/* BusinessSIM — brand kit Identity 1.1: midnight / cobalt / cloud / amber, Manrope + Noto.
   Amber is a fill only on light backgrounds (1.64:1 on cloud), never text: amber-themed text uses --amber-ink. */
:root {
  --midnight: #11183b; --cobalt: #3156e8; --cloud: #f5f7fc; --amber: #f7b84b; --surface: #1a234b; --mist: #e7ebff; --slate: #526081;
  --bg: var(--cloud); --bg2: #ffffff; --panel: #ffffff; --panel2: #eef1fd; --line: #dde2f1; --line2: #c5cce4;
  --text: var(--midnight); --muted: var(--slate); --faint: #6f7b99;
  --accent: var(--cobalt); --accent2: #2443c4; --on-accent: #fff; --action: var(--cobalt); --action2: #2443c4;
  --amber-ink: var(--midnight); --series2: var(--midnight);
  --teal: var(--cobalt); --yellow: var(--amber); --green: #1d7a4c; --red: #c0392b; --blue: var(--cobalt);
  --pos: #1d7a4c; --neg: #c0392b;
  --latin: "Manrope", -apple-system, "Segoe UI", system-ui, sans-serif;
  --sans: "Manrope", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", -apple-system, "Segoe UI", system-ui, sans-serif;
  --serif: var(--sans);
  --mono: var(--sans);
  --code: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --r: 8px;
  color-scheme: light;
}
/* Simplified Chinese uses its own SC family; English display is Manrope Bold. */
:root[lang="zh-Hans"] { --sans: "Manrope", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, system-ui, sans-serif; --serif: "Manrope", "Noto Sans SC", "PingFang SC", sans-serif; }
:root[lang="en"] { --serif: var(--latin); }
:root[data-theme="dark"] {
  --bg: var(--midnight); --bg2: #0d1330; --panel: var(--surface); --panel2: #222c5a; --line: #2b3666; --line2: #3a4679;
  --text: var(--cloud); --muted: #aab4d4; --faint: #8390b5;
  --accent: #8fa5ff; --accent2: #b4c3ff; --on-accent: #fff; --action: var(--cobalt); --action2: #4468f0;
  --amber-ink: var(--amber); --series2: var(--amber);
  --teal: #8fa5ff; --yellow: var(--amber); --green: #6cc28f; --red: #ff8a80; --blue: #8fa5ff;
  --pos: #6cc28f; --neg: #ff8a80;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.6 var(--sans); min-height: 100vh; }
/* financial figures line up: tabular numerals wherever numbers are compared */
table, .kv, .mono, .n, .fact .v, .stepper output, .bars, .hbar, svg.chart text, .price, .age, .rank, .score, input[type="number"], .r { font-variant-numeric: tabular-nums; }
a { color: var(--teal); }
a:hover { color: var(--accent2); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(30px, 4.6vw, 50px); }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0 0 .8em; }
code { font-family: var(--code); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.accent { color: var(--accent); } .teal { color: var(--teal); }
.err { color: var(--neg); min-height: 1em; }
.hide { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- shell */
.top {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; padding: 2px 20px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
/* horizontal logo: >=160 CSS px wide, clear space >= 1/4 of its height, never stretched or recoloured */
.brand { display: inline-flex; align-items: center; padding: 9px 0; flex: none; line-height: 0; }
.brand img { width: 168px; height: auto; display: block; }
.brand .logo-dark { display: none; }
:root[data-theme="dark"] .brand .logo-light { display: none; }
:root[data-theme="dark"] .brand .logo-dark { display: block; }
.nav { display: flex; gap: 2px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.nav a:hover, .nav a.on { color: var(--text); background: var(--panel2); }
.nav a[hidden] { display: none !important; }
.tools { display: flex; gap: 6px; align-items: center; }
.pill { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--panel); }
.pill button { border: 0; background: none; color: var(--muted); padding: 5px 11px; font-size: 13px; border-radius: 0; min-height: 0; }
.pill button.on { background: var(--text); color: var(--bg); }
.iconbtn { border: 1px solid var(--line); background: var(--panel); color: var(--text); width: 34px; height: 34px; border-radius: 999px; padding: 0; }
.menu-btn { display: none; }
.nav .m-more, .nav .m-langs { display: none; }
.banner { background: color-mix(in srgb, var(--yellow) 14%, var(--bg)); color: var(--text); border-bottom: 1px solid color-mix(in srgb, var(--yellow) 30%, transparent); font-size: 13px; padding: 6px 20px; text-align: center; }
.banner:empty { display: none; }
main { max-width: 1240px; margin: 0 auto; padding: 22px 20px 60px; }
main.wide { max-width: 1480px; }
@media (max-width: 860px) {
  .top { padding: 0 16px; gap: 8px; }
  .tools { margin-left: auto; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
  .top.open .menu-btn { background: var(--text); color: var(--bg); border-color: var(--text); }
  .tools .pill { display: none; }
  /* the menu drops down over the page, so the header (and the bars stuck under it) keep their height */
  .nav { display: none; }
  .top.open .nav {
    display: flex; flex-direction: column; gap: 0; position: absolute; top: 100%; left: 0; right: 0;
    padding: 4px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 28px rgb(0 0 0 / .14); max-height: calc(100dvh - var(--top-h, 56px)); overflow-y: auto;
  }
  .top.open .nav a, .nav .m-more button {
    display: block; width: 100%; text-align: left; padding: 13px 4px; min-height: 0; font-size: 16px; font-weight: 500;
    color: var(--text); background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  }
  .top.open .nav a.on { color: var(--accent2); font-weight: 700; background: none; }
  .top.open .nav .m-more { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; margin-top: 6px; }
  .top.open .nav .m-more a, .top.open .nav .m-more button { font-size: 14.5px; color: var(--muted); padding: 11px 4px; }
  .top.open .nav .m-more a.on { color: var(--accent2); font-weight: 700; }
  .top.open .nav .m-langs { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; font-size: 14.5px; color: var(--muted); }
  .m-langs .pill button { padding: 8px 18px; font-size: 15px; }
  main { padding: 16px 16px 90px; }
}

/* ---------------------------------------------------------------- controls */
button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 9px 16px; min-height: 40px;
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s, border-color .15s, transform .1s;
}
button:hover, .btn:hover { border-color: var(--muted); color: var(--text); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary, .btn.primary { background: var(--action); border-color: var(--action); color: var(--on-accent); }
button.primary:hover, .btn.primary:hover { background: var(--action2); border-color: var(--action2); color: var(--on-accent); }
button.big, .btn.big { font-size: 16px; padding: 11px 26px; min-height: 46px; font-weight: 700; }
button.ghost, .btn.ghost { background: transparent; }
button.outline-accent { background: transparent; border-color: var(--accent); color: var(--accent2); border-radius: 999px; }
button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
button.sm, .btn.sm { padding: 4px 10px; min-height: 30px; font-size: 13px; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%;
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--accent); }
label > span:first-child { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.grid.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.g3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .grid.g3 { grid-template-columns: 1fr; } }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid var(--line2); background: var(--panel); color: var(--muted); font-weight: 500; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.seg button.locked { color: var(--faint); }
.seg.stack button { flex-direction: column; gap: 0; padding: 6px 14px; min-height: 46px; }
.seg.stack button small { display: block; font-weight: 400; font-size: 11.5px; color: var(--muted); }
.seg.sm button { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.row.tight { gap: 6px; margin: 6px 0; }
.row.tight select { flex: 1; min-width: 0; }
/* collapsible side panels */
details.fold > summary { cursor: pointer; font-weight: 600; font-size: 15px; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; display: inline-block; margin-right: 7px; color: var(--muted); transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold[open] > summary { margin-bottom: 10px; }
details.after { margin-top: 14px; }
details.after > summary { cursor: pointer; color: var(--teal); font-weight: 600; }

/* ---------------------------------------------------------------- panels */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
/* decide tab: this month's estimated spending */
.est { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.est h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; }
.erows { display: grid; gap: 3px; font-size: 14px; }
.erows.res { margin-top: 10px; }
.er { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.er span { min-width: 0; }
.er small { color: var(--muted); font-size: 12px; margin-left: 6px; }
.er b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.er.tot { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 2px; }
.estats { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 6px; margin-top: 12px; }
.estats div { display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--bg2); min-width: 0; }
.estats span { font-size: 12px; color: var(--muted); }
.estats b { font-size: 14px; font-variant-numeric: tabular-nums; }
.estats b small { font-weight: 400; color: var(--muted); }
.estats b.warn { color: var(--amber); }
.card + .card { margin-top: 14px; }
.grid > .card + .card, .statgrid > .card + .card, .plans > .card + .card { margin-top: 0; }
.card.flat { background: transparent; }
.card.dashed { border-style: dashed; background: transparent; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.section { margin-top: 44px; padding-top: 28px; border-top: 1px solid var(--line); }
.section > h2 { font-size: 26px; }
.kicker { font-family: var(--sans); font-size: 12px; font-weight: 700; color: var(--teal); letter-spacing: .12em; text-transform: uppercase; }
:root[data-theme="dark"] .kicker { color: var(--amber); }
.tag { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); vertical-align: middle; font-family: var(--sans); }
.tag.accent { border-color: var(--accent); color: var(--accent2); }
.tag.teal { border-color: var(--teal); color: var(--teal); }
.tag.red { border-color: var(--red); color: var(--red); }
.tag.green { border-color: var(--green); color: var(--green); }
.tag.warn { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber-ink); }
.tag.lock::before { content: "🔒 "; }
.callout { border-left: 3px solid var(--teal); background: color-mix(in srgb, var(--teal) 9%, transparent); padding: 12px 14px; border-radius: 0 8px 8px 0; }
.callout.warn { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, transparent); }
.callout.accent { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.empty { color: var(--muted); font-size: 14px; padding: 18px; text-align: center; border: 1px dashed var(--line2); border-radius: var(--r); }

/* ---------------------------------------------------------------- tables */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: top; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; }
td.l, th.l { text-align: left; }
tr.you td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.scroll { overflow-x: auto; }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; font-size: 14px; }
.kv > :nth-child(odd) { color: var(--muted); }
.kv > :nth-child(even) { font-family: var(--mono); text-align: right; }

/* ---------------------------------------------------------------- home */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 44px; align-items: center; padding: 30px 0 8px; }
.hero h1 { margin: 8px 0 14px; font-weight: 700; }
.hero h1 b { color: var(--accent); font-weight: 700; }
:root[data-theme="dark"] .hero h1 b { color: var(--amber); }
.hero .lead { font-size: 16.5px; max-width: 540px; color: var(--muted); }
.card.start h3 { margin-bottom: 10px; }
.card.start .seg { margin-bottom: 10px; }
.facts2 { display: grid; margin: 10px 0; }
.facts2 > div { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.facts2 > div:last-child { border-bottom: 0; }
.facts2 dt { color: var(--muted); }
.facts2 dd { margin: 0; font-weight: 600; text-align: right; }
.strip { margin-top: 18px; }
.strip .stat.card { padding: 14px 16px; }
.ticker { min-height: 1.6em; margin: 12px 0 0; }
.ticker b { color: var(--text); font-weight: 600; }
.cta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 14px 0 6px; }
.sources .card h3 { font-size: 15px; }
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; gap: 20px; padding-top: 10px; } }

