/*
 * Username Monitor admin panel. Self-contained: no framework, no build step.
 * Colours are tokens; dark mode follows the operating system.
 */

:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f3f4f7;
    --surface-3: #e8eaef;
    --border: #e3e6eb;
    --border-strong: #cdd2da;
    --text: #151821;
    --text-2: #444b59;
    --muted: #6b7280;
    --accent: #4f46e5;
    --accent-contrast: #ffffff;
    --accent-soft: #eef0ff;
    --success: #13803b;
    --success-contrast: #ffffff;
    --success-soft: #e7f6ec;
    --warning: #b25a06;
    --warning-soft: #fdf2e1;
    --danger: #c42b2b;
    --danger-soft: #fdecec;
    --neutral-soft: #eef0f4;
    --focus: #6366f1;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgb(16 24 40 / 5%), 0 1px 3px rgb(16 24 40 / 7%);
    --shadow-lg: 0 10px 30px rgb(16 24 40 / 16%);
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e1015;
        --surface: #161920;
        --surface-2: #1c2029;
        --surface-3: #262b36;
        --border: #292f3b;
        --border-strong: #3a4250;
        --text: #e6e8ee;
        --text-2: #b9bfcb;
        --muted: #8b92a1;
        --accent: #8f8bff;
        --accent-contrast: #10121a;
        --accent-soft: #24234a;
        --success: #4ade80;
        --success-contrast: #06140b;
        --success-soft: #10271a;
        --warning: #fbbf24;
        --warning-soft: #2c230f;
        --danger: #f87171;
        --danger-soft: #331718;
        --neutral-soft: #232833;
        --focus: #a5a2ff;
        --shadow: 0 1px 2px rgb(0 0 0 / 40%);
        --shadow-lg: 0 12px 32px rgb(0 0 0 / 55%);
        color-scheme: dark;
    }
}

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

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { letter-spacing: -0.01em; }

code, .mono { font-family: var(--mono); font-size: 0.92em; }

[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip-link {
    position: absolute;
    left: 8px;
    top: -40px;
    z-index: 200;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: var(--accent-contrast);
}
.skip-link:focus { top: 8px; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
.break { word-break: break-word; overflow-wrap: anywhere; }
.stack { display: grid; gap: 14px; }
.stack--sm { gap: 8px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.spacer { flex: 1; }

/* ---------- Top bar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(160%) blur(8px);
    border-bottom: 1px solid var(--border);
}

.topbar__inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 16px;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    font-weight: 650;
    white-space: nowrap;
}
.brand:hover { text-decoration: none; }

.brand__mark {
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: conic-gradient(from 210deg, #6366f1, #db2777, #f59e0b, #6366f1);
    box-shadow: inset 0 0 0 5px var(--surface);
    border: 2px solid transparent;
    flex: none;
}

.nav {
    display: flex;
    gap: 2px;
    flex: 1;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

.nav a {
    padding: 6px 11px;
    border-radius: var(--radius-sm);
    color: var(--text-2);
    font-weight: 500;
    white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.account { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.account form { margin: 0; }

@media (max-width: 760px) {
    .topbar__inner { flex-wrap: wrap; height: auto; padding: 8px 16px 0; gap: 8px 12px; }
    .nav { order: 3; flex-basis: 100%; margin: 0 -6px; padding-bottom: 6px; }
    .account { margin-left: auto; }
    .account__email { display: none; }
}

/* ---------- Page ---------- */

.page { max-width: 1440px; margin: 0 auto; padding: 24px 16px 72px; }

.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px 20px;
    margin-bottom: 20px;
}
.page-header h1 { margin: 0; font-size: 22px; font-weight: 680; }
.page-header p { margin: 4px 0 0; color: var(--muted); }
.page-header__title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
.page-header__title h1 { word-break: break-all; }

.back-link { display: inline-block; margin-bottom: 6px; font-size: 13px; color: var(--muted); }

/* ---------- Alerts ---------- */

.alert {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 16px;
    background: var(--surface);
}
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.alert--success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); }
.alert--error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.alert--warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); }
.alert a { font-weight: 600; margin-left: 6px; }

/* ---------- Stat cards ---------- */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat {
    position: relative;
    overflow: hidden;
    padding: 13px 16px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--tone, var(--border-strong));
}
.stat__label {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stat__value {
    margin-top: 2px;
    font-size: 26px;
    font-weight: 680;
    line-height: 1.25;
    font-variant-numeric: tabular-nums;
}
.stat__sub { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 2px; color: var(--muted); font-size: 12px; }
.stat__sub b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }

.tone-neutral { --tone: var(--border-strong); }
.tone-accent { --tone: var(--accent); }
.tone-success { --tone: var(--success); }
.tone-warning { --tone: var(--warning); }
.tone-danger { --tone: var(--danger); }
.tone-muted { --tone: var(--surface-3); }

.bump { animation: bump 1s ease-out; }
@keyframes bump {
    0% { color: var(--accent); }
    100% { color: inherit; }
}

