/* ============================================================
   ADMIN OPENX · Design System v4
   Zinc/Vercel aesthetic — dark sidebar, light content
   ============================================================ */

/* ─── Design Tokens ──────────────────────────────────────── */
:root,
[data-bs-theme="light"] {
    --font-body: 'Geist', 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, monospace;

    /* Brand / Accent */
    --clr-accent:         #1463fe;
    --clr-accent-hover:   #0d52e0;
    --clr-accent-subtle:  rgba(20, 99, 254, 0.08);
    --clr-accent-border:  rgba(20, 99, 254, 0.18);
    --clr-accent-muted:   rgba(20, 99, 254, 0.12);

    /* Backgrounds */
    --clr-bg:       #f8f8f9;   /* off-white — not pure white */
    --clr-surface:  #ffffff;
    --clr-elevated: #ffffff;
    --clr-muted:    #f3f3f5;   /* zinc-100 ish */
    --clr-overlay:  rgba(0,0,0,0.02);

    /* Text */
    --clr-text:   #111118;    /* near-black */
    --clr-text-2: #62626a;    /* zinc-500ish */
    --clr-text-3: #9898a4;    /* zinc-400ish */

    /* Borders */
    --clr-border:       #e2e2ea;
    --clr-border-hover: #c8c8d4;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow:    0 2px 8px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.05);

    /* Topbar */
    --topbar-bg:     rgba(255,255,255,0.88);
    --topbar-border: rgba(226,226,234,0.8);

    /* Sidebar — always dark */
    --sidebar-bg:          #0c0c11;
    --sidebar-border:      rgba(255,255,255,0.07);
    --sidebar-nav-default: rgba(255,255,255,0.55);
    --sidebar-nav-hover:   rgba(255,255,255,0.88);
    --sidebar-nav-hover-bg:rgba(255,255,255,0.05);
    --sidebar-nav-active:  #ffffff;
    --sidebar-nav-active-bg: rgba(20,99,254,0.18);
    --sidebar-nav-active-border: var(--clr-accent);
    --sidebar-label:       rgba(255,255,255,0.28);

    /* Cards */
    --card-bg:     #ffffff;
    --card-border: #e2e2ea;
    --card-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.04);

    /* Inputs */
    --input-bg:          #ffffff;
    --input-border:      #e2e2ea;
    --input-focus-ring:  rgba(20,99,254,0.15);
    --input-placeholder: #9898a4;

    /* Status */
    --clr-success: #059669;
    --clr-warning: #d97706;
    --clr-danger:  #dc2626;
    --clr-info:    #2563eb;

    /* Geometry */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius:    8px;
    --radius-lg: 12px;
    --transition:      150ms ease;
    --transition-fast: 80ms ease;
    --sidebar-w: 240px;
}

[data-bs-theme="dark"] {
    --clr-bg:       #08080d;
    --clr-surface:  #111118;
    --clr-elevated: #1a1a24;
    --clr-muted:    #1a1a24;
    --clr-overlay:  rgba(255,255,255,0.025);

    --clr-text:   #f0f0f6;
    --clr-text-2: #9898a4;
    --clr-text-3: #62626a;

    --clr-border:       #252530;
    --clr-border-hover: #353545;

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.5);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.6);
    --shadow:    0 2px 8px rgba(0,0,0,0.6);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.7);

    --topbar-bg:     rgba(17,17,24,0.90);
    --topbar-border: rgba(37,37,48,0.8);

    --card-bg:     #111118;
    --card-border: #252530;
    --card-shadow: 0 0 0 1px rgba(255,255,255,0.04), 0 1px 3px rgba(0,0,0,0.3);

    --input-bg:          #1a1a24;
    --input-border:      #2a2a38;
    --input-placeholder: #62626a;

    --clr-success: #10b981;
    --clr-warning: #f59e0b;
    --clr-danger:  #ef4444;
    --clr-info:    #3b82f6;

    --clr-accent-subtle: rgba(20,99,254,0.14);
    --clr-accent-muted:  rgba(20,99,254,0.18);
}

