/* Civic Pulse app. EE design system rev 3 (DESIGN.md): paper canvas, white cards, DM Sans, green accent from the design set. */
:root {
  --bg: #F5F3EE; --surface: #FFFFFF; --text: #14243A; --muted: #526174; --line: #DDD9D0;
  --accent: #087A50; --accent-deep: #0A5C3D; --mint: #EEF6F1; --mint-line: #CFE6D8; --orange: #FF7A1A;
  --ok: #087A50; --warn: #9A6518; --err: #B42318;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --enter: cubic-bezier(.22, 1, .36, 1);
  --bar-h: 64px; --rail-w: 232px; --tab-h: 68px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 18px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
svg[aria-hidden="true"] { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.tnum { font-variant-numeric: tabular-nums; font-weight: 500; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 10px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid rgba(8, 122, 80, .4); outline-offset: 2px; }

/* Bar */
.bar { position: sticky; top: 0; z-index: 20; height: var(--bar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px; padding-top: env(safe-area-inset-top, 0); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 19px; }
.brand img { width: 30px; height: 30px; }
.bar-sp { flex: 1; }
.bar-link { font-size: 16px; font-weight: 500; text-decoration: none; padding: 8px 4px; }

/* Shell */
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: calc(100vh - var(--bar-h)); }
.rail { position: sticky; top: var(--bar-h); align-self: start; height: calc(100vh - var(--bar-h)); display: flex; flex-direction: column; gap: 2px; padding: 20px 12px; border-right: 1px solid var(--line); }
.rail a { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 17px; font-weight: 500; transition: background-color .16s, color .16s; }
.rail a:hover { background: rgba(20, 36, 58, .05); color: var(--text); }
.rail a[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(20, 36, 58, .06); }
.rail .rail-cities { margin-top: auto; }
.view { padding: 40px 48px 64px; max-width: 980px; width: 100%; outline: none; }
.view > * { animation: viewIn .26s var(--enter) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.foot { padding: 20px 24px 28px calc(var(--rail-w) + 48px); font-size: 14px; color: var(--muted); }

/* Type */
h1 { font-size: clamp(32px, 4vw, 44px); line-height: 1.08; font-weight: 500; letter-spacing: -0.01em; margin: 0 0 24px; }
h2 { font-size: 22px; line-height: 1.2; font-weight: 600; margin: 0; }
.meta { color: var(--muted); font-size: 15px; }
.lede { color: var(--muted); font-size: 18px; margin: -12px 0 24px; max-width: 52ch; }
.city-eyebrow { margin: 0 0 14px; color: var(--accent); font-size: 14px; font-weight: 600; }
.city-intro { padding-bottom: 8px; }
.city-intro h1 { max-width: none; font-size: clamp(32px, 4vw, 44px); }
.city-story { border-top: 1px solid var(--line); padding: 30px 0; }
.city-story h2 { max-width: 30ch; font-size: clamp(24px, 3vw, 30px); }
.city-story p { max-width: 61ch; }
.city-path { padding: 0; list-style: none; counter-reset: city-step; }
.city-path li { counter-increment: city-step; position: relative; padding: 20px 0 20px 46px; border-bottom: 1px solid var(--line); }
.city-path li::before { content: counter(city-step, decimal-leading-zero); position: absolute; left: 0; top: 22px; color: var(--accent); font-size: 15px; font-variant-numeric: tabular-nums; }
.city-path strong, .city-path span { display: block; }
.city-path span { max-width: 55ch; margin-top: 5px; color: var(--muted); font-size: 17px; }
.city-film-title { margin: 12px 0 20px; }
#civic-city-film, #city-pilot-options { scroll-margin-top: calc(var(--bar-h) + 20px); }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 17px; font-weight: 500; text-decoration: none; cursor: pointer; transition: transform .12s var(--enter), background-color .16s, border-color .16s; }
.btn:hover { border-color: #c9c4b8; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; border-radius: 10px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { background: rgba(20, 36, 58, .06); color: var(--text); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field legend { font-size: 15px; font-weight: 500; }
.field input, .field select, .field textarea { min-height: 52px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 18px; width: 100%; }
.field textarea { min-height: 112px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 122, 80, .25); }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.form { display: grid; gap: 16px; max-width: 560px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; }
.check input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--accent); flex: none; }
.status { min-height: 1.5em; font-size: 16px; }
.status:empty { min-height: 0; margin: 0; }
.status.ok { color: var(--ok); } .status.err { color: var(--err); }

/* Start */
.zip-row { display: flex; gap: 12px; align-items: flex-end; max-width: 420px; margin-bottom: 4px; }
.zip-row + .status { margin: 0 0 20px; }
.zip-row .field { flex: 1; }

/* Rows */
.list-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.rows { background: var(--surface); border-radius: 20px; overflow: hidden; }
.row { display: flex; align-items: center; gap: 16px; width: 100%; padding: 18px 22px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; transition: background-color .14s; }
.row:first-child { border-top: 0; }
.row:hover { background: #FBFAF7; }
.row .main { flex: 1; min-width: 0; }
.row .t { display: block; font-size: 18px; font-weight: 600; line-height: 1.3; }
.row .s { display: block; font-size: 15px; color: var(--muted); margin-top: 2px; }
.row .r { text-align: right; font-size: 15px; color: var(--muted); white-space: nowrap; }
.row .chev { color: var(--muted); width: 18px; height: 18px; }
.label { display: inline-block; font-size: 14px; font-weight: 500; padding: 2px 8px; border-radius: 6px; border: 1px solid currentColor; }
.label.warn { color: var(--warn); } .label.ok { color: var(--ok); } .label.info { color: var(--accent); }
.more { margin-top: 16px; }
.empty { background: var(--surface); border-radius: 20px; padding: 32px; }
.empty p { margin: 0 0 16px; color: var(--muted); }
.skel { height: 74px; border-top: 1px solid var(--line); background: linear-gradient(90deg, transparent, rgba(20, 36, 58, .04), transparent) 0 0 / 200% 100%; animation: skel 1.2s linear infinite; }
.skel:first-child { border-top: 0; }
@keyframes skel { to { background-position: -200% 0; } }
.note { font-size: 15px; color: var(--muted); margin: 0 0 16px; }

/* Local help */
.plot-wrap { background: var(--surface); border-radius: 20px; padding: 16px; margin-bottom: 20px; }
/* isolation keeps Leaflet's panes (z-index 400+) under the sticky bar and tab bar */
.map { height: 380px; border-radius: 14px; overflow: hidden; position: relative; z-index: 0; isolation: isolate; background: #EEECE6; }
.map .leaflet-tooltip { font-family: var(--sans); font-size: 14px; }
.map .leaflet-tile-pane { filter: grayscale(.65) brightness(1.04) contrast(.92); }
@media (max-width: 820px) { .map { height: 280px; } }
.plot { width: 100%; height: auto; display: block; max-height: 360px; }
.plot circle.ring { fill: none; stroke: var(--line); stroke-width: 1; }
.plot text { font-family: var(--sans); font-size: 12px; fill: var(--muted); stroke: none; }
.plot .dot { stroke: #fff; stroke-width: 1.5; }
.dot.capital, .key .capital { fill: var(--accent); background: var(--accent); }
.dot.coaching, .key .coaching { fill: var(--orange); background: var(--orange); }
.dot.community, .key .community { fill: #526174; background: #526174; }
.plot .you { fill: var(--text); }
.key { display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--muted); margin-top: 8px; }
.key i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* Readiness */
.step-count { font-size: 15px; color: var(--muted); margin-bottom: 8px; }
.choices { display: grid; gap: 12px; max-width: 560px; margin-bottom: 24px; }
.choice { display: flex; align-items: center; min-height: 64px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; font-weight: 500; text-align: left; cursor: pointer; transition: border-color .14s, background-color .14s; }
.choice:hover { border-color: #c9c4b8; }
.choice[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.result { background: var(--surface); border-radius: 20px; padding: 28px; max-width: 640px; margin-bottom: 24px; }
.result .score { font-size: 64px; line-height: 1; font-weight: 500; color: var(--ok); }
.result h2 { margin: 12px 0 8px; }
.result p { margin: 0; color: var(--muted); }

/* For cities */
.video { position: relative; aspect-ratio: 16 / 9; border-radius: 20px; overflow: hidden; background: #0B0F1A; margin-bottom: 28px; }
.video button { position: absolute; inset: 0; width: 100%; border: 0; padding: 0; cursor: pointer; background: #0B0F1A center / cover no-repeat; color: #fff; }
.video button span { position: absolute; left: 24px; bottom: 20px; display: inline-flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 500; background: rgba(11, 15, 26, .7); padding: 10px 16px; border-radius: 10px; }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }
.video video { width: 100%; height: 100%; display: block; object-fit: contain; }
.price { font-size: 20px; font-weight: 500; white-space: nowrap; color: var(--text); }
.row.static { cursor: default; }
.row.static:hover { background: transparent; }
.cities-actions { margin: 28px 0 8px; }

/* Sheet */
.sheet { width: min(560px, 100vw); max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0 0 0 auto; padding: 0; border: 0; background: var(--bg); color: var(--text); box-shadow: -12px 0 40px rgba(11, 15, 26, .12); }
.sheet[open] { animation: sheetIn .32s var(--enter) both; }
.sheet::backdrop { background: rgba(11, 15, 26, .32); }
@keyframes sheetIn { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 20px 12px 28px; background: var(--bg); }
.sheet-body { padding: 4px 28px 40px; }
.sheet-body p { margin: 0 0 16px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 24px; font-size: 16px; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; }

@media (max-width: 820px) {
  :root { --bar-h: 56px; }
  body { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0)); }
  .bar { padding: 0 16px; }
  .shell { display: block; }
  .rail { position: fixed; z-index: 20; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0)); border-right: 0; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); }
  .rail a { flex: 1; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 0 2px; font-size: 12px; }
  .rail a[aria-current="page"] { background: transparent; box-shadow: none; }
  .rail a[data-view="readiness"], .rail .rail-cities, .rail .rail-admin { display: none; }
  .view { padding: 24px 16px 32px; }
  .foot { padding: 8px 16px 24px; }
  .filters { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
  .filters .field:nth-child(3) { grid-column: 1 / -1; }
  .plot text { font-size: 22px; }
  .row { padding: 16px; }
  .row .r { display: none; }
  .sheet { width: 100vw; height: auto; max-height: 88dvh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .sheet[open] { animation-name: sheetUp; }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
  .sheet-head { padding: 16px 12px 8px 20px; }
  .sheet-body { padding: 4px 20px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .view > *, .sheet[open] { animation: fade .15s linear both; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  .skel { animation: none; }
}

/* Setup Assistant (first visit): full screen, one step per viewport */
.link-btn { border: 0; background: none; padding: 8px 4px; color: var(--accent); font-size: 16px; font-weight: 500; cursor: pointer; text-decoration: none; }
.btn.wide { width: 100%; max-width: 560px; }
body.setup-mode .bar, body.setup-mode .rail, body.setup-mode .foot { display: none; }
body.setup-mode { padding-bottom: 0; }
body.setup-mode .shell { display: block; min-height: 100dvh; }
body.setup-mode .view { max-width: 560px; margin: 0 auto; padding: 0 20px; }
.setup { min-height: 100dvh; display: flex; flex-direction: column; }
.setup-top { display: flex; align-items: center; gap: 12px; padding: calc(12px + env(safe-area-inset-top, 0)) 0 0; }
.progress { flex: 1; display: flex; gap: 6px; }
.progress i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); transition: background-color .3s var(--enter); }
.progress i.on { background: var(--accent); }
.setup-body { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 32px 0 calc(40px + env(safe-area-inset-bottom, 0)); }
.setup-body h1 { margin-bottom: 28px; }
.setup-body .choices { max-width: none; }
.hello { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.hello-mark { width: 112px; height: 112px; margin-bottom: 16px; animation: markIn .7s var(--enter) both; }
.hello h1 { font-size: clamp(56px, 12vw, 96px); margin: 0 0 40px; animation: viewIn .5s var(--enter) .35s both; }
.hello .btn { animation: viewIn .4s var(--enter) .6s both; }
@keyframes markIn { from { opacity: 0; transform: scale(.82) rotate(-8deg); } to { opacity: 1; transform: none; } }
.boot { text-align: center; }
.boot h1 { font-size: 28px; }
.boot-line { height: 3px; max-width: 240px; margin: 0 auto; border-radius: 2px; background: var(--line); overflow: hidden; }
.boot-line i { display: block; height: 100%; background: var(--accent); animation: bootFill 1s var(--enter) both; }
@keyframes bootFill { from { width: 0; } to { width: 100%; } }
/* Grain only as boot material: under 500 ms, never under running text. */
body.grain::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 60; opacity: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
  animation: grain .45s steps(4) both; }
@keyframes grain { 0% { opacity: .5; } 100% { opacity: 0; } }

/* Home dashboard */
.dash-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dash-head h1 { margin-bottom: 16px; }
.next { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 24px; margin-bottom: 20px; border-radius: 20px; background: var(--accent); color: #fff; text-decoration: none; font-size: 19px; font-weight: 500; transition: transform .16s var(--enter); }
.next:hover { transform: translateY(-2px); }
.next strong { flex: none; font-weight: 600; padding: 10px 16px; border-radius: 10px; background: rgba(255, 255, 255, .16); }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.card { background: var(--surface); border-radius: 20px; padding: 20px 22px 8px; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.card-head h2 { font-size: 20px; }
.card-head a { font-size: 15px; font-weight: 500; text-decoration: none; }
.card > .meta { margin: 2px 0 8px; }
.card .row { padding: 12px 0; }
.card .row .t { font-size: 16px; font-weight: 500; }
.card .row .r { display: block; font-size: 14px; }
.card-empty { margin: 4px 0 14px; font-size: 16px; }
.card-empty a { font-weight: 500; text-decoration: none; }
.mini-score { display: flex; align-items: baseline; gap: 12px; margin: 4px 0 14px; font-size: 17px; color: var(--muted); }
.mini-score span { font-size: 44px; line-height: 1; color: var(--ok); }

@media (max-width: 820px) {
  .dash { grid-template-columns: 1fr; gap: 12px; }
  .next { padding: 18px 20px; font-size: 17px; }
  .card { padding: 16px 18px 6px; }
  .card .row .r { max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
  .card .row:nth-of-type(n+3) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hello-mark, .hello h1, .hello .btn, .boot-line i { animation: fade .15s linear both; }
  body.grain::after { animation: none; }
}
@media (prefers-reduced-transparency: reduce) { body.grain::after { display: none; } }

.biz-stage { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin: 6px 0 4px; font-size: 16px; }

/* City view (staff) */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border-radius: 16px; padding: 16px 18px; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.kpi span { font-size: 32px; line-height: 1.1; color: var(--text); }
.card.wide { grid-column: 1 / -1; }
.bars { list-style: none; margin: 12px 0 14px; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 112px 1fr 36px; align-items: center; gap: 12px; font-size: 15px; }
.bars .bl { color: var(--muted); }
.bars .bt { height: 10px; background: #F1EFE9; border-radius: 4px; overflow: hidden; }
.bars .bt i { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bars .bv { text-align: right; }
.notes { margin: 0 0 20px; padding-left: 18px; font-size: 16px; }
@media (max-width: 820px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi:last-child { grid-column: 1 / -1; }
  .rail .rail-city { display: none; }
  .card.wide .row:nth-of-type(n+3) { display: flex; }
}

/* Account step, list and saved */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hello-mark.small { width: 72px; height: 72px; }
.hello .save-h { font-size: clamp(34px, 7vw, 48px); margin: 0 0 8px; }
.hello .lede { margin: 0 0 32px; }
.hello .link-btn { margin-top: 8px; }
.dash-acts { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.todo-add { display: flex; gap: 8px; align-items: center; margin: 4px 0 6px; }
.todo-add input { flex: 1; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 17px; }
.todo-add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 122, 80, .25); }
.todo-add .icon-btn { background: var(--accent); color: #fff; }
.todo-add .icon-btn:hover { background: var(--accent-deep); color: #fff; }
.todos { list-style: none; margin: 0 0 8px; padding: 0; }
.todos li { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line); min-height: 52px; }
.todos li:first-child { border-top: 0; }
.todos label { flex: 1; display: flex; align-items: center; gap: 12px; font-size: 16px; cursor: pointer; padding: 8px 0; }
.todos input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.todos li.done span { color: var(--muted); text-decoration: line-through; }
.todos .icon-btn { width: 36px; height: 36px; opacity: .6; }
.todos .icon-btn:hover { opacity: 1; }
.saved-row { padding: 10px 0; }
.saved-row .main { text-decoration: none; color: var(--text); }
.saved-row .icon-btn { width: 36px; height: 36px; }
.btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* Admin view */
.inline-add { display: grid; grid-template-columns: 1fr 160px auto; gap: 10px; align-items: end; margin: 4px 0 6px; }
.seat { font-size: 15px; color: var(--muted); }
.rm { border: 0; background: none; font: inherit; font-size: 15px; color: var(--muted); text-decoration: underline; display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; cursor: pointer; }
.rm:hover { color: var(--text); }
.kv { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 16px; }
.kv:first-of-type { border-top: 0; }
.imp-step { margin: -4px 0 8px; }
.imp-h { font-size: 18px; margin: 24px 0 8px; }
.imp-map { grid-template-columns: 1fr 1fr; gap: 10px 12px; max-width: none; }
.imp-map .field label { font-size: 14px; }
.imp-map .imp-foot { grid-column: 1 / -1; }
.imp-foot { position: sticky; bottom: 0; z-index: 1; margin: 16px 0 0; padding: 12px 0 16px; border-top: 1px solid var(--line); background: var(--bg); }
.imp-foot .status { margin: 0 0 8px; }
.imp-dl { min-height: 44px; }
.imp-warn { color: var(--warn); }
.field input[type="file"] { padding: 8px; cursor: pointer; }
.field input[type="file"]::file-selector-button { min-height: 36px; margin-right: 12px; padding: 0 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 16px; font-weight: 500; cursor: pointer; }
.imp-table { overflow-x: auto; margin: 0 0 8px; border-radius: 10px; background: var(--surface); }
.imp-table:focus-visible { outline: 3px solid rgba(0, 82, 255, .4); }
.imp-table table { width: 100%; border-collapse: collapse; font-size: 15px; }
.imp-table th, .imp-table td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); white-space: nowrap; }
.imp-table th { color: var(--muted); font-weight: 500; border-top: 0; }
.imp-probs { list-style: none; margin: 0 0 8px; padding: 0; font-size: 16px; }
.imp-probs li { padding: 10px 0; border-top: 1px solid var(--line); }
.imp-probs li:first-child { border-top: 0; }
.imp-probs .tnum { color: var(--muted); margin-right: 6px; }
.card-head + .kv, .card-head + .row { border-top: 0; }
.card .row.static .label { flex: none; }
@media (max-width: 820px) { .inline-add { grid-template-columns: 1fr; } .card .row.static { flex-wrap: wrap; gap: 0 12px; } .card .row.static .main { flex: 1 1 100%; } .dash > * { min-width: 0; } }
.meta.you { padding: 0 4px; }
.dash-acts .link-btn { min-height: 44px; display: inline-flex; align-items: center; }

/* city side / owner side */
.bar-btn { min-height: 44px; padding: 0 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--accent); font-size: 16px; font-weight: 500; cursor: pointer; }
.bar-btn:hover { border-color: #c9c4b8; }
body.city-mode [data-side="owner"] { display: none; }
.city-pick { min-height: 44px; max-width: 220px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 16px; }
@media (max-width: 820px) {
  body.city-mode .rail .rail-city:not([hidden]), body.city-mode .rail .rail-msgs:not([hidden]), body.city-mode .rail .rail-admin:not([hidden]) { display: flex; }
  .city-pick { max-width: 100%; }
}

/* Messages: thread, bubbles, day separators, composer (mockup messages.html). Owner bubbles right, the other side left. */
.back { display: inline-flex; align-items: center; min-height: 44px; margin: -8px 0 8px; }
.thread-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 640px; }
.thread-head h1, .thread-head h2 { margin-bottom: 16px; }
.context { font-size: 15px; color: var(--muted); margin: -8px 0 16px; }
.older { margin-bottom: 12px; }
.thread { display: flex; flex-direction: column; gap: 10px; max-width: 640px; margin-bottom: 120px; outline: none; }
.msg { max-width: 82%; padding: 12px 16px; border-radius: 16px; background: var(--surface); font-size: 18px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg .who { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; white-space: normal; }
.msg.me { align-self: flex-end; border: 1px solid var(--accent); border-bottom-right-radius: 6px; }
.msg.them { align-self: flex-start; border-bottom-left-radius: 6px; }
.day { align-self: center; font-size: 13px; color: var(--muted); margin: 6px 0; }
.composer { position: fixed; z-index: 15; left: var(--rail-w); right: 0; bottom: 0; padding: 12px 48px 12px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.composer-row { display: flex; gap: 10px; align-items: flex-end; max-width: 640px; }
.composer textarea { flex: 1; min-height: 52px; max-height: 200px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 18px; line-height: 1.45; resize: none; }
.composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 122, 80, .25); }
.composer .topic { max-width: 640px; margin-bottom: 10px; }
.composer-foot { display: flex; justify-content: space-between; gap: 12px; max-width: 640px; }
.composer-foot .status { margin: 4px 0 0; }
.composer-foot .meta:empty { display: none; }
.composer-foot .link-btn { min-height: 44px; }
.msg-rows .row { text-decoration: none; color: var(--text); }
.msg-rows .row .t { font-weight: 400; }
.msg-rows .row.unread .t { font-weight: 600; }
@media (max-width: 820px) {
  .composer { left: 0; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); padding: 10px 16px; }
  .thread { margin-bottom: 160px; }
  .msg-rows .row .r { display: block; }
}

/* Staff inbox (city side): the list and the open thread side by side on desktop; on phones the thread is its own screen. */
.msg-rows .row[aria-current="true"], .msg-rows .row[aria-current="true"]:hover { background: var(--bg); box-shadow: inset 0 0 0 1px #c9c4b8; } /* not a colored bar */
.more { margin-top: 12px; }
.thread.ro { margin-bottom: 16px; } /* no composer below */
.notice { max-width: 640px; margin: 0 0 32px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); font-size: 16px; }
@media (min-width: 821px) {
  .inbox.split { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 32px; align-items: start; }
  .inbox.split .thread-head h2 { font-size: 28px; font-weight: 500; }
  .inbox.split .thread { margin-bottom: 16px; }
  .inbox.split .composer { position: sticky; left: auto; right: auto; padding: 12px 0; }
}

/* Destructive flows (owner delete, city close): a ledger of what goes and what stays; red only on the final verb. */
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger:hover { background: #912018; border-color: #912018; }
.btn.danger[disabled] { background: var(--surface); border-color: var(--line); color: var(--muted); opacity: 1; }
.link-btn.danger { color: var(--err); min-height: 44px; }
.ledger { background: var(--surface); border-radius: 20px; padding: 8px 24px 12px; }
.ledger h3 { margin: 16px 0 4px; font-size: 16px; font-weight: 600; }
.ledger ul { list-style: none; margin: 0; padding: 0; }
.ledger li { padding: 10px 0; border-top: 1px solid var(--line); font-size: 17px; line-height: 1.4; }
.ledger li:first-child { border-top: 0; }
.ledger .keep li { color: var(--muted); }
.deleted-note { margin: -8px 0 24px; text-align: inherit; }
#adminClose .row { padding-left: 0; padding-right: 0; }
#adminClose .row .btn { flex: none; }
@media (max-width: 820px) { .ledger { padding: 4px 18px 10px; } }

/* Email settings: one white card of rows (DESIGN.md row unit): what the email is about on the left, its setting on the right. */
.pref-group { margin: 0 0 20px; padding: 0; border: 0; background: var(--surface); border-radius: 20px; max-width: 720px; }
.pref-group legend { float: left; width: 100%; padding: 20px 24px 4px; font-size: 15px; font-weight: 500; color: var(--muted); }
.pref { clear: both; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 24px; border-top: 1px solid var(--line); }
.pref-group .pref:first-of-type { border-top: 0; }
.pref label { font-size: 18px; line-height: 1.35; }
.pref select { flex: none; width: 200px; min-height: 52px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 18px; }
.pref select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8, 122, 80, .25); }
.pref-save { display: flex; align-items: center; gap: 16px; }
.pref-save .status { margin: 0; }
@media (max-width: 820px) {
  .pref { flex-direction: column; align-items: stretch; gap: 6px; padding: 12px 20px; }
  .pref-group { margin-bottom: 12px; }
  .pref-group legend { padding: 14px 20px 0; }
  .pref select { width: 100%; }
  .pref-save .btn { flex: 1; }
}

.city-film-transcript{margin-bottom:32px;border-block:1px solid var(--line);padding:20px 0}.city-film-transcript summary{cursor:pointer;min-height:44px;font-weight:500}.city-film-transcript>div{max-width:65ch;padding-top:16px}.city-next-film{border-top:1px solid var(--line);padding:28px 0;margin-bottom:24px}.city-next-film p{max-width:60ch}
