/* ============================================================
   NEXUS  —  Unified Stylesheet  v1.7.0
   Velora.tv Community Manager Portal
   
   Fonts loaded per-page:
   Space Mono 400/700 + Syne 700/800/900
   https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Syne:wght@700;800;900
   ============================================================ */

/* ── 1. CSS VARIABLES ──────────────────────────────────────── */
:root {
    /* Gold / primary */
    --primary:      #d4a017;
    --primary-dark: #a07810;
    --gold:         #d4a017;
    --gold-mid:     #a07810;
    --gold-dim:     #5a3e08;

    /* Surfaces */
    --bg:           #080706;
    --surface:      #0f0e0b;
    --surface2:     #141209;
    --sidebar-bg:   #0f0e0b;
    --card-bg:      #0f0e0b;

    /* Borders */
    --border:       #1e1b14;
    --border2:      #2a2518;

    /* Text */
    --text:         #e8dcc8;
    --muted:        #6b5e46;
    --dim:          #3a3020;

    /* Accent colours */
    --accent:       #8b1a1a;
    --red:          #8b1a1a;
    --green:        #22c55e;
    --blue:         #3b82f6;
}

/* ── 2. RESET & BASE ───────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
    font-size: 16px;
}

html {
    font-family: 'Space Mono', monospace;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Space Mono', monospace;
    min-height: 100%;
    line-height: 1.6;
    /* Reset Bootstrap font variables */
    --bs-body-font-family: 'Space Mono', monospace;
    --bs-body-font-size: 0.875rem;
    --bs-body-font-weight: 400;
    --bs-nav-link-font-size: 0.72rem;
    --bs-nav-link-font-weight: 400;
    --bs-nav-link-color: var(--muted);
    --bs-nav-link-hover-color: var(--text);
    --bs-nav-link-disabled-color: var(--dim);
}

a { color: inherit; }

/* Scrollbars */
::-webkit-scrollbar              { width: 4px; height: 4px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: var(--border2); border-radius: 2px; }
*                                 { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }

/* Scanline texture — the Nexus signature */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0,0,0,0.04) 3px,
        rgba(0,0,0,0.04) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ── 3. LAYOUT ─────────────────────────────────────────────── */