/* ─── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-font-smoothing:  antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01', 'tnum' 0;
}

body {
    font-family: var(--font-body);
    background-color: var(--clr-bg);
    color: var(--clr-text);
    margin: 0;
    line-height: 1.5;
    font-size: 14px;
}

/* ─── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar            { width: 4px; height: 4px; }
::-webkit-scrollbar-track      { background: transparent; }
::-webkit-scrollbar-thumb      { background: var(--clr-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover{ background: var(--clr-text-3); }

/* ═══════════════════════════════════════════════════════════
   LAYOUT SHELL
   ═══════════════════════════════════════════════════════════ */
#wrapper {
    display: flex;
    min-height: 100vh;
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════ */
#sidebar {
    width:     var(--sidebar-w);
    min-width: var(--sidebar-w);
    max-width: var(--sidebar-w);
    height:    100vh;
    position:  sticky;
    top: 0;
    background:  var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    scrollbar-width: none;
}

#sidebar::-webkit-scrollbar { display: none; }

/* Logo */
.sidebar-logo-area {
    padding: 0 14px;
    height: 56px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.sidebar-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    opacity: 0.88;
    transition: opacity var(--transition);
}

.sidebar-logo-link:hover { opacity: 1; }

.sidebar-logo-img {
    display: block;
    height: 28px;
    width: auto;
    object-fit: contain;
}

/* Nav scroll */
.sidebar-nav-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 8px;
    scrollbar-width: none;
}

.sidebar-nav-scroll::-webkit-scrollbar { display: none; }

/* Nav list */
.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.sidebar-nav-group-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--sidebar-label);
    padding: 18px 10px 5px;
    line-height: 1;
    user-select: none;
}

.sidebar-nav-group-label:first-child { padding-top: 2px; }

.sidebar-nav li { list-style: none; }

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    border-left: 2px solid transparent;
    color: var(--sidebar-nav-default);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition);
    line-height: 1.4;
    position: relative;
    margin: 0 0;
}

.sidebar-nav .nav-link i {
    width: 15px;
    font-size: 12.5px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity var(--transition), color var(--transition);
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-nav-hover-bg);
    color: var(--sidebar-nav-hover);
    text-decoration: none;
}

.sidebar-nav .nav-link:hover i { opacity: 0.85; }

.sidebar-nav .nav-link.active {
    background: var(--sidebar-nav-active-bg);
    color: var(--sidebar-nav-active);
    border-left-color: var(--sidebar-nav-active-border);
    font-weight: 600;
}

.sidebar-nav .nav-link.active i {
    opacity: 1;
    color: var(--clr-accent);
}

/* Sidebar footer */
.sidebar-footer {
    padding: 8px 8px 14px;
    flex-shrink: 0;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 10px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
    cursor: default;
}

.sidebar-user:hover { background: var(--sidebar-nav-hover-bg); }

.sidebar-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    background: var(--clr-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 10.5px;
    font-weight: 700;
    flex-shrink: 0;
    user-select: none;
    letter-spacing: 0.04em;
}

.sidebar-user-info { min-width: 0; }

.sidebar-user-name {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255,255,255,0.78);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-email {
    font-size: 10.5px;
    color: rgba(255,255,255,0.32);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Notification badge */
.sidebar-nav .nav-badge,
.sidebar-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 99px;
    font-size: 9.5px;
    font-weight: 700;
    background: #dc2626;
    color: #fff;
    margin-left: auto;
    letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════
   PAGE CONTENT
   ═══════════════════════════════════════════════════════════ */
#page-content {
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--clr-bg);
}

/* ─── Topbar ─────────────────────────────────────────────── */
#topbar {
    height: 54px;
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-page-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--clr-text-2);
    margin: 0;
    letter-spacing: 0;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.topbar-separator {
    width: 1px;
    height: 16px;
    background: var(--clr-border);
    margin: 0 2px;
}