/* ---------- Panels ---------- */

.panel {
    min-width: 0;
    margin-bottom: 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.panel__head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.panel__head p { margin: 0; }
.panel__body { padding: 16px; }
.panel__foot { padding: 12px 16px; border-top: 1px solid var(--border); }

.panel--claim {
    border-color: color-mix(in srgb, var(--success) 45%, var(--border));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--success-soft) 80%, transparent), var(--shadow);
}
.panel--claim .panel__head h2 { font-size: 17px; }

details.panel > summary {
    list-style: none;
    cursor: pointer;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary .chevron { display: inline-block; color: var(--muted); font-size: 18px; line-height: 1; transition: transform 0.15s ease; }
details.panel[open] > summary .chevron { transform: rotate(90deg); }
details.panel:not([open]) > summary { border-bottom: 0; }

/* ---------- Dashboard layout ---------- */

.dash {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 20px;
    align-items: start;
}
.dash__side { position: sticky; top: 76px; }

.table-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 20px;
}

@media (max-width: 1200px) {
    .dash { grid-template-columns: minmax(0, 1fr); }
    .dash__side {
        position: static;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 0 20px;
        align-items: start;
    }
}

@media (max-width: 960px) {
    .table-grid { grid-template-columns: minmax(0, 1fr); }
}

.live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 12.5px;
}
.live__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent);
    animation: pulse 2.4s infinite;
}
.live[data-state="error"] .live__dot { background: var(--danger); animation: none; }
.live[data-state="paused"] .live__dot { background: var(--muted); animation: none; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); }
    70% { box-shadow: 0 0 0 7px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}

/* ---------- Claim-ready cards ---------- */

.claim-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 12px;
}

.claim {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 14px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.claim--ready {
    background: var(--success-soft);
    border-color: color-mix(in srgb, var(--success) 50%, var(--border));
}

.claim__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.claim__handle {
    font-family: var(--mono);
    font-size: 21px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    word-break: break-all;
}
.claim__status {
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.07em;
    color: var(--success);
}
.claim__lines { display: grid; gap: 1px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.claim__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.claim__actions form { margin: 0; }
.claim__open {
    display: grid;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-strong);
}
.claim__message { font-size: 12.5px; color: var(--text-2); }

.inline-form { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.inline-form .input { flex: 1 1 110px; min-width: 0; width: auto; }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
    padding: 8px 12px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 650;
    text-align: left;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.table .num, .table th.num { text-align: right; }
.table td.handle a { font-family: var(--mono); font-weight: 600; }
.table tr.is-highlighted td { background: var(--accent-soft); }

.empty { padding: 22px 16px; margin: 0; text-align: center; color: var(--muted); }

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
}

/* ---------- Badges ---------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--neutral-soft);
    color: var(--text-2);
    font-size: 11.5px;
    font-weight: 650;
    line-height: 1.6;
    white-space: nowrap;
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--accent { background: var(--accent-soft); color: var(--accent); }
.badge--muted { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border-strong); }
.badge--lg { font-size: 13px; padding: 3px 11px; }

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-weight: 560;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.12s ease, border-color 0.12s ease, filter 0.12s ease;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled, .btn[aria-busy="true"] { opacity: 0.6; cursor: progress; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.btn--primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn--success { background: var(--success); border-color: var(--success); color: var(--success-contrast); }
.btn--success:hover { background: var(--success); filter: brightness(1.08); }
.btn--danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--border-strong)); }
.btn--danger:hover { background: var(--danger-soft); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: var(--surface-2); }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn--block { width: 100%; }

/* ---------- Forms ---------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
}
.form-grid .span-all { grid-column: 1 / -1; }

.field { display: grid; gap: 6px; align-content: start; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; }
fieldset.field { margin: 0; padding: 0; border: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; }
.hint { margin: 0; color: var(--muted); font-size: 12px; }
.field-error { margin: 0; color: var(--danger); font-size: 12.5px; }

.input, .select, .textarea {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); opacity: 0.8; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); outline: 2px solid color-mix(in srgb, var(--focus) 35%, transparent); outline-offset: 0; }
.input--sm, .select--sm { height: 30px; font-size: 13px; }
.textarea { height: auto; min-height: 120px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: 13px; line-height: 1.45; }
.textarea--sm { min-height: 72px; }
.is-invalid { border-color: var(--danger); }
input[type="file"].input { height: auto; padding: 6px; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checks--chips .check {
    padding: 4px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}
.checks--chips .check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

.segmented { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: 5px 14px; border-radius: 6px; font-weight: 560; color: var(--text-2); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.filters .field { flex: 1 1 170px; }
.filters .field--wide { flex: 2 1 240px; }

/* Toggle switch rendered as a button (aria-pressed) */
.switch {
    position: relative;
    width: 40px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--surface-3);
    cursor: pointer;
    flex: none;
    transition: background-color 0.15s ease;
}
.switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgb(0 0 0 / 30%);
    transition: transform 0.15s ease;
}
.switch[aria-pressed="true"] { background: var(--success); }
.switch[aria-pressed="true"]::after { transform: translateX(18px); }
.switch:disabled { opacity: 0.6; cursor: progress; }

