/* Catnip 主报告 —— 样式表
 * 配色与圆角等统一在 :root 的自定义属性里，改主题优先改那里。
 */

:root {
  --ink: #152337;
  --muted: #5f6c7c;
  --paper: #f5f3ed;
  --surface: #fffdf9;
  --surface-2: #edf3f1;
  --navy: #18334f;
  --teal: #118a80;
  --teal-dark: #08675f;
  --amber: #e6a43a;
  --coral: #d7624e;
  --violet: #7161a8;
  --line: #d8dedc;
  --success-bg: #e0f2ec;
  --reject-bg: #f9e7e2;
  --blocked-bg: #fff0cf;
  --invalid-bg: #eceff3;
  --shadow: 0 18px 60px rgba(28, 49, 68, .09);
  --radius: 18px;
  --page: min(1180px, calc(100% - 36px));
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 82px; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 5%, rgba(17, 138, 128, .11), transparent 25rem),
    radial-gradient(circle at 5% 19%, rgba(230, 164, 58, .09), transparent 22rem),
    var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { color: var(--teal-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
code, .mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: .92em;
}
code { padding: .1em .36em; border-radius: 5px; background: #edf0ef; }
h1, h2, h3, h4 { line-height: 1.16; letter-spacing: -.025em; }
h1 { margin: 0; font-size: clamp(2.6rem, 7vw, 5.7rem); max-width: 980px; }
h2 { margin: 0 0 16px; font-size: clamp(2rem, 4vw, 3.25rem); }
h3 { margin: 0 0 12px; font-size: clamp(1.25rem, 2vw, 1.65rem); }
p { margin: 0 0 1em; }
strong { color: var(--navy); }

.progress {
  position: fixed;
  z-index: 100;
  inset: 0 auto auto 0;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--amber), var(--teal));
}

.topbar {
  position: sticky;
  z-index: 90;
  top: 0;
  border-bottom: 1px solid rgba(21, 35, 55, .09);
  background: rgba(245, 243, 237, .91);
  backdrop-filter: blur(16px);
}
.topbar-inner {
  width: var(--page);
  min-height: 64px;
  margin: auto;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: white;
  background: var(--navy);
  box-shadow: inset -7px -7px 0 rgba(17, 138, 128, .55);
  font-size: 12px;
}
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--muted);
  font-size: .88rem;
  text-decoration: none;
  white-space: nowrap;
}
.nav a:hover, .nav a.active { color: white; background: var(--navy); }

.hero {
  width: var(--page);
  padding: clamp(72px, 10vw, 140px) 0 54px;
  margin: auto;
}
.eyebrow, .section-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  color: var(--teal-dark);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.eyebrow::before, .section-kicker::before {
  content: "";
  width: 28px;
  height: 3px;
  border-radius: 3px;
  background: var(--amber);
}
.hero h1 em { color: var(--teal); font-style: normal; }
.hero-lead {
  max-width: 850px;
  margin: 28px 0 32px;
  color: #405166;
  font-size: clamp(1.08rem, 2vw, 1.35rem);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--navy);
  border-radius: 999px;
  color: var(--navy);
  font-weight: 750;
  text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease;
}
.button.primary { color: white; background: var(--navy); }
.button:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(24, 51, 79, .14); }

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 64px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--line);
  box-shadow: var(--shadow);
}
.status-item { padding: 22px; background: var(--surface); }
.status-item small { display: block; margin-bottom: 4px; color: var(--muted); font-weight: 700; }
.status-item b { display: block; font-size: 1.2rem; }
.status-item span { color: var(--muted); font-size: .9rem; }

main { width: var(--page); margin: auto; }
.section { padding: clamp(65px, 9vw, 110px) 0; border-top: 1px solid rgba(21, 35, 55, .11); }
.section-intro { max-width: 810px; margin-bottom: 34px; color: var(--muted); font-size: 1.06rem; }
.anchor { position: relative; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.metric {
  min-height: 155px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 253, 249, .82);
}
.metric .value { color: var(--navy); font-size: clamp(1.65rem, 3vw, 2.45rem); font-weight: 880; line-height: 1.05; }
.metric .unit { color: var(--teal-dark); font-size: .82rem; font-weight: 800; }
.metric p { margin: 13px 0 0; color: var(--muted); font-size: .89rem; line-height: 1.5; }

.phase-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 30px;
}
.phase-card {
  position: relative;
  min-height: 250px;
  padding: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}