body.app-layout {
    display: flex;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

/* ── 4. SIDEBAR ────────────────────────────────────────────── */
.sidebar {
    /* Reset Bootstrap nav variables so they can't leak in */
    --bs-nav-link-font-size: 0.72rem;
    --bs-nav-link-font-weight: 400;
    --bs-nav-link-color: var(--muted);
    --bs-nav-link-hover-color: var(--text);
    /* Kill Bootstrap's nav-link transition at the variable level */
    --bs-nav-link-transition: none;
    width: 260px;
    height: 100vh;
    height: 100dvh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 200;
    overflow: hidden;
    transition: width 0.2s ease;
    flex-shrink: 0;
}

/* Collapsed state */
body.sidebar-collapsed .sidebar { width: 56px; }
body.sidebar-collapsed .main    { margin-left: 56px !important; }
body.sidebar-collapsed .sidebar-brand,
body.sidebar-collapsed .sidebar-sub,
body.sidebar-collapsed .sidebar-logo > div,
body.sidebar-collapsed .nav-label-text,
body.sidebar-collapsed .sidebar-footer .user-details,
body.sidebar-collapsed .sidebar-footer .user-status-dot,
body.sidebar-collapsed .sidebar-footer .btn-logout { display: none; }
body.sidebar-collapsed .nav-link span { display: none; }
body.sidebar-collapsed .sidebar-logo { justify-content: center; padding: 1rem; }

/* Sidebar logo / brand */
.sidebar-logo {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.875rem;
    flex-shrink: 0;
    text-decoration: none;
}

.sidebar-logo img {
    width: 38px; height: 38px;
    border-radius: 9px;
    flex-shrink: 0;
    /* PWA icon — ensure crisp rendering */
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.sidebar-logo > div {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.sidebar-brand {
    font-family: 'Syne', sans-serif;
    font-weight: 900;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    color: var(--text);
    white-space: nowrap;
    line-height: 1;
}

.sidebar-brand span { color: var(--gold); }

.sidebar-sub {
    font-size: 0.56rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    white-space: nowrap;
    font-family: 'Space Mono', monospace;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section,
.sidebar .nav-section,
.sidebar-nav .nav-section {
    font-size: 0.62rem !important;
    font-weight: 400 !important;
    letter-spacing: 0.2em !important;
    text-transform: uppercase !important;
    color: var(--muted) !important;
    padding: 0.9rem 1.5rem 0.35rem !important;
    white-space: nowrap !important;
    font-family: 'Space Mono', monospace !important;
    display: block !important;
}

/* ── Sidebar nav ──
   Completely override Bootstrap's .nav-link to prevent flicker.
   Bootstrap transitions + our transitions fight during scroll hover,
   causing colour/background to alternate. Solution:
   1. Kill Bootstrap's transition entirely on sidebar links
   2. Use will-change:color,background to promote to compositor layer
   3. Null out all Bootstrap focus/active pseudo-state styles
   4. Set explicit colours so there's no cascade ambiguity
─────────────────────────────────────────────────────────────── */
.sidebar .nav-link,
.sidebar-nav .nav-link,
.sidebar-nav a,
.sidebar .nav-link:link,
.sidebar .nav-link:visited,
.sidebar-nav .nav-link:link,
.sidebar-nav .nav-link:visited {
    display: flex !important;
    align-items: center !important;
    gap: 0.75rem !important;
    padding: 0.55rem 1.5rem !important;
    font-size: 0.72rem !important;
    font-weight: 400 !important;
    letter-spacing: 0.03em !important;
    color: var(--muted) !important;
    text-decoration: none !important;
    /* Single fast transition — no Bootstrap competing transition */
    transition: color 0.1s ease, background-color 0.1s ease !important;
    -webkit-transition: color 0.1s ease, background-color 0.1s ease !important;
    white-space: nowrap !important;
    border-left: 2px solid transparent !important;
    font-family: 'Space Mono', monospace !important;
    position: relative !important;
    line-height: 1.5 !important;
    background-color: transparent !important;
    background: transparent !important;
    border-radius: 0 !important;
    opacity: 1 !important;
    /* GPU layer — prevents repaint flicker */
    will-change: color, background-color;
    /* Kill Bootstrap outline/box-shadow on focus */
    box-shadow: none !important;
    outline: none !important;
}

/* Hover — explicit background-color (not shorthand) prevents flicker */
.sidebar .nav-link:hover,
.sidebar-nav .nav-link:hover,
.sidebar-nav a:hover {
    color: var(--text) !important;
    background-color: rgba(212,160,23,0.04) !important;
    background: rgba(212,160,23,0.04) !important;
}

/* Kill Bootstrap's :focus-visible highlight which triggers during scroll */
.sidebar .nav-link:focus,
.sidebar .nav-link:focus-visible,
.sidebar-nav .nav-link:focus,
.sidebar-nav .nav-link:focus-visible,
.sidebar-nav a:focus,
.sidebar-nav a:focus-visible {
    color: var(--muted) !important;
    background-color: transparent !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Active page */
.sidebar .nav-link.active,
.sidebar-nav .nav-link.active,
.sidebar-nav a.active,
.sidebar .nav-link.active:focus,
.sidebar .nav-link.active:focus-visible,
.sidebar-nav .nav-link.active:focus,
.sidebar-nav .nav-link.active:focus-visible {
    color: var(--gold) !important;
    background-color: rgba(212,160,23,0.07) !important;
    background: rgba(212,160,23,0.07) !important;
    border-left-color: var(--gold) !important;
    font-weight: 700 !important;
    font-family: 'Space Mono', monospace !important;
    font-size: 0.72rem !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Active hover — stay gold, slightly brighter */
.sidebar .nav-link.active:hover,
.sidebar-nav .nav-link.active:hover,
.sidebar-nav a.active:hover {
    color: var(--gold) !important;
    background-color: rgba(212,160,23,0.1) !important;
    background: rgba(212,160,23,0.1) !important;
}

/* Icons */
.sidebar .nav-link i,
.sidebar-nav .nav-link i,
.sidebar-nav a i {
    font-size: 0.88rem !important;
    width: 18px !important;
    text-align: center !important;
    flex-shrink: 0 !important;
    font-weight: 400 !important;
    /* Prevent icon from triggering separate repaint */
    pointer-events: none;
}

/* Keep old bare .nav-link class from being totally unstyled */
.nav-link {
    font-size: 0.72rem;
    font-weight: 400;
    font-family: 'Space Mono', monospace;
}

.nav-badge {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: #ef4444;
    color: white;
    border-radius: 10px;
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.1rem 0.4rem;
    min-width: 18px;
    text-align: center;
    line-height: 1.4;
}

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

.user-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding-bottom: 0.5rem;
}

.btn-logout {
    display: block;
    text-align: center;
    width: 100%;
    background: transparent;
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    padding: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.12s, border-color 0.12s;
    margin-top: 0.5rem;
}
.btn-logout:hover { color: #f87171; border-color: #f87171; }

/* ── 5. AVATAR ──────────────────────────────────────────────── */
.avatar {
    width: 38px; height: 38px;
    border-radius: 8px;
    background: var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--bg);
    flex-shrink: 0;
    font-family: 'Syne', sans-serif;
    overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.user-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'Syne', sans-serif;
}

.user-role {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ── 6. MAIN & TOPBAR ──────────────────────────────────────── */
.main {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    transition: margin-left 0.2s ease;
    overflow-y: auto;
    overflow-x: hidden;
}


/* ── Council layout — no sidebar, full-width main ── */
body.council-layout .main {
    margin-left: 0 !important;
}
body.council-layout .sidebar {
    display: none !important;
}
body.council-layout .sidebar-overlay {
    display: none !important;
}

.topbar {
    height: 56px;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    border-bottom: 1px solid var(--border);
    background: rgba(8,7,6,0.97);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
    flex-shrink: 0;
}

.topbar h2 {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    letter-spacing: 0.02em;
    margin: 0;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Topbar icon buttons */
.topbar-btn,
.notif-btn,
.mobile-menu-btn,
.sidebar-toggle-btn {
    width: 34px; height: 34px;
    border-radius: 4px;
    border: 1px solid var(--border2);
    background: transparent;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: none;
    transition: color 0.12s, border-color 0.12s;
    flex-shrink: 0;
    position: relative;
}
.topbar-btn:hover,
.notif-btn:hover,
.mobile-menu-btn:hover,
.sidebar-toggle-btn:hover {
    color: var(--gold);
    border-color: var(--gold-dim);
}

.badge-count {
    position: absolute;
    top: -4px; right: -4px;
    min-width: 16px; height: 16px;
    border-radius: 8px;
    background: var(--gold);
    color: var(--bg);
    font-size: 0.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    font-family: 'Space Mono', monospace;
}

/* ── 7. CONTENT ────────────────────────────────────────────── */
.content {
    flex: 1;
    padding: 1.75rem 2rem;
}

/* ── 8. CARDS & PANELS ─────────────────────────────────────── */
.card,
.section-card,
.panel {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1.25rem;
}

.card-header,
.section-header,
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    gap: 0.75rem;
    flex-shrink: 0;
}

.card-title,
.section-title,
.panel-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.02em;
}

.card-body,
.section-body,
.panel-body {
    padding: 1.1rem 1.25rem;
}

/* Section divider label */
.section-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.section-divider::before, .section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border2);
}
.section-divider span {
    font-size: 0.58rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ── 9. STAT CARDS ─────────────────────────────────────────── */
.stat-card,
.stat-box {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 4px;
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
    color: var(--text);
    position: relative;
    overflow: hidden;
}
.stat-card::before, .stat-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212,160,23,0.25), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}
a.stat-card:hover, a.stat-box:hover {
    border-color: var(--border2);
    background: var(--surface2);
}
a.stat-card:hover::before, a.stat-box:hover::before { opacity: 1; }
.stat-card.stat-warn, .stat-box.stat-warn { border-color: rgba(245,158,11,0.3); }
.stat-card.stat-critical, .stat-box.stat-critical { border-color: rgba(239,68,68,0.35); }

.stat-value, .stat-box-val {
    font-family: 'Syne', sans-serif;
    font-weight: 800;
    font-size: 2rem;
    color: var(--text);
    line-height: 1;
}
.stat-value.text-danger { color: #f87171; }

.stat-label, .stat-box-label {
    font-size: 0.6rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-icon {
    width: 36px; height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    margin-bottom: 0.25rem;
}

.stat-sub-badge {
    display: inline-block;
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    background: rgba(239,68,68,0.15);
    color: #f87171;
    margin-left: 0.3rem;
}

/* ── 10. BUTTONS ───────────────────────────────────────────── */
.btn-primary {
    background: var(--gold);
    border: none;
    border-radius: 4px;
    color: var(--bg);
    font-family: 'Space Mono', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 0.65rem 1.25rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: background 0.15s, transform 0.1s;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.4s;
}
.btn-primary:hover { background: var(--gold-mid); color: var(--bg); }
.btn-primary:hover::before { left: 100%; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-secondary,
.btn-outline {
    background: transparent;
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--muted);
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    padding: 0.55rem 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: color 0.12s, border-color 0.12s;
    white-space: nowrap;
}
.btn-secondary:hover,
.btn-outline:hover { color: var(--gold); border-color: var(--gold-dim); }

.btn-danger {
    background: rgba(139,26,26,0.12);
    border: 1px solid rgba(139,26,26,0.35);
    border-radius: 4px;
    color: #f87171;
    font-family: 'Space Mono', monospace;
    font-size: 0.68rem;
    padding: 0.55rem 0.875rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: background 0.12s;
    white-space: nowrap;
}
.btn-danger:hover { background: rgba(139,26,26,0.25); }

.btn-sm { padding: 0.35rem 0.75rem !important; font-size: 0.62rem !important; }

/* Icon-only action button */
.btn-icon {
    width: 32px; height: 32px;
    background: transparent;
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: color 0.12s, border-color 0.12s;
}
.btn-icon:hover { color: var(--gold); border-color: var(--gold-dim); }
.btn-icon.danger:hover { color: #f87171; border-color: rgba(239,68,68,0.5); }

/* ── 11. FORMS ─────────────────────────────────────────────── */
.form-label,
label.form-label {
    display: block;
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.4rem;
    font-family: 'Space Mono', monospace;
    font-weight: 400;
}

.form-control,
.form-select,
input[type="text"].form-control,
input[type="email"].form-control,
input[type="password"].form-control,
input[type="url"].form-control,
input[type="number"].form-control,
input[type="search"].form-control,
select.form-control,
textarea.form-control {
    background: var(--surface2) !important;
    border: 1px solid var(--border2) !important;
    border-radius: 4px !important;
    color: var(--text) !important;
    font-family: 'Space Mono', monospace !important;
    font-size: 0.8rem !important;
    padding: 0.625rem 0.875rem !important;
    outline: none !important;
    transition: border-color 0.12s, box-shadow 0.12s !important;
    width: 100%;
}
.form-control:focus,
.form-select:focus {
    border-color: var(--gold-dim) !important;
    box-shadow: 0 0 0 3px rgba(212,160,23,0.07) !important;
    background: var(--surface2) !important;
    color: var(--text) !important;
}
.form-control::placeholder { color: var(--dim) !important; }
.form-select option { background: var(--surface2); color: var(--text); }
textarea.form-control { resize: vertical; min-height: 80px; }
.input-group-text {
    background: var(--surface2);
    border: 1px solid var(--border2);
    border-radius: 4px;
    color: var(--muted);
    font-size: 0.8rem;
}
.form-check-input {
    background-color: var(--surface2);
    border-color: var(--border2);
}
.form-check-input:checked {
    background-color: var(--gold);
    border-color: var(--gold);
}
.form-check-label {
    color: var(--text);
    font-size: 0.8rem;
}

/* ── 12. TABLES ────────────────────────────────────────────── */
.admin-table,
.table,
.mod-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.admin-table th,
.table th,
.mod-table th {
    font-family: 'Space Mono', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-weight: 400;
    background: rgba(0,0,0,0.25);
}

.admin-table td,
.table td,
.mod-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
    font-size: 0.8rem;
}

.admin-table tr:last-child td,
.table tr:last-child td,
.mod-table tr:last-child td { border-bottom: none; }

.admin-table tr:hover td,
.table tr:hover td,
.mod-table tr:hover td { background: rgba(212,160,23,0.025); }

/* ── 13. BADGES & TAGS ─────────────────────────────────────── */
.role-badge {
    display: inline-block;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.22rem 0.65rem;
    border-radius: 3px;
}
.role-admin      { background: rgba(212,160,23,0.12); color: var(--gold);  border: 1px solid rgba(212,160,23,0.25); }
.role-manager    { background: rgba(59,130,246,0.1);  color: #60a5fa; border: 1px solid rgba(59,130,246,0.25); }
.role-member     { background: rgba(34,197,94,0.08);  color: #86efac; border: 1px solid rgba(34,197,94,0.2); }
.role-council    { background: rgba(167,139,250,0.12); color: #a78bfa; border: 1px solid rgba(167,139,250,0.3); }
.role-superadmin { background: rgba(239,68,68,0.1);   color: #f87171; border: 1px solid rgba(239,68,68,0.25); }

.priority-badge, .sev-badge {
    display: inline-block;
    font-size: 0.56rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.18rem 0.5rem;
    border-radius: 2px;
}
.badge-critical, .sev-critical { background: rgba(239,68,68,0.12);  color: #f87171; }
.badge-high,     .sev-high     { background: rgba(245,158,11,0.12); color: #fbbf24; }
.badge-medium,   .sev-medium   { background: rgba(212,160,23,0.1);  color: var(--gold); }
.badge-low,      .sev-low      { background: rgba(59,130,246,0.1);  color: #93c5fd; }
.badge-closed                  { background: rgba(100,100,100,0.1); color: var(--muted); }

.tag-chip {
    display: inline-block;
    font-size: 0.62rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.2rem 0.6rem;
    border-radius: 2px;
    border: 1px solid var(--border2);
    color: var(--muted);
    font-family: 'Space Mono', monospace;
}

.mention {
    background: rgba(212,160,23,0.12);
    color: var(--gold);
    border-radius: 2px;
    padding: 0.05rem 0.3rem;
    font-size: 0.9em;
    font-weight: 700;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ── 14. ALERTS ────────────────────────────────────────────── */
.alert-success {
    background: rgba(34,197,94,0.07);
    border: 1px solid rgba(34,197,94,0.2);
    border-left: 3px solid #22c55e;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    color: #86efac;
    font-size: 0.78rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-danger,
.alert-error {
    background: rgba(139,26,26,0.08);
    border: 1px solid rgba(139,26,26,0.25);
    border-left: 3px solid #c0392b;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    color: #f87171;
    font-size: 0.78rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-info {
    background: rgba(59,130,246,0.07);
    border: 1px solid rgba(59,130,246,0.2);
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    color: #93c5fd;
    font-size: 0.78rem;
    margin-bottom: 1rem;
}

/* ── 15. MODALS (Bootstrap overrides) ─────────────────────── */
.modal-content {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 6px;
    color: var(--text);
    box-shadow: 0 16px 48px rgba(0,0,0,0.6);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.75rem;
}

.modal-title {
    font-family: 'Syne', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-body { padding: 1.5rem 1.75rem; }

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.75rem;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.btn-close { filter: invert(0.7) sepia(0) saturate(0); }
.btn-close:hover { filter: invert(1); }

/* ── 16. EMPTY STATES ──────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
}
.empty-state i {
    font-size: 1.75rem;
    color: var(--border2);
    margin-bottom: 0.25rem;
}

/* ── 17. PRIORITY DOTS ─────────────────────────────────────── */
.priority-dot {
    width: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}
.priority-critical { background: #f87171; }
.priority-high     { background: #f59e0b; }
.priority-medium   { background: var(--gold); }
.priority-low      { background: #60a5fa; }

/* ── 18. CODE BLOCKS ───────────────────────────────────────── */
.code-block,
pre, code {
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'Space Mono', monospace;
    font-size: 0.78rem;
    color: var(--text);
    padding: 0.875rem 1rem;
    overflow-x: auto;
    line-height: 1.6;
}
code {
    padding: 0.1rem 0.35rem;
    font-size: 0.82em;
    color: var(--gold);
    background: rgba(212,160,23,0.08);
    border-radius: 2px;
    border: none;
}

/* ── 19. PWA INSTALL BANNER ────────────────────────────────── */
#pwaInstallBanner {
    background: var(--surface);
    border: 1px solid rgba(212,160,23,0.3);
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

/* ── 20. STATUS PICKER ─────────────────────────────────────── */
#statusPickerPanel {
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

/* ── 21. UTILITY ───────────────────────────────────────────── */
.text-gold    { color: var(--gold); }
.text-muted   { color: var(--muted); }
.text-danger  { color: #f87171; }
.text-success { color: #86efac; }
.text-info    { color: #93c5fd; }

.border-gold   { border-color: rgba(212,160,23,0.3) !important; }
.border-danger { border-color: rgba(239,68,68,0.35) !important; }

.mono { font-family: 'Space Mono', monospace; }
.syne { font-family: 'Syne', sans-serif; font-weight: 700; }

/* ── 22. MOBILE ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 300;
        /* Full width on mobile for better readability */
        width: 300px !important;
    }
    .sidebar.open { transform: translateX(0); }

    .main {
        margin-left: 0 !important;
        width: 100%;
    }

    /* More breathing room on mobile */
    .content { padding: 1.5rem 1.25rem; }

    .topbar {
        padding: 0 1.25rem;
        height: 60px !important;
        min-height: 60px !important;
    }

    .topbar h2 { font-size: 1rem; }

    /* Bigger touch targets on mobile nav */
    .sidebar .nav-link,
    .sidebar-nav .nav-link,
    .sidebar-nav a {
        padding: 0.8rem 1.5rem !important;
        font-size: 0.875rem !important;
        min-height: 48px !important;
    }

    /* Bigger buttons on mobile */
    .btn-primary, .btn-secondary, .btn-outline {
        padding: 0.75rem 1.25rem !important;
        font-size: 0.78rem !important;
        min-height: 44px;
    }
    .btn-sm {
        padding: 0.5rem 1rem !important;
        font-size: 0.72rem !important;
        min-height: 40px !important;
    }

    /* Bigger form inputs */
    .form-control, .form-select {
        padding: 0.75rem 1rem !important;
        font-size: 0.875rem !important;
        min-height: 48px;
    }

    /* Card headers more spacious */
    .card-header, .section-header {
        padding: 1rem 1.25rem !important;
    }
    .card-body, .section-body {
        padding: 1.25rem !important;
    }

    .sidebar-toggle-btn { display: none; }

    /* Overlay when sidebar opens */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.65);
        z-index: 250;
    }
    .sidebar-overlay.show { display: block; }
}

@media (max-width: 480px) {
    .content { padding: 1.25rem 1rem; }
    .stat-value, .stat-box-val { font-size: 1.8rem; }
    .topbar h2 { font-size: 0.95rem; }
}
