/* CSRP Staff Panel — "Street Gold" design system.
   Dark by default; light follows the device unless the user picks one (data-theme on <html>). */

:root {
    --bg: #0d0e11;
    --bg-2: #121317;
    --surface: #17181d;
    --surface-2: #1f2027;
    --surface-3: #272933;
    --border: #2a2c35;
    --border-strong: #3a3d48;
    --text: #efece4;
    --text-2: #c9c5bb;
    --muted: #8f8d87;
    --gold: #f2b33d;
    --gold-2: #ffcf6b;
    --gold-ink: #1c1405;
    --gold-text: #f5c25e;
    --gold-soft: rgba(242, 179, 61, .12);
    --gold-line: rgba(242, 179, 61, .35);
    --ok: #34d399;
    --ok-soft: rgba(52, 211, 153, .12);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, .12);
    --info: #7cb4ff;
    --info-soft: rgba(124, 180, 255, .12);
    --shadow: 0 10px 30px rgba(0, 0, 0, .35);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, .25);
    --glass: rgba(18, 19, 23, .72);
    --radius: 14px;
    --radius-sm: 10px;
    --sb-w: 264px;
    --sb-w-collapsed: 78px;
    --ease: cubic-bezier(.2, .8, .2, 1);
    color-scheme: dark;
}

@media (prefers-color-scheme: light) {
    :root:not([data-theme="dark"]) {
        --bg: #f5f2ea;
        --bg-2: #fbf9f4;
        --surface: #ffffff;
        --surface-2: #f3efe5;
        --surface-3: #e9e3d4;
        --border: #e5dfd1;
        --border-strong: #d4ccb9;
        --text: #1c1a16;
        --text-2: #3d3a33;
        --muted: #6f6a5f;
        --gold: #e2a124;
        --gold-2: #f2b33d;
        --gold-ink: #1c1405;
        --gold-text: #9a6500;
        --gold-soft: rgba(226, 161, 36, .14);
        --gold-line: rgba(180, 120, 10, .35);
        --ok: #0f9d6e;
        --ok-soft: rgba(15, 157, 110, .1);
        --bad: #d63b3b;
        --bad-soft: rgba(214, 59, 59, .09);
        --info: #2563eb;
        --info-soft: rgba(37, 99, 235, .09);
        --shadow: 0 10px 30px rgba(60, 45, 10, .12);
        --shadow-sm: 0 2px 10px rgba(60, 45, 10, .08);
        --glass: rgba(251, 249, 244, .78);
        color-scheme: light;
    }
}

:root[data-theme="light"] {
    --bg: #f5f2ea;
    --bg-2: #fbf9f4;
    --surface: #ffffff;
    --surface-2: #f3efe5;
    --surface-3: #e9e3d4;
    --border: #e5dfd1;
    --border-strong: #d4ccb9;
    --text: #1c1a16;
    --text-2: #3d3a33;
    --muted: #6f6a5f;
    --gold: #e2a124;
    --gold-2: #f2b33d;
    --gold-ink: #1c1405;
    --gold-text: #9a6500;
    --gold-soft: rgba(226, 161, 36, .14);
    --gold-line: rgba(180, 120, 10, .35);
    --ok: #0f9d6e;
    --ok-soft: rgba(15, 157, 110, .1);
    --bad: #d63b3b;
    --bad-soft: rgba(214, 59, 59, .09);
    --info: #2563eb;
    --info-soft: rgba(37, 99, 235, .09);
    --shadow: 0 10px 30px rgba(60, 45, 10, .12);
    --shadow-sm: 0 2px 10px rgba(60, 45, 10, .08);
    --glass: rgba(251, 249, 244, .78);
    color-scheme: light;
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

::selection { background: var(--gold); color: var(--gold-ink); }

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
p { margin: 0 0 .75em; }

.i { width: 20px; height: 20px; flex: none; display: inline-block; vertical-align: middle; }
.i-sm { width: 16px; height: 16px; }
.i-lg { width: 26px; height: 26px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .92em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* ---------- App shell ---------- */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sb-w);
    display: flex;
    flex-direction: column;
    background: var(--bg-2);
    border-right: 1px solid var(--border);
    z-index: 30;
    transition: width .28s var(--ease);
}

