:root {
  --bg: #f7f7f5; --surface: #ffffff; --text: #1d1f23; --muted: #6b7079; --line: #e3e4e8; --track: #ebecef;
  --ok: #23884d; --run: #2f6fd0; --wait: #b37a0e; --bad: #c93c3c; --idle: #858a93;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131417; --surface: #1b1d21; --text: #e8e9ec; --muted: #9a9fa8; --line: #2c2f35; --track: #2c2f35;
    --ok: #4cbf7b; --run: #6aa2f2; --wait: #e0a53a; --bad: #ec6b6b; --idle: #8d929b;
    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", sans-serif; font-variant-numeric: tabular-nums;
}
main { max-width: 1040px; margin: 0 auto; padding: 32px 16px 48px; }
header { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
h1 { font-size: 22px; margin: 0; }
header p { margin: 2px 0 0; color: var(--muted); }
a { color: var(--run); text-decoration: none; }
a:hover { text-decoration: underline; }
h2 { font-size: 15px; margin: 28px 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.foot { margin-top: 12px; }
.notes { padding-left: 20px; line-height: 1.55; max-width: 820px; }
.notes li { margin-bottom: 8px; }
.notes b { color: var(--text); font-weight: 600; }
.err { color: var(--bad); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }

button {
  font: inherit; font-size: 14px; padding: 7px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.signin { text-align: center; padding: 64px 16px; }
.signin p { color: var(--muted); margin-bottom: 18px; }

.stats { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; }
.stat, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 28px; font-weight: 650; margin: 4px 0 8px; }
.stat .of { font-size: 16px; font-weight: 400; color: var(--muted); }

.bar { height: 8px; border-radius: 99px; background: var(--track); overflow: hidden; }
.fill { height: 100%; border-radius: 99px; }
.fill.s-done { background: var(--ok); } .fill.s-extracting { background: var(--run); }
.fill.s-idle { background: var(--wait); }
.fill.s-queued, .fill.s-not_started { background: var(--idle); }

.badge { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; }
.badge.s-done { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.s-extracting { color: var(--run); background: color-mix(in srgb, var(--run) 14%, transparent); }
.badge.s-idle { color: var(--wait); background: color-mix(in srgb, var(--wait) 14%, transparent); }
.badge.s-queued, .badge.s-not_started { color: var(--idle); background: color-mix(in srgb, var(--idle) 14%, transparent); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: center; }
.card .pct { font-size: 26px; font-weight: 650; margin: 8px 0; }
.card .meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 10px; font-size: 13px; color: var(--muted); }

.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 10px 12px;
  border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; }
.prog { display: flex; align-items: center; gap: 10px; min-width: 170px; }
.prog .bar { flex: 1; }
.prog span { width: 48px; text-align: right; }

.loading { color: var(--muted); padding: 48px 0; text-align: center; }

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats .wide { grid-column: 1 / -1; }
}