/* ─── Theme Toggle ────────────────────────────────────────── */
.btn-theme {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--clr-border);
    background: transparent;
    color: var(--clr-text-3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12.5px;
    transition: background var(--transition), border-color var(--transition),
                color var(--transition);
    flex-shrink: 0;
    padding: 0;
}

.btn-theme:hover {
    background: var(--clr-muted);
    border-color: var(--clr-border-hover);
    color: var(--clr-text);
}

/* ─── Main Content ───────────────────────────────────────── */
.main-content {
    padding: 28px 28px;
    flex: 1;
}

/* ═══════════════════════════════════════════════════════════
   PAGE HEADER
   ═══════════════════════════════════════════════════════════ */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--clr-text);
    margin: 0;
    letter-spacing: -0.4px;
    line-height: 1.3;
}

.page-subtitle {
    font-size: 13px;
    color: var(--clr-text-3);
    margin: 3px 0 0;
    line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}

.card-body { padding: 20px; }

.card-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--clr-text-3);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 8px;
}

.card-header {
    padding: 13px 20px;
    background: transparent;
    border-bottom: 1px solid var(--card-border);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--clr-text);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Stat Cards ──────────────────────────────────────────── */
.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.stat-card-icon.accent  { background: var(--clr-accent-subtle);     color: var(--clr-accent);  }
.stat-card-icon.success { background: rgba(5,150,105,0.08);          color: #059669;            }
.stat-card-icon.warning { background: rgba(217,119,6,0.10);          color: #d97706;            }
.stat-card-icon.danger  { background: rgba(220,38,38,0.08);          color: #dc2626;            }
.stat-card-icon.info    { background: rgba(37,99,235,0.08);          color: #2563eb;            }

.stat-card-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--clr-text);
    line-height: 1;
    letter-spacing: -0.8px;
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' 1;
}

.stat-card-label {
    font-size: 12px;
    color: var(--clr-text-3);
    margin-top: 5px;
    line-height: 1.3;
    font-weight: 500;
}

/* ═══════════════════════════════════════════════════════════
   BOOTSTRAP COMPONENT OVERRIDES
   ═══════════════════════════════════════════════════════════ */

/* ─── Buttons ─────────────────────────────────────────────── */
.btn {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    line-height: 1.4;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: background var(--transition), color var(--transition),
                border-color var(--transition), box-shadow var(--transition);
    vertical-align: middle;
    white-space: nowrap;
    letter-spacing: 0;
}

.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-xs); }
.btn-lg { padding: 9px 20px; font-size: 14px; }

.btn-primary {
    background: var(--clr-accent);
    border-color: var(--clr-accent);
    color: #fff;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--clr-accent-hover);
    border-color: var(--clr-accent-hover);
    color: #fff;
    box-shadow: 0 0 0 3px var(--clr-accent-subtle);
}
.btn-primary:active { box-shadow: none; }

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

.btn-outline-secondary {
    background: transparent;
    border-color: var(--clr-border);
    color: var(--clr-text-2);
}
.btn-outline-secondary:hover {
    background: var(--clr-muted);
    border-color: var(--clr-border-hover);
    color: var(--clr-text);
}

.btn-outline-primary {
    background: transparent;
    border-color: var(--clr-accent-border);
    color: var(--clr-accent);
}
.btn-outline-primary:hover {
    background: var(--clr-accent-subtle);
    border-color: var(--clr-accent);
    color: var(--clr-accent);
}

.btn-outline-danger {
    background: transparent;
    border-color: rgba(220,38,38,0.25);
    color: var(--clr-danger);
}
.btn-outline-danger:hover {
    background: rgba(220,38,38,0.06);
    border-color: rgba(220,38,38,0.45);
    color: var(--clr-danger);
}

.btn-outline-success {
    background: transparent;
    border-color: rgba(5,150,105,0.25);
    color: var(--clr-success);
}
.btn-outline-success:hover {
    background: rgba(5,150,105,0.06);
    border-color: rgba(5,150,105,0.45);
    color: var(--clr-success);
}