.main {
    margin-left: var(--sb-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left .28s var(--ease);
}

.sb-head { display: flex; align-items: center; gap: 8px; padding: 16px 14px 10px 16px; }

.sb-brand { display: flex; align-items: center; gap: 12px; color: var(--text); min-width: 0; flex: 1; }
.sb-brand:hover { text-decoration: none; }
.sb-brand img { width: 42px; height: 42px; flex: none; filter: drop-shadow(0 4px 10px rgba(242, 179, 61, .25)); }
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.15; white-space: nowrap; overflow: hidden; }
.sb-brand-text strong { font-size: 17px; letter-spacing: .06em; }
.sb-brand-text small { color: var(--muted); font-size: 12px; }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    flex: none;
    transition: background .15s, color .15s, transform .2s var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.sb-collapse .i { transition: transform .28s var(--ease); }

.sb-nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.sb-group { margin: 16px 10px 6px; font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; }

.sb-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin: 2px 0;
    border-radius: 11px;
    color: var(--text-2);
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.sb-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.sb-link.active { background: var(--gold-soft); color: var(--gold-text); font-weight: 600; }
.sb-link.active::before {
    content: "";
    position: absolute;
    left: -12px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--gold);
}
.sb-label { overflow: hidden; text-overflow: ellipsis; flex: 1; }

.count-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--gold);
    color: var(--gold-ink);
    font-size: 11.5px;
    font-weight: 700;
    display: inline-grid;
    place-items: center;
}

.sb-foot { padding: 12px; border-top: 1px solid var(--border); display: grid; gap: 10px; }

.me-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); min-width: 0; }
.me-info { min-width: 0; flex: 1; line-height: 1.25; }
.me-info strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.me-actions { display: flex; gap: 2px; }
.me-actions form { margin: 0; }

.credit { font-size: 11.5px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; }
.credit b { color: var(--gold-text); font-weight: 600; }

/* Collapsed sidebar (desktop) */
.sb-collapsed .sidebar { width: var(--sb-w-collapsed); }
.sb-collapsed .main { margin-left: var(--sb-w-collapsed); }
.sb-collapsed .sb-head { flex-direction: column; padding: 14px 10px 6px; }
.sb-collapsed .sb-brand { justify-content: center; }
.sb-collapsed .sb-brand-text,
.sb-collapsed .sb-label,
.sb-collapsed .sb-group,
.sb-collapsed .me-info,
.sb-collapsed .credit { display: none; }
.sb-collapsed .sb-collapse .i { transform: rotate(180deg); }
.sb-collapsed .sb-nav { padding: 6px 10px; }
.sb-collapsed .sb-link { justify-content: center; padding: 11px 0; }
.sb-collapsed .sb-link .count-badge { position: absolute; top: 3px; right: 6px; min-width: 17px; height: 17px; font-size: 10px; padding: 0 4px; }
.sb-collapsed .me-card { flex-direction: column; padding: 8px 4px; }
.sb-collapsed .me-actions { flex-direction: column; }

/* Tooltips for the icon rail */
.sb-collapsed [data-tip]:hover::after {
    content: attr(data-tip);
    position: absolute;
    left: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%);
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--surface-3);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    pointer-events: none;
    z-index: 40;
}

/* Mobile top bar */
.appbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 20;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    padding-top: max(10px, env(safe-area-inset-top));
    background: var(--glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.appbar-brand { display: flex; align-items: center; gap: 10px; color: var(--text); min-width: 0; flex: 1; }
.appbar-brand:hover { text-decoration: none; }
.appbar-brand img { width: 34px; height: 34px; }
.appbar-brand strong { font-size: 16px; letter-spacing: .05em; }
.appbar form { margin: 0; }

.nojs-nav { display: none; }

.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 32px 40px; flex: 1; }

.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.pagehead h1 { font-size: 26px; font-weight: 700; }
.pagehead p { color: var(--muted); margin: 6px 0 0; max-width: 680px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-text); margin-bottom: 6px; }

.site-foot { padding: 18px 32px 26px; text-align: center; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); }
.site-foot b { color: var(--gold-text); }
.site-foot .dot { margin: 0 8px; opacity: .5; }

