:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-2: #f0f2f5;
    --border: #dde1e7;
    --text: #1b1f24;
    --muted: #5f6b7a;
    --accent: #1f5fbf;
    --accent-text: #ffffff;
    --ok: #1a7f37;
    --ok-bg: #e6f4ea;
    --warn: #9a6700;
    --warn-bg: #fff4d6;
    --bad: #c62828;
    --bad-bg: #fdecea;
    --in: #1f5fbf;
    --out: #8250df;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1216;
        --surface: #171b21;
        --surface-2: #1e232b;
        --border: #2c333d;
        --text: #e6e9ee;
        --muted: #9aa5b4;
        --accent: #5b9bff;
        --accent-text: #0b1220;
        --ok: #4cc26d;
        --ok-bg: #12301c;
        --warn: #e3b341;
        --warn-bg: #3a2e0f;
        --bad: #ff7b72;
        --bad-bg: #3d1614;
        --in: #6ea8ff;
        --out: #c297ff;
        color-scheme: dark;
    }
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}
header h1 { margin: 0; font-size: 19px; }
header p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px;
    padding: 20px 24px;
    max-width: 1400px;
    margin: 0 auto;
}
@media (max-width: 900px) {
    main { grid-template-columns: minmax(0, 1fr); padding: 16px; }
}
section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 20px;
}
section h2 {
    margin: 0 0 12px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
input, select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
}
input.mono { font-family: var(--mono); font-size: 13px; }
button {
    padding: 9px 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
button:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

.pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px; font-size: 13px;
    background: var(--surface-2); color: var(--muted);
}
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.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); }
.conn-id { font-family: var(--mono); font-size: 12px; color: var(--muted); word-break: break-all; }

.lot-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.lot-head h3 { margin: 0; font-size: 18px; }
.lot-number { color: var(--muted); font-size: 13px; }
.price { font-size: 30px; font-weight: 700; margin: 12px 0 2px; font-variant-numeric: tabular-nums; }
.price-label { color: var(--muted); font-size: 13px; }
.countdown { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.countdown.closing { color: var(--bad); }
dl.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 14px 0 0; font-size: 14px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
.bidder-state { margin-top: 14px; }
.steps { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.steps button { font-variant-numeric: tabular-nums; padding: 6px 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.num, th.num { text-align: right; }
.empty { color: var(--muted); font-size: 14px; }

.log { font-family: var(--mono); font-size: 12px; max-height: 70vh; overflow: auto; }
.log details { border-bottom: 1px solid var(--border); padding: 4px 0; }
.log summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: baseline; }
.log summary::-webkit-details-marker { display: none; }
.log .t { color: var(--muted); flex: none; }
.log .dir { flex: none; font-weight: 700; width: 1.4em; }
.log .dir.in { color: var(--in); }
.log .dir.out { color: var(--out); }
.log .dir.sys { color: var(--muted); }
.log .name { font-weight: 600; flex: none; }
.log .hint { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log pre { margin: 6px 0 6px 2em; white-space: pre-wrap; word-break: break-all; background: var(--surface-2); padding: 8px; border-radius: 6px; }

dialog {
    border: 1px solid var(--border); border-radius: 10px; padding: 0;
    background: var(--surface); color: var(--text); width: min(440px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog .body { padding: 18px 20px; }
dialog h3 { margin: 0 0 12px; }
dialog .total { font-size: 22px; font-weight: 700; }
dialog .foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border); }

#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 10; max-width: calc(100vw - 32px); }
.toast { padding: 10px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 4px 16px rgba(0,0,0,.15); font-size: 14px; }
.toast.ok { border-left: 4px solid var(--ok); }
.toast.warn { border-left: 4px solid var(--warn); }
.toast.bad { border-left: 4px solid var(--bad); }