/* ---------- Key/value grids ---------- */

.kv {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    margin: 0;
}
.kv > div { padding: 10px 16px; border-bottom: 1px solid var(--border); min-width: 0; }
.kv dt { color: var(--muted); font-size: 12px; }
.kv dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; word-break: break-word; }

.mini-kv {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 3px 12px;
    margin: 0;
    font-size: 12.5px;
}
.mini-kv dt { color: var(--muted); }
.mini-kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; word-break: break-word; }

/* ---------- Dashboard settings ---------- */

.setting { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; }
.setting__text { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; min-width: 0; }
.setting__label { font-size: 13px; font-weight: 600; }
.setting__state--paused { color: var(--warning); font-weight: 600; }
.setting__select { flex: 1 1 110px; width: auto; min-width: 0; }

/* ---------- Providers / queues ---------- */

.provider { display: grid; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.provider:last-child { border-bottom: 0; }
.provider__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.provider__name { font-family: var(--mono); font-weight: 650; }
.provider__error { margin: 0; color: var(--danger); font-size: 12px; word-break: break-word; }

.meter { height: 6px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width 0.4s ease; }
.meter--hot > span { background: var(--warning); }
.meter--full > span { background: var(--danger); }

.queue-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.queue-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); }
.queue-list li:last-child { border-bottom: 0; }
.queue-list .num { font-weight: 600; }

/* ---------- Progress ---------- */

progress.progress {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: 100%;
    min-width: 110px;
    height: 8px;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--accent);
}
progress.progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
progress.progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; transition: width 0.5s ease; }
progress.progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }
progress.progress--done::-webkit-progress-value { background: var(--success); }
progress.progress--done::-moz-progress-bar { background: var(--success); }
progress.progress--failed::-webkit-progress-value { background: var(--danger); }
progress.progress--failed::-moz-progress-bar { background: var(--danger); }
.progress-cell { display: grid; gap: 4px; min-width: 130px; }

/* ---------- Timeline ---------- */

.timeline { margin: 0; padding: 4px 16px 8px; list-style: none; }
.timeline__item { position: relative; padding: 10px 0 10px 24px; }
.timeline__item::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 17px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 0 0 0 2px var(--dot, var(--border-strong));
}
.timeline__item::after {
    content: "";
    position: absolute;
    left: 9px;
    top: 30px;
    bottom: -8px;
    width: 1px;
    background: var(--border);
}
.timeline__item:last-child::after { display: none; }
.timeline__item.tone-success { --dot: var(--success); }
.timeline__item.tone-warning { --dot: var(--warning); }
.timeline__item.tone-danger { --dot: var(--danger); }
.timeline__item.tone-accent { --dot: var(--accent); }
/* Admin/system events (no status change) and the "Added" entry: a small filled dot. */
.timeline__item--event::before { top: 18px; left: 6px; width: 7px; height: 7px; background: var(--border-strong); box-shadow: none; }
.timeline__event { font-weight: 600; font-size: 13.5px; }
.timeline__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.timeline__meta { margin-top: 2px; color: var(--muted); font-size: 12.5px; }
.timeline__context { margin-top: 4px; font-size: 12px; }
.timeline__context summary { cursor: pointer; color: var(--muted); }
.timeline__context pre {
    margin: 6px 0 0;
    padding: 8px 10px;
    overflow-x: auto;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    font-family: var(--mono);
    font-size: 12px;
    white-space: pre-wrap;
    word-break: break-word;
}
.arrow { color: var(--muted); }

/* ---------- Transitions ---------- */

.transition-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 0 20px; }
.transition { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.transition:last-child { border-bottom: 0; }
.transition__text { flex: 1; min-width: 0; }
.transition__desc { color: var(--muted); font-size: 12.5px; }
.transition.is-disabled .transition__text { opacity: 0.55; }
.transition form { margin: 0; }

/* ---------- Toasts ---------- */

.toasts {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 100;
    display: grid;
    gap: 8px;
    width: min(400px, calc(100vw - 32px));
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.18s ease-out;
}
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
.toast__text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast__text a { font-weight: 600; margin-left: 4px; }
.toast__close {
    flex: none;
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}
.toast__close:hover { background: var(--surface-2); color: var(--text); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Auth / error pages ---------- */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth__card {
    width: min(400px, 100%);
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
}
.auth__card h1 { margin: 18px 0 4px; font-size: 21px; }
.auth__card > p { margin: 0 0 18px; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 560px) {
    .page { padding-top: 16px; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat__value { font-size: 22px; }
    .panel__body { padding: 14px; }
    .claim-list { grid-template-columns: minmax(0, 1fr); }
    .transition-groups { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Spacing helpers ---------- */

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.m-0 { margin: 0; }
.pt-0 { padding-top: 0; }
.items-end { align-items: flex-end; }

.claim__substatus {
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--muted, inherit);
}