/* ---------- Components ---------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-head h2 .i { color: var(--gold-text); }
.card-tight { padding: 0; overflow: hidden; }

.section-title { font-size: 15px; font-weight: 700; margin: 30px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .i { color: var(--gold-text); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.stack { display: grid; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
    position: relative;
    display: block;
    padding: 18px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    overflow: hidden;
    transition: transform .2s var(--ease), border-color .2s;
}
a.stat:hover { transform: translateY(-2px); border-color: var(--gold-line); text-decoration: none; }
.stat .stat-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 14px; background: var(--surface-2); color: var(--text-2); }
.stat .num { font-size: 30px; font-weight: 750; line-height: 1; letter-spacing: -.02em; }
.stat .label { margin-top: 6px; color: var(--muted); font-size: 13px; }
.stat.hot { border-color: var(--gold-line); background: linear-gradient(160deg, var(--gold-soft), var(--surface) 60%); }
.stat.hot .stat-icon { background: var(--gold); color: var(--gold-ink); }
.stat.good .stat-icon { background: var(--ok-soft); color: var(--ok); }
.stat.info .stat-icon { background: var(--info-soft); color: var(--info); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 11px;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .15s var(--ease), background .15s, border-color .15s, box-shadow .2s;
}
.btn:hover { text-decoration: none; background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn .i { width: 18px; height: 18px; }
.btn-primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); border-color: transparent; color: var(--gold-ink); }
.btn-primary:hover { background: linear-gradient(180deg, var(--gold-2), var(--gold-2)); box-shadow: 0 6px 20px rgba(242, 179, 61, .3); }
.btn-ok { background: var(--ok); border-color: transparent; color: #06231a; }
.btn-ok:hover { background: var(--ok); filter: brightness(1.08); }
.btn-bad { background: var(--bad); border-color: transparent; color: #fff; }
.btn-bad:hover { background: var(--bad); filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-soft-bad { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.btn-soft-bad:hover { background: var(--bad-soft); filter: brightness(1.15); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--gold-text); font-weight: 600; }
.btn-link:hover { background: none; text-decoration: underline; }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, input[type=text], input[type=password], select, textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border-radius: 11px;
    border: 1px solid var(--border-strong);
    background: var(--bg-2);
    color: var(--text);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-icon input { padding-left: 40px; }
.code-input { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 20px; letter-spacing: .28em; text-transform: uppercase; text-align: center; }

/* Pills and badges */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.pill .i { width: 13px; height: 13px; }
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill-gold { background: var(--gold-soft); color: var(--gold-text); border-color: transparent; }
.pill-info { background: var(--info-soft); color: var(--info); border-color: transparent; }

.role-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.role-badge .i { width: 13px; height: 13px; }
.role-badge.is-ceo { background: var(--gold-soft); color: var(--gold-text); border-color: var(--gold-line); }

.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status-dot.off { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }

