/* Marquee Server Console — light SaaS design system (handoff 02_server_ui.md).
   Indigo-violet primary on zinc neutrals; Space Grotesk titles, Hanken Grotesk UI,
   IBM Plex Mono for IDs/money. */

:root {
    --app-bg: #F4F4F5;
    --surface: #FFFFFF;
    --surface-muted: #FAFAFA;
    --surface-muted-2: #FCFCFD;
    --border: #E4E4E7;
    --border-soft: #EDEDED;
    --border-faint: #F0F0F1;
    --ink: #18181B;
    --ink-2: #3F3F46;
    --ink-3: #52525B;
    --ink-muted: #71717A;
    --ink-faint: #A1A1AA;
    --primary: #5B47E0;
    --primary-2: #8B5BE0;
    --primary-tint: #F1EEFE;
    --primary-tint-2: #F4F1FE;
    --primary-tint-border: #DDD6FB;
    --gold: #C8922A;
    --gold-deep: #9A6E18;
    --success-fg: #15803D;
    --success-bg: #DCFCE7;
    --success-dot: #22C55E;
    --warning-fg: #B45309;
    --warning-bg: #FEF3C7;
    --warning-dot: #F59E0B;
    --danger-fg: #B91C1C;
    --danger-border: #FECACA;
    --info-fg: #3457B2;
    --info-bg: #E6EEFF;
    --font-display: "Space Grotesk", system-ui, sans-serif;
    --font-ui: "Hanken Grotesk", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;
    --radius: 12px;
    --radius-lg: 16px;
    --shadow-raised: 0 28px 64px -22px rgba(24, 24, 27, .32);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--app-bg);
    color: var(--ink);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; color: var(--ink); margin: 0 0 4px; }
h1 { font-size: 26px; }
h3 { font-size: 16px; }
a { color: var(--primary); text-decoration: none; }
p { color: var(--ink-3); margin: 4px 0 16px; }
.mono { font-family: var(--font-mono); }

/* ── App shell ───────────────────────────────────────────────── */
.app { display: flex; min-height: 100vh; }

