:root {
  --ink: #1d1d1f; --ink-2: #6e6e73; --ink-3: #8a8378;
  --bronze: #8a735c; --bronze-2: #c4a88c; --sand: #f6f1e8; --sand-2: #f3eee6; --line: #ece3d4;
  --surface: #ffffff; --page: #fbf9f6;
  --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #f2a600; --s5: #ee7fac; --s6: #008a17; --s7: #6a4ce2; --s8: #ec4647;
  --h0: #efece7; --h1: #e6d8c4; --h2: #d2b590; --h3: #b08b62; --h4: #876646; --h5: #5a432d;
  --sans: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --serif: Cardo, Georgia, serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--sans); color: var(--ink); background: var(--page); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; background: var(--sand-2); padding: 1px 6px; border-radius: 6px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 32px); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.topbar { background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar-in { display: flex; justify-content: space-between; align-items: center; gap: 16px; height: 58px; }
.brand { font-weight: 700; text-decoration: none; letter-spacing: -.02em; font-size: 17px; }
.brand span { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--bronze); margin-left: 2px; font-size: 19px; }
.topbar nav { display: flex; gap: clamp(12px, 3vw, 24px); font-size: 14px; }
.topbar nav a { text-decoration: none; color: var(--ink-2); white-space: nowrap; }
.topbar nav a:hover { color: var(--ink); }
@media (max-width: 520px) { .topbar nav a[href="#how"] { display: none; } }