/* landing visuals: hero scene, icon tiles, how-it-works steps, closing banner (decorative, theme-token colours only) */
.hero { grid-template-areas: "text card" "art card"; grid-template-rows: auto auto; row-gap: 26px; }
.hero-text { grid-area: text; align-self: end; }
.hero .card.start { grid-area: card; }
.hero-art { grid-area: art; align-self: start; }
.ill { display: block; width: 100%; height: auto; max-width: 520px; }
@media (max-width: 860px) { .hero { grid-template-areas: "text" "card" "art"; row-gap: 20px; } .hero-text { align-self: auto; } .ill { max-width: 520px; margin: 0 auto; } }
.ico { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico .f { fill: currentColor; stroke: none; }
.ico .a { fill: var(--amber); stroke: currentColor; stroke-width: 1.5; }
.ico .k { fill: var(--panel2); }
.ico-tile { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--panel2); color: var(--accent); flex: none; }
:root[data-theme="dark"] .ico-tile { background: var(--bg2); }
.stat.has-ico { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }
.stat.has-ico .ico-tile { grid-row: 1 / span 2; width: 44px; height: 44px; }
.stat.has-ico .n, .stat.has-ico .l { grid-column: 2; }
.sources .card .ico-tile { margin-bottom: 12px; }
@media (max-width: 560px) {
  .statgrid.strip { grid-template-columns: 1fr 1fr; gap: 10px; }
  .strip .stat.card.has-ico { padding: 10px 12px; column-gap: 10px; }
  .strip .ico-tile { width: 36px; height: 36px; border-radius: 10px; }
  .strip .ico { width: 22px; height: 22px; }
  .strip .stat .n { font-size: 22px; }
}
.steps { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(4, 1fr); }
.steps > .card + .card { margin-top: 0; }
.step { position: relative; padding-top: 20px; }
.step .ico-tile { width: 52px; height: 52px; margin-bottom: 14px; }
.step .no { position: absolute; top: 14px; right: 16px; font-size: 13px; font-weight: 700; color: var(--accent2); background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 999px; min-width: 26px; height: 26px; display: grid; place-items: center; }
.step h3 { font-size: 16px; margin-bottom: 6px; }
.step p { margin: 0; color: var(--muted); }
@media (max-width: 1000px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) {
  .steps { grid-template-columns: 1fr; gap: 10px; }
  .step { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; padding: 14px 44px 14px 14px; }
  .step .ico-tile { grid-row: 1 / span 2; width: 44px; height: 44px; margin: 0; }
  .step h3, .step p { grid-column: 2; }
}
.band { margin-top: 44px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 34px 40px; border-radius: 18px; color: var(--mist); overflow: hidden;
  background: radial-gradient(520px 260px at 88% 50%, color-mix(in srgb, var(--cobalt) 55%, transparent), transparent 70%), var(--midnight); }