.btn-outline-warning {
    background: transparent;
    border-color: rgba(217,119,6,0.25);
    color: var(--clr-warning);
}
.btn-outline-warning:hover {
    background: rgba(217,119,6,0.06);
    border-color: rgba(217,119,6,0.45);
    color: var(--clr-warning);
}

.btn-danger {
    background: var(--clr-danger);
    border-color: var(--clr-danger);
    color: #fff;
}
.btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
    color: #fff;
}

.btn-success {
    background: var(--clr-success);
    border-color: var(--clr-success);
    color: #fff;
}
.btn-success:hover {
    background: #047857;
    border-color: #047857;
    color: #fff;
}

.btn-warning {
    background: var(--clr-warning);
    border-color: var(--clr-warning);
    color: #fff;
}

.btn:disabled, .btn.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Icon-only button */
.btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

/* ─── Forms ───────────────────────────────────────────────── */
.form-control,
.form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--clr-text);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 13.5px;
    padding: 7px 12px;
    transition: border-color var(--transition), box-shadow var(--transition),
                background-color var(--transition);
    height: auto;
    line-height: 1.4;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--input-bg);
    border-color: var(--clr-accent);
    color: var(--clr-text);
    box-shadow: 0 0 0 3px var(--input-focus-ring);
    outline: none;
}

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

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--clr-text-2);
    margin-bottom: 5px;
}

.form-check-input:checked {
    background-color: var(--clr-accent);
    border-color: var(--clr-accent);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px var(--input-focus-ring);
    border-color: var(--clr-accent);
}

.input-group-text {
    background: var(--clr-muted);
    border-color: var(--input-border);
    color: var(--clr-text-3);
    font-size: 13px;
    padding: 7px 12px;
}

/* ─── Tables ──────────────────────────────────────────────── */
.table {
    color: var(--clr-text);
    font-size: 13.5px;
    margin-bottom: 0;
}

.table thead th {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--clr-text-3);
    border-bottom: 1px solid var(--clr-border);
    border-top: none;
    padding: 10px 16px;
    background: transparent;
    white-space: nowrap;
}

.table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--clr-border);
    border-top: none;
    vertical-align: middle;
    color: var(--clr-text);
    font-size: 13.5px;
}

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

.table-striped > tbody > tr:nth-of-type(odd) > * {
    background-color: var(--clr-overlay);
    color: var(--clr-text);
}

.table-hover > tbody > tr {
    transition: background-color var(--transition-fast);
}

.table-hover > tbody > tr:hover > * {
    background-color: var(--clr-muted);
    color: var(--clr-text);
}

/* ─── Badges ──────────────────────────────────────────────── */
.badge {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    letter-spacing: 0;
}

.badge.bg-secondary, .badge.text-bg-secondary {
    background: var(--clr-muted) !important;
    color: var(--clr-text-2) !important;
}
.badge.bg-success, .badge.text-bg-success {
    background: rgba(5,150,105,0.10) !important;
    color: var(--clr-success) !important;
    border: 1px solid rgba(5,150,105,0.18);
}
.badge.bg-warning, .badge.text-bg-warning {
    background: rgba(217,119,6,0.10) !important;
    color: var(--clr-warning) !important;
    border: 1px solid rgba(217,119,6,0.18);
}
.badge.bg-danger, .badge.text-bg-danger {
    background: rgba(220,38,38,0.10) !important;
    color: var(--clr-danger) !important;
    border: 1px solid rgba(220,38,38,0.18);
}
.badge.bg-primary, .badge.text-bg-primary {
    background: var(--clr-accent-subtle) !important;
    color: var(--clr-accent) !important;
    border: 1px solid var(--clr-accent-border);
}
.badge.bg-info, .badge.text-bg-info {
    background: rgba(37,99,235,0.10) !important;
    color: var(--clr-info) !important;
    border: 1px solid rgba(37,99,235,0.18);
}

