/* ============================================================
   AETRAM BULLION ERP - Main Theme Stylesheet
   ============================================================ */

:root {
    /* AETRAM Fintech Gold + Black (reference palette) */
    --primary-gold: #f9c851;
    --secondary-gold: #b8860b;
    --light-gold: #fde68a;
    --accent-gold: #f9c851;

    --brand-gold: var(--primary-gold);
    --brand-gold-light: var(--light-gold);
    --brand-gold-dark: var(--secondary-gold);
    --brand-navy: #000000;
    --brand-navy-light: #121212;
    --brand-navy-dark: #000000;

    --gradient-gold: linear-gradient(90deg, #f9c851 0%, #e8b84a 35%, #c9962a 70%, #b8860b 100%);
    --gradient-menu-active: linear-gradient(90deg, rgba(201, 143, 48, 1) 0%, rgba(245, 233, 125, 1) 33%, rgba(190, 128, 43, 1) 67%, rgba(226, 190, 89, 1) 100%);
    --gradient-gold-btn: linear-gradient(90deg, rgba(201, 143, 48, 1) 0%, rgba(245, 233, 125, 1) 33%, rgba(190, 128, 43, 1) 67%, rgba(226, 190, 89, 1) 100%);

    --sidebar-width: 280px;
    --sidebar-collapsed-width: 76px;
    --header-height: 64px;

    /* Status Colors */
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --status-approved: var(--success);
    --status-pending: var(--warning);
    --status-rejected: var(--danger);
    --status-draft: #6B7280;
    --status-blocked: var(--danger);
    --status-review: #3B82F6;
    --status-info: #0EA5E9;

    /* Spacing (8px grid) */
    --space-1: 8px;
    --space-2: 16px;
    --space-3: 24px;
    --space-4: 32px;
    --space-5: 40px;
    --space-6: 48px;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --font-family-base: 'Inter', sans-serif;

    --transition: all .25s ease;
    --transition-fast: all .2s ease;
}

/* Premium Gold Dark (default) — AETRAM fintech reference */
:root,
[data-theme="dark"] {
    --bg-primary: #000000;
    --bg-secondary: #121212;
    --bg-sidebar: #000000;
    --bg-card: #1c1c1c;
    --bg-header: #000000;
    --bg-content: #121212;

    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #707070;
    --text-sidebar: #a0a0a0;
    --text-sidebar-active: #000000;

    --border-color: #2a2a2a;
    --border-color-dark: #333333;
    --border-gold: rgba(249,200,81,.35);

    --shadow-sm: 0 2px 8px rgba(0,0,0,.5);
    --shadow-md: 0 8px 24px rgba(0,0,0,.55);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.6);
    --shadow-gold: 0 8px 24px rgba(249,200,81,.15);

    --glass-card-bg: #1c1c1c;
    --glass-card-border: transparent;
    --sidebar-gradient-start: #000000;
    --sidebar-gradient-end: #000000;
    --kpi-border: transparent;
    --table-row-hover: rgba(249,200,81,.06);
    --chart-grid: rgba(255,255,255,.06);
    --chart-text: #a0a0a0;

    --scrollbar-track: rgba(255, 255, 255, 0.05);
    --scrollbar-thumb: rgba(201, 143, 48, 0.8);
    --scrollbar-thumb-hover: rgba(245, 233, 125, 0.95);
}

/* Premium Executive Light */
[data-theme="light"] {
    --bg-primary: #F8FAFC;
    --bg-secondary: #FFFFFF;
    --bg-sidebar: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-header: #FFFFFF;
    --bg-content: #F1F5F9;

    --text-primary: #111827;
    --text-secondary: #4B5563;
    --text-muted: #6B7280;
    --text-sidebar: #6B7280;
    --text-sidebar-active: #111827;

    --border-color: #E5E7EB;
    --border-color-dark: #D1D5DB;
    --border-gold: rgba(212,175,55,.45);

    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,.10);
    --shadow-gold: 0 4px 16px rgba(212,175,55,.12);

    --glass-card-bg: rgba(255,255,255,.95);
    --glass-card-border: rgba(212,175,55,.25);
    --sidebar-gradient-start: #FFFFFF;
    --sidebar-gradient-end: #F8FAFC;
    --kpi-border: rgba(212,175,55,.35);
    --table-row-hover: rgba(0,0,0,.03);
    --chart-grid: rgba(0,0,0,.06);
    --chart-text: #6B7280;

    --scrollbar-track: rgba(0, 0, 0, 0.06);
    --scrollbar-thumb: rgba(184, 134, 11, 0.55);
    --scrollbar-thumb-hover: rgba(201, 143, 48, 0.85);
}

