:root {
    --primary: #1f4a8f;
    --primary-dark: #17366a;
    --primary-soft: rgba(31, 74, 143, .10);
    --sidebar: #0e1b35;
    --sidebar-soft: rgba(255,255,255,.08);
    --text: #172033;
    --muted: #6b778c;
    --bg: #f4f7fb;
    --card: #ffffff;
    --border: #e7edf5;
    --success: #12b76a;
    --warning: #f5a524;
    --danger: #ef4444;
    --shadow: 0 16px 40px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background: linear-gradient(180deg, #f7f9fc 0%, #eef3f9 100%);
}

a { text-decoration: none; }

.app-shell { overflow-x: hidden; }
.app-wrapper { display: flex; min-height: 100vh; }
.app-backdrop {
    position: fixed; inset: 0; background: rgba(8, 15, 30, .45);
    opacity: 0; visibility: hidden; transition: .2s ease; z-index: 1020;
}
.app-backdrop.show { opacity: 1; visibility: visible; }

.sidebar {
    width: 290px;
    background: linear-gradient(180deg, #112347 0%, #0b1630 100%);
    color: #fff;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* ADD THIS */
    z-index: 1030;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 10px 18px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
    width: 50px;
    height: 50px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.12);
    font-size: 1.25rem;
}
.brand-title { font-size: 1.15rem; font-weight: 800; letter-spacing: .02em; }
.brand-subtitle { color: rgba(255,255,255,.66); font-size: .84rem; }
.sidebar-section-title {
    color: rgba(255,255,255,.45);
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
    padding: 14px 10px 8px;
}

.nav-theme .nav-link {
    color: rgba(255,255,255,.82);
    border-radius: 16px;
    padding: 12px 14px;
    display: flex;
    gap: 12px;
    align-items: center;
    font-weight: 600;
    margin-bottom: 8px;
    transition: .18s ease;
}
.nav-theme .nav-link:hover,
.nav-theme .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,.11);
    transform: translateX(2px);
}

.sidebar-footer {
    border: 1px solid rgba(255,255,255,.09);
    background: rgba(255,255,255,.06);
    border-radius: 20px;
    padding: 16px;
    margin-top: auto;
    padding-top: 20px;
}

.main-panel { flex: 1; min-width: 0; }
.topbar {
    height: 86px;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 1010;
}
.page-eyebrow {
    font-size: .78rem;
    font-weight: 800;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: .08em;
}
.page-title { font-size: 1.4rem; font-weight: 800; }
.content-area { padding: 28px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.search-shell {
    display: flex; align-items: center; gap: 10px;
    min-width: 320px; background: #fff; border: 1px solid var(--border);
    border-radius: 16px; padding: 0 14px; height: 48px;
}
.search-shell i { color: var(--muted); }
.search-shell input {
    border: 0; outline: 0; width: 100%; background: transparent; color: var(--text);
}
.btn-icon {
    width: 44px; height: 44px; border-radius: 14px; display: inline-grid; place-items: center;
}
.notification-dot {
    width: 10px; height: 10px; border-radius: 50%; background: var(--danger);
    position: absolute; top: 10px; right: 11px; border: 2px solid #fff;
}
.user-chip {
    background: #fff; border: 1px solid var(--border); border-radius: 18px;
    padding: 8px 12px; display: flex; align-items: center; gap: 10px;
}
.avatar, .profile-avatar {
    width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary), #4d74c5); color: #fff; font-weight: 700;
}
.profile-avatar { width: 86px; height: 86px; font-size: 1.4rem; margin: 0 auto 1rem; }

.hero-card, .metric-card, .panel-card, .construction-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
}
.hero-card {
    padding: 28px; display: flex; justify-content: space-between; gap: 22px; align-items: center;
    background: linear-gradient(135deg, #17366a 0%, #1f4a8f 55%, #2d64bf 100%);
    color: #fff;
}
.hero-badge {
    display: inline-flex; align-items: center; padding: .42rem .78rem;
    border-radius: 999px; background: rgba(255,255,255,.12); font-weight: 700; font-size: .78rem;
}
.hero-title { margin: 14px 0 10px; font-size: 1.85rem; font-weight: 800; max-width: 700px; }
.hero-text { color: rgba(255,255,255,.85); max-width: 640px; }
.hero-stats {
    display: grid; grid-template-columns: repeat(2, minmax(120px, 1fr)); gap: 12px; min-width: 270px;
}
.hero-stats > div {
    background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.08);
    border-radius: 20px; padding: 18px;
}
.hero-stat-value { font-size: 1.6rem; font-weight: 800; }
.hero-stat-label { color: rgba(255,255,255,.76); font-size: .9rem; }