.phase-card::after {
  content: attr(data-phase);
  position: absolute;
  right: 12px;
  bottom: -24px;
  color: rgba(24, 51, 79, .055);
  font-size: 7rem;
  font-weight: 900;
  line-height: 1;
}
.phase-card .phase-label {
  color: var(--teal-dark);
  font-size: .74rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.phase-card h3 { margin-top: 9px; font-size: 1.17rem; }
.phase-card p { position: relative; z-index: 1; color: var(--muted); font-size: .9rem; line-height: 1.58; }

.finding-table td:first-child {
  width: 18%;
  color: var(--teal-dark);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .055em;
  text-transform: uppercase;
  white-space: nowrap;
}
.finding-table td:nth-child(2) { width: 38%; font-weight: 700; color: var(--navy); }
.finding-table td:last-child { color: var(--muted); }

.callout {
  margin: 28px 0;
  padding: 22px 24px;
  border: 1px solid #e3d29e;
  border-left: 5px solid var(--amber);
  border-radius: 12px;
  background: #fff8e7;
}
.callout.danger { border-color: #ebc7bf; border-left-color: var(--coral); background: #fff2ee; }
.callout.good { border-color: #b8dbd4; border-left-color: var(--teal); background: #ebf7f4; }
.callout h3 { font-size: 1rem; letter-spacing: 0; }
.callout p:last-child { margin-bottom: 0; }

.topology {
  display: grid;
  grid-template-columns: 1fr 96px 1fr;
  align-items: stretch;
  gap: 12px;
  margin-top: 36px;
}
.gpu {
  padding: 26px;
  border: 2px solid var(--navy);
  border-radius: var(--radius);
  background: var(--surface);
}
.gpu:nth-child(3) { border-color: var(--teal); background: #f0faf7; }
.gpu-tag { color: var(--muted); font-size: .75rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.gpu h3 { margin-top: 5px; }
.gpu ul { padding-left: 18px; margin-bottom: 0; color: var(--muted); }
.flow {
  display: grid;
  align-content: center;
  gap: 12px;
  text-align: center;
  color: var(--teal-dark);
  font-size: .75rem;
  font-weight: 750;
}
.arrow { font-size: 2.2rem; line-height: 1; }

.contract-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 18px;
  margin-top: 34px;
}
.card {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 35px rgba(28, 49, 68, .045);
}
.contract-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.contract-list div { padding: 13px 14px; border-radius: 10px; background: var(--surface-2); }
.contract-list b, .contract-list span { display: block; }
.contract-list span { color: var(--muted); font-size: .86rem; }

.timeline { position: relative; margin-top: 42px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 29px;
  top: 20px;
  bottom: 20px;
  width: 2px;
  background: linear-gradient(var(--amber), var(--teal), var(--navy));
}
.stage {
  position: relative;
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  gap: 24px;
  margin-bottom: 30px;
}
.stage-number {
  position: sticky;
  top: 82px;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border: 4px solid var(--paper);
  border-radius: 50%;
  color: white;
  background: var(--navy);
  font-weight: 900;
  box-shadow: 0 0 0 1px var(--line);
}
.stage-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.stage-head { padding: 28px 30px 18px; }
.stage-meta { color: var(--teal-dark); font-size: .78rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.stage-summary { max-width: 840px; color: var(--muted); }
.adr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}
.adr { padding: 22px 24px; background: #fbfaf6; }
.adr b { display: block; margin-bottom: 6px; color: var(--teal-dark); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }
.adr p { margin: 0; color: var(--muted); font-size: .92rem; }
.stage-body { padding: 28px 30px 32px; border-top: 1px solid var(--line); }

.data-table-wrap { margin: 22px 0; overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .91rem; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--navy); background: #edf2f0; font-size: .78rem; letter-spacing: .045em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover td { background: #f8faf8; }

figure {
  margin: 28px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}
.chart-open { width: 100%; padding: 0; border: 0; background: white; cursor: zoom-in; }
.chart-open img { display: block; width: 100%; height: auto; }
figcaption { padding: 16px 19px; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; background: #fcfbf8; }
figcaption b { color: var(--navy); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip, .badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 820;
  line-height: 1;
  white-space: nowrap;
}
.chip { padding: 8px 11px; color: var(--navy); background: #edf2f0; }
.badge { padding: 6px 9px; }
.badge.kept { color: #07584f; background: var(--success-bg); }
.badge.promoted { color: white; background: var(--teal); }
.badge.rejected { color: #8a3022; background: var(--reject-bg); }
.badge.blocked { color: #80550b; background: var(--blocked-bg); }
.badge.invalid, .badge.not-run { color: #536171; background: var(--invalid-bg); }

.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.stat-list { margin: 0; padding: 0; list-style: none; }
.stat-list li { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.stat-list li:last-child { border-bottom: 0; }
.stat-list span { color: var(--muted); }
.stat-list b { text-align: right; font-variant-numeric: tabular-nums; }

.ledger-toolbar {
  position: sticky;
  z-index: 20;
  top: 72px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 28px 0 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 249, .93);
  backdrop-filter: blur(12px);
}
.filter {
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: #edf0ef;
  font: inherit;
  font-size: .82rem;
  font-weight: 780;
  cursor: pointer;
}
.filter[aria-pressed="true"] { color: white; background: var(--navy); }
.decision-table td:first-child { white-space: nowrap; color: var(--muted); font-weight: 760; }
.decision-table td:last-child { white-space: nowrap; }
.decision-row[hidden] { display: none; }
.decision-table .reason { min-width: 300px; }

details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
summary { padding: 15px 18px; color: var(--navy); font-weight: 800; cursor: pointer; }
details > div { padding: 0 18px 18px; color: var(--muted); }

.next-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.priority { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.priority .p { display: inline-block; margin-bottom: 10px; color: var(--teal-dark); font-size: .75rem; font-weight: 900; letter-spacing: .1em; }
.priority p { color: var(--muted); font-size: .9rem; }
.priority small { display: block; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); }

footer {
  width: var(--page);
  margin: 0 auto;
  padding: 42px 0 70px;
  border-top: 1px solid rgba(21, 35, 55, .11);
  color: var(--muted);
  font-size: .88rem;
}
.footer-grid { display: flex; justify-content: space-between; gap: 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 14px; }

dialog {
  width: min(96vw, 1500px);
  max-height: 94vh;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 16px;
  background: white;
  box-shadow: 0 30px 100px rgba(8, 25, 40, .35);
}
dialog::backdrop { background: rgba(12, 27, 42, .72); backdrop-filter: blur(5px); }
dialog img { display: block; width: 100%; }
.dialog-bar { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding: 14px 18px; color: var(--muted); }
.dialog-bar button { border: 0; border-radius: 999px; padding: 8px 11px; background: #edf0ef; cursor: pointer; }

.back-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: white;
  background: var(--navy);
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(24, 51, 79, .2);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .18s ease;
}
.back-top.visible { opacity: 1; transform: none; pointer-events: auto; }

@media (max-width: 960px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .phase-grid { grid-template-columns: repeat(2, 1fr); }
  .contract-grid, .split-2 { grid-template-columns: 1fr; }
  .next-grid { grid-template-columns: repeat(2, 1fr); }
  .adr-grid { grid-template-columns: 1fr; }
  .topology { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr auto 1fr; }
  .arrow { transform: rotate(90deg); }
}
@media (max-width: 680px) {
  :root { --page: min(100% - 24px, 1180px); }
  .topbar-inner { display: block; padding: 9px 0 7px; }
  .brand { margin-bottom: 5px; }
  .nav { margin-left: 0; }
  .nav a { padding: 6px 9px; font-size: .78rem; }
  .status-strip, .metric-grid, .next-grid { grid-template-columns: 1fr; }
  .phase-grid { grid-template-columns: 1fr; }
  .status-item { padding: 18px; }
  .timeline::before { left: 21px; }
  .stage { grid-template-columns: 43px minmax(0, 1fr); gap: 9px; }
  .stage-number { width: 43px; height: 43px; top: 110px; border-width: 3px; }
  .stage-head, .stage-body { padding: 22px 18px; }
  .adr { padding: 18px; }
  .contract-list { grid-template-columns: 1fr; }
  .ledger-toolbar { top: 106px; }
  .footer-grid { display: block; }
  h1 { font-size: clamp(2.45rem, 15vw, 4.2rem); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}
@media print {
  .topbar, .progress, .ledger-toolbar, .back-top, .hero-actions { display: none !important; }
  body { background: white; }
  .section { break-inside: auto; }
  .stage, figure, .card { break-inside: avoid; }
  .stage-number { position: static; }
  .stage-panel, .card { box-shadow: none; }
}


/* ---- 配套报告入口 ---- */
.companions { margin-top: 30px; }
.companions-title {
  margin: 0 0 14px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.companion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(268px, 1fr));
  gap: 16px;
}
.companion {
  display: flex;
  flex-direction: column;
  padding: 20px 22px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--teal);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
  transition: transform .18s ease, box-shadow .18s ease, border-top-color .18s ease;
}
.companion:hover,
.companion:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 22px 66px rgba(28, 49, 68, .14);
  border-top-color: var(--amber);
}
.companion-kicker {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--teal-dark);
}
.companion strong {
  margin: 7px 0 6px;
  font-size: 1.03rem;
  line-height: 1.35;
  letter-spacing: -.02em;
}
.companion-desc {
  flex: 1;
  color: var(--muted);
  font-size: .89rem;
}
.companion-go {
  margin-top: 12px;
  font-weight: 700;
  font-size: .86rem;
  color: var(--teal-dark);
}
.companion:hover .companion-go span { padding-left: 4px; }
