/* ==========================================================================
   ITN EasyProjects - Enterprise SaaS Dashboard Layout, Tables & Charts
   ========================================================================== */

.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-sidebar {
    width: 262px;
    flex-shrink: 0;
    background: var(--bg-sidebar);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 18px 18px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-brand .brand-logo { color: #ffffff; }
.sidebar-close-btn { display: none; font-size: 24px; cursor: pointer; color: #cbd5e1; }

.sidebar-nav {
    padding: 12px 10px;
    flex: 1;
}

.nav-group-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    padding: 12px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 7px;
    color: #cbd5e1;
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background-color 0.14s ease, color 0.14s ease;
}
.nav-item:hover {
    background: var(--bg-sidebar-hover);
    color: #ffffff;
    text-decoration: none;
}
.nav-item.active {
    background: #1d4ed8;
    color: #ffffff;
    font-weight: 600;
}
.nav-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    opacity: 0.9;
}

.sidebar-footer {
    padding: 12px 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-version {
    font-size: 11px;
    color: #64748b;
    padding: 0 12px 8px;
}
.nav-logout { color: #fca5a5; }

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.sidebar-trigger {
    display: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}
.topbar-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.topbar-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 11px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface-alt);
    color: var(--text-primary);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}
.icon-btn:hover { text-decoration: none; border-color: var(--border-strong); }

.licence-pill {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
}
.pill-ok { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.pill-warn { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.pill-danger { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger-border); }

.notif-dropdown { position: relative; }
.notif-dropdown summary::-webkit-details-marker { display: none; }
.notif-count {
    background: #dc2626;
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
}
.notif-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: 330px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 50;
    overflow: hidden;
}
.notif-panel-head {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
}
.notif-item {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}
.notif-item.unread { background: var(--brand-soft); }
.notif-item:hover { background: var(--bg-surface-alt); text-decoration: none; }
.notif-title { font-weight: 600; font-size: 12.5px; }
.notif-msg { font-size: 12px; color: var(--text-secondary); margin: 2px 0; }
.notif-time { font-size: 11px; color: var(--text-muted); }
.notif-empty { padding: 18px; text-align: center; color: var(--text-muted); font-size: 12.5px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-surface-alt);
}
.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: var(--brand-primary);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-name { font-size: 12.5px; font-weight: 700; line-height: 1.2; }
.user-role { font-size: 11px; color: var(--text-muted); }

.app-content {
    padding: 24px;
    flex: 1;
}

.app-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

/* KPI Grid & Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}
.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}
.kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.kpi-value {
    font-size: 26px;
    font-weight: 800;
    margin: 6px 0 4px;
    font-variant-numeric: tabular-nums;
}
.kpi-sub { font-size: 12px; color: var(--text-secondary); }

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.card-title { font-size: 15px; font-weight: 700; margin: 0; }
.card-body { padding: 18px; }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

/* Tables */
.table-wrap { width: 100%; overflow-x: auto; }
table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th, .data-table td {
    padding: 11px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
}
.data-table th {
    background: var(--bg-surface-alt);
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.data-table tbody tr:hover { background: var(--bg-surface-alt); }

/* Filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}
.filter-bar input, .filter-bar select { width: auto; min-width: 170px; }

/* Native HTML/CSS Charts & Progress Bars */
.progress-track {
    width: 100%;
    height: 8px;
    background: var(--bg-surface-alt);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #0d9488);
}
.progress-fill.warn { background: #d97706; }
.progress-fill.danger { background: #dc2626; }

.css-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.css-bar-row {
    display: grid;
    grid-template-columns: 150px 1fr 75px;
    gap: 12px;
    align-items: center;
    font-size: 12.5px;
}
.css-bar-label {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.css-bar-track {
    height: 16px;
    background: var(--bg-surface-alt);
    border-radius: 4px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.css-bar-val {
    height: 100%;
    background: linear-gradient(90deg, #1d4ed8, #0f766e);
}
.css-bar-num {
    text-align: right;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* 4-Stage Approval Stepper */
.stepper {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 14px 0;
}
.step-box {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: var(--bg-surface-alt);
}
.step-box.done {
    border-color: var(--success-border);
    background: var(--success-bg);
}
.step-box.current {
    border-color: var(--brand-primary);
    background: var(--brand-soft);
}
.step-box.rejected {
    border-color: var(--danger-border);
    background: var(--danger-bg);
}
.step-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; }
.step-sub { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }

.evidence-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 10px;
}
.evidence-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    background: var(--bg-surface-alt);
    font-size: 11.5px;
}
.evidence-card img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    border-radius: 4px;
    margin-bottom: 6px;
}

/* Internal Team Chat */
.chat-layout {
    display: grid;
    grid-template-columns: 290px 1fr;
    gap: 18px;
    align-items: start;
}
.chat-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    max-height: 76vh;
    overflow-y: auto;
}
.chat-section-head {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: var(--bg-surface-alt);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}
.chat-section-head:first-child { border-top: none; }
.chat-channel-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13px;
}
.chat-channel-item:hover {
    background: var(--bg-surface-alt);
    text-decoration: none;
}
.chat-channel-item.active {
    background: var(--brand-soft);
    border-left: 3px solid var(--brand-primary);
    font-weight: 600;
}
.chat-channel-meta {
    font-size: 11px;
    color: var(--text-muted);
    display: block;
}
.chat-thread-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    min-height: 70vh;
    max-height: 78vh;
    overflow: hidden;
}
.chat-msg-list {
    flex: 1;
    padding: 18px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-surface-alt);
}
.chat-bubble {
    max-width: 78%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    align-self: flex-start;
    box-shadow: var(--shadow-sm);
}
.chat-bubble.mine {
    align-self: flex-end;
    background: var(--brand-soft);
    border-color: var(--brand-primary);
}
.chat-bubble-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    margin-bottom: 5px;
}
.chat-bubble-body {
    font-size: 13.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}
.chat-bubble-att {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-color);
    font-size: 12px;
}
.chat-composer {
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface);
}
.chat-composer-row {
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.chat-composer-row textarea {
    flex: 1;
    min-width: 240px;
    min-height: 54px;
    max-height: 120px;
    resize: vertical;
}

