/* ============================================================================
   Mississauga Activities — mobile-first, results-first UI.
   Tokens → base → sticky control stack → results → sheets → responsive → motion.
   ========================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfcfe;
  --ink: #15202c;
  --ink-2: #5b6672;
  --ink-3: #69727e;
  --line: #e4e8ed;
  --line-2: #eef1f5;
  --accent: #0b6fb8;
  --accent-ink: #085a96;
  --accent-tint: #e7f1f9;
  --accent-soft: rgba(11, 111, 184, .14);
  --accent-soft-hover: rgba(11, 111, 184, .28);
  --danger: #9a3a2f;
  --ok: #1a7f4b;
  --ok-tint: #e6f3ec;
  --warn: #9a6207;
  --warn-tint: #fbf0db;
  --full: #8a94a0;
  --full-tint: #eef1f4;
  --radius-card: 16px;
  --radius-pill: 999px;
  --radius-btn: 12px;
  --radius-sheet: 22px;
  --shadow-card: 0 1px 2px rgba(16, 32, 44, .04);
  --shadow-hover: 0 6px 18px rgba(16, 32, 44, .10);
  --shadow-pop: 0 8px 28px rgba(16, 32, 44, .14);
  --shadow-sheet: 0 -10px 36px rgba(16, 32, 44, .18);
  --tap: 44px;
  --gutter: 16px;
  --stack-shadow: 0 6px 14px -10px rgba(16, 32, 44, .35);
  /* group accent colours (card left border + sheet dots) */
  --grp-aquatics: #0b87d0;
  --grp-camps: #d98a1e;
  --grp-fitness: #128a6e;
  --grp-racquet: #7c4dd1;
  --grp-team: #d4582f;
  --grp-ice: #2f86c4;
  --grp-othersport: #6a8f1e;
  --grp-learning: #b5418a;
  --grp-arts: #c93f6a;
  --grp-social: #3a7a93;
  --grp-martial: #9a3a2f;
  --grp-other: #7a8694;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1419;
    --surface: #161d25;
    --surface-2: #1b232c;
    --ink: #e8ecef;
    --ink-2: #9aa4af;
    --ink-3: #76828e;
    --line: #26303a;
    --line-2: #202a33;
    --accent: #4ba3e0;
    --accent-ink: #6fb8ec;
    --accent-tint: #15324a;
    --accent-soft: rgba(75, 163, 224, .22);
    --accent-soft-hover: rgba(75, 163, 224, .38);
    --danger: #f0857a;
    --ok: #4cc188;
    --ok-tint: #16352a;
    --warn: #e0a64b;
    --warn-tint: #3a2f18;
    --full: #76828e;
    --full-tint: #222b34;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-hover: 0 6px 18px rgba(0, 0, 0, .45);
    --shadow-pop: 0 8px 28px rgba(0, 0, 0, .5);
    --shadow-sheet: 0 -10px 36px rgba(0, 0, 0, .55);
    --stack-shadow: 0 6px 16px -10px rgba(0, 0, 0, .7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
[hidden] { display: none !important; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.link {
  background: none; border: 0; padding: 0; color: var(--accent); font-size: 13px; font-weight: 600;
}
.link:hover { color: var(--accent-ink); }

/* ---------- Sticky control stack ---------- */
.topstack {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
}
.topstack.scrolled { box-shadow: var(--stack-shadow); }
/* When scrolling down through results, collapse the persona + toolbar rows to
   give the list more room; they slide back as soon as you scroll up. */
.topstack .personas, .topstack .toolbar {
  transition: max-height .22s ease, opacity .18s ease, padding .22s ease;
  /* clip vertically for the collapse animation only — must NOT clip the
     horizontal axis or the persona rail can't scroll to "Adult"/etc. */
  max-height: 90px; overflow-y: hidden;
}
.topstack.stack-min .personas, .topstack.stack-min .toolbar {
  max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; pointer-events: none;
}

.hdr {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px var(--gutter); min-height: 48px;
}
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { display: inline-flex; flex: none; }
.brand-mark svg { display: block; border-radius: 9px; }
.brand-name { font-size: 16px; font-weight: 600; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-city { color: var(--ink); }

.loc-btn {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  max-width: 46vw; padding: 8px 12px; min-height: var(--tap);
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 600;
}
.loc-btn .loc-ic { font-size: 13px; }
.loc-btn span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.loc-btn.is-set { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-tint); }
.loc-btn:hover { border-color: var(--ink-3); }

/* Search */
.searchbar {
  position: relative; display: flex; align-items: center; gap: 8px;
  margin: 2px var(--gutter) 10px;
  padding: 0 12px; min-height: 46px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-pill);
}
.searchbar:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-tint); }
.search-ic { color: var(--ink-3); display: inline-flex; flex: none; }
.searchbar input {
  flex: 1; min-width: 0; border: 0; background: none; padding: 11px 0; font-size: 16px; /* 16px avoids iOS zoom */
}
.searchbar input::placeholder { color: var(--ink-3); }
.searchbar input:focus { outline: none; }
.search-clear {
  flex: none; border: 0; background: var(--line-2); color: var(--ink-2);
  width: 26px; height: 26px; border-radius: 50%; font-size: 13px; line-height: 1;
  display: grid; place-items: center;
}
.search-clear:hover { background: var(--line); }

