/* Kabimya Admin — one stylesheet, design tokens on :root, light + dark. */
:root {
    --bg: #f5f7f6;
    --surface: #ffffff;
    --surface-2: #f7f9f8;
    --surface-3: #eef2f0;
    --text: #111a16;
    --text-2: #3c4842;
    --muted: #6a7670;
    --line: #e3e9e6;
    --line-strong: #d3dcd8;
    --brand: #0b7a54;
    --brand-strong: #075f41;
    --brand-ink: #ffffff;
    --brand-soft: #e2f3eb;
    --onboarded: #3b82c4;
    --onboarded-soft: #e6f0fa;
    --money: #b7791f;
    --money-soft: #fbf1e1;
    --up: #0b7a54;
    --down: #c0392b;
    --danger: #b3261e;
    --danger-soft: #fdecea;
    --info-soft: #e8f0fb;
    --gold: #e0a800;
    --silver: #a3adb5;
    --bronze: #c07a42;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(17, 26, 22, .05);
    --shadow: 0 1px 2px rgba(17, 26, 22, .05), 0 6px 20px -8px rgba(17, 26, 22, .10);
    --focus: 0 0 0 3px rgba(11, 122, 84, .25);
    color-scheme: light;
}

/* Dark: chosen in the top bar (data-theme="dark"), or the system setting when the choice is "System". */
:root[data-theme="dark"] {
        --bg: #0d1311;
        --surface: #141c19;
        --surface-2: #18221e;
        --surface-3: #1e2a25;
        --text: #e8efeb;
        --text-2: #c2cec8;
        --muted: #8d9b94;
        --line: #24302b;
        --line-strong: #2e3c36;
        --brand: #34c38f;
        --brand-strong: #5fd6a9;
        --brand-ink: #04130d;
        --brand-soft: #15332a;
        --onboarded: #6aa9e6;
        --onboarded-soft: #182a3c;
        --money: #e6b04f;
        --money-soft: #33281a;
        --up: #34c38f;
        --down: #f08a7e;
        --danger: #f2827a;
        --danger-soft: #3a1d1b;
        --info-soft: #1a2638;
        --shadow-sm: none;
        --shadow: none;
        --focus: 0 0 0 3px rgba(52, 195, 143, .3);
        color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
            --bg: #0d1311;
            --surface: #141c19;
            --surface-2: #18221e;
            --surface-3: #1e2a25;
            --text: #e8efeb;
            --text-2: #c2cec8;
            --muted: #8d9b94;
            --line: #24302b;
            --line-strong: #2e3c36;
            --brand: #34c38f;
            --brand-strong: #5fd6a9;
            --brand-ink: #04130d;
            --brand-soft: #15332a;
            --onboarded: #6aa9e6;
            --onboarded-soft: #182a3c;
            --money: #e6b04f;
            --money-soft: #33281a;
            --up: #34c38f;
            --down: #f08a7e;
            --danger: #f2827a;
            --danger-soft: #3a1d1b;
            --info-soft: #1a2638;
            --shadow-sm: none;
            --shadow: none;
            --focus: 0 0 0 3px rgba(52, 195, 143, .3);
            color-scheme: dark;
    }
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
h1 { font-size: 24px; line-height: 1.2; margin: 0 0 6px; letter-spacing: -.02em; font-weight: 700; }
h1:focus { outline: none; box-shadow: none; }
h2 { font-size: 15px; margin: 0; font-weight: 650; display: inline-flex; align-items: center; gap: 6px; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.money-text { color: var(--money); font-weight: 600; }
.icon { flex: none; display: inline-block; vertical-align: middle; }
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }

