:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #111827;
  --muted: #5b6472;
  --line: #e3e6eb;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --manual: #dc2626;
  --manual-soft: #fde8e8;
  --unclear: #b45309;
  --unclear-soft: #fdf1df;
  --auto: #15803d;
  --auto-soft: #e3f4e8;
  --expired: #6b7280;
  --expired-soft: #eceef1;
  --shadow: 0 1px 2px rgba(17, 24, 39, 0.06), 0 2px 8px rgba(17, 24, 39, 0.04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116;
    --surface: #161a21;
    --ink: #e8ebf0;
    --muted: #9aa3b1;
    --line: #2a303a;
    --accent: #2dd4bf;
    --accent-ink: #062521;
    --manual: #f87171;
    --manual-soft: #3a1b1d;
    --unclear: #fbbf24;
    --unclear-soft: #3a2c12;
    --auto: #4ade80;
    --auto-soft: #13301e;
    --expired: #9aa3b1;
    --expired-soft: #232831;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
    --bg: #0e1116;
    --surface: #161a21;
    --ink: #e8ebf0;
    --muted: #9aa3b1;
    --line: #2a303a;
    --accent: #2dd4bf;
    --accent-ink: #062521;
    --manual: #f87171;
    --manual-soft: #3a1b1d;
    --unclear: #fbbf24;
    --unclear-soft: #3a2c12;
    --auto: #4ade80;
    --auto-soft: #13301e;
    --expired: #9aa3b1;
    --expired-soft: #232831;
    --shadow: none;
    color-scheme: dark;
  }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top { border-bottom: 1px solid var(--line); background: var(--surface); }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -0.01em; }
.brand svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 3; }
.brand svg path { stroke: var(--manual); stroke-linecap: round; }
.gh { color: var(--muted); text-decoration: none; font-size: 14px; }
.gh:hover { color: var(--ink); }

.hero { padding: 48px 0 28px; max-width: 760px; }
h1 { text-wrap: balance; font-size: clamp(28px, 4.4vw, 42px); line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 14px; }
.lede { color: var(--muted); font-size: 17px; margin: 0 0 22px; }
.lede b { color: var(--ink); }
.scan { display: flex; gap: 8px; }
.scan input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
.scan input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
button {
  font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); padding: 12px 20px; font-weight: 600;
}
button:focus-visible, .seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: 0.55; cursor: progress; }
button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); padding: 7px 12px; font-weight: 500; font-size: 14px; }
button.secondary:hover { border-color: var(--muted); }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; text-decoration: underline; }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.error { color: var(--manual); background: var(--manual-soft); padding: 10px 12px; border-radius: 8px; margin-top: 14px; }