/* Avatars */
.avatar { width: 38px; height: 38px; border-radius: 12px; display: inline-grid; place-items: center; flex: none; font-weight: 700; font-size: 14px; letter-spacing: .02em; color: #fff; }
.avatar.sm { width: 30px; height: 30px; border-radius: 9px; font-size: 12px; }
.avatar.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 20px; }
.av-0 { background: linear-gradient(135deg, #f59e0b, #b45309); }
.av-1 { background: linear-gradient(135deg, #10b981, #047857); }
.av-2 { background: linear-gradient(135deg, #6366f1, #4338ca); }
.av-3 { background: linear-gradient(135deg, #ec4899, #be185d); }
.av-4 { background: linear-gradient(135deg, #06b6d4, #0e7490); }
.av-5 { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.av-6 { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.av-7 { background: linear-gradient(135deg, #84cc16, #4d7c0f); }

/* Flash messages */
.flash { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; border-radius: 12px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface); animation: flash-in .35s var(--ease); }
.flash .i { margin-top: 1px; }
.flash-success { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.flash-success span { color: var(--text); }
.flash-error { border-color: transparent; background: var(--bad-soft); color: var(--bad); }
.flash-error span { color: var(--text); }
.flash-info { border-color: transparent; background: var(--info-soft); color: var(--info); }
.flash-info span { color: var(--text); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

.errors { display: flex; gap: 10px; padding: 13px 15px; border-radius: 12px; margin-bottom: 16px; background: var(--bad-soft); color: var(--bad); }
.errors ul { margin: 0; padding-left: 18px; color: var(--text); }

/* Lists */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-main { min-width: 0; flex: 1; }
.list-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sub { font-size: 13px; color: var(--muted); }

/* Empty states */
.empty { text-align: center; padding: 36px 18px; color: var(--muted); }
.empty .empty-icon { width: 58px; height: 58px; border-radius: 18px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--surface-2); color: var(--gold-text); }
.empty .empty-icon .i { width: 28px; height: 28px; }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; font-size: 15px; }

/* Request cards (review queue) */
.req-card { display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }
.req-card.hot { border-color: var(--gold-line); }
.req-top { display: flex; align-items: center; gap: 12px; }
.req-top .list-main strong { font-size: 16px; }
.req-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.req-facts div { background: var(--surface-2); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.req-facts dt { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.req-facts dd { margin: 2px 0 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.req-actions form { margin: 0; }
.req-note { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 10px; padding: 9px 11px; }

details.reveal > summary { list-style: none; cursor: pointer; }
details.reveal > summary::-webkit-details-marker { display: none; }
details.reveal[open] > summary { display: none; }
.reveal-body { display: grid; gap: 8px; width: 100%; }
details.reveal { flex: 1 1 100%; }
details.reveal:not([open]) { flex: 0 0 auto; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }

/* Segmented control (radio group) */
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 6px 11px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; transition: background .15s, color .15s; }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input[value=allow]:checked + span { background: var(--ok-soft); color: var(--ok); }
.segmented input[value=deny]:checked + span { background: var(--bad-soft); color: var(--bad); }
.segmented input:focus-visible + span { outline: 2px solid var(--gold); }
.segmented input:disabled + span { cursor: not-allowed; opacity: .5; }

/* Toggle switch (checkbox) */
.switch { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { position: relative; width: 42px; height: 24px; flex: none; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .2s; margin-top: 1px; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .22s var(--ease); }
.switch input:checked + .track { background: var(--gold); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .45; }
.switch.locked { cursor: not-allowed; }
.switch-text { min-width: 0; }
.switch-text strong { font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.switch-text small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.perm-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.perm-row:last-child { border-bottom: 0; }
.perm-row .switch-text { flex: 1; min-width: 220px; }

.perm-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 18px 6px; }
.perm-group-head { display: flex; align-items: center; gap: 8px; padding: 12px 0 8px; font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--border); }
.perm-group-head .i { color: var(--gold-text); }

.sticky-save { position: sticky; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-top: 18px; padding: 12px 14px 12px 18px; border-radius: var(--radius); background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--border); box-shadow: var(--shadow); }

/* Secret reveal (invite codes) */
.secret-card { border-color: var(--gold-line); background: linear-gradient(160deg, var(--gold-soft), var(--surface) 55%); }
.secret { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 22px; letter-spacing: .22em; padding: 12px 16px; border-radius: 12px; background: var(--bg-2); border: 1px dashed var(--gold-line); user-select: all; word-break: break-all; }
.secret-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0 12px; }

/* Staff cards */
.staff-card { display: grid; gap: 14px; }
.staff-top { display: flex; gap: 12px; align-items: center; }
.staff-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--muted); }

/* Filters (chips) */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600; }
.chip:hover { text-decoration: none; border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--gold); border-color: transparent; color: var(--gold-ink); }
.chip .count { opacity: .7; font-weight: 700; }

.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input-icon { flex: 1; min-width: 220px; max-width: 360px; }
.toolbar form { margin: 0; display: flex; gap: 8px; flex: 1; }

/* Activity timeline */
.timeline { position: relative; }
.tl-day { position: sticky; top: 0; z-index: 2; display: inline-block; margin: 18px 0 10px; padding: 5px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.tl-day:first-child { margin-top: 0; }
.tl-list { position: relative; margin-left: 18px; padding-left: 26px; border-left: 2px solid var(--border); }
.tl-item { position: relative; padding: 4px 0 18px; }
.tl-icon { position: absolute; left: -45px; top: 2px; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); border: 3px solid var(--bg); }
.tl-icon .i { width: 17px; height: 17px; }
.tone-ok .tl-icon { background: var(--ok-soft); color: var(--ok); }
.tone-bad .tl-icon { background: var(--bad-soft); color: var(--bad); }
.tone-gold .tl-icon { background: var(--gold-soft); color: var(--gold-text); }
.tone-info .tl-icon { background: var(--info-soft); color: var(--info); }
.tl-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 11px 14px; }
.tl-text { margin: 0; }
.tl-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 5px; font-size: 12.5px; color: var(--muted); }
.tl-meta .sep { opacity: .45; }
.tl-more { margin-top: 8px; }
.tl-more summary { cursor: pointer; font-size: 12.5px; color: var(--gold-text); font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.tl-more summary::-webkit-details-marker { display: none; }
.tl-more ul { margin: 8px 0 0; padding: 10px 12px 10px 28px; border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--text-2); }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; font-size: 13px; color: var(--muted); }

/* Feed (dashboard) */
.feed-item { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.feed-item:last-child { border-bottom: 0; }
.feed-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-2); color: var(--text-2); }
.feed-icon .i { width: 16px; height: 16px; }
.feed-item.tone-ok .feed-icon { background: var(--ok-soft); color: var(--ok); }
.feed-item.tone-bad .feed-icon { background: var(--bad-soft); color: var(--bad); }
.feed-item.tone-gold .feed-icon { background: var(--gold-soft); color: var(--gold-text); }
.feed-item.tone-info .feed-icon { background: var(--info-soft); color: var(--info); }
.feed-item p { margin: 0; font-size: 14px; }

.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* Steps (submit page) */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: step; }
.steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--text-2); }
.steps li::before { counter-increment: step; content: counter(step); width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--gold-soft); color: var(--gold-text); font-weight: 700; font-size: 13px; }

/* ---------- Auth screens (not logged in) ---------- */

.auth-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    background:
        radial-gradient(1200px 600px at 10% 10%, rgba(242, 179, 61, .10), transparent 60%),
        radial-gradient(900px 500px at 90% 90%, rgba(242, 179, 61, .06), transparent 60%),
        var(--bg);
}
.auth-hero { position: relative; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 20px; padding: 56px; border-right: 1px solid var(--border); overflow: hidden; }
.auth-hero img { width: 170px; height: 170px; filter: drop-shadow(0 18px 40px rgba(242, 179, 61, .25)); }
.auth-hero h1 { font-size: 40px; font-weight: 800; letter-spacing: -.02em; }
.auth-hero h1 span { color: var(--gold-text); }
.auth-hero p { font-size: 16px; color: var(--text-2); max-width: 440px; }
.auth-points { list-style: none; padding: 0; margin: 4px 0 0; display: grid; gap: 10px; color: var(--text-2); }
.auth-points li { display: flex; gap: 10px; align-items: center; }
.auth-points .i { color: var(--gold-text); }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; gap: 18px; }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 30px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 22px; margin-bottom: 6px; }
.auth-card > p { color: var(--muted); font-size: 14px; }
.auth-logo-mobile { display: none; }
.auth-foot { font-size: 12.5px; color: var(--muted); text-align: center; }
.auth-foot b { color: var(--gold-text); }
.auth-alt { margin-top: 16px; text-align: center; font-size: 14px; color: var(--muted); }
.auth-theme { position: fixed; top: 14px; right: 14px; z-index: 5; }

