/* ---------- self-hosted fonts (CSP: font-src 'self') ---------- */
@font-face{font-family:'Inter';font-style:normal;font-weight:400;font-display:swap;src:url('../fonts/inter-latin-400-normal.woff2') format('woff2');}
@font-face{font-family:'Inter';font-style:normal;font-weight:500;font-display:swap;src:url('../fonts/inter-latin-500-normal.woff2') format('woff2');}
@font-face{font-family:'Inter';font-style:normal;font-weight:600;font-display:swap;src:url('../fonts/inter-latin-600-normal.woff2') format('woff2');}
@font-face{font-family:'Inter';font-style:normal;font-weight:700;font-display:swap;src:url('../fonts/inter-latin-700-normal.woff2') format('woff2');}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:400;font-display:swap;src:url('../fonts/space-grotesk-latin-400-normal.woff2') format('woff2');}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:500;font-display:swap;src:url('../fonts/space-grotesk-latin-500-normal.woff2') format('woff2');}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:600;font-display:swap;src:url('../fonts/space-grotesk-latin-600-normal.woff2') format('woff2');}
@font-face{font-family:'Space Grotesk';font-style:normal;font-weight:700;font-display:swap;src:url('../fonts/space-grotesk-latin-700-normal.woff2') format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:400;font-display:swap;src:url('../fonts/jetbrains-mono-latin-400-normal.woff2') format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:500;font-display:swap;src:url('../fonts/jetbrains-mono-latin-500-normal.woff2') format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:600;font-display:swap;src:url('../fonts/jetbrains-mono-latin-600-normal.woff2') format('woff2');}
@font-face{font-family:'JetBrains Mono';font-style:normal;font-weight:700;font-display:swap;src:url('../fonts/jetbrains-mono-latin-700-normal.woff2') format('woff2');}

/* =============================================================
   NCSX — Neocloud Credit Spread Index
   Design system: 51kaifa blue line, financial-terminal precision
   ============================================================= */