.progress { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.progress li::before { content: "○"; display: inline-block; width: 22px; }
.progress li.doing { color: var(--ink); }
.progress li.doing::before { content: "◐"; animation: spin 1s linear infinite; }
.progress li.done::before { content: "✓"; color: var(--auto); }
.progress li.fail::before { content: "!"; color: var(--manual); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .progress li.doing::before { animation: none; } }
@keyframes spin { 50% { opacity: 0.3; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card h2 { font-size: 16px; margin: 0; letter-spacing: -0.01em; }
.sub { color: var(--muted); font-size: 13.5px; margin: 4px 0 14px; }
.note { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

.headline { display: grid; grid-template-columns: auto 1fr; gap: 28px; align-items: center; }
.kicker { margin: 0; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }
.big { font-size: 72px; line-height: 1; margin: 6px 0 2px; font-weight: 750; letter-spacing: -0.03em; color: var(--manual); font-variant-numeric: tabular-nums; }
.big-label { margin: 0; font-weight: 600; }
.hl-text { margin: 0; color: var(--muted); font-size: 16px; }
.hl-text b { color: var(--ink); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.tile .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .k { color: var(--muted); font-size: 13px; }
.tile.warn .v { color: var(--manual); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 .card { margin-bottom: 16px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 12px; font-family: inherit; }
.chart .val { fill: var(--ink); font-weight: 650; font-size: 13px; }
.chart .axis { stroke: var(--line); }
.chart .today { stroke: var(--ink); stroke-dasharray: 3 3; opacity: 0.5; }

.attention { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.attention li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 8px; background: var(--manual-soft); font-size: 14px; flex-wrap: wrap; }
.attention li .why { color: var(--muted); }
.attention li.expired { background: var(--expired-soft); }
.attention .empty { background: var(--auto-soft); }

.table-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
.filters { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 4px 0 6px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.seg button { background: none; color: var(--muted); padding: 6px 11px; font-weight: 500; font-size: 13.5px; border-radius: 7px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.seg button .c { opacity: 0.7; margin-left: 4px; font-variant-numeric: tabular-nums; }
#search { font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); min-width: 200px; }

.table-wrap { overflow-x: auto; margin-top: 8px; border-top: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.name { max-width: 340px; }
td.name .primary { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 13.5px; font-weight: 600; word-break: break-all; }
td.name .more { display: block; color: var(--muted); font-size: 12.5px; word-break: break-all; }
td.ca { white-space: nowrap; }
td.exp .date { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.exp .left { font-size: 12.5px; color: var(--muted); }
td.exp .left.soon { color: var(--manual); font-weight: 600; }
td.num { font-variant-numeric: tabular-nums; text-align: right; }
td .owner { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--ink); width: 150px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; cursor: help; white-space: nowrap; }
.badge.manual { background: var(--manual-soft); color: var(--manual); }
.badge.unclear { background: var(--unclear-soft); color: var(--unclear); }
.badge.automated { background: var(--auto-soft); color: var(--auto); }
.badge.expired { background: var(--expired-soft); color: var(--expired); }
.livecell { font-size: 12.5px; white-space: nowrap; color: var(--muted); }
.livecell .okk { color: var(--auto); }
.livecell .bad { color: var(--manual); }

.about { padding: 28px 0 8px; }
.about h2 { font-size: 20px; margin: 0 0 8px; }
.about h3 { font-size: 15px; margin: 12px 0 4px; }
.about p { color: var(--muted); margin: 0; font-size: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.foot { color: var(--muted); font-size: 13px; padding: 28px 16px 40px; }

@media (max-width: 820px) {
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .headline { grid-template-columns: 1fr; gap: 10px; }
  .big { font-size: 56px; }
  .hero { padding-top: 32px; }
}
@media (max-width: 520px) {
  .scan button { padding: 12px 14px; }
  #search { min-width: 0; width: 100%; }
}

/* ---------- v2 additions ---------- */
.brand { color: var(--ink); text-decoration: none; }
.topnav { display: flex; gap: 18px; align-items: center; }
.topnav a { color: var(--muted); text-decoration: none; font-size: 14px; }
.topnav a:hover { color: var(--ink); }
code { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 0.92em; background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }
.muted { color: var(--muted); }
.chart .muted { fill: var(--muted); font-weight: 400; }
.bad { color: var(--manual); }

.countdown { display: inline-block; margin: 0 0 14px; padding: 5px 11px; border-radius: 999px; background: var(--manual-soft); color: var(--manual); font-size: 13.5px; }
.countdown b { font-weight: 650; }
.progress li.skip::before { content: "–"; color: var(--unclear); }

.headline { grid-template-columns: auto 1fr; align-items: start; }
.grade-wrap { display: grid; justify-items: center; gap: 6px; }
.grade { width: 108px; height: 108px; border-radius: 22px; display: grid; place-items: center; font-size: 64px; font-weight: 750; letter-spacing: -0.04em; color: var(--surface); background: var(--expired); }
.grade.small { width: 34px; height: 34px; border-radius: 9px; font-size: 19px; letter-spacing: 0; }
.g-A { background: var(--auto); }
.g-B { background: color-mix(in srgb, var(--auto) 60%, var(--unclear)); }
.g-C { background: var(--unclear); }
.g-D { background: color-mix(in srgb, var(--unclear) 45%, var(--manual)); }
.g-F { background: var(--manual); }
.g-na { background: var(--expired); }
.grade-label { margin: 0; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; text-align: center; }
.hl-main { min-width: 0; }
.big-line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin: 4px 0 6px; }
.big-line .big { margin: 0; }
.big-line .big-label { font-weight: 600; font-size: 17px; }
.grade-notes { margin: 10px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 2px; }
.changes { margin: 10px 0 0; font-size: 14px; padding: 8px 12px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); }
.source-note { color: var(--muted); font-size: 13px; margin: -6px 2px 14px; }

.board { margin: 6px 0 28px; }
.board-head h2 { font-size: 16px; margin: 0; }
.board-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-top: 10px; }
.bcard { display: grid; gap: 6px; text-align: left; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 14px; font-weight: 400; box-shadow: var(--shadow); }
button.bcard:hover { border-color: var(--accent); }
.bhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.bdomain { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-weight: 600; word-break: break-all; }
.bstats { font-size: 13px; color: var(--muted); }
.bstats b { color: var(--ink); }

.attention li { align-items: baseline; }
.attention li .ca-name { color: var(--muted); flex: 1; }
.attention .jump { font-weight: 600; color: var(--ink); text-decoration: none; font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 13.5px; }
.attention .jump:hover { text-decoration: underline; }

td.name .expand { all: unset; cursor: pointer; display: inline-flex; gap: 6px; align-items: baseline; border-radius: 4px; }
td.name .expand:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
td.name .chev { display: inline-block; color: var(--muted); transition: transform 0.15s; font-size: 16px; line-height: 1; width: 10px; }
tr.open td.name .chev { transform: rotate(90deg); }
tr.row:hover td { background: color-mix(in srgb, var(--bg) 60%, transparent); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 11.5px; padding: 1px 7px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.tag.warn { color: var(--manual); border-color: color-mix(in srgb, var(--manual) 40%, var(--line)); }
th.num, td.num { text-align: right; }

tr.detail > td { background: var(--bg); padding: 16px 18px 18px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px; }
.detail h4 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.detail .facts { margin: 0 0 10px; font-size: 14px; }
.detail ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; font-size: 14px; }
.detail .guidance li::marker { color: var(--accent); }
.detail .names { margin: 0; font-size: 13px; line-height: 1.9; word-break: break-all; }
.detail .certs { font-size: 13px; }
.gantt svg { width: 100%; height: auto; display: block; }
.gantt text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.gantt .axis { stroke: var(--line); }
.gantt .today { stroke: var(--ink); stroke-dasharray: 3 3; opacity: 0.5; }

.schedule { margin-top: 22px; }
.schedule h3 { margin-top: 0; }
table.plain td, table.plain th { padding: 8px; }
.more { margin-top: 10px; }

@media (max-width: 820px) {
  .detail-grid { grid-template-columns: 1fr; gap: 6px; }
  .grade { width: 84px; height: 84px; font-size: 50px; border-radius: 18px; }
  .headline { grid-template-columns: auto 1fr; gap: 16px; }
}
@media (max-width: 520px) {
  .headline { grid-template-columns: 1fr; }
  .grade-wrap { justify-items: start; }
  .topnav a:first-child { display: none; }
}

@media print {
  :root { --bg: #fff; --surface: #fff; --shadow: none; }
  .top, .hero, .board, .actions, .filters, .about, .foot, td .owner, .chev { display: none !important; }
  body { font-size: 12px; }
  .card { break-inside: avoid; box-shadow: none; }
  tr.detail { break-inside: avoid; }
  #results { display: block !important; }
  .grid2 { grid-template-columns: 1fr 1fr; }
}
