:root {
  --ink: #101820;
  --ink-2: #1c2934;
  --paper: #f4f2eb;
  --card: #fffef9;
  --line: #d8d5cb;
  --muted: #6b746f;
  --signal: #c8f135;
  --blue: #1d5eff;
  --danger: #d23c3c;
  --green: #1a9e6b;
  --amber: #e0a106;
  font-family: "Avenir Next", "PingFang SC", "Hiragino Sans GB", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    linear-gradient(rgba(16,24,32,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(16,24,32,.035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}
.rank-app { max-width: 1240px; margin: 0 auto; padding: 24px 30px 56px; }

/* topbar */
.topbar { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 28px; min-height: 150px; padding: 30px 38px; overflow: hidden; color: #fff; background: var(--ink); border: 1px solid #263642; border-radius: 4px; box-shadow: 0 18px 45px rgba(16,24,32,.16); }
.topbar::after { content: ""; position: absolute; right: -58px; bottom: -158px; width: 300px; height: 300px; border: 50px solid var(--signal); border-radius: 50%; pointer-events: none; }
.hero-copy,.hero-actions { position: relative; z-index: 1; }
.eyebrow { color: var(--signal); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.topbar h1 { margin: 10px 0 8px; font-family: "Songti SC","STSong",serif; font-size: clamp(30px,4vw,46px); line-height: 1.05; letter-spacing: -.04em; }
.topbar p { max-width: 620px; margin: 0; color: #b8c2c8; font-size: 13px; line-height: 1.8; }
.hero-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.search-entry { display: inline-flex; gap: 14px; align-items: center; padding: 10px 15px; color: var(--ink); background: var(--signal); border-radius: 99px; font-size: 12px; font-weight: 800; text-decoration: none; }
.search-entry.alt { background: var(--blue); color: #fff; }
.search-entry.alt2 { background: #2a3946; color: #fff; }
.search-entry span { font-size: 16px; line-height: 1; }
.status { display: inline-flex; align-items: center; gap: 8px; color: #dce3e6; font-size: 12px; }
.status::before { content: ""; width: 7px; height: 7px; background: var(--signal); border-radius: 50%; box-shadow: 0 0 0 4px rgba(200,241,53,.12); }
.status.subtle { color: var(--muted); }
.status.subtle::before { background: var(--blue); box-shadow: 0 0 0 4px rgba(29,94,255,.1); }
.status.ok::before { background: var(--green); box-shadow: 0 0 0 4px rgba(26,158,107,.12); }
.status.bad::before { background: var(--danger); box-shadow: 0 0 0 4px rgba(210,60,60,.12); }

/* cards */
.card { padding: 24px; margin-bottom: 16px; background: rgba(255,254,249,.97); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 8px 28px rgba(16,24,32,.06); }
.calc-card { border-top: 4px solid var(--green); }
.section-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.section-kicker { color: var(--signal); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.section-title h2 { margin: 6px 0 6px; font-size: 19px; }
.section-title p { margin: 0; max-width: 720px; color: var(--muted); font-size: 12px; line-height: 1.7; }

/* form bits */
.prompt-label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
textarea, input { font-family: inherit; font-size: 13px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 9px 11px; }
textarea { width: 100%; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid rgba(29,94,255,.25); border-color: var(--blue); }
.grid { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
button { font-family: inherit; font-size: 12px; font-weight: 800; cursor: pointer; border: 1px solid var(--ink); background: #fff; color: var(--ink); border-radius: 99px; padding: 10px 16px; }
button.primary, button.signal { background: var(--signal); border-color: var(--signal); color: var(--ink); }
button.signal { background: var(--signal); }
button:hover { opacity: .9; }
button:disabled { opacity: .45; cursor: not-allowed; }

/* coverage note */
.coverage-note { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.badge { font-size: 11px; font-weight: 700; padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line); }
.badge.dim { background: #eef6ff; color: var(--blue); border-color: #cfe0ff; }
.badge.miss { background: #fff6e0; color: var(--amber); border-color: #f0dda6; }

/* table */
.count-pill { font-size: 12px; font-weight: 800; color: var(--muted); background: #eceadf; padding: 6px 12px; border-radius: 99px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th { position: sticky; top: 0; background: var(--ink); color: #e8eef2; text-align: left; padding: 11px 12px; font-weight: 700; white-space: nowrap; }
tbody td { padding: 10px 12px; border-top: 1px solid var(--line); white-space: nowrap; }
tbody tr.main-row { cursor: pointer; }
tbody tr.main-row:hover { background: #f1f6ee; }
td.pid { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; color: var(--muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.score-cell { font-weight: 800; font-variant-numeric: tabular-nums; }
.score-cell.dim { color: var(--muted); }     /* 中性兜底分 */
.score-cell.good { color: var(--green); }
.score-cell.mid { color: var(--amber); }
.score-cell.total { color: var(--blue); font-size: 14px; }

/* grade + coverage badges */
.grade { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; font-weight: 800; font-size: 13px; color: #fff; }
.grade.S { background: #1a9e6b; }
.grade.A { background: #2faa5e; }
.grade.B { background: var(--amber); }
.grade.C { background: #c9803a; }
.grade.D { background: var(--danger); }
.grade.unc { background: #8a8f8a; } /* 低覆盖 ? */
.cov-badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 99px; }
.cov-badge.hi { background: #e6f5ec; color: var(--green); }
.cov-badge.mid { background: #fff6e0; color: var(--amber); }
.cov-badge.lo { background: #fdecec; color: var(--danger); }

/* detail expand */
tr.detail-row > td { background: #f7f6ef; padding: 0; }
.detail-box { padding: 16px 18px; display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); gap: 22px; }
.detail-col h4 { margin: 0 0 10px; font-size: 13px; color: var(--ink); }
.dim-bar { display: grid; grid-template-columns: 84px 1fr 46px; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 12px; }
.dim-bar .name { color: var(--muted); }
.dim-bar .track { height: 9px; background: #e7e4d8; border-radius: 99px; overflow: hidden; }
.dim-bar .fill { height: 100%; border-radius: 99px; background: var(--blue); }
.dim-bar .fill.neutral { background: repeating-linear-gradient(45deg,#cfcabd,#cfcabd 5px,#e2ddd0 5px,#e2ddd0 10px); }
.dim-bar .val { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.metric-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px 14px; font-size: 12px; }
.metric-grid .k { color: var(--muted); }
.metric-grid .v { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.ai-mini { grid-column: 1 / -1; margin-top: 4px; border-top: 1px dashed var(--line); padding-top: 12px; }
.ai-mini .reason { font-size: 12px; color: var(--ink-2); line-height: 1.7; background: #fff; border: 1px solid var(--line); border-radius: 3px; padding: 10px 12px; margin-top: 6px; }
.empty { color: var(--muted); font-size: 13px; padding: 14px 2px; }

/* funnel */
.funnel-card { border-top: 4px solid var(--amber); }
.funnel-dist { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.funnel-seg { display: flex; flex-direction: column; gap: 4px; min-width: 92px; flex: 1; background: #f7f6ef; border: 1px solid var(--line); border-radius: 4px; padding: 9px 11px; }
.funnel-seg .sl { font-size: 11px; font-weight: 800; color: var(--muted); }
.funnel-seg .sc { font-size: 20px; font-weight: 800; color: var(--ink); }
.funnel-seg.elim { background: #fdecec; border-color: #f0c4c4; }
.funnel-seg.elim .sc { color: var(--danger); }
.funnel-seg.s7 { background: #e6f5ec; border-color: #bfe6cf; }
.funnel-seg.s7 .sc { color: var(--green); }
.stage-badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 99px; background: #eceadf; color: var(--muted); white-space: nowrap; }
.stage-badge.s4, .stage-badge.s5, .stage-badge.s6 { background: #eef6ff; color: var(--blue); }
.stage-badge.s7 { background: #e6f5ec; color: var(--green); }
.stage-badge.elim { background: #fdecec; color: var(--danger); }
.mini-btn { font-size: 11px; padding: 5px 10px; border-radius: 99px; }

/* test modal */
.test-modal { border: none; border-radius: 6px; padding: 0; max-width: 380px; box-shadow: 0 20px 60px rgba(16,24,32,.3); }
.test-modal::backdrop { background: rgba(16,24,32,.45); }
.test-form { padding: 22px 24px; }
.test-form h3 { margin: 0 0 14px; font-size: 15px; }
.test-form .pid { font-family: ui-monospace, Menlo, monospace; font-size: 12px; color: var(--muted); }
.test-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.test-form input { font-size: 13px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }
.test-form .cancel { border-color: var(--line); color: var(--muted); }