/* Suggestions dropdown */
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop);
  max-height: 60vh; overflow-y: auto;
}
.suggest li {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px; border-radius: 10px;
  cursor: pointer; min-height: var(--tap);
}
.suggest li[aria-selected="true"], .suggest li:hover { background: var(--accent-tint); }
.suggest .sg-ic { width: 22px; text-align: center; flex: none; }
.suggest .sg-main { flex: 1; min-width: 0; }
.suggest .sg-name { font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.suggest .sg-name b { color: var(--accent-ink); }
.suggest .sg-kind { font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.suggest .sg-count { font-size: 12px; color: var(--ink-3); flex: none; }
.suggest .sg-empty { color: var(--ink-2); padding: 14px 10px; }
.suggest .sg-pophead { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 6px 10px 2px; }

/* Personas rail */
.personas {
  display: flex; align-items: center; gap: 8px;
  padding: 0 var(--gutter) 10px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; scroll-padding-left: var(--gutter);
}
.personas::-webkit-scrollbar { display: none; }
.personas-lead {
  flex: none; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-3); padding-right: 2px;
}
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; min-height: var(--tap);
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 600;
  white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.chip .chip-emoji { font-size: 15px; }
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.chip[aria-pressed="true"] .chip-sub { color: rgba(255, 255, 255, .85); }
.chip-sub { font-size: 11.5px; font-weight: 600; color: var(--ink-3); }

/* Toolbar */
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 var(--gutter) 10px; flex-wrap: wrap;
}
.toolbar-grp { display: flex; gap: 8px; min-width: 0; flex: 1 1 auto; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0;
  padding: 8px 13px; min-height: var(--tap);
  border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 600; white-space: nowrap;
}
.pill-ghost { border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.pill-ghost:hover { border-color: var(--ink-3); color: var(--ink); }
.pill-ghost.is-active { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-tint); }
.pill #typeLabel { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; }
.pill .caret { color: var(--ink-3); font-size: 11px; }
.badge {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--accent); color: #fff; border-radius: var(--radius-pill); font-size: 11px; font-weight: 700;
}
.sortwrap {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 0 6px 0 10px; min-height: var(--tap);
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink-2);
}
.sortwrap-ic { font-size: 13px; }
.sortwrap select { border: 0; background: none; padding: 8px 4px; font-size: 13.5px; font-weight: 600; }
.sortwrap select:focus { outline: none; }

/* ---------- Result bar + active chips ---------- */
.resultbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px var(--gutter) 4px;
}
.count { font-size: 14px; font-weight: 700; color: var(--ink); }
.count .count-sub { font-weight: 500; color: var(--ink-3); }

.active-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 8px var(--gutter) 0; }
.active-chips:empty { display: none; }
.tagchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 11px;
  background: var(--accent-tint); border: 1px solid transparent; color: var(--accent-ink);
  border-radius: var(--radius-pill); font-size: 12.5px; font-weight: 600;
}
.tagchip button {
  border: 0; background: var(--accent-soft); color: var(--accent-ink);
  width: 20px; height: 20px; border-radius: 50%; font-size: 11px; line-height: 1; display: grid; place-items: center;
}
.tagchip button:hover { background: var(--accent-soft-hover); }