/* ---------- tokens ---------- */
:root {
  --bg:            #FAFAFF;
  --surface:       #FFFFFF;
  --surface-2:     #F5F8FD;
  --surface-3:     #EDF3FC;
  --border:        #E4E9F2;
  --border-strong: #D2DBEA;

  --text:          #0B1729;
  --text-2:        #4C5A73;
  --text-3:        #8493A9;

  --blue:          #157EFE;
  --blue-deep:     #0B63D0;
  --blue-ink:      #0846A0;
  --blue-soft:     #F0F7FF;

  --danger:        #E5484D;   /* 利差走阔 = 信用恶化 */
  --danger-soft:   #FEF1F1;
  --success:       #14996B;   /* 利差收窄 = 信用改善 */
  --success-soft:  #EDF9F4;
  --amber:         #C9820A;
  --amber-soft:    #FDF6E7;

  --ink:           #0A1424;   /* code / dark blocks */

  --f-display: 'Space Grotesk', 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --f-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --f-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-sm: 3px; --r: 5px; --r-md: 8px; --r-lg: 14px;
  --sh-sm: 0 1px 2px rgba(11,23,41,.05);
  --sh-md: 0 4px 18px -6px rgba(11,23,41,.10);
  --sh-lg: 0 24px 56px -24px rgba(11,63,208,.22);

  --nav-h: 60px;
  --tape-h: 34px;
  --wrap: 1240px;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--f-body); font-size: 15px; line-height: 1.62;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  /* 兜底：CUSIP / DOI / 长 URL 等不可断串不再把页面顶出横向滚动条 */
  overflow-wrap: break-word;
}
h1,h2,h3,h4,h5 { font-family: var(--f-display); font-weight: 600; letter-spacing: -.015em; margin: 0; color: var(--text); }
a { color: var(--blue-deep); text-decoration: none; }
a:hover { color: var(--blue); }
img, svg { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.num  { font-family: var(--f-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
.sr { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }

/* ---------- status banner ---------- */
.banner {
  background: var(--amber-soft); border-bottom: 1px solid #F0DFB8;
  font-size: 12.5px; color: #7A5604;
}
.banner .wrap { display: flex; align-items: center; gap: 10px; min-height: 34px; padding-top: 7px; padding-bottom: 7px; flex-wrap: wrap; }
.banner .wrap > span:last-child { flex: 1 1 320px; min-width: 0; line-height: 1.5; }
.banner b { font-weight: 600; }
.banner .tag {
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  background: #F5E6C3; border: 1px solid #E9D3A0; border-radius: var(--r-sm);
  padding: 2px 7px; color: #6B4B03; white-space: nowrap;
}

/* ---------- ticker tape ---------- */
.tape {
  height: var(--tape-h); background: var(--ink); color: #CBD6E6;
  border-bottom: 1px solid #16243C; overflow: hidden; position: relative;
  display: flex; align-items: center;
}
.tape-track { display: flex; gap: 34px; white-space: nowrap; animation: slide 46s linear infinite; padding-left: 12px; will-change: transform; }
.tape:hover .tape-track { animation-play-state: paused; }
@keyframes slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tape-item { display: inline-flex; align-items: baseline; gap: 8px; font-size: 12px; }
.tape-item .k { font-family: var(--f-mono); letter-spacing: .04em; color: #8FA2BC; font-size: 11px; }
.tape-item .v { font-family: var(--f-mono); font-variant-numeric: tabular-nums; color: #fff; font-weight: 500; }
.tape-item .d { font-family: var(--f-mono); font-size: 11.5px; }
.tape-item .d.up { color: #FF8A8E; } .tape-item .d.dn { color: #4FD1A0; }

/* ---------- header nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 60; height: var(--nav-h);
  background: rgba(255,255,255,.86); backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav .wrap { height: var(--nav-h); display: flex; align-items: center; gap: 30px; }
.brand { display: flex; align-items: center; gap: 11px; text-decoration: none; color: var(--text); flex-shrink: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--r-sm); flex-shrink: 0;
  background: linear-gradient(145deg, var(--blue) 0%, var(--blue-ink) 100%);
  display: grid; place-items: center; color: #fff;
  font-family: var(--f-display); font-weight: 700; font-size: 13px; letter-spacing: -.04em;
  box-shadow: 0 3px 10px -3px rgba(21,126,254,.55);
}
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; }
.brand-txt strong { font-family: var(--f-display); font-size: 15.5px; letter-spacing: -.02em; }
.brand-txt span { font-size: 10.5px; color: var(--text-3); letter-spacing: .02em; }
.nav-links { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav-links a {
  font-size: 13.5px; color: var(--text-2); padding: 7px 12px; border-radius: var(--r);
  transition: .16s; font-weight: 500; white-space: nowrap;
}
.nav-links a:hover { background: var(--surface-2); color: var(--text); }
.nav-links a.on { color: var(--blue-deep); background: var(--blue-soft); }
.nav-cta {
  font-size: 13px; font-weight: 600; padding: 8px 15px; border-radius: var(--r);
  background: var(--blue); color: #fff !important; box-shadow: 0 3px 10px -4px rgba(21,126,254,.6);
  transition: .16s;
}
.nav-cta:hover { background: var(--blue-deep); transform: translateY(-1px); }
.nav-asof {
  font-family: var(--f-mono); font-size: 11px; color: var(--text-3);
  padding-left: 14px; margin-left: 4px; border-left: 1px solid var(--border);
  white-space: nowrap;
}
.nav-asof b { color: var(--text-2); font-weight: 500; }
/* mobile menu */
.nav-menu-btn {
  display: none; margin-left: auto; align-items: center; justify-content: center;
  width: 38px; height: 34px; border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); cursor: pointer; padding: 0;
}
.nav-menu-btn i { display: block; width: 16px; height: 1.6px; background: var(--text); position: relative; }
.nav-menu-btn i::before, .nav-menu-btn i::after {
  content: ''; position: absolute; left: 0; width: 16px; height: 1.6px; background: var(--text);
}
.nav-menu-btn i::before { top: -5px; } .nav-menu-btn i::after { top: 5px; }
.nav-menu-btn.on i { background: transparent; }
.nav-menu-btn.on i::before { top: 0; transform: rotate(45deg); }
.nav-menu-btn.on i::after { top: 0; transform: rotate(-45deg); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  background: var(--ink); color: #fff; font-size: 13px; padding: 10px 18px; border-radius: var(--r);
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); opacity: 0; pointer-events: none;
  transition: .22s; z-index: 200;
}
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* download / utility row */
.dl-row { display: flex; gap: 10px; flex-wrap: wrap; }
.kv-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
@media (max-width: 760px) { .kv-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }

/* citation block */
.cite-out {
  font-family: var(--f-mono); font-size: 12.5px; line-height: 1.8; white-space: pre-wrap;
  /* APA/BibTeX 里有 DOI 与超长 URL，pre-wrap 不会断词，窄屏会把面板顶宽 */
  overflow-wrap: anywhere; word-break: break-word;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px 16px; color: var(--text);
}

/* changelog */
.log-item { display: grid; grid-template-columns: 92px 1fr; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.log-item:last-child { border-bottom: 0; }
.log-item .v { font-family: var(--f-mono); font-size: 12px; color: var(--blue-deep); }
.log-item .d { font-family: var(--f-mono); font-size: 11px; color: var(--text-3); }
.log-item h5 { font-size: 14.5px; margin: 3px 0 5px; font-family: var(--f-display); }
.log-item p { margin: 0; font-size: 13.5px; color: var(--text-2); }
@media (max-width: 600px) { .log-item { grid-template-columns: 1fr; gap: 6px; } }

/* bar (distribution) */
.bar-row { display: grid; grid-template-columns: 128px 1fr 96px; gap: 12px; align-items: center; padding: 7px 0; }
.bar-row .lbl { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 9px; background: var(--surface-3); border-radius: 5px; overflow: hidden; position: relative; }
.bar-track.z::after { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.bar-fill { height: 100%; border-radius: 5px; background: var(--blue); position: absolute; top: 0; }
.bar-fill.up { background: var(--danger); } .bar-fill.dn { background: var(--success); }
.bar-fill.alt { background: var(--blue-deep); }
.bar-row .val { font-family: var(--f-mono); font-size: 12px; color: var(--text-2); text-align: right; }
@media (max-width: 600px) { .bar-row { grid-template-columns: 92px 1fr 74px; } }

/* API console */
.console-out {
  font-family: var(--f-mono); font-size: 12px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
  background: var(--ink); color: #D7E1F0; border-radius: var(--r-md); padding: 14px 16px;
  max-height: 300px; overflow: auto; margin: 0;
}
.console-out .k { color: #7FB4FF; } .console-out .s { color: #9BE0B4; } .console-out .n { color: #FFC98B; }
.status-pill { font-family: var(--f-mono); font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--surface-3); color: var(--text-3); border: 1px solid var(--border); }
.status-pill.ok { background: var(--success-soft); color: var(--success); border: 1px solid #C7EBDC; }
.status-pill.err { background: var(--danger-soft); color: var(--danger); border: 1px solid #F6CDCD; }

/* ---------- hero ---------- */
.hero { padding: 60px 0 40px; border-bottom: 1px solid var(--border); background:
  radial-gradient(1100px 420px at 12% -10%, rgba(21,126,254,.075), transparent 62%),
  radial-gradient(760px 340px at 92% 0%, rgba(11,99,208,.05), transparent 60%); }
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px; margin-bottom: 20px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--blue-deep);
}
.eyebrow::before { content: ''; width: 22px; height: 1px; background: var(--blue); }
.hero h1 { font-size: clamp(34px, 4.4vw, 53px); line-height: 1.08; letter-spacing: -.03em; max-width: 15ch; }
.hero h1 em { font-style: normal; color: var(--blue-deep); }
.hero-lede { margin: 20px 0 0; font-size: 17px; color: var(--text-2); max-width: 62ch; }
.hero-lede b { color: var(--text); font-weight: 600; }

.hero-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,420px); gap: 44px; align-items: end; margin-top: 44px; }

/* primary level block */
.primary { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); padding: 26px 28px 22px; box-shadow: var(--sh-md); }
.primary-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.primary-head .lbl { font-family: var(--f-display); font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.primary-head .lbl small { display: block; font-family: var(--f-body); font-size: 11.5px; color: var(--text-3); font-weight: 400; letter-spacing: 0; }
.primary-val { display: flex; align-items: baseline; gap: 12px; margin: 18px 0 4px; }
.primary-val .big { font-family: var(--f-mono); font-size: 54px; font-weight: 600; letter-spacing: -.045em; line-height: 1; font-variant-numeric: tabular-nums; }
.primary-val .unit { font-size: 15px; color: var(--text-3); }
.delta { font-family: var(--f-mono); font-size: 14px; font-weight: 500; padding: 3px 9px; border-radius: var(--r-sm); white-space: nowrap; }
.delta.up { color: var(--danger); background: var(--danger-soft); }
.delta.dn { color: var(--success); background: var(--success-soft); }
.delta.flat { color: var(--text-3); background: var(--surface-2); }
.primary-foot { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.mstat { display: flex; flex-direction: column; gap: 1px; }
.mstat span { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-3); font-family: var(--f-mono); }
.mstat b { font-family: var(--f-mono); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- index cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.card {
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface);
  padding: 18px 18px 14px; transition: .18s; position: relative; overflow: hidden;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--sh-md); transform: translateY(-2px); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-name { font-family: var(--f-display); font-size: 13.5px; font-weight: 600; }
.card-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.card-val { font-family: var(--f-mono); font-size: 30px; font-weight: 600; letter-spacing: -.035em; margin: 12px 0 8px; font-variant-numeric: tabular-nums; }
.card-val small { font-size: 13px; color: var(--text-3); font-weight: 400; letter-spacing: 0; margin-left: 3px; }
.card-spark { height: 44px; margin: 4px -4px -4px; }
.card-meta { display: flex; gap: 14px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
.card-meta b { font-family: var(--f-mono); color: var(--text-2); font-weight: 500; }

/* ---------- section ---------- */
.sec { padding: 64px 0; }
.sec.alt { background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 26px; flex-wrap: wrap; }
.sec-head h2 { font-size: 26px; letter-spacing: -.025em; }
.sec-head p { margin: 8px 0 0; color: var(--text-2); font-size: 14.5px; max-width: 68ch; }
.sec-kicker { font-family: var(--f-mono); font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--blue-deep); margin-bottom: 10px; }

/* ---------- panel / chart ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head h3 { font-size: 15px; letter-spacing: -.01em; }
.panel-head .sub { font-size: 12px; color: var(--text-3); }
.panel-body { padding: 18px 20px; }
.panel-body.flush { padding: 0; }

/* flex-wrap:wrap —— API 页端点切换有 8 个按钮，窄屏不换行会把 panel 顶宽 138px */
.seg { display: inline-flex; flex-wrap: wrap; max-width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 2px; gap: 2px; }
.seg button {
  border: 0; background: transparent; font-size: 12px; padding: 5px 12px; border-radius: 3px;
  color: var(--text-2); cursor: pointer; font-family: var(--f-mono); letter-spacing: .01em; transition: .14s;
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--blue-deep); box-shadow: var(--sh-sm); font-weight: 500; }

.chart-host { position: relative; }
.chart-host svg { width: 100%; height: auto; display: block; overflow: visible; }
.tip {
  position: absolute; pointer-events: none; opacity: 0; transform: translate(-50%, 0);
  background: var(--ink); color: #fff; border-radius: var(--r); padding: 8px 11px; font-size: 12px;
  white-space: nowrap; box-shadow: 0 10px 24px -10px rgba(0,0,0,.5); transition: opacity .1s; z-index: 5;
}
.tip .t-d { font-family: var(--f-mono); font-size: 10.5px; color: #8FA2BC; letter-spacing: .04em; }
.tip .t-v { font-family: var(--f-mono); font-size: 14px; font-weight: 600; margin-top: 2px; }
.tip .t-c { font-family: var(--f-mono); font-size: 11px; margin-top: 1px; }
.tip .t-c.up { color: #FF8A8E; } .tip .t-c.dn { color: #4FD1A0; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 16px; height: 2px; border-radius: 2px; margin-right: 7px; vertical-align: 3px; }

/* ---------- table ---------- */
/* 表格横向滚动容器：自己不再被内容撑开，宽表格在容器内滚，不牵连整页 */
.tbl-scroll { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; }
table.dt { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.dt th {
  font-family: var(--f-body); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--text-3); font-weight: 600; text-align: right; padding: 11px 14px;
  border-bottom: 1px solid var(--border-strong); white-space: nowrap; background: var(--surface);
  position: sticky; top: 0; z-index: 2;
}
table.dt th:first-child, table.dt td:first-child { text-align: left; padding-left: 20px; }
table.dt th:last-child, table.dt td:last-child { padding-right: 20px; }
table.dt th.sortable { cursor: pointer; user-select: none; }
table.dt th.sortable:hover { color: var(--text); }
table.dt th.sortable .ind { opacity: .35; margin-left: 4px; font-size: 9px; }
table.dt th.sorted .ind { opacity: 1; color: var(--blue); }
table.dt td {
  padding: 11px 14px; border-bottom: 1px solid var(--border); text-align: right;
  font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap;
}
table.dt td.t { font-family: var(--f-body); }
table.dt tbody tr { transition: background .12s; }
table.dt tbody tr:hover { background: var(--surface-2); }
table.dt tbody tr:last-child td { border-bottom: 0; }
/* 深链选中的行（?bond=CUSIP 进来的那只） */
table.dt tbody tr.sel { background: var(--blue-soft); }
table.dt tbody tr.sel td:first-child { box-shadow: inset 3px 0 0 var(--blue); }
table.dt tfoot td { border-top: 1px solid var(--border-strong); font-weight: 600; color: var(--text); background: var(--surface-2); }
table.dt td.w { white-space: normal; text-align: left; font-family: var(--f-body); font-size: 13.5px; line-height: 1.6; color: var(--text-2); }
.issuer-cell { display: flex; flex-direction: column; gap: 1px; }
.issuer-cell b { font-family: var(--f-body); font-weight: 600; font-size: 13.5px; }
.issuer-cell span { font-family: var(--f-mono); font-size: 11px; color: var(--text-3); }
.up { color: var(--danger); } .dn { color: var(--success); } .flat { color: var(--text-3); }

/* ---------- badges ---------- */
.bd {
  display: inline-flex; align-items: center; gap: 5px; font-family: var(--f-mono);
  font-size: 10.5px; letter-spacing: .03em; padding: 2px 7px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); white-space: nowrap;
}
.bd.ig  { background: var(--blue-soft); border-color: #CBE2FF; color: var(--blue-ink); }
.bd.hy  { background: var(--amber-soft); border-color: #F0DFB8; color: #7A5604; }
.bd.sec { background: var(--success-soft); border-color: #C7EBDC; color: #0C6E4C; }
.bd.v   { background: var(--surface-3); border-color: var(--border-strong); color: var(--text-2); }
.bd.free{ background: var(--blue-soft); border-color: #CBE2FF; color: var(--blue-ink); }

/* ---------- recalc textarea ---------- */
.recalc-ta {
  width: 100%; min-height: 224px; resize: vertical; display: block;
  font-family: var(--f-mono); font-size: 12px; line-height: 1.75;
  padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface-2); color: var(--text); outline: none;
}
.recalc-ta:focus { border-color: var(--blue); background: var(--surface); }

/* ---------- generic grid ---------- */
.g2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.g3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.g4 { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }

/* 栅格/弹性子项的下限归零。
   默认值是 min-width:auto —— 子项最小宽度 = 内容 min-content。
   只要子项里有一张宽表格或一长串不可断字符，整条轨道就会被撑破，
   页面出现横向滚动条（手机上最明显）。统一兜底，避免逐处救火。 */
.g2 > *, .g3 > *, .g4 > *, .cards > *, .hero-grid > *,
.sub-grid > *, .faq-grid > *, .fgrid > *, .doc-grid > *, .doc-grid2 > * { min-width: 0; }
.panel-head > *, .panel-body > * { min-width: 0; }
.seg, .legend, .banner .wrap > * { min-width: 0; }

/* ---------- stat block ---------- */
.stat { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 16px 18px; }
.stat .k { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); }
.stat .v { font-family: var(--f-mono); font-size: 25px; font-weight: 600; letter-spacing: -.03em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12px; color: var(--text-2); }

/* ---------- feature / list ---------- */
.feat { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 22px; }
.feat .n { font-family: var(--f-mono); font-size: 11px; color: var(--blue); letter-spacing: .1em; }
.feat h4 { font-size: 16px; margin: 10px 0 8px; }
.feat p { margin: 0; font-size: 13.5px; color: var(--text-2); }

.notes { border-left: 2px solid var(--border-strong); }
.note { padding: 0 0 20px 20px; position: relative; }
.note:last-child { padding-bottom: 0; }
.note::before {
  content: ''; position: absolute; left: -5px; top: 7px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--blue);
}
.note .d { font-family: var(--f-mono); font-size: 11px; color: var(--text-3); letter-spacing: .04em; }
.note h5 { font-size: 14.5px; margin: 4px 0 5px; font-weight: 600; font-family: var(--f-display); }
.note p { margin: 0; font-size: 13.5px; color: var(--text-2); }

/* ---------- code ---------- */
.code {
  background: var(--ink); color: #D7E1F0; border-radius: var(--r-md); padding: 16px 18px;
  font-family: var(--f-mono); font-size: 12.5px; line-height: 1.75; overflow-x: auto;
}
.code .c { color: #6E829F; }
.code .k { color: #7FB4FF; }
.code .s { color: #9BE0B4; }
.code .n { color: #FFC98B; }
.code-wrap { position: relative; }
.copy {
  position: absolute; top: 10px; right: 10px; font-family: var(--f-mono); font-size: 11px;
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.16); color: #C7D4E6;
  padding: 4px 10px; border-radius: var(--r-sm); cursor: pointer; transition: .15s;
}
.copy:hover { background: rgba(255,255,255,.18); color: #fff; }

.endpoint { display: flex; align-items: center; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--border); }
.endpoint:last-child { border-bottom: 0; }
.meth {
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  padding: 3px 8px; border-radius: var(--r-sm); background: var(--blue-soft); color: var(--blue-ink);
  border: 1px solid #CBE2FF; min-width: 46px; text-align: center;
}
.path { font-family: var(--f-mono); font-size: 13px; color: var(--text); }
.endpoint .desc { font-size: 12.5px; color: var(--text-3); margin-left: auto; text-align: right; }

/* ---------- pricing ---------- */
.plan { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); padding: 26px; display: flex; flex-direction: column; position: relative; }
.plan.hi { border-color: var(--blue); box-shadow: var(--sh-lg); }
.plan.hi::after {
  content: 'Recommended'; position: absolute; top: -10px; left: 26px;
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  background: var(--blue); color: #fff; padding: 3px 10px; border-radius: 10px;
}
.plan h4 { font-size: 17px; }
.plan .price { font-family: var(--f-mono); font-size: 34px; font-weight: 600; letter-spacing: -.04em; margin: 14px 0 2px; }
.plan .price small { font-size: 13px; color: var(--text-3); font-weight: 400; letter-spacing: 0; }
.plan .who { font-size: 12.5px; color: var(--text-3); margin-bottom: 18px; }
.plan ul { list-style: none; margin: 0 0 22px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plan li { font-size: 13.5px; color: var(--text-2); padding-left: 24px; position: relative; }
.plan li::before {
  content: ''; position: absolute; left: 0; top: 7px; width: 13px; height: 8px;
  border-left: 2px solid var(--blue); border-bottom: 2px solid var(--blue);
  transform: rotate(-45deg) scale(.85); transform-origin: center;
}
.plan .btn { margin-top: auto; }
.btn {
  display: inline-block; text-align: center; font-size: 14px; font-weight: 600; padding: 11px 20px;
  border-radius: var(--r); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  transition: .16s;
}
.btn:hover { border-color: var(--text-3); }
.btn.pri { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 4px 14px -6px rgba(21,126,254,.7); }
.btn.pri:hover { background: var(--blue-deep); border-color: var(--blue-deep); }
.btn.sm { font-size: 12.5px; padding: 7px 14px; }

/* ---------- methodology ---------- */
.mdoc { max-width: 820px; }
.mdoc h3 { font-size: 19px; margin: 40px 0 12px; padding-top: 22px; border-top: 1px solid var(--border); }
.mdoc h3:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.mdoc h3 .no { font-family: var(--f-mono); font-size: 12px; color: var(--blue); margin-right: 10px; letter-spacing: .06em; }
.mdoc p { color: var(--text-2); font-size: 14.5px; }
.mdoc ul { color: var(--text-2); font-size: 14.5px; padding-left: 20px; }
.mdoc li { margin-bottom: 7px; }
.formula {
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid var(--blue);
  border-radius: var(--r); padding: 15px 18px; font-family: var(--f-mono); font-size: 13px;
  line-height: 1.9; margin: 14px 0; overflow-x: auto; color: var(--text);
}
.formula .v { color: var(--blue-ink); font-weight: 500; }
.callout {
  border: 1px solid #F0DFB8; background: var(--amber-soft); border-radius: var(--r-md);
  padding: 15px 18px; font-size: 13.5px; color: #6E4E03; margin: 18px 0;
}
.callout.red { border-color: #F6CDCD; background: var(--danger-soft); color: #8E2528; }
.callout b { font-weight: 600; }
.toc { position: sticky; top: calc(var(--nav-h) + 18px); font-size: 13px; }
.toc .t { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.toc a { display: block; padding: 5px 0 5px 13px; border-left: 2px solid var(--border); color: var(--text-2); }
.toc a:hover { border-left-color: var(--blue); color: var(--blue-deep); }

/* ---------- footer ---------- */
.foot { background: var(--ink); color: #93A5BF; padding: 52px 0 30px; margin-top: 20px; font-size: 13px; }
.foot h5 { color: #fff; font-size: 12px; font-family: var(--f-mono); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 14px; font-weight: 500; }
.foot a { color: #B9C8DC; font-size: 13px; }
.foot a:hover { color: #fff; }
.foot ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fgrid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 36px; }
.fbot { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-top: 40px; padding-top: 22px; border-top: 1px solid #1B2A45; font-size: 12px; color: #6E829F; }
.foot .disc { font-size: 12px; color: #6E829F; max-width: 74ch; line-height: 1.7; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .hero-grid { grid-template-columns: minmax(0,1fr); gap: 30px; }
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .fgrid { grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
}
/* 导航断点单独一档：品牌名比初版长（SpreadBench 12 字符 vs 初版 NCSX 4 字符），
   860–1000px 区间会把链接挤成竖排两行，所以这一档提前收成汉堡菜单。
   改品牌名后必须重跑导航宽度实测（_layout_probe.html），别只看 CSS。
   与 assets/js/app.js 的 resize 复位逻辑保持一致。 */
@media (max-width: 1000px) {
  .nav .wrap { gap: 12px; }
  .nav-menu-btn { display: inline-flex; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--sh-md); flex-direction: column; align-items: stretch;
    gap: 2px; padding: 10px 18px 14px; margin-left: 0;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 10px; font-size: 14.5px; white-space: nowrap; }
  .nav-links .nav-cta { text-align: center; margin-top: 6px; }
  .nav-asof { display: none; }
}

/* 注意：这里所有单列轨道都必须写成 minmax(0,1fr) 而不是 1fr。
   1fr == minmax(auto,1fr)，轨道下限取内容的 min-content：
   宽表格 / 长代码串会把栅格顶宽，造成整页横向滚动（390px 下实测溢出 172px）。 */
@media (max-width: 860px) {
  .cards, .g3 { grid-template-columns: minmax(0,1fr); }
  .g2 { grid-template-columns: minmax(0,1fr); }
  .doc-grid { grid-template-columns: minmax(0,1fr) !important; }
  .doc-grid2 { grid-template-columns: minmax(0,1fr) !important; }
  .toc { display: none; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 18px; }
  .g4 { grid-template-columns: minmax(0,1fr); }
  .primary-val .big { font-size: 42px; }
  .hero { padding: 40px 0 30px; }
  .sec { padding: 44px 0; }
  .fgrid { grid-template-columns: minmax(0,1fr); gap: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  .tape-track { animation: none; }
  * { transition: none !important; }
}

/* ---------- 订阅块（周报 RSS / JSON Feed / 邮件） ---------- */
.sub-grid { display: grid; grid-template-columns: 1.02fr .98fr; gap: 16px; }
.feed-list { display: flex; flex-direction: column; gap: 10px; }
.feed-btn {
  display: flex; align-items: center; gap: 13px; padding: 13px 15px;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--surface);
  text-decoration: none; color: inherit; transition: border-color .16s, background .16s, transform .16s;
}
.feed-btn:hover { border-color: var(--blue); background: var(--blue-soft); transform: translateY(-1px); }
.feed-ico {
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none;
  font-family: var(--f-mono); font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.feed-ico.rss { background: #FFF3EC; color: #D9611F; border: 1px solid #F8DCCB; }
.feed-ico.json { background: var(--blue-soft); color: var(--blue-deep); border: 1px solid #CFE2FB; }
.feed-btn .fb-txt { min-width: 0; }
.feed-btn .fb-txt b { display: block; font-size: 13.5px; font-weight: 600; color: var(--text); }
.feed-btn .fb-txt span {
  display: block; font-family: var(--f-mono); font-size: 11.5px; color: var(--text-3);
  margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.feed-btn .fb-go { margin-left: auto; color: var(--text-3); font-size: 15px; flex: none; }

.field { display: flex; gap: 9px; flex-wrap: wrap; }
.field input {
  flex: 1 1 200px; min-width: 0; padding: 9px 13px; border: 1px solid var(--border-strong);
  border-radius: var(--r); font-size: 13.5px; font-family: var(--f-body);
  background: var(--surface); color: var(--text); transition: border-color .16s, box-shadow .16s;
}
.field input::placeholder { color: var(--text-3); }
.field input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,126,254,.12); }
.field input.bad { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(229,72,77,.10); }

.sub-live {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 13px; border-top: 1px dashed var(--border);
  font-family: var(--f-mono); font-size: 11.5px; color: var(--text-3);
}
.sub-live b { color: var(--text-2); font-weight: 500; }

@media (max-width: 860px) {
  .sub-grid { grid-template-columns: minmax(0,1fr); }
}

/* 订阅块：每期包含清单 */
.sub-what { margin: 16px 0 0; padding: 14px 0 0; border-top: 1px dashed var(--border); list-style: none; }
.sub-what li {
  position: relative; padding-left: 17px; font-size: 12.5px; line-height: 1.7;
  color: var(--text-2); margin-bottom: 7px;
}
.sub-what li:last-child { margin-bottom: 0; }
.sub-what li::before {
  content: ''; position: absolute; left: 3px; top: 8px; width: 4px; height: 4px;
  border-radius: 50%; background: var(--blue);
}

/* ---------- FAQ 区块 ---------- */
.faq-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.faq-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 18px 20px;
}
.faq-item h4 {
  font-family: var(--f-display); font-size: 14.5px; font-weight: 500;
  color: var(--text); margin: 0 0 8px; letter-spacing: -.01em;
  display: flex; align-items: flex-start; gap: 8px;
}
.faq-item h4::before {
  content: 'Q'; flex: none; margin-top: 2px;
  width: 18px; height: 18px; border-radius: 3px;
  background: var(--blue-soft); color: var(--blue-deep);
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 600;
  display: grid; place-items: center;
}
.faq-item p { font-size: 13px; line-height: 1.78; color: var(--text-2); margin: 0; }

@media (max-width: 860px) {
  .faq-grid { grid-template-columns: minmax(0,1fr); }
}

/* ---------- 嵌入说明页（embed.html） ---------- */
.emb-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
@media (max-width: 1080px) { .emb-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 760px)  { .emb-grid { grid-template-columns: minmax(0,1fr); } }
.emb-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px; box-shadow: var(--sh-sm);
}
.emb-item > .k {
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .09em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 12px;
}
.emb-item img { display: block; max-width: 100%; height: auto; }
.emb-dark { background: #0A1424; padding: 14px; border-radius: var(--r-md); }
.emb-path {
  font-family: var(--f-mono); font-size: 10.5px; color: var(--text-3);
  margin-top: 12px; overflow-wrap: anywhere; word-break: break-all;
}
.emb-note { font-size: 12px; color: var(--text-3); margin: 12px 0 0; line-height: 1.7; }
