/* ============================================================
   AILEENN_Manager — Dark Enterprise Theme
   Top Navigation with Dropdown Menus
   ============================================================ */

/* ==========  1. CSS VARIABLES / DESIGN TOKENS  ========== */

:root {
    /* Backgrounds */
    --bg-primary:     #0a0e17;
    --bg-secondary:   #111827;
    --bg-card:        #1a2332;
    --bg-input:       #0d1117;
    --bg-header:      #0c1220;
    --bg-footer:      #0c1220;
    --bg-dropdown:    #131b2a;
    --bg-overlay:     rgba(0, 0, 0, 0.65);

    /* Accent colours */
    --accent:         #00d4ff;
    --accent-hover:   #00b8e6;
    --accent-green:   #00ff88;
    --accent-red:     #ff4757;
    --accent-yellow:  #ffc107;
    --accent-orange:  #ff8c00;
    --accent-purple:  #a855f7;

    /* Text */
    --text-primary:   #e0e6ed;
    --text-secondary: #8892a0;
    --text-muted:     #5a6270;
    --text-inverse:   #0a0e17;

    /* Borders */
    --border:         #2a3444;
    --border-active:  #00d4ff;

    /* Sizing */
    --header-height:  52px;
    --footer-height:  36px;
    --radius:         6px;
    --radius-lg:      10px;

    /* Transitions */
    --transition-fast: 0.18s ease;
    --transition-std:  0.28s ease;

    /* Shadows */
    --shadow-card:     0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-dropdown: 0 8px 32px rgba(0, 0, 0, 0.55);
    --shadow-glow:     0 0 20px rgba(0, 212, 255, 0.15);
}


/* ==========  2. RESET & BASE  ========== */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--accent-hover); }

ul { list-style: none; }

img { max-width: 100%; }


/* ==========  3. APP LAYOUT  ========== */

.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}


/* ==========  4. TOP HEADER / NAVIGATION BAR  ========== */

.top-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    gap: 8px;
}

/* Brand */
.nav-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 16px;
    border-right: 1px solid var(--border);
    white-space: nowrap;
    flex-shrink: 0;
}

.brand-logo {
    font-size: 22px;
    color: var(--accent);
    line-height: 1;
}

.brand-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

/* Main nav */
.main-nav {
    flex: 1;
    overflow: visible;
}

.nav-menu {
    display: flex;
    align-items: center;
    height: var(--header-height);
    gap: 0;
}

.nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 12px;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: color var(--transition-fast), background var(--transition-fast);
    cursor: pointer;
}

.nav-link:hover,
.nav-item:hover > .nav-link {
    color: var(--accent);
    background: rgba(0, 212, 255, 0.06);
}

/* Dropdown arrow indicator */
.has-dropdown > .nav-link::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 5px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid currentColor;
    transition: transform var(--transition-fast);
}

.has-dropdown:hover > .nav-link::after {
    transform: rotate(180deg);
}


/* ==========  5. DROPDOWN MENUS  ========== */

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--bg-dropdown);
    border: 1px solid var(--border);
    border-top: 2px solid var(--accent);
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: var(--shadow-dropdown);
    padding: 6px 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
    z-index: 2000;
}

.has-dropdown:hover > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Wide dropdown (2 columns) */
.dropdown-wide {
    min-width: 440px;
}

.dropdown-columns {
    display: flex;
    gap: 0;
}

.dropdown-col {
    flex: 1;
    padding: 0;
    min-width: 200px;
}

.dropdown-col + .dropdown-col {
    border-left: 1px solid var(--border);
}

/* Dropdown items */
.dropdown-item {
    display: block;
    padding: 8px 16px;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    transition: background var(--transition-fast), color var(--transition-fast), padding-left var(--transition-fast);
}

.dropdown-item:hover {
    background: rgba(0, 212, 255, 0.08);
    color: var(--text-primary);
    padding-left: 20px;
}

/* Section label */
.dropdown-label {
    display: block;
    padding: 8px 16px 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--accent);
    pointer-events: none;
}

/* Dashboard / KPI items */
.dropdown-item.item-dashboard {
    color: var(--accent);
    font-weight: 600;
    border-top: none;
}

.dropdown-item.item-dashboard:hover {
    background: rgba(0, 212, 255, 0.12);
    color: var(--accent-hover);
}

