/* style.css — institutional pitchbook aesthetic */
:root {
  --navy: #0f4c81; --navy-d: #0a2e52; --ink: #0f172a; --slate: #475569;
  --line: #d8dee6; --bg: #f6f7f9; --card: #ffffff; --gold: #b49244;
  --amber: #b45309; --green: #4a7c59; --red: #b91c1c;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 15px; line-height: 1.45; }
.serif { font-family: Georgia, "Times New Roman", serif; }

header.masthead { background: var(--navy-d); color: #fff; padding: 22px 28px 16px; }
header.masthead .wrap { max-width: 1180px; margin: 0 auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
header.masthead h1 { font-size: 21px; margin: 0; letter-spacing: .3px; font-family: Georgia, serif; }
header.masthead .sub { margin: 3px 0 0; font-size: 12.5px; color: #b8c6d8; }
.badge { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; border: 1px solid rgba(255,255,255,.35); padding: 4px 10px; color: #e6d9b8; white-space: nowrap; }
.gold-rule { height: 3px; background: linear-gradient(90deg, var(--gold), var(--navy)); }

#app { max-width: 1180px; margin: 0 auto; padding: 0 24px 60px; }

.tabs { display: flex; gap: 2px; margin: 18px 0 22px; border-bottom: 2px solid var(--navy); flex-wrap: wrap; }
.tabs button { background: #eef1f5; border: 1px solid var(--line); border-bottom: none; color: var(--slate);
  padding: 9px 16px; font-size: 13.5px; cursor: pointer; border-radius: 4px 4px 0 0; font-weight: 500; }
.tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.tabs button:hover:not(.on) { background: #e0e5ec; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 4px; padding: 22px 24px; margin-bottom: 22px;
  box-shadow: 0 1px 3px rgba(15, 34, 58, .05); }
.card-h h2 { margin: 0; font-size: 17px; color: var(--navy-d); font-family: Georgia, serif; border-bottom: 2px solid var(--navy); padding-bottom: 8px; }
.card-h .sub { margin: 6px 0 14px; font-size: 12.5px; color: var(--slate); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: right; font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--slate);
  border-bottom: 1.5px solid var(--ink); padding: 7px 8px; font-weight: 600; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { text-align: right; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.tbl tr.hl td { background: #f0f4f8; font-weight: 600; border-top: 1.5px solid var(--navy); }
.tbl tr.hl td:first-child { border-left: 3px solid var(--navy); }
.tbl .lbl { color: var(--ink); font-weight: 500; }
.tbl .mini, .mini { font-size: 11px; color: var(--slate); font-weight: 400; }
.tbl.tight td { padding: 6px 8px; }
.tbl.tight td:first-child { color: var(--slate); }
.tbl.grid td.base { background: #dcebf7; font-weight: 700; }
.tbl tr.muted td { color: #9aa5b1; }

.kgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 16px; }
.kpi { border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: 3px; padding: 13px 15px; background: #fbfcfd; }
.kpi.amber { border-left-color: var(--amber); } .kpi.green { border-left-color: var(--green); }
.kpi.red { border-left-color: var(--red); } .kpi.navy { border-left-color: var(--navy); }
.kpi-v { font-size: 21px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi-l { font-size: 12px; color: var(--slate); margin-top: 2px; font-weight: 600; }
.kpi-n { font-size: 11.5px; color: var(--slate); margin-top: 4px; }

.verdict { margin-top: 18px; padding: 14px 18px; background: #f2f6fa; border: 1px solid #cfdcec; border-left: 4px solid var(--gold);
  border-radius: 3px; font-size: 14px; }
.note { font-size: 12.5px; color: var(--slate); margin: 14px 0 0; }
.note code { background: #eef1f5; padding: 1px 5px; border-radius: 3px; }

.in { border: none; border-bottom: 1.5px solid var(--navy); background: #f2f7fc; color: var(--navy-d);
  font: inherit; text-align: right; width: 76px; padding: 2px 4px; border-radius: 2px; font-weight: 600; }
.in:focus { outline: 2px solid var(--gold); background: #fdf8ec; }
.th .in { width: 58px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.two-col-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 880px) { .two-col, .two-col-inner { grid-template-columns: 1fr; } }

.segbar { display: flex; height: 120px; border-radius: 3px; overflow: hidden; margin-top: 8px; }
.seg { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; text-align: center; padding: 6px; }
.seg span b { display: block; font-size: 14px; margin-top: 3px; }

ol.src { margin: 8px 0 0; padding-left: 20px; color: var(--slate); font-size: 12.5px; }
ol.src li { margin-bottom: 6px; }

footer { text-align: center; color: var(--slate); font-size: 11.5px; padding: 18px 0 30px; }

/* ---- dynamic toolbar / scenario engine ---- */
.toolbar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 8px;
  background: rgba(246, 247, 249, .96); backdrop-filter: blur(4px); padding: 12px 0 8px; border-bottom: 1px solid var(--line); }
.toolbar .spacer { flex: 1; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--slate); border-radius: 3px;
  padding: 5px 11px; font-size: 12.5px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.chip:hover { border-color: var(--navy); color: var(--navy); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.danger { color: #8b2525; }
.chip.danger:hover { border-color: var(--red); color: var(--red); }
.status { font-size: 12px; color: var(--green); font-weight: 600; opacity: 0; transition: opacity .3s; }
.status.show { opacity: 1; }

/* ---- sensitivity grids ---- */
.gridwrap { overflow-x: auto; }
.tbl.grid td.cell { text-align: center; font-weight: 500; border: 1px solid #fff; }
.tbl.grid th.axis, .tbl.grid td.axis { font-weight: 600; color: var(--navy-d); white-space: nowrap; }
.axisrow { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 10px 0 2px; }
.axisctl { display: flex; align-items: center; gap: 5px; background: #f8fafc; border: 1px dashed var(--line); border-radius: 3px; padding: 5px 9px; }
.axisctl .in { width: 54px; }

.in.txt { text-align: left; border-bottom-color: #b7c3d2; background: transparent; font-weight: 400; color: var(--slate); }
.in.txt:focus { outline: 2px solid var(--gold); background: #fdf8ec; }

/* ---- Valuation Academy ---- */
.progrow { display: flex; align-items: center; gap: 16px; }
.progbar { flex: 1; height: 14px; background: #e6eaf0; border-radius: 7px; overflow: hidden; }
.progfill { height: 100%; background: linear-gradient(90deg, var(--navy), var(--gold)); border-radius: 7px; transition: width .3s; }
.progtxt { font-size: 13px; color: var(--slate); white-space: nowrap; }
.masterbadge { background: var(--gold); color: #fff; font-size: 11px; letter-spacing: 1.2px; padding: 3px 10px; border-radius: 3px; font-weight: 700; }

.card.acad { border-left: 4px solid var(--line); }
.card.acad.done { border-left-color: var(--green); background: linear-gradient(180deg, #fbfdfb, #fff); }
.lvlrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; }
.lvlrow h2 { border-bottom: none; padding-bottom: 0; }
.lvlmeta { display: flex; align-items: center; gap: 10px; }
.lvlnum { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: 14px; margin-right: 6px; font-family: inherit; }
.lvlnum.on { background: var(--green); }
details.lesson { border: 1px solid var(--line); border-radius: 3px; margin: 10px 0; background: #fbfcfd; }
details.lesson summary { padding: 11px 14px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--navy-d); list-style-position: inside; }
details.lesson summary:hover { background: #f0f4f8; border-radius: 3px; }
details.lesson[open] summary { border-bottom: 1px solid var(--line); }
.lesson-body { padding: 12px 16px 4px; margin: 0; font-size: 14px; line-height: 1.6; color: #1e293b; }

.livebox { margin: 8px 16px 14px; border: 1px solid #cfdcec; border-left: 4px solid var(--gold);
  border-radius: 3px; background: #f2f6fa; padding: 10px 14px; }
.livebox-t { font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--navy); font-weight: 700; margin-bottom: 6px; }

.quizbox { margin: 14px 0 4px; padding: 14px 16px; border: 1px dashed #c9b98a; border-radius: 4px; background: #fdf9ef; }
.quizq { font-weight: 700; font-size: 14px; color: #6b5320; margin-bottom: 10px; }
.quizopt { display: block; width: 100%; text-align: left; margin: 6px 0; padding: 9px 12px; font-size: 13.5px;
  border: 1px solid #e2d9c0; border-radius: 3px; background: #fff; cursor: pointer; color: #1e293b; }
.quizopt:hover:not(:disabled) { border-color: var(--gold); background: #fdf6e6; }
.quizopt.right { border-color: var(--green); background: #eaf4ec; font-weight: 600; }
.quizopt.right::after { content: " ✓"; color: var(--green); font-weight: 700; }
.quizopt.wrong { border-color: var(--red); background: #fbeeec; text-decoration: line-through; color: #7f1d1d; }
.quizopt:disabled { cursor: default; }
.quiz-why { display: none; margin-top: 10px; font-size: 13px; color: #574411; background: #f6eed8; padding: 10px 12px; border-radius: 3px; line-height: 1.55; }

.gloss { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 10px; }
.gitem { font-size: 12.5px; color: var(--slate); border: 1px solid var(--line); border-radius: 3px; padding: 9px 11px; background: #fbfcfd; line-height: 1.5; }
.gitem b { color: var(--ink); }

@media print {
  .tabs, header.masthead .badge, .toolbar { display: none; }
  .card { break-inside: avoid; box-shadow: none; }
  body { background: #fff; }
}