/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */
* { box-sizing: border-box; }

body {
    font-family: var(--font-family-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    transition: background .3s, color .3s;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, .h1 { font-size: 32px; font-weight: 700; line-height: 1.2; }
h2, .h2 { font-size: 28px; font-weight: 700; line-height: 1.25; }
h3, .h3 { font-size: 24px; font-weight: 600; line-height: 1.3; }
h4, .h4 { font-size: 20px; font-weight: 600; line-height: 1.35; }
small, .small { font-size: 12px; }

/* ── Gold scrollbars (global) ─────────────────────────── */
html,
body,
.page-content,
.main-content,
.sidebar-nav,
.table-container,
.modal-body,
.dataTables_wrapper .dataTables_scrollBody,
.card-body {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 8px;
}

*::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        rgba(245, 233, 125, 0.95) 0%,
        rgba(201, 143, 48, 0.95) 45%,
        rgba(190, 128, 43, 0.95) 100%
    );
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        rgba(245, 233, 125, 1) 0%,
        rgba(226, 190, 89, 1) 50%,
        rgba(190, 128, 43, 1) 100%
    );
}

*::-webkit-scrollbar-corner {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

a { color: var(--brand-gold); text-decoration: none; }
a:hover { color: var(--brand-gold-light); }

/* ============================================================
   APP SHELL LAYOUT
   ============================================================ */
.app-shell {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--sidebar-gradient-start) 0%, var(--sidebar-gradient-end) 100%);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    transition: width .3s ease;
    overflow: hidden;
}

.sidebar.collapsed { width: var(--sidebar-collapsed-width); }

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--header-height);
    white-space: nowrap;
    overflow: visible;
}

.sidebar-brand .brand-icon {
    width: 56px;
    height: 44px;
    min-width: 56px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    font-size: 0;
    flex-shrink: 0;
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    background: var(--gradient-menu-active);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.brand-sub {
    font-size: 10px;
    color: var(--brand-gold);
    letter-spacing: .5px;
    text-transform: uppercase;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}

.nav-section-label {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-label { visibility: hidden; }

.nav-item {
    list-style: none;
    margin: 1px 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-sidebar);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    position: relative;
}

.nav-link:hover:not(.active) {
    background: rgba(255,255,255,.04);
    color: #ffffff;
    text-decoration: none;
}

[data-theme="light"] .nav-link:hover:not(.active) {
    background: rgba(201, 143, 48, 0.1);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-link.active {
    background: var(--gradient-menu-active) !important;
    color: #000000 !important;
    border-left: none;
    box-shadow: 0 4px 16px rgba(249,200,81,.25);
    font-weight: 700;
}

.nav-link.active .nav-icon,
.nav-link.active .nav-text {
    color: #000000 !important;
}

.nav-link.active .nav-icon svg {
    stroke: #000000 !important;
}

.has-submenu.active-parent > .nav-link {
    background: rgba(249,200,81,.15);
    color: #ffffff !important;
    border-left: none;
    font-weight: 600;
}

[data-theme="light"] .has-submenu.active-parent > .nav-link {
    background: rgba(201, 143, 48, 0.12);
    color: var(--text-primary) !important;
}

.has-submenu.active-parent > .nav-link .nav-icon,
.has-submenu.active-parent > .nav-link .nav-text {
    color: #f9c851 !important;
}

[data-theme="light"] .has-submenu.active-parent > .nav-link .nav-icon,
[data-theme="light"] .has-submenu.active-parent > .nav-link .nav-text {
    color: var(--brand-gold-dark) !important;
}

.has-submenu.open > .nav-link.active {
    background: rgba(249,200,81,.12);
    color: #ffffff !important;
    border-left: none;
}

[data-theme="light"] .has-submenu.open > .nav-link.active {
    background: rgba(201, 143, 48, 0.12);
    color: var(--text-primary) !important;
}

.submenu .nav-link.active {
    background: var(--gradient-menu-active) !important;
    color: #000000 !important;
    border-left: none;
    font-weight: 700;
    box-shadow: 0 2px 12px rgba(249,200,81,.2);
}

.submenu .nav-link.active .nav-text,
.submenu .nav-link.active .nav-icon {
    color: #000000 !important;
}

.nav-link.active:hover,
.submenu .nav-link.active:hover {
    background: var(--gradient-menu-active) !important;
    color: #000000 !important;
    filter: brightness(1.05);
}

.has-submenu.active-parent > .nav-link:hover {
    background: rgba(249,200,81,.2);
    color: #ffffff !important;
}

[data-theme="light"] .has-submenu.active-parent > .nav-link:hover {
    background: rgba(201, 143, 48, 0.16);
    color: var(--text-primary) !important;
}

[data-theme="light"] .nav-link.active,
[data-theme="light"] .submenu .nav-link.active {
    color: var(--brand-gold-dark) !important;
    box-shadow: 0 0 12px rgba(212,175,55,.18), inset 0 0 8px rgba(212,175,55,.05);
}

[data-theme="light"] .nav-link.active .nav-icon,
[data-theme="light"] .nav-link.active .nav-text,
[data-theme="light"] .submenu .nav-link.active .nav-text {
    color: var(--brand-gold-dark) !important;
}

.nav-link .nav-icon {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
    color: var(--brand-gold);
    opacity: .85;
}

.nav-link .nav-text { flex: 1; }

.nav-link .badge-count {
    background: var(--gradient-menu-active);
    color: #000000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Sub-menu */
.has-submenu > .nav-link::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 11px;
    margin-left: auto;
    transition: transform .2s;
}

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

.submenu {
    list-style: none;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease;
}

.has-submenu.open > .submenu { max-height: 500px; }

.submenu .nav-item { margin: 1px 4px; }
.submenu .nav-link { padding-left: 44px; font-size: 13px; }

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .3s ease;
    overflow-x: hidden;
    background: var(--bg-content);
}

.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed-width); }