/* ─── Alerts ──────────────────────────────────────────────── */
.alert {
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    padding: 11px 15px;
    border-width: 1px;
    font-family: var(--font-body);
}

.alert-danger {
    background: rgba(220,38,38,0.05);
    border-color: rgba(220,38,38,0.18);
    color: var(--clr-danger);
}

.alert-warning {
    background: rgba(217,119,6,0.05);
    border-color: rgba(217,119,6,0.18);
    color: var(--clr-warning);
}

.alert-success {
    background: rgba(5,150,105,0.05);
    border-color: rgba(5,150,105,0.18);
    color: var(--clr-success);
}

.alert-info {
    background: rgba(37,99,235,0.05);
    border-color: rgba(37,99,235,0.18);
    color: var(--clr-info);
}

/* ─── Modals ──────────────────────────────────────────────── */
.modal-backdrop {
    background: rgba(0,0,0,0.50);
}

.modal-backdrop.show { opacity: 1; }

.modal-content {
    background: var(--clr-elevated);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--clr-border);
    padding: 16px 20px;
}

.modal-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--clr-text);
    letter-spacing: -0.2px;
}

.modal-body {
    padding: 20px;
    color: var(--clr-text);
}

.modal-footer {
    border-top: 1px solid var(--clr-border);
    padding: 14px 20px;
    gap: 8px;
}

.btn-close {
    filter: none;
    opacity: 0.4;
    transition: opacity var(--transition);
}

[data-bs-theme="dark"] .btn-close { filter: invert(1); }

.btn-close:hover { opacity: 0.9; }

/* ─── Progress ────────────────────────────────────────────── */
.progress {
    background: var(--clr-muted);
    border-radius: 99px;
    overflow: hidden;
    height: 6px;
}

.progress-bar {
    background: var(--clr-accent);
    font-size: 10px;
    font-weight: 600;
}

/* ─── Spinner ─────────────────────────────────────────────── */
.spinner-border { color: var(--clr-accent) !important; }

/* ─── Dropdowns ───────────────────────────────────────────── */
.dropdown-menu {
    background: var(--clr-elevated);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    font-family: var(--font-body);
    font-size: 13.5px;
}

.dropdown-item {
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    color: var(--clr-text);
    font-size: 13.5px;
    transition: background var(--transition-fast);
}

.dropdown-item:hover, .dropdown-item:focus {
    background: var(--clr-muted);
    color: var(--clr-text);
}

.dropdown-divider { border-color: var(--clr-border); margin: 4px 0; }

/* ─── Toast ───────────────────────────────────────────────── */
.toast {
    background: var(--clr-elevated);
    border: 1px solid var(--clr-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-family: var(--font-body);
    font-size: 13.5px;
}

/* ─── Nav tabs (Bootstrap) ────────────────────────────────── */
.nav-tabs {
    border-color: var(--clr-border);
}
.nav-tabs .nav-link {
    color: var(--clr-text-2);
    border-color: transparent;
    font-size: 13.5px;
}
.nav-tabs .nav-link:hover { border-color: transparent; color: var(--clr-text); }
.nav-tabs .nav-link.active {
    color: var(--clr-text);
    background: var(--clr-surface);
    border-color: var(--clr-border) var(--clr-border) var(--clr-surface);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--clr-bg);
    padding: 24px;
    position: relative;
}

.login-bg-noise {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 60% at 10% 15%, rgba(20,99,254,0.07) 0%, transparent 60%),
        radial-gradient(ellipse 60% 50% at 90% 85%, rgba(20,50,200,0.06) 0%, transparent 55%);
}

.login-card {
    width: 100%;
    max-width: 372px;
    position: relative;
    z-index: 1;
}

.login-card .card-body { padding: 36px 32px 28px; }

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 26px;
}

.login-logo-img {
    width: 34px;
    height: 34px;
    object-fit: contain;
}

.login-logo-text {
    font-size: 17px;
    font-weight: 700;
    color: var(--clr-text);
    letter-spacing: -0.4px;
}

