:root {
  --bg: #f4f6fb; --panel: #fff; --line: #e2e6ef; --text: #1d2433; --muted: #6b7488;
  --accent: #2456d6; --accent-soft: #e8eefc; --ok: #1f8a4c; --warn: #b26a00; --danger: #c0392b;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 "Segoe UI", "Microsoft YaHei", system-ui, sans-serif; color: var(--text); background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 12px; }

.shell { display: grid; grid-template-columns: 200px 1fr; min-height: 100vh; }
.side { background: #172038; color: #cfd6e6; padding: 16px 0; display: flex; flex-direction: column; }
.side .brand { color: #fff; font-weight: 600; font-size: 16px; padding: 0 20px 16px; }
.side a { display: block; color: inherit; padding: 9px 20px; }
.side a:hover { background: #222d4d; text-decoration: none; }
.side a.active { background: #2456d6; color: #fff; }
.side .who { margin-top: auto; padding: 12px 20px 0; border-top: 1px solid #2a3557; font-size: 13px; }
.side .who button { margin-top: 8px; margin-right: 6px; }
.main { padding: 24px 28px; min-width: 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; color: inherit; }
.card:hover { text-decoration: none; border-color: var(--accent); }
.card .n { font-size: 24px; font-weight: 600; }
.card .l { color: var(--muted); font-size: 13px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 20px; text-align: center; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 13px; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll { overflow-x: auto; }

button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
button.small { padding: 3px 8px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; color: var(--text); max-width: 100%; }
textarea { width: 100%; min-height: 70px; resize: vertical; }
label.field { display: block; margin-bottom: 10px; }
label.field > span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 3px; }
label.field input:not([type=checkbox]), label.field select { width: 100%; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; background: #eef0f5; color: #48506a; white-space: nowrap; }
.tag.ready, .tag.queued { background: #fff3d9; color: var(--warn); }
.tag.grabbing, .tag.running { background: var(--accent-soft); color: var(--accent); }
.tag.hit, .tag.confirmed, .tag.done, .tag.paid, .tag.active { background: #e0f5e9; color: var(--ok); }
.tag.failed, .tag.disabled, .tag.p2 { background: #fde8e6; color: var(--danger); }
.tag.p1 { background: #fff3d9; color: var(--warn); }

dl.kv { display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 7px 0; border-bottom: 1px solid var(--line); }
ul.plain li:last-child { border-bottom: 0; }

dialog { border: 1px solid var(--line); border-radius: 10px; padding: 20px; width: min(480px, 92vw); }
dialog::backdrop { background: rgba(20, 28, 50, .45); }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.error { color: var(--danger); min-height: 1.5em; margin: 6px 0 0; }
.login { max-width: 360px; margin: 12vh auto; }
.toast { position: fixed; right: 20px; bottom: 20px; background: #172038; color: #fff; padding: 10px 16px; border-radius: 8px; max-width: 360px; }