/* Quick starts */
.quickstarts { padding: 10px var(--gutter) 2px; }
.quickstarts-lead { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.quickstarts-row { display: flex; gap: 8px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.quickstarts-row::-webkit-scrollbar { display: none; }
.qs {
  flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; min-height: 40px;
  border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--surface);
  font-size: 13.5px; font-weight: 600; white-space: nowrap; box-shadow: var(--shadow-card);
}
.qs:hover { border-color: var(--accent); color: var(--accent-ink); }
.qs .qs-emoji { font-size: 16px; }

/* ---------- Results ---------- */
.results {
  display: grid; grid-template-columns: 1fr; gap: 10px;
  padding: 12px var(--gutter) 8px;
}
.card {
  position: relative; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 13px 14px 13px 16px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 7px;
  transition: transform .1s ease, box-shadow .14s ease, border-color .14s ease;
}
.card::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 4px; border-radius: 4px;
  background: var(--grp, var(--accent));
}
.card:active { transform: scale(.992); }
.card-row1 { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card .card-title { display: block; font-size: 15.5px; font-weight: 650; line-height: 1.3; letter-spacing: -.2px; }
.card-sub { color: var(--ink-2); font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.card-sub .dot { color: var(--ink-3); }
.card-sub .dist { color: var(--accent-ink); font-weight: 700; }
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 1px; }
.mtag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-pill);
  font-size: 11.5px; font-weight: 600; color: var(--ink-2);
}

.status {
  flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px;
  border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 700; white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.ok { color: var(--ok); background: var(--ok-tint); }
.status.low { color: var(--warn); background: var(--warn-tint); }
.status.full { color: var(--ink-2); background: var(--full-tint); }
.status.walkin { color: var(--accent-ink); background: var(--accent-tint); }
.dropin-tag {
  display: inline-flex; align-items: center; padding: 3px 8px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 700; color: var(--warn); background: var(--warn-tint);
}
.fee { font-size: 12.5px; font-weight: 700; color: var(--ink); }

/* Skeletons */
.skel { pointer-events: none; }
.skel .sk { background: linear-gradient(90deg, var(--line-2) 25%, var(--line) 37%, var(--line-2) 63%); background-size: 400% 100%; border-radius: 7px; animation: shimmer 1.3s infinite; }
.skel .sk-title { height: 16px; width: 70%; }
.skel .sk-sub { height: 12px; width: 88%; }
.skel .sk-tags { height: 20px; width: 55%; border-radius: 999px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* Empty / end states */
.empty {
  grid-column: 1 / -1; text-align: center; color: var(--ink-2); padding: 48px 20px 36px;
}
.empty .empty-emoji { font-size: 34px; }
.empty h3 { margin: 12px 0 4px; color: var(--ink); font-size: 17px; }
.empty p { margin: 0 0 16px; }
.empty .empty-chips { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; margin-bottom: 16px; }
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 18px; min-height: var(--tap);
  background: var(--accent); color: #fff; border: 0; border-radius: var(--radius-btn); font-size: 14.5px; font-weight: 700; text-decoration: none;
}
.btn-primary:hover { background: var(--accent-ink); }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 18px; min-height: var(--tap);
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-btn); font-size: 14px; font-weight: 600; text-decoration: none;
}
.btn-ghost:hover { border-color: var(--ink-3); }

.endcap { grid-column: 1 / -1; text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 12px 0 4px; }
.sentinel { height: 1px; }

.appfoot { color: var(--ink-3); font-size: 12px; text-align: center; padding: 18px var(--gutter) calc(28px + env(safe-area-inset-bottom)); }
.appfoot a { font-weight: 600; }

/* ---------- Bottom tab bar + view switching ---------- */
body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; align-items: stretch;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 12px rgba(16, 32, 44, .05);
}
.tab {
  flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 7px 4px; min-height: 54px;
  border: 0; background: none; cursor: pointer; color: var(--ink-3);
  font-size: 11px; font-weight: 600; letter-spacing: .01em;
  -webkit-tap-highlight-color: transparent; transition: color .14s;
}
.tab .tab-ic { width: 24px; height: 24px; display: grid; place-items: center; }
.tab .tab-ic svg { width: 23px; height: 23px; }
.tab .tab-lbl { line-height: 1; }
.tab.on { color: var(--accent); }
.tab:active { color: var(--accent-ink); }

/* The "About" view is hidden until its tab is active; the find UI is hidden while it shows. */
.about { display: none; }
body.view-about .about { display: block; }
body.view-about #topstack,
body.view-about .resultbar,
body.view-about #activeChips,
body.view-about #quickstarts,
body.view-about #results,
body.view-about #sentinel,
body.view-about #appfoot { display: none !important; }