.rail {
    width: 236px; flex: 0 0 236px;
    background: var(--surface-muted);
    border-right: 1px solid var(--border-soft);
    padding: 18px 14px;
    display: flex; flex-direction: column; gap: 4px;
}
.rail .brand { display: flex; align-items: center; gap: 10px; padding: 6px 6px 16px; }
.rail .brand .logo {
    width: 30px; height: 30px; border-radius: 9px;
    background: linear-gradient(140deg, #5B47E0, #8B5BE0);
    display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700;
    font-family: var(--font-display);
}
.rail .brand .name { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1; }
.rail .brand .sub { font-size: 10px; font-weight: 700; color: var(--ink-faint); letter-spacing: .08em; }
.rail .section-label { font-size: 11px; font-weight: 700; color: var(--ink-faint); letter-spacing: .06em; padding: 12px 10px 6px; }

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 13px; border-radius: 9px;
    font-size: 14px; font-weight: 600; color: var(--ink-3);
    cursor: pointer; user-select: none;
}
.nav-item:hover { background: #F4F4F5; }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; }
.nav-item.active, .nav-item[aria-current="page"] { color: var(--primary); background: var(--primary-tint); }
.nav-item .count-pill {
    margin-left: auto; background: var(--warning-bg); color: var(--warning-fg);
    border-radius: 999px; font-size: 11px; font-weight: 700; padding: 1px 8px;
}
.rail .rail-footer {
    margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px;
    border-top: 1px solid var(--border-soft);
}
.rail .rail-footer .avatar {
    width: 32px; height: 32px; border-radius: 999px; background: #27272A; color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700;
}
.rail .rail-footer .who { font-size: 13px; font-weight: 600; color: var(--ink); }
.rail .rail-footer .role { font-size: 12px; color: var(--ink-muted); }

.section { flex: 1; display: flex; flex-direction: column; background: var(--surface); min-width: 0; }
.section-body { padding: 28px 32px; flex: 1; }
.status-footer {
    height: 54px; border-top: 1px solid var(--border-soft); padding: 0 32px;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px; color: var(--ink-muted);
}
.status-footer .live { display: inline-flex; align-items: center; gap: 8px; }
.status-footer .dot { width: 8px; height: 8px; border-radius: 999px; background: var(--success-dot); }
.status-footer .cap { font-family: var(--font-mono); color: var(--ink-faint); }

/* ── Header row ───────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.page-head .subtitle { color: var(--ink-muted); font-size: 14px; }
.head-actions { display: flex; gap: 8px; }

/* ── Cards & stats ────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px 18px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius); padding: 16px 18px; }
.stat-card .label { font-size: 13px; color: var(--ink-muted); margin-bottom: 6px; }
.stat-card .num { font-family: var(--font-display); font-size: 30px; font-weight: 600; }
.stat-card.good .num { color: var(--success-fg); }
.stat-card.warn .num { color: var(--warning-fg); }
.stat-card.faint .num { color: var(--ink-faint); }

/* ── Approval banner ──────────────────────────────────────────── */
.approval-banner {
    border: 1px solid #F4D9A6; background: linear-gradient(180deg, #FFFCF4, #FFF8E8);
    border-radius: 14px; padding: 20px 24px; margin-bottom: 20px;
    display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.approval-banner .title { color: #7C4A0C; font-weight: 700; }
.approval-banner .meta { color: var(--gold-deep); font-size: 13px; }
.approval-banner .claim {
    font-family: var(--font-mono); font-size: 26px; color: #7C4A0C; letter-spacing: .08em;
    padding: 0 24px; border-left: 1px solid #F0DCB0; border-right: 1px solid #F0DCB0;
}
.approval-banner .devkey { font-family: var(--font-mono); font-size: 12px; color: var(--gold-deep); word-break: break-all; max-width: 180px; }

/* ── Tables ───────────────────────────────────────────────────── */
table { border-collapse: collapse; width: 100%; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 14px; overflow: hidden; }
thead tr { background: var(--surface-muted); }
th { text-align: left; padding: 11px 24px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); }
td { padding: 14px 24px; border-top: 1px solid var(--border-faint); color: var(--ink-2); font-size: 14px; }
tbody tr:first-child td { border-top: 1px solid var(--border-soft); }
td .id { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--ink); }
td .muted { color: var(--ink-muted); font-size: 13px; }

/* ── Pills ────────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.pill .dot { width: 7px; height: 7px; border-radius: 999px; }
.pill.active { background: var(--success-bg); color: var(--success-fg); }
.pill.active .dot { background: var(--success-dot); }
.pill.pending { background: var(--warning-bg); color: var(--warning-fg); }
.pill.pending .dot { background: var(--warning-dot); }
.pill.suspended { background: #F4F4F5; color: var(--ink-muted); }
.pill.suspended .dot { background: var(--ink-faint); }
.pill.revoked { background: #FEF2F2; color: var(--danger-fg); }
.pill.revoked .dot { background: var(--danger-fg); }
.pill.scheduled { background: var(--info-bg); color: var(--info-fg); }
.pill.draft { background: #F4F4F5; color: var(--ink-muted); }
/* tiers */
.pill.tier-silver { background: #EEF1F5; color: #5B6573; }
.pill.tier-gold { background: #FBF1DA; color: #9A6E18; }
.pill.tier-platinum { background: #E0F0F3; color: #27707E; }
.pill.tier-onyx { background: #27272A; color: #F4E9CB; }

.code { font-family: var(--font-mono); font-size: 22px; letter-spacing: .08em; color: var(--gold-deep); }

/* ── Buttons ──────────────────────────────────────────────────── */
button, .btn {
    font-family: var(--font-ui); font-size: 14px; font-weight: 600;
    background: var(--surface); color: var(--ink-2);
    border: 1px solid var(--border); border-radius: 9px; padding: 8px 14px;
    cursor: pointer; margin-right: 6px; transition: background .12s, border-color .12s;
}
button:hover, .btn:hover { background: #FAFAFA; border-color: #D4D4D8; }
button:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary, button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover, button.primary:hover { background: #4F3DCC; border-color: #4F3DCC; }
.btn-success, button.success { background: var(--success-fg); color: #fff; border-color: var(--success-fg); }
.btn-danger, button.danger { background: var(--surface); color: var(--danger-fg); border-color: var(--danger-border); }

/* ── Inputs ───────────────────────────────────────────────────── */
input, select {
    font-family: var(--font-ui); font-size: 14px;
    background: var(--surface); color: var(--ink);
    border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-tint); }
input::placeholder { color: var(--ink-faint); }
label { font-size: 13px; color: var(--ink-3); display: block; }

/* ── Sign-in (pre-auth, full screen) ──────────────────────────── */
.auth-screen {
    position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 40px;
    background: radial-gradient(120% 120% at 50% 22%, #F4F1FE, #FAFAFA 65%);
}
.auth-screen::before {
    content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(91, 71, 224, .09) 1px, transparent 1px); background-size: 22px 22px;
}
.auth-overlay {
    position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 40px;
    background: rgba(24, 24, 27, .38);
}
.otp-input { font-family: var(--font-mono); font-size: 22px; letter-spacing: .3em; text-align: center; }
.auth-card {
    position: relative; width: 440px; max-width: 100%; background: var(--surface);
    border: 1px solid var(--border-soft); border-radius: 20px; padding: 34px 36px; box-shadow: var(--shadow-raised);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.auth-brand .logo {
    width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(140deg, #5B47E0, #8B5BE0);
    display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-family: var(--font-display);
}
.auth-brand .name { font-family: var(--font-display); font-weight: 700; font-size: 16px; line-height: 1; }
.auth-brand .sub { font-size: 10px; font-weight: 700; color: var(--ink-faint); letter-spacing: .08em; }
.auth-title { font-family: var(--font-display); font-size: 25px; margin: 0; }
.auth-sub { color: var(--ink-muted); margin: 4px 0 20px; }
.auth-error { color: var(--danger-fg); background: #FEF2F2; border: 1px solid var(--danger-border); border-radius: 9px; padding: 8px 12px; margin: 0 0 14px; }
.btn-passkey {
    width: 100%; margin: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px;
    box-shadow: 0 10px 30px -10px rgba(91, 71, 224, .6);
}
.btn-passkey svg { width: 18px; height: 18px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--ink-faint); font-size: 12px; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; background: var(--border-soft); flex: 1; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input { padding: 11px 13px; }
.btn-block { width: 100%; margin: 0; padding: 11px; }
.auth-foot { color: var(--ink-faint); font-size: 12px; font-family: var(--font-mono); margin: 18px 0 0; text-align: center; }
.auth-foot a { color: var(--ink-muted); }

/* ── Players split + CS detail panel (02 §3) ──────────────────── */
.split { display: grid; grid-template-columns: 1fr 392px; align-items: start; }
.split > .main { min-width: 0; padding-right: 24px; }
.cs-panel { border-left: 1px solid var(--border-soft); background: var(--surface-muted-2); border-radius: 14px; padding: 22px; }

.chips { display: flex; gap: 8px; margin: 14px 0 16px; flex-wrap: wrap; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 600; color: var(--ink-3); cursor: pointer; }
.chip:hover { background: #FAFAFA; }
.chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.search { display: inline-flex; align-items: center; gap: 8px; }
.player-cell { display: flex; align-items: center; gap: 10px; }
.avatar-sm { width: 34px; height: 34px; border-radius: 999px; background: #EEF0F3; color: #3F3F46; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: 0 0 34px; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: #FBFBFE; }
tbody tr.selected td { background: #FAF9FF; }
tbody tr.selected td:first-child { box-shadow: inset 3px 0 0 var(--primary); }
.gold { color: var(--gold-deep); }

.cs-head { display: flex; gap: 12px; align-items: center; }
.avatar-lg { width: 56px; height: 56px; border-radius: 999px; background: #27272A; color: #F4E9CB; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex: 0 0 56px; }
.cs-head .nm { font-family: var(--font-display); font-size: 19px; font-weight: 600; }
.cs-chips { display: flex; gap: 6px; margin: 12px 0 4px; flex-wrap: wrap; }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; margin: 18px 0; }
.metric .k { font-size: 11px; color: var(--ink-faint); letter-spacing: .04em; text-transform: uppercase; }
.metric .v { font-family: var(--font-mono); font-size: 18px; color: var(--ink); }
.section-cap { font-size: 11px; font-weight: 700; color: var(--ink-faint); letter-spacing: .06em; text-transform: uppercase; margin: 18px 0 8px; }
.bucket-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.bucket-row .lbl { display: flex; align-items: center; gap: 8px; color: var(--ink-3); }
.bucket-row .amt { font-family: var(--font-mono); }
.bucket-row.total { border-top: 1px solid var(--border-soft); margin-top: 6px; padding-top: 10px; font-weight: 700; }
.bucket-row.total .amt { color: var(--ink); }
.bdot { width: 8px; height: 8px; border-radius: 999px; }
.bdot.promo { background: #FF3D8B; } .bdot.bonus { background: #C44DF0; } .bdot.cash { background: #2DE2E6; }
.recent-row { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--border-faint); font-size: 13px; }
.recent-row .when { color: var(--ink-muted); }
.cs-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; border-top: 1px solid var(--border-soft); padding-top: 16px; }
.cs-actions input { width: 92px; }

/* ── Content library card grid (02 §4a) ───────────────────────── */
.lib-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 1200px) { .lib-grid { grid-template-columns: repeat(3, 1fr); } }
.asset-card { border: 1px solid var(--border-soft); border-radius: 13px; overflow: hidden; background: var(--surface); }
.asset-thumb { height: 128px; position: relative; background-size: cover; background-position: center; }
.asset-thumb .dur { position: absolute; top: 8px; right: 8px; background: rgba(0, 0, 0, .55); color: #fff; font-family: var(--font-mono); font-size: 11px; padding: 2px 7px; border-radius: 6px; }
.asset-thumb .type { position: absolute; bottom: 8px; left: 8px; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }
.type-video { background: #EFEDFE; color: #5B47E0; } .type-image { background: #E6F4FB; color: #0B7FB0; } .type-html { background: #FBF1DA; color: #9A6E18; }
.asset-body { padding: 12px 14px; }
.asset-body .ttl { font-size: 13.5px; font-weight: 600; color: var(--ink); word-break: break-all; line-height: 1.35; }
.asset-body .meta { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.asset-body .meta button { padding: 4px 9px; font-size: 12px; }
.asset-body .meta .spacer { flex: 1; }
.note-card { border: 1px dashed var(--border); border-radius: 13px; padding: 16px 18px; color: var(--ink-muted); background: var(--surface-muted); margin-top: 22px; }

/* ── Users & access (02 §5a) ──────────────────────────────────── */
.role-admin { color: #5B47E0; font-weight: 600; }
.role-cs { color: #1F8A5B; font-weight: 600; }
.role-marketing { color: #9A6E18; font-weight: 600; }
.pill.passkey { background: var(--primary-tint); color: var(--primary); }
.pill.totp { background: #F4F4F5; color: #52525B; }
.roles-panel { border: 1px solid var(--border-soft); border-radius: 14px; background: var(--surface-muted-2); padding: 18px; }
.roles-panel h3 { margin-bottom: 4px; }
.role-row { padding: 12px 0; border-top: 1px solid var(--border-faint); }
.role-row:first-of-type { border-top: none; }
.role-row .top { display: flex; align-items: center; gap: 8px; }
.role-row .chip-dot { width: 10px; height: 10px; border-radius: 3px; flex: 0 0 10px; }
.role-row .nm { font-weight: 600; color: var(--ink); }
.role-row .ct { margin-left: auto; color: var(--ink-faint); font-size: 12px; }
.role-row .summary { color: var(--ink-muted); font-size: 13px; margin-top: 4px; }
.access-foot { display: flex; align-items: center; gap: 8px; color: var(--ink-muted); font-size: 13px; margin-top: 18px; }

/* clickable operator footer → self-service Security */
.rail .rail-footer-link { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 1; min-width: 0; border-radius: 8px; padding: 4px; margin: -4px; }
.rail .rail-footer-link:hover { background: #F4F4F5; }
.rail .rail-footer-link:hover .who { color: var(--primary); }