.hero { padding: clamp(40px, 7vw, 76px) 0 28px; max-width: 760px; }
.eyebrow { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.rule { display: inline-block; width: 26px; height: 1px; background: var(--ink); vertical-align: middle; margin-right: 12px; }
h1 { font-weight: 600; font-size: clamp(34px, 5vw, 54px); line-height: 1.05; letter-spacing: -.035em; margin: 20px 0 18px; }
h1 em { font-family: var(--serif); font-weight: 400; color: var(--bronze); letter-spacing: -.01em; }
.lede { font-size: clamp(16px, 1.8vw, 18px); line-height: 1.6; color: var(--ink-2); margin: 0; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: clamp(18px, 3vw, 28px); margin: 18px 0; box-shadow: 0 1px 2px rgba(60,40,20,.04), 0 14px 36px rgba(60,40,20,.06); }
.card-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 14px; align-items: flex-start; }
.card-h { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.card-sub { font-size: 13px; color: var(--ink-3); margin: 4px 0 0; }

.check-form { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.check-form input { flex: 1 1 260px; font: inherit; font-size: 16px; padding: 14px 16px; border: 1px solid #d9cdbb; border-radius: 12px; background: #fff; min-width: 0; }
.check-form input:focus { outline: 2px solid var(--bronze-2); outline-offset: 1px; }
.check-form button, .seg button { font: inherit; cursor: pointer; }
.check-form button { background: var(--ink); color: #fff; border: 0; border-radius: 12px; padding: 14px 22px; font-weight: 600; font-size: 15px; }
.check-form button:disabled { opacity: .6; cursor: wait; }
.check-result:empty { display: none; }
.check-result { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 18px; }
.res-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: baseline; justify-content: space-between; }
.res-name { font-weight: 600; font-size: 18px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.pill.on { background: #eaf6ee; color: #0b6b22; }
.pill.off { background: var(--sand-2); color: var(--ink-2); }
.pill.warn { background: #fff4e0; color: #8a5300; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 14px; }
.res-stat { background: var(--sand-2); border-radius: 14px; padding: 12px 14px; }
.res-stat b { display: block; font-family: var(--serif); font-weight: 400; font-size: 28px; line-height: 1.1; }
.res-stat span { font-size: 12px; color: var(--ink-2); }
.res-line { font-size: 14px; color: var(--ink-2); margin: 12px 0 0; line-height: 1.55; }
.res-line strong { color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.track-hint { margin-top: 14px; font-size: 13px; color: var(--ink-2); background: var(--page); border: 1px dashed #d9cdbb; border-radius: 12px; padding: 12px 14px; }
.track-hint code { display: block; margin-top: 6px; padding: 8px 10px; white-space: pre-wrap; word-break: break-all; }
.copy { font: inherit; font-size: 12px; margin-top: 8px; border: 1px solid #d9cdbb; background: #fff; border-radius: 8px; padding: 5px 10px; cursor: pointer; }

.banner { background: #fff8ec; border: 1px solid #f1dfbf; color: #6b4e1f; border-radius: 14px; padding: 12px 16px; font-size: 14px; line-height: 1.5; margin: 18px 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 45%), 1fr)); gap: 14px; margin: 18px 0; }
.kpi { min-width: 0; background: linear-gradient(160deg, #fff 0%, var(--sand) 60%, #ede3d4 100%); border: 1px solid var(--line); border-radius: 20px; padding: 18px 20px; }
.kpi b { display: block; font-family: var(--serif); font-weight: 400; font-size: clamp(30px, 3.6vw, 40px); line-height: 1; }
.kpi .k-l { font-size: 13px; font-weight: 600; margin-top: 10px; }
.kpi .k-s { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.seg { display: inline-flex; background: var(--sand-2); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 16px 0 6px; font-size: 13px; }
.legend button { font: inherit; display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; padding: 4px 0; cursor: pointer; color: var(--ink); }
.legend button.off { color: var(--ink-3); text-decoration: line-through; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend button.off i { opacity: .3; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis text { font-size: 11px; fill: var(--ink-3); font-family: var(--sans); }
.grid line { stroke: #efe8dd; }
.dlabel { font-size: 11px; fill: var(--ink-2); font-family: var(--sans); }

.calendar { margin-top: 16px; overflow-x: auto; padding-bottom: 6px; }
.cal-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 10px; margin-bottom: 6px; }
.cal-name { font-size: 12px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-cells { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(4px, 14px); gap: 2px; }
.cal-cells span { height: 22px; border-radius: 3px; background: var(--h0); cursor: default; }
.cal-months { margin-top: 2px; }
.cal-months .cal-cells { grid-template-rows: 14px; }
.cal-months em { font-style: normal; font-size: 11px; color: var(--ink-3); white-space: nowrap; grid-row: 1; }
.scale { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--ink-3); margin-top: 12px; flex-wrap: wrap; }
.scale i { width: 18px; height: 12px; border-radius: 3px; display: inline-block; }

.table-wrap { overflow-x: auto; margin-top: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid #f3ede4; vertical-align: top; }
td.num { font-variant-numeric: tabular-nums; }
td:first-child { white-space: nowrap; }
td .muted { color: var(--ink-3); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; vertical-align: -1px; }

.how { padding: 28px 0 10px; max-width: 760px; }
.how h2 { font-size: 26px; letter-spacing: -.02em; margin: 0 0 10px; }
.how h3 { font-size: 15px; margin: 24px 0 8px; }
.how ol { padding-left: 20px; line-height: 1.6; color: var(--ink-2); }
.how ol li { margin-bottom: 8px; }
.how ol strong { color: var(--ink); }
.how p { color: var(--ink-2); line-height: 1.6; font-size: 15px; }
.ticks { list-style: none; padding: 0; color: var(--ink-2); line-height: 1.8; font-size: 15px; }
.ticks li::before { content: '✓'; color: var(--bronze); margin-right: 10px; font-weight: 700; }
.foot { border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 0 40px; font-size: 13px; color: var(--ink-3); }

.tip { position: fixed; z-index: 20; pointer-events: none; background: #1d1d1f; color: #fff; font-size: 12px; line-height: 1.5; border-radius: 10px; padding: 9px 11px; box-shadow: 0 8px 24px rgba(0,0,0,.18); max-width: 260px; }
.tip b { font-weight: 600; }
.tip .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.tip i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.empty { color: var(--ink-3); font-size: 14px; padding: 18px 0; }

/* ---- calculator ---- */
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-top: 16px; }
.field { min-width: 0; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.field small { display: block; font-size: 11px; color: var(--ink-3); margin-top: 5px; line-height: 1.4; }
.inp { display: flex; align-items: center; border: 1px solid #d9cdbb; border-radius: 12px; background: #fff; overflow: hidden; }
.inp:focus-within { outline: 2px solid var(--bronze-2); outline-offset: 1px; }
.inp span { padding: 0 0 0 12px; color: var(--ink-3); font-size: 15px; }
.inp span.suf { padding: 0 12px 0 0; }
.inp input, .inp select { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; font: inherit; font-size: 16px; padding: 12px; background: transparent; font-variant-numeric: tabular-nums; }
.inp select { padding-right: 8px; cursor: pointer; }
.unit-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.unit-strip b { color: var(--ink); font-weight: 600; }
.offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 16px; }
.offer { border: 1px solid var(--line); border-radius: 18px; padding: 16px; background: var(--page); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.offer-h { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.offer-h i { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.offer .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.out { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 10px; }
.big { font-family: var(--serif); font-size: 34px; line-height: 1; }
.out .lbl { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.out .line { font-size: 13px; color: var(--ink-2); line-height: 1.5; }
.out .line b { color: var(--ink); }
.verdict { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 5px 11px; width: fit-content; }
.verdict.good { background: #eaf6ee; color: #0b6b22; }
.verdict.bad { background: #fdecec; color: #a3191a; }
.verdict.meh { background: #fff4e0; color: #8a5300; }
.ladder { width: 100%; min-width: 0; }
.ladder td, .ladder th { padding: 10px 8px; }
.bar { height: 8px; border-radius: 4px; background: var(--bronze-2); display: block; min-width: 2px; }
.bar.over { background: #e3c2c2; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 24px; margin-top: 14px; align-items: start; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.afford { background: linear-gradient(160deg, #fff 0%, var(--sand) 60%, #ede3d4 100%); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; }
.afford .big { font-size: 46px; }
.share { font: inherit; font-size: 13px; border: 1px solid #d9cdbb; background: #fff; border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.formula { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--sand-2); border-radius: 12px; padding: 14px 16px; line-height: 1.8; color: var(--ink); overflow-x: auto; }
.how a { color: var(--bronze); }

[hidden] { display: none !important; }

/* ---- CLV model ---- */
.layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; align-items: start; margin-top: 8px; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.layout > * { min-width: 0; }
.results .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { position: sticky; top: 74px; max-height: calc(100vh - 90px); overflow-y: auto; padding: 18px; margin: 0; }
@media (max-width: 900px) { .panel { position: static; max-height: none; } }
.group { border-top: 1px solid var(--line); padding: 14px 0 6px; }
.group:first-of-type { border-top: 0; padding-top: 4px; }
.group-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; font-size: 14px; margin-bottom: 10px; }
.group-h small { display: block; font-weight: 400; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.group.off .fields { opacity: .4; pointer-events: none; }
.panel .fields { grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 0; }
.panel .field label { font-size: 11.5px; }
.panel .inp input { padding: 9px 10px; font-size: 15px; }
.panel .inp span { font-size: 14px; }
.panel .inp span:not(.suf) { padding-left: 10px; }
.panel .inp span.suf { padding-right: 10px; }
.switch { position: relative; width: 40px; height: 24px; flex: 0 0 40px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #d9cdbb; border-radius: 999px; cursor: pointer; transition: .15s; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--ink); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--bronze-2); outline-offset: 2px; }
.check-line { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); grid-column: 1 / -1; }
.results .card:first-child { margin-top: 0; }
.kpi .delta { font-family: var(--sans); font-size: 13px; font-weight: 600; color: #0b6b22; margin-left: 6px; vertical-align: middle; }
.kpi .delta.neg { color: #a3191a; }
.ptable td, .ptable th { padding: 10px 8px; }
.ptable { min-width: 560px; }
.pos { color: #0b6b22; } .neg { color: #a3191a; }
.reset { font: inherit; font-size: 12px; border: 1px solid #d9cdbb; background: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; }

@media (max-width: 520px) { .kpi .delta { display: block; margin: 6px 0 0; } }
