:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #e3e6eb;
  --text: #1b1f27; --muted: #5d6675; --grid: #e9ecf0;
  --accent: #3b6fd8; --accent-soft: #e6eeff;
  --ok: #23885a; --high: #cf3e33; --mid: #c98a12; --low: #7d8798;
  --c-goog: #3b6fd8; --c-meta: #7a5af5; --c-schd: #1f9d8a; --c-jepq: #e0812a; --c-sgov: #9aa3b2; --c-bench: #39404d;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218; --surface: #171b23; --surface-2: #1e232d; --border: #2a303b;
    --text: #e8ebf1; --muted: #9aa3b2; --grid: #262c36;
    --accent: #7aa2ff; --accent-soft: #1e2a44;
    --ok: #4cc38a; --high: #ff6b5e; --mid: #f0b440; --low: #8a94a6;
    --c-goog: #7aa2ff; --c-meta: #a58bff; --c-schd: #3cc7b0; --c-jepq: #f5a35b; --c-sgov: #8a94a6; --c-bench: #c9cfd9;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1218; --surface: #171b23; --surface-2: #1e232d; --border: #2a303b;
  --text: #e8ebf1; --muted: #9aa3b2; --grid: #262c36;
  --accent: #7aa2ff; --accent-soft: #1e2a44;
  --ok: #4cc38a; --high: #ff6b5e; --mid: #f0b440; --low: #8a94a6;
  --c-goog: #7aa2ff; --c-meta: #a58bff; --c-schd: #3cc7b0; --c-jepq: #f5a35b; --c-sgov: #8a94a6; --c-bench: #c9cfd9;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h3 { font-size: 16px; font-weight: 650; }