.login-logo-text span { color: var(--clr-accent); }

.login-title {
    font-size: 19px;
    font-weight: 600;
    color: var(--clr-text);
    text-align: center;
    margin-bottom: 4px;
    letter-spacing: -0.4px;
}

.login-subtitle {
    font-size: 13px;
    color: var(--clr-text-3);
    text-align: center;
    margin-bottom: 28px;
}

/* ═══════════════════════════════════════════════════════════
   FILE DROPZONE
   ═══════════════════════════════════════════════════════════ */
.file-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1.5px dashed var(--clr-border);
    border-radius: var(--radius);
    padding: 32px 24px;
    cursor: pointer;
    text-align: center;
    position: relative;
    background: transparent;
    transition: border-color var(--transition), background var(--transition);
    user-select: none;
}

.file-dropzone:hover,
.file-dropzone.dragover {
    border-color: var(--clr-accent);
    background: var(--clr-accent-subtle);
}

.file-dropzone.has-file {
    border-color: var(--clr-accent-border);
    background: var(--clr-accent-subtle);
}

.file-dropzone-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.file-dropzone-icon {
    font-size: 22px;
    color: var(--clr-text-3);
    pointer-events: none;
    transition: color var(--transition);
}

.file-dropzone:hover .file-dropzone-icon,
.file-dropzone.has-file .file-dropzone-icon {
    color: var(--clr-accent);
}

.file-dropzone-text {
    font-size: 13.5px;
    color: var(--clr-text-2);
    pointer-events: none;
}

.file-dropzone-hint {
    font-size: 12px;
    color: var(--clr-text-3);
    pointer-events: none;
}

.file-dropzone-filename {
    font-size: 12px;
    font-weight: 600;
    color: var(--clr-accent);
    background: var(--clr-accent-subtle);
    padding: 3px 12px;
    border-radius: 99px;
    pointer-events: none;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   TAB BAR (pill)
   ═══════════════════════════════════════════════════════════ */
.tabs-pill-bar {
    display: flex;
    gap: 2px;
    padding: 3px 4px;
    background: var(--clr-muted);
    border-radius: var(--radius);
    overflow-x: auto;
    scrollbar-width: none;
    flex-wrap: nowrap;
    border: 1px solid var(--clr-border);
}

.tabs-pill-bar::-webkit-scrollbar { display: none; }

.tabs-pill-bar .nav-link {
    border: none !important;
    border-radius: var(--radius-sm) !important;
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--clr-text-2);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    flex-shrink: 0;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.tabs-pill-bar .nav-link:hover {
    background: rgba(0,0,0,0.04);
    color: var(--clr-text);
}

[data-bs-theme="dark"] .tabs-pill-bar .nav-link:hover {
    background: rgba(255,255,255,0.06);
}

.tabs-pill-bar .nav-link.active {
    background: var(--clr-surface) !important;
    color: var(--clr-text) !important;
    font-weight: 600;
    box-shadow: var(--shadow-xs);
    border: 1px solid var(--clr-border) !important;
}

.tabs-pill-bar .nav-link .tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 99px;
    font-size: 10px;
    font-weight: 700;
    background: var(--clr-border);
    color: var(--clr-text-3);
}

.tabs-pill-bar .nav-link.active .tab-badge {
    background: var(--clr-accent-subtle);
    color: var(--clr-accent);
}

/* Classic tab variant */
.tabs-pill-bar.tabs-classic {
    gap: 0;
    padding: 6px 6px 0;
    align-items: flex-end;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--clr-border);
    border-radius: 0;
}

.tabs-pill-bar.tabs-classic .nav-item {
    display: flex;
    align-items: flex-end;
    margin-bottom: -1px;
}

.tabs-pill-bar.tabs-classic .nav-link {
    padding: 5px 12px 7px !important;
    font-size: 13px !important;
    border-radius: 6px 6px 0 0 !important;
    border: 1px solid transparent !important;
    border-bottom: none !important;
    margin-right: 2px;
    background: transparent;
    box-shadow: none !important;
}

