:root {
  --bg: #f6f7f9; --card: #fff; --text: #1a1d23; --muted: #666c78; --line: #e3e6ea;
  --accent: #1d4ed8; --accent-text: #fff; --warn-bg: #fff4d6; --warn-text: #7a4b00;
  --s9: #15803d; --s8: #16a34a; --s7: #65a30d; --s6: #ca8a04; --s5: #d97706; --s4: #ea580c; --s3: #dc2626; --s2: #b91c1c; --s1: #991b1b; --s0: #7f1d1d; --sna: #9ca3af;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111318; --card: #1a1d24; --text: #e6e8ec; --muted: #9aa1ad; --line: #2a2f38;
    --accent: #3b82f6; --warn-bg: #3a2e12; --warn-text: #fbd38d;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; }
main { max-width: 960px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.4rem; margin: 12px 0; }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
h3 { font-size: 0.95rem; margin: 14px 0 6px; color: var(--muted); }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card); }
.brand { font-weight: 700; text-decoration: none; }
.linklike { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 4px; }
.tabs a { text-decoration: none; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 0.9rem; }
.tabs a.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.tabs .count { opacity: 0.7; margin-left: 4px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 12px; padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.row:hover { border-color: var(--accent); }
.score { flex: 0 0 44px; height: 44px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: #fff; }
.score.big { flex-basis: 64px; height: 64px; font-size: 1.4rem; }
.s10, .s9 { background: var(--s9); } .s8 { background: var(--s8); } .s7 { background: var(--s7); } .s6 { background: var(--s6); }
.s5 { background: var(--s5); } .s4 { background: var(--s4); } .s3 { background: var(--s3); } .s2 { background: var(--s2); } .s1 { background: var(--s1); } .s0 { background: var(--s0); } .sna { background: var(--sna); }
.main { min-width: 0; }
.title { font-weight: 600; }
.company { font-weight: 400; color: var(--muted); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 0.85rem; color: var(--muted); margin: 4px 0; }
.pill { padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 0.78rem; }
.pill.warn, .flash.warn { background: var(--warn-bg); color: var(--warn-text); border-color: transparent; }
.pill.status { text-transform: capitalize; }
.deadline { color: var(--s4); font-weight: 600; }
.reason { font-size: 0.9rem; color: var(--muted); }
.empty { color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 12px 0; }
.card.narrow { max-width: 360px; margin: 60px auto; }
.detail-head { display: flex; gap: 14px; align-items: flex-start; margin-top: 8px; }
.company-line { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.button { display: inline-block; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); text-decoration: none; font: inherit; cursor: pointer; }
.button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.button.subtle { color: var(--muted); }
.button.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.status-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.status-buttons .button { text-transform: capitalize; }
label { display: block; margin: 8px 0; }
input[type=password], textarea { width: 100%; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font: inherit; }
button[type=submit]:not(.button):not(.linklike) { margin-top: 8px; padding: 8px 14px; border-radius: 8px; border: 0; background: var(--accent); color: var(--accent-text); font: inherit; cursor: pointer; }
.hint { font-size: 0.8rem; color: var(--muted); margin: 0; }
.inline { margin-top: 8px; }
pre { white-space: pre-wrap; word-break: break-word; font: 0.88rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; margin: 0; }
pre.description { max-height: 480px; overflow: auto; }
.history { list-style: none; padding: 0; margin: 0; font-size: 0.9rem; }
.history li { padding: 4px 0; border-bottom: 1px solid var(--line); }
.when, .who { color: var(--muted); }
.flash { padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-text); margin: 8px 0; }
.runinfo { margin-top: 20px; font-size: 0.8rem; color: var(--muted); }
.runinfo .warn { color: var(--s3); }
@media (max-width: 600px) {
  .actions .button { flex: 1 1 45%; text-align: center; }
  .detail-head { flex-direction: column; }
}

/* --- v2 additions --- */
.topnav { display: flex; gap: 14px; align-items: center; }
.topnav a { text-decoration: none; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--s8); animation: pulse 1.2s infinite; vertical-align: middle; }
@keyframes pulse { 50% { opacity: 0.3; } }
.live-line { display: flex; align-items: center; gap: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 12px 0 4px; }
.stat { display: flex; flex-direction: column; align-items: flex-start; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; }
.stat b { font-size: 1.4rem; line-height: 1.1; }
.stat span { font-size: 0.78rem; color: var(--muted); }
.stat.hot b { color: var(--s4); }
.stat.live b { color: var(--s8); }
.stat.action { padding: 0; border: 0; background: none; }
.stat.action button { width: 100%; height: 100%; min-height: 58px; border-radius: 10px; border: 0; background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 600; cursor: pointer; }
.search { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.search input { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; }
.row { align-items: flex-start; }
.row .score { text-decoration: none; }
.row .title { text-decoration: none; display: block; }
.row .title:hover { text-decoration: underline; }
.rowactions { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.rowactions form { margin: 0; }
.button.small { padding: 4px 10px; font-size: 0.82rem; width: 100%; text-align: center; }
.pill.soon { background: var(--s6); color: #fff; border-color: transparent; }
.pill.urgent { background: var(--s3); color: #fff; border-color: transparent; font-weight: 600; }
.pill.dead { opacity: 0.6; }
.pill.req { border-style: dashed; }
.reqs { margin-top: 6px; }
.offscreen { position: absolute; left: -9999px; height: 1px; width: 1px; }
.log { max-height: 420px; overflow: auto; background: var(--bg); padding: 10px; border-radius: 8px; font-size: 0.8rem; }
table.runs { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
table.runs th, table.runs td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
table.runs td.warn { color: var(--s3); }
.hint form.inline { display: inline; }
@media (max-width: 600px) {
  .row { flex-wrap: wrap; }
  .rowactions { flex-direction: row; width: 100%; }
  .rowactions form, .rowactions .button { flex: 1; }
}
details { margin-top: 10px; }
details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
pre.diff { font-size: 0.78rem; }
