:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --text: #1b2430;
    --muted: #64707d;
    --border: #e1e6eb;
    --accent: #0f6e6e;
    --accent-ink: #ffffff;
    --ok: #1d7a46;
    --ok-bg: #e5f4ec;
    --warn: #8a5a00;
    --warn-bg: #fdf2dc;
    --bad: #b3261e;
    --bad-bg: #fbe7e5;
    --code-bg: #eef1f4;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #12161b;
        --surface: #1a2027;
        --text: #e4e8ec;
        --muted: #95a0ab;
        --border: #2b333c;
        --accent: #3bb3b0;
        --accent-ink: #0b1414;
        --ok: #6fd39a;
        --ok-bg: #173325;
        --warn: #f0c060;
        --warn-bg: #3a2d10;
        --bad: #f28b82;
        --bad-bg: #3d1a18;
        --code-bg: #232a32;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--code-bg); padding: 1px 6px; border-radius: 4px; word-break: break-all; }

.topbar {
    display: flex; align-items: center; gap: 24px;
    padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 16px; color: var(--text); }
.brand span { color: var(--accent); font-weight: 600; }
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); }
.topbar nav a.active { background: var(--code-bg); color: var(--text); text-decoration: none; }

.container { max-width: 1280px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 20px; }
.grid { display: grid; grid-template-columns: minmax(300px, 1fr) minmax(0, 1.6fr); gap: 20px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 20px; min-width: 0; }
.card h2 { margin: 0 0 8px; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.step {
    display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); color: var(--accent-ink); font-size: 12px;
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

label { display: grid; gap: 4px; margin: 10px 0 0; font-weight: 500; font-size: 13px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
input, select {
    font: inherit; color: var(--text); background: var(--bg);
    border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; width: 100%;
}
input[type=checkbox] { width: auto; }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; }
.fields .span2 { grid-column: span 2; }
@media (max-width: 600px) { .fields { grid-template-columns: 1fr; } .fields .span2 { grid-column: auto; } }
.pair { display: flex; align-items: center; gap: 8px; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.row.center { justify-content: center; }
.btn {
    display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
    background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
    border-radius: 6px; padding: 8px 14px;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.notice { margin-top: 12px; padding: 10px 12px; border-radius: 6px; background: var(--warn-bg); color: var(--warn); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.err { background: var(--bad-bg); color: var(--bad); }

.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--code-bg); color: var(--muted); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }

.progress-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.progress-head .row { margin: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; margin: 12px 0 16px; }
.stats > div { display: grid; }
.stats b { font-size: 22px; font-variant-numeric: tabular-nums; }
.stats span { color: var(--muted); font-size: 12px; }
.stats .grow { flex: 1; min-width: 200px; }
.stats .row { margin: 0; display: flex; }

.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.log {
    margin: 0; background: var(--code-bg); border-radius: 6px; padding: 12px;
    font-size: 12px; max-height: 480px; overflow: auto; white-space: pre-wrap;
}

.filters { display: flex; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.filters input { flex: 1; min-width: 200px; }
.filters select { width: auto; }

.table-wrap { overflow-x: auto; max-height: 640px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { position: sticky; top: 0; background: var(--surface); font-size: 12px; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.thumb { width: 72px; }
.thumb img { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; display: block; }
.sub { color: var(--muted); font-size: 12px; word-break: break-word; }
details p { white-space: pre-wrap; margin: 4px 0 0; font-size: 13px; }

#blazor-error-ui {
    background: var(--warn-bg); color: var(--warn); bottom: 0; display: none; left: 0;
    padding: 10px 20px; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 12px; top: 8px; }
.card h3 { margin: 18px 0 0; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.signout { display: flex; align-items: center; gap: 8px; margin: 0; }
.signout .btn { padding: 4px 10px; }
.login-card { max-width: 420px; margin: 40px auto; width: 100%; }

.live { margin-top: 14px; border: 1px solid var(--border); border-radius: 8px; padding: 10px; background: var(--bg); }
.live-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.live-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-bar .btn, .live-keys .btn { padding: 4px 10px; }
.live-shot { width: 100%; height: auto; display: block; border-radius: 4px; cursor: crosshair; border: 1px solid var(--border); }
.live-keys { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.live-keys input { flex: 1; min-width: 160px; }
.live-shot { max-width: 1366px; }