.tabs-pill-bar.tabs-classic .nav-link:hover {
    background: var(--clr-muted);
    color: var(--clr-text);
    border-color: transparent !important;
    border-bottom: none !important;
}

.tabs-pill-bar.tabs-classic .nav-link.active {
    background: var(--clr-surface) !important;
    color: var(--clr-text) !important;
    border: 1px solid var(--clr-border) !important;
    border-bottom-color: var(--clr-surface) !important;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.tabs-pill-bar.tabs-classic .nav-link .tab-badge {
    min-width: 16px;
    height: 16px;
    font-size: 9.5px;
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════
   SECTION DIVIDER
   ═══════════════════════════════════════════════════════════ */
.section-label {
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--clr-text-3);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--clr-border);
}

/* ═══════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeInUp 0.22s ease both;
}

.animate-in-delay-1 { animation-delay: 0.04s; }
.animate-in-delay-2 { animation-delay: 0.08s; }
.animate-in-delay-3 { animation-delay: 0.13s; }
.animate-in-delay-4 { animation-delay: 0.18s; }

/* ─── Global theme transitions ───────────────────────────── */
body,
.card,
.form-control,
.form-select,
.btn,
.badge,
.alert,
#topbar,
#page-content {
    transition:
        background-color 200ms ease,
        border-color 200ms ease,
        color 150ms ease;
}

/* Sidebar color stays fixed on desktop; mobile drawer animates separately */
#sidebar { transition: none; }

/* ─── Utility overrides ──────────────────────────────────── */
.text-muted     { color: var(--clr-text-3) !important; }
.text-secondary { color: var(--clr-text-2) !important; }
small           { font-size: 12px; }
code            { font-family: var(--font-mono); font-size: 12px; color: var(--clr-text-2); background: var(--clr-muted); padding: 1px 6px; border-radius: 4px; border: 1px solid var(--clr-border); }
pre             { background: var(--clr-muted); border: 1px solid var(--clr-border); border-radius: var(--radius-sm); padding: 12px 16px; font-family: var(--font-mono); font-size: 12.5px; color: var(--clr-text); }

/* Override Bootstrap's pink code color */
:root { --bs-code-color: var(--clr-text-2); }

a { color: var(--clr-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

hr { border-color: var(--clr-border); opacity: 1; }

.fw-mono { font-family: var(--font-mono); }

/* ─── Mobile sidebar toggle ────────────────────────────────── */
.btn-sidebar-toggle,
.btn-sidebar-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-sm);
    background: var(--clr-surface);
    color: var(--clr-text-2);
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.btn-sidebar-toggle:hover,
.btn-sidebar-close:hover {
    background: var(--clr-muted);
    color: var(--clr-text);
    border-color: var(--clr-border-hover);
}

.sidebar-backdrop {
    display: none;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .btn-sidebar-toggle { display: inline-flex; }

    .sidebar-logo-area {
        justify-content: space-between;
    }

    .btn-sidebar-close { display: inline-flex; }

    .btn-sidebar-close {
        border-color: rgba(255, 255, 255, 0.12);
        background: rgba(255, 255, 255, 0.06);
        color: rgba(255, 255, 255, 0.72);
    }

    .btn-sidebar-close:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: rgba(255, 255, 255, 0.18);
        color: #fff;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1040;
        background: rgba(0, 0, 0, 0.45);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 250ms ease, visibility 250ms ease;
    }

    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 1050;
        transform: translateX(-100%);
        transition: transform 280ms ease;
        box-shadow: none;
    }

    #wrapper.sidebar-open #sidebar {
        transform: translateX(0);
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
    }

    #wrapper.sidebar-open .sidebar-backdrop {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }

    .main-content { padding: 16px; }
    #topbar       { padding: 0 16px; }

    .topbar-page-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: calc(100vw - 180px);
    }
}