/* ---------- About page ---------- */
.about { max-width: 680px; margin: 0 auto; padding: 18px var(--gutter) 28px; }
.about h1 { font-size: 23px; font-weight: 800; letter-spacing: -.4px; margin: 4px 0 8px; }
.about .about-lead { color: var(--ink-2); font-size: 15px; line-height: 1.55; margin: 0 0 18px; }
.about .about-lead strong { color: var(--ink); }
.about-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 14px 16px; margin: 0 0 12px; box-shadow: var(--shadow-card);
}
.about-card h2 {
  font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-3); margin: 0 0 9px; display: flex; align-items: center; gap: 8px;
}
.about-card h2 span { font-size: 15px; }
.about-card p { margin: 0 0 9px; font-size: 14px; line-height: 1.6; color: var(--ink); }
.about-card p:last-child { margin-bottom: 0; }
.about-card strong { font-weight: 700; }
.about-card.warn { background: var(--warn-tint); border-color: transparent; }
.about-card.warn h2 { color: var(--warn); }
.about-card.warn p { color: color-mix(in srgb, var(--warn) 88%, var(--ink)); }
.about-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 6px; }
.about-fineprint { color: var(--ink-3); font-size: 12px; line-height: 1.5; text-align: center; margin: 14px 0 0; }

@media (min-width: 720px) {
  .tabbar { justify-content: center; gap: 6px; padding-top: 5px; }
  .tab { flex: 0 0 auto; min-width: 132px; flex-direction: row; gap: 9px; border-radius: 12px; padding: 8px 18px; min-height: 46px; font-size: 14px; }
  .tab.on { background: var(--accent-soft); }
  .tab .tab-ic, .tab .tab-ic svg { width: 20px; height: 20px; }
}

/* ---------- Sheets / modals ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(16, 24, 36, .5);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  animation: fade .18s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  position: fixed; z-index: 90; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  box-shadow: var(--shadow-sheet); max-height: 90dvh;
  animation: sheet-up .26s cubic-bezier(.32, .72, 0, 1);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-grab { width: 40px; height: 4px; border-radius: 4px; background: var(--line); margin: 8px auto 2px; flex: none; }
.sheet-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 14px 10px;
}
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; }
.sheet-back, .sheet-close {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 10px; background: var(--surface-2);
  color: var(--ink-2); display: grid; place-items: center; font-size: 16px;
}
.sheet-back { font-size: 24px; }
.sheet-back:hover, .sheet-close:hover { background: var(--line-2); color: var(--ink); }
.sheet-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 14px 12px; -webkit-overflow-scrolling: touch; }
.sheet-foot {
  flex: none; display: flex; align-items: center; gap: 12px; padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
}
.sheet-foot .btn-primary { flex: 1; }

/* Sheet content blocks */
.sheet-section { padding: 6px 0 14px; border-bottom: 1px solid var(--line-2); }
.sheet-section:last-child { border-bottom: 0; }
.sheet-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: 8px 0 9px; }

/* Big tappable option rows (personas in sheet, groups) */
.optrow {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 13px 12px; min-height: var(--tap); border: 1px solid var(--line); border-radius: 13px;
  background: var(--surface); margin-bottom: 8px;
}
.optrow:hover { border-color: var(--ink-3); }
.optrow.sel { border-color: var(--accent); background: var(--accent-tint); }
.optrow .opt-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--grp, var(--accent)); }
.optrow .opt-emoji { font-size: 20px; width: 26px; text-align: center; flex: none; }
.optrow .opt-main { flex: 1; min-width: 0; }
.optrow .opt-name { font-weight: 650; font-size: 15px; }
.optrow .opt-sub { font-size: 12.5px; color: var(--ink-2); }
.optrow .opt-count { font-size: 12.5px; color: var(--ink-3); font-weight: 600; flex: none; }
.optrow .opt-check {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line); flex: none; display: grid; place-items: center;
  color: #fff; font-size: 13px;
}
.optrow.sel .opt-check { background: var(--accent); border-color: var(--accent); }
.optrow .opt-chev { color: var(--ink-3); font-size: 18px; flex: none; }