.metric-card { padding: 22px; }
.metric-icon {
    width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center;
    font-size: 1.2rem; margin-bottom: 16px;
}
.metric-icon.primary { background: rgba(31,74,143,.12); color: var(--primary); }
.metric-icon.success { background: rgba(18,183,106,.12); color: var(--success); }
.metric-icon.warning { background: rgba(245,165,36,.14); color: #ae6b00; }
.metric-icon.danger { background: rgba(239,68,68,.12); color: var(--danger); }
.metric-value { font-size: 1.9rem; font-weight: 800; }
.metric-label { color: var(--muted); font-weight: 600; }
.metric-change { margin-top: 10px; font-size: .9rem; font-weight: 600; }

.panel-card { padding: 24px; }
.panel-header { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.chart-lg { min-height: 360px; }
.chart-md { min-height: 320px; }
.quick-link {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    border: 1px solid var(--border); padding: 16px 18px; border-radius: 18px;
    color: var(--text); font-weight: 700; background: #fff; transition: .18s ease;
}
.quick-link:hover { border-color: #cdd8ea; color: var(--primary); transform: translateY(-1px); }

.form-label { font-weight: 700; margin-bottom: .55rem; }
.form-control-modern, .form-select.form-control-modern {
    min-height: 50px; border-radius: 16px; border: 1px solid #dbe4f0; padding: .82rem 1rem;
    box-shadow: none !important;
}
textarea.form-control-modern { min-height: 140px; }
.form-control-modern:focus, .form-select.form-control-modern:focus {
    border-color: rgba(31,74,143,.45);
    box-shadow: 0 0 0 4px rgba(31,74,143,.08) !important;
}
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

.theme-table thead th {
    color: var(--muted); font-size: .78rem; text-transform: uppercase;
    letter-spacing: .06em; border-bottom-width: 1px; white-space: nowrap;
}
.theme-table td, .theme-table th { padding: 1rem .9rem; border-color: #edf2f8; }
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border: 1px solid #dbe4f0; border-radius: 12px; padding: .35rem .7rem;
}

.badge-soft {
    border-radius: 999px; padding: .42rem .78rem; font-weight: 700; font-size: .78rem;
}
.badge-soft.success { background: rgba(18,183,106,.12); color: var(--success); }
.badge-soft.warning { background: rgba(245,165,36,.14); color: #a86600; }
.badge-soft.danger { background: rgba(239,68,68,.12); color: var(--danger); }

.progress-thin { height: 8px; border-radius: 999px; background: #edf2f8; }
.progress-thin .progress-bar { background: var(--primary); border-radius: 999px; }

.timeline { position: relative; margin-left: 10px; }
.timeline:before {
    content: ''; position: absolute; left: 14px; top: 0; bottom: 0; width: 2px; background: #e8edf6;
}
.timeline-item { position: relative; padding-left: 46px; margin-bottom: 26px; }
.timeline-marker {
    width: 16px; height: 16px; border-radius: 50%; position: absolute; left: 7px; top: 5px;
    background: var(--primary);
}
.timeline-marker.success { background: var(--success); }
.timeline-marker.warning { background: var(--warning); }
.timeline-marker.danger { background: var(--danger); }
.timeline-title { font-weight: 800; margin-bottom: 4px; }
.timeline-content p { margin-bottom: 0; color: var(--text); }

.notification-list { display: grid; gap: 16px; }
.notification-item {
    border: 1px solid var(--border); border-radius: 18px; padding: 18px; display: flex; gap: 14px; align-items: center;
}
.notification-icon {
    width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary);
}
.notification-icon.warning { background: rgba(245,165,36,.14); color: #a86600; }
.notification-icon.success { background: rgba(18,183,106,.12); color: var(--success); }

.insight-item, .settings-item, .faq-item, .mini-card {
    border: 1px solid var(--border); border-radius: 18px; background: #fff;
}
.insight-item {
    display: flex; gap: 14px; align-items: flex-start; padding: 16px; margin-bottom: 12px;
}
.insight-dot {
    width: 14px; height: 14px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0;
}
.insight-dot.success { background: var(--success); }
.insight-dot.warning { background: var(--warning); }

.settings-list { display: grid; gap: 14px; }
.settings-item {
    padding: 18px; display: flex; justify-content: space-between; align-items: center; gap: 18px;
}
.faq-item { padding: 16px; margin-bottom: 12px; }
.mini-card { padding: 18px; font-weight: 700; text-align: center; }
.profile-stat-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 20px;
}
.profile-stat-grid div { background: var(--bg); border-radius: 18px; padding: 14px; }
.profile-stat-grid strong { display: block; font-size: 1.1rem; }
.profile-stat-grid span { color: var(--muted); font-size: .9rem; }

.construction-shell { min-height: calc(100vh - 190px); display: grid; place-items: center; }
.construction-card {
    max-width: 720px; width: 100%; text-align: center; padding: 56px 40px;
}
.construction-icon {
    width: 82px; height: 82px; margin: 0 auto 1.4rem; border-radius: 24px;
    display: grid; place-items: center; font-size: 2rem;
    background: rgba(31,74,143,.12); color: var(--primary);
}
.construction-icon.danger { background: rgba(239,68,68,.12); color: var(--danger); }

.auth-body {
    min-height: 100vh;
    background: radial-gradient(circle at top right, rgba(31,74,143,.18), transparent 30%), linear-gradient(180deg, #eff4fb 0%, #f8fbff 100%);
}
.auth-shell {
    min-height: 100vh; padding: 28px; display: grid; place-items: center;
}
.auth-card-wrap {
    display: grid; grid-template-columns: 1.05fr .95fr; width: min(1180px, 100%);
    border-radius: 30px; overflow: hidden; background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow);
}
.auth-card-wrap-wide { grid-template-columns: 1fr 1fr; }
.auth-side {
    padding: 56px; color: #fff; background: linear-gradient(135deg, #17366a 0%, #1f4a8f 60%, #2d64bf 100%);
}
.auth-badge {
    display: inline-flex; padding: .42rem .75rem; border-radius: 999px; background: rgba(255,255,255,.12);
    font-size: .78rem; font-weight: 800; margin-bottom: 20px;
}
.auth-side h2 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.auth-side p { color: rgba(255,255,255,.85); max-width: 450px; }
.auth-features { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.auth-features li { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.95); }
.auth-card { padding: 48px; background: #fff; }
.auth-logo {
    width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px;
    background: var(--primary-soft); color: var(--primary); font-size: 1.4rem; margin-bottom: 18px;
}
.auth-footer a { font-weight: 700; }

@media (max-width: 1199px) {
    .sidebar {
        position: fixed; left: -310px; transition: .2s ease;
    }
    .sidebar.show { left: 0; }
    .hero-card { flex-direction: column; align-items: flex-start; }
    .hero-stats { width: 100%; }
}

@media (max-width: 991px) {
    .content-area { padding: 20px; }
    .topbar { padding: 0 18px; }
    .auth-card-wrap, .auth-card-wrap-wide { grid-template-columns: 1fr; }
    .auth-side { display: none; }
}

@media (max-width: 575px) {
    .page-title { font-size: 1.15rem; }
    .hero-title { font-size: 1.5rem; }
    .panel-card, .metric-card, .construction-card { border-radius: 22px; }
    .construction-card { padding: 42px 22px; }
    .auth-card, .auth-shell { padding: 20px; }
}

/* =================================
   SIDEBAR FOOTER FIX
================================= */

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
}

    /* override bootstrap text-muted */
    .sidebar-footer .text-muted {
        color: rgba(255,255,255,0.65) !important;
    }

    /* ensure white heading */
    .sidebar-footer .text-white {
        color: #ffffff !important;
    }

    /* optional spacing */
    .sidebar-footer .fw-semibold {
        font-weight: 600;
    }

    /* Sidebar footer text */

    .sidebar-footer .footer-label {
        color: rgba(255,255,255,0.65);
        font-size: 13px;
    }

    .sidebar-footer .footer-title {
        color: #ffffff;
        font-weight: 600;
        font-size: 14px;
        line-height: 1.3;
    }

.sidebar {
    scrollbar-width: thin;
}

    .sidebar::-webkit-scrollbar {
        width: 6px;
    }

    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.2);
        border-radius: 10px;
    }

.input-validation-error {
    border-color: #dc3545;
}

.field-validation-error {
    font-size: 0.875rem;
    margin-top: 4px;
}

.input-validation-error {
    border-color: #dc3545;
    background-image: url("data:image/svg+xml,...");
}