:root[data-theme="dark"] .band { background: radial-gradient(520px 260px at 88% 50%, color-mix(in srgb, var(--cobalt) 55%, transparent), transparent 70%), var(--surface); border: 1px solid var(--line); }
.band h2 { color: #fff; font-size: 30px; margin-bottom: 8px; }
.band p { margin: 0 0 20px; font-size: 16px; color: var(--mist); max-width: 460px; }
.band button.primary { background: var(--amber); border-color: var(--amber); color: var(--midnight); }
.band button.primary:hover { background: #ffc765; border-color: #ffc765; color: var(--midnight); }
.ill-branch { width: 240px; height: auto; flex: none; }
@media (max-width: 700px) { .band { padding: 24px 20px; } .band h2 { font-size: 24px; } .ill-branch { display: none; } .band button { width: 100%; } }
.sticky-cta { display: none; }
@media (max-width: 760px) {
  .sticky-cta { display: block; position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px; background: var(--bg); border-top: 1px solid var(--line); z-index: 25; }
  .sticky-cta button { width: 100%; }
}
.cards { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ccard { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: var(--r); overflow: hidden; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.ccard:hover { border-color: var(--line2); color: var(--text); }
.ccard .b { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.ccard .t { font-family: var(--serif); font-weight: 700; font-size: 16px; line-height: 1.3; }
.ccard .s { font-size: 12.5px; color: var(--muted); }
.ccard .e { font-size: 13px; font-weight: 600; }
.ccard .f { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 8px; gap: 8px; }
.likebtn { border-radius: 999px; padding: 3px 12px; min-height: 30px; font-size: 13px; border-color: var(--accent); color: var(--accent2); background: transparent; font-weight: 500; }
.likebtn.on { background: var(--action); border-color: var(--action); color: var(--on-accent); }
.explain3 { display: grid; gap: 22px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 760px) { .explain3 { grid-template-columns: 1fr; } }
.explain3 h3 { font-family: var(--sans); font-size: 14px; }
.explain3 p { font-size: 13.5px; color: var(--muted); }

/* ---------------------------------------------------------------- company profile (reveal) */
.profile { max-width: 760px; margin: 0 auto; padding: 24px 28px; }
.profile .co-name { font-size: clamp(24px, 4vw, 32px); margin: 10px 0 2px; }
.profile .co-alt { font-size: 15px; min-height: 1.4em; }
.profile .story { margin: 14px 0 12px; }
.profile .facts2 { border-top: 1px solid var(--line); margin-top: 6px; }
.mapbox { margin: 16px 0 6px; position: relative; max-width: 520px; }
.mapbox svg { width: 100%; height: auto; display: block; }
.mapbox .cap { font-size: 12px; color: var(--muted); }
.cmp { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-top: 14px; }
.cmp table td, .cmp table th { border: 0; padding: 4px 6px; }
.cohort-list { display: grid; gap: 0; }
.cohort-list > div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.cohort-list > div:last-child { border-bottom: 0; }
.cohort-list .nm { font-weight: 700; }
/* built-in prediction models: a plain line each, the year-by-year numbers on tap */
details.model { border-bottom: 1px solid var(--line); padding: 10px 0; }
details.model:last-child { border-bottom: 0; }
details.model > summary { cursor: pointer; list-style: none; display: grid; gap: 3px; }
details.model > summary::-webkit-details-marker { display: none; }
details.model > summary .nm { font-weight: 700; font-size: 15px; }
details.model > summary .nm::after { content: "▸"; margin-left: 7px; color: var(--muted); display: inline-block; transition: transform .15s; }
details.model[open] > summary .nm::after { transform: rotate(90deg); }
table.mdl { width: 100%; border-collapse: collapse; margin: 10px 0 6px; font-size: 13.5px; }
table.mdl th, table.mdl td { text-align: left; padding: 6px 8px 6px 0; border-top: 1px solid var(--line); vertical-align: top; font-weight: 400; }
table.mdl th { color: var(--muted); width: 46%; }
table.mdl tr.diff th, table.mdl tr.diff td { font-weight: 700; color: var(--text); }
table.mdl .nw { white-space: nowrap; }
.reveal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- dashboard */
.dash-top { position: sticky; top: 55px; z-index: 20; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 14px; display: grid; grid-template-columns: minmax(140px, 220px) minmax(160px, 1fr) auto; gap: 16px; align-items: center; margin-bottom: 12px; }
.dash-top .co { display: flex; flex-direction: column; min-width: 0; }
.dash-top .co b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { height: 5px; background: var(--line); border-radius: 9px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.speed { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.speed .grp { display: inline-flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.speed .grp + .grp { padding-left: 14px; border-left: 1px solid var(--line); }
.speed button, .speed .btn { min-height: 32px; padding: 4px 10px; font-size: 13px; font-weight: 500; }
.speed .grp .muted { margin-right: 4px; }
@media (max-width: 1100px) { .dash-top { grid-template-columns: 1fr 1fr; } .speed { grid-column: 1 / -1; justify-content: flex-start; } }
/* phones: one compact header (month, name, controls, four short figures) stays under the top bar on every tab */
@media (min-width: 761px) { .m-show { display: none !important; } }
@media (max-width: 760px) {
  .m-hide { display: none !important; }
  .dash-top { display: flex; flex-direction: column; align-items: stretch; gap: 6px; top: var(--top-h, 52px); margin: -16px -16px 10px; padding: 8px 16px; border-width: 0 0 1px; border-radius: 0; }
  .mhead { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
  .mhead .mm { white-space: nowrap; line-height: 1; }
  .mhead .mm b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
  .mhead .mm small { font-size: 12px; color: var(--muted); margin-left: 2px; }
  .mmeta { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
  .mmeta b, .mmeta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mmeta b { font-size: 14.5px; }
  .mmeta span { font-size: 12px; color: var(--muted); }
  .dash-top .progress { margin-top: 0; height: 4px; }
  .speed { gap: 8px; flex-wrap: nowrap; justify-content: space-between; }
  .speed .grp { flex-wrap: nowrap; }
  .speed .grp + .grp { border-left: 0; padding-left: 0; }
  .speed button { min-height: 32px; min-width: 32px; padding: 4px 7px; }
  .mstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
  .mstats > div { min-width: 0; }
  .mstats .l { display: block; font-size: 11px; line-height: 1.25; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mstats b { display: block; font-size: 13.5px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
  .mstats .bar { height: 3px; margin-top: 2px; }
}
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 14px; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 20px; font-weight: 700; line-height: 1.35; }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.work { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 12px; align-items: start; }
.work .main > .card + .card, .work .side > .card + .card { margin-top: 12px; }
@media (max-width: 1000px) { .work { grid-template-columns: minmax(0, 1fr); } }
.dash { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 14px; align-items: start; }
@media (max-width: 1180px) { .dash { grid-template-columns: 280px minmax(0, 1fr); } .dash .right { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; } .dash .right > .card + .card { margin-top: 0; } }
@media (max-width: 760px) { .dash { grid-template-columns: 1fr; } }
.dash.two { grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1180px) { .dash.two { grid-template-columns: 1fr; } }
.bars > div { margin-bottom: 10px; }
.bars .bl { display: flex; justify-content: space-between; font-size: 13.5px; }
.bar { height: 6px; background: var(--line); border-radius: 9px; overflow: hidden; margin-top: 3px; }
.bar > i { display: block; height: 100%; border-radius: 9px; transition: width .5s; }
.focus h3 { display: flex; justify-content: space-between; align-items: baseline; }
.choice { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.choice > div { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.choice h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.choice .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.choice label.check { margin-bottom: 4px; }
.info { display: none; }
@media (max-width: 760px) {
  .choice { display: block; }
  .choice > div { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 10px 0; }
  .choice > div:first-child { padding-top: 0; }
  .choice > div:last-child { border-bottom: 0; }
  .ch { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .ch + .ch, .choice label.check + .ch, .loan-opts + .ch { margin-top: 8px; }
  .ch h4, .choice h4 { margin: 0; font-size: 14.5px; color: var(--text); }
  .ch h4 { flex: 0 0 auto; white-space: nowrap; }
  .choice > div > h4 { margin-bottom: 6px; }
  .ch select, .ch input[type="number"] { width: auto; min-width: 0; max-width: 64%; min-height: 36px; padding: 5px 8px; font-size: 14px; }
  .ch input[type="number"] { width: 120px; }
  .choice .hint { margin-top: 4px; }
  .info {
    display: inline-flex; width: 22px; height: 22px; min-height: 0; padding: 0; margin-left: 6px; vertical-align: 1px; border-radius: 999px;
    border: 1px solid var(--line2); background: none; color: var(--muted); font: italic 700 12px/1 Georgia, serif;
  }
  .open > h4 .info, .open > .ch h4 .info { color: var(--accent); border-color: var(--accent); }
  .runpage [data-fold]:not(.open) .more { display: none; }
  .bank:not(.loan-on) .loan-opts { display: none; }
  .loan-opts .row { margin-top: 4px; }
  .offers, .acts { margin-top: 10px; }
  .acts h4, .offers h4 { font-size: 14.5px; }
  .offer-list { gap: 8px; }
  .offer.act { padding: 8px 10px; gap: 8px; }
  .offer.act > span { flex: 1; min-width: 0; gap: 1px; }
  .offer .ah { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
  .offer .ah .c { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
  .offer .ah .c small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
  .offer .eff { color: var(--muted); }
  #act-s { margin: 0 0 8px; }
  .acts:not(.all) .offer.extra { display: none; }
  #act-more { margin-top: 8px; width: 100%; color: var(--accent); }
}
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { width: 36px; padding: 0; }
.stepper output { font-size: 18px; min-width: 2ch; text-align: center; }
.switch { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.advance-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.advance-row + label.check { margin-top: 8px; }
.offers, .acts { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.offers h4, .acts h4 { margin: 0 0 2px; font-size: 13.5px; font-weight: 700; }
.offers .hint, .acts .hint { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.offer-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.offer { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line2); border-left: 3px solid var(--accent); border-radius: 8px; padding: 10px 12px; background: var(--panel); cursor: pointer; }
.offer input { margin-top: 3px; flex: none; width: auto; min-height: 0; }
.offer > span { display: flex; flex-direction: column; gap: 3px; }
.offer.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.adv-note { margin: 14px 0 6px; }
.log { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: auto; }
.log li { padding: 9px 0 9px 64px; border-bottom: 1px solid var(--line); position: relative; font-size: 14px; }
.log li .m { position: absolute; left: 0; top: 9px; font-size: 12.5px; color: var(--muted); width: 58px; }
.log li.ev { background: color-mix(in srgb, var(--amber) 12%, transparent); }
.log li.bad { color: var(--neg); }
.log li.note { color: var(--teal); }
.log li .sub { display: block; font-size: 12.5px; color: var(--muted); }
.log li .sv { margin-top: 6px; font-size: 13px; }
.log li .sv div { padding-left: 12px; position: relative; margin-top: 3px; }
.log li .sv div::before { content: "·"; position: absolute; left: 2px; }
.mgrid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
/* run page on phones: a bottom tab bar shows one group of panels at a time; wide screens keep the two columns */
.tabbar, .m-only { display: none; }
.acts .switch { margin: 6px 0 4px; font-weight: 600; font-size: 13.5px; }
.acts .switch input { width: auto; min-height: 0; }
@media (max-width: 760px) {
  body.has-tabbar #toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.has-tabbar .foot { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .m-only { display: block; }
  .m-only .row { display: flex; flex-wrap: wrap; gap: 8px; }
  .dash-top .grp.desk { display: none; }
  .runpage [data-tab] { display: none; }
  .runpage[data-show="sum"] [data-tab="sum"], .runpage[data-show="dec"] [data-tab="dec"],
  .runpage[data-show="log"] [data-tab="log"], .runpage[data-show="more"] [data-tab="more"] { display: block; }
  .runpage[data-show="sum"] .kpis[data-tab="sum"] { display: grid; }
  .runpage .work .main, .runpage .work .side { display: flex; flex-direction: column; gap: 12px; }
  .runpage .work .main > .card + .card, .runpage .work .side > .card + .card { margin-top: 0; }
  .runpage .log { max-height: none; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: end; gap: 2px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgba(17, 24, 59, .08);
  }
  .tabbar button {
    position: relative; flex-direction: column; gap: 2px; min-height: 54px; padding: 5px 2px; border: 0; border-radius: 14px;
    background: none; color: var(--muted); font-size: 11.5px; font-weight: 600; line-height: 1.2;
  }
  .tabbar button:active { transform: none; }
  .tabbar button svg { width: 22px; height: 22px; flex: none; }
  .tabbar button.on { color: var(--accent); background: var(--panel2); }
  .tabbar .tb-play { color: var(--text); }
  .tabbar .tb-play .disc {
    width: 58px; height: 58px; margin-top: -30px; border-radius: 999px; display: grid; place-items: center;
    background: var(--action); color: var(--on-accent); border: 4px solid var(--panel);
    box-shadow: 0 6px 16px color-mix(in srgb, var(--action) 40%, transparent);
  }
  .tabbar .tb-play .disc svg { width: 26px; height: 26px; }
  .tabbar .tb-play.playing .disc { background: var(--midnight); box-shadow: 0 0 0 3px var(--amber); }
  :root[data-theme="dark"] .tabbar .tb-play.playing .disc { background: var(--surface); }
  .tabbar .badge {
    position: absolute; top: 3px; left: calc(50% + 5px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--red); color: #fff; font: 700 11px/18px var(--latin); font-style: normal;
  }
}
.mgrid i { aspect-ratio: 1; border-radius: 2px; background: var(--line); display: block; }
.mgrid i.cur { outline: 2px solid var(--accent); outline-offset: 1px; }
.mgrid .yr { grid-column: 1 / -1; font-size: 10.5px; color: var(--faint); margin-top: 2px; }
.legend { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
svg.chart { width: 100%; height: auto; display: block; }
svg.chart text { fill: var(--muted); font: 10px var(--mono); }
details.st > summary { cursor: pointer; color: var(--teal); font-size: 14px; }
.statements { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 10px; }
.statements h4 { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.statements td { padding: 4px 4px; font-size: 13px; }
.statements tr.tot td { font-weight: 700; border-top: 1px solid var(--line2); }
.statements p.tiny.muted { margin: 0 0 6px; }
details.gloss { margin-top: 12px; font-size: 13px; }
details.gloss > summary { cursor: pointer; color: var(--teal); }
details.gloss dl { margin: 8px 0 0; }
details.gloss dt { font-weight: 600; margin-top: 8px; }
details.gloss dd { margin: 2px 0 0; color: var(--muted); }

/* ---------------------------------------------------------------- dialogs */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 12px; padding: 22px; width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h3 { margin-top: 0; }
dialog label { display: block; margin-bottom: 10px; }

/* ---------------------------------------------------------------- rankings */
.board td.rank { font-family: var(--serif); font-size: 18px; width: 52px; }
.board td.score { font-family: var(--mono); }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.subnav a { text-decoration: none; color: var(--muted); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; font-size: 13.5px; }
.subnav a.on { color: var(--text); border-color: var(--accent); }
.statgrid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.stat .n { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat .l { font-size: 12.5px; color: var(--muted); }
.hbar { display: grid; grid-template-columns: 130px 1fr 54px; gap: 10px; align-items: center; font-size: 13.5px; margin: 6px 0; }
.hbar .tr { height: 8px; background: var(--line); border-radius: 9px; overflow: hidden; }
.hbar .tr i { display: block; height: 100%; background: var(--teal); }
.hbar span:last-child { font-family: var(--mono); text-align: right; color: var(--muted); }

/* ---------------------------------------------------------------- footer */
.foot { max-width: 1240px; margin: 0 auto; padding: 30px 20px 60px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.foot .row { margin-top: 12px; }
.foot .btns button { font-weight: 500; font-size: 13.5px; }
.foot .links a { color: var(--muted); }

/* ---------------------------------------------------------------- shared extras */
#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60; background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 999px; font-size: 14px; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 760px) { #toast { bottom: 84px; } }
.lockcard { text-align: left; }
.lockcard h3 { font-family: var(--sans); font-size: 15px; margin: 6px 0 4px; }
.ccard.ended { border-top-color: var(--line2); }
.ccard.ended .t { color: color-mix(in srgb, var(--text) 75%, var(--muted)); }
label.pv { display: inline-flex; align-items: center; gap: 6px; }
label.pv > span:first-child { margin: 0; }
label.pv select { width: auto; min-height: 30px; padding: 3px 8px; }
.banner label.pv { margin-left: 10px; font-size: 13px; }
details.optional { margin-top: 12px; }
details.optional > summary, details.small > summary { cursor: pointer; color: var(--teal); }
.check + .check { margin-top: 6px; }
.hkmap { width: 100%; height: auto; display: block; }

/* ---------------------------------------------------------------- podium */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; gap: 12px; align-items: end; margin-bottom: 16px; }
.pod { border: 1px solid var(--line2); border-radius: var(--r); padding: 14px 12px; text-align: center; background: var(--bg2); }
.pod .r { font-family: var(--serif); font-size: 26px; line-height: 1; }
.pod .nm { font-family: var(--serif); font-weight: 700; margin: 6px 0 2px; overflow-wrap: anywhere; }
.pod.p1 { order: 2; padding-top: 26px; border-color: var(--amber); border-width: 2px; background: color-mix(in srgb, var(--amber) 12%, var(--bg2)); }
.pod.p1 .r { color: var(--amber-ink); }
.pod.p2 { order: 1; }
.pod.p3 { order: 3; }
.pod.p2 .r { color: var(--muted); }
.pod.p3 .r { color: var(--muted); }
@media (max-width: 560px) { .podium { grid-template-columns: 1fr; } .pod.p1, .pod.p2, .pod.p3 { order: 0; } }
.board tr.top1 td:first-child { color: var(--amber-ink); box-shadow: inset 3px 0 0 var(--amber); }

/* ---------------------------------------------------------------- reports */
.repwrap { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; align-items: start; margin-top: 12px; }
.repwrap > .card + .card { margin-top: 0; }
@media (max-width: 860px) { .repwrap { grid-template-columns: 1fr; } }
.replist h4 { font-size: 12px; color: var(--muted); font-weight: 600; margin: 12px 0 4px; text-transform: uppercase; letter-spacing: .04em; }
.replist h4:first-child { margin-top: 0; }
.replist a, .replist .locked { display: block; padding: 5px 8px; border-radius: 6px; font-size: 13.5px; text-decoration: none; color: var(--text); }
.replist a:hover { background: var(--panel2); }
.replist a.on { background: var(--panel2); box-shadow: inset 2px 0 0 var(--accent); }
.replist .locked { color: var(--faint); cursor: default; }
table.report td, table.report th { white-space: nowrap; }
table.report td.l { white-space: normal; min-width: 140px; }
table.report td.mono { font-size: 13px; }
table.report tr.tot td, table.report tfoot td { font-weight: 700; border-top: 1px solid var(--line2); }
.repnotes { margin: 12px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- workbench + model builder */
table.edit td { padding: 4px 4px; text-align: left; }
table.edit th { white-space: nowrap; }
table.edit input, table.edit select { min-height: 32px; padding: 4px 6px; min-width: 76px; font-size: 13px; }
table.edit input[data-f="title"], table.edit input[data-f="name"] { min-width: 150px; }
table.fc td { padding: 3px; }
table.fc td:first-child { min-width: 170px; }
table.fc input { min-width: 64px; min-height: 30px; padding: 3px 5px; font-size: 13px; text-align: right; }

/* ---------------------------------------------------------------- plans */
.plans { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plans > .card + .card { margin-top: 0; }
.plan { display: flex; flex-direction: column; }
.plan.cur { border-color: var(--accent); }
.plan .price { font-family: var(--serif); font-size: 30px; margin: 4px 0 10px; }
.plan ul { padding-left: 18px; margin: 0 0 14px; flex: 1; }
.plan li { margin-bottom: 4px; }
.plan-custom { margin-top: 14px; display: grid; gap: 14px 32px; grid-template-columns: minmax(220px, 1fr) minmax(0, 2fr); border-style: dashed; }
.plan-custom .price { font-family: var(--serif); font-size: 26px; margin: 4px 0 10px; }
.plan-custom ul { columns: 2; column-gap: 28px; padding-left: 18px; margin: 0; }
.plan-custom li { margin-bottom: 10px; break-inside: avoid; }
@media (max-width: 760px) { .plan-custom { grid-template-columns: minmax(0, 1fr); } .plan-custom ul { columns: 1; } }

/* ---------------------------------------------------------------- terms notice + legal pages */
dialog.gate { width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; }
dialog.gate::backdrop { background: rgba(0, 0, 0, .78); backdrop-filter: blur(3px); }
.gate .gate-points { padding-left: 20px; margin: 10px 0 14px; }
.gate .gate-points li { margin-bottom: 8px; line-height: 1.5; }
.gate .gate-doc { max-height: 58vh; overflow: auto; margin: 10px 0; }
.gate .gate-doc .legal { border: 0; padding: 0; background: none; }
.gate .row.end .primary { min-width: 140px; }
.legal { max-width: 760px; margin: 0 auto; line-height: 1.65; }
.legal h3 { margin: 20px 0 6px; font-size: 16px; }
.legal p { margin: 0 0 10px; }

@media print {
  .top, .banner, .foot, .noprint, .replist, .subnav, #toast, .sticky-cta { display: none !important; }
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .card { border: 0; padding: 0; background: #fff; }
  .repwrap { display: block; }
  th, td { border-color: #bbb; color: #000; }
  .neg { color: #b00; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
