/* ==========================================================================================
   Compass Afar -- the iOS layer for the WHOLE app (Steps 2 and 3 of docs/archive/IOS-REDESIGN.md).

   Loaded last. styles.css still describes every component; this file re-skins those components with the --ios-* tokens
   (theme.css) and makes the shell fit every phone: safe areas, the navigation bar, the bottom tab bar, the keyboard,
   small screens, landscape and tablets. Layout and styling only -- no rule here depends on app state beyond the
   data-screen / data-chrome attributes app.js puts on .app-frame.

   Part 1 (this file)   shell, navigation bar, tab bar, safe areas, type, buttons, fields, chips, sheets, chat, toast
   Part 2 (ios-screens.css)   the screens, one section each

   NOT restyled, on purpose: the compass wheel (Explore and the interests step) and the launch animation -- they keep
   the brand fonts and the original tokens (see "brand islands" below) -- and the wordmark in the navigation bar.
   ========================================================================================== */

/* ---------- the original tokens, kept under another name ----------
   A custom property is resolved where it is declared, so these hold the theme.css values (light or dark) even after
   .app-frame re-points the working tokens below. The brand islands read them back. */
:root{
  --o-font-sans: var(--font-sans); --o-font-display: var(--font-display); --o-font-mono: var(--font-mono);
  --o-fs-display: var(--fs-display); --o-fs-title: var(--fs-title); --o-fs-body: var(--fs-body); --o-fs-caption: var(--fs-caption);
  --o-lh-body: var(--lh-body);
  --o-accent: var(--accent); --o-on-accent: var(--on-accent); --o-chip: var(--chip);
  --o-surface: var(--surface); --o-surface-soft: var(--surface-soft); --o-border: var(--border);
  --o-radius-m: var(--radius-m); --o-radius-l: var(--radius-l);
  --o-shadow-card: var(--shadow-card); --o-shadow-accent: var(--shadow-accent);
}

/* ---------- the working tokens, re-pointed at the iOS system ---------- */
.app-frame{
  --font-sans: var(--ios-font); --font-display: var(--ios-font); --font-mono: var(--ios-font);
  /* body is 17px (16px on the narrowest phones); nothing a person reads is under 13px */
  --fs-body: clamp(16px, 4.36cqi, 17px);
  --fs-caption: 13px;
  --fs-title: clamp(17px, 4.9cqi, 19px);
  --fs-display: clamp(26px, 7.4cqi, 32px);
  --lh-body: 1.38;
  --accent: var(--ios-tint-fill); --on-accent: var(--ios-on-tint); --chip: var(--ios-tint-soft);
  --surface: var(--ios-card); --surface-soft: var(--ios-fill); --border: var(--ios-separator);
  --radius-m: var(--ios-radius-card); --radius-l: var(--ios-radius-sheet);
  --shadow-card: none; --shadow-accent: none; --budget-shadow: none;
  /* one side margin for every screen: the iOS 16px (14px on a 320px phone, 24px in the wide tablet column -- see below) */
  --gutter: var(--ios-margin);
  --tabbar-space: 0px;

  font-family: var(--ios-font); color: var(--ios-label);
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
}
/* brand islands: the wheel, the launch animation and the wordmark keep the look they were designed with -- and so
   do the shared cards (SHARED CARDS below: the Housing look, wherever they are used), a screen head marked is-brand, the
   section dial's bar, and a whole screen marked class="classic" (see CLASSIC SCREENS at the end of this file) */
.compass-ring, .launch, .lockup, .splash-lockup, .mark-badge, .hero-card, .feature-card, .pill-btn, .pill-btn-reason, .help-text, .screen-head.is-brand, .section-dial-bar, .screen.classic{
  --font-sans: var(--o-font-sans); --font-display: var(--o-font-display); --font-mono: var(--o-font-mono);
  --fs-display: var(--o-fs-display); --fs-title: var(--o-fs-title); --fs-body: var(--o-fs-body); --fs-caption: var(--o-fs-caption);
  --lh-body: var(--o-lh-body);
  --accent: var(--o-accent); --on-accent: var(--o-on-accent); --chip: var(--o-chip);
  --surface: var(--o-surface); --surface-soft: var(--o-surface-soft); --border: var(--o-border);
  --radius-m: var(--o-radius-m); --radius-l: var(--o-radius-l);
  --shadow-card: var(--o-shadow-card); --shadow-accent: var(--o-shadow-accent);
  font-family: var(--o-font-sans);
}

/* ==========================================================================================
   SHELL: one column, as tall as the visible screen, never wider than 600px
   ========================================================================================== */
html{ background: var(--ios-bg); }
body{
  padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px); /* landscape: clear the notch */
  min-height: 100vh; min-height: 100dvh; align-items: stretch; background: var(--ios-bg);
  overflow: hidden; /* the app scrolls inside its screens; the page itself never does */
}
.app-shell{ height: 100vh; height: var(--app-h, 100dvh); }
.app-frame{
  max-width: 600px; height: 100%; border-radius: 0; box-shadow: none; background: var(--ios-bg);
  /* clip, not hidden: a hidden box can still be scrolled by focus() or scrollIntoView() on something off to the side
     (the next screen waiting at translateX(100%)), which shifted the whole app sideways. A clipped box cannot scroll. */
  overflow: hidden; overflow: clip;
  container-type: inline-size; container-name: frame;
}
@media (max-width: 340px){ .app-frame{ --gutter: 14px; } }
@media (min-width: 560px){ .app-frame{ --gutter: 24px; } }
@media (min-width: 601px){ .app-frame{ box-shadow: 0 0 0 .5px var(--ios-separator); } }
/* a desktop window: the app as a phone-sized card, as before */
@media (min-width: 1000px) and (min-height: 700px){
  html, body{ background: var(--wash); }
  body{ align-items: center; padding: 24px; }
  .app-shell{ height: auto; }
  .app-frame{ --gutter: var(--ios-margin); max-width: 430px; height: min(900px, calc(100dvh - 48px)); border-radius: 28px; box-shadow: 0 0 0 1px var(--o-border), var(--shadow-float); }
}
.screens{ container-type: size; container-name: screens; overflow: hidden; overflow: clip; }
/* the wheel was sized against the window (94vw, 50vh); size it against the screen area it actually lives in */
.screens{ --ring: min(360px, 94cqw, 50cqh); }

.screen{
  padding: 4px var(--gutter) 24px;
  background: var(--ios-bg); color: var(--ios-label);
  overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  scroll-padding: 12px 0 24px;
}
/* no tab bar under these screens: they pad for the home indicator themselves */
.app-frame[data-chrome="bare"] .screen{ padding-bottom: calc(24px + var(--ios-safe-bottom)); }
.screen.ios-screen{ padding: 0 var(--gutter) 24px; }
/* long words (addresses, Spanish compounds, e-mail addresses) wrap instead of pushing the screen wider */
.screen, .sp-sheet, .chat-panel, .nav-drawer, .toast{ overflow-wrap: break-word; }
.screen :where(h1, h2, h3, p, li):where(:not(.classic *)){ overflow-wrap: break-word; }
.screen img, .sp-sheet img{ max-width: 100%; height: auto; }