/* Cross-module connection items */
.dropdown-item.item-connection {
    color: var(--accent-purple);
    font-style: italic;
}

.dropdown-item.item-connection::before {
    content: '\2197 ';
    font-style: normal;
}

.dropdown-item.item-connection:hover {
    color: #c084fc;
    background: rgba(168, 85, 247, 0.08);
}

/* Divider */
.dropdown-divider {
    height: 1px;
    margin: 4px 12px;
    background: var(--border);
}


/* ==========  6. NAV RIGHT (3D btn, user, logout)  ========== */

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    margin-left: auto;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}

.btn-3d-manager {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(168, 85, 247, 0.15));
    border: 1px solid rgba(0, 212, 255, 0.3);
    border-radius: var(--radius);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.btn-3d-manager:hover {
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(168, 85, 247, 0.25));
    border-color: var(--accent);
    box-shadow: var(--shadow-glow);
    color: #fff;
}

.btn-3d-icon {
    font-size: 16px;
    animation: pulse3d 2s ease-in-out infinite;
}

@keyframes pulse3d {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.user-info {
    display: flex;
    align-items: center;
}

.user-name {
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
}

.btn-logout {
    padding: 5px 12px;
    background: rgba(255, 71, 87, 0.12);
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: var(--radius);
    color: var(--accent-red);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(255, 71, 87, 0.25);
    border-color: var(--accent-red);
    color: #fff;
}


/* ==========  7. MAIN CONTENT  ========== */

.main-content {
    flex: 1;
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height) - var(--footer-height));
}


/* ==========  8. FOOTER  ========== */

.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--footer-height);
    padding: 0 24px;
    background: var(--bg-footer);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
}


/* ==========  9. CARDS / TILES  ========== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    transition: border-color var(--transition-std), box-shadow var(--transition-std);
}

.card:hover {
    border-color: var(--border-active);
    box-shadow: var(--shadow-glow);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

/* Module tiles for dashboard */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.module-tile {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all var(--transition-std);
    text-decoration: none;
    color: inherit;
    position: relative;
    overflow: hidden;
}

.module-tile::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--tile-accent, var(--accent));
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.module-tile:hover {
    border-color: var(--tile-accent, var(--accent));
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.module-tile:hover::before {
    opacity: 1;
}

.tile-icon {
    font-size: 28px;
    margin-bottom: 12px;
    color: var(--tile-accent, var(--accent));
}

.tile-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.tile-description {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.tile-count {
    margin-top: auto;
    padding-top: 12px;
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}


/* ==========  10. BUTTONS  ========== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--text-inverse);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}
.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
}

.btn-danger {
    background: rgba(255, 71, 87, 0.12);
    color: var(--accent-red);
    border-color: rgba(255, 71, 87, 0.3);
}
.btn-danger:hover {
    background: rgba(255, 71, 87, 0.25);
    border-color: var(--accent-red);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}


/* ==========  11. FORMS  ========== */

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.12);
}

.form-control::placeholder {
    color: var(--text-muted);
}


/* ==========  12. LOGIN PAGE  ========== */

.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-primary);
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 440px;
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand-icon {
    font-size: 48px;
    color: var(--accent);
    display: block;
    margin-bottom: 12px;
}

.login-brand h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.login-brand p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* Login tabs */
.login-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
}

.login-tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
}

.login-tab:hover {
    color: var(--text-secondary);
    background: rgba(0, 212, 255, 0.04);
}

.login-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.login-panel {
    display: none;
    padding: 28px;
}

.login-panel.active {
    display: block;
}

.login-btn {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
}

.login-footer {
    text-align: center;
    padding: 16px 28px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.login-error {
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(255, 71, 87, 0.1);
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: var(--radius);
    color: var(--accent-red);
    font-size: 13px;
    display: none;
}

.login-error.visible {
    display: block;
}


/* ==========  13. 3D MANAGER PAGE  ========== */

.manager3d-content {
    padding: 0 !important;
    position: relative;
    overflow: hidden;
    height: calc(100vh - var(--header-height) - var(--footer-height));
}

.canvas-container {
    width: 100%;
    height: 100%;
    position: relative;
}

#threejs-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Info panel overlay */
.module-info-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 280px;
    background: rgba(19, 27, 42, 0.92);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dropdown);
    padding: 0;
    opacity: 0;
    transform: translateX(10px);
    transition: all var(--transition-std);
    pointer-events: none;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100;
}