/* Theme toggle shows the icon for the current mode */
.theme-toggle .i { display: none; }
html:not([data-theme-mode]) .theme-toggle .t-auto,
[data-theme-mode="auto"] .theme-toggle .t-auto,
[data-theme-mode="light"] .theme-toggle .t-light,
[data-theme-mode="dark"] .theme-toggle .t-dark { display: inline-block; }

/* ---------- Orbit navigation (mobile) ---------- */

.orbit { display: none; }

.orbit-backdrop {
    position: fixed;
    inset: 0;
    z-index: 48;
    background: rgba(8, 8, 10, .45);
    backdrop-filter: blur(8px) saturate(1.2);
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s var(--ease);
}
.orbit.open .orbit-backdrop { opacity: 1; pointer-events: auto; }

.orbit-core {
    position: fixed;
    left: 50%;
    bottom: calc(18px + env(safe-area-inset-bottom));
    z-index: 50;
    transform: translateX(-50%);
    width: 66px;
    height: 66px;
    border-radius: 50%;
    border: 0;
    cursor: pointer;
    display: grid;
    place-items: center;
    color: var(--gold-ink);
    background: radial-gradient(circle at 35% 30%, var(--gold-2), var(--gold) 60%, #b97a10);
    box-shadow: 0 10px 30px rgba(242, 179, 61, .35), 0 0 0 6px var(--glass), 0 0 0 7px var(--border);
    transition: transform .35s var(--ease), box-shadow .3s;
}
.orbit-core .i { width: 26px; height: 26px; transition: transform .35s var(--ease), opacity .2s; }
.orbit-core .core-close { position: absolute; opacity: 0; transform: rotate(-90deg) scale(.6); }
.orbit.open .orbit-core { transform: translateX(-50%) scale(.92); box-shadow: 0 0 0 10px rgba(242, 179, 61, .16), 0 0 40px rgba(242, 179, 61, .45); }
.orbit.open .core-page { opacity: 0; transform: rotate(90deg) scale(.6); }
.orbit.open .core-close { opacity: 1; transform: none; }
.orbit-core .core-dot { position: absolute; top: 6px; right: 6px; width: 13px; height: 13px; border-radius: 50%; background: var(--bad); border: 2px solid var(--gold); }
.orbit.open .core-dot { display: none; }
.orbit-caption {
    position: fixed;
    left: 50%;
    bottom: calc(4px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 50;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
    pointer-events: none;
    transition: opacity .2s;
}
.orbit.open .orbit-caption { opacity: 0; }

/* Ring items sit on the core and fly out along an arc; JS sets --x/--y/--d per item. */
.orbit-ring { position: fixed; inset: 0; z-index: 49; pointer-events: none; }
.orbit-item {
    position: fixed;
    left: 50%;
    bottom: calc(18px + 33px + env(safe-area-inset-bottom));
    display: grid;
    justify-items: center;
    gap: 5px;
    width: 72px;
    color: var(--text);
    text-decoration: none;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 50%) scale(.2);
    transition: transform .42s cubic-bezier(.2, 1.3, .4, 1) var(--d, 0ms), opacity .22s var(--ease) var(--d, 0ms);
}
.orbit-item:hover { text-decoration: none; }
.orbit.open .orbit-item {
    opacity: 1;
    pointer-events: auto;
    transform: translate(calc(-50% + var(--x, 0px)), calc(50% + var(--y, 0px))) scale(1);
}
.orbit-bubble {
    position: relative;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    color: var(--text-2);
}
.orbit-bubble .i { width: 23px; height: 23px; }
.orbit-item.active .orbit-bubble { background: var(--gold); color: var(--gold-ink); border-color: transparent; }
.orbit-bubble .count-badge { position: absolute; top: -4px; right: -4px; border: 2px solid var(--bg); }
.orbit-label { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--glass); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); white-space: nowrap; }

