/* Layout: navy sidebar + light work area (James's MVP wireframe). Main sections open on a real photo of the
   community; everything else sits on white cards with soft borders. One light look, by request. */
:root {
  --navy-950: #071630; --navy-900: #0B1F3F; --navy-800: #11305E; --navy-700: #1B3F78; --navy-600: #2A5296;
  --blue-700: #1648B0; --blue-600: #1D5BD6; --blue-500: #3A75E6; --blue-100: #DCE7FB; --blue-50: #EEF4FE;
  --green-700: #0B7A4B; --green-100: #D2EFE0; --green-50: #E9F7EF;
  --amber-700: #8F5600; --amber-500: #E19A12; --amber-100: #FBE7C2; --amber-50: #FEF6E6;
  --orange-700: #B04A0D; --orange-50: #FFF0E5;
  --red-700: #B42318; --red-50: #FEEDEB;
  --purple-700: #5A3FC0; --purple-50: #F2EFFE;
  --teal-700: #0A6C77; --teal-50: #E5F4F5;
  --bg: #F3F5F9; --surface: #FFFFFF; --surface-2: #F7F9FC; --line: #E2E7EF; --line-2: #CBD3DF;
  --text: #1D2939; --heading: #0B1F3F; --muted: #5B6A80; --faint: #8693A6;
  --shadow-1: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-2: 0 1px 3px rgba(16, 24, 40, 0.06), 0 10px 28px rgba(16, 24, 40, 0.09);
  --f-sans: "Public Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", Menlo, Consolas, monospace;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px;
  /* names older screens still use */
  --paper: var(--surface); --card: var(--surface); --wash: var(--bg); --ink: var(--text); --head: var(--heading);
  --line-strong: var(--line-2); --teal-600: var(--teal-700); --teal-100: var(--teal-50); --teal-300: #5FB8BF;
  --gold-500: var(--amber-500); --gold-100: var(--amber-50); --gold-800: var(--amber-700);
  --brick-600: var(--red-700); --brick-100: var(--red-50); --on-navy: #FFFFFF; --on-navy-muted: #B8C6DB;
  --f-display: var(--f-sans);
  color-scheme: light;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--f-sans); font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }
h1, h2, h3, h4 { font-family: var(--f-sans); color: var(--heading); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
h1 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 700; line-height: 1.2; }
h2 { font-size: 20px; font-weight: 700; line-height: 1.25; }
h3 { font-size: 16px; font-weight: 650; line-height: 1.3; }
p { margin: 0; }
.label { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.data { font-variant-numeric: tabular-nums; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-between { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-2 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.grid-4 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.hide { display: none !important; }

/* ---------- app frame ---------- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%; }
.rail { background: var(--navy-900); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 12px 12px; gap: 2px; }
.rail .brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 16px; }
.brand-word { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; color: #fff; line-height: 1.1; }
.brand-word small { display: block; font-weight: 500; font-size: 11.5px; color: var(--on-navy-muted); margin-top: 2px; letter-spacing: 0; }
.nav-group { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #8EA2C2; padding: 14px 12px 6px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 12px; border-radius: var(--r-md); color: #DCE5F2; text-decoration: none; font-weight: 500; font-size: 14px; min-height: 38px; }
.nav a svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: rgba(255, 255, 255, 0.07); color: #fff; text-decoration: none; }
.nav a.active { background: var(--navy-700); color: #fff; font-weight: 600; }
.nav a .count { margin-left: auto; background: var(--blue-600); color: #fff; font-size: 11.5px; font-weight: 700; border-radius: 999px; min-width: 22px; text-align: center; padding: 1px 7px; }
.rail .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 10px 4px; border-top: 1px solid rgba(184, 198, 219, 0.16); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--blue-600); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: 0 0 36px; }
.rail .me .who { font-size: 13.5px; line-height: 1.3; min-width: 0; color: #fff; }
.rail .me .who small { color: var(--on-navy-muted); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(255, 255, 255, 0.96); backdrop-filter: saturate(1.4) blur(6px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding-block: 10px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.menu-btn { display: none; }
.town-switch { display: flex; align-items: center; gap: 8px; min-width: 0; }
.town-switch button { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 6px 12px; font-weight: 600; cursor: pointer; min-height: 40px; max-width: 280px; color: var(--heading); }
.town-switch button:hover { border-color: var(--blue-500); }
.town-switch button .ico { stroke: var(--blue-600); width: 18px; height: 18px; }
.town-switch button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask { flex: 1 1 360px; display: flex; align-items: center; min-width: 0; position: relative; max-width: 760px; }
.ask .ask-ico { position: absolute; left: 12px; width: 18px; height: 18px; stroke: var(--faint); pointer-events: none; }
.ask input { flex: 1; min-width: 0; border: 1px solid var(--line-2); border-right: 0; border-radius: var(--r-md) 0 0 var(--r-md); padding: 8px 12px 8px 38px; background: var(--surface-2); min-height: 40px; }
.ask input:focus { background: #fff; border-color: var(--blue-500); outline: none; box-shadow: 0 0 0 3px var(--blue-50); }
.ask button { border-radius: 0 var(--r-md) var(--r-md) 0; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.top-right .avatar { width: 34px; height: 34px; flex-basis: 34px; font-size: 12.5px; }
.view { padding-block: 24px 72px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); max-width: 1360px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }
.view-head { display: flex; flex-wrap: wrap; gap: 14px 16px; align-items: flex-end; justify-content: space-between; }
.view-head > div:first-child { min-width: 0; flex: 1 1 420px; }
.view-head .label { margin-bottom: 4px; }
.view-head .lead { max-width: 76ch; color: var(--muted); margin-top: 6px; font-size: 15px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); font-weight: 500; }
.crumbs a:hover { color: var(--blue-600); }
.crumbs .sep { color: var(--faint); }

/* Photo banner that opens a main section */
.view-head.photo { position: relative; isolation: isolate; min-height: 188px; padding: 28px; border-radius: var(--r-xl); overflow: hidden; align-items: flex-end; background: var(--navy-900) var(--photo) center / cover no-repeat; color: #fff; }
.view-head.photo::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(7, 22, 48, 0.86) 0%, rgba(7, 22, 48, 0.62) 46%, rgba(7, 22, 48, 0.18) 100%); }
.view-head.photo h1, .view-head.photo .label, .view-head.photo .lead { color: #fff; }
.view-head.photo .label { color: #C9D6EA; }
.view-head.photo .lead { color: #E3EAF5; }
.view-head.photo .btn:not(.primary) { background: rgba(255, 255, 255, 0.96); border-color: transparent; }
.photo-credit { position: absolute; right: 12px; bottom: 8px; font-size: 11px; color: rgba(255, 255, 255, 0.82); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); }
.photo-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; min-width: 0; box-shadow: var(--shadow-1); }
.card.raised { box-shadow: var(--shadow-2); }
.card.flat { box-shadow: none; background: var(--surface-2); }
.card h3 + * { margin-top: 10px; }
a.card { color: inherit; display: block; }
a.card:hover { text-decoration: none; border-color: var(--blue-100); box-shadow: var(--shadow-2); }
.card-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-head > a, .card-head .link { font-size: 13px; font-weight: 600; }
.ground { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 8px; }
.source-line { font-size: 12px; color: var(--muted); }
.band { background: var(--navy-900); color: #fff; border-radius: var(--r-xl); padding: 24px; }
.band h1, .band h2, .band h3 { color: #fff; }
.band .label, .band .muted { color: var(--on-navy-muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface); color: var(--heading); font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; box-shadow: var(--shadow-1); }
.btn:hover { background: var(--surface-2); border-color: #B5C0D0; text-decoration: none; }
.btn .ico { width: 17px; height: 17px; stroke: currentColor; }
.btn.primary { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.btn.primary:hover { background: var(--blue-700); border-color: var(--blue-700); }
.btn.outline { border-color: var(--blue-600); color: var(--blue-600); }
.btn.outline:hover { background: var(--blue-50); }
.btn.navy { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }
.btn.navy:hover { background: var(--navy-800); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--blue-600); padding: 0 8px; box-shadow: none; }
.btn.ghost:hover { background: var(--blue-50); }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .flabel { font-weight: 600; font-size: 13.5px; color: var(--heading); }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea, input.inp, select.inp, textarea.inp { border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 8px 12px; background: #fff; min-height: 40px; width: 100%; }
.field input:not([type=checkbox]):not([type=radio]):focus, .field select:focus, .field textarea:focus, .inp:focus { border-color: var(--blue-500); outline: none; box-shadow: 0 0 0 3px var(--blue-50); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--blue-600); flex: 0 0 auto; margin: 0; }
.field textarea, textarea.inp { min-height: 110px; resize: vertical; }
.field .hint { font-size: 12.5px; color: var(--muted); }
.tabs { display: flex; flex-wrap: wrap; gap: 2px 6px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; border: 0; padding: 10px 12px; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; min-height: 42px; }
.tabs button:hover { color: var(--heading); }
.tabs button.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.5; border: 1px solid transparent; }
.pill.linked, .pill.ok, .pill.approved { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.pill.named { background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-100); }
.pill.representative, .pill.estimate, .pill.template, .pill.extracted, .pill.review { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-100); }
.pill.entered, .pill.survey, .pill.computed { background: var(--purple-50); color: var(--purple-700); }
.pill.gap, .pill.attention { background: var(--red-50); color: var(--red-700); }
.pill.neutral { background: var(--surface-2); color: var(--muted); border-color: var(--line); }
.pill.progress { background: var(--amber-50); color: var(--amber-700); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--surface); border: 1px solid var(--line-2); color: var(--text); cursor: pointer; }
.chip:has(input:checked) { background: var(--blue-50); border-color: var(--blue-500); color: var(--blue-700); }
.tag { display: inline-flex; padding: 1px 8px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.stat { display: flex; align-items: center; gap: 14px; }
.stat .v { font-weight: 700; font-size: 26px; color: var(--heading); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 13px; color: var(--muted); display: block; }
.stat .t { display: flex; flex-direction: column; min-width: 0; }
.stat .more { font-size: 12.5px; font-weight: 600; color: var(--blue-600); margin-top: 4px; }
.ic { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 44px; background: var(--blue-50); }
.ic svg { width: 22px; height: 22px; stroke: var(--blue-600); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ic.round { border-radius: 50%; }
.ic.sm { width: 36px; height: 36px; flex-basis: 36px; } .ic.sm svg { width: 18px; height: 18px; }
.ic.solid { background: var(--blue-600); } .ic.solid svg { stroke: #fff; }
.ic.green { background: var(--green-50); } .ic.green svg { stroke: var(--green-700); }
.ic.green.solid { background: var(--green-700); } .ic.green.solid svg { stroke: #fff; }
.ic.amber { background: var(--amber-50); } .ic.amber svg { stroke: var(--amber-700); }
.ic.red { background: var(--red-50); } .ic.red svg { stroke: var(--red-700); }
.ic.purple { background: var(--purple-50); } .ic.purple svg { stroke: var(--purple-700); }
.ic.navy { background: var(--navy-900); } .ic.navy svg { stroke: #fff; }
.list { display: flex; flex-direction: column; }
.list > .li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.list > .li:first-child { border-top: 0; padding-top: 0; }
.list > .li:last-child { padding-bottom: 0; }
.li .grow p { color: var(--muted); }
.li .when { font-size: 12px; color: var(--faint); white-space: nowrap; }
table.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tbl th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl th:first-child { border-top-left-radius: var(--r-md); } .tbl th:last-child { border-top-right-radius: var(--r-md); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl tbody tr:hover td { background: #FAFBFD; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; max-width: 100%; }
.meter { height: 8px; background: #EBEFF5; border-radius: 99px; overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--blue-600); border-radius: 99px; }
.matchbar { display: flex; align-items: center; gap: 8px; }
.matchbar .meter { flex: 1; }
.match { font-weight: 700; font-size: 12.5px; padding: 3px 10px; border-radius: var(--r-sm); background: var(--green-50); color: var(--green-700); white-space: nowrap; font-variant-numeric: tabular-nums; border: 1px solid var(--green-100); }
.match.mid { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-100); }
.match.low { background: var(--orange-50); color: var(--orange-700); border-color: #FBD9C2; }
button.match { font: inherit; font-weight: 700; font-size: 12.5px; cursor: pointer; }
.grade { font-weight: 800; font-size: 32px; line-height: 1; color: var(--heading); min-width: 56px; }
.grade-box { display: grid; place-items: center; width: 60px; height: 60px; border-radius: var(--r-lg); border: 1px solid var(--line-2); background: var(--surface-2); font-weight: 800; }
.grade-box.provisional { border-style: dashed; }
.empty { border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); padding: 24px; color: var(--muted); background: var(--surface-2); }
.note { background: var(--amber-50); color: #6E4300; border: 1px solid var(--amber-100); border-radius: var(--r-md); padding: 10px 14px; font-size: 13.5px; }
.note.teal { background: var(--blue-50); color: var(--navy-800); border-color: var(--blue-100); }
.note.brick { background: var(--red-50); color: var(--red-700); border-color: #F9D0CB; }
.kv { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--heading); font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.steps { display: flex; flex-wrap: wrap; gap: 0; }
.steps .st { flex: 1 1 90px; display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; text-align: center; font-size: 12.5px; color: var(--muted); padding-top: 2px; }
.steps .st::before { content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 2px; background: var(--line); z-index: 0; }
.steps .st:first-child::before { display: none; }
.steps .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); background: #fff; z-index: 1; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.steps .st.done .dot { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.steps .st.done::before, .steps .st.now::before { background: var(--blue-600); }
.steps .st.now .dot { border-color: var(--blue-600); color: var(--blue-600); box-shadow: 0 0 0 4px var(--blue-50); }
.steps .st.now, .steps .st.done { color: var(--heading); font-weight: 600; }
.steps .st small { display: block; font-weight: 400; color: var(--faint); font-size: 11.5px; }
.toast-wrap { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: max(16px, env(safe-area-inset-bottom, 0px)); z-index: 90; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--navy-900); color: #fff; padding: 11px 16px; border-radius: var(--r-md); box-shadow: var(--shadow-2); font-size: 14px; max-width: 380px; }
dialog.modal { border: 0; padding: 0; border-radius: var(--r-xl); background: var(--surface); color: var(--text); width: min(760px, 94vw); max-height: 88vh; box-shadow: 0 24px 64px rgba(7, 22, 48, 0.28); }
dialog.modal::backdrop { background: rgba(7, 22, 48, 0.45); }
.modal-in { padding: 24px; display: flex; flex-direction: column; gap: 14px; max-height: 88vh; overflow: auto; }
.modal-in > * { flex-shrink: 0; }
.thinking { display: inline-flex; gap: 8px; align-items: center; color: var(--muted); }
.thinking::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--blue-600); animation: cv-spin 0.9s linear infinite; }
@keyframes cv-spin { to { transform: rotate(360deg); } }
.factcard { display: flex; flex-direction: column; gap: 4px; }
.factcard .v { font-weight: 700; font-size: 22px; color: var(--heading); line-height: 1.2; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.factcard .l { font-size: 13px; color: var(--muted); font-weight: 500; }
.factcard .s { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin-top: 2px; font-size: 12px; color: var(--muted); }
.factcard .s a { font-weight: 600; }
.qa { border-top: 1px solid var(--line); padding-top: 12px; }
.mono { font-family: var(--f-mono); }
.ico { width: 20px; height: 20px; stroke: var(--blue-600); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.req-row { display: grid; grid-template-columns: 36px minmax(120px, 22%) 1fr auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--line); }
.req-row:first-of-type { border-top: 0; }
.req-row > .ico { width: 22px; height: 22px; margin-top: 2px; }
.site-thumb { width: 120px; height: 84px; border-radius: var(--r-md); flex: 0 0 120px; background: var(--surface-2) center / cover no-repeat; border: 1px solid var(--line); overflow: hidden; }
.site-thumb svg { width: 100%; height: 100%; display: block; }
.selected { border-color: var(--blue-600) !important; box-shadow: 0 0 0 3px var(--blue-50) !important; }
details > summary { cursor: pointer; color: var(--heading); font-weight: 600; min-height: 32px; display: flex; align-items: center; }
fieldset.q legend { padding: 0; }
[hidden] { display: none !important; }
.boot { padding: 48px 16px; max-width: 720px; margin: 0 auto; }
.row .btn.ghost.wrap { white-space: normal; text-align: left; height: auto; min-height: 36px; max-width: 100%; }
.dropzone { border: 1.5px dashed #9FB7E6; background: var(--blue-50); border-radius: var(--r-lg); padding: 26px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); }
.dropzone .ico { width: 34px; height: 34px; }
.dropzone strong { color: var(--heading); }
.choice { text-align: left; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 22px; }
.choice .ic { margin-bottom: 4px; }
.callout { display: flex; gap: 14px; align-items: center; background: var(--blue-50); border: 1px solid var(--blue-100); border-radius: var(--r-lg); padding: 16px 18px; }
.callout .grow p { color: var(--muted); }
.promo { background: var(--navy-800) var(--photo, none) center / cover; color: #fff; border-radius: var(--r-lg); padding: 18px; position: relative; isolation: isolate; overflow: hidden; display: flex; align-items: center; gap: 14px; }
.promo::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(17, 48, 94, 0.95), rgba(29, 91, 214, 0.78)); }
.promo strong { color: #fff; }
.promo .meter { background: rgba(255, 255, 255, 0.25); height: 6px; } .promo .meter > span { background: #fff; }
.badge-count { background: var(--red-50); color: var(--red-700); font-size: 12px; font-weight: 700; border-radius: 999px; padding: 1px 9px; }

/* ---------- home ---------- */
.hero-home { position: relative; isolation: isolate; border-radius: var(--r-xl); overflow: hidden; min-height: 248px; padding: 30px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 320px); gap: 24px; align-items: center; background: var(--navy-900) var(--photo) center / cover no-repeat; color: #fff; }
.hero-home::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(7, 22, 48, 0.82) 0%, rgba(7, 22, 48, 0.5) 55%, rgba(7, 22, 48, 0.25) 100%); }
.hero-home h1 { color: #fff; font-size: clamp(26px, 3vw, 34px); }
.hero-home .sub { color: #E3EAF5; margin-top: 6px; font-size: 16px; }
.hero-home form { margin-top: 18px; display: flex; max-width: 560px; position: relative; }
.hero-home form .ico { position: absolute; left: 14px; top: 12px; stroke: var(--faint); }
.hero-home form input { flex: 1; min-width: 0; border: 0; border-radius: var(--r-md) 0 0 var(--r-md); padding: 10px 12px 10px 42px; min-height: 46px; background: #fff; color: var(--text); }
.hero-home form button { border-radius: 0 var(--r-md) var(--r-md) 0; min-height: 46px; }
.hero-home .place { background: rgba(7, 22, 48, 0.72); border: 1px solid rgba(255, 255, 255, 0.16); border-radius: var(--r-lg); padding: 16px 18px; backdrop-filter: blur(4px); }
.hero-home .place h3 { color: #fff; margin-bottom: 10px; }
.hero-home .place .kv dt { color: #B8C6DB; } .hero-home .place .kv dd { color: #fff; }
.hero-home .place .btn { margin-top: 14px; background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.5); box-shadow: none; }
.hero-home .place .btn:hover { background: rgba(255, 255, 255, 0.1); }

/* ---------- model panel ---------- */
.model-shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 16px; align-items: start; }
.model-nav { position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; display: flex; flex-direction: column; gap: 1px; max-height: calc(100vh - 96px); overflow: auto; box-shadow: var(--shadow-1); }
.model-nav .g { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: 12px 10px 4px; }
.model-nav button { text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: var(--r-md); cursor: pointer; font-weight: 500; font-size: 13.5px; color: var(--text); }
.model-nav button:hover { background: var(--surface-2); color: var(--heading); }
.model-nav button.active { background: var(--blue-50); color: var(--blue-700); font-weight: 650; }
#model-park { display: none; }
#model-host { overflow-x: auto; }

/* ---------- twin ---------- */
.twin-shell { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.twin-stage { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); }
.twin-stage canvas { display: block; width: 100%; height: auto; touch-action: none; cursor: grab; }
.twin-tools { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.twin-tools .tool { min-height: 36px; padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: #fff; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text); display: inline-flex; align-items: center; gap: 6px; }
.twin-tools .tool.on { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.twin-time { padding: 12px 14px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; background: var(--surface); }
.twin-time input[type=range] { width: 100%; accent-color: var(--blue-600); min-height: 32px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 12.5px; color: var(--muted); padding: 8px 14px; border-top: 1px solid var(--line); background: var(--surface); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; border: 1px solid rgba(0, 0, 0, 0.12); }
.rci { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; align-items: end; height: 90px; }
.rci > div { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: 11.5px; color: var(--muted); }
.rci .bar { width: 26px; border-radius: 4px 4px 0 0; background: var(--navy-700); min-height: 3px; }
.rci .bar.c { background: var(--blue-500); } .rci .bar.i { background: var(--amber-500); }

/* ---------- sign in ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: #fff; }
.login .art { position: relative; isolation: isolate; background: var(--navy-900) var(--photo) center / cover no-repeat; color: #fff; display: flex; flex-direction: column; justify-content: space-between; padding: 40px; gap: 24px; min-width: 0; min-height: 520px; }
.login .art::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(7, 22, 48, 0.25) 0%, rgba(7, 22, 48, 0.1) 40%, rgba(7, 22, 48, 0.88) 100%); }
.login .art h1 { color: #fff; font-size: clamp(30px, 3.6vw, 44px); line-height: 1.12; }
.login .art p { color: #E3EAF5; max-width: 44ch; margin-top: 12px; font-size: 15.5px; }
.login .panel { display: flex; align-items: center; justify-content: center; padding-block: 40px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); background: #fff; }
.login .box { width: min(420px, 100%); display: flex; flex-direction: column; gap: 16px; }
.login .box .brandline { display: flex; align-items: center; gap: 10px; color: var(--heading); font-weight: 700; font-size: 20px; }
.login .box h2 { font-size: 26px; }
.login .who-card { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 12px 14px; background: var(--surface-2); }
.login .btn.primary { min-height: 46px; font-size: 15px; }
.code-boxes { display: flex; gap: 10px; justify-content: center; }
.code-boxes input { width: 48px; height: 56px; text-align: center; font-size: 22px; font-weight: 700; border: 1px solid var(--line-2); border-radius: var(--r-md); }
.code-boxes input:focus { border-color: var(--blue-500); outline: none; box-shadow: 0 0 0 3px var(--blue-50); }
.mfa-shield { width: 56px; height: 56px; border-radius: 50%; background: var(--blue-50); display: grid; place-items: center; margin: 0 auto; }
.mfa-shield svg { width: 30px; height: 30px; stroke: var(--blue-600); fill: none; stroke-width: 1.8; }

/* ---------- survey taker ---------- */
.q { padding: 14px 0; border-top: 1px solid var(--line); }
.q:first-child { border-top: 0; }
.scale { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.scale label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); border-radius: var(--r-md); padding: 6px 12px; cursor: pointer; min-height: 40px; background: #fff; }
.scale label:has(input:checked) { border-color: var(--blue-600); background: var(--blue-50); }
.bars .b { display: grid; grid-template-columns: minmax(80px, 34%) 1fr 48px; gap: 10px; align-items: center; font-size: 13px; padding: 4px 0; }
.bars .b .meter { height: 10px; }
.bars .b .meter > span { background: var(--navy-700); }
.bars .b.hi .meter > span { background: var(--blue-600); }

@media (max-width: 1100px) { .twin-shell { grid-template-columns: 1fr; } .hero-home { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 60; inset: 0 auto 0 0; width: 272px; transform: translateX(-100%); transition: transform 0.2s ease; padding-top: max(16px, env(safe-area-inset-top, 0px)); padding-left: max(12px, env(safe-area-inset-left, 0px)); }
  .rail.open { transform: none; box-shadow: var(--shadow-2); }
  .menu-btn { display: inline-flex; }
  .model-shell { grid-template-columns: 1fr; }
  .model-nav { position: static; max-height: none; flex-direction: row; flex-wrap: wrap; }
  .model-nav .g { width: 100%; }
  .login { grid-template-columns: 1fr; }
  .login .art { min-height: 300px; }
  .req-row { grid-template-columns: 28px 1fr; }
  .req-row > :nth-child(3), .req-row > :nth-child(4) { grid-column: 2; }
  .req-row > .match { justify-self: start; }
  .ask { flex-basis: 100%; order: 3; }
  .topbar { flex-wrap: wrap; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .view { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .view-head.photo, .hero-home { padding: 20px; }
}
@media (max-width: 640px) { .card { overflow-x: auto; } .site-thumb { width: 88px; height: 64px; flex-basis: 88px; } .top-right .avatar { display: none; } }
@media (min-width: 901px) { .menu-btn { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .rail { transition: none; } .thinking::before { animation: none; } }
.town-opt { display: flex; gap: 10px; align-items: center; cursor: pointer; padding: 12px 14px; box-shadow: none; }
.town-opt:hover { border-color: var(--blue-100); }
.town-opt:has(input:checked) { border-color: var(--blue-600); background: var(--blue-50); }
.setup-card { max-width: 1040px; }
.home-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr); }
@media (max-width: 1200px) { .home-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); } }
.hero-home { padding-bottom: 34px; }
.hero-home .photo-credit { right: 14px; bottom: 8px; }
.login .art .photo-credit { left: auto; right: 14px; bottom: 10px; }
.promo .btn { background: #fff; color: var(--navy-900); border-color: #fff; }
.search-in { position: relative; display: flex; align-items: center; min-width: 200px; }
.search-in .ico { position: absolute; left: 11px; width: 17px; height: 17px; stroke: var(--faint); }
.search-in input { padding-left: 36px !important; }
.fund-row { align-items: flex-start !important; }
.fund-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; min-width: 130px; text-align: right; }
@media (max-width: 640px) { .fund-row { flex-wrap: wrap; } .fund-side { align-items: flex-start; text-align: left; flex-basis: 100%; padding-left: 56px; } }
.site-row { align-items: flex-start !important; }
.dropzone { cursor: pointer; }
.dropzone.over, .dropzone:hover { border-color: var(--blue-600); background: #E4EDFD; }
.data-split { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 16px; align-items: start; }
.data-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; max-height: 520px; overflow-y: auto; }
.data-list button { text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--line); padding: 10px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.data-list button:last-child { border-bottom: 0; }
.data-list button span { font-weight: 600; font-size: 13.5px; color: var(--heading); }
.data-list button small { color: var(--muted); font-size: 12px; }
.data-list button:hover { background: var(--surface-2); }
.data-list button.active { background: var(--blue-50); box-shadow: inset 3px 0 0 var(--blue-600); }
.data-detail .factcard .v { font-size: 26px; }
@media (max-width: 760px) { .data-split { grid-template-columns: 1fr; } .data-list { max-height: 260px; } }
.status-sel { font-weight: 600; }
.status-sel.st-needs-response { background: var(--red-50); color: var(--red-700); border-color: #F9D0CB; }
.status-sel.st-in-progress { background: var(--amber-50); color: var(--amber-700); border-color: var(--amber-100); }
.status-sel.st-completed { background: var(--green-50); color: var(--green-700); border-color: var(--green-100); }
.status-sel.st-not-started { background: var(--surface-2); color: var(--muted); }
.check-link { font-size: 12px; font-weight: 600; color: var(--blue-600); white-space: nowrap; }
.check-link:hover { text-decoration: underline; }
.ask .ask-ico, .search-in .ico, .hero-home form .ico { fill: none; stroke: var(--faint); stroke-width: 1.8; stroke-linecap: round; }
.card.stat { display: flex; }
.view-head.photo .photo-credit { top: 10px; bottom: auto; }
.view-head.photo > div:first-child { padding-top: 14px; }
#cvm .emo-gone { display: none !important; }
#cvm .site-tag.priority-undefined { display: none !important; }
.hero-home > div { min-width: 0; }
@media (max-width: 640px) {
  .grid-4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .card.stat { flex-direction: column; align-items: flex-start; gap: 10px; padding: 16px; }
  .hero-home .photo-credit, .view-head.photo .photo-credit { position: static; display: block; margin-top: 8px; grid-column: 1 / -1; }
  .view-head.photo > div:first-child { padding-top: 0; }
  .site-row { flex-wrap: wrap; }
  .site-row > .grow { flex: 1 1 calc(100% - 104px); }
  .site-row > .btn { margin-left: 100px; }
  .steps .st small { display: none; }
  .hero-home form button { padding: 0 12px; }
}
.next-step { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.town-thumb { width: 64px; height: 46px; border-radius: 6px; background: var(--surface-2) center / cover no-repeat; flex: 0 0 64px; border: 1px solid var(--line); }
.town-opt .town-thumb { width: 52px; height: 40px; flex-basis: 52px; }
