/* =============================================================================
   Admin — the Event OS shell
   ========================================================================== */

.admin { min-height: 100vh; display: flex; background: var(--paper-sunk); }

/* ---------------------------------------------------------- dark mode --- */
/*
   Components that hardcode an "ink" surface read as primary in light mode but
   disappear against a dark page. In dark mode they invert: the emphatic
   surface becomes light, and accents move to brass.
*/
[data-theme="dark"] .admin { background: var(--paper); }

[data-theme="dark"] .btn {
    background: var(--ink);
    color: var(--paper);
}
[data-theme="dark"] .btn:hover { background: #ffffff; color: var(--paper); }
[data-theme="dark"] .btn--ghost { background: transparent; color: var(--ink); }
[data-theme="dark"] .btn--ghost:hover { background: var(--paper-deep); color: var(--ink); }
[data-theme="dark"] .btn--light { background: var(--paper-deep); color: var(--ink); }
[data-theme="dark"] .btn--brass { background: var(--brass); color: #17130c; }
[data-theme="dark"] .btn--brass:hover { background: #d9ab63; color: #17130c; }
[data-theme="dark"] .btn--danger { background: var(--danger); color: #1a0f12; }

[data-theme="dark"] .table tbody tr:hover { background: rgba(255, 255, 255, .035); }
[data-theme="dark"] .pagination .is-current {
    background: var(--ink); border-color: var(--ink); color: var(--paper);
}
[data-theme="dark"] .chip.is-active {
    background: var(--ink); border-color: var(--ink); color: var(--paper);
}
[data-theme="dark"] .tabs a.is-active { color: var(--ink); border-bottom-color: var(--brass); }
/* Dark mode lifts the neutral meter fill off the dark surface, but must not
   flatten the status variants — a full quota still needs to read as full. */
[data-theme="dark"] .meter > span { background: var(--ink-2); }
[data-theme="dark"] .meter--ok > span     { background: var(--ok); }
[data-theme="dark"] .meter--warn > span   { background: var(--warn); }
[data-theme="dark"] .meter--danger > span { background: var(--danger); }
[data-theme="dark"] .status-flow .step.is-current {
    background: var(--brass); border-color: var(--brass); color: #17130c;
}
[data-theme="dark"] .avatar--ink { background: var(--paper-deep); color: var(--ink); }
[data-theme="dark"] .chart-tip { background: var(--paper-deep); color: var(--ink); border: 1px solid var(--rule-strong); }
[data-theme="dark"] .toast { background: var(--paper-deep); color: var(--ink); border: 1px solid var(--rule-strong); }
[data-theme="dark"] .sidebar { border-right: 1px solid var(--rule); }
[data-theme="dark"] .tile--accent { border-left-color: var(--brass); }
[data-theme="dark"] ::selection { background: var(--brass); color: #17130c; }

/* The QR itself must stay dark-on-white to remain scannable. */
[data-theme="dark"] .ticket-qr,
[data-theme="dark"] .qr-plate { background: #ffffff; }

[data-theme="dark"] .input,
[data-theme="dark"] .select,
[data-theme="dark"] .textarea { background: var(--paper-deep); }
[data-theme="dark"] .input:focus,
[data-theme="dark"] .select:focus,
[data-theme="dark"] .textarea:focus {
    border-color: var(--brass);
    box-shadow: 0 0 0 3px rgba(201, 154, 82, .16);
}
[data-theme="dark"] .choice { background: var(--paper-deep); }
[data-theme="dark"] .choice:hover { background: var(--paper-sunk); }
[data-theme="dark"] .select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%2387857e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}
[data-theme="dark"] .scan-result.is-ok      { background: var(--ok-wash);     border-color: #2c5a45; }
[data-theme="dark"] .scan-result.is-already { background: var(--warn-wash);   border-color: #5a4a24; }
[data-theme="dark"] .scan-result.is-error   { background: var(--danger-wash); border-color: #5c3037; }
[data-theme="dark"] .alert--ok     { border-color: #2c5a45; color: #7fd3aa; }
[data-theme="dark"] .alert--info   { border-color: #2b4560; color: #8dc0ec; }
[data-theme="dark"] .alert--warn   { border-color: #5a4a24; color: #ddb970; }
[data-theme="dark"] .alert--danger { border-color: #5c3037; color: #ef98a5; }

/* ------------------------------------------------------------- sidebar --- */
.sidebar {
    width: 248px;
    flex: none;
    background: var(--ink-surface);
    color: var(--ink-invert-2);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: var(--sp-5);
    border-bottom: 1px solid var(--rule-invert);
    text-decoration: none;
    color: var(--ink-invert);
    flex: none;
}
.sidebar-brand .brand-mark {
    background: transparent;
    border-color: rgba(246,242,234,.35);
    color: var(--brass);
    width: 34px; height: 34px;
    font-size: 1rem;
}
.sidebar-brand .brand-name { font-size: 1rem; color: #fff; letter-spacing: -.02em; }
.sidebar-brand .brand-sub { color: var(--ink-invert-2); font-size: .68rem; letter-spacing: 0; text-transform: none; }

.sidebar-nav { padding: var(--sp-4) var(--sp-3); flex: 1; }
.sidebar-group + .sidebar-group { margin-top: var(--sp-5); }
.sidebar-group-label {
    font-size: .625rem;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(182,177,166,.62);
    padding: 0 var(--sp-3) var(--sp-2);
}
.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px var(--sp-3);
    border-radius: 8px;
    color: var(--ink-invert-2);
    text-decoration: none;
    font-size: .875rem;
    line-height: 1.4;
    transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
    position: relative;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar-nav a.is-active {
    background: rgba(255,255,255,.10);
    color: #fff;
    font-weight: 550;
}
.sidebar-nav a.is-active .ico { opacity: 1; color: var(--accent); }
.sidebar-nav a.is-active::before {
    content: '';
    position: absolute;
    left: -12px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
}
.sidebar-nav .ico { width: 17px; flex: none; opacity: .8; }
.sidebar-nav .count {
    margin-left: auto;
    font-size: .688rem;
    background: rgba(255,255,255,.12);
    padding: 2px 7px;
    border-radius: 100px;
    font-variant-numeric: tabular-nums;
}

.sidebar-foot {
    padding: var(--sp-3) var(--sp-4) var(--sp-4);
    border-top: 1px solid var(--rule-invert);
    flex: none;
}
.sidebar-site-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px var(--sp-3);
    margin-bottom: var(--sp-3);
    border-radius: var(--radius);
    color: var(--ink-invert-2);
    text-decoration: none;
    font-size: .8125rem;
}
.sidebar-site-link:hover { background: rgba(255,255,255,.06); color: var(--ink-invert); }
.sidebar-site-link .ico { width: 17px; flex: none; opacity: .8; }

.sidebar-user { display: flex; align-items: center; gap: var(--sp-3); }
.sidebar-user .avatar { background: rgba(255,255,255,.1); color: var(--ink-invert); width: 34px; height: 34px; }
.sidebar-user .n { font-size: .8125rem; color: var(--ink-invert); font-weight: 500; line-height: 1.3; }
.sidebar-user .r { font-size: .688rem; color: var(--ink-invert-2); }
.sidebar-out {
    margin-left: auto;
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: var(--radius);
    color: var(--ink-invert-2);
    text-decoration: none;
    font-size: .95rem;
}
.sidebar-out:hover { background: rgba(255,255,255,.08); color: var(--ink-invert); }

/* --------------------------------------------- language & theme toggle -- */
.bar-sep { width: 1px; height: 22px; background: var(--rule); flex: none; }

.lang-toggle {
    display: inline-flex;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    overflow: hidden;
}
.lang-toggle a {
    padding: 5px 9px;
    font-size: .688rem;
    font-weight: 600;
    letter-spacing: .06em;
    color: var(--ink-3);
    text-decoration: none;
    background: var(--card);
    line-height: 1.5;
}
.lang-toggle a + a { border-left: 1px solid var(--rule); }
.lang-toggle a:hover { color: var(--ink); }
.lang-toggle a.is-on { background: var(--ink-surface); color: var(--ink-invert); }
[data-theme="dark"] .lang-toggle a.is-on { background: var(--ink); color: var(--paper); }

/* ---------------------------------------------------------------- main --- */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.admin-bar {
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
    padding: 0 var(--sp-6);
    min-height: 62px;
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    position: sticky;
    top: 0;
    z-index: 30;
}
.admin-bar-title { min-width: 0; }
.admin-bar h1 { font-size: 1.32rem; margin: 0; }
.admin-bar .sub { font-size: .8125rem; color: var(--ink-3); margin-top: 1px; }
.admin-bar-actions { margin-left: auto; display: flex; gap: var(--sp-2); align-items: center; }

.admin-body { padding: var(--sp-6); flex: 1; }
.admin-body > * + * { margin-top: var(--sp-5); }

.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    padding: 7px 10px;
    cursor: pointer;
}

@media (max-width: 1000px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        z-index: 60;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: var(--shadow-lg);
    }
    .admin.is-open .sidebar { transform: translateX(0); }
    .sidebar-toggle { display: block; }
    .admin-body { padding: var(--sp-4); }
    .admin-bar {
        padding-inline: var(--sp-4);
        flex-wrap: wrap;
        padding-block: var(--sp-3);
    }
    .admin-bar h1 { font-size: 1.15rem; }
    .admin-bar-actions {
        margin-left: 0;
        width: 100%;
        flex-wrap: wrap;
    }
    .scrim {
        position: fixed; inset: 0; z-index: 50;
        background: rgba(20,24,31,.4);
        display: none;
    }
    .admin.is-open .scrim { display: block; }
}

/* ---------------------------------------------------------- stat tiles --- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: var(--sp-4); }
/* A secondary row of numbers, sized so it never competes with the headline tiles. */
.tiles--compact .tile { padding: var(--sp-4); }
.tiles--compact .tile-value { font-size: 1.65rem; }
.tiles--compact .tile-label { margin-bottom: var(--sp-2); }
.tile {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    position: relative;
    transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.tile:hover { border-color: var(--rule-strong); box-shadow: var(--shadow-sm); }
.tile-label {
    font-size: .75rem;
    letter-spacing: .01em;
    text-transform: none;
    font-weight: 500;
    color: var(--ink-3);
    margin-bottom: var(--sp-3);
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}
.tile-value {
    font-family: var(--font-display);
    font-size: 1.95rem;
    font-weight: 650;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    letter-spacing: -.035em;
}
.tile-value small { font-size: .95rem; color: var(--ink-3); font-family: var(--font-sans); margin-left: 4px; }
.tile-note { font-size: .8125rem; color: var(--ink-3); margin-top: var(--sp-3); }
.tile-note strong { color: var(--ink-2); font-weight: 600; }
.tile--accent { border-left: 3px solid var(--brass); }

/* ------------------------------------------------------------- toolbar --- */
.toolbar {
    display: flex;
    gap: var(--sp-3);
    align-items: flex-end;
    flex-wrap: wrap;
    padding: var(--sp-4);
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
}
.toolbar .field { margin: 0; }
.toolbar .label { font-size: .688rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.toolbar .input, .toolbar .select { min-width: 160px; padding: 8px 12px; font-size: .875rem; }
.toolbar-end { margin-left: auto; display: flex; gap: var(--sp-2); align-items: flex-end; }

/* ------------------------------------------------------ card headings --- */
.card-title {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}
.card-sub { margin: 3px 0 0; font-size: .8125rem; color: var(--ink-3); }

/* --------------------------------------------------------- todo list ---- */
.todo-list { display: grid; margin-top: var(--sp-4); }
.todo-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    color: var(--ink-2);
    font-size: .875rem;
    line-height: 1.5;
}
.todo-item:last-child { border-bottom: 0; padding-bottom: 0; }
.todo-item:hover { color: var(--ink); }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 7px; }
.dot--warn { background: var(--warn); }
.dot--info { background: var(--info); }

/* -------------------------------------------------------- mini rows ----- */
.mini-row {
    display: block;
    padding: 11px var(--sp-5);
    border-bottom: 1px solid var(--rule);
    text-decoration: none;
    color: inherit;
}
.mini-row:last-child { border-bottom: 0; }
.mini-row:hover { background: var(--paper-sunk); }
.mini-name { font-size: .875rem; font-weight: 500; }
.mini-sub { font-size: .75rem; color: var(--ink-3); margin-top: 2px; }

/* ---------------------------------------------------------------- tabs --- */
.tabs {
    display: flex;
    gap: var(--sp-1);
    border-bottom: 1px solid var(--rule);
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
    padding: 11px var(--sp-4);
    font-size: .875rem;
    font-weight: 500;
    color: var(--ink-3);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--ink-surface); }

/* --------------------------------------------------------- data tables --- */
.admin .table th { background: var(--paper-sunk); }
.admin .table td { font-size: .875rem; }
.table-title { display: flex; align-items: center; gap: var(--sp-3); }
.table-title .n { font-weight: 600; color: var(--ink); }
.table-title .s { font-size: .75rem; color: var(--ink-3); }

.code-pill {
    font-family: var(--font-mono);
    font-size: .75rem;
    letter-spacing: .03em;
    background: var(--paper-sunk);
    border: 1px solid var(--rule);
    border-radius: 3px;
    padding: 2px 7px;
    white-space: nowrap;
}

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn {
    width: 30px; height: 30px;
    display: inline-grid;
    place-items: center;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink-3);
    cursor: pointer;
    text-decoration: none;
    font-size: .8rem;
    transition: all .15s ease;
}
.icon-btn:hover { border-color: var(--ink-3); color: var(--ink); }
.icon-btn--danger:hover { border-color: var(--danger); color: var(--danger); }

/* --------------------------------------------------------------- forms --- */
.form-section {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.form-section + .form-section { margin-top: var(--sp-5); }
.form-section-head {
    padding: var(--sp-4) var(--sp-5);
    border-bottom: 1px solid var(--rule);
    background: var(--paper-sunk);
}
.form-section-head h3 { margin: 0; font-size: 1.05rem; font-family: var(--font-sans); font-weight: 600; }
.form-section-head p { margin: 4px 0 0; font-size: .8125rem; color: var(--ink-3); }
.form-section-body { padding: var(--sp-5); }
.form-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--sp-5); }
.form-cols--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-cols .field--full { grid-column: 1 / -1; }
@media (max-width: 800px) { .form-cols, .form-cols--3 { grid-template-columns: minmax(0, 1fr); } }

.form-actions {
    display: flex;
    gap: var(--sp-3);
    align-items: center;
    padding: var(--sp-4) var(--sp-5);
    border-top: 1px solid var(--rule);
    background: var(--paper-sunk);
}

/* -------------------------------------------------------- form builder --- */
.builder-row {
    display: grid;
    grid-template-columns: 26px minmax(0, 1.4fr) minmax(0, 1fr) 130px 118px 88px;
    gap: var(--sp-3);
    align-items: center;
    padding: var(--sp-3) var(--sp-4);
    border-bottom: 1px solid var(--rule);
    background: var(--card);
}
.builder-row:last-of-type { border-bottom: 0; }
.builder-row .input, .builder-row .select { padding: 7px 10px; font-size: .8125rem; }
.builder-head {
    display: grid;
    grid-template-columns: 26px minmax(0, 1.4fr) minmax(0, 1fr) 130px 118px 88px;
    gap: var(--sp-3);
    padding: 10px var(--sp-4);
    background: var(--paper-sunk);
    border-bottom: 1px solid var(--rule-strong);
    font-size: .688rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--ink-3);
}
.drag-handle { cursor: grab; color: var(--rule-strong); text-align: center; user-select: none; }
.drag-handle:active { cursor: grabbing; }
.builder-row.is-dragging { opacity: .4; }
.builder-row.is-locked .drag-handle { opacity: .3; cursor: default; }
@media (max-width: 1100px) {
    .builder-head { display: none; }
    .builder-row { grid-template-columns: minmax(0, 1fr); gap: var(--sp-2); padding-block: var(--sp-4); }
    .drag-handle { display: none; }
}

/* --------------------------------------------------------------- charts -- */
.chart-card {
    background: var(--card);
    border: 1px solid var(--rule);
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
}
.chart-head { margin-bottom: var(--sp-5); }
.chart-head h3 { font-size: 1.02rem; font-family: var(--font-sans); font-weight: 600; margin: 0; }
.chart-head p { margin: 3px 0 0; font-size: .8125rem; color: var(--ink-3); }

.legend { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin-top: var(--sp-4); }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: .8125rem; color: var(--ink-2); }
.legend-swatch { width: 11px; height: 11px; border-radius: 2px; flex: none; }

/* Horizontal bar list — the workhorse for categorical breakdowns */
.bars { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 132px minmax(0, 1fr) 62px; gap: var(--sp-3); align-items: center; }
.bar-label { font-size: .8125rem; color: var(--ink-2); text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.bar-track { height: 20px; background: var(--paper-sunk); border-radius: 2px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--series-1); transition: width .5s ease; min-width: 2px; }
.bar-value { font-size: .8125rem; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
@media (max-width: 620px) { .bar-row { grid-template-columns: 96px minmax(0, 1fr) 52px; } }

.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-svg .grid-line { stroke: var(--grid); stroke-width: 1; }
.chart-svg .axis-text { font-size: 11px; fill: var(--ink-3); font-family: var(--font-sans); }
.chart-svg .value-text { font-size: 11px; fill: var(--ink-2); font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart-svg .series-line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .series-area { fill: var(--series-1); fill-opacity: .1; }
.chart-svg .series-dot { fill: var(--series-1); stroke: var(--card); stroke-width: 2; }
.chart-svg .col { fill: var(--series-1); }
.chart-svg .hit { fill: transparent; cursor: crosshair; }
.chart-svg .crosshair { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }

.chart-tip {
    position: absolute;
    z-index: 20;
    background: var(--ink-surface);
    color: var(--ink-invert);
    padding: 7px 11px;
    border-radius: var(--radius);
    font-size: .75rem;
    line-height: 1.45;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -125%);
    transition: opacity .12s ease;
    white-space: nowrap;
    box-shadow: var(--shadow);
}
.chart-tip.is-on { opacity: 1; }
.chart-tip b { font-weight: 600; }
.chart-wrap { position: relative; }

.donut-wrap { display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; }
.donut-center { text-align: center; }
.donut-center .n { font-family: var(--font-display); font-size: 1.7rem; line-height: 1; }
.donut-center .l { font-size: .688rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }

.table-toggle {
    margin-top: var(--sp-4);
    font-size: .8125rem;
}
.table-toggle summary { cursor: pointer; color: var(--ink-3); }
.table-toggle summary:hover { color: var(--ink); }
.table-toggle table { width: 100%; margin-top: var(--sp-3); border-collapse: collapse; font-size: .8125rem; }
.table-toggle th, .table-toggle td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--rule); }
.table-toggle td:last-child, .table-toggle th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- check-in -- */
.scanner-shell { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--sp-5); align-items: start; }
@media (max-width: 1050px) { .scanner-shell { grid-template-columns: minmax(0, 1fr); } }

.scan-stage {
    background: #0d1014;
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    aspect-ratio: 4/3;
    display: grid;
    place-items: center;
}
.scan-stage video, .scan-stage canvas { width: 100%; height: 100%; object-fit: cover; }
.scan-frame {
    position: absolute;
    inset: 16%;
    border: 2px solid rgba(176,131,65,.85);
    border-radius: 8px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(13,16,20,.42);
}
.scan-frame::before, .scan-frame::after {
    content: '';
    position: absolute;
    left: -2px; right: -2px;
    height: 2px;
    background: var(--brass);
}
.scan-frame::before { top: -2px; }
.scan-frame::after  { bottom: -2px; }
.scan-idle { color: #7d8590; text-align: center; padding: var(--sp-6); font-size: .875rem; }

.scan-result {
    border-radius: var(--radius-lg);
    padding: var(--sp-5);
    border: 1px solid var(--rule);
    background: var(--card);
    min-height: 210px;
}
.scan-result.is-ok      { background: var(--ok-wash);     border-color: #a9d3bf; }
.scan-result.is-already { background: var(--warn-wash);   border-color: #e4d2a5; }
.scan-result.is-error   { background: var(--danger-wash); border-color: #eec3c9; }
.scan-result-mark { font-size: 1.9rem; line-height: 1; margin-bottom: var(--sp-3); }
.scan-result h3 { font-size: 1.25rem; margin-bottom: var(--sp-2); }
.scan-result .who { font-family: var(--font-display); font-size: 1.45rem; line-height: 1.2; margin-bottom: var(--sp-2); }
.scan-result dl { display: grid; gap: 7px; font-size: .875rem; margin: var(--sp-4) 0 0; }
.scan-result dl > div { display: flex; justify-content: space-between; gap: var(--sp-3); }
.scan-result dt { color: var(--ink-2); }
.scan-result dd { margin: 0; font-weight: 500; }

.scan-log { max-height: 320px; overflow-y: auto; }
.scan-log-item {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    padding: 10px var(--sp-4);
    border-bottom: 1px solid var(--rule);
    font-size: .8125rem;
}
.scan-log-item:last-child { border-bottom: 0; }
.scan-log-item .t { margin-left: auto; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ login ------ */
.login-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--paper);
}
.login-aside {
    background: var(--ink-surface);
    color: var(--ink-invert);
    padding: var(--sp-9) var(--sp-8);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.login-aside::after {
    content: '';
    position: absolute;
    right: -140px; bottom: -160px;
    width: 460px; height: 460px;
    border: 1px solid rgba(176,131,65,.22);
    border-radius: 50%;
}
.login-aside h2 { color: var(--ink-invert); font-size: 2rem; max-width: 16ch; position: relative; }
.login-aside p { color: var(--ink-invert-2); max-width: 42ch; position: relative; }
.login-main { display: grid; place-items: center; padding: var(--sp-6); }
.login-card { width: 100%; max-width: 400px; }
@media (max-width: 900px) {
    .login-page { grid-template-columns: minmax(0, 1fr); }
    .login-aside { display: none; }
}

.cred-hint {
    margin-top: var(--sp-5);
    padding: var(--sp-4);
    background: var(--paper-sunk);
    border: 1px dashed var(--rule-strong);
    border-radius: var(--radius);
    font-size: .8125rem;
    color: var(--ink-2);
}
.cred-hint code { font-family: var(--font-mono); color: var(--ink); }
.cred-hint table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.cred-hint td { padding: 3px 0; }
.cred-hint td:last-child { text-align: right; }

/* ------------------------------------------------------------- toasts ---- */
.toasts {
    position: fixed;
    right: var(--sp-5); bottom: var(--sp-5);
    z-index: 200;
    display: grid;
    gap: var(--sp-2);
    max-width: 380px;
}
.toast {
    background: var(--ink-surface);
    color: var(--ink-invert);
    padding: 12px var(--sp-4);
    border-radius: var(--radius);
    font-size: .875rem;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: var(--sp-3);
    align-items: flex-start;
    animation: toast-in .22s ease;
}
.toast--ok     { border-left: 3px solid #4ec08e; }
.toast--danger { border-left: 3px solid #e2596b; }
.toast--warn   { border-left: 3px solid var(--brass); }
.toast--info   { border-left: 3px solid #6ba8de; }
.toast button { background: none; border: 0; color: var(--ink-invert-2); cursor: pointer; margin-left: auto; padding: 0 2px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------------- misc ---- */
/* .kv lives in base.css — it is shared with the public site. */

.status-flow { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; font-size: .75rem; }
.status-flow .step {
    padding: 4px 10px;
    border: 1px solid var(--rule);
    border-radius: 100px;
    color: var(--ink-3);
    background: var(--card);
}
.status-flow .step.is-done { border-color: var(--rule-strong); color: var(--ink-2); }
.status-flow .step.is-current { background: var(--ink-surface); border-color: var(--ink-surface); color: var(--ink-invert); font-weight: 600; }
.status-flow .arr { color: var(--rule-strong); }

.qr-preview { display: flex; gap: var(--sp-5); align-items: center; flex-wrap: wrap; }

/* A QR always sits on white — it has to stay scannable in either theme. */
.qr-plate {
    display: inline-block;
    padding: var(--sp-3);
    background: #ffffff;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    margin: var(--sp-4) 0;
}