/* ============================================================
   TOP HEADER
   ============================================================ */
.top-header {
    height: var(--header-height);
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-toggle {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

.header-toggle:hover { background: var(--bg-primary); color: var(--text-primary); }

.header-breadcrumb {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
}

.header-breadcrumb .current { color: var(--text-primary); font-weight: 600; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.header-btn:hover { background: var(--bg-primary); color: var(--text-primary); }

.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    background: var(--status-rejected);
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-header);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.user-menu:hover { background: var(--bg-primary); border-color: var(--border-color); }

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gradient-gold-btn) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000000 !important;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(249, 200, 81, 0.25);
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.2; }
.user-role { font-size: 11px; color: var(--text-secondary); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 var(--space-1);
    letter-spacing: -.02em;
}

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

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0,0,0,.4);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border-color); }

/* ============================================================
   STAT CARDS (KPI)
   ============================================================ */
.stat-card {
    background: var(--bg-card);
    border: none;
    border-radius: var(--radius-md);
    padding: var(--space-3);
    box-shadow: 0 4px 20px rgba(0,0,0,.35);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: 0 8px 28px rgba(0,0,0,.4);
    transform: translateY(-4px);
}

.stat-header { display: flex; align-items: center; justify-content: space-between; }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.stat-icon.gold { background: rgba(212,175,55,.15); color: var(--brand-gold); }
.stat-icon.navy { background: rgba(42,47,58,.6); color: var(--brand-gold); }
.stat-icon.green { background: rgba(16,185,129,.12); color: var(--status-approved); }
.stat-icon.amber { background: rgba(245,158,11,.12); color: var(--status-pending); }
.stat-icon.red { background: rgba(239,68,68,.12); color: var(--danger); }
.stat-icon.blue { background: rgba(59,130,246,.12); color: var(--status-review); }

.stat-trend {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
}

.stat-trend.up { background: rgba(16,185,129,.12); color: var(--status-approved); }
.stat-trend.down { background: rgba(239,68,68,.12); color: var(--status-rejected); }
.stat-trend.flat { background: rgba(107,114,128,.12); color: var(--status-draft); }

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

