:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #667085; --line: #e3e6eb; --accent: #1f5fbf;
  --accent-text: #fff; --ok: #1a7f4b; --warn: #a15c00; --bad: #b42318; --ins: #d9f2e1; --del: #fbe0de;
  --flag: #fff3cd; --pill: #eef1f5;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #12151b; --card: #1b1f27; --text: #e6e9ef; --muted: #98a2b3; --line: #2c323d; --accent: #5b9bff;
    --accent-text: #0b0e13; --ok: #4cc38a; --warn: #f0a63a; --bad: #ff7a6e; --ins: #173d27; --del: #4a1f1c;
    --flag: #3d3215; --pill: #262c36; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 18px; } .sub { font-weight: 400; color: var(--muted); font-size: 13px; }
nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 40px auto; }
h1, h2, h3, h4 { margin: 0 0 10px; } h2 { font-size: 18px; } h4 { font-size: 14px; color: var(--muted); }
label { display: block; margin-bottom: 10px; } label.inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; padding: 7px 9px; }
label input { width: 100%; margin-top: 4px; }
.full { width: 100%; margin-bottom: 8px; }
.editor { width: 100%; min-height: 320px; resize: vertical; font: 15px/1.6 Georgia, "Times New Roman", serif; padding: 12px; }
button, .button { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--pill); color: var(--text);
  border-radius: 6px; padding: 7px 12px; text-decoration: none; display: inline-block; }
button:disabled { opacity: .5; cursor: default; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
.link { background: none; border: none; color: var(--accent); padding: 4px 6px; }
.row { display: flex; gap: 8px; align-items: center; } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.muted { color: var(--muted); } .error { color: var(--bad); }
.notice { background: var(--flag); border-radius: 8px; padding: 10px 12px; margin: 0 0 16px; font-size: 14px; }
.pick { margin-top: 10px; } .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.pick label { margin-bottom: 4px; font-size: 14px; }
.pill { background: var(--pill); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.st-ok { color: var(--ok); } .st-failed, .st-blocked { color: var(--bad); } .st-running, .st-queued { color: var(--accent); }
.st-needs_key, .st-needs_login, .st-needs_paid, .st-manual, .st-rate_limited, .st-unavailable, .st-skipped { color: var(--warn); }
.progress { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-bottom: 10px; }
.prog { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.prog b { display: block; font-size: 14px; }
.events { margin: 0; padding-left: 20px; max-height: 160px; overflow: auto; font-size: 13px; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.dcard { border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.dcard .big { font-size: 26px; font-weight: 700; } .dcard .small { font-size: 12px; color: var(--muted); }
.bar { height: 6px; background: var(--pill); border-radius: 3px; overflow: hidden; margin: 6px 0; }
.bar > span { display: block; height: 100%; background: var(--warn); }
.flag { padding: 6px 8px; border-left: 3px solid transparent; margin-bottom: 4px; }
.flag.hot { background: var(--flag); border-left-color: var(--warn); }
.badge { display: inline-block; font-size: 11px; background: var(--pill); border-radius: 4px; padding: 0 6px; margin-left: 4px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.tabs button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.side { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.doc { border: 1px solid var(--line); border-radius: 8px; padding: 12px; white-space: pre-wrap; font: 14px/1.6 Georgia, serif;
  max-height: 520px; overflow: auto; }
ins { background: var(--ins); text-decoration: none; } del { background: var(--del); }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
tr.best td { background: var(--ins); }
.manual-row { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.manual-row input[type=number] { width: 90px; }
.manual-row textarea { width: 100%; min-height: 90px; margin-top: 6px; }
#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg);
  padding: 8px 14px; border-radius: 6px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
ul.notes { margin: 6px 0; padding-left: 18px; }
@media (max-width: 760px) { .side, .cols { grid-template-columns: 1fr; } .editor { min-height: 220px; } }