/* ==========================================================================================
   NAVIGATION BAR: [back] SOS | wordmark | menu      (44pt bar under the status bar / notch)
   ========================================================================================== */
.app-header{
  position: relative; z-index: 30;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 2px;
  min-height: calc(44px + var(--ios-safe-top)); padding: var(--ios-safe-top) 6px 0;
  background: var(--ios-bar); border-bottom: .5px solid var(--ios-separator);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
/* Both sides are as wide as Back + SOS whatever they hold, so the wordmark sits in the true centre and nothing moves
   when the back arrow comes and goes. With no arrow (it is display:none, not merely invisible) SOS is first in the
   left slot: the corner. */
.header-left, .header-right{ gap: 0; min-width: 96px; }
.header-right{ justify-content: flex-end; }
#back-btn[hidden]{ display: none; }
/* Back and Menu: the original round outlined buttons, drawn 36px wide inside a 44 x 44 target (the transparent border
   is tappable, the ring is an inset shadow at the edge of the fill) */
.app-header .icon-btn, .nav-close-btn{
  box-sizing: border-box; width: 44px; height: 44px; border: 4px solid transparent; border-radius: 50%;
  background: var(--o-surface-soft) padding-box; color: var(--ink-soft); box-shadow: inset 0 0 0 1px var(--border-strong);
}
.app-header .icon-btn:hover, .nav-close-btn:hover{ background: var(--o-chip) padding-box; color: var(--ink); }
.app-header .icon-btn:active, .nav-close-btn:active{ opacity: .6; }
.app-header .icon-btn svg, .app-header .icon-btn .icon, .nav-close-btn .icon{ width: 18px; height: 18px; }
/* no menu on the launch, sign-in and sign-up screens; the slot keeps its width so the wordmark stays centred */
.app-frame:not([data-chrome="full"]) .hamburger-btn{ visibility: hidden; }
/* SOS: the one loud control in the bar. A solid red capsule (30px tall, white bold text) inside a 52 x 44 target: the
   transparent border is tappable, the fill is the capsule. */
.app-header .icon-btn.sos-btn{
  width: 52px; height: 44px; padding: 0; border: solid transparent; border-width: 7px 2px; border-radius: 999px;
  background: var(--risk-fg) padding-box; color: #fff; box-shadow: none;
  font: 800 13px/1 var(--ios-font); letter-spacing: .05em;
}
.app-header .icon-btn.sos-btn:active{ transform: none; opacity: .7; }
html[data-theme="dark"] .app-header .icon-btn.sos-btn{ background: #c7354e padding-box; border-color: transparent; }
.app-header .icon-btn.sos-btn:hover{ background: var(--risk-fg) padding-box; color: #fff; filter: none; }
/* the wordmark: its original size wherever the bar has room for it beside two 96px slots, smaller on the narrowest phones */
.lockup{ font-size: clamp(10.5px, 3.6cqi, 14px); }
@container frame (min-width: 360px){ .header-logo{ font-size: 17.6px; } }
.header-logo{ min-width: 0; }

/* ==========================================================================================
   CHAT BUTTON: the round pink bubble, bottom-right, above the tab bar and the home indicator.
   It floats over the end of the screen, so every screen pads its end by --fab-clear: the last line (and any button
   there) can always be scrolled out from under it. Explore does not scroll: its Go button is sized to sit beside it.
   ========================================================================================== */
.app-frame{ --fab-size: 52px; --fab-gap: 12px; --fab-clear: calc(var(--fab-size) + 2 * var(--fab-gap)); }
.chat-fab{
  right: 16px; bottom: calc(var(--tabbar-space) + var(--ios-safe-bottom) + var(--fab-gap)); z-index: 40;
  width: var(--fab-size); height: var(--fab-size);
  background: var(--o-accent); color: var(--o-on-accent); box-shadow: 0 10px 24px -10px rgba(var(--accent-rgb), .7);
}
.chat-fab:hover{ background: var(--o-accent); }
.chat-fab:active{ transform: scale(.95); }
/* it steps up out of the way of a primary button passing under it (dodgePrimaryButtons in app.js) */
.chat-fab{ transition: translate var(--dur-fast) var(--ease-out); }
/* no chat on the launch, sign-in and sign-up screens (it used to cover the main button there), or while typing */
.app-frame:not([data-chrome="full"]) .chat-fab, html.kb-open .chat-fab{ display: none; }
.app-frame[data-chrome="full"] .screen{ padding-bottom: calc(var(--fab-clear) + var(--tabbar-space) + var(--ios-safe-bottom)); } /* ...and of the tab bar under it */

/* ==========================================================================================
   TAB BAR: Explore, Housing, Calendar, Budget, as a floating pill: 12px in from the sides and from the bottom (or the
   home indicator, whichever is more), a soft shadow, small icons and labels. It floats over the end of the screen
   area, so every screen pads its end by the pill's height as well (--tabbar-space; see .screen below and the
   chat button above, which sits on top of the pill).
   ========================================================================================== */
.app-frame{ --ios-tabbar-h: 54px; --tabbar-end: max(12px, var(--ios-safe-bottom)); }
.tabbar-host{ position: absolute; left: 12px; right: 12px; bottom: var(--tabbar-end); z-index: 30; }
.app-frame:not([data-chrome="full"]) .tabbar-host{ display: none; }
html.kb-open .tabbar-host{ display: none; } /* typing: the keyboard has the bottom of the screen */
.tabbar-host .ios-tabbar{
  min-height: var(--ios-tabbar-h); padding: 0 8px; border: 0; border-radius: 999px;
  background: var(--ios-card); -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 12px 28px -12px rgba(var(--ink-rgb), .38), 0 2px 6px -2px rgba(var(--ink-rgb), .12), 0 0 0 .5px var(--ios-separator);
}
html[data-theme="dark"] .tabbar-host .ios-tabbar{ box-shadow: 0 12px 28px -10px rgba(0, 0, 0, .8), 0 0 0 .5px var(--ios-separator); }
.ios-tab{ min-width: 44px; min-height: var(--ios-tabbar-h); gap: 1px; padding: 4px 0 2px; -webkit-tap-highlight-color: transparent; }
.ios-tab .icon{ width: 22px; height: 22px; }
.ios-tab .icon svg{ stroke-width: 1.8; }
.ios-tab span:last-child{ max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ios-tab[aria-current="page"]{ font-weight: var(--ios-w-semibold); }
.ios-tab:active{ opacity: .6; }
/* a short screen (a phone in Safari with its toolbars showing): a slightly lower pill, nearer the bottom */
@media (max-height: 620px){ .app-frame{ --ios-tabbar-h: 48px; --tabbar-end: max(8px, var(--ios-safe-bottom)); } }
/* landscape phones: a lower pill, icon and label side by side */
@media (max-height: 480px) and (orientation: landscape){
  .app-frame{ --ios-tabbar-h: 44px; --tabbar-end: max(8px, var(--ios-safe-bottom)); }
  .ios-tab{ flex-direction: row; gap: 6px; font-size: 12px; }
  .ios-tab .icon{ width: 20px; height: 20px; }
}

/* ==========================================================================================
   THE MENU (drawer): slides in from the right over a scrim; one grouped list (ios.css rows) in sections that fold,
   Settings as a round button pinned to its end. Position, the closed state and the slide are in styles.css.
   ========================================================================================== */
.nav-drawer{ background: var(--ios-bg); width: min(320px, 86%); padding-top: var(--ios-safe-top); font-family: var(--ios-font); color: var(--ios-label); }
.nav-drawer.open{ box-shadow: -16px 0 40px -18px rgba(0, 0, 0, .35); }
#nav-drawer-items{ padding: 0 var(--ios-margin) 12px; }
/* the head is as tall as the navigation bar, and the close button sits exactly where the menu button is */
.nav-drawer-head{ min-height: 44px; margin: 0 -10px 0 4px; }
.nav-drawer-head .lockup.lg{ font-size: clamp(18px, 6cqi, 22px); }
.nav-close-btn{ flex: none; }
/* One ring in the normal state (the button's own). Opened by touch or mouse, focus sits on the panel, which shows
   nothing; keyboard focus adds a ring drawn inside the 44px box, so the panel's edges can't clip it. */
.nav-drawer:focus{ outline: none; }
.nav-close-btn:focus{ outline: none; }
.nav-close-btn:focus-visible{ outline: 2px solid var(--ios-tint); outline-offset: -2px; }
/* Sections that fold: the title is a 44px button with a chevron (right = folded, down = open); the list under it
   opens by growing its grid row from 0fr to 1fr, so the height animates without being measured. */
.nav-drawer .ios-section, .nav-drawer .ios-section:first-child{ margin-top: 4px; }
.nav-sec-h{ padding: 0; }
.nav-sec-btn{
  all: unset; box-sizing: border-box; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 44px; padding: 0 var(--ios-margin); border-radius: 10px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.nav-sec-btn:active{ opacity: .6; }
.nav-sec-btn:focus-visible{ outline: 2px solid var(--ios-tint); outline-offset: -2px; }
.nav-sec-chev{ flex: none; display: flex; margin-right: -4px; color: var(--ios-label-3); transition: transform .2s ease; }
.nav-sec-chev .icon{ width: 14px; height: 14px; display: flex; }
.nav-sec-chev svg{ width: 100%; height: 100%; stroke-width: 2.8; }
.nav-sec.open .nav-sec-chev{ transform: rotate(90deg); }
.nav-sec-body{ display: grid; grid-template-rows: 0fr; transition: grid-template-rows .2s ease; }
.nav-sec.open .nav-sec-body{ grid-template-rows: 1fr; }
.nav-sec-clip{ min-height: 0; overflow: hidden; }
.nav-drawer .ios-row[aria-current="page"] .ios-row-title{ color: var(--ios-tint); font-weight: var(--ios-w-semibold); }
.nav-drawer-foot{ gap: 12px; padding: 8px var(--ios-margin) calc(12px + var(--ios-safe-bottom)); }
.nav-util-btn{ width: 44px; height: 44px; background: var(--ios-fill); color: var(--ios-label-2); }
.nav-util-btn:active{ opacity: .6; }
.nav-util-btn[aria-current="page"]{ background: var(--ios-tint-fill); color: var(--ios-on-tint); }

/* ==========================================================================================
   TYPE
   ========================================================================================== */
.screen h1:where(:not(.classic *)), .screen h2:where(:not(.classic *)), .screen h3:where(:not(.classic *)), .sp-sheet h3:where(:not(.classic *)), .modal-card h3:where(:not(.classic *)){ font-family: var(--ios-font); letter-spacing: -.01em; }
.screen-head:where(:not(.classic *)){ margin: 0 0 16px; padding-top: 8px; }
.screen-head h2:where(:not(.classic *)), .detail-head h2:where(:not(.classic *)){ font-size: var(--fs-display); font-weight: var(--ios-w-bold); line-height: 1.14; letter-spacing: .01em; margin-top: 0; }
.screen-head .sub:where(:not(.classic *)), .detail-head .loc:where(:not(.classic *)){ font-size: var(--ios-fs-sub); line-height: 1.4; color: var(--ink-soft); margin-top: 6px; }
/* the small caps line above a title: iOS has none. (Sign-up's "Step 2 of 7" is on classic screens, so it is Housing's eyebrow: see SIGN-UP in ios-screens.css.) */
.screen-head .eyebrow:where(:not(.classic *)), .detail-head .eyebrow:where(:not(.classic *)){ display: none; }
/* section headers inside a screen: the grouped-list header (footnote, caps, secondary) */
.section-title:where(:not(.classic *)), .transit-title:where(:not(.classic *)), .cal-day-heading:where(:not(.classic *)), .sp-group:where(:not(.classic *)), .pc-label:where(:not(.classic *)){
  font: var(--ios-w-regular) var(--ios-fs-foot)/var(--ios-lh-foot) var(--ios-font); letter-spacing: 0; text-transform: uppercase; color: var(--ink-soft);
}
.section-title{ margin: 24px 0 8px; }

/* ==========================================================================================
   BUTTONS: one filled primary; a grey secondary; plain tinted text for the rest. All at least 44px tall.
   ========================================================================================== */
.btn:where(:not(.classic *)){
  min-height: 50px; padding: 12px 20px; border-radius: var(--ios-radius-btn);
  font: var(--ios-w-semibold) var(--ios-fs-body)/1.25 var(--ios-font); text-align: center;
}
.btn-primary:where(:not(.classic *)){ background: var(--ios-tint-fill); color: var(--ios-on-tint); box-shadow: none; }
.btn-primary:hover:where(:not(.classic *)){ background: var(--ios-tint-fill); }
.btn-primary:active:where(:not(.classic *)){ background: var(--ios-tint-fill); opacity: .78; }
.btn-ghost:where(:not(.classic *)), .btn-google:where(:not(.classic *)){ border: 0; background: var(--ios-fill); color: var(--ios-label); }
.btn-ghost:where(:not(.classic *)){ color: var(--ios-tint); }
.btn-ghost:hover:where(:not(.classic *)), .btn-google:hover:where(:not(.classic *)){ background: var(--ios-fill); }
.btn-ghost:active:where(:not(.classic *)), .btn-google:active:where(:not(.classic *)){ opacity: .6; }
.btn-google{ background: var(--ios-card); box-shadow: inset 0 0 0 .5px var(--ios-separator); }
.btn-sm:where(:not(.classic *)){ min-height: 44px; padding: 8px 16px; border-radius: 12px; font-size: var(--ios-fs-sub); }
.btn[disabled]:where(:not(.classic *)), .btn[aria-disabled="true"]:where(:not(.classic *)){ opacity: .4; }
/* text buttons. Inside a sentence they stay inline; on a line of their own they are a full 44px target. */
.btn-link:where(:not(.classic *)){ color: var(--ios-tint); font-weight: var(--ios-w-regular); font-size: inherit; }
.btn-link:active:where(:not(.classic *)){ opacity: .5; }
:is(#share-close-btn, #methodology-close-btn, .sos-skip, .split-head .btn-link, [data-retry]).btn-link:where(:not(.classic *)),
#signin-retry-btn:not([hidden]):where(:not(.classic *)), #google-help-link:where(:not(.classic *)), #forgot-password-btn:where(:not(.classic *)), #verify-signout-btn:where(:not(.classic *)), #sos-signin-btn:where(:not(.classic *)), #housing-nudge-btn:where(:not(.classic *)){
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; padding: 0 8px; box-sizing: border-box;
  font-size: var(--ios-fs-body); text-align: center;
}
#signin-retry-btn[hidden]{ display: none; } /* an id rule in styles.css was showing the hidden "Try again" */
.disclosure-toggle:where(:not(.classic *)){ min-height: 44px; padding: 8px 0; color: var(--ios-tint); font-weight: var(--ios-w-regular); font-size: var(--ios-fs-body); box-sizing: border-box; }

/* round icon buttons (save, share, edit, delete, close): 44 x 44 target, a 36px grey circle drawn inside it */
.icon-toggle:where(:not(.classic *)), .screen.quiet .event-actions .icon-toggle:where(:not(.classic *)), .screen.quiet .event-dropdown-actions .icon-toggle:where(:not(.classic *)){
  box-sizing: border-box; width: 44px; height: 44px; border: 4px solid transparent; border-radius: 50%;
  background: var(--ios-fill) padding-box; color: var(--ios-tint);
}
.icon-toggle.saved:where(:not(.classic *)), .screen.quiet .event-actions .icon-toggle.saved:where(:not(.classic *)){ background: var(--ios-tint-fill) padding-box; border-color: transparent; color: var(--ios-on-tint); }
.icon-toggle .icon:where(:not(.classic *)){ width: 18px; height: 18px; }
.event-expand-btn, .screen.quiet .event-expand-btn{ box-sizing: border-box; width: 44px; height: 44px; padding: 0; align-items: center; justify-content: center; color: var(--ios-label-3); }
.event-expand-btn .icon{ width: 18px; height: 18px; }

/* ==========================================================================================
   FIELDS: 16px+ text (iOS zooms the page for anything smaller), 44px+ tall, no outline until focused
   ========================================================================================== */
.field{ margin-bottom: 16px; }
.field label, .cpc-field{ font: var(--ios-w-regular) var(--ios-fs-foot)/var(--ios-lh-foot) var(--ios-font); color: var(--ink-soft); margin-bottom: 6px; }
:is(.field input, .field select, .field textarea, .search input, .sp-search input, .tool-form textarea, .bud-note-box textarea, .split-row input,
.chat-proposal-card .cpc-field input, .cal-cat-select, .chat-proposal-card select, .district-select select, .screen select, .sp-sheet select):not([type="checkbox"], [type="radio"], [type="file"]){
  box-sizing: border-box; min-height: 44px; border: 0; border-radius: 10px; background-color: var(--ios-card); color: var(--ios-label);
  font: var(--ios-w-regular) max(16px, var(--fs-body))/1.3 var(--ios-font); box-shadow: inset 0 0 0 .5px var(--ios-separator);
}
.field :is(input, select):not([type="checkbox"], [type="radio"], [type="file"]){ padding: 11px 14px; }
.field input:focus, .field select:focus, .field textarea:focus, .search input:focus, .sp-search input:focus, .tool-form textarea:focus,
.bud-note-box textarea:focus, .split-row input:focus, .cal-cat-select:focus, .screen select:focus, .sp-sheet select:focus{
  outline: none; background-color: var(--ios-card); box-shadow: inset 0 0 0 2px var(--ios-tint);
}
.field input::placeholder, .search input::placeholder, .sp-search input::placeholder, .tool-form textarea::placeholder{ color: var(--ios-label-3); font-weight: var(--ios-w-regular); }
/* fields that sit on a white card or sheet: a grey fill instead of a white one */
.sp-sheet:not(.ios-sheet) :is(.field input, .field select, .field textarea, .sp-search input, select),
.bud-card :is(input, select, textarea), .event-card select, .chat-proposal-card :is(input, select){
  background-color: var(--ios-fill); box-shadow: none;
}
.field-error{ font-size: var(--ios-fs-foot); line-height: var(--ios-lh-foot); }
.field input[type="date"], .field input[type="time"]{ min-height: 44px; }
.search input{ padding: 11px 14px 11px 40px; }
.search svg{ left: 13px; }
.password-wrap input{ padding-right: 72px; }
.password-toggle-btn{ right: 4px; min-width: 60px; min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: var(--ios-fs-sub); font-weight: var(--ios-w-regular); color: var(--ios-tint); }
/* phone field (intl-tel-input) */
.field .iti{ --iti-border-color: transparent; --iti-hover-color: var(--ios-fill); --iti-country-selector-bg: var(--ios-card); }
.iti__dropdown-content{ border: 0; border-radius: var(--ios-radius-card); box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .35); max-width: calc(100cqw - 2 * var(--gutter)); }
.iti__search-input{ border: 0; min-height: 44px; font-size: 16px; }
.iti__country{ min-height: 44px; align-items: center; }
.iti__selected-dial-code{ font-weight: var(--ios-w-regular); }
.field .iti input.iti__tel-input, .field .iti input[type="tel"]{ min-height: 46px; }
.iti__selected-country{ min-height: 44px; }
.place-list{ border: 0; border-radius: var(--ios-radius-card); box-shadow: 0 12px 32px -12px rgba(0, 0, 0, .35); }
.place-list li{ min-height: 44px; font-weight: var(--ios-w-regular); padding: 10px 12px; }

/* switches: the 51 x 31 UISwitch */
.switch{ width: 51px; height: 44px; }
.switch .track{ inset: 6.5px 0; background: var(--ios-switch-off); }
.switch .thumb{ left: 2px; top: 8.5px; width: 27px; height: 27px; box-shadow: 0 2px 4px rgba(0, 0, 0, .22); }
.switch input:checked + .track{ background: var(--ios-tint-fill); }
.switch input:checked ~ .thumb{ transform: translateX(20px); }
.toggle-row{ min-height: 44px; padding: 6px var(--ios-margin); gap: 12px; border: 0; border-radius: var(--ios-radius-card); }
.toggle-row .lbl{ font-weight: var(--ios-w-regular); flex: 1; min-width: 0; }

/* ==========================================================================================
   CHIPS and SEGMENTED CONTROLS
   A chip is drawn 34px tall inside a 44px target (transparent top/bottom border, fill clipped to the padding box).
   ========================================================================================== */
.filter-row:where(:not(.classic *)){ gap: 8px; margin: 0 calc(-1 * var(--gutter)) 12px; padding: 0 var(--gutter) 0; scrollbar-width: none; scroll-padding-inline: var(--gutter); }
.filter-row:where(:not(.classic *))::-webkit-scrollbar{ display: none; }
.f-chip:where(:not(.classic *)), .screen.quiet .f-chip:where(:not(.classic *)), .chip-row-sm .f-chip:where(:not(.classic *)){
  box-sizing: border-box; min-height: 44px; padding: 0 14px; border: solid transparent; border-width: 5px 0; border-radius: 999px;
  background: var(--ios-fill) padding-box; color: var(--ios-label);
  font: var(--ios-w-regular) var(--ios-fs-sub)/1.2 var(--ios-font); letter-spacing: 0; box-shadow: none;
}
.f-chip:hover:where(:not(.classic *)), .chip-row-sm .f-chip:hover:where(:not(.classic *)){ background: var(--ios-fill) padding-box; border-color: transparent; }
.f-chip[aria-pressed="true"]:where(:not(.classic *)), .screen.quiet .f-chip[aria-pressed="true"]:where(:not(.classic *)), .chip-row-sm .f-chip[aria-pressed="true"]:where(:not(.classic *)){
  background: var(--ios-tint-fill) padding-box; border-color: transparent; color: var(--ios-on-tint); font-weight: var(--ios-w-semibold);
}
.f-chip .icon:where(:not(.classic *)){ width: 15px; height: 15px; }
.chip-row-sm{ margin-top: 0; }
/* segmented controls (List/Swipe, Log in/Sign up, My School/General/Requests, budget period): 32px track in a 44px target */
.view-toggle:where(:not(.classic *)), .tab-toggle:where(:not(.classic *)), .tab-toggle.seg:where(:not(.classic *)), .auth-toggle:where(:not(.classic *)), .seg-control:where(:not(.classic *)){
  gap: 0; padding: 0; margin-bottom: 12px; border: solid transparent; border-width: 4px 0; border-radius: 13px;
  background: var(--ios-fill) padding-box; min-height: 44px; box-sizing: border-box;
}
/* each segment is a full 44px target: it reaches 4px past the track (negative margin) and draws its 32px pill inside a transparent border */
.view-toggle button:where(:not(.classic *)), .tab-toggle button:where(:not(.classic *)), .tab-toggle.seg button:where(:not(.classic *)), .auth-toggle button:where(:not(.classic *)), .seg-control button:where(:not(.classic *)){
  box-sizing: border-box; min-height: 44px; margin: -4px 0; padding: 0 4px; border: solid transparent; border-width: 6px 2px; border-radius: 13px;
  background: transparent; color: var(--ios-label); display: flex; align-items: center; justify-content: center;
  font: var(--ios-w-regular) var(--ios-fs-sub)/1.15 var(--ios-font); text-align: center;
}
.view-toggle button.active:where(:not(.classic *)), .tab-toggle button.active:where(:not(.classic *)), .tab-toggle.seg button.active:where(:not(.classic *)), .auth-toggle button.active:where(:not(.classic *)), .seg-control button[aria-checked="true"]:where(:not(.classic *)){
  background: var(--ios-card) padding-box; color: var(--ios-label); border-color: transparent; font-weight: var(--ios-w-semibold);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .14);
}
html[data-theme="dark"] :is(.view-toggle, .tab-toggle, .auth-toggle, .seg-control) :is(button.active, button[aria-checked="true"]):where(:not(.classic *)){ background: rgba(120, 120, 128, .55) padding-box; }

/* ==========================================================================================
   CARDS: white on the grouped background, 12px radius, no outline, no shadow
   ========================================================================================== */
.row-btn:where(:not(.classic *)), .housing-card:where(:not(.classic *)), .swipe-card:where(:not(.classic *)), .district-card:where(:not(.classic *)), .citywide-card:where(:not(.classic *)), .gauge-card:where(:not(.classic *)), .event-card:where(:not(.classic *)), .account-card:where(:not(.classic *)), .badge-tile:where(:not(.classic *)), .login-gate:where(:not(.classic *)),
.bud-card:where(:not(.classic *)), .bud-linkrow:where(:not(.classic *)), .bud-banner:where(:not(.classic *)), .bud-item:where(:not(.classic *)), .bud-hist:where(:not(.classic *)), .split-box:where(:not(.classic *)), .cat-choice:where(:not(.classic *)), .room-price-banner:where(:not(.classic *)), .fact:where(:not(.classic *)), .flag:where(:not(.classic *)), .tip:where(:not(.classic *)), .clause:where(:not(.classic *)),
.q-list li:where(:not(.classic *)), .setup-prompt:where(:not(.classic *)), .listing-tips:where(:not(.classic *)), .cmp-block:where(:not(.classic *)), .chat-proposal-card:where(:not(.classic *)), .school-picker-btn:where(:not(.classic *)), .place-list:where(:not(.classic *)){
  border-color: transparent; box-shadow: none;
}
.row-btn:hover:where(:not(.classic *)), .housing-card[data-open="true"]:where(:not(.classic *)), .school-picker-btn:hover:where(:not(.classic *)){ border-color: transparent; }
.attr-chip:where(:not(.classic *)), .event-cat:where(:not(.classic *)), .row-soon:where(:not(.classic *)), .example-tag:where(:not(.classic *)), .src-tag:where(:not(.classic *)), .pa-stat:where(:not(.classic *)), .route-origin:where(:not(.classic *)){ border-color: transparent; }
.school-logo, .network-logo, .event-logo{ border-color: var(--ios-separator); border-width: .5px; }
.login-gate{ padding: 24px var(--ios-margin); border-radius: var(--ios-radius-card); }
.login-gate-title{ font-size: var(--ios-fs-title-s); font-weight: var(--ios-w-semibold); }
.school-picker-btn{ min-height: 56px; background: var(--ios-card); font-weight: var(--ios-w-regular); box-shadow: inset 0 0 0 .5px var(--ios-separator); }
.school-picker-btn:focus-visible, .school-picker-btn[aria-expanded="true"]{ box-shadow: inset 0 0 0 2px var(--ios-tint); background: var(--ios-card); }
.school-picker-btn > .icon{ color: var(--ios-label-3); }
.empty-note:where(:not(.classic *)), .empty-compass:where(:not(.classic *)), .sp-empty:where(:not(.classic *)), .swipe-done:where(:not(.classic *)){ font-size: var(--ios-fs-sub); line-height: 1.4; color: var(--ink-soft); padding: 28px 12px; }
.screen.quiet .empty-note{ padding: 16px 0; }

/* ==========================================================================================
   SHEETS (school picker, calendar entry, settings, guest prompts): bottom sheet with a grabber, above the home indicator
   ========================================================================================== */
.sp-backdrop{ z-index: 80; }
.sp-sheet{ max-height: min(88%, calc(100% - var(--ios-safe-top) - 24px)); padding-left: var(--gutter); padding-right: var(--gutter); }
.sp-title{ font-size: var(--ios-fs-body); }
.sp-option{ min-height: 44px; padding: 8px 10px; border: 0; border-radius: 10px; }
.sp-option.active, .sp-option[aria-selected="true"]{ background: var(--ios-tint-soft); border: 0; }
.sp-option .sp-name{ font-weight: var(--ios-w-regular); }
.sp-option .sp-check{ color: var(--ios-tint); }
.sp-search input{ padding: 11px 14px 11px 40px; }
.sheet-body{ padding: 2px 0 6px; scrollbar-gutter: auto; }
.sheet-actions{ gap: 8px; flex-wrap: wrap; }
.sheet-actions .btn{ flex: 1 1 120px; }
.form-note{ font-size: var(--ios-fs-sub); line-height: 1.4; color: var(--ink-soft); }
/* centred dialogs (share card, how the index works) */
.modal-overlay{ padding: 24px var(--gutter); }
.modal-card, .methodology-modal .modal-card{ width: 100%; max-width: 340px; max-height: 100%; overflow-y: auto; border-radius: var(--ios-radius-sheet); padding: 20px var(--ios-margin) 12px; }
.modal-card canvas{ border: 0; }

/* ==========================================================================================
   CHAT: a bottom sheet (grabber, bubbles, a rounded field), its input always above the keyboard and the home indicator
   ========================================================================================== */
.chat-panel{
  left: 0; right: 0; bottom: 0; top: auto; width: auto; z-index: 70;
  height: min(78%, 620px); max-height: calc(100% - var(--ios-safe-top) - 20px);
  border: 0; border-radius: var(--ios-radius-sheet) var(--ios-radius-sheet) 0 0; background: var(--ios-card);
  box-shadow: 0 -12px 40px -12px rgba(0, 0, 0, .35); transform: translateY(100%); opacity: 1; visibility: hidden;
  transition: transform var(--dur-base) var(--ease-out), visibility 0s linear var(--dur-base);
}
.chat-panel.open{ transform: translateY(0); visibility: visible; transition: transform var(--dur-base) var(--ease-out), visibility 0s; }
html.kb-open .chat-panel{ height: 100%; max-height: 100%; border-radius: 0; } /* typing: the sheet takes what the keyboard leaves */
.chat-panel::before{ content: ""; flex: none; width: 36px; height: 5px; margin: 6px auto 0; border-radius: 999px; background: var(--ios-label-3); }
.chat-head{ flex: none; min-height: 44px; padding: 0 4px 0 var(--ios-margin); border-bottom: .5px solid var(--ios-separator); font: var(--ios-w-semibold) var(--ios-fs-body)/var(--ios-lh-body) var(--ios-font); }
.chat-head .icon-btn{ width: 44px; height: 44px; border: 7px solid transparent; border-radius: 50%; background: var(--ios-fill) padding-box; color: var(--ios-label-2); }
.chat-head .icon-btn .icon, .chat-head .icon-btn svg{ width: 15px; height: 15px; }
.chat-body{ padding: 12px var(--ios-margin); gap: 8px; font-size: var(--ios-fs-body); line-height: 1.32; overscroll-behavior: contain; }
.chat-msg{ max-width: 82%; padding: 8px 13px; border-radius: 18px; overflow-wrap: anywhere; }
.chat-msg.bot{ background: var(--ios-fill); border-bottom-left-radius: 5px; }
.chat-msg.me{ background: var(--ios-tint-fill); color: var(--ios-on-tint); border-bottom-right-radius: 5px; }
.chat-suggest{ flex: none; gap: 8px; padding: 0 var(--ios-margin) 8px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chat-suggest::-webkit-scrollbar{ display: none; }
.chat-suggest button{
  flex: none; box-sizing: border-box; min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border: solid transparent; border-width: 5px 0; border-radius: 999px;
  background: var(--ios-tint-soft) padding-box; color: var(--ios-tint); font-size: var(--ios-fs-sub); white-space: nowrap;
}
.chat-input-row{ flex: none; align-items: flex-end; gap: 4px; padding: 6px 6px calc(6px + var(--ios-safe-bottom)) var(--ios-margin); border-top: .5px solid var(--ios-separator); }
html.kb-open .chat-input-row{ padding-bottom: 6px; }
.chat-input-row input{ min-width: 0; min-height: 44px; padding: 10px 16px; border: 0; border-radius: 22px; background: var(--ios-fill); font: var(--ios-w-regular) max(16px, var(--fs-body))/1.3 var(--ios-font); }
.chat-input-row input:focus{ outline: none; box-shadow: inset 0 0 0 1.5px var(--ios-tint); }
.chat-input-row button{ box-sizing: border-box; min-width: 56px; min-height: 44px; padding: 0 10px; display: flex; align-items: center; justify-content: center; color: var(--ios-tint); font: var(--ios-w-semibold) var(--ios-fs-body)/1 var(--ios-font); }
.chat-proposal-card{ border-radius: var(--ios-radius-card); background: var(--ios-bg); padding: 12px; }
.chat-proposal-card .cpc-fields{ grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.chat-proposal-card .cpc-actions .btn{ min-height: 44px; padding: 8px; font-size: var(--ios-fs-sub); }

/* ==========================================================================================
   TOAST: a dark capsule above the tab bar; long messages wrap instead of running off the screen
   ========================================================================================== */
.toast{
  top: calc(var(--ios-safe-top) + 52px); bottom: auto; transform: translateX(-50%) translateY(-12px); width: max-content; max-width: calc(100% - 2 * var(--gutter)); box-sizing: border-box;
  padding: 12px 18px; border-radius: 22px; white-space: normal; text-align: left;
  background: rgba(40, 32, 36, .94); color: #fff; font: var(--ios-w-semibold) var(--ios-fs-sub)/1.3 var(--ios-font);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
}
.toast.show{ transform: translateX(-50%) translateY(0); }
html[data-theme="dark"] .toast{ background: rgba(245, 238, 241, .96); color: #1c1417; }
.app-frame[data-chrome="full"]{ --tabbar-space: calc(var(--ios-tabbar-h) + var(--tabbar-end) - var(--ios-safe-bottom)); } /* the pill and the gap under it, counted from the safe area */
html.kb-open .app-frame{ --tabbar-space: 0px; }

/* ==========================================================================================
   SHARED CARDS: the Housing pattern, as components (frontend/cards.js writes the markup; Housing's own markup uses the same classes).
     HERO CARD     a rose-tinted card: white icon tile, serif headline, a helper line, one pill button
     FEATURE CARD  a white card, thin rose border, pale-rose icon tile, bold title, one grey line; two to a row (.feature-grid), a
                   .feature-card-wide one spans both. Optional: a count badge, a locked icon, a single-line description.
   They are islands (the list at the top of this file): inside them the tokens are the originals again, so they look the same in a
   classic screen (Housing) and in any other, in light and in dark.
   ========================================================================================== */
.hero-card{ padding:16px; border-radius: var(--radius-m); background: linear-gradient(135deg, var(--chip), var(--surface)); border:1.5px solid var(--border-strong); display:flex; flex-direction:column; gap:10px; color: var(--ink); }
.hero-card + .feature-grid{ margin-top:16px; }
.hero-card-head{ display:flex; align-items:center; gap:10px; }
.hero-card-icon{ flex:none; width:36px; height:36px; border-radius:11px; background: var(--surface); color: var(--accent-deep); display:flex; align-items:center; justify-content:center; }
.hero-card-icon .icon{ width:18px; height:18px; }
.hero-card .hero-card-title{ margin:0; font-family: var(--font-display); font-size: var(--fs-body); font-weight:700; letter-spacing: normal; color: var(--ink); line-height:1.3; }
.hero-card-tag{ margin-left:8px; padding:3px 8px; border-radius:999px; background: var(--chip); color: var(--accent-deep); font: 700 11px/1 var(--font-sans); letter-spacing:.04em; text-transform:uppercase; vertical-align:middle; }
.hero-card .place-field{ margin:0; }
.hero-card .place-field label{ font-size: var(--fs-caption); }
.hero-card-help{ margin:0; font-size: var(--fs-caption); color: var(--ink-soft); line-height:1.4; }
/* the PILL BUTTON: the hero's action, and every screen's one main button. `.hero-card-action` is the same pill inside a hero card. */
.hero-card-action, .pill-btn{
  all:unset; box-sizing:border-box; align-self:flex-start; cursor:pointer; font-family: var(--font-sans); border-radius:999px; font-weight:700; font-size: var(--fs-body); padding:9px 16px; min-height:44px;
  display:inline-flex; align-items:center; justify-content:center; gap:8px; background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-accent);
}
.hero-card-action:hover, .pill-btn:hover{ background: var(--accent-deep); }
.hero-card-action:active, .pill-btn:active{ background: var(--accent-press); }
.hero-card-action:focus-visible, .pill-btn:focus-visible{ outline:2px solid var(--accent-deep); outline-offset:2px; }
/* a small in-card switcher ("Madrid v"): a white pill with a thin rose outline, 44px tall to tap */
.hero-card-switch{
  all:unset; box-sizing:border-box; align-self:flex-start; cursor:pointer; font-family: var(--font-sans); min-height:44px; padding:0 14px; border:1.5px solid var(--border-strong); border-radius:999px;
  display:inline-flex; align-items:center; gap:6px; background: var(--surface); color: var(--accent-deep); font-weight:700; font-size: var(--fs-body);
}
.hero-card-switch .icon{ width:16px; height:16px; }
.hero-card-switch:hover{ background: var(--chip); }
.hero-card-switch:focus-visible{ outline:2px solid var(--accent-deep); outline-offset:2px; }

.feature-grid{ display:grid; grid-template-columns:1fr; gap:10px; margin-bottom:16px; flex:none; }
/* two columns (Scam Check | Lease Explainer, the wide cards under them) on every phone from 360px up; one column below that */
@media (min-width: 360px){ .feature-grid{ grid-template-columns:1fr 1fr; } }
.feature-grid-after{ margin-top:4px; }
.feature-card{
  all:unset; box-sizing:border-box; cursor:pointer; font-family: var(--font-sans); display:flex; align-items:center; gap:12px; padding:13px 14px;
  border:1.5px solid var(--border); border-radius: var(--radius-m); background: var(--surface);
  box-shadow: 0 10px 22px -16px rgba(var(--accent-rgb),.45); transition: border-color var(--dur-fast) ease, transform var(--dur-fast) ease;
}
.feature-card:hover{ border-color: var(--accent); }
.feature-card:active{ transform: scale(.985); }
.feature-card:focus-visible{ outline:2px solid var(--accent-deep); outline-offset:2px; }
.feature-card-wide{ grid-column: 1 / -1; }
.feature-card-icon{ flex:none; width:40px; height:40px; border-radius:12px; background: var(--chip); color: var(--accent-deep); display:flex; align-items:center; justify-content:center; }
.feature-card-icon .icon{ width:20px; height:20px; }
.feature-card-body{ flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.feature-card-title{ font-weight:700; font-size: var(--fs-body); color: var(--ink); }
.feature-card-meta{ font-size: var(--fs-caption); font-weight:700; line-height:1.35; color: var(--accent-deep); }
.feature-card-sub{ font-size: var(--fs-caption); line-height:1.35; color: var(--ink-soft); }
.feature-card-chev{ flex:none; color: var(--ink-faint); display:flex; }
.feature-card-chev .icon{ width:16px; height:16px; }
@media (min-width: 360px){ .feature-card{ flex-direction:column; align-items:flex-start; gap:10px; } .feature-card-chev{ display:none; } }
/* a count (unread messages, new tips): top right of the card, accent-deep with white text for contrast. Only a card that has one is positioned: a
   positioned card would paint its shadow over the content that follows it, and Housing's cards (no badge) must stay exactly as they were. */
.feature-card.has-badge{ position:relative; }
.feature-card-badge{ position:absolute; top:10px; right:10px; min-width:20px; height:20px; padding:0 6px; box-sizing:border-box; border-radius:999px; background: var(--accent-deep); color: var(--on-accent); font: 700 12px/20px var(--font-sans); text-align:center; }
/* a campus or chat you cannot post in yet: the lock sits in the icon tile, muted */
.feature-card.is-locked .feature-card-icon{ background: var(--surface-soft); color: var(--ink-faint); }
/* a one-line description (the latest message): cut with an ellipsis instead of wrapping */
.feature-card.is-oneline{ min-width:0; } /* (a grid item will not shrink below its text on one line unless told to) */
.feature-card.is-oneline .feature-card-body{ align-self:stretch; } /* (and in the column layout the text box is the card's width, not its text's) */
.feature-card.is-oneline .feature-card-sub{ display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ---- SHARED, for a screen that asks a question (sign-up; added in 7A.1). Everything below is tokens; Housing, Community and Insider use none of it. ----
   ROW CARD       the feature card with the tile on the LEFT and one card to a line (a campus, a school, a budget period): `feature-card-row`
   CHOOSABLE      a card that is an answer: radio (one of several, aria-checked) or toggle (aria-pressed). Chosen = a 2px rose border, the hero's
                  tint, a SOLID rose tile with a white check, and (when the card has one) its small flag ("Main"). The border grows OUTWARD, so
                  nothing around it moves.
   COMPACT        a smaller choosable card: a smaller tile, name and one line, no tags
   TAGS           small pale-rose labels under the title (a campus's faculties) */
.feature-card.feature-card-row{ grid-column:1 / -1; flex-direction:row; align-items:flex-start; gap:var(--sp-3); }
.feature-card-titleline{ display:flex; align-items:center; flex-wrap:wrap; gap:var(--sp-2); }
.feature-card-tags{ display:flex; flex-wrap:wrap; gap:var(--sp-1); margin-top:var(--sp-1); }
.feature-card-tag{ padding:var(--sp-1) var(--sp-2); border-radius:var(--radius-pill); background:var(--chip); color:var(--accent-deep); font-size:var(--fs-caption); font-weight:600; line-height:1.2; }
.feature-card-flag{ display:none; padding:var(--sp-1) var(--sp-2); border-radius:var(--radius-pill); background:var(--accent-deep); color:var(--on-accent); font:700 var(--fs-caption)/1 var(--font-sans); letter-spacing:var(--tracking-caps); text-transform:uppercase; }
.feature-card-icon .feature-card-check{ display:none; }
.feature-card[aria-checked="true"], .feature-card[aria-pressed="true"]{
  border-color:var(--accent); border-width:var(--stroke-strong); margin:calc((var(--stroke) - var(--stroke-strong)) / 2);
  background:linear-gradient(135deg, var(--chip), var(--surface));
}
.feature-card[aria-checked="true"] .feature-card-icon, .feature-card[aria-pressed="true"] .feature-card-icon{ background:var(--accent); color:var(--on-accent); }
.feature-card[aria-checked="true"] .feature-card-icon > :not(.feature-card-check), .feature-card[aria-pressed="true"] .feature-card-icon > :not(.feature-card-check){ display:none; }
.feature-card[aria-checked="true"] .feature-card-check, .feature-card[aria-pressed="true"] .feature-card-check{ display:block; }
.feature-card[aria-checked="true"] .feature-card-flag{ display:inline-flex; }
.feature-card[aria-checked="true"] .feature-card-tag, .feature-card[aria-pressed="true"] .feature-card-tag{ background:var(--surface); }
.feature-card[aria-disabled="true"]{ opacity:.45; }
.feature-card[hidden]{ display:none; }
.feature-card.feature-card-compact{ align-items:center; gap:var(--sp-3); padding:var(--sp-2) var(--sp-3); }
.feature-card-compact .feature-card-icon{ width:var(--tile-s); height:var(--tile-s); border-radius:var(--radius-s); }
.feature-card-compact .feature-card-icon .icon{ width:var(--icon-s); height:var(--icon-s); }
.feature-card-compact .feature-card-tags{ display:none; }

/* the PILL's other states: full width, a clearly readable disabled state (light rose, deep-rose text, a rose outline: not washed out), a spinner while it works,
   and the one short line under it that says why it is off */
.pill-btn[hidden]{ display:none; }
.pill-btn-block{ align-self:stretch; width:100%; flex:none; }
.pill-btn[disabled], .pill-btn[aria-disabled="true"]{ background:var(--chip); color:var(--accent-press); box-shadow:inset 0 0 0 var(--stroke) var(--border-strong); cursor:default; }
.pill-btn.is-loading[disabled]{ background:var(--accent); color:var(--on-accent); box-shadow:var(--shadow-accent); cursor:progress; }
.pill-btn-reason{ margin:var(--sp-2) 0 0; text-align:center; font-size:var(--fs-caption); line-height:1.4; color:var(--ink-soft); }
.pill-btn-reason:empty{ display:none; }
/* the helper line under a title or a question, left-aligned (the hero's helper, outside a hero) */
.help-text{ margin:var(--sp-1) 0 0; font-size:var(--fs-caption); line-height:1.4; color:var(--ink-soft); }
/* the page header's progress bar: a thin bar under the eyebrow, only when there is something to show */
.screen-head .progress{ margin:var(--sp-2) 0 var(--sp-3); }
.progress:empty{ display:none; }

/* ==========================================================================================
   CLASSIC SCREENS: a screen with class="classic" keeps the look it had before the iOS restyle (today: Housing).
   How: (1) inside it the working tokens point back at the originals, like the brand islands at the top of this file;
   (2) every rule in this file and in ios-screens.css that restyles something found on such a screen ends in
   :where(:not(.classic *)) -- no specificity, it just does not match there -- so styles.css shows through unchanged.
   To give another screen its old look back: add the class, then add that ending to the rules that still reach it.
   What follows is only what stops real breakage on a phone: no sideways scroll, 44px tap targets, long words.
   ========================================================================================== */
.screen.classic{ --gutter: 22px; padding-inline: var(--gutter); background: var(--surface); color: var(--ink); }
@media (max-width: 340px){ .screen.classic{ --gutter: 16px; } }
.classic :where(h1, h2, h3, p, li){ overflow-wrap: break-word; }
/* 44px tap targets, drawn at their original size: the extra height is a transparent border (tappable), the fill is
   clipped to the padding box, and the outline that used to be the border is an inset shadow at the edge of the fill */
.classic .f-chip{
  box-sizing: border-box; min-height: 44px; padding: 0 14.5px; border: solid transparent; border-width: 5.5px 0;
  background: var(--surface) padding-box; box-shadow: inset 0 0 0 1.5px var(--border);
}
.classic .f-chip:hover{ box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.classic .f-chip[aria-pressed="true"]{ background: var(--accent) padding-box; border-color: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.classic .icon-toggle{
  box-sizing: border-box; width: 44px; height: 44px; border: 1.5px solid transparent;
  background: var(--surface-soft) padding-box; box-shadow: inset 0 0 0 1.5px var(--border);
}
.classic .icon-toggle.saved{ background: var(--accent) padding-box; border-color: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.classic .view-toggle button{ box-sizing: border-box; min-height: 44px; }
.classic .btn-sm{ min-height: 44px; }
/* filter chips: one row that scrolls sideways out to the screen's edges (not cut at the margin), no scrollbar, and a
   chip leaving on the right fades out instead of being sliced through a word. The row gives back the height the
   taller targets added, so it sits where it always did. */
.classic .filter-row{
  margin: -5.5px calc(-1 * var(--gutter)) 8.5px; padding: 0 var(--gutter) 0; scroll-padding-inline: var(--gutter); scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent calc(100% - 6px)); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent calc(100% - 6px));
}
.classic .filter-row::-webkit-scrollbar{ display: none; }
.classic .filter-row::after{ content: ""; flex: none; width: 18px; } /* room to scroll the last chip clear of the fade */

/* ==========================================================================================
   CRASH SCREEN, SPLASH
   ========================================================================================== */
.crash-screen{ background: var(--ios-bg); padding: 28px var(--gutter) calc(28px + var(--ios-safe-bottom)); }
.crash-card h2{ font-family: var(--ios-font); font-weight: var(--ios-w-bold); }

/* ==========================================================================================
   REDUCED MOTION: nothing slides
   ========================================================================================== */
@media (prefers-reduced-motion: reduce){
  .chat-fab, .chat-panel, .chat-panel.open, .sp-sheet, .map-sheet, .nav-drawer, .nav-drawer.open, .nav-menu-scrim, .nav-sec-body, .nav-sec-chev, .toast{ transition: none !important; }
}