/* ---------- Glue ---------- */

.stats, .grid { margin-bottom: 16px; }
.grid:last-child { margin-bottom: 0; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.list-head .section-title { margin: 0; }
.staff-meta .sep, .list-sub .sep { opacity: .45; }
.row-end { align-items: flex-end; }
.row-end .field { margin-bottom: 0; }
.role-edit { margin: 4px 0 14px; }
.role-edit[open] > summary { margin-bottom: 12px; }
.role-edit .grid { margin-top: 4px; }
.card > .perm-chips { margin-top: 4px; }
.card > form.row { margin-top: 12px; }
.tl-day .i { width: 14px; height: 14px; margin-right: 2px; vertical-align: -2px; }
.req-card .list-main strong { font-size: 16px; }
.orbit-core .core-page,
.orbit-core .core-close { display: grid; place-items: center; transition: transform .35s var(--ease), opacity .2s; }

/* ---------- Responsive ---------- */

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 959px) {
    .sidebar { display: none; }
    .main, .sb-collapsed .main { margin-left: 0; }
    .appbar { display: flex; }
    .content { padding: 20px 16px 130px; }
    .site-foot { padding: 16px 16px calc(110px + env(safe-area-inset-bottom)); }
    .pagehead h1 { font-size: 22px; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .orbit { display: block; }
    html:not(.js) .orbit { display: none; }
    html:not(.js) .nojs-nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; }
    .sticky-save { bottom: calc(100px + env(safe-area-inset-bottom)); }

    .auth-body { grid-template-columns: minmax(0, 1fr); }
    .auth-hero { display: none; }
    .auth-logo-mobile { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
    .auth-logo-mobile img { width: 96px; height: 96px; filter: drop-shadow(0 12px 30px rgba(242, 179, 61, .25)); }
    .auth-logo-mobile strong { font-size: 20px; letter-spacing: .05em; }
    .auth-card { padding: 24px 20px; }
}

@media (max-width: 520px) {
    .stats { gap: 10px; }
    .stat { padding: 14px; }
    .stat .num { font-size: 26px; }
    .req-facts { grid-template-columns: minmax(0, 1fr); }
    .segmented span { padding: 6px 9px; }
    .toolbar form { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; transition-delay: 0ms !important; }
}
