:root {
  --paper: #EEF2FB;
  --surface: #FFFFFF;
  --ink: #1D2B55;
  --ink-2: #3A4A78;
  --muted: #66749B;
  --line: #BAC7E8;
  --line-2: #DDE4F5;
  --accent: #4C5FCF;
  --accent-ink: #3A4BB4;
  --accent-soft: #DCE3FA;
  --glass: linear-gradient(180deg, rgba(255,255,255,.92) 0%, rgba(243,246,253,.88) 100%);
  --sel: linear-gradient(180deg, #E3E9FC 0%, #CCD7F8 100%);
  --btn: linear-gradient(180deg, #FFFFFF 0%, #EEF2FC 48%, #E1E8F9 52%, #EAF0FC 100%);
  --btn-primary: linear-gradient(180deg, #8193EE 0%, #6175E0 48%, #4C5FCF 52%, #5A6DDA 100%);
  --deed: #2E7D55;
  --deed-ink: #1B4A38;
  --deed-soft: #E0ECE5;
  --brass: #A8741A;
  --brass-soft: #F4EBDA;
  --brass-ink: #6E4C0E;
  --loss: #B23A2B;
  --loss-soft: #F6E3DF;
  --slate: #2F3F9E;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --font: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', system-ui, sans-serif;
  --step--1: 0.8125rem;
  --step-0: 0.9375rem;
  --step-1: 1.125rem;
  --step-2: 1.5rem;
  --step-3: 2.25rem;
  --step-4: clamp(2.25rem, 4.6vw, 3.75rem);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink);
  background:
    radial-gradient(1200px 380px at 85% 104%, rgba(255,255,255,.95), rgba(255,255,255,0) 70%),
    radial-gradient(900px 300px at 10% 100%, rgba(214,224,250,.7), rgba(214,224,250,0) 70%),
    linear-gradient(180deg, #F3F6FD 0%, #E9EEFA 55%, #E4EAF9 100%);
  background-attachment: fixed;
  font-family: var(--font); font-size: var(--step-0); line-height: 1.5;
}
[hidden] { display: none !important; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
h1, h2, h3 { line-height: 1.15; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 12px; border-radius: var(--r-sm); z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--muted); }
.pos { color: var(--deed); }
.neg { color: var(--loss); }

/* ---------- buttons ---------- */
.btn {
  appearance: none; border: 1px solid #A9B8E0; background: var(--btn); color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 1px 2px rgba(60,80,160,.12);
  padding: 7px 16px; border-radius: 4px; cursor: pointer; font-weight: 500; font-size: var(--step--1);
  white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: #7F93D6; background: linear-gradient(180deg, #FFFFFF 0%, #E8EEFD 48%, #D6E0FA 52%, #E2EAFD 100%); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--btn); border-color: #A9B8E0; }
.btn.primary { background: var(--btn-primary); border-color: #3F51B5; color: #fff; text-shadow: 0 1px 0 rgba(30,40,110,.35); box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 1px 3px rgba(60,80,180,.3); }
.btn.primary:hover { background: linear-gradient(180deg, #91A2F2 0%, #7084E6 48%, #5A6DDA 52%, #6A7DE2 100%); border-color: #3F51B5; }
.btn.big { padding: 0 22px; font-size: var(--step-0); font-weight: 600; }
.link { appearance: none; background: none; border: 0; padding: 0; color: var(--accent-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; font-size: var(--step--1); }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px clamp(16px, 4vw, 40px); border-bottom: 1px solid var(--line); background: rgba(243,246,253,.85); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--accent); text-decoration: none; font-weight: 800; font-size: 1.2rem; letter-spacing: -0.02em; }
.brand span { color: var(--ink); }
.actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.count { display: inline-block; min-width: 1.3em; padding: 0 5px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: 0.75rem; }
.count:empty { display: none; }

/* ---------- ambient background (homepage only) ---------- */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; transition: opacity .8s; }
.aurora i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.aurora i:nth-child(1) { width: 46vw; height: 46vw; left: -8vw; top: -12vw; background: radial-gradient(circle, #C9D5FF, transparent 65%); animation: drift1 26s ease-in-out infinite alternate; }
.aurora i:nth-child(2) { width: 40vw; height: 40vw; right: -10vw; top: 4vw; background: radial-gradient(circle, #D9E6FF, transparent 65%); animation: drift2 32s ease-in-out infinite alternate; }
.aurora i:nth-child(3) { width: 34vw; height: 34vw; left: 30vw; top: 22vw; background: radial-gradient(circle, #E4DCFF, transparent 65%); animation: drift1 38s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(6vw, 4vw) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-5vw, 6vw) scale(.94); } }
.has-place .aurora, .show-bench .aurora { opacity: .25; }

/* ---------- hero ---------- */
.hero { padding: clamp(32px, 6vw, 72px) clamp(16px, 4vw, 40px) 28px; max-width: 1180px; position: relative; }
.hero-mark { margin-bottom: 18px; width: 96px; height: 96px; filter: drop-shadow(0 10px 18px rgba(52,70,176,.28)); animation: float 6s ease-in-out infinite; }
.hero-mark svg { width: 100%; height: 100%; }
.hero-mark .sheen { animation: sheen 5.5s ease-in-out 1.2s infinite; }
@keyframes float { 50% { transform: translateY(-7px); } }
@keyframes sheen { 0% { transform: rotate(20deg) translateX(0); } 35%, 100% { transform: rotate(20deg) translateX(190px); } }
.brand:hover .orb { animation: spinOrb .9s ease; }
@keyframes spinOrb { 50% { transform: rotate(-12deg) scale(1.08); } }
.has-place .hero-mark, .show-bench .hero-mark { display: none; }

/* The sources strip: each badge lights up in turn on load, then again while a lookup runs. */
.source-strip { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 18px 0 0; padding: 0; max-width: 760px; }
.source-strip li { font-size: 0.75rem; font-weight: 600; color: var(--ink-2); padding: 3px 10px 3px 22px; border-radius: 999px; border: 1px solid var(--line); background: var(--btn); position: relative; }
.source-strip li::before { content: ''; position: absolute; left: 9px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #B9C4E6; }
.source-strip li { animation: light 1.2s ease both; }
.source-strip li:nth-child(1) { animation-delay: .2s; } .source-strip li:nth-child(2) { animation-delay: .35s; } .source-strip li:nth-child(3) { animation-delay: .5s; }
.source-strip li:nth-child(4) { animation-delay: .65s; } .source-strip li:nth-child(5) { animation-delay: .8s; } .source-strip li:nth-child(6) { animation-delay: .95s; } .source-strip li:nth-child(7) { animation-delay: 1.1s; }
.source-strip li::before { animation: dot 1.2s ease both; animation-delay: inherit; }
@keyframes light { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dot { 60% { background: #6FD3A0; box-shadow: 0 0 0 4px rgba(111,211,160,.25); } to { background: #2E8A5C; } }
.searching .source-strip li::before { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { background: #8FA2EE; box-shadow: 0 0 0 4px rgba(76,95,207,.2); } }
.has-place .source-strip { display: none; }

/* ---------- landing ---------- */
.landing { padding: 8px clamp(16px, 4vw, 40px) 40px; max-width: 1180px; }
.land-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.land-grid article { background: var(--glass); border: 1px solid var(--line); box-shadow: inset 0 1px 0 #fff, 0 2px 10px rgba(60,80,160,.08); border-radius: 10px; padding: 18px 18px 16px; }
.land-grid h2 { font-size: 1rem; color: #1F2F5C; margin-bottom: 6px; letter-spacing: -0.01em; }
.land-grid p { margin: 0; font-size: var(--step--1); color: var(--ink-2); line-height: 1.55; }
.land-cta { margin: 18px 2px 0; font-size: var(--step--1); }
.landing ~ .workbench { display: none; }
.has-place .landing, .show-bench .landing { display: none; }
.has-place .landing ~ .workbench, .show-bench .landing ~ .workbench { display: grid; }
.hero h1 { font-size: var(--step-4); font-weight: 700; letter-spacing: -0.02em; max-width: 18ch; text-wrap: balance; color: #1F2F5C; }
.lede { font-size: var(--step-1); color: var(--ink-2); max-width: 60ch; margin: 14px 0 26px; }
.search { position: relative; max-width: 760px; }
.has-place .hero { padding-top: 24px; padding-bottom: 18px; }
.has-place .hero h1 { font-size: var(--step-3); max-width: none; }
.has-place .lede { display: none; }
.has-place .hero h1 { margin-bottom: 16px; }
.search-box { display: flex; gap: 8px; }
.search-box input {
  flex: 1; min-width: 0; padding: 14px 16px; font-size: var(--step-1);
  border: 1px solid #93A6DC; border-radius: 6px; background: #fff;
  box-shadow: inset 0 1px 3px rgba(40,60,130,.12);
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: inset 0 1px 3px rgba(40,60,130,.12), 0 0 0 3px var(--accent-soft); }
.search-status { min-height: 1.5em; margin: 10px 2px 0; color: var(--muted); font-size: var(--step--1); }
.search-status.busy::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: -1px; }
.search-status.err { color: var(--loss); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- place card ---------- */
.place {
  margin: 0 clamp(16px, 4vw, 40px) 28px; display: grid; grid-template-columns: minmax(240px, 0.9fr) 1.4fr 1fr; gap: 0;
  background: var(--glass); border: 1px solid var(--line); box-shadow: inset 0 1px 0 #fff, 0 2px 10px rgba(60,80,160,.08); border-radius: 10px; overflow: hidden;
}
.place-map iframe { width: 100%; height: 100%; min-height: 300px; border: 0; display: block; filter: saturate(.85); }
.place-info { padding: 22px 24px; border-right: 1px solid var(--line-2); }
.place-info h2 { font-size: var(--step-2); letter-spacing: -0.02em; margin-bottom: 14px; }
.place h3 { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: #2B3D6B; margin: 16px 0 8px; }
.place h3:first-child { margin-top: 0; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 18px; margin: 0; }
.facts dt { font-size: 0.75rem; color: var(--muted); }
.facts dd { margin: 1px 0 0; font-weight: 600; }
.facts dd .muted { font-weight: 400; font-size: var(--step--1); }
.facts dd small { display: block; font-weight: 400; color: var(--muted); font-size: 0.75rem; line-height: 1.35; margin-top: 2px; }
.cite { font-size: 0.65rem; margin-left: 2px; font-weight: 500; }
.cite a { text-decoration: none; color: var(--brass-ink); display: inline-block; min-width: 12px; text-align: center; }
.place-side { padding: 22px 24px; background: rgba(236,241,252,.6); font-size: var(--step--1); }
.links { display: flex; flex-direction: column; gap: 6px; }
.links a { font-weight: 500; display: block; padding: 3px 0; min-height: 24px; }
.sources { margin-top: 18px; }
.sources ol { margin: 0; padding-left: 18px; color: var(--ink-2); }
.sources li { margin-bottom: 6px; line-height: 1.4; }
.sources li:target { background: var(--brass-soft); border-radius: 4px; }
.sources p { margin: 8px 0 0; }

/* ---------- workbench ---------- */
.workbench {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(400px, 520px); gap: 28px; align-items: start;
  padding: 0 clamp(16px, 4vw, 40px) 48px;
}

/* ---------- ledger (inputs) ---------- */
.ledger { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.sec { background: var(--glass); border: 1px solid var(--line); box-shadow: inset 0 1px 0 #fff, 0 2px 10px rgba(60,80,160,.08); border-radius: 10px; }
.sec summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 14px 18px; user-select: none;
}
.sec summary::-webkit-details-marker { display: none; }
.sec summary::before { content: ''; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin-right: 4px; align-self: center; }
.sec[open] summary::before { transform: rotate(45deg); }
.sec-title { font-weight: 700; font-size: 0.78rem; letter-spacing: 0.02em; text-transform: uppercase; color: #2B3D6B; flex: 1; }
.sec-sum { color: var(--muted); font-size: var(--step--1); }
.sec-body { padding: 4px 18px 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 16px; }
.grid.three { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-top: 14px; }
.field label { display: flex; align-items: center; gap: 6px; font-size: var(--step--1); font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field small { display: block; color: var(--muted); font-size: 0.75rem; line-height: 1.35; margin-top: 4px; }
.field small:empty { display: none; }
.field .src { color: var(--brass-ink); }
.field .fact-src { color: var(--deed); }
.est { appearance: none; border: 0; background: var(--brass-soft); color: var(--brass-ink); font-size: 0.6875rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; cursor: pointer; }
.est.off { background: var(--line-2); color: var(--muted); }
.num { display: flex; align-items: center; border: 1px solid #A9B8E0; border-radius: 4px; background: #fff; box-shadow: inset 0 1px 2px rgba(40,60,130,.08); transition: border-color .15s; }
.num:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.num input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 8px 10px; outline: none; }
.num.has-pre input { padding-left: 2px; }
.affix { color: var(--muted); padding: 0 10px; font-size: var(--step--1); }
.num.has-pre .affix:first-child { padding-right: 2px; }
.num input::-webkit-inner-spin-button { opacity: .4; }
select { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; background: var(--surface); }
.ledger.is-cash .loan-only { display: none; }

.rc { margin-top: 18px; padding: 14px; border-radius: 6px; background: rgba(236,241,252,.7); border: 1px solid var(--line-2); }
.rc p { margin: 0 0 10px; font-size: var(--step--1); color: var(--ink-2); }
.rc-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 12px; align-items: center; margin-bottom: 10px; }
.rc-row label { font-size: var(--step--1); font-weight: 600; }
.rc-row label small { display: block; font-weight: 400; color: var(--muted); font-size: 0.72rem; line-height: 1.35; }
.rc-row input { min-width: 0; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 10px; background: var(--surface); }
@media (max-width: 720px) { .rc-row { grid-template-columns: 1fr; } }

.cond { border: 0; padding: 0; margin: 0; }
.cond legend { font-size: var(--step--1); font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.cond small { display: block; margin-top: 6px; color: var(--muted); font-size: var(--step--1); }
.seg-ctl { display: flex; background: var(--btn); border: 1px solid #A9B8E0; border-radius: var(--r-sm); overflow: hidden; flex-wrap: wrap; }
.seg-opt { flex: 1 1 auto; position: relative; }
.seg-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.seg-opt span { display: block; text-align: center; padding: 8px 10px; font-size: var(--step--1); font-weight: 500; border-right: 1px solid var(--line-2); white-space: nowrap; }
.seg-opt:last-child span { border-right: 0; }
.seg-opt input:checked + span { background: var(--sel); color: var(--ink); font-weight: 700; box-shadow: inset 3px 0 0 var(--accent); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--brass); outline-offset: -2px; }
.cost-index { font-size: var(--step--1); color: var(--muted); margin: 14px 0 6px; }

.items { display: flex; flex-direction: column; margin-top: 6px; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.item > label { font-size: var(--step--1); flex: 1; }
.item > label small { display: block; color: var(--muted); font-size: 0.72rem; }
.item .num { width: 132px; flex: none; }
.item.custom .num { border-color: var(--brass); }
.item.total { border-bottom: 0; padding-top: 12px; font-weight: 700; }
.item.check.off > label span { color: var(--muted); }
.item.check.off .num { opacity: .5; }
.chk { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.chk input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.sugg { font-style: normal; font-size: 0.6875rem; color: var(--brass-ink); background: var(--brass-soft); padding: 0 6px; border-radius: 999px; }
.sugg:empty { display: none; }
.items-foot { margin: 10px 0 0; }

/* ---------- results ---------- */
.results {
  position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto;
  background: var(--glass); border: 1px solid var(--line); box-shadow: inset 0 1px 0 #fff, 0 2px 14px rgba(60,80,160,.1); border-radius: 10px; padding: 22px;
  scrollbar-width: thin;
}
.results:focus { outline: none; }
.verdict { display: flex; gap: 18px; align-items: center; }
.grade { width: 76px; height: 76px; flex: none; border-radius: 50%; display: grid; place-content: center; text-align: center; border: 3px solid currentColor; }
.grade span { font-size: 2.1rem; font-weight: 900; line-height: 1; letter-spacing: -0.04em; }
.grade small { font-size: 0.6875rem; font-weight: 600; opacity: .8; }
.grade-A, .grade-B { color: var(--deed); }
.grade-C { color: var(--brass); }
.grade-D, .grade-F { color: var(--loss); }
.hl-label { margin: 0; font-size: var(--step--1); color: var(--muted); font-weight: 600; }
.hl-num { margin: 0; font-size: var(--step-3); font-weight: 800; letter-spacing: -0.035em; line-height: 1.05; }
.hl-sub { margin: 4px 0 0; color: var(--ink-2); font-size: var(--step--1); }

/* The ledger strip: where the rent goes */
.flow { margin: 22px 0 6px; }
.flow-title { margin: 0 0 8px; font-size: var(--step--1); font-weight: 600; color: var(--ink-2); }
.flow-track { display: flex; height: 38px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--paper); }
.seg { min-width: 3px; transition: flex .35s ease; }
.seg-cashflow { background-image: repeating-linear-gradient(135deg, transparent 0 6px, rgba(255,255,255,.12) 6px 12px); }
.flow-short { height: 10px; margin-top: 4px; background: repeating-linear-gradient(135deg, var(--loss) 0 5px, var(--loss-soft) 5px 10px); border-radius: 3px; position: relative; margin-left: auto; }
.flow-short span { position: absolute; right: 0; top: 12px; font-size: 0.72rem; color: var(--loss); font-weight: 600; white-space: nowrap; }
.flow-legend { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px 14px; font-size: 0.78rem; }
.flow-short + .flow-legend { margin-top: 26px; }
.flow-legend li { display: flex; align-items: center; gap: 6px; }
.flow-legend i { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.flow-legend span { flex: 1; color: var(--ink-2); }
.flow-legend b { font-weight: 600; }

.metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line-2); border: 1px solid var(--line-2); border-radius: var(--r-md); overflow: hidden; margin-top: 20px; }
.tile { background: var(--surface); padding: 11px 13px; display: flex; flex-direction: column; }
.tile .k { font-size: 0.75rem; color: var(--muted); font-weight: 600; }
.tile .v { font-size: var(--step-1); font-weight: 750; letter-spacing: -0.01em; }
.tile .h { font-size: 0.7rem; color: var(--muted); line-height: 1.3; }
.tile.good .v { color: var(--deed); }
.tile.ok .v { color: var(--brass); }
.tile.bad .v { color: var(--loss); }
.tile.offer { grid-column: 1 / -1; background: var(--sel); box-shadow: inset 3px 0 0 var(--accent); }
.offer-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--step--1); margin-top: 4px; }
.offer-row select { width: auto; padding: 4px 6px; }
.num.inline { display: inline-flex; width: 104px; }
.num.inline input { padding: 4px 6px; }
.offer-msg { margin: 8px 0 0; font-size: var(--step--1); }

.tabs { display: flex; gap: 2px; margin: 24px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs [role=tab] { appearance: none; border: 0; background: none; padding: 9px 12px; font-weight: 600; font-size: var(--step--1); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs [role=tab][aria-selected=true] { color: var(--ink); border-bottom-color: var(--accent); background: var(--sel); border-radius: 4px 4px 0 0; }
[role=tabpanel] { padding-top: 16px; }
[role=tabpanel] h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: .02em; color: #2B3D6B; margin: 18px 0 6px; }

.notes-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.notes-intro { margin: 0; color: var(--muted); font-size: var(--step--1); max-width: 46ch; }
.notes-actions { display: flex; gap: 6px; }
.summary { font-size: var(--step-0); line-height: 1.6; margin: 14px 0 0; padding: 14px 16px; background: var(--sel); border-radius: 6px; box-shadow: inset 3px 0 0 var(--accent); }
.pros, .cons, .todo, .negot { margin: 0; padding: 0; list-style: none; font-size: var(--step--1); }
.pros li, .cons li, .todo li, .negot li { position: relative; padding: 5px 0 5px 20px; line-height: 1.45; }
.pros li::before, .cons li::before, .todo li::before, .negot li::before { position: absolute; left: 2px; top: 5px; font-weight: 700; }
.pros li::before { content: '+'; color: var(--deed); }
.cons li::before { content: '!'; color: var(--loss); left: 5px; }
.todo li::before { content: ''; width: 9px; height: 9px; border: 1.5px solid var(--ink-2); border-radius: 2px; top: 10px; }
.negot li::before { content: '$'; color: var(--brass); }
.polished { margin-top: 14px; padding: 14px 16px; background: var(--paper); border-radius: var(--r-md); }
.polished > div { white-space: pre-wrap; font-size: var(--step--1); line-height: 1.6; margin: 6px 0 10px; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; resize: vertical; background: var(--surface); }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.proj-sum { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 16px; margin-bottom: 14px; }
.proj-sum span { display: block; font-size: 0.75rem; color: var(--muted); }
.proj-sum b { font-size: var(--step-1); }
.legend-inline { display: flex; gap: 16px; font-size: 0.75rem; color: var(--ink-2); margin-bottom: 4px; }
.legend-inline i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.sw-equity { background: var(--slate); }
.sw-cash { background: var(--deed); }
.proj-svg { width: 100%; height: auto; display: block; }
.proj-svg .gl { stroke: var(--line-2); }
.proj-svg .axis { stroke: var(--ink-2); }
.proj-svg .tick { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.proj-svg .bar-equity { fill: var(--slate); }
.proj-svg .bar-cash { fill: var(--deed); }
.proj-svg .bar-neg { fill: var(--loss); }

.table-wrap { overflow-x: auto; margin-top: 12px; }
.table-wrap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.78rem; }
.tbl th, .tbl td { padding: 6px 8px; text-align: right; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl thead th { color: var(--muted); font-weight: 600; }
.tbl tbody th { font-weight: 500; }
.tbl.plain tr.sub th, .tbl.plain tr.sub td { font-weight: 700; border-top: 1px solid var(--line); }
.tbl.plain tr.tot th, .tbl.plain tr.tot td { font-weight: 800; font-size: var(--step--1); border-bottom: 2px solid var(--ink); }
.tbl.plain tr.muted th, .tbl.plain tr.muted td { color: var(--muted); }
.two { display: grid; grid-template-columns: 1fr; gap: 6px; }

/* ---------- dialog ---------- */
dialog { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; width: min(980px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); }
dialog::backdrop { background: rgba(22, 34, 43, .45); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.dlg-head h2 { font-size: var(--step-2); }
.tbl.saved td small { display: block; color: var(--muted); font-size: 0.7rem; }
.tbl.saved .link { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.78rem; }
.mini-grade { display: inline-grid; place-content: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid currentColor; font-weight: 800; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.empty { color: var(--muted); padding: 20px 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-md); font-size: var(--step--1); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.foot { padding: 24px clamp(16px, 4vw, 40px) 40px; color: var(--muted); font-size: var(--step--1); border-top: 1px solid var(--line); max-width: 110ch; }
.foot p { margin: 0 0 8px; }
.foot-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* ---------- account ---------- */
.btn.account { margin-left: 6px; }
.btn.account.signed-in { background: var(--sel); border-color: #8EA0DD; }
.btn.account.signed-in::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--deed); margin-right: 7px; vertical-align: 1px; }
dialog.small { width: min(440px, calc(100vw - 32px)); }
.acct-form { display: flex; flex-direction: column; gap: 12px; }
.acct-form label { display: flex; flex-direction: column; gap: 5px; font-size: var(--step--1); font-weight: 600; color: var(--ink-2); }
.acct-form input[type=email], .acct-form input[type=password] { border: 1px solid #A9B8E0; border-radius: 4px; padding: 9px 11px; background: #fff; box-shadow: inset 0 1px 2px rgba(40,60,130,.08); }
.acct-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.acct-form .agree { flex-direction: row; font-weight: 400; align-items: flex-start; }
.acct-form .agree input { margin-top: 3px; }
.acct-form .btn.primary { padding: 10px; font-size: var(--step-0); }
.acct-err { margin: 0; color: var(--loss); font-size: var(--step--1); min-height: 0; }
.acct-err:empty { display: none; }
.acct-alt { margin: 0; font-size: var(--step--1); color: var(--muted); }
.fine { font-size: 0.75rem; color: var(--muted); margin: 6px 0 0; line-height: 1.45; }
.acct-actions { display: flex; gap: 8px; margin: 14px 0; }
.danger { margin-top: 10px; border-top: 1px solid var(--line-2); padding-top: 10px; font-size: var(--step--1); }
.danger summary { cursor: pointer; color: var(--loss); font-weight: 600; }
.danger-btn { border-color: var(--loss); color: var(--loss); }

/* ---------- place extras ---------- */
.pill { display: inline-block; font-size: 0.6875rem; font-weight: 600; padding: 0 7px; border-radius: 999px; margin: 2px 2px 0 0; }
.risk-hi { background: var(--loss-soft); color: var(--loss); }
.risk-mid { background: var(--brass-soft); color: var(--brass-ink); }
.risk-lo { background: var(--deed-soft); color: var(--deed); }
.rentcheck { padding: 10px 12px; background: rgba(236,241,252,.7); border: 1px solid var(--line-2); border-radius: 6px; }
.shimmer { background: linear-gradient(90deg, var(--muted) 0%, #AFBBE0 50%, var(--muted) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shim 1.4s linear infinite; }
@keyframes shim { to { background-position: -200% 0; } }
.rc-actions { display: flex; gap: 14px; align-items: center; }

/* ---------- strategies ---------- */
.strat { border: 1px solid var(--line-2); border-radius: 8px; padding: 12px 14px; margin-top: 12px; background: rgba(255,255,255,.7); }
.strat h3 { margin: 0 0 8px !important; }
.strat h3 small { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--muted); margin-left: 6px; }
.kvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 14px; }
.kv span { display: block; font-size: 0.72rem; color: var(--muted); }
.kv b { font-size: var(--step-0); }
.kv.pos b { color: var(--deed); }
.kv.neg b { color: var(--loss); }
.strat-ctl { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; }
.mini { display: flex; align-items: center; gap: 8px; font-size: 0.78rem; color: var(--ink-2); }
.mini .num.inline { width: auto; }
.mini .num.inline input { width: 72px; }
.strat-note { margin: 8px 0 0; font-size: 0.75rem; color: var(--muted); line-height: 1.45; }
.hint-box { margin: 10px 0 0; padding: 8px 12px; border-radius: 6px; background: var(--brass-soft); font-size: 0.78rem; color: #6B4B10; }

/* ---------- risk ---------- */
.risk-sum { margin-top: 14px; }
.hist .hb-gain { fill: var(--deed); opacity: .8; }
.hist .hb-loss { fill: var(--loss); opacity: .8; }
.hist .hb-mixed { fill: var(--brass); opacity: .8; }
.hist .hm { stroke: var(--ink); stroke-dasharray: 3 3; }
.proj-svg .tick.strong { fill: var(--ink); font-weight: 700; }
.tbl.sens { font-size: 0.75rem; }
.tbl.sens caption { text-align: left; color: var(--muted); font-size: 0.72rem; padding-bottom: 6px; }
.tbl.sens td { text-align: center; font-weight: 600; border: 1px solid #fff; }
.tbl.sens th.cur { color: var(--accent-ink); font-weight: 800; }
.tbl.sens td.here { outline: 2px solid var(--ink); outline-offset: -2px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .place { grid-template-columns: 1fr 1.4fr; }
  .place-side { grid-column: 1 / -1; border-top: 1px solid var(--line-2); display: grid; grid-template-columns: 1fr 2fr; gap: 24px; }
  .sources { margin-top: 0; }
}
@media (max-width: 980px) {
  .workbench { grid-template-columns: 1fr; }
  .results { position: static; max-height: none; order: -1; }
  .actions .btn.ghost { padding: 7px 8px; }
}
@media (max-width: 720px) {
  .topbar { flex-direction: column; align-items: stretch; position: static; }
  .actions { justify-content: flex-start; }
  .place { grid-template-columns: 1fr; }
  .place-info { border-right: 0; }
  .place-side { grid-template-columns: 1fr; }
  .place-map iframe { min-height: 220px; }
  .search-box { flex-direction: column; }
  .search-box .btn.big { padding: 12px; }
  .results { padding: 16px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .item .num { width: 112px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .source-strip li { opacity: 1; }
  .source-strip li::before { background: #2E8A5C; }
}

/* ---------- print ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: #fff; font-size: 11px; }
  .topbar, .search, .tabs, .notes-actions, .items-foot, .rc, .skip, .toast, #userNotes:placeholder-shown, .place-map, .lede, .aurora, .landing, .source-strip, .strat-ctl, .foot-links { display: none !important; }
  .workbench { display: block !important; }
  .hero { display: none; }
  .workbench { display: block; padding: 0; }
  .results { position: static; max-height: none; overflow: visible; border: 0; padding: 0; }
  [role=tabpanel] { display: block !important; break-inside: avoid-page; }
  [role=tabpanel][hidden] { display: block !important; }
  .ledger { display: none; }
  .place { border: 1px solid #ccc; grid-template-columns: 1fr 1fr; margin: 0 0 12px; }
  .metrics { break-inside: avoid; }
  .foot { border: 0; padding: 12px 0 0; }
}

/* ---------- legal pages ---------- */
.doc { max-width: 72ch; padding: clamp(24px, 5vw, 56px) clamp(16px, 4vw, 40px) 64px; }
.doc h1 { font-size: var(--step-3); color: #1F2F5C; letter-spacing: -0.02em; }
.doc h2 { font-size: var(--step-1); margin: 28px 0 8px; color: #1F2F5C; }
.doc p, .doc li { line-height: 1.65; color: var(--ink-2); }
.doc ul { padding-left: 20px; }
.doc-meta { color: var(--muted); font-size: var(--step--1); margin-top: 6px; }
.doc-page .actions a { text-decoration: none; }