.module-info-panel.visible {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

.tabs-nav {
    display: flex;
    overflow-x: auto;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
    gap: 0;
}

    .tabs-nav::-webkit-scrollbar {
        display: none;
    }

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    font-family: var(--font-main);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    letter-spacing: .2px;
}

    .tab-btn:hover {
        color: var(--text-primary);
        background: rgba(255,255,255,.03);
    }

    .tab-btn.active {
        color: var(--teal);
        border-bottom-color: var(--teal);
        background: var(--teal-glow);
    }

    .tab-btn i {
        font-size: 13px;
    }


.tab-pane {
    display: none;
    padding: 28px;
}

    .tab-pane.active {
        display: block;
    }

.info-panel-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-panel-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.info-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.info-panel-items {
    padding: 8px 0;
    max-height: 300px;
    overflow-y: auto;
}

.info-panel-item {
    display: block;
    padding: 7px 16px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.info-panel-item:hover {
    background: rgba(0, 212, 255, 0.08);
    color: var(--text-primary);
    padding-left: 20px;
}

.info-panel-footer {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.info-panel-footer a {
    font-size: 12px;
    font-weight: 600;
}

/* 3D Manager instructions overlay */
.canvas-instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(19, 27, 42, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 20px;
    font-size: 12px;
    color: var(--text-secondary);
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    white-space: nowrap;
    z-index: 100;
}

/* Legend panel */
.canvas-legend {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(19, 27, 42, 0.85);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100;
}

.legend-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--accent);
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color var(--transition-fast);
}

.legend-item:hover {
    color: var(--text-primary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}


/* ==========  14. PAGE HEADER  ========== */

.page-header {
    margin-bottom: 24px;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}


/* ==========  15. DASHBOARD STATS  ========== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    transition: border-color var(--transition-fast);
}

.stat-card:hover {
    border-color: var(--border-active);
}

.stat-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-change {
    font-size: 11px;
    margin-top: 4px;
}

.stat-change.positive { color: var(--accent-green); }
.stat-change.negative { color: var(--accent-red); }


/* ==========  16. TABLES  ========== */

.table-container {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    text-align: left;
    white-space: nowrap;
}

tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

tbody tr:hover {
    background: rgba(0, 212, 255, 0.03);
}

tbody tr:last-child td {
    border-bottom: none;
}


/* ==========  17. STATUS BADGES  ========== */

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.badge-active   { background: rgba(0, 255, 136, 0.12); color: var(--accent-green); }
.badge-warning  { background: rgba(255, 193, 7, 0.12); color: var(--accent-yellow); }
.badge-danger   { background: rgba(255, 71, 87, 0.12); color: var(--accent-red); }
.badge-info     { background: rgba(0, 212, 255, 0.12); color: var(--accent); }


/* ==========  18. SCROLLBAR  ========== */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}


/* ==========  19. MOBILE / RESPONSIVE  ========== */

.mobile-nav-checkbox {
    display: none;
}

.mobile-nav-overlay {
    display: none;
}

.hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 28px;
    height: 28px;
    cursor: pointer;
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: all var(--transition-fast);
}

@media (max-width: 1280px) {
    .nav-link {
        padding: 0 8px;
        font-size: 12px;
    }

    .btn-3d-manager {
        font-size: 11px;
        padding: 5px 10px;
    }

    .user-name {
        display: none;
    }
}

@media (max-width: 1024px) {
    .hamburger {
        display: flex;
    }

    .main-nav {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-header);
        z-index: 999;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform var(--transition-std);
    }

    .mobile-nav-checkbox:checked ~ .app-layout .main-nav,
    .mobile-nav-checkbox:checked ~ .main-nav {
        transform: translateX(0);
    }

    .nav-menu {
        flex-direction: column;
        height: auto;
        padding: 8px 0;
    }

    .nav-item {
        width: 100%;
        height: auto;
        flex-direction: column;
    }

    .nav-link {
        width: 100%;
        padding: 12px 20px;
        justify-content: space-between;
    }

    .dropdown-menu,
    .dropdown-wide {
        position: static;
        min-width: 100%;
        opacity: 1;
        visibility: visible;
        transform: none;
        border: none;
        border-top: none;
        border-radius: 0;
        box-shadow: none;
        background: rgba(0, 0, 0, 0.2);
        display: none;
        padding: 0;
    }

    .has-dropdown:hover > .dropdown-menu {
        display: block;
    }

    .dropdown-columns {
        flex-direction: column;
    }

    .dropdown-col + .dropdown-col {
        border-left: none;
        border-top: 1px solid var(--border);
    }

    .dropdown-item {
        padding-left: 36px;
    }

    .dropdown-item:hover {
        padding-left: 40px;
    }

    .mobile-nav-overlay {
        display: block;
    }

    .mobile-nav-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-overlay);
        z-index: 998;
        display: none;
    }

    .mobile-nav-checkbox:checked ~ .mobile-nav-overlay .mobile-nav-backdrop {
        display: block;
    }

    .btn-3d-manager span:not(.btn-3d-icon) {
        display: none;
    }
}