/* Segmented toggle group (time of day, days, presets, availability) */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-btn {
  flex: 1 1 auto; min-width: 64px; min-height: var(--tap); padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 11px; background: var(--surface);
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
}
.seg-btn:hover { border-color: var(--ink-3); }
.seg-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.days-seg .seg-btn { flex: 1 1 0; min-width: 0; padding: 9px 4px; }

/* Switch rows */
.switchrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 2px; min-height: var(--tap); }
.switchrow .sw-main { min-width: 0; }
.switchrow .sw-name { font-weight: 600; font-size: 14.5px; }
.switchrow .sw-sub { font-size: 12.5px; color: var(--ink-2); }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: background .16s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .16s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Range / distance */
.rangerow { display: flex; align-items: center; gap: 12px; }
.rangerow input[type=range] { flex: 1; accent-color: var(--accent); height: 28px; }
.rangerow .range-val { font-weight: 700; color: var(--accent-ink); min-width: 54px; text-align: right; }
.range-hint { color: var(--ink-2); font-size: 13px; }

/* Location sheet */
.locform { display: flex; gap: 8px; margin: 6px 0 10px; }
.locform input { flex: 1; min-width: 0; padding: 11px 13px; font-size: 16px; border: 1px solid var(--line); border-radius: var(--radius-btn); background: var(--surface-2); }
.locform input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.locform button { flex: none; }
.loc-geo { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.loc-msg { font-size: 13px; color: var(--ink-2); min-height: 18px; margin-top: 2px; }
.loc-msg.err { color: var(--danger); }

/* Text input (exclude words) */
.textfield { width: 100%; padding: 11px 13px; font-size: 16px; border: 1px solid var(--line); border-radius: var(--radius-btn); background: var(--surface-2); }
.textfield:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }

/* ---------- Detail sheet ---------- */
.detail .det-tagline { color: var(--ink-2); font-size: 13.5px; display: flex; align-items: center; gap: 6px; margin: -2px 0 14px; }
.detail .det-tagline .grp-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--grp, var(--accent)); }
.detail .det-status { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.detail .det-note { margin: -6px 0 14px; padding: 10px 12px; font-size: 13px; line-height: 1.45; color: var(--accent-ink); background: var(--accent-tint); border-radius: 10px; }
.detail dl.det-dl { display: grid; grid-template-columns: 26px 1fr; gap: 12px 12px; margin: 0 0 16px; align-items: start; }
.detail dl.det-dl dt { text-align: center; color: var(--ink-3); }
.detail dl.det-dl dd { margin: 0; }
.detail dl.det-dl dd .lead { font-weight: 600; }
.detail dl.det-dl dd .sub { color: var(--ink-2); font-size: 13px; }
.detail .det-desc { color: var(--ink); font-size: 14px; line-height: 1.55; border-top: 1px solid var(--line-2); padding-top: 14px; margin-bottom: 4px; }

/* ---------- Responsive: tablet & desktop ---------- */
@media (min-width: 600px) {
  :root { --gutter: 22px; }
  .results { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
  .resultbar, .active-chips, .quickstarts { max-width: 1180px; margin-left: auto; margin-right: auto; }
}

@media (min-width: 900px) {
  body { font-size: 15px; }
  .topstack { padding-left: max(0px, calc((100vw - 1180px) / 2)); padding-right: max(0px, calc((100vw - 1180px) / 2)); }
  .hdr { min-height: 56px; }
  .brand-name { font-size: 18px; }
  .searchbar { max-width: 460px; margin-left: var(--gutter); }
  .personas { padding-bottom: 12px; flex-wrap: wrap; overflow: visible; }
  .results, .resultbar, .active-chips, .quickstarts { max-width: 1180px; margin-left: auto; margin-right: auto; }
  .results { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
  .card:hover { border-color: var(--ink-3); box-shadow: var(--shadow-hover); transform: translateY(-2px); }

  /* Sheets become centered dialogs on desktop */
  .sheet {
    left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%);
    width: min(560px, 92vw); max-height: 84dvh; border-radius: 18px;
    animation: pop-in .2s ease;
  }
  @keyframes pop-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
  .sheet-grab { display: none; }
  .sheet-foot { border-radius: 0 0 18px 18px; padding-bottom: 14px; }
}

@media (min-width: 1280px) {
  .results { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .sheet { animation: fade .12s ease; }
}

/* Hover lift only where hover is real (skip touch) */
@media (hover: none) {
  .card:hover { box-shadow: var(--shadow-card); transform: none; border-color: var(--line); }
}
