:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #1d2a24;
  --ink-2: #4b5a53;
  --ink-3: #7c8a83;
  --line: #e4ddd0;
  --line-2: #efe9de;
  --brand: #2f5d4a;
  --brand-2: #3f7a61;
  --brand-soft: #e3ede7;
  --accent: #b5652f;
  --accent-soft: #f6e7da;
  --gold: #d9a441;
  --pos: #2f7d4f;
  --neg: #b23b2e;
  --c-nri: #2f6f9f;
  --c-cafe: #b5652f;
  --c-mushroom: #5f8f4e;
  --c-pepper: #6d3b2a;
  --s1: #2f5d4a; --s2: #b5652f; --s3: #2f6f9f; --s4: #d9a441; --s5: #8a6fb0; --s6: #c25b7a;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 42, 36, .06), 0 4px 18px rgba(29, 42, 36, .05);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', Georgia, serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--serif); font-weight: 650; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; font-family: var(--font); font-weight: 650; letter-spacing: 0; }
p { margin: 0 0 .8em; }
a { color: var(--brand); }
small, .muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }

/* ---------- top bar ---------- */
.top { position: sticky; top: 0; z-index: 40; background: rgba(246, 243, 236, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1320px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.brand svg { width: 34px; height: 34px; }
.brand svg rect { fill: var(--brand); }
.brand svg path { stroke: #f1c27d; stroke-width: 2.4; fill: none; stroke-linejoin: round; }
.brand b { display: block; font-family: var(--serif); font-size: 1.05rem; line-height: 1.1; }
.brand small { font-size: .74rem; }
.main-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.main-tabs::-webkit-scrollbar { display: none; }
.main-tabs a { padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: .9rem; white-space: nowrap; display: flex; align-items: center; gap: 7px; }
.main-tabs a:hover { background: var(--line-2); color: var(--ink); }
.main-tabs a[aria-selected="true"] { background: var(--brand); color: #fff; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.nri { background: var(--c-nri); } .dot.cafe { background: var(--c-cafe); } .dot.mushroom { background: var(--c-mushroom); } .dot.pepper { background: var(--c-pepper); }
.main-tabs a[aria-selected="true"] .dot { box-shadow: 0 0 0 2px #fff; }

main { max-width: 1320px; margin: 0 auto; padding: 24px 20px 40px; outline: none; }
.foot { max-width: 1320px; margin: 0 auto; padding: 8px 20px 40px; color: var(--ink-3); font-size: .8rem; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.4fr 1fr; gap: 28px; align-items: end; margin-bottom: 18px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; color: var(--accent); margin-bottom: 6px; }
.hero p.lead { font-size: 1.05rem; color: var(--ink-2); max-width: 62ch; }
.hero .brandname { font-size: .85rem; color: var(--ink-3); }
.scen { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 14px; border-radius: 999px; font: 600 .82rem var(--font); color: var(--ink-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg button:focus-visible, .subnav button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- KPI strip ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi .k { font-size: .74rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi .v { font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .s { font-size: .76rem; color: var(--ink-3); }
.kpi.good .v { color: var(--pos); } .kpi.bad .v { color: var(--neg); }

/* ---------- sub nav ---------- */
.subnav { position: sticky; top: 59px; z-index: 30; display: flex; gap: 2px; overflow-x: auto; background: var(--bg); padding: 8px 0; margin-bottom: 14px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav button { border: 0; background: none; padding: 8px 12px; font: 600 .86rem var(--font); color: var(--ink-3); cursor: pointer; border-radius: 8px; white-space: nowrap; }
.subnav button:hover { color: var(--ink); background: var(--line-2); }
.subnav button[aria-selected="true"] { color: var(--brand); background: var(--brand-soft); }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.grid2 > .card, .grid3 > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; }
.pill.high { background: #dcefe2; color: #22603b; } .pill.medium { background: #fbefd5; color: #8a5a00; } .pill.low { background: #f8dcd8; color: #8f2a1f; }
.pill.High { background: #f8dcd8; color: #8f2a1f; } .pill.Medium { background: #fbefd5; color: #8a5a00; } .pill.Low { background: #dcefe2; color: #22603b; }
.note { font-size: .82rem; color: var(--ink-3); }
.callout { background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; font-size: .88rem; margin: 10px 0; }
.callout.ok { background: var(--brand-soft); border-color: var(--brand); }
.callout.warn { background: #f8dcd8; border-color: var(--neg); }

dl.facts { display: grid; grid-template-columns: 170px 1fr; gap: 10px 18px; margin: 0; }
dl.facts dt { font-weight: 650; color: var(--ink); }
dl.facts dd { margin: 0; color: var(--ink-2); }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
table { width: 100%; border-collapse: collapse; font-size: .86rem; }
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line-2); vertical-align: top; }
thead th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.tot td { font-weight: 700; background: var(--surface-2); border-top: 1px solid var(--line); }
tr.sub td { color: var(--ink-3); font-size: .8rem; }
tr.sec td { background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; }
td.neg { color: var(--neg); }
table.fin td:first-child { min-width: 220px; }

/* ---------- assumptions editor ---------- */
.assume-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; align-items: start; }
.live { position: sticky; top: 120px; }
.live .kpi { margin-bottom: 8px; }
table.inputs td { vertical-align: middle; }
table.inputs input { width: 100%; min-width: 64px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; font: 500 .85rem var(--font); color: #1f3fd1; text-align: right; background: #fbfcff; font-variant-numeric: tabular-nums; }
table.inputs input:focus { outline: 2px solid var(--brand-2); border-color: transparent; }
table.inputs input.changed { background: #fff7d6; border-color: #e6c75a; }
table.inputs .lbl { min-width: 240px; }
table.inputs .lbl small { display: block; font-size: .74rem; line-height: 1.35; margin-top: 2px; }
table.inputs .unit { color: var(--ink-3); font-size: .78rem; white-space: nowrap; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px; border-radius: 10px; font: 600 .88rem var(--font); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); }
.btn svg { width: 18px; height: 18px; }

/* ---------- plan viewer ---------- */
.plan-shell { display: grid; grid-template-columns: 1fr; gap: 16px; }
.viewer { position: relative; height: 560px; border-radius: 12px; overflow: hidden; background: #e8eef0; border: 1px solid var(--line); }
.viewer canvas { display: block; }
.plan-labels { position: absolute; inset: 0; }
.plan-label { background: rgba(29, 42, 36, .82); color: #fff; font: 600 11px var(--font); padding: 3px 7px; border-radius: 6px; white-space: nowrap; pointer-events: none; }
.viewer-tools { position: absolute; top: 12px; left: 12px; display: flex; flex-wrap: wrap; gap: 6px; z-index: 5; }
.viewer-tools .seg { box-shadow: var(--shadow); }
.viewer-hint { position: absolute; bottom: 10px; right: 12px; font-size: .74rem; color: var(--ink-2); background: rgba(255, 255, 255, .8); padding: 3px 8px; border-radius: 6px; z-index: 5; }
.plan2d { width: 100%; height: auto; max-height: 640px; background: #fbfaf6; border-radius: 10px; border: 1px solid var(--line); }
.plan2d .room { fill: #f1ece1; stroke: #3b3b3b; stroke-width: .18; }
.plan2d .room.outline { fill: none; stroke: #1d2a24; stroke-width: .55; }
.plan2d .room.dashed { fill: none; stroke-dasharray: 1 .6; stroke-width: .15; }
.plan2d .room.glass { fill: #bfe3ef; }
.plan2d .room.ph1 { fill: #e3ede7; } .plan2d .room.ph2 { fill: #f6e7da; } .plan2d .room.ph3 { fill: #e2ecf6; } .plan2d .room.ph4 { fill: #efe7f6; }
.plan2d .room.off { opacity: .25; }
.plan2d .hatch { stroke: rgba(0, 0, 0, .05); stroke-width: .3; }
.plan2d .rt { fill: #1d2a24; font-family: var(--font); font-weight: 600; }
.plan2d .rt.off { opacity: .35; }
.plan2d .dim { stroke: var(--accent); stroke-width: .15; }
.plan2d .dim-ar { fill: var(--accent); }
.plan2d .dt { fill: var(--accent); font-family: var(--font); font-weight: 700; }
.plan2d .scale { stroke: #1d2a24; stroke-width: .5; }
.plan2d .street { fill: var(--ink-3); font-family: var(--font); font-weight: 700; letter-spacing: .15em; }

/* ---------- canvas ---------- */
.bmc { display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: auto auto auto; gap: 8px; }
.bmc > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: .84rem; }
.bmc h4 { margin: 0 0 6px; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }
.bmc ul { margin: 0; padding-left: 16px; color: var(--ink-2); }
.bmc .kp { grid-column: 1; grid-row: 1 / span 2; }
.bmc .ka { grid-column: 2; grid-row: 1; }
.bmc .kr { grid-column: 2; grid-row: 2; }
.bmc .vp { grid-column: 3; grid-row: 1 / span 2; background: var(--accent-soft); }
.bmc .cr { grid-column: 4; grid-row: 1; }
.bmc .ch { grid-column: 4; grid-row: 2; }
.bmc .cs { grid-column: 5; grid-row: 1 / span 2; }
.bmc .co { grid-column: 1 / span 3; grid-row: 3; }
.bmc .rs { grid-column: 4 / span 2; grid-row: 3; background: var(--brand-soft); }

.swot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.swot > div { border-radius: 10px; padding: 12px 14px; font-size: .86rem; }
.swot h4 { margin: 0 0 4px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.swot ul { margin: 0; padding-left: 16px; }
.swot .S { background: #e3ede7; } .swot .W { background: #fbefd5; } .swot .O { background: #e2ecf6; } .swot .T { background: #f8dcd8; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 8px 0 8px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 117px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ''; position: absolute; left: 121px; top: 26px; bottom: -8px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline b { font-size: .82rem; color: var(--brand); }
.timeline span { padding-left: 22px; color: var(--ink-2); font-size: .9rem; }
ul.checks { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 20px; }
ul.checks li { padding: 4px 0 4px 22px; position: relative; font-size: .88rem; break-inside: avoid; }
ul.checks li::before { content: '✓'; position: absolute; left: 0; color: var(--pos); font-weight: 700; }

.chart-box { position: relative; height: 290px; }
.chart-box.tall { height: 340px; }

/* ---------- portfolio ---------- */
.model-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 10px; border-top: 4px solid var(--c); transition: transform .15s; }
.mcard:hover { transform: translateY(-2px); }
.mcard h3 { font-family: var(--serif); font-size: 1.15rem; margin: 0; }
.mcard p { font-size: .86rem; color: var(--ink-2); margin: 0; }
.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini div { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.mini b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.mini small { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.dl-row { display: flex; flex-wrap: wrap; gap: 10px; }

.slider-row { display: grid; grid-template-columns: 170px 1fr 60px; gap: 12px; align-items: center; margin-bottom: 10px; font-size: .88rem; }
.slider-row input { width: 100%; accent-color: var(--brand); }
.slider-row output { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 1000px) {
  .hero, .assume-layout, .grid2 { grid-template-columns: 1fr; }
  .grid3, .model-cards { grid-template-columns: 1fr; }
  .scen { align-items: flex-start; }
  .live { position: static; }
  .bmc { grid-template-columns: 1fr 1fr; }
  .bmc > div { grid-column: auto !important; grid-row: auto !important; }
  .bmc .vp { grid-column: 1 / -1 !important; }
}
@media (max-width: 640px) {
  .top-inner { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 16px; }
  .subnav { top: 104px; }
  main { padding: 16px 16px 32px; }
  .viewer { height: 420px; }
  dl.facts { grid-template-columns: 1fr; gap: 2px 0; }
  dl.facts dd { margin-bottom: 8px; }
  .bmc, .swot { grid-template-columns: 1fr; }
  ul.checks { columns: 1; }
  .timeline li { grid-template-columns: 88px 1fr; }
  .timeline li::before { left: 95px; } .timeline li::after { left: 99px; }
  .slider-row { grid-template-columns: 1fr 60px; }
  .slider-row input { grid-column: 1 / -1; grid-row: 2; }
  .card { padding: 16px; }
}
@media print {
  .top, .subnav, .viewer-tools, .btn, .seg, .foot { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}
/* let grid children shrink so wide tables scroll inside their card, not the page */
.hero > *, .assume-layout > *, .grid2 > *, .grid3 > * { min-width: 0; }
.plan2d .std { fill: #3f7a35; }

/* ---------- settings ---------- */
.main-tabs .tab-settings svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.settings-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.settings-bar .grow { flex: 1; }
.settings-bar input[type=search] { flex: 1 1 240px; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font: 500 .9rem var(--font); background: var(--surface-2); }
.settings-bar input[type=search]:focus { outline: 2px solid var(--brand-2); border-color: transparent; }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.settings-model { margin-top: 26px; }
.settings-head { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 12px 20px; align-items: center; padding: 14px 18px; margin-bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: var(--radius); position: sticky; top: 66px; z-index: 20; box-shadow: var(--shadow); }
.settings-head h2 { margin: 0 0 2px; font-size: 1.2rem; }
.settings-head .dl-row { grid-column: 1 / -1; }
.mini-kpis { margin: 0; grid-template-columns: repeat(5, minmax(96px, 1fr)); gap: 6px; }
.mini-kpis .kpi { padding: 6px 10px; }
.mini-kpis .kpi .v { font-size: 1rem; }
.mini-kpis .kpi .k { font-size: .66rem; }
label.btn { user-select: none; }
@media (max-width: 1000px) {
  .settings-head { grid-template-columns: 1fr; position: static; }
  .mini-kpis { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
  .settings-bar { position: static; }
}
.seg { max-width: 100%; flex-wrap: wrap; }
@media (max-width: 640px) { .seg { border-radius: 14px; } }
table.inputs .calc { display: block; text-align: right; padding: 5px 7px; color: var(--ink-3); font-variant-numeric: tabular-nums; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 6px; }