/* ==========  20. UTILITIES  ========== */

.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-accent  { color: var(--accent); }
.text-success { color: var(--accent-green); }
.text-danger  { color: var(--accent-red); }
.text-warning { color: var(--accent-yellow); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex     { display: flex; }
.gap-1      { gap: 8px; }
.gap-2      { gap: 16px; }
.flex-wrap  { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

.hidden { display: none !important; }

/* KPI large cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    position: relative;
    overflow: hidden;
}

    .kpi-card::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3px;
        background: var(--kpi-accent, var(--accent));
    }

    .kpi-card:hover {
        border-color: var(--kpi-accent, var(--accent));
        box-shadow: 0 0 16px rgba(0, 212, 255, 0.1);
    }

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    line-height: 1.2;
}

.kpi-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.kpi-trend {
    font-size: 11px;
    margin-top: 6px;
}

    .kpi-trend.positive {
        color: var(--accent-green);
    }

    .kpi-trend.negative {
        color: var(--accent-red);
    }

    .kpi-trend.neutral {
        color: var(--accent-yellow);
    }


/* ============================================================
   LIGHT THEME  —  activated by <html data-theme="light">
   Overrides the design-token variables; every page/module that
   uses var(--token) follows automatically.
   ============================================================ */
:root[data-theme="light"] {
    /* Backgrounds */
    --bg-primary:     #f4f6fb;
    --bg-secondary:   #ffffff;
    --bg-card:        #ffffff;
    --bg-input:       #f1f4f9;
    --bg-header:      #ffffff;
    --bg-footer:      #eef2f8;
    --bg-dropdown:    #ffffff;
    --bg-overlay:     rgba(15, 23, 42, 0.45);

    /* Accent colours (darkened for contrast on light backgrounds) */
    --accent:         #0891b2;
    --accent-hover:   #0e7490;
    --accent-green:   #16a34a;
    --accent-red:     #e11d48;
    --accent-yellow:  #b45309;
    --accent-orange:  #ea580c;
    --accent-purple:  #7c3aed;

    /* Text */
    --text-primary:   #0f1a2e;
    --text-secondary: #55627a;
    --text-muted:     #8593a8;
    --text-inverse:   #ffffff;

    /* Borders */
    --border:         #dbe3ef;
    --border-active:  #0891b2;

    /* Shadows */
    --shadow-card:     0 2px 10px rgba(15, 26, 46, 0.08);
    --shadow-dropdown: 0 8px 32px rgba(15, 26, 46, 0.16);
    --shadow-glow:     0 0 20px rgba(8, 145, 178, 0.12);
}

/* A few spots use hard-coded dark values or translucent white overlays that
   need a light-mode nudge for legibility. */
:root[data-theme="light"] body { background: var(--bg-primary); color: var(--text-primary); }
:root[data-theme="light"] .badge-active  { background: rgba(22, 163, 74, 0.12); }
:root[data-theme="light"] .badge-warning { background: rgba(180, 83, 9, 0.12); }
:root[data-theme="light"] .badge-danger  { background: rgba(225, 29, 72, 0.12); }
:root[data-theme="light"] .badge-info    { background: rgba(8, 145, 178, 0.12); }

/* Global theme/lang toggle buttons in the header */
.hdr-toggle {
    cursor: pointer;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius);
    height: 30px;
    min-width: 34px;
    padding: 0 9px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color var(--transition-fast), color var(--transition-fast);
}
.hdr-toggle:hover { border-color: var(--accent); color: var(--accent); }