/* ── Shell ─────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 240px; flex: none;
    background: var(--surface);
    border-right: 1px solid var(--line);
    padding: 20px 14px;
    position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); margin-top: -2px; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 11px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--brand), var(--brand-strong));
    color: var(--brand-ink); font-weight: 800; font-size: 17px;
    box-shadow: 0 4px 12px -4px rgba(11, 122, 84, .5);
}
.brand.big .brand-mark { width: 44px; height: 44px; font-size: 21px; border-radius: 13px; }
.nav-group { margin: 4px 10px 8px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 11px; border-radius: var(--radius-sm);
    color: var(--text-2); font-weight: 550;
    transition: background .15s, color .15s;
}
.sidebar nav a .icon { color: var(--muted); transition: color .15s; }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar nav a.active { background: var(--brand-soft); color: var(--brand); }
.sidebar nav a.active .icon { color: var(--brand); }
.sidebar-foot { margin-top: auto; padding: 12px 8px 0; }
.env {
    display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 99px; background: var(--surface-3); color: var(--text-2);
}
.env::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.env.local::before { background: var(--onboarded); }
.env.development::before { background: var(--money); }
.env.staging::before { background: var(--money); }
.env.production::before { background: var(--brand); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 10px 32px; min-height: 60px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    backdrop-filter: saturate(1.4) blur(10px);
    position: sticky; top: 0; z-index: 10;
}
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; }
.me-text { display: flex; flex-direction: column; line-height: 1.25; }
.me-text strong { font-size: 13px; }
.me-text small { color: var(--muted); }
.topbar .menu-btn { display: none; }
.content { padding: 28px 32px 56px; max-width: 1320px; width: 100%; margin: 0 auto; }
.scrim { display: none; }

/* ── Building blocks ───────────────────────────────────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head p.muted { margin: 0; max-width: 680px; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head .small { display: block; margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-2 > .card { margin-bottom: 20px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat {
    position: relative;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 16px 18px 15px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow);
}
.stat::before { content: ""; position: absolute; inset: -1px auto -1px -1px; width: 4px; border-radius: var(--radius) 0 0 var(--radius); background: var(--line-strong); }
.stat.good::before { background: var(--brand); }
.stat.money::before { background: var(--money); }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; display: inline-flex; align-items: center; gap: 6px; }
.stat-value { font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.03em; line-height: 1.15; }
.stat.good .stat-value { color: var(--brand); }
.stat.money .stat-value { color: var(--money); }
.stat-foot { display: flex; align-items: center; gap: 8px; min-height: 20px; flex-wrap: wrap; }
.stat-hint { color: var(--muted); font-size: 12px; }
.sk-card { min-height: 112px; }

.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 650; padding: 1px 7px 1px 5px; border-radius: 99px; }
.delta.up { color: var(--up); background: var(--brand-soft); }
.delta.down { color: var(--down); background: var(--danger-soft); }
.delta.flat { color: var(--muted); background: var(--surface-3); padding-left: 7px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
    border-radius: var(--radius-sm); padding: 8px 14px; min-height: 38px;
    font: inherit; font-weight: 600; cursor: pointer; box-shadow: var(--shadow-sm);
    transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover:not(:disabled) { background: var(--brand-strong); border-color: var(--brand-strong); color: var(--brand-ink); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.sm { min-height: 32px; padding: 5px 11px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 44px; }
.icon-btn {
    display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0;
    border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.link-arrow { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; white-space: nowrap; }
.link-arrow .icon { transition: transform .15s; }
.link-arrow:hover .icon { transform: translateX(2px); }

.toolbar { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 5px; margin: 0; }
.field > span { font-size: 12px; font-weight: 650; color: var(--muted); }
.field.grow { min-width: 260px; flex: 1; max-width: 520px; }
select, input[type=search], input[type=email], input[type=password], input[type=text] {
    font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 11px; min-height: 38px;
    transition: border-color .15s, box-shadow .15s;
}
select { padding-right: 30px; cursor: pointer; }
select:focus, input:focus { outline: none; border-color: var(--brand); box-shadow: var(--focus); }
.search { display: flex; gap: 8px; position: relative; }
.search input { flex: 1; min-width: 0; padding-left: 34px; }
.search .search-icon { position: absolute; left: 11px; top: 11px; color: var(--muted); pointer-events: none; }

.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
    border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 13px;
    padding: 6px 12px; border-radius: 8px; cursor: pointer; min-height: 32px; transition: color .15s, background .15s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table-caption { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 650; background: var(--surface-2); position: sticky; top: 0; z-index: 1; }
th.num { text-align: right; }
th .infotip { margin-left: 2px; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.card:not(.flush) table th:first-child, .card:not(.flush) table td:first-child { padding-left: 0; }
.card:not(.flush) th { background: transparent; }
th.sortable button {
    font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer;
    display: inline-flex; align-items: center; gap: 3px;
}
th.sortable button:hover { color: var(--text); }
th.sorted { color: var(--brand); }
.person { display: inline-flex; align-items: center; gap: 10px; }
.stack { display: inline-flex; flex-direction: column; line-height: 1.3; }

.code-chip { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 1px 2px 1px 8px; }
.code-chip code { font-size: 12.5px; letter-spacing: .02em; }
.code-chip .icon-btn { width: 24px; height: 24px; }

.ratebar { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.ratebar-track { width: 44px; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.ratebar-track > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.ratebar > span:last-child { min-width: 34px; text-align: right; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.pager .muted { margin-right: auto; }

.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--text-2); }
.badge.eligible { background: var(--brand-soft); color: var(--brand); }
.badge.onboarded { background: var(--onboarded-soft); color: var(--onboarded); }

.steps { display: inline-flex; gap: 3px; margin-right: 8px; vertical-align: middle; }
.step { width: 14px; height: 6px; border-radius: 99px; background: var(--surface-3); }
.step.done { background: var(--onboarded); }
.step.done.gold { background: var(--brand); }

.alert { padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.alert.info { background: var(--info-soft); }

.empty-state { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 40px 20px; text-align: center; }
.empty-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); margin-bottom: 4px; }

.infotip { position: relative; display: inline-flex; color: var(--muted); cursor: help; text-transform: none; letter-spacing: 0; font-weight: 400; }
.infotip:hover, .infotip:focus { color: var(--text); }
.infotip .tip {
    position: absolute; top: calc(100% + 8px); left: 50%; transform: translateX(-50%);
    width: max-content; max-width: 260px; white-space: normal; text-align: left;
    background: var(--text); color: var(--bg); font-size: 12px; line-height: 1.45; font-weight: 450;
    padding: 8px 10px; border-radius: 8px; box-shadow: var(--shadow);
    opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 30;
}
.infotip:hover .tip, .infotip:focus .tip { opacity: 1; }

.avatar {
    --hue: 150;
    width: 32px; height: 32px; border-radius: 50%; flex: none;
    display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; letter-spacing: .02em;
    background: hsl(var(--hue) 55% 90%); color: hsl(var(--hue) 45% 28%);
}
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 60px; height: 60px; font-size: 20px; }
:root[data-theme="dark"] .avatar { background: hsl(var(--hue) 30% 24%); color: hsl(var(--hue) 60% 82%); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .avatar { background: hsl(var(--hue) 30% 24%); color: hsl(var(--hue) 60% 82%); }
}

.skeleton { padding: 14px 18px; display: flex; flex-direction: column; gap: 14px; }
.sk-row span, .sk-card {
    background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
    background-size: 400% 100%; animation: shimmer 1.3s ease infinite;
}
.sk-row span { display: block; height: 14px; width: var(--w); border-radius: 6px; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.center-load { min-height: 100vh; display: grid; place-items: center; }
.spinner {
    width: 22px; height: 22px; border-radius: 50%;
    border: 3px solid var(--line); border-top-color: var(--brand);
    animation: spin .8s linear infinite; display: inline-block;
}
.spinner.small { width: 14px; height: 14px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: currentColor; }
@keyframes spin { to { transform: rotate(360deg); } }

.meter { display: block; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 7px; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-strong)); border-radius: 99px; }

.theme-switch { display: inline-flex; background: var(--surface-3); border-radius: 9px; padding: 3px; gap: 2px; }
.theme-switch button {
    display: inline-grid; place-items: center; width: 30px; height: 28px; border: 0; border-radius: 7px;
    background: transparent; color: var(--muted); cursor: pointer;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.login-theme { position: fixed; top: 16px; right: 16px; }
html { transition: background-color .2s; }

.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary.disabled { opacity: .6; pointer-events: none; }
.menu-list {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 270px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px;
    display: flex; flex-direction: column; gap: 2px;
}
.menu-list button {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    border: 0; background: transparent; color: var(--text); font: inherit; padding: 9px 10px; border-radius: 8px; cursor: pointer;
}
.menu-list button:hover { background: var(--surface-2); }
.menu-list button span:last-child { display: flex; flex-direction: column; line-height: 1.3; }
.file-badge { font-size: 10px; font-weight: 800; letter-spacing: .04em; padding: 4px 6px; border-radius: 6px; color: #fff; min-width: 40px; text-align: center; }
.file-badge.xlsx { background: #1d6f42; }
.file-badge.csv { background: var(--muted); }

/* ── Overview ──────────────────────────────────────────────────────── */
.funnel { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 18px; }
.funnel-row { display: grid; grid-template-columns: 90px 1fr 60px 44px; gap: 12px; align-items: center; }
.funnel-name { font-weight: 600; color: var(--text-2); }
.funnel-bar { height: 28px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.funnel-bar > span { display: block; height: 100%; border-radius: 8px; min-width: 4px; transition: width .4s ease; }
.funnel-bar .referred { background: color-mix(in srgb, var(--brand) 30%, var(--surface-3)); }
.funnel-bar .onboarded { background: var(--onboarded); opacity: .8; }
.funnel-bar .eligible { background: var(--brand); }
.funnel-count { font-weight: 700; font-size: 15px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; }
.mini-stats > div { display: flex; flex-direction: column; gap: 2px; }
.mini-stats span { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.mini-stats strong { font-size: 18px; font-variant-numeric: tabular-nums; }

.mini-board { list-style: none; margin: 0; padding: 0; }
.mini-board li { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mini-board li:last-child { border-bottom: 0; }
.mini-board .grow { display: flex; flex-direction: column; line-height: 1.3; }
.rank {
    width: 26px; height: 26px; flex: none; border-radius: 50%;
    display: grid; place-items: center; font-weight: 700; font-size: 12px;
    background: var(--surface-3); color: var(--text-2);
}
.rank.r1 { background: var(--gold); color: #3a2a00; }
.rank.r2 { background: var(--silver); color: #16191b; }
.rank.r3 { background: var(--bronze); color: #fff; }

.chart { position: relative; }
.chart-head { display: flex; justify-content: flex-end; margin: -6px 0 8px; }
.chart-body { position: relative; }
.bars { width: 100%; height: auto; display: block; overflow: visible; }
.bars .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.bars .hit { fill: transparent; }
.bars g { outline: none; cursor: default; }
.bars .bar { fill: var(--brand); opacity: .4; transition: opacity .15s; }
.bars .bar.current { opacity: .95; }
.bars .bar.hover { opacity: 1; }
.bars .axis { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.bars .ytick { fill: var(--muted); font-size: 11px; text-anchor: end; font-variant-numeric: tabular-nums; }
.chart-tip {
    position: absolute; top: 4px; transform: translateX(12px); pointer-events: none;
    background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
    padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; min-width: 180px; z-index: 5;
}
.chart-tip.flip { transform: translateX(calc(-100% - 12px)); }
.chart-tip strong { font-size: 13px; margin-bottom: 2px; }
.chart-tip span { display: flex; align-items: center; gap: 7px; }
.chart-tip b { margin-left: auto; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.referred { background: color-mix(in srgb, var(--brand) 35%, var(--surface-3)); }
.dot.onboarded { background: var(--onboarded); }
.dot.eligible { background: var(--brand); }
.dot.money { background: var(--money); }
.month-table { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.month-table summary { cursor: pointer; color: var(--brand); font-weight: 600; padding: 4px 0; width: max-content; }
.month-table[open] summary { margin-bottom: 8px; }

/* ── Leaderboard ───────────────────────────────────────────────────── */
.podium { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; align-items: end; margin-bottom: 20px; }
.podium-spot {
    position: relative;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); text-align: center; padding: 22px 16px 18px;
    display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.podium-spot.p1 { padding-top: 34px; padding-bottom: 30px; border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
    background: linear-gradient(180deg, color-mix(in srgb, var(--gold) 10%, var(--surface)), var(--surface) 60%); }
.podium-spot.p2 { padding-top: 26px; }
.crown { position: absolute; top: 10px; color: var(--gold); }
.podium-avatar { position: relative; margin-bottom: 4px; }
.medal {
    position: absolute; right: -4px; bottom: -4px;
    width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    font-weight: 800; font-size: 12px; border: 2px solid var(--surface);
}
.p1 .medal { background: var(--gold); color: #3a2a00; }
.p2 .medal { background: var(--silver); color: #16191b; }
.p3 .medal { background: var(--bronze); color: #fff; }
.podium-name { font-size: 15px; overflow-wrap: anywhere; }
.podium-score { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.p1 .podium-score { color: var(--money); font-size: 30px; }
.podium-meta { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; color: var(--muted); font-size: 12px; }
.podium-meta b { color: var(--text-2); }

.board { list-style: none; margin: 0; padding: 0; }
.board li { display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.board li:last-child { border-bottom: 0; }
.board li:hover { background: var(--surface-2); }
.board-name { display: flex; align-items: baseline; gap: 8px; }
.board .meter { max-width: 360px; }
.board .score { font-weight: 750; min-width: 110px; }
.board .hide-sm { min-width: 96px; }

/* ── Sign-in ───────────────────────────────────────────────────────── */
.bare {
    min-height: 100vh; display: grid; place-items: center; padding: 16px;
    background:
        radial-gradient(900px 500px at 10% -10%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 60%),
        radial-gradient(700px 400px at 110% 110%, color-mix(in srgb, var(--money) 10%, transparent), transparent 60%),
        var(--bg);
}
.login-card {
    width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--line);
    border-radius: 18px; box-shadow: var(--shadow); padding: 32px;
}
.login-card .brand { padding: 0 0 24px; }
.login-card form { display: flex; flex-direction: column; gap: 16px; margin-top: 20px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; }
.login-foot { margin: 20px 0 0; font-size: 12px; text-align: center; }

/* ── Small screens ─────────────────────────────────────────────────── */
@media (max-width: 1380px) {
    .hide-lg { display: none; }
}
@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
    .sidebar {
        position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%);
        transition: transform .2s ease; box-shadow: var(--shadow);
    }
    .menu-open .sidebar { transform: none; }
    .menu-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
    .topbar .menu-btn { display: inline-grid; width: 36px; height: 36px; }
    .topbar { padding: 8px 16px; }
    .content { padding: 20px 16px 40px; }
    .me-text { display: none; }
    .stats { gap: 10px; }
    .stat { padding: 13px 14px; }
    .stat-value { font-size: 24px; }
    .podium { grid-template-columns: 1fr; }
    .podium .p1 { order: -1; }
    .hide-sm { display: none !important; }
    .field.grow { min-width: 100%; }
    .funnel-row { grid-template-columns: 76px 1fr 44px 36px; gap: 8px; }
    .mini-stats { grid-template-columns: 1fr 1fr; }
    h1 { font-size: 21px; }
}

#blazor-error-ui {
    background: var(--danger-soft); color: var(--danger);
    bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
    display: none; left: 0; padding: .6rem 1.25rem .7rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: .75rem; top: .5rem; }

/* ── Staff codes ─────────────────────────────────────────────────────── */
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.alert.success { background: var(--brand-soft); color: var(--brand); }
.alert .icon { vertical-align: -3px; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover:not(:disabled) { filter: brightness(1.08); color: #fff; border-color: var(--danger); }
.icon-btn.danger:hover { color: var(--danger); background: var(--danger-soft); }
.icon-btn:disabled { opacity: .45; cursor: default; }
.row-actions { text-align: right; }
.row-actions .icon-btn { margin-left: 2px; }
tr.dim td { color: var(--muted); }
tr.dim .code-chip { opacity: .7; }
td.wrap { white-space: normal; min-width: 240px; }
.badge.staff { background: var(--money-soft); color: var(--money); font-size: 10.5px; padding: 0 7px; margin-left: 7px; vertical-align: 1px; }
.center-load.inline-load { min-height: 0; padding: 28px; display: flex; gap: 10px; justify-content: center; color: var(--muted); }

.modal-backdrop {
    position: fixed; inset: 0; z-index: 60; background: rgba(8, 14, 11, .45);
    display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; outline: none;
    animation: fade-in .12s ease-out;
}
.modal {
    width: min(560px, 100%); background: var(--surface); color: var(--text);
    border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .35); display: flex; flex-direction: column; max-height: calc(100vh - 48px);
    animation: pop-in .14s ease-out;
}
.modal.wide { width: min(820px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 20px 12px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head p { margin: 4px 0 0; max-width: 620px; }
.modal-head .icon-btn { width: 32px; height: 32px; flex: none; }
.modal-body { padding: 4px 20px 16px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.98); } }
@media (prefers-reduced-motion: reduce) { .modal, .modal-backdrop { animation: none; } }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid .alert { margin: 0; }
.form-grid input:not([type=checkbox]) { width: 100%; }
.form-grid input:disabled { background: var(--surface-2); color: var(--muted); }
input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; padding-top: 4px; }
.check input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--brand); }

.dropzone {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
    padding: 34px 20px; border: 2px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted);
    background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; margin-bottom: 12px;
}
.dropzone strong { color: var(--text); }
.dropzone:hover, .dropzone:focus-within { border-color: var(--brand); background: var(--brand-soft); }
.dropzone.busy { opacity: .7; pointer-events: none; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.file-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.file-line .btn { margin-left: auto; }
.file-name { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; }
.upload-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.upload-stats .mini { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.upload-stats .mini b { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.upload-stats .mini span { color: var(--muted); font-size: 12px; }
.upload-stats .mini.good b { color: var(--brand); }
.upload-stats .mini.info b { color: var(--onboarded); }
.upload-stats .mini.bad { border-color: var(--danger); background: var(--danger-soft); }
.upload-stats .mini.bad b, .upload-stats .mini.bad span { color: var(--danger); }
.error-table { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.error-table th, .error-table td { padding: 8px 12px; font-size: 13px; }

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .upload-stats { grid-template-columns: 1fr 1fr; }
    .head-actions { width: 100%; }
    .modal-backdrop { padding: 12px; place-items: end center; }
}
