:root {
    --sidebar-bg: #1B2A4A;
    --sidebar-hover: #243860;
    --sidebar-active: #0d6efd;
    --sidebar-text: #c8d6e8;
    --header-height: 60px;
    --sidebar-width: 250px;
}

body {
    font-family: 'Segoe UI', sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
}

/* ── Sidebar ── */
#sidebar {
    width: var(--sidebar-width);
    height: 100vh;              /* fixed panel: scroll inside it, not the page */
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;           /* long menus (many branches/reports) stay reachable */
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.28) transparent;
    padding-bottom: 12px;
}

/* Slim scrollbar so it does not fight the dark panel */
#sidebar::-webkit-scrollbar { width: 8px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.22);
    border-radius: 4px;
}
#sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.4); }

#sidebar .sidebar-brand {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

#sidebar .sidebar-brand h5 {
    color: #fff;
    font-weight: 700;
    margin: 0;
    font-size: 1.1rem;
}

#sidebar .sidebar-brand small {
    color: var(--sidebar-text);
    font-size: 0.72rem;
}

#sidebar .nav-link {
    color: var(--sidebar-text);
    padding: 10px 20px;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

#sidebar .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

#sidebar .nav-link.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

#sidebar .nav-section {
    padding: 16px 20px 6px;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(200,214,232,0.5);
}

#sidebar .nav-link i {
    width: 18px;
    text-align: center;
}

/* ── Main content ── */
#main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* ── Top navbar ── */
#topnav {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid #e0e6ed;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

#topnav .page-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1B2A4A;
}

#topnav .user-info {
    font-size: 0.85rem;
    color: #555;
}

/* ── Content area ── */
.content-area {
    padding: 24px;
}

/* ── Cards ── */
.stat-card {
    border: none;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
}

.stat-card .stat-icon {
    width: 52px; height: 52px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}

.stat-card .stat-value { font-size: 1.15rem; font-weight: 700; line-height: 1; }
.stat-card .stat-label { font-size: 0.78rem; color: #888; margin-top: 4px; }

/* ── Tables ── */
.table-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    overflow: hidden;
}

.table-card .card-header {
    background: #fff;
    border-bottom: 1px solid #e8edf2;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1B2A4A;
}

.table thead th {
    background: #f8fafc;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7a8d;
    border-bottom: 1px solid #e8edf2;
    font-weight: 600;
    padding: 12px 16px;
}

.table tbody td {
    padding: 12px 16px;
    font-size: 0.88rem;
    vertical-align: middle;
    border-bottom: 1px solid #f0f3f6;
    color: #374151;
}

.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ── Forms ── */
.form-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    padding: 28px;
}

.form-label { font-size: 0.85rem; font-weight: 600; color: #374151; }

.form-control, .form-select {
    font-size: 0.88rem;
    border-color: #d1dbe8;
    border-radius: 6px;
    padding: 8px 12px;
}

.form-control:focus, .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 3px rgba(13,110,253,0.12);
}

/* ── Login page ── */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1B2A4A 0%, #243860 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-card .brand { text-align: center; margin-bottom: 28px; }
.login-card .brand h4 { font-weight: 700; color: #1B2A4A; }
.login-card .brand p { font-size: 0.82rem; color: #888; }

/* ── Badges ── */
.badge { font-size: 0.72rem; padding: 4px 8px; border-radius: 4px; }

/* ── Progress stages ── */
.stage-list { list-style: none; padding: 0; margin: 0; }
.stage-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f3f6;
    position: relative;
}
.stage-item:last-child { border-bottom: none; }

.stage-dot {
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem; font-weight: 700;
    flex-shrink: 0; margin-top: 2px;
}
.stage-dot.done    { background: #198754; color: #fff; }
.stage-dot.active  { background: #0d6efd; color: #fff; }
.stage-dot.pending { background: #e9ecef; color: #aaa; }

.stage-info .stage-name { font-weight: 600; font-size: 0.88rem; color: #1B2A4A; }
.stage-info .stage-meta { font-size: 0.78rem; color: #888; }

/* ── Responsive ── */
@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.show { transform: translateX(0); }
    #main-content { margin-left: 0; }
    .content-area { padding: 16px; }
}

/* ── Misc ── */
.btn { font-size: 0.85rem; border-radius: 6px; }
.btn-sm { font-size: 0.78rem; }
.page-link { font-size: 0.83rem; }
.alert { font-size: 0.87rem; border-radius: 8px; }
.section-divider { border-top: 1px solid #e8edf2; margin: 20px 0; }