p { margin: .4em 0; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); font-size: 13px; }
.note { color: var(--muted); font-size: 13px; margin-top: 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; padding-bottom: 8px; }
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); flex: none; position: relative; }
.logo::after { content: ""; position: absolute; inset: 9px 8px; border-left: 3px solid #fff; border-bottom: 3px solid #fff; transform: skewX(-12deg); opacity: .9; }
.brand h1 { font-size: 18px; }
.sub { margin: 0; color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; align-items: center; flex: none; }
.vault-pill { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 12px; border-radius: 999px; font: inherit; font-size: 13px; cursor: pointer; }
.vault-pill:hover { border-color: var(--accent); }
.vault-pill.open { background: var(--accent-soft); border-color: var(--accent); }
.lock-ico { width: 12px; height: 12px; border: 2px solid currentColor; border-radius: 3px; position: relative; margin-top: 4px; }
.lock-ico::before { content: ""; position: absolute; left: 1px; top: -8px; width: 6px; height: 7px; border: 2px solid currentColor; border-bottom: 0; border-radius: 5px 5px 0 0; }
.vault-pill.open .lock-ico::before { left: 5px; }
.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 34px; height: 34px; border-radius: 999px; cursor: pointer; font-size: 16px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 14px; padding: 10px 12px; border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.dev-banner { background: #fff4d6; color: #6b4b00; text-align: center; font-size: 13px; padding: 6px 16px; }
:root[data-theme="dark"] .dev-banner { background: #3a2f12; color: #f3d48a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .dev-banner { background: #3a2f12; color: #f3d48a; } }

main { padding-top: 20px; padding-bottom: 32px; }
.tab { display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.sec-title { margin-top: 8px; }

.hero { padding: 6px 2px 2px; }
.hero h2 { font-size: clamp(19px, 2.6vw, 26px); font-weight: 650; max-width: 900px; }
.hero h2 em { font-style: normal; color: var(--accent); }
.hero.slim p { max-width: 920px; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; color: var(--muted); margin: 0 0 4px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi .k { color: var(--muted); font-size: 13px; }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.01em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--muted); font-size: 12.5px; }
.kpi.bad .v { color: var(--high); }

.chart { width: 100%; }
.h260 { height: 260px; } .h300 { height: 300px; } .h320 { height: 320px; } .h360 { height: 360px; }

.finding { display: flex; flex-direction: column; gap: 6px; }
.finding .num { font-size: 30px; font-weight: 750; color: var(--high); line-height: 1.1; }
.finding h4 { margin: 0; font-size: 15px; }
.finding p { color: var(--muted); font-size: 13.5px; margin: 0; }
.finding .meta { font-size: 12px; color: var(--muted); margin-top: auto; }

.pipeline { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; counter-reset: s; }
.pipeline li { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; position: relative; counter-increment: s; }
.pipeline li::before { content: counter(s); position: absolute; top: 10px; right: 12px; color: var(--muted); font-size: 12px; }
.pipeline b { display: block; font-size: 14px; }
.pipeline span { color: var(--muted); font-size: 12.5px; }
.pipeline li:nth-child(4) { border-color: var(--accent); }
@media (max-width: 860px) { .pipeline { grid-template-columns: minmax(0, 1fr); } }

.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl.threat td { white-space: normal; vertical-align: top; }
.tbl.threat td:first-child { min-width: 180px; }
@media (max-width: 600px) {
  .tbl.threat thead { display: none; }
  .tbl.threat tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--border); }
  .tbl.threat td { display: block; border: 0; padding: 2px 0; min-width: 0 !important; }
  .tbl.threat td:first-child { font-weight: 600; }
  .tbl.threat td:last-child { color: var(--muted); font-size: 13.5px; }
  .vault-pill #vaultLabel { display: none; }
  .vault-pill { padding: 9px 11px; }
}
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.lk::before { content: "🔒"; font-size: 11px; }
body.unlocked .lk::before { content: "🔓"; }
.masked { color: var(--muted); letter-spacing: .1em; }
.pos { color: var(--ok); } .neg { color: var(--high); }

.sev { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.s-high { background: color-mix(in srgb, var(--high) 15%, transparent); color: var(--high); }
.s-mid { background: color-mix(in srgb, var(--mid) 18%, transparent); color: var(--mid); }
.s-low { background: color-mix(in srgb, var(--low) 18%, transparent); color: var(--low); }
.tag { font-size: 12px; font-weight: 500; color: var(--accent); background: var(--accent-soft); padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.issues { display: grid; gap: 8px; margin-top: 8px; }
.issue { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.issue summary { list-style: none; cursor: pointer; padding: 10px 12px; display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.issue summary::-webkit-details-marker { display: none; }
.issue .id { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.issue .t { font-weight: 600; font-size: 14px; min-width: 0; }
.issue .d { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.issue .body { padding: 0 12px 12px; font-size: 13.5px; }
.issue blockquote { margin: 8px 0; padding: 6px 10px; border-left: 3px solid var(--border); color: var(--muted); font-size: 12.5px; background: var(--surface-2); border-radius: 0 8px 8px 0; overflow-wrap: anywhere; }
.issue .src a { color: var(--accent); font-size: 12.5px; margin-right: 10px; }
.issue .cat { font-size: 12px; color: var(--muted); }
@media (max-width: 600px) {
  .issue summary { grid-template-columns: auto minmax(0, 1fr); }
  .issue .id, .issue .d { display: none; }
}

.lessons { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 8px; }
.lessons b { color: var(--text); }
.lessons li { color: var(--muted); }

.earn { display: grid; gap: 12px; margin-top: 4px; }
.earn .row { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; align-items: center; }
.bar { position: relative; height: 26px; background: var(--surface-2); border-radius: 8px; }
.bar .band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 8px; }
.bar .mark { position: absolute; top: -3px; bottom: -3px; width: 3px; background: var(--high); border-radius: 2px; }
.bar .zero { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted); opacity: .5; }
.earn small { color: var(--muted); font-size: 12.5px; display: block; }

.soon p, .empty p, .empty li { color: var(--muted); }
.empty ol { padding-left: 18px; }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 14px; margin: 8px 0 0; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.checks { margin: 8px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }

.foot { color: var(--muted); font-size: 12.5px; padding-bottom: 28px; }

/* ---- home ---- */
.asof { margin: 0; color: var(--muted); font-size: 13px; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 860px) { .grid-2.wide-left { grid-template-columns: minmax(0, 1fr); } }
.grid-2.inner { margin-top: 12px; gap: 20px; }
.kpis.inner { margin: 6px 0 12px; }
.kpis.inner .kpi { box-shadow: none; background: var(--surface-2); border-color: transparent; }
.mini { margin: 0 0 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
.tbl.compact td { padding: 6px 8px; font-size: 13.5px; }
.tbl.compact td.nm { color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.news { display: grid; gap: 12px; margin-top: 6px; }
.news-item { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.news-item:first-child { border-top: 0; padding-top: 4px; }
.news-item .rk { font-size: 22px; font-weight: 750; color: var(--accent); line-height: 1.2; }
.news-item h4 { margin: 0 0 4px; font-size: 15.5px; line-height: 1.4; }
.news-item .dt { color: var(--muted); font-size: 12.5px; margin-right: 6px; }
.news-item p { margin: 4px 0; font-size: 14px; }
.news-item .imp { color: var(--muted); font-size: 13.5px; }
.vchips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.vchip { font-size: 12px; border-radius: 999px; padding: 2px 9px; background: var(--surface-2); color: var(--muted); }
.vchip.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.vchip.warn { background: color-mix(in srgb, var(--mid) 16%, transparent); color: var(--mid); }
.srcs { margin-top: 6px; font-size: 12.5px; }
.srcs a, .lnk { color: var(--accent); text-decoration: none; margin-right: 12px; }
.srcs a:hover, .lnk:hover { text-decoration: underline; }
.rejected { margin-top: 10px; font-size: 13.5px; color: var(--muted); }
.rejected summary { cursor: pointer; }
.rejected li { margin: 4px 0; }
.strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-top: 6px; }
.strip .s { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.strip .s .n { font-size: 12px; color: var(--muted); }
.strip .s .l { font-weight: 650; font-variant-numeric: tabular-nums; }
.strip .s .c { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lead { color: var(--muted); max-width: 920px; margin-top: 8px; }

/* ---- analyze ---- */
.ana-form { display: flex; gap: 8px; margin-top: 10px; max-width: 460px; }
.ana-form input { flex: 1; min-width: 0; font: inherit; font-size: 16px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); text-transform: uppercase; letter-spacing: .04em; }
.ana-form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.skills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.skill { font-size: 12.5px; border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; background: var(--surface-2); text-decoration: none; color: var(--text); }
.skill small { display: block; color: var(--muted); font-size: 11.5px; }
.log { margin: 8px 0 0; padding-left: 20px; font-size: 13.5px; color: var(--muted); display: grid; gap: 4px; }
.log li.cur { color: var(--text); }
.log li.err { color: var(--high); }
.ana { display: grid; gap: 16px; }
.ana-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; }
.ana-head h2 { font-size: 22px; }
.ana-head .meta { color: var(--muted); font-size: 13px; }
.skill-tag { font-size: 11.5px; color: var(--muted); font-weight: 500; margin-left: 8px; }
.skill-tag a { color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 8px; }
@media (max-width: 860px) { .cols { grid-template-columns: minmax(0, 1fr); } }
.cols h4 { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.cols ul, .plain { margin: 0; padding-left: 18px; font-size: 14px; display: grid; gap: 4px; }
.verdict { font-size: 15px; font-weight: 600; margin: 4px 0 8px; }
.chg { border-top: 1px solid var(--border); padding: 10px 0; font-size: 14px; }
.chg:first-of-type { border-top: 0; }
.chg q { display: block; margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--border); color: var(--muted); font-size: 13px; background: var(--surface-2); border-radius: 0 8px 8px 0; quotes: none; }
.conf { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-left: 6px; }
.conf.High { color: var(--ok); } .conf.Low { color: var(--high); }
.summary-box { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); border-radius: var(--radius); padding: 16px; font-size: 15px; line-height: 1.75; }
.summary-box h3 { margin-bottom: 6px; }
.big-num { font-size: 28px; font-weight: 750; font-variant-numeric: tabular-nums; }
.dcf-controls { display: grid; gap: 12px; margin: 8px 0 4px; }
.dcf-row { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; font-size: 13.5px; color: var(--muted); }
.dcf-row label { display: flex; align-items: center; gap: 8px; }
.dcf-row b { color: var(--text); min-width: 44px; font-variant-numeric: tabular-nums; }
.dcf-row input[type="range"] { width: 160px; accent-color: var(--accent); }
.g5 { display: flex; flex-wrap: wrap; gap: 8px; }
.g5 label { gap: 4px; }
.g5 input { width: 64px; font: inherit; font-size: 13.5px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); text-align: right; }
.mock-banner { background: #fff4d6; color: #6b4b00; border-radius: 10px; padding: 8px 12px; font-size: 13px; }
:root[data-theme="dark"] .mock-banner { background: #3a2f12; color: #f3d48a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mock-banner { background: #3a2f12; color: #f3d48a; } }

.dlg { border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); padding: 20px; width: min(92vw, 400px); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.dlg::backdrop { background: rgba(10, 14, 20, .45); }
.dlg input { width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--text); margin-top: 10px; }
.dlg input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.btn { font: inherit; font-size: 14px; border: 1px solid var(--accent); background: var(--accent); color: #fff; padding: 7px 16px; border-radius: 10px; cursor: pointer; }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn:disabled { opacity: .6; cursor: wait; }
.msg { min-height: 1.4em; font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.msg.err { color: var(--high); }