.stat-label {
    font-size: 12.5px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.4;
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
    background: var(--gradient-gold-btn) !important;
    color: #000000 !important;
    border: none !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(249,200,81,.25);
}
.btn-primary:hover:not(:disabled) {
    background: var(--gradient-gold-btn) !important;
    color: #000000 !important;
    box-shadow: 0 4px 16px rgba(249,200,81,.4);
    filter: brightness(1.06);
    transform: translateY(-2px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(255,191,0,.25);
}

.btn-gold {
    background: var(--gradient-gold-btn) !important;
    color: #000000 !important;
    border: none !important;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(249,200,81,.25);
}
.btn-gold:hover:not(:disabled) {
    background: var(--gradient-gold-btn) !important;
    color: #000000 !important;
    box-shadow: 0 4px 16px rgba(249,200,81,.4);
    filter: brightness(1.06);
    transform: translateY(-2px);
}
.btn-gold:active:not(:disabled) { transform: translateY(0); }

.btn-success { background: var(--status-approved); color: #fff; border-color: var(--status-approved); }
.btn-success:hover { background: #059669; color: #fff; }

.btn-warning { background: var(--status-pending); color: #fff; border-color: var(--status-pending); }
.btn-warning:hover { background: #D97706; color: #fff; }

.btn-danger { background: var(--status-rejected); color: #fff; border-color: var(--status-rejected); }
.btn-danger:hover { background: #DC2626; color: #fff; }

.btn-outline {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}
.btn-outline:hover:not(:disabled) {
    background: rgba(255,191,0,.08);
    border-color: rgba(255,191,0,.35);
    color: var(--accent-gold);
    transform: translateY(-2px);
}

.btn:hover:not(:disabled) { transition: var(--transition-fast); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
}

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 600;
}

.badge-approved { background: rgba(22,163,74,.15); color: #16A34A; }
.badge-pending { background: rgba(212,175,55,.18); color: #D4AF37; }
.badge-completed { background: rgba(22,163,74,.2); color: #16A34A; box-shadow: 0 0 10px rgba(22,163,74,.35); }
.badge-rejected { background: rgba(239,68,68,.12); color: #DC2626; }
.badge-draft { background: rgba(107,114,128,.12); color: #6B7280; }
.badge-blocked { background: rgba(220,38,38,.15); color: #B91C1C; }
.badge-review { background: rgba(59,130,246,.12); color: #2563EB; }
.badge-critical { background: rgba(220,38,38,.2); color: #B91C1C; }
.badge-high { background: rgba(245,158,11,.15); color: #B45309; }
.badge-medium { background: rgba(59,130,246,.12); color: #1D4ED8; }
.badge-low { background: rgba(16,185,129,.12); color: #047857; }
.badge-gold { background: rgba(212,175,55,.18); color: var(--brand-gold); }

/* ============================================================
   TABLES
   ============================================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table thead th {
    background: #111;
    color: var(--accent-gold);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
}

.data-table tbody tr:nth-child(even) { background: rgba(255,255,255,.02); }

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

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

.data-table tbody tr:hover { background: var(--table-row-hover); }

/* Sidebar user footer */
.sidebar-user-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
}

.sidebar-user-footer .sidebar-user-name {
    font-size: 12.5px;
    font-weight: 600;
    color: #ffffff;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .sidebar-user-footer .sidebar-user-name {
    color: var(--text-primary);
}

.sidebar-user-footer .sidebar-user-role {
    font-size: 11px;
    color: #a0a0a0;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="light"] .sidebar-user-footer .sidebar-user-role {
    color: var(--text-muted);
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-label .required { color: var(--status-rejected); margin-left: 2px; }

.form-control {
    width: 100%;
    padding: 9px 13px;
    border: 1px solid var(--border-color-dark);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 13.5px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 4px rgba(255,191,0,.15);
}

.form-control:disabled {
    background: var(--bg-primary);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-select {
    appearance: none;
    color-scheme: dark;
    background-color: #1c1c1c;
    color: #ffffff;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23f9c851' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 34px;
}

.form-select option,
select.form-control option,
select option {
    background-color: #1c1c1c;
    color: #ffffff;
}

[data-theme="light"] .form-select,
[data-theme="light"] select.form-control,
[data-theme="light"] select {
    color-scheme: light;
    background-color: #ffffff;
    color: #111827;
}

[data-theme="light"] .form-select option,
[data-theme="light"] select option {
    background-color: #ffffff;
    color: #111827;
}

.form-hint { font-size: 11.5px; color: var(--text-secondary); margin-top: 4px; }
.form-error { font-size: 11.5px; color: var(--status-rejected); margin-top: 4px; }

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    flex: 1;
}

.input-group > .input-group-text:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-right: none;
    border-left: 1px solid var(--border-color-dark);
}

.input-group > .input-group-text:first-child + .form-control {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-left: none;
}

.input-group > .form-control:first-child {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group > .form-control:first-child + .input-group-text {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border-left: none;
}

/* Amount/currency text inputs — free typing (avoid number spinner issues) */
input.amount-input {
    pointer-events: auto;
    user-select: text;
    -webkit-user-select: text;
}

.input-group-text {
    padding: 9px 13px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color-dark);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
    font-size: 13.5px;
    white-space: nowrap;
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-3);
    opacity: 0;
    visibility: hidden;
    transition: opacity .25s, visibility .25s;
}

.modal-overlay.show { opacity: 1; visibility: visible; }

.modal-dialog {
    background: var(--bg-card);
    border: 1px solid var(--glass-card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(.96) translateY(8px);
    transition: transform .25s ease, opacity .25s ease;
    box-shadow: 0 24px 48px rgba(0,0,0,.45);
}

.modal-overlay.show .modal-dialog { transform: scale(1) translateY(0); }

/* Override Bootstrap .modal-dialog { pointer-events: none } — clicks must hit our dialog */
.modal-overlay .modal-dialog {
    pointer-events: auto;
    position: relative;
    margin: 0;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; color: var(--text-primary); }

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

.modal-close:hover { background: var(--bg-primary); color: var(--text-primary); }

.modal-body { padding: 24px; }

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ============================================================
   WORKFLOW TIMELINE
   ============================================================ */
.workflow-timeline { display: flex; align-items: flex-start; gap: 0; }

.workflow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
}

.workflow-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 14px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: var(--border-color-dark);
    z-index: 0;
}

.workflow-step.completed:not(:last-child)::after { background: var(--status-approved); }
.workflow-step.active:not(:last-child)::after {
    background: linear-gradient(to right, var(--status-approved), var(--border-color-dark));
}

.workflow-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border-color-dark);
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    z-index: 1;
    position: relative;
}

.workflow-step.completed .workflow-dot { background: var(--status-approved); border-color: var(--status-approved); color: #fff; }
.workflow-step.active .workflow-dot { border-color: var(--brand-gold); background: rgba(201,168,76,.15); color: var(--brand-gold); }
.workflow-step.rejected .workflow-dot { background: var(--status-rejected); border-color: var(--status-rejected); color: #fff; }

.workflow-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 6px;
    text-align: center;
    max-width: 80px;
}

.workflow-step.completed .workflow-label { color: var(--status-approved); }
.workflow-step.active .workflow-label { color: var(--brand-gold); }

/* ============================================================
   TABS
   ============================================================ */
.tab-nav {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 18px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-secondary);
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: var(--transition);
    white-space: nowrap;
}

.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--brand-gold); border-bottom-color: var(--brand-gold); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   ALERT BANNERS
   ============================================================ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.alert-success { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: #065F46; }
.alert-warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #92400E; }
.alert-danger  { background: rgba(239,68,68,.1);  border-color: rgba(239,68,68,.3);  color: #991B1B; }
.alert-info    { background: rgba(59,130,246,.1);  border-color: rgba(59,130,246,.3);  color: #1E40AF; }
.alert-gold    { background: rgba(201,168,76,.1);  border-color: rgba(201,168,76,.3);  color: #92400E; }

[data-theme="dark"] .alert-success { color: #6EE7B7; }
[data-theme="dark"] .alert-warning { color: #FCD34D; }
[data-theme="dark"] .alert-danger  { color: #FCA5A5; }
[data-theme="dark"] .alert-info    { color: #93C5FD; }

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--brand-gold);
    border-radius: 50%;
    animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}

.loading-overlay.show { opacity: 1; visibility: visible; }

/* Toastr - gold theme, above header */
#toast-container { z-index: 11000 !important; }
#toast-container > .toast {
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-family: 'Inter', sans-serif;
    font-size: 13.5px;
}
#toast-container > .toast-success { background-color: var(--brand-navy); }
#toast-container > .toast-info { background-color: var(--brand-gold-dark); }
#toast-container > .toast-warning { background-color: #B45309; }
#toast-container > .toast-error { background-color: #B91C1C; }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-gold { color: var(--brand-gold) !important; }
.text-navy { color: var(--brand-navy) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--status-approved) !important; }
.text-red { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger { color: var(--status-rejected) !important; }

.bg-gold { background: var(--brand-gold) !important; }
.bg-navy { background: var(--brand-navy) !important; }

.fw-semibold { font-weight: 600 !important; }
.fw-bold { font-weight: 700 !important; }

.gap-1 { gap: 4px !important; }
.gap-2 { gap: 8px !important; }
.gap-3 { gap: 12px !important; }
.gap-4 { gap: 16px !important; }

.rounded-pill { border-radius: 50px !important; }
.rounded { border-radius: var(--radius-sm) !important; }
.rounded-md { border-radius: var(--radius-md) !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.mobile-open { transform: translateX(0); }
    .main-content { margin-left: 0 !important; }
    .page-content { padding: 16px; }
}

@media (max-width: 768px) {
    .stat-card .stat-value { font-size: 20px; }
    .page-header { flex-direction: column; }
    .page-actions { width: 100%; }
}
