/* =========================================================
   FindIt — base styles
   Palette is set at :root so every component stays in sync.
   ========================================================= */

:root {
  /* Color tokens (WCAG AA verified for body text on bg) */
  --bg: #FAF7F2;
  --surface: #FFFFFF;
  --surface-2: #F4EFE6;
  --ink: #14252B;
  --muted: #595959;
  --border: #E3DCCB;
  --primary: #14383F;
  --primary-hover: #0E2A30;
  --accent: #B23A1F;
  --accent-hover: #8E2C14;
  --danger: #9A2E2E;
  --danger-hover: #7A2222;
  --success: #2A6B45;
  --warn: #B5821A;
  --bubble: #E2EBE7; /* user chat bubble: a quiet teal wash of --primary */
  --on-primary: #FFFFFF;      /* text/icons on primary|danger|accent fills */
  --scrim: rgba(20, 37, 43, 0.4);
  --peg-dot: rgba(20, 37, 43, 0.10);
  --arrange-bg: #EFE8DA;      /* "the canvas is editable" parchment tint */
  --danger-surface: #FBF0EE;
  --warn-surface: #FFF7E6;
  --warn-border: #F0DBA8;
  color-scheme: light;

  /* Spacing scale */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* Type (v2.26): the system stack for every word you read or tap — SF on
     an iPhone, like Secretary — and Fraunces only for display: the
     wordmark, page titles, direction labels. */
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, Roboto, "Segoe UI", sans-serif;
  --font-display: 'Fraunces', 'Georgia', serif;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(20, 37, 43, 0.06);
  --shadow-md: 0 4px 12px rgba(20, 37, 43, 0.08);
  --shadow-lg: 0 12px 32px rgba(20, 37, 43, 0.12);
}

/* ---------- Dark theme (the default) ----------
   Same warm brand, inverted: deep teal-black ground, cream ink, the teal
   lightened enough to carry on dark surfaces (which is also why
   --on-primary flips dark — white on the lightened teal would wash out).
   Everything else in this file speaks tokens or color-mix, so this block
   IS the dark mode. */
html[data-theme="dark"] {
  --bg: #101B1E;
  --surface: #182A2F;
  --surface-2: #1F343A;
  --ink: #E8E3D8;
  --muted: #9BA8A6;
  --border: #2E444B;
  --primary: #7FB5AE;
  --primary-hover: #93C6BF;
  --accent: #E07A5F;
  --accent-hover: #E98F77;
  --danger: #E07070;
  --danger-hover: #EA8888;
  --success: #6FBF8F;
  --warn: #D9A84E;
  --bubble: #24423F;
  --on-primary: #0E1F22;
  --scrim: rgba(0, 0, 0, 0.6);
  --peg-dot: rgba(232, 227, 216, 0.10);
  --arrange-bg: #22362F;
  --danger-surface: #3A2323;
  --warn-surface: #3A3120;
  --warn-border: #5A4A26;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* Illustration assets ship the light palette baked in; on dark they sit as
   little cream vignettes — dimmed so they don't glow — and the ink-colored
   logo flips to a light silhouette or it vanishes into the header. */
html[data-theme="dark"] .logo img { filter: brightness(0) invert(0.92); }
html[data-theme="dark"] .empty-state img,
html[data-theme="dark"] .confirm-card img,
html[data-theme="dark"] .hero-art img,
html[data-theme="dark"] .about-art img,
html[data-theme="dark"] .feature img,
html[data-theme="dark"] img.placeholder { filter: brightness(0.88); }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3, h4 {
  font-family: var(--font-body);
  color: var(--ink);
  margin: 0 0 var(--s-3);
  line-height: 1.25;
  font-weight: 600;
}
/* A page title is display type; everything under it is text (v2.26). */
h1 { font-size: 2rem; font-family: var(--font-display); letter-spacing: -0.01em; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 var(--s-3); }

img { max-width: 100%; height: auto; display: block; }

.muted { color: var(--muted); }

.lead {
  font-size: 1.15rem;
  color: var(--ink);
  max-width: 56ch;
}

/* ---------- Header & Footer ---------- */

/* Only a visitor sees this (v2.26) — a signed-in page floats the app's ☰ +
   search bar instead. Drawn as the same floating pill, on the same tokens,
   so the pitch is not a different website. */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  /* Standalone on a phone paints under the status bar (viewport-fit=cover).
     env() is 0 everywhere else. */
  margin: max(var(--s-3), env(safe-area-inset-top, 0px)) max(var(--s-3), env(safe-area-inset-right, 0px)) 0 max(var(--s-3), env(safe-area-inset-left, 0px));
  padding: var(--s-1) var(--s-1) var(--s-1) var(--s-4);
  min-height: 52px;
  background: var(--surface);
  border-radius: 999px;
  box-shadow: var(--shadow-md);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--ink);
}
.logo:hover { text-decoration: none; }
.logo img { width: 32px; height: 32px; }

.site-nav ul {
  display: flex;
  gap: var(--s-1);
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  color: var(--ink);
  font-weight: 500;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-sm);
}
.site-nav a:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.nav-divider {
  width: 1px;
  height: 22px;
  background: var(--border);
}
.nav-user { color: var(--muted); font-size: 0.9rem; }
.logout-form { margin: 0; }
.site-nav .btn { border-radius: 999px; }

.site-main {
  flex: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--s-7) var(--s-5);
}

.site-footer {
  padding: var(--s-5);
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}
.site-footer p { margin: 0; }

/* A class's `display` beats the browser's own [hidden] rule, which bit this
   file over and over (the lend dialog, the picker, the chat panel, the
   Account page's three notification buttons showing at once — v2.60). Every
   use of `hidden` here means not shown, so it wins everywhere now; the older
   scoped rules below are kept, and harmless. */
[hidden] { display: none !important; }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease, transform 80ms ease;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.btn.primary { background: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }

.btn.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}
.btn.secondary:hover { background: var(--surface-2); }

.btn.danger { background: var(--danger); color: var(--on-primary); }
.btn.danger:hover { background: var(--danger-hover); }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: transparent;
}
.btn.ghost:hover { background: var(--surface-2); }
.btn.ghost.danger { color: var(--danger); }
.btn.ghost.danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }

.btn.large { padding: 14px 24px; font-size: 1.05rem; }
.btn.small { padding: 6px 12px; font-size: 0.9rem; }
.btn.block { width: 100%; }

/* ---------- Page header ---------- */

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-5);
  margin-bottom: var(--s-6);
  flex-wrap: wrap;
}
.page-header h1 { margin-bottom: var(--s-1); }
.page-header .muted { margin: 0; }

/* ---------- Card grids ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--s-5);
}

.item-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.item-card-photo {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  overflow: hidden;
}
.item-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.95);
}
.item-card-photo img.placeholder {
  object-fit: contain;
  padding: var(--s-6);
  filter: none;
  opacity: 0.55;
}
.item-card-body {
  padding: var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.item-card-body h3 small {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Location cards */
.loc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-5);
  display: flex;
  gap: var(--s-4);
  align-items: flex-start;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.loc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.loc-card-icon {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
}
.loc-card-icon img { width: 28px; height: 28px; }
.loc-card-body h3 { margin: 0 0 var(--s-1); }

.lent-person-name {
  flex-shrink: 0;
  margin-left: auto;
  padding-left: var(--s-3);
  font-size: 0.9em;
}

/* Tag cards */
.tag-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.tag-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 6px solid var(--tag-color, var(--primary));
  border-radius: var(--radius);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  box-shadow: var(--shadow-sm);
}
.tag-card .tag-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--tag-color, var(--primary));
}
.tag-card-actions {
  display: flex;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

/* Stat cards on dashboard */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
  gap: var(--s-4);
  margin: var(--s-6) auto;
  justify-content: center;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.stat-number {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1;
}
.stat-label { color: var(--muted); font-size: 0.95rem; }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 420px));
  gap: var(--s-5);
  margin: 0 auto var(--s-6);
  justify-content: center;
}
.dashboard-cta {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  justify-content: center;
}

/* ---------- Panels & detail ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-5);
  box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: var(--s-5); }
.panel.quiet {
  background: transparent;
  border: 1px dashed var(--border);
  box-shadow: none;
}

.detail-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: var(--s-6);
  align-items: start;
}
@media (max-width: 800px) {
  /* minmax(0, 1fr), not 1fr: a grid track's default minimum is min-content,
     so one unshrinkable child (a nowrap button row, a wide table) would
     stretch the column past the phone's viewport and scroll the page. */
  .detail-shell { grid-template-columns: minmax(0, 1fr); }
}

/* The photo sits at the top of the thing and scrolls away with it. It is
   never pinned: a sticky photo rides over (or under) everything below it —
   most visibly a container's contents canvas. */
.detail-photo {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}
.detail-photo img { width: 100%; height: 100%; object-fit: cover; }
.detail-photo img.placeholder { object-fit: contain; padding: var(--s-6); opacity: 0.55; }

.detail-main { display: flex; flex-direction: column; gap: var(--s-5); }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-4);
  flex-wrap: wrap;
}
/* Four nowrap buttons ("+ Add inside", "Lend out", "Edit", "Delete") want
   more than a 390px phone has, and flex items default to min-width: auto so
   none of them would give — the row has to break onto a second line. */
.detail-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }

.kv-list {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-5);
  box-shadow: var(--shadow-sm);
}
.kv-list > div {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: var(--s-4);
  padding-bottom: var(--s-3);
  border-bottom: 1px solid var(--border);
}
.kv-list > div:last-child { padding-bottom: 0; border-bottom: none; }
.kv-list dt { color: var(--muted); margin: 0; font-size: 0.95rem; }
.kv-list dd { margin: 0; }
@media (max-width: 600px) {
  .kv-list > div { grid-template-columns: 1fr; gap: var(--s-1); }
}

.confirm-strip {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  background: var(--warn-surface);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: var(--s-4) var(--s-5);
  flex-wrap: wrap;
}
.confirm-strip p { margin: 0; }

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.history-list li {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
  flex-wrap: wrap;
}
.history-list li:last-child { border-bottom: none; }
.history-list time {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 0.9rem;
  width: 110px;
}
.history-body { flex: 1 1 220px; }
.history-actions {
  display: flex;
  gap: var(--s-2);
  margin-left: auto;
}

/* ---------- Forms ---------- */

/* Notification toggles on the Account page: big tap target, label does
   the work, the checkbox submits on change. */
.pref-rows { margin-top: var(--s-3); }
.pref-toggle {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  padding: var(--s-2) 0;
  cursor: pointer;
}
.pref-toggle input[type='checkbox'] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  flex: none;
  accent-color: var(--primary);
}

/* Sharing panel on the spot edit page: the owner's grant list + add form,
   styled like a slim sibling of the big form above it. */
.share-panel {
  margin-top: var(--s-4);
  padding: var(--s-4) var(--s-6);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.share-panel h2 { margin: 0 0 4px; font-size: 1.1rem; }
.share-row {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.share-row-name { flex: 1; min-width: 0; font-weight: 600; }
/* An invitation not yet accepted (v2.65): the name, then its state. */
.share-row-state { display: block; font-weight: 400; font-size: 0.85rem; color: var(--muted); }
.share-add { display: flex; gap: var(--s-2); margin-top: var(--s-3); }
.share-add input { flex: 1; min-width: 0; }
/* The role dropdown: compact, not the form-wide full-width select. */
.share-role {
  width: auto;
  min-height: 44px;
  padding: 4px 8px;
  /* 16px floor: smaller and iOS zooms the page on focus. */
  font-size: 16px;
}

.big-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-6);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: var(--s-5);
  max-width: 720px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.field label {
  font-weight: 500;
  color: var(--ink);
}
.field .help { color: var(--muted); font-size: 0.9rem; margin: 0; }
.field .error { color: var(--danger); font-size: 0.9rem; margin: 0; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }

input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="url"],
textarea,
select {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: 3px solid color-mix(in oklab, var(--primary) 30%, transparent);
  outline-offset: 1px;
  border-color: var(--primary);
}
textarea { resize: vertical; min-height: 80px; }
/* A Notes box — a thing's or a spot's, deliberately both — grows with what
   is in it where the browser can (field-sizing: content; item_form.html
   carries a script that does the same where it can't, WebKit as of v2.16).
   Capped so a long note never pushes Save off screen. */
textarea[name="notes"] { field-sizing: content; min-height: 80px; max-height: 40vh; }

input[type="file"] {
  font: inherit;
  padding: 8px 0;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* checkbox lists for tags-on-item form */
ul[id*="tags"] {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
ul[id*="tags"] li label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
}
ul[id*="tags"] input[type="checkbox"]:checked + span,
ul[id*="tags"] input[type="checkbox"]:checked ~ span {
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: var(--s-3);
  justify-content: flex-end;
}

.stacked-form {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.inline-form { display: inline; }
.inline-form button { font: inherit; }

.filter-bar {
  display: flex;
  gap: var(--s-3);
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-3) var(--s-4);
  margin-bottom: var(--s-5);
  align-items: center;
  box-shadow: var(--shadow-sm);
}
.filter-bar input[type="search"] { flex: 1 1 280px; }
.filter-bar select { flex: 0 1 180px; }
.filter-bar .check {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 0.95rem;
  color: var(--muted);
}

.big-form .helptext {
  color: var(--muted);
  font-size: 0.85rem;
  display: block;
  margin-top: 4px;
}

.form-error {
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger);
  padding: var(--s-3);
  border-radius: var(--radius-sm);
  margin-bottom: var(--s-3);
}
/* A way out inside the message (the locked sign-in's "reset your password",
   v2.47): underlined, so it reads as a link without the colour. */
.form-error a { text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }

/* ---------- Tag chips ---------- */

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  list-style: none;
  margin: 0;
  padding: 0;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--on-primary);
  letter-spacing: 0.01em;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}
.tag-chip.removable form { display: inline; margin: 0; }
/* The × still reads as an 18px dot, but a thumb gets 44px to hit: the box is
   grown with padding and pulled back by an equal negative margin, so the
   chip's layout is untouched, and background-clip keeps the tint on the
   18px content box instead of painting the whole target. */
.tag-chip.removable button {
  background: rgba(255, 255, 255, 0.25);
  background-clip: content-box;
  color: var(--on-primary);
  border: none;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  font-size: 0.8rem;
  cursor: pointer;
  font: inherit;
  padding: 13px;
  margin: -13px;
}
.tag-chip.add {
  border: 1px dashed rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

/* ---------- Badges ---------- */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.badge.archived { background: var(--surface-2); color: var(--muted); }
.badge.soft { background: color-mix(in srgb, var(--primary) 12%, transparent); color: var(--primary); }

/* ---------- Empty state ---------- */

.empty-state {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: var(--s-6) var(--s-4);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s-3);
}
.empty-state img { width: 120px; opacity: 0.85; }
.empty-state h2 { margin: 0; }
.empty-state p { color: var(--muted); max-width: 40ch; }

.empty-search {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-5);
  margin-bottom: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  align-items: flex-start;
}

/* ---------- Confirm card (delete pages) ----------
   v2.26: an .app-card under the page's title pill; the actions sit at the
   end, Cancel before the destructive one. */
.confirm-card .confirm-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-top: var(--s-4);
}

/* ---------- Hero (logged-out home) ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--s-7);
  align-items: center;
  margin-bottom: var(--s-8);
}
.hero h1 {
  font-size: clamp(2rem, 4.5vw, 3.4rem);
  margin-bottom: var(--s-4);
}
.hero .lead { font-size: 1.2rem; }
.hero-actions { display: flex; gap: var(--s-3); flex-wrap: wrap; margin-top: var(--s-5); }
.hero-art img { width: 100%; max-width: 460px; margin-left: auto; }
@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; }
}

.features { margin-top: var(--s-7); }
.features h2 { text-align: center; margin-bottom: var(--s-6); }
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--s-5);
}
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  box-shadow: var(--shadow-sm);
}
.feature img { width: 56px; height: 56px; }
.feature h3 { margin: 0; }

/* ---------- Dashboard greeting ---------- */

.dashboard-greeting {
  margin-bottom: var(--s-4);
  text-align: center;
}
.dashboard-greeting h1 { font-size: 2.4rem; }
.dashboard-greeting .lead { margin-left: auto; margin-right: auto; }
.dashboard { display: flex; flex-direction: column; }


/* ---------- About page ---------- */

.about-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: var(--s-6);
  align-items: center;
  margin-bottom: var(--s-7);
}
.about-hero h1 { font-size: clamp(2rem, 4vw, 3rem); }
/* width:100% (as .hero-art img) so the 400px cap can't outgrow a 390px
   phone column — it used to push the whole page 27px wide (v2.17). */
.about-art img { width: 100%; max-width: 400px; margin-left: auto; }
@media (max-width: 720px) {
  .about-hero { grid-template-columns: minmax(0, 1fr); }
}

.about-body .prose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--s-7);
  max-width: 800px;
  margin: 0 auto;
  box-shadow: var(--shadow-sm);
}
.prose h2 { margin-top: var(--s-6); margin-bottom: var(--s-3); }
.prose h2:first-of-type { margin-top: 0; }
.prose ul { padding-left: var(--s-5); }
.prose li { margin-bottom: var(--s-2); }

.bio-row {
  display: flex;
  gap: var(--s-4);
  align-items: flex-start;
  background: var(--surface-2);
  padding: var(--s-4);
  border-radius: var(--radius);
  margin: var(--s-3) 0;
}
.avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--surface);
}
.bio-row p { margin: 0 0 var(--s-2); }
.bio-row p:last-child { margin: 0; }

.credits { list-style: none; padding: 0; }
.credits li {
  padding: var(--s-2) 0;
  border-bottom: 1px solid var(--border);
}
.credits li:last-child { border-bottom: none; }

/* ---------- Lists ---------- */

.list-plain {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}


/* ---------- Location map (tree + panel) ---------- */

.loc-map {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: var(--s-5);
  align-items: start;
}

.loc-map-tree {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--s-4);
  position: sticky;
  top: var(--s-4);
  max-height: calc(100vh - var(--s-7));
  overflow-y: auto;
}

.loc-map-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: var(--s-5);
  min-height: 320px;
}

.loc-tree {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
}
.loc-tree .loc-tree { padding-left: var(--s-4); margin-top: var(--s-1); }
.loc-tree-node { line-height: 1.6; }
.loc-tree-node summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--s-1);
}
.loc-tree-node summary::-webkit-details-marker { display: none; }
.loc-tree-node summary::before {
  content: '▸';
  font-size: 0.7rem;
  color: var(--muted);
  transition: transform 0.15s;
  display: inline-block;
}
.loc-tree-node details[open] > summary::before { transform: rotate(90deg); }

.loc-tree-link {
  background: none;
  border: 0;
  padding: 2px var(--s-2);
  border-radius: 6px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.loc-tree-link.leaf { padding-left: calc(var(--s-2) + 0.7rem + var(--s-1)); }
.loc-tree-link:hover { background: var(--surface-2); }

.tree-drop-zone {
  display: inline-block;
  border-radius: 6px;
  transition: outline 0.1s, background 0.1s;
}
.tree-drop-zone.drop-active {
  outline: 2px dashed var(--primary);
  background: var(--surface-2);
}

.loc-panel-header {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--border);
}
.loc-panel-header h2 { margin: 0; }
.loc-panel-header .detail-actions { margin-top: var(--s-2); }

.panel-section { margin-top: var(--s-5); }
.panel-section h3 { margin: 0 0 var(--s-3); font-size: 1.05rem; }
.panel-action { margin: var(--s-5) 0 0; }
.muted.small { font-size: 0.85rem; }

.subloc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--s-3);
}

.subloc-card {
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: var(--s-4);
  min-height: 92px;
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.subloc-card:hover { border-color: var(--primary); }
.subloc-card-title {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.subloc-card-title:hover { color: var(--primary); }

.subloc-card.drop-active {
  border-color: var(--primary);
  background: var(--surface);
  border-style: dashed;
}

.item-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  min-height: 40px;
}

.item-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px var(--s-3);
  font-size: 0.95rem;
  transition: box-shadow 0.15s, transform 0.1s;
}
.item-chip:hover { box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.item-chip a { color: var(--ink); font-weight: 500; }

.drag-handle {
  display: inline-block;
  cursor: grab;
  color: var(--muted);
  font-size: 1rem;
  letter-spacing: -2px;
  padding: 0 2px;
  user-select: none;
  line-height: 1;
}
.drag-handle:hover { color: var(--ink); }
.drag-handle:active { cursor: grabbing; }


@media (max-width: 720px) {
  .loc-map { grid-template-columns: 1fr; }
  .loc-map-tree { position: static; max-height: none; }
}

/* ---------- Responsive header ---------- */

@media (max-width: 720px) {
  /* The visitor's pill stays one line on a phone (v2.26): wordmark left,
     Log in / Sign up right; About moves to the footer below 420px. */
  .site-header { gap: var(--s-2); }
  .site-nav ul { flex-wrap: nowrap; }
  .site-nav a { padding: var(--s-2) 10px; }
  .site-main { padding: var(--s-5) var(--s-4); }
  /* The form's only Save is the sticky bar, so the last field is the end
     of the page: keep it clear of the mic FAB (60px + its bottom inset). */
  .big-form { margin-bottom: var(--s-7); }
}

/* ---------- Location icons (inline Lucide SVG, recolorable via currentColor) ---------- */

.loc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.2em;
  flex-shrink: 0;
  line-height: 1;
}
.loc-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  stroke: currentColor;
  fill: none;
}

.loc-name { display: inline-flex; align-items: center; gap: 0.4em; }
.loc-name .loc-icon { color: var(--muted); }
a:hover .loc-name .loc-icon,
button:hover .loc-name .loc-icon { color: var(--ink); }

/* ---------- Icon picker ---------- */

.icon-picker { display: flex; flex-direction: column; gap: var(--s-2); }

.icon-current {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.icon-current .loc-icon {
  width: 1.6em;
  height: 1.6em;
  color: var(--ink);
}
.icon-current .loc-icon.no-icon {
  background: var(--surface-2);
  border-radius: 999px;
}
.icon-current .loc-icon.no-icon::before {
  content: '?';
  color: var(--muted);
  font-size: 0.9em;
}
.icon-current-label { flex: 1; }
.btn.small { padding: 4px 10px; font-size: 0.85rem; }

.icon-search {
  width: 100%;
  padding: var(--s-2) var(--s-3);
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 4px;
  max-height: 260px;
  overflow-y: auto;
  padding: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.icon-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  padding: 0;
}
.icon-option:hover { background: var(--surface-2); color: var(--ink); }
.icon-option.selected {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--surface-2);
}
.icon-option .loc-icon { width: 20px; height: 20px; }

/* ---------- Location list: grouped roots + nested sub-cards ---------- */

.loc-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s-5);
  align-items: start;
}

.loc-group {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.loc-sub-list {
  list-style: none;
  margin: 0 0 0 var(--s-5);
  padding: 0 0 0 var(--s-4);
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.loc-sub { display: flex; flex-direction: column; gap: var(--s-2); }

.loc-sub-card {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.95rem;
  transition: background 120ms ease, border-color 120ms ease;
}
.loc-sub-card:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  text-decoration: none;
}
.loc-sub-name { font-weight: 500; }
.loc-sub-card .muted.small { margin-left: auto; }

/* ---------- Map tree search ---------- */

.loc-tree-search {
  width: 100%;
  margin-bottom: var(--s-3);
  padding: var(--s-2) var(--s-3);
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
}
.loc-tree-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
}
.loc-tree-empty { margin: 0 0 var(--s-3); }
.loc-tree-section-title {
  margin: var(--s-4) 0 var(--s-2);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.loc-tree-section-title:first-of-type { margin-top: 0; }

/* ---------- Home: collection tree (org-chart style) ---------- */

.collection-tree {
  margin: 0 0 var(--s-6);
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.collection-tree-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  flex-wrap: wrap;
}
.collection-tree-header h2 { margin: 0; font-size: 1.6rem; }
.collection-tree-header .muted.small { margin: 0; }

/* ---------- The Tree outline (v2.43) ----------
   Like a Files list view: one 48px row per spot or thing, collapsed under
   chevrons; each level indented by a fixed step with a thin guide line
   under its parent's chevron. Long names wrap to two lines, never wider
   than the screen. */
.otree-wrap {
  --ot-step: 20px;
  --ot-chev: 44px;          /* the chevron's hit area: 44 wide at every width, the row's full height */
  max-width: 760px;
  margin: 0 auto;
  padding: var(--s-2) 0 var(--s-8);
}
@media (max-width: 360px) {
  .otree-wrap { --ot-step: 14px; }
  .ot-lead { width: 32px; height: 32px; }
  .ot-link { gap: var(--s-2); }
}
.ot-filter {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 0 var(--s-3);
}
.ot-filter-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
.otree-wrap input.ot-filter-input {
  width: 100%;
  min-height: 44px;
  padding: 0 16px 0 40px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.otree-wrap input.ot-filter-input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
/* Room for "24 matches" only once there is something typed. */
.otree-wrap input.ot-filter-input:not(:placeholder-shown) { padding-right: 104px; }
.ot-summary { margin: 0 0 var(--s-3); padding: 0 var(--s-1); font-size: 0.85rem; color: var(--muted); }
.ot-filter-count {
  position: absolute;
  right: 16px;
  font-size: 0.8rem;
  color: var(--muted);
  pointer-events: none;
}
.otree, .ot-kids { list-style: none; margin: 0; padding: 0; }
.otree {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.ot-kids {
  position: relative;
  padding-left: var(--ot-step);
}
/* The guide line: under the parent's chevron, down the whole level. */
.ot-kids::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 12px;
  left: calc(var(--ot-chev) / 2);
  border-left: 1px solid var(--border);
}
.ot-kids[hidden] { display: none; }
.otree.is-filtering .ot-kids.ot-force-open { display: block; }
.otree.is-filtering .ot-forced > .ot-row > .ot-chev::before { transform: rotate(45deg); margin: -3px 0 0; }
.ot-node.ot-out { display: none; }
.ot-row {
  display: flex;
  align-items: stretch;
  min-height: 48px;
  border-top: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.otree > .ot-node:first-child > .ot-row { border-top: 0; }
.ot-chev {
  flex: none;
  width: var(--ot-chev);
  min-height: 48px;
}
/* A row with nothing inside has no chevron; its body keeps the column. */
.ot-row > .ot-link:first-child { margin-left: var(--ot-chev); }
.ot-chev {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
/* Drawn, not an SVG per row (a thousand rows add up). */
.ot-chev::before {
  content: '';
  width: 8px;
  height: 8px;
  margin-left: -3px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.ot-chev[aria-expanded="true"]::before { transform: rotate(45deg); margin: -3px 0 0; }
.ot-chev:focus-visible, .ot-link:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.ot-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 6px var(--s-3) 6px 0;
  color: var(--ink);
  text-decoration: none;
  text-align: left;
  font: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}
a.ot-link:hover .ot-name { text-decoration: underline; }
.ot-lead {
  position: relative;
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  color: var(--primary);
}
.ot-lead .loc-icon, .ot-lead .loc-icon svg { width: 20px; height: 20px; }
.is-thing > .ot-row .ot-lead { background: var(--surface-2); color: var(--muted); }
.ot-lead.has-photo { background: var(--surface-2); }
.ot-lead img:not([data-crop]) { width: 100%; height: 100%; object-fit: cover; }
.is-self > .ot-row .ot-lead { border-radius: 50%; background: var(--primary); color: var(--on-primary); }
.ot-text { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ot-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  line-height: 1.3;
  font-weight: 500;
}
.is-spot > .ot-row .ot-name, .is-self > .ot-row .ot-name, .is-person > .ot-row .ot-name { font-weight: 650; }
.ot-qty { color: var(--muted); font-weight: 500; }
.ot-meta {
  font-size: 0.82rem;
  line-height: 1.3;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.ot-meta .ot-on-you { color: var(--primary); font-weight: 600; }
.ot-meta .ot-lent { color: var(--accent); font-weight: 600; }
.otree.is-filtering .ot-node.is-match > .ot-row { background: color-mix(in srgb, var(--primary) 9%, transparent); }
.ot-none { text-align: center; margin: var(--s-5) 0; }

/* ---------- My Things: view toggle + list view ---------- */

.view-toggle {
  display: inline-flex;
  gap: var(--s-1);
  margin: 0 0 var(--s-4);
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.item-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: background 120ms ease, border-color 120ms ease;
}
.item-row:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  text-decoration: none;
}
.item-row-thumb {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.item-row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.item-row-thumb img.placeholder {
  width: 65%;
  height: 65%;
  object-fit: contain;
  opacity: 0.5;
}
.item-row-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}
.item-row-name { font-weight: 500; }
.item-row-name small { font-weight: 400; color: var(--muted); }
.item-row .tag-row {
  margin: 0 0 0 auto;
  flex-shrink: 0;
}
.item-row .badge.archived { margin-left: var(--s-2); }

/* ---------- A mapped space in 3D (v2.92) ---------- */

.space3d-stage {
  position: relative;
  isolation: isolate;   /* the labels' own z-index stays inside, under the page's header */
  scroll-margin-top: calc(80px + env(safe-area-inset-top, 0px));   /* clear of the fixed bar */
  height: min(62vh, 560px);
  min-height: 300px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  overflow: hidden;
}
/* Only the canvas takes the fingers: the page around it still scrolls. */
.space3d-gl { position: absolute; inset: 0; display: block; touch-action: none; }
/* z-index 1 makes the layer its own stacking context: CSS2DRenderer's per-pin
   z-index stays under the card and the placing banner (v2.93). */
.space3d-labels { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.space3d-status {
  position: absolute; inset: 0; margin: 0; padding: var(--s-4);
  display: grid; place-items: center; text-align: center; color: var(--muted);
}
.space3d-status[hidden] { display: none; }
.space3d-pin {
  --z: #666666;
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 26px; height: 26px; padding: 0 7px;
  border-radius: 999px; border: 2px solid var(--z);
  background: var(--surface); color: var(--ink);
  font: 700 12px/1 system-ui, sans-serif; font-variant-numeric: tabular-nums;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
  white-space: nowrap; touch-action: manipulation;
}
.space3d-pin .nm { display: none; font-weight: 600; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.show-names .space3d-pin .nm, .space3d-pin.is-on .nm { display: inline; }
.space3d-pin.is-on { background: var(--z); color: #FFFFFF; z-index: 9999 !important; }
.space3d-fx {
  display: none; pointer-events: none; font: italic 500 11.5px/1.2 system-ui, sans-serif;
  color: var(--ink); background: color-mix(in srgb, var(--surface) 72%, transparent);
  padding: 2px 6px; border-radius: 4px; white-space: nowrap;
}
.show-names .space3d-fx { display: block; }
.space3d-card {
  position: absolute; left: var(--s-3); right: var(--s-3); bottom: var(--s-3); z-index: 4;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--s-3) var(--s-4); display: grid; gap: var(--s-2);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.space3d-card[hidden] { display: none; }
.space3d-card-name { margin: 0; font-size: 1.1rem; padding-right: 40px; }
.space3d-card-where { margin: 0; padding-right: 40px; }
.space3d-card-x {
  position: absolute; top: 2px; right: 2px; width: 44px; height: 44px;
  border: 0; background: transparent; color: var(--muted); font-size: 1.1rem;
}
.space3d-card-open { justify-self: start; min-height: 40px; }
/* Left-aligned: the voice button floats over the right edge of the page. */
.space3d-tools { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-3) 0; }
.space3d-looks { display: flex; gap: var(--s-1); }
.space3d-tools .btn { min-height: 44px; min-width: 52px; }
.space3d-tools .btn[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.space3d-search input {
  width: 100%; min-height: 44px; padding: var(--s-2) var(--s-3); font: inherit;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
}
.space3d-result { margin: var(--s-2) 0 var(--s-3); }
.space3d-zones, .space3d-rows { list-style: none; margin: 0; padding: 0; }
.space3d-zone { --z: var(--border); margin-bottom: var(--s-4); border-left: 4px solid var(--z); padding-left: var(--s-3); }
.space3d-zone[hidden] { display: none; }
.space3d-zone-name { font-size: 1rem; margin: 0 0 var(--s-2); }
.space3d-rows li[hidden] { display: none; }
.space3d-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--s-2); align-items: baseline;
  padding: var(--s-2) 0; min-height: 44px; color: var(--ink); text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.space3d-row-where { grid-column: 2; }
.space3d-no {
  display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px;
  border-radius: 999px; border: 2px solid var(--z, var(--border)); font: 700 12px/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
}
.space3d-unplaced { margin-top: var(--s-5); }
.space3d-unplaced[hidden] { display: none; }
.space3d-unplaced .space3d-row { grid-template-columns: minmax(0, 1fr); }
.space3d-unplaced .space3d-row-where { grid-column: 1; }
.space3d-switch { min-height: 40px; }
/* The tray (v2.93): Place, then a tap on the floor. */
.space3d-placing {
  position: absolute; left: var(--s-3); right: var(--s-3); top: var(--s-3); z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  background: var(--surface); color: var(--ink); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s-2) var(--s-3);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}
.space3d-placing[hidden] { display: none; }
.space3d-placing .btn { min-height: 40px; flex: 0 0 auto; }
.space3d-stage.is-placing { outline: 2px dashed var(--primary); outline-offset: -2px; }
.space3d-stage.is-placing .space3d-gl { cursor: crosshair; }
.space3d-card-by { margin: 0; }
.space3d-card-by[hidden] { display: none; }
.space3d-card-acts { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.space3d-card-acts .btn { min-height: 40px; }
.space3d-unplaced-row { display: flex; align-items: center; gap: var(--s-2); }
.space3d-unplaced-row .space3d-row { flex: 1 1 auto; min-width: 0; }
.space3d-place { flex: 0 0 auto; min-height: 44px; }
.no-gl .space3d-place:not([data-into]), .no-gl [data-card-place] { display: none; }

/* ---------- Map this space (v2.89) ---------- */

.space-intake textarea {
  width: 100%;
  padding: var(--s-3);
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  resize: vertical;
}
#space-mic { min-height: 44px; }
#space-mic.recording {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-primary);
}
.space-photos-label { margin-top: var(--s-4); }
.space-photos-input { display: block; width: 100%; min-height: 44px; }
.space-thumbs {
  list-style: none;
  margin: var(--s-3) 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-2);
}
.space-thumbs:empty { display: none; }
.space-thumbs li { position: relative; aspect-ratio: 3 / 4; }
.space-thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.space-thumb-n {
  position: absolute;
  left: 6px;
  top: 6px;
  min-width: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 0.8rem;
  text-align: center;
}
.space-thumb-x {
  position: absolute;
  right: 0;
  top: 0;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: #FFFFFF;            /* on a photo, light or dark theme alike */
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  font-size: 1.1rem;
  touch-action: manipulation;
}
.space-go { margin-top: var(--s-4); display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }
.space-go .btn { min-height: 44px; }
.space-privacy { margin: var(--s-3) 0 0; }
.space-status-line { margin: 0 0 var(--s-3); }
.space-status-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.space-status-actions[hidden] { display: none; }

.space-review .app-card + .app-card,
.space-review .app-card + .space-review-actions { margin-top: var(--s-4); }
.space-h { font-size: 1.05rem; margin: 0 0 var(--s-3); }
.space-h ~ .space-h { margin-top: var(--s-5); }
.space-note { border-left: 4px solid var(--warn); }
.space-zone {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 2px var(--s-2);
  align-items: center;
  margin-bottom: var(--s-2);
}
.space-zone .muted { grid-column: 2; }
.space-zone-n { font-weight: 600; text-align: center; }
.space-zone .space-zone-home { grid-column: 2; font-weight: 600; }
.space-maybes { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-4); }
.space-maybes .btn { min-height: 44px; }
.space-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s-2); }
.space-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: var(--s-1) var(--s-2);
  align-items: center;
  padding: var(--s-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.space-row.is-flagged { border-color: var(--warn-border); background: var(--warn-surface); }
.space-row.is-off .space-name { color: var(--muted); text-decoration: line-through; }
.space-row input[readonly] { background: transparent; border-style: dashed; }
.space-keep { display: grid; place-items: center; min-height: 44px; touch-action: manipulation; }
.space-keep input { width: 22px; height: 22px; }
.space-row input[type="text"],
.space-row input[type="number"],
.space-row select,
.space-zone input {
  min-width: 0;
  width: 100%;
  min-height: 40px;
  padding: var(--s-1) var(--s-2);
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.space-row-more {
  grid-column: 2;
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: var(--s-2);
}
.space-qty { display: flex; align-items: center; gap: 4px; }
.space-flags { grid-column: 2; margin: 0; padding-left: 1.1em; font-size: 0.9rem; }
.space-action { grid-column: 2; margin: 0; font-size: 0.9rem; font-weight: 600; }
.space-pair { grid-column: 2; margin: 0; font-size: 0.9rem; }
.space-pair b { font-weight: 600; }
.space-row.is-off .space-action { font-weight: 400; color: var(--muted); }
.space-row-more .space-match { grid-column: 1 / -1; }
.space-desc { grid-column: 2; margin: 0; }
.space-review-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-4); }
.space-review-actions .btn { min-height: 44px; }

/* ---------- Bulk add ---------- */

/* Wraps because the My Things header stacks up several actions and a phone
   header is only ~358px wide — without it the row runs off the viewport. */
.page-header-actions { display: inline-flex; flex-wrap: wrap; gap: var(--s-2); }

.bulk-label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--s-2);
}
.bulk-capture textarea {
  width: 100%;
  padding: var(--s-3);
  font: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  resize: vertical;
}
.bulk-capture textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-top: var(--s-3);
  flex-wrap: wrap;
}
.bulk-actions .btn .mic-icon { font-size: 1.1em; line-height: 1; }
#mic-btn.recording {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-primary);
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 40%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 0%, transparent); }
}
#mic-btn { min-height: 44px; }
.bulk-actions .mic-line {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 1.4em;
  margin: 0;
}
/* The live level beside Record (v2.25): proof the mic is hearing you. */
.mic-level {
  flex: none;
  width: 56px;
  height: 6px;
  border-radius: 3px;
  background: var(--border);
  overflow: hidden;
}
.mic-level > span {
  display: block;
  height: 100%;
  background: var(--primary);
  transform-origin: left center;
  transform: scaleX(0.04);
}
@media (prefers-reduced-motion: reduce) {
  #mic-btn.recording { animation: none; }
}

.bulk-preview { margin-top: var(--s-5); }
.bulk-preview-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
  flex-wrap: wrap;
}
.bulk-preview-header h2 { margin: 0; }
.bulk-preview-header .muted.small { margin: 0; }

.bulk-preview-rows {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
.bulk-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.3fr) minmax(180px, 2fr) 64px 36px;
  grid-template-areas:
    'name detail qty remove'
    'kind loc    loc loc';
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.bulk-row .row-name { grid-area: name; }
.bulk-row .row-detail { grid-area: detail; }
.bulk-row .row-qty { grid-area: qty; }
.bulk-row .row-remove { grid-area: remove; justify-self: end; }
.bulk-row .row-loc-kind { grid-area: kind; }
.bulk-row .row-loc-existing,
.bulk-row .row-loc-new { grid-area: loc; min-width: 0; }
.bulk-row input,
.bulk-row select {
  padding: var(--s-2);
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  min-width: 0;
  width: 100%;
}
.bulk-row .row-loc-existing[hidden],
.bulk-row .row-loc-new[hidden] {
  display: none !important;
}
.bulk-row .row-remove {
  padding: 4px 8px;
  color: var(--danger);
}
.bulk-row .row-remove:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }

.bulk-preview-actions {
  display: flex;
  gap: var(--s-2);
  flex-wrap: wrap;
}

@media (max-width: 780px) {
  .bulk-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      'name name'
      'detail detail'
      'qty kind'
      'loc loc'
      'remove remove';
  }
  .bulk-row .row-name { grid-area: name; }
  .bulk-row .row-detail { grid-area: detail; }
  .bulk-row .row-qty { grid-area: qty; }
  .bulk-row .row-loc-kind { grid-area: kind; }
  .bulk-row .row-loc-existing,
  .bulk-row .row-loc-new { grid-column: auto; grid-area: loc; }
  .bulk-row .row-remove { grid-area: remove; justify-self: end; }
}

/* ---------- Lending ---------- */

.lent-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  margin: var(--s-3) 0 var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border: 1px solid var(--warn);
  border-left-width: 4px;
  border-radius: var(--radius-sm);
}
.lent-banner h2 { margin: 0 0 4px; font-size: 1.05rem; }
.lent-banner p { margin: 0; }

.badge.lent {
  background: var(--warn);
  color: var(--on-primary);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.item-card-photo .badge.lent {
  position: absolute;
  top: var(--s-2);
  left: var(--s-2);
}
.item-card.is-lent { opacity: 0.85; }
.item-card.is-lent .item-card-photo img { filter: grayscale(0.35) saturate(0.7); }


/* flatpickr ships a light calendar; these are the app's own colours. It
   renders into <body>, outside every other scope, hence the bare class. */
.findit-calendar.flatpickr-calendar {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  color: var(--ink);
}
.findit-calendar .flatpickr-months,
.findit-calendar .flatpickr-weekdays,
.findit-calendar span.flatpickr-weekday {
  background: var(--surface);
  color: var(--muted);
  fill: var(--muted);
}
.findit-calendar .flatpickr-month,
.findit-calendar .flatpickr-current-month input.cur-year,
.findit-calendar .flatpickr-monthDropdown-months { color: var(--ink); }
.findit-calendar .flatpickr-monthDropdown-months { background: var(--surface); }
.findit-calendar .flatpickr-prev-month svg,
.findit-calendar .flatpickr-next-month svg { fill: var(--ink); }
.findit-calendar .flatpickr-day {
  color: var(--ink);
  border-radius: var(--radius-sm);
}
.findit-calendar .flatpickr-day:hover { background: var(--surface-2); border-color: var(--surface-2); }
.findit-calendar .flatpickr-day.today { border-color: var(--primary); }
.findit-calendar .flatpickr-day.selected {
  background: var(--primary); border-color: var(--primary); color: var(--bg);
}
.findit-calendar .flatpickr-day.prevMonthDay,
.findit-calendar .flatpickr-day.nextMonthDay,
.findit-calendar .flatpickr-day.flatpickr-disabled { color: var(--muted); opacity: 0.55; }
/* The readable mirror flatpickr swaps in for the ISO input. */
input.form-control.input { font: inherit; }

/* ---------- the clouds, and the pages they open onto ---------- */
/* Above the canvas, not on it. Fixed, so panning and zooming leave it be. */
.map-clouds {
  position: fixed;
  left: max(var(--s-3), env(safe-area-inset-left));
  bottom: calc(max(var(--s-3), env(safe-area-inset-bottom)) + 76px);
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  max-width: min(260px, 62vw);
}
.map-cloud {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'discs label' 'discs meta';
  align-items: center;
  column-gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--ink);
  text-decoration: none;
  touch-action: manipulation;
}
.map-cloud:hover { background: var(--surface-2); }
.map-cloud.is-overdue { border-color: var(--warn); }
.map-cloud-discs { grid-area: discs; display: flex; }
.map-cloud-disc {
  width: 28px; height: 28px; margin-right: -10px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--surface-2);
  color: var(--primary);
  font-size: 0.78rem; font-weight: 700;
}
.map-cloud-disc.is-more { color: var(--muted); font-size: 0.7rem; }
.map-cloud-label { grid-area: label; font-weight: 600; font-size: 0.95rem; }
.map-cloud-meta {
  grid-area: meta; font-size: 0.78rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.loan-late { color: var(--warn); }
.back-choices {
  display: flex; flex-direction: column; gap: var(--s-3);
  padding: var(--s-4) 0;
}

/* ---------- the lend dialog ---------- */
/* A real overlay, not an accordion further down the page. The old control
   was an anchor to #lend-out: it scrolled you there and opened nothing. */
.lend-dialog { position: fixed; inset: 0; z-index: 70; }
.lend-scrim {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.lend-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(460px, 100%);
  max-height: 92dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--s-4) max(var(--s-4), env(safe-area-inset-bottom));
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 720px) {
  /* Centred on a desktop; a sheet on a phone, where the bottom is the thumb. */
  .lend-card {
    top: 50%; bottom: auto;
    transform: translate(-50%, -50%);
    border-radius: var(--radius-lg);
  }
}
.lend-head {
  position: sticky; top: 0; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) 0 var(--s-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.lend-head h2 { margin: 0; font-size: 1.15rem; }
.lend-form { padding-top: var(--s-4); }
.lend-form .field { position: relative; margin-bottom: var(--s-4); }
.lend-actions {
  display: flex; justify-content: flex-end; gap: var(--s-3);
  padding-top: var(--s-2);
}
.lend-actions .btn { min-height: 44px; }
/* Suggestions hang under the name field. */
.lend-suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 2;
  margin-top: 4px; padding: 4px;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.lend-suggest-opt {
  min-height: 44px; padding: 8px 12px;
  border: 0; border-radius: calc(var(--radius) - 2px);
  background: none; color: var(--ink);
  font: inherit; text-align: left; cursor: pointer;
  touch-action: manipulation;
}
.lend-suggest-opt:hover { background: var(--surface-2); }
/* A class display beats the UA's [hidden]; this bit us twice already. */
.lend-dialog[hidden], .lend-suggest[hidden] { display: none !important; }
body.is-dialog-open { overflow: hidden; }

.lend-disclosure {
  margin: var(--s-3) 0 var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0;
}
.lend-disclosure > summary {
  cursor: pointer;
  padding: var(--s-3) var(--s-4);
  font-weight: 500;
  list-style: none;
  border-radius: var(--radius-sm);
}
.lend-disclosure > summary::-webkit-details-marker { display: none; }
.lend-disclosure > summary::marker { content: ''; }
.lend-disclosure > summary:hover { background: var(--surface-2); }
.lend-disclosure[open] > summary { border-bottom: 1px solid var(--border); }
.lend-form {
  padding: var(--s-4);
  display: grid;
  gap: var(--s-3);
}
.lend-form input[type="text"],
.lend-form input[type="date"] {
  width: 100%;
  padding: var(--s-2) var(--s-3);
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.lend-form .field { margin: 0; }
.lend-form .help { margin: 4px 0 0; font-size: 0.85rem; color: var(--muted); }

/* ---------- My Things: hero search + combined sections ---------- */

.hero-search {
  display: flex;
  gap: var(--s-3);
  margin: 0 0 var(--s-6);
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.hero-search-input {
  flex: 1;
  min-width: 0;
  padding: var(--s-3) var(--s-4);
  font-size: 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
}
.hero-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
  background: var(--surface);
}
.hero-search-btn { padding-left: var(--s-5); padding-right: var(--s-5); }

.combined-section { margin: 0 0 var(--s-7); }
.combined-section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.combined-section-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-family: var(--font-display);
}

/* ---------- Overdue lent items ---------- */

/* ---------- View switch (Map / Tree / …) ----------
   A segmented control sized for thumbs: the whole strip is one row, each
   option is an equal share of it, and the row grows with the number of views
   rather than needing new rules per view. */
.view-switch {
  display: flex;
  gap: var(--s-1);
  padding: var(--s-1);
  margin-bottom: var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.view-switch-option {
  flex: 1 1 0;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--s-3);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 120ms ease, color 120ms ease;
}
.view-switch-option:hover { color: var(--ink); }
.view-switch-option.is-active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.view-switch-option:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
@media (prefers-reduced-motion: reduce) {
  .view-switch-option { transition: none; }
}

/* ---------- Thing map (spatial drill-down) ---------- */
.map-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.map-head-actions { display: flex; gap: var(--s-2); flex-shrink: 0; }
/* Fill the flex line: the search box inside anchors its dropdown to this
   block's right edge, which must reach the content's right edge at every
   width or the panel clips off the left of the viewport. */
.map-head-text { flex: 1 1 auto; min-width: 0; }
.map-title {
  font-family: var(--font-display);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 0;
}
.map-title-icon { width: 1em; height: 1em; color: var(--primary); }
.map-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: var(--s-2);
}
.map-crumbs a { color: var(--muted); text-decoration: none; }
.map-crumbs a:hover { color: var(--ink); text-decoration: underline; }
.map-crumb-sep { opacity: 0.5; }
.map-hint { margin: var(--s-2) 0 0; font-size: 0.9rem; }
.map-status { min-height: 1.2em; margin: var(--s-2) 0 0; text-align: center; }

/* The map is a fixed-size window (.thing-map-frame) onto a scalable surface
   (.thing-map). Zoom lives as a transform on the surface; the frame stays put
   and the viewport scrolls, so a crowded spot can be magnified and panned. */
.thing-map-frame {
  position: relative;
  aspect-ratio: 3 / 4;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}
.thing-map-viewport {
  position: absolute;
  inset: 0;
  /* A camera, not a scroller: the board moves via transform, so every
     coordinate — including negative fractions — is reachable by panning.
     Native overflow could never scroll up/left past its origin, which is
     exactly the bug this replaced. */
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--surface-2);
  /* The pegboard lives on the window, not the board, because the canvas is
     unbounded — dots stop at the 1× box otherwise. The dots track the
     camera exactly: position is the world origin's screen point, pitch
     scales with the zoom, all from the same three --cam vars the board
     transform reads, so grain and pins can never shear apart. */
  background-image: radial-gradient(circle, var(--peg-dot) 1px, transparent 1px);
  background-size: calc(26px * var(--cam-z, 1)) calc(26px * var(--cam-z, 1));
  background-position: var(--cam-x, 0px) var(--cam-y, 0px);
  /* The camera owns every touch on the surface. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.thing-map-viewport.is-panning { cursor: grabbing; }
/* …except on an embedded canvas, where the map is only the top two thirds of
   a thing's page: owning every touch there means a swipe pans the camera and
   "Move it", the tags and the history below can never be reached. The same
   exemption map.js already makes for the wheel (frame.dataset.mapEmbed) —
   pan-y hands vertical drags back to the page, while horizontal pans and
   pinch-zoom still reach the camera. The full-screen map keeps them all. */
.thing-map-frame[data-map-embed] .thing-map-viewport { touch-action: pan-y; }
/* The board is the world: a fixed zoom-1 surface (map.js pins its px size
   at wire time) moved and scaled as one unit by the camera transform. Pin
   positions are percentages of this surface; pins, spacing, and dot pitch
   all inherit the zoom from the single transform, so nothing can be
   mid-transition at a different scale than anything else. */
.thing-map {
  position: absolute;
  top: 0;
  left: 0;
  /* Pre-JS fallback ≈ the zoom-1 board; wire() overrides with frozen px. */
  width: 100%;
  height: 100%;
  transform-origin: 0 0;
  transform: translate(var(--cam-x, 0px), var(--cam-y, 0px)) scale(var(--cam-z, 1));
  /* Camera motion is a JS tween (one clock for board + pegboard), so no CSS
     transition here — it would fight per-frame gesture writes. */
}
/* Arrange tints the whole window, not the 1× box: everything you can see is
   somewhere a pin may be dropped. */
.thing-map-frame:has(.thing-map[data-editing="1"]) .thing-map-viewport {
  background-color: var(--arrange-bg);
  border-style: dashed;
  border-color: var(--primary);
}

/* Zoom controls — pinned to the window's top-right, above the surface and
   outside the scroller so they never pan away. */
.map-zoom {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  z-index: 5;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.map-zoom-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.map-zoom-btn + .map-zoom-btn { border-top: 1px solid var(--border); }
.map-zoom-btn:hover { background: var(--surface-2); }
.map-zoom-btn:active { background: var(--border); }
.map-zoom-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* "Tidy up" — the canvas's Clean Up By menu, a details-dropdown so it needs
   no JS to open and closes itself when an option is picked. */
.map-tidy { position: relative; display: inline-block; }
.map-tidy > summary { list-style: none; cursor: pointer; user-select: none; }
.map-tidy > summary::-webkit-details-marker { display: none; }
.map-tidy[open] > summary { background: var(--surface-2); }
.map-tidy-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  min-width: 190px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.map-tidy-opt {
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.map-tidy-opt:hover { background: var(--surface-2); }
.map-tidy-opt:active { background: var(--border); }

.map-pin {
  position: absolute;
  /* No zoom term here: the board's camera transform scales every pin, the
     spacing, and the pegboard together — one source of truth. */
  transform: translate(-50%, -50%);
  width: 96px;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  text-decoration: none;
  color: var(--ink);
  /* Just the is-dragging pickup; camera motion never animates pins. */
  transition: transform 120ms ease;
}
/* The disc carries the weight — big glyph, small caption underneath, so a pin
   reads as an object on a map rather than a row in a list. */
.map-pin-disc {
  /* Anchor for the absolute photo fill, and a hard clip so no photo shape
     can ever escape the circle. */
  position: relative;
  overflow: hidden;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-md);
  color: var(--primary);
  transition: border-color 0.12s ease, box-shadow 0.12s ease,
              transform 0.28s cubic-bezier(0.2, 0.8, 0.3, 1.15);
}
.map-pin-icon { width: 46px; height: 46px; stroke-width: 1.6; }
/* A thing's pin shows its photo filling the disc, like a little porthole. */
.map-pin-photo {
  /* Absolute fill: a percentage height inside the centered grid resolved
     to auto for portrait photos, which then overflowed the circle as tall
     ovals. inset 0 + cover cannot leak regardless of the source's shape. */
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}
.map-pin-initial {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--primary);
}

/* Nested preview: a spot with children shows its own icon as a small core
   badge with the kids floating as mini-bubbles inside the disc. */
.map-pin-disc:has(.map-pin-minis) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.map-pin-core { display: grid; place-items: center; }
.map-pin-coreicon { width: 24px; height: 24px; stroke-width: 1.6; }
.map-pin-initial.is-small { font-size: 1rem; }
.map-pin-minis { display: flex; gap: 3px; }
.map-mini {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  color: var(--primary);
}
.map-mini-icon { width: 14px; height: 14px; stroke-width: 1.8; }
.map-mini-initial {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--primary);
}
.map-mini.is-more {
  background: var(--surface);
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 600;
}
.map-mini.is-person {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent);
}

/* New bubbles pop into existence: scale up with a quick overshoot. The base
   translate(-50%,-50%) has to ride along or the pin would jump off-center. */
/* The pop lands at the map's current zoom, not a hardcoded 1, or a new pin
   on a zoomed map would inflate and then visibly snap to the wrong size. */
@keyframes bubble-pop {
  0%   { transform: translate(-50%, -50%) scale(0); }
  70%  { transform: translate(-50%, -50%) scale(1.12); }
  100% { transform: translate(-50%, -50%) scale(1); }
}
.map-pin.is-new { animation: bubble-pop 360ms cubic-bezier(0.34, 1.56, 0.64, 1) both; }
/* Just added (v2.49): the new pins pulse a few times where they landed. */
.map-pin.is-landed .map-pin-disc { animation: pin-landed 860ms ease-out 3; }
@keyframes pin-landed {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); }
  100% { box-shadow: 0 0 0 16px color-mix(in srgb, var(--accent) 0%, transparent); }
}

/* Zooming into a spot: the tapped bubble morphs into the next page's canvas
   (cross-document view transitions; browsers without support just navigate). */
@view-transition { navigation: auto; }
::view-transition-group(*) {
  animation-duration: 320ms;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
@media (prefers-reduced-motion: reduce) {
  .map-pin.is-new { animation: none; }
  /* Still marked, without the motion: a ring while it would have pulsed. */
  .map-pin.is-landed .map-pin-disc { animation: none; box-shadow: 0 0 0 4px var(--accent); }
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}
.map-pin-label {
  font-weight: 600;
  font-size: 0.72rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  /* Long names wrap rather than overlapping the neighbouring pin. */
  overflow-wrap: anywhere;
}
.map-pin-meta { font-size: 0.62rem; line-height: 1.1; }

.map-pin:hover .map-pin-disc,
.map-pin:focus-visible .map-pin-disc {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}
.map-pin:focus-visible { outline: none; }
.map-pin:focus-visible .map-pin-disc { outline: 2px solid var(--primary); outline-offset: 3px; }

.map-pin.is-person .map-pin-disc {
  border-color: var(--accent);
  color: var(--accent);
  border-style: dashed;
}
/* Auto-placed, never dragged: hint that it has no chosen home yet. */
.thing-map[data-editing="1"] .map-pin.is-unplaced .map-pin-disc {
  border-style: dotted;
  opacity: 0.9;
}

.thing-map[data-editing="1"] .map-pin {
  cursor: grab;
  /* Stops the browser scrolling the page instead of moving the pin. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
/* Select mode: a picked pin is a handle for the whole selection (v2.15) —
   drag one and the rest come along, into whatever opens for them. */
body.is-selecting .map-pin.is-picked {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.map-pin.is-dragging {
  cursor: grabbing;
  z-index: 5;
  transform: translate(-50%, -50%) scale(1.08);
}
/* A group let go over nothing slides home rather than snapping. */
.map-pin.is-returning {
  transition: left 0.24s ease, top 0.24s ease, transform 120ms ease;
}
.map-pin.is-dragging .map-pin-disc {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

/* ---------- drop-into: the iPhone-folder choreography ----------
 * Open: the target swells with a springy overshoot and a soft halo —
 * unmistakably "this will receive it". In: the dragged pin ducks slightly,
 * already half-inside. Absorb: it dives to the target's centre and shrinks
 * away while the target gulps once and settles. */
/* The open/gulping target gets its own layer: pins stack in DOM order, so
   without this a neighbouring pin drawn later slices through the swell.
   Below the diving pin (4) and a fresh drag (5). */
.map-pin.is-drop-open, .map-pin.is-gulp { z-index: 3; }
.map-pin.is-drop-open .map-pin-disc {
  transform: scale(1.2);
  border-color: var(--primary);
  box-shadow: 0 0 0 8px color-mix(in srgb, var(--primary) 22%, transparent),
              var(--shadow-lg);
}
.map-pin.is-going-in {
  transform: translate(-50%, -50%) scale(0.9);
  transition: transform 0.24s ease;
}
.map-pin.is-absorbed {
  pointer-events: none;
  z-index: 4;
  transition: left 0.3s ease-in, top 0.3s ease-in;
}
.map-pin.is-absorbed .map-pin-disc {
  transform: scale(0.12);
  opacity: 0;
  transition: transform 0.3s ease-in, opacity 0.3s ease-in;
}
.map-pin.is-absorbed .map-pin-label,
.map-pin.is-absorbed .map-pin-meta,
/* and the select-mode check, which otherwise hangs full-size over a
   disc that has already shrunk away */
body.is-selecting .map-pin.is-absorbed::after {
  opacity: 0;
  transition: opacity 0.16s ease;
}
@keyframes map-gulp {
  0% { transform: scale(1.2); }
  55% { transform: scale(0.93); }
  100% { transform: scale(1); }
}
.map-pin.is-gulp .map-pin-disc {
  animation: map-gulp 0.42s cubic-bezier(0.2, 0.8, 0.3, 1.2);
}
@media (prefers-reduced-motion: reduce) {
  .map-pin-disc { transition: border-color 0.12s ease, box-shadow 0.12s ease; }
  .map-pin.is-going-in, .map-pin.is-absorbed,
  .map-pin.is-returning { transition: none; }
  .map-pin.is-absorbed .map-pin-disc { transition: none; }
  .map-pin.is-gulp .map-pin-disc { animation: none; }
}

.map-items { margin-top: var(--s-6); }

@media (min-width: 720px) {
  .thing-map-frame { aspect-ratio: 16 / 10; max-width: 100%; }
}
/* No phone-size pin tier: pins keep ONE footprint on every device, so
   collision math and Tidy produce literally the same layout everywhere —
   the camera, not a media query, adapts to the screen. */

/* ---------- Flash messages ---------- */
.messages { list-style: none; margin: 0 0 var(--s-4); padding: 0; display: grid; gap: var(--s-2); }
.message {
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 0.92rem;
}
.message.success { border-left: 4px solid var(--success); }
.message.error { border-left: 4px solid var(--danger); }
.message.warning { border-left: 4px solid var(--warn); }
/* Edit window: the thing's photo leads, centered above the name. */
.edit-photo-head { display: grid; place-items: center; margin-bottom: var(--s-3); }
.edit-photo-frame {
  position: relative;          /* a cropped preview is placed inside it (v2.35) */
  display: block;
  width: 132px;
  height: 132px;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.edit-photo-head img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.edit-photo-head img.placeholder { object-fit: contain; padding: 24px; }

.message { cursor: pointer; transition: opacity 0.25s, transform 0.25s; }
.message.is-leaving { opacity: 0; transform: translateY(-6px); }
@media (prefers-reduced-motion: reduce) {
  .message { transition: none; }
}

/* ---------- Delete: choose what happens to the contents ---------- */
.delete-choices { display: grid; gap: var(--s-3); width: 100%; text-align: left; }
.delete-choice {
  display: flex;
  gap: var(--s-3);
  align-items: flex-start;
  padding: var(--s-4);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.delete-choice input { margin-top: 3px; flex-shrink: 0; width: 18px; height: 18px; }
.delete-choice-body { display: grid; gap: var(--s-1); }
.delete-choice-title { font-weight: 600; }
/* :has lets the whole card react to its radio — supported in all current
   mobile browsers; without it the card simply stays neutral. */
.delete-choice:has(input:checked) { border-color: var(--primary); background: var(--surface-2); }
.delete-choice.danger-choice:has(input:checked) { border-color: var(--danger); background: var(--danger-surface); }
.delete-destination { margin-top: var(--s-2); width: 100%; max-width: 100%; }
.confirm-card .delete-choices + .confirm-actions,
.delete-choices .confirm-actions { display: flex; gap: var(--s-3); justify-content: flex-end; }
.btn.ghost.danger-link { color: var(--danger); }
.btn.ghost.danger-link:hover { color: var(--danger-hover); }

@media (max-width: 520px) {
  .map-head-actions { width: 100%; flex-wrap: wrap; }
  .delete-choices .confirm-actions { flex-direction: column-reverse; }
  .delete-choices .confirm-actions .btn { width: 100%; text-align: center; }
}

/* ---------- Empty-state actions ---------- */
/* Stacked, not side by side: the spot sits above the thing it contains. */
.empty-state-actions {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  align-items: center;
}
@media (max-width: 520px) {
  .empty-state-actions { align-items: stretch; }
  .empty-state-actions .btn { width: 100%; }
}

/* ---------- Map: up-a-level button ---------- */
.map-title-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.map-title-row .map-title { margin: 0; min-width: 0; }
.map-back {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease;
}
.map-back:hover {
  background: var(--surface-2);
  border-color: var(--primary);
  text-decoration: none;
}
.map-back:active { transform: translateY(1px); }
.map-back:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.map-back svg { width: 26px; height: 26px; }

@media (max-width: 420px) {
  .map-back { width: 42px; height: 42px; }
  .map-back svg { width: 24px; height: 24px; }
  .map-title-row .map-title { font-size: 1.6rem; }
}

/* ---------- Item contents canvas (things inside a thing) ---------- */
.item-contents { margin-bottom: var(--s-5); }
.item-contents .combined-section-header {
  margin-bottom: var(--s-3);
  align-items: center;
  gap: var(--s-2);
}
/* "Inside X" takes its own line; Arrange · Tidy up · Select share the next
   one (they used to wrap 2×2 beside the title, on a phone and at 1440). */
.item-contents .combined-section-header h2 { flex: 1 1 100%; font-size: 1.15rem; font-family: var(--font-body); }
.item-contents .combined-section-header > :not(h2) { flex: none; }
.item-contents .thing-map-frame { max-width: none; }

/* ---------- Map: live search ---------- */
/* Sits at the far right of the title row; the results panel drops from its
   right edge so it never overhangs the viewport. */
.map-search {
  position: relative;
  margin-left: auto;
  flex: 1 1 150px;
  min-width: 120px;
  max-width: 320px;
}
.map-search-input {
  width: 100%;
  font: inherit;
  /* 16px floor: anything smaller makes iOS Safari zoom the page on focus. */
  font-size: 16px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.map-search-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
}
.map-search-results {
  position: absolute;
  top: calc(100% + var(--s-2));
  right: 0;
  width: min(420px, calc(100vw - 2 * var(--s-4)));
  max-height: min(60vh, 480px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--s-2);
  /* Above page content, below the voice fab (40) and chat panel (50). */
  z-index: 30;
}
.map-search-group {
  padding: var(--s-2) var(--s-2) var(--s-1);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.map-search-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 48px;
  padding: var(--s-2);
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  touch-action: manipulation;
}
.map-search-row:hover,
.map-search-row.is-active { background: var(--surface-2); text-decoration: none; }
/* The matched letters, not a highlighter swipe. */
.map-search-row mark { background: none; color: inherit; font-weight: 700; }
.map-search-row.is-all {
  margin-top: var(--s-1);
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--primary);
}
.map-search-row.is-all .map-search-name { font-weight: 600; }
.map-search-thumb {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--primary);
  font-family: var(--font-display);
  font-weight: 700;
}
.map-search-thumb img { width: 100%; height: 100%; object-fit: cover; }
/* Echo the map's person treatment: dashed accent ring. */
.map-search-row.is-person .map-search-thumb {
  border-style: dashed;
  border-color: var(--accent);
  color: var(--accent);
}
.map-search-body { min-width: 0; display: grid; gap: 1px; }
.map-search-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-search-path {
  font-size: 0.8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-search-note {
  padding: var(--s-2) var(--s-2) var(--s-1);
  color: var(--muted);
  font-size: 0.85rem;
}
@media (max-width: 520px) {
  .map-search { max-width: none; }
}

/* ---------- Shopping picks (v2.33) ----------
   A card in the chat thread, phone-first: a 64px image hotlinked from the
   result, the title (two lines at most), price · store, a one-line reason.
   Each pick is one big link out (a new tab, never inside the app). Then
   always "Search Amazon for …", one honest line, and "Not interested". */
.shop-card { display: grid; gap: var(--s-2); }
.shop-picks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.shop-pick-link {
  display: flex; gap: var(--s-3); align-items: flex-start;
  padding: var(--s-2); border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--ink); text-decoration: none;
}
.shop-pick-link:hover { text-decoration: none; border-color: var(--primary); }
.shop-pick-img { flex: none; width: 64px; height: 64px; object-fit: contain; border-radius: 8px; background: #fff; }
.shop-pick-body { min-width: 0; display: grid; gap: 2px; }
.shop-pick-title {
  font-weight: 600; font-size: 0.92rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.shop-pick-meta { font-size: 0.85rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.shop-pick-reason { font-size: 0.82rem; color: var(--muted); }
.shop-amazon {
  display: inline-flex; align-items: center; min-height: 44px;
  font-weight: 600; color: var(--primary); overflow-wrap: anywhere;
}
.shop-amazon-why { font-size: 0.82rem; color: var(--muted); margin-top: -6px; }
.shop-note { margin: 0; font-size: 0.75rem; color: var(--muted); }
.shop-mute { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); font-size: 0.85rem; color: var(--muted); }
.shop-mute-btn {
  min-height: 44px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--ink);
  font: inherit; font-size: 0.85rem; cursor: pointer;
}
.account-sub { font-size: 0.95rem; margin: var(--s-4) 0 var(--s-2); }
.shop-mutes .app-row form { margin: 0; flex: none; }

/* Account → Sharing (v2.65): an invitation's three answers, or a shared
   place's Leave / Report, wrap under its words on a phone. 44px targets. */
.share-entry { flex-wrap: wrap; padding: var(--s-3) var(--s-4); row-gap: var(--s-2); }
.share-entry.is-blocked { padding: 0 var(--s-4) 0 0; flex-wrap: nowrap; }
.share-entry > .app-row-text { flex: 1 1 14rem; min-width: 0; }
.share-entry .app-row-title { white-space: normal; overflow-wrap: anywhere; font-weight: 400; }
.share-entry-place { color: inherit; text-decoration: none; }
.share-entry-place .app-row-title { font-weight: 600; }
.share-entry-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.share-entry form { margin: 0; flex: none; }
.share-entry .btn { min-height: 44px; }
.share-report-card + .share-report-card { margin-top: var(--s-4); }
.share-report-form textarea { width: 100%; }
.share-report-block { margin: var(--s-3) 0 var(--s-4); }
.share-block-btn { min-height: 44px; color: var(--danger); }
.shop-mutes .app-row-title { white-space: normal; overflow-wrap: anywhere; }

/* Apps that can read your things (v2.41). The shown-once key must be
   copyable on a 320px phone: it wraps anywhere, and Copy is full width. */
.api-secret {
  margin: var(--s-3) 0;
  padding: var(--s-3);
  border: 1px solid var(--warn-border);
  background: var(--warn-surface);
  border-radius: var(--radius);
}
.api-secret-lede { margin: 0 0 var(--s-2); }
.api-secret-value {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: var(--s-2);
  font: 0.9rem/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  word-break: break-all;
  resize: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.api-copy { width: 100%; min-height: 44px; margin-top: var(--s-2); }
.api-tokens .app-row form { margin: 0; flex: none; }
.api-tokens .app-row-title { white-space: normal; overflow-wrap: anywhere; }
.api-tokens .app-row-meta { white-space: normal; }
.api-token-form { margin-top: var(--s-3); }
.api-token-form label { display: block; font-weight: 600; margin-bottom: var(--s-1); }
.api-token-make { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.api-token-make input { flex: 1 1 10rem; min-width: 0; min-height: 44px; font-size: 16px; }
.api-token-make .btn { flex: none; min-height: 44px; }
.api-howto { margin-top: var(--s-3); }
.api-howto > summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  cursor: pointer;
  font-weight: 500;
  list-style: none;
}
.api-howto > summary::-webkit-details-marker { display: none; }
.api-howto > summary::before {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s;
}
.api-howto[open] > summary::before { transform: rotate(45deg); }
.api-howto pre {
  max-width: 100%;
  margin: var(--s-2) 0;
  padding: var(--s-2);
  font: 0.78rem/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* ---------- Away & missing (v2.33) ----------
   A thing somewhere you can't reach, or gone. Said in words wherever it is
   listed (search, My Things, its page); on a canvas the pin is dimmed with
   a mark INSIDE the disc, so its box — and with it layout, labels and Tidy —
   is exactly what it was. No new floating chrome. */
/* Away is not a problem — the primary colour; Missing is the danger red. */
.map-search-status { font-size: 0.8rem; font-weight: 600; color: var(--primary); }
.map-search-status.is-missing, .status-text.is-missing { color: var(--danger); }
.status-text.is-away { color: var(--primary); font-weight: 600; }
.status-text.is-missing { font-weight: 600; }
.map-search-none { padding: var(--s-1) var(--s-2) var(--s-2); }
.map-search-none .map-search-note { padding: 0 0 var(--s-2); }
.map-search-choices { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.map-search-choice {
  min-height: 44px;     /* a touch target (v2.34) */
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.map-search-choice.is-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary, #fff); }
.map-search-away { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.map-search-away[hidden] { display: none; }
/* At 320 the button drops under the line rather than squeezing into a disc. */
.map-search-away input { flex: 1 1 160px; min-width: 0; min-height: 44px; }
.map-search-away .map-search-choice { white-space: nowrap; }
.status-chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-top: var(--s-2); }
.badge.status-chip { text-transform: none; letter-spacing: 0; font-size: 0.85rem; white-space: normal; }
.badge.status-chip.is-away { background: color-mix(in srgb, var(--primary) 16%, transparent); color: var(--ink); }
.badge.status-chip.is-missing { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.status-back { margin: 0; }
/* A name that is a guess (R47). On a pin, a dotted underline under the name:
   a shape, not a colour, and quiet on a canvas of twenty fresh groceries (the
   label also says so to a screen reader). On the thing's page, in words, with
   what they said and a 44px Keep. */
.map-pin.is-guess .map-pin-label {
  text-decoration: underline dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, var(--ink) 45%, transparent);
}
.badge.name-guess-chip { text-transform: none; letter-spacing: 0; font-size: 0.85rem; white-space: normal;
                         background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.name-guess-heard { overflow-wrap: anywhere; }
.name-keep-form { margin: 0; }
.name-guess-row .btn.small { min-height: 44px; }
.status-mark { margin-top: var(--s-3); }
.status-mark > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; }
.status-mark-form { display: grid; gap: var(--s-2); padding-top: var(--s-2); }
.status-mark-form input { width: 100%; }
.status-mark-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.map-pin.is-away .map-pin-disc, .map-pin.is-missing .map-pin-disc { border-style: dashed; }
.map-pin.is-away .map-pin-photo, .map-pin.is-away .map-pin-initial,
.map-pin.is-missing .map-pin-photo, .map-pin.is-missing .map-pin-initial { opacity: 0.4; filter: grayscale(0.7); }
.map-pin.is-away .map-pin-label, .map-pin.is-missing .map-pin-label { opacity: 0.75; }
.map-pin-status {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: var(--primary);
  box-shadow: 0 0 0 2px var(--surface);
}
.map-pin.is-missing .map-pin-status { background: var(--danger); }
.map-pin.is-away .map-pin-status::after { content: '↗'; }
.map-pin.is-missing .map-pin-status::after { content: '?'; }

/* ---------- Account & trash ---------- */
.account-form .field { margin-bottom: var(--s-4); }
.account-form input[type="text"] { width: 100%; }

.inline-form { margin: 0; display: inline-flex; }

/* ---------- Spend (v1.89) ----------
   A bill you can read at a glance: one big number, then bars long enough to
   compare without reading the figures. Bars, not a pie: comparing lengths is
   the one thing the eye is actually good at. */
.spend-total { margin: 0 0 var(--s-6); }
.spend-total-figure {
  font-size: 44px;
  font-weight: 600;
  line-height: 1;
  margin: 0 0 var(--s-2);
  font-variant-numeric: tabular-nums;
}
.spend-bar {
  display: block;
  height: 6px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  overflow: hidden;
}
.spend-bar-fill { display: block; height: 100%; background: var(--accent); }
/* One column per day, tallest = the worst day. Scrolls rather than squashing
   below anything readable at 390px. */
.spend-days {
  list-style: none;
  margin: 0 0 var(--s-2);
  padding: 0;
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 90px;
  overflow-x: auto;
}
.spend-day {
  flex: 1 0 8px;
  height: 100%;
  display: flex;
  align-items: flex-end;
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  border-radius: 2px;
}
.spend-day-fill {
  display: block;
  width: 100%;
  min-height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* ---------- Realtime models (v2.31, the owner's page) ----------
   Model IDs wrap instead of trailing off, and the badges sit on a line of
   their own under the ID: "email not sent" is said in that badge and at the
   top, so it must never be the part an ellipsis eats (it was, at 390px). A
   stopped check or a missed email is a red-edged card above everything. */
.rt-list .app-row-title { white-space: normal; overflow-wrap: anywhere; }
.rt-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.badge.alert { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
/* Two classes: .app-card, later in this file, sets its own border. */
.app-card.rt-alert { border-left: 4px solid var(--danger); }
.rt-alert p { margin: 0; overflow-wrap: anywhere; }
.rt-alert p + p { margin-top: var(--s-2); }
.rt-alert strong { color: var(--danger); }



/* ---------- Full-screen map: the canvas IS the page ----------
   Google-Maps model: site chrome hides, the frame fills the viewport, and
   every control floats over the map inside safe areas. z order (low→high):
   frame 0 · floating chrome 20 · voice FAB 40 · select bar 45 · chat 50 ·
   sheets 60. */
.fullscreen-map .site-header,
.fullscreen-map .site-footer { display: none; }
.fullscreen-map .site-main {
  max-width: none;
  margin: 0;
  padding: 0;
}
.fullscreen-map {
  overscroll-behavior: none;
  background: var(--surface-2);
}
.fullscreen-map .thing-map-frame {
  position: fixed;
  inset: 0;
  aspect-ratio: auto;
  width: auto;
  max-width: none;
  height: 100dvh;
  margin: 0;
  z-index: 0;
}
.fullscreen-map .thing-map-viewport {
  border: 0;
  border-radius: 0;
}

/* Floating messages become toasts over the map — and over every app page. */
.fullscreen-map .messages,
.app-page .messages {
  position: fixed;
  top: calc(72px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  width: min(480px, calc(100vw - 2 * var(--s-4)));
  margin: 0;
}

/* Top bar: menu + search pill. Above the chip row (z 20): the open menu
 * and search results must paint over the Arrange pill, never under it. */
.map-topbar {
  position: fixed;
  top: max(var(--s-3), env(safe-area-inset-top));
  left: max(var(--s-3), env(safe-area-inset-left));
  right: max(var(--s-3), env(safe-area-inset-right));
  z-index: 30;
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  pointer-events: none;          /* the map pans between the controls */
}
.map-topbar > * { pointer-events: auto; }
.map-topbar .map-search {
  margin-left: 0;
  flex: 1 1 auto;
  max-width: 560px;
}
.map-topbar .map-search-input {
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  border-color: transparent;
  padding-left: 18px;
}
.map-topbar .map-search-results {
  left: 0;
  right: 0;
  width: auto;
}

/* Round floating buttons — the GMaps corner-control look. */
.map-fab-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  list-style: none;
}
.map-fab-btn::-webkit-details-marker { display: none; }
.map-fab-btn:hover { color: var(--primary); }
.map-fab-btn svg { width: 22px; height: 22px; }

/* The tucked-away menu and the ⋯ actions panel. */
.map-menu, .map-actions { position: relative; }
/* An OPEN popover paints over its neighbours in the rail. Both are
   positioned with auto z-index, so paint order was DOM order — and the +
   button, which sits below the ⋯, was punching a hole through the corner
   of the ⋯ panel. */
.map-menu[open], .map-actions[open] { z-index: 1; }
.map-menu-panel, .map-actions-panel {
  position: absolute;
  top: calc(100% + 6px);
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.map-menu-panel { left: 0; }
.map-actions-panel {
  right: 0;
  /* Scrolls when it outgrows a short screen (the R44 review: an editor's
     eight rows inside a shared place ran off a 320×568 one). Its top sits
     under the ⋯ button, about 170px down; it stops above the bottom row
     (the things sheet's handle, the voice button), which would cover it. */
  max-height: calc(100dvh - 260px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.map-actions-panel > * { flex-shrink: 0; }
/* Tidy up's options are a popover of their own, below its row: a scrolling
   panel would clip them, so while Tidy is open the panel lets them out. */
.map-actions-panel:has(.map-tidy[open]) { max-height: none; overflow: visible; }
.map-menu-link {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

/* The ⋯ menu's one-line adder. Wraps, because at 390px a text box, a
   button and an × do not share a line with anything left over. */
.map-quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-3) var(--s-3);
}
.map-quick-input {
  flex: 1 1 100%;
  /* Wide enough that the camera, Add and the × share one line: the ⋯ panel
     is only 200px on its own, which wrapped the × onto a row of its own. */
  min-width: 210px;
  font: inherit;
  font-size: 16px;   /* iOS zooms the page below 16px */
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.photo-pick-label {
  position: relative;
  display: inline-flex;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  cursor: pointer;
  /* Belt and braces: if the rule below ever stops matching, the browser's
     own file chrome is clipped rather than bursting out of the button. */
  overflow: hidden;
}
/* A descendant rule, not a class the script has to add — the control is
   inside the label in the markup, so this matches whether or not any
   JavaScript ran. */
.photo-pick-label input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.photo-pick-text { pointer-events: none; }
.map-quick-go { flex: none; min-height: 44px; }
/* Camera sits to the left of Add: a photo is an input to the same act, not
   a separate one. Turns solid once something is attached. */
.map-quick-camera {
  position: relative;      /* the input stretches over it */
  flex: none;
  width: 44px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}
.map-quick-camera svg { width: 20px; height: 20px; }
/* The real control, invisible but present and on top — Safari will not open
   a file picker for an input it is not actually rendering. */
.map-quick-camera input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.map-quick-camera:hover { background: var(--surface-2); color: var(--ink); }
.map-quick-camera.has-photo {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
}
.map-quick-cancel {
  flex: none;
  width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.map-quick-hint { flex: 1 1 100%; margin: 0; }
.map-menu-link:hover { background: var(--surface-2); }
/* A row with a glyph. Opt-in, so the hamburger menu's plain text links are
   left exactly as they were. */
.map-menu-link.has-icon {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.map-menu-icon {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.map-menu-link.danger-link .map-menu-icon { color: inherit; }
.map-menu-link.has-icon:hover .map-menu-icon { color: var(--primary); }
.map-menu-link.danger-link:hover .map-menu-icon { color: inherit; }
/* What you do to the canvas, above what you do to this spot. */
.map-menu-rule {
  height: 1px;
  margin: var(--s-2) var(--s-2);
  background: var(--border);
}
/* Adding gets its own button under the ⋯, because it is the one people
   reach for most and it was buried in a menu of six. */
.map-add > summary { list-style: none; }
.map-add > summary::-webkit-details-marker { display: none; }
.map-add-glyph { width: 22px; height: 22px; }
.map-add[open] > summary { color: var(--primary); }
/* A class `display` beats the UA's [hidden] rule, so hiding the adders
   while the box is open did nothing at all — the same trap the picker's
   scroller hit. Second time; hence the sweep test. */
.map-actions-panel [hidden] { display: none !important; }
.map-menu-logout { margin: 0; }
.map-menu-version {
  margin: 4px 0 0;
  padding: 6px 14px;
  border-top: 1px solid var(--border);
}

/* Carrying a pin between pages: a bar that rides above every screen until
   you drop it. Above the select bar, below the chat panel. */
.map-carry {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(max(var(--s-4), env(safe-area-inset-bottom)) + 76px);
  z-index: 46;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  max-width: min(92vw, 520px);
  padding: 8px 10px 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}
.map-carry-line {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.map-carry-what {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.map-carry-msg { white-space: normal; }
.map-carry .btn { flex: none; white-space: nowrap; }
.map-carry-x {
  flex: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

/* Chip row under the search bar: back chip + Arrange pill, GMaps-style.
 * The right edge reserves the map-side FAB column (44px + gap), which sits
 * in the same band — otherwise a long back-chip name pushes the pill under
 * the layers toggle and its taps get stolen.
 *
 * Two lines, not one (v2.14). Undo and Redo joined the row in v2.11 and a
 * 390px phone cannot hold a spot's name, Arrange, "Undo moving things" and
 * Redo side by side: the name shrank to "…" and Undo ran under the layers
 * toggle. So the row is a column of two lines — the chips on the first,
 * the undo pair on the second, the way GMaps stacks its filter chips.
 * Explicit lines rather than flex-wrap: wrapping breaks by the chips'
 * natural widths, so a long spot name pushed Arrange down a line and the
 * pair down another, three deep. */
.map-chip-row {
  position: fixed;
  top: calc(max(var(--s-3), env(safe-area-inset-top)) + 54px);
  left: max(var(--s-3), env(safe-area-inset-left));
  right: calc(max(var(--s-3), env(safe-area-inset-right)) + 44px + var(--s-2));
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-start;       /* each line is only as wide as its chips */
  gap: var(--s-2);
  pointer-events: none;          /* the map pans between the chips */
}
.map-chip-row > * { pointer-events: auto; }
/* An invitation on your own top level (v2.65): a card under the chips,
   measured by map.js like them. Its answers are full-size targets. */
.map-invite {
  width: min(100%, 22rem);
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  color: var(--ink);
}
.map-invite-text { margin: 0; overflow-wrap: anywhere; }
.map-invite-meta { margin: var(--s-1) 0 var(--s-3); font-size: 0.85rem; color: var(--muted); }
.map-invite-meta a { color: var(--primary); white-space: nowrap; }
.map-invite-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.map-invite-actions form { margin: 0; }
.map-invite-actions .btn { min-height: 44px; padding: 8px 14px; touch-action: manipulation; }
.map-invite-report { color: var(--muted); }
.map-chip-line {
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.map-chip-line,
.map-chip-row > .map-undo-pair {
  max-width: 100%;
  min-width: 0;
  pointer-events: none;          /* transparent boxes: the map pans through */
}
.map-chip-line > *,
.map-chip-row > .map-undo-pair > * { pointer-events: auto; }
/* The undo line keeps its room whether or not a pill is showing (v2.29): a
   label pinned along the top sits just under the chip rows (map.js,
   measureChrome), and a line that only existed once there was something to
   undo made that tag hop 40px on the first drag. The pill's own height. */
.map-chip-row > .map-undo-pair { min-height: 44px; }
/* On its own line the label has the whole row, so it ellipsizes against
   the line, not a viewport cap. */
.map-chip-row .map-undo-pill { flex: 0 1 auto; min-width: 0; }
.map-chip-row .map-undo-label { flex: 0 1 auto; min-width: 0; max-width: none; }
.map-back-chip {
  display: inline-flex;
  align-items: center;
  gap: 0;
  /* The NAME yields, never the pill: no viewport cap (70vw + the pill was
   * wider than the row, overflowing Arrange under the layers toggle) —
   * the chip shrinks to whatever the row truly has left and the name span
   * ellipsizes there. */
  flex: 0 1 auto;
  min-width: 0;
  /* The thing page's pill, matched (v2.35): 48px, Fraunces at the pill's
     size, the ‹ in a 44px circle. It is measured chrome, so labels pinned
     along the top sit under it (map.js measureChrome). */
  min-height: 48px;
  padding: 2px var(--s-5) 2px 2px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
}
.map-back-chip svg { width: 20px; height: 20px; padding: 12px; box-sizing: content-box; flex: none; }
@media (min-width: 720px) {
  .map-back-chip { font-size: 1.4rem; }
}
/* A phone (v2.36): at 20px with its icon, 54 of his 147 spot names showed
   whole at 390 and 1 at 320. Below 430px the spot icon steps out (~31px
   back), the name is set at 1.1rem and the end padding is 16px: 95 and 26
   whole. The 48px height, the 44px ‹ circle and Fraunces stay. */
@media (max-width: 429.98px) {
  .map-back-chip { font-size: 1.1rem; padding-right: var(--s-4); }
  .map-back-chip .map-chip-icon { display: none; }
}
/* Plain inline flow, not a flex container: text-overflow only draws its
 * "…" on flowing text, so a flex name span hard-clipped mid-glyph. */
.map-back-chip-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.map-chip-icon {
  width: 18px;
  height: 18px;
  margin-right: 4px;
  vertical-align: -0.2em;
}

.map-arrange-pill {
  display: inline-flex;
  align-items: center;
  flex: none;
  min-height: 44px;              /* a whole touch target (v2.52; it was 40) */
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.map-arrange-pill.primary { background: var(--primary); color: var(--on-primary); }
/* Four arrows beside "Move", a tick beside "Done" (v2.48). */
.map-arrange-pill, .map-arrange-btn { gap: 6px; }
.map-arrange-btn { display: inline-flex; align-items: center; }
.map-arrange-icon { display: inline-flex; }
.map-arrange-icon svg { width: 18px; height: 18px; }
#map-arrange[aria-pressed="true"] .map-arrange-icon.is-move,
#map-arrange[aria-pressed="false"] .map-arrange-icon.is-done { display: none; }
/* A tight row — a spot's name beside it at 320: Move is its arrows alone
   (aria-label "Move"), Done keeps its word and drops the tick. */
@media (max-width: 359px) {
  .map-chip-line:has(.map-back-chip) #map-arrange[aria-pressed="false"] .map-arrange-label,
  .map-chip-line:has(.map-back-chip) #map-arrange[aria-pressed="true"] .map-arrange-icon.is-done { display: none; }
  .map-chip-line:has(.map-back-chip) #map-arrange[aria-pressed="false"] { padding: 6px 12px; }
}

/* The way back from a Tidy, or from an evening of dragging. It carries its
   own box rather than borrowing .map-arrange-pill, because it sits beside
   that pill on the spot map and beside a .btn.ghost on a thing's contents
   canvas, and has to read the same in both. Quieter than Arrange on
   purpose: reassurance you want to SEE is there, not a second call to
   action. 44px tall, a whole touch target (v2.52; it was 40). */
.map-undo-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 44px;
  padding: 6px 14px 6px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-md);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
/* Must beat the display above, or a canvas with nothing to undo shows a
   pill reading "Undo". */
.map-undo-pill[hidden] { display: none; }
.map-undo-pill[disabled] { opacity: 0.55; }
.map-undo-pill svg { width: 18px; height: 18px; flex: none; }
/* A long label ("Undo Group by type") must not push Arrange off a 390px
   row — the icon alone still reads as "back". Only a thing's contents
   header uses this cap now (the chip row lifts it), and that header wraps:
   52vw holds the widest label, "Undo moving a label" (153px), whole at 320
   (v2.52; 46vw cut it to "Undo moving a la…"). */
.map-undo-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 52vw;
}

/* Right-edge cluster: layers toggle + ⋯ actions. */
.map-side {
  position: fixed;
  top: calc(max(var(--s-3), env(safe-area-inset-top)) + 54px);
  right: max(var(--s-3), env(safe-area-inset-right));
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

/* A thing's contents canvas is the same canvas a spot has, so it is laid
   out the same way: adding at the top right, zoom at the bottom right. The
   rail is positioned inside the frame rather than fixed to the window,
   because this canvas is a panel on a scrolling page, not the whole screen. */
.map-side.is-embedded {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  bottom: auto;
  left: auto;
  z-index: 6;
}
[data-map-embed] .map-zoom {
  top: auto;
  bottom: var(--s-2);
}
/* Zoom keeps its ids but floats above the chat FAB now. */
.fullscreen-map .map-zoom {
  top: auto;
  right: max(var(--s-3), env(safe-area-inset-right));
  bottom: calc(max(var(--s-5), env(safe-area-inset-bottom)) + 76px);
  z-index: 20;
  border: 0;
  box-shadow: var(--shadow-md);
}

/* The hint only matters while arranging; floated as a small banner along
 * the bottom, wrapping, and pointer-events: none — up top it sat exactly
 * over the ⋯ cluster and blocked it. */
.fullscreen-map .map-hint { display: none; }
.fullscreen-map .thing-map-frame:has(.thing-map[data-editing="1"]) .map-hint {
  display: block;
  position: absolute;
  bottom: calc(max(var(--s-5), env(safe-area-inset-bottom)) + 76px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  margin: 0;
  padding: 8px 16px;
  border-radius: 16px;
  max-width: min(72vw, 420px);
  text-align: center;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  font-size: 0.85rem;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
/* A passing toast (v2.24): gone after a few seconds or the first touch. */
.fullscreen-map .thing-map-frame:has(.thing-map[data-editing="1"]) .map-hint.is-gone {
  opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
  .fullscreen-map .map-hint { transition: none; }
}
.fullscreen-map .map-status {
  position: fixed;
  left: max(var(--s-3), env(safe-area-inset-left));
  bottom: max(var(--s-3), env(safe-area-inset-bottom));
  z-index: 20;
  margin: 0;
}

/* "Things here": loose items in this spot as a bottom sheet over the map. */
.map-things-sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 25;
  width: min(560px, 100vw);
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
}
.map-things-handle {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  /* Tall: near the screen's bottom edge iOS steals thin tap targets for
     its own toolbar reveal. Swiping the handle works too (map.js). */
  min-height: 58px;
  touch-action: none;
  padding: var(--s-2) var(--s-4);
  padding-bottom: max(var(--s-2), env(safe-area-inset-bottom));
  font-weight: 700;
  cursor: pointer;
  list-style: none;
  position: relative;
}
.map-things-handle::-webkit-details-marker { display: none; }
.map-things-grab {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
}
.map-things-list {
  max-height: 45dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0;
  padding: 0 var(--s-3) max(var(--s-3), env(safe-area-inset-bottom));
}

/* Tree view scrolls beneath the same floating chrome. The right gutter
   is the side rail's (map/list switch, actions): fixed over the page, it
   would otherwise sit on the end of every row as the outline scrolls. */
.fullscreen-map .otree-wrap {
  padding: calc(max(var(--s-3), env(safe-area-inset-top)) + 66px)
           calc(max(var(--s-2), env(safe-area-inset-right)) + 58px) 120px var(--s-4);
  max-width: 820px;
  margin: 0 auto;
}
/* Inside a spot the back chip floats under the search bar too: start below
   it. outline.js measures the real chrome and sets the exact padding (a
   long name, a late font); this is the gap before it runs. */
.fullscreen-map .otree-wrap.has-crumb {
  padding-top: calc(max(var(--s-3), env(safe-area-inset-top)) + 54px + 48px + var(--s-4));
}
.fullscreen-map .map-empty-state {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--s-6);
  text-align: center;
}

/* ---------- Trips: packing lists as gathering routes ----------
   v2.26: the index is the one list row (.app-list); a trip is its route as
   titled groups of rows, top to bottom IS the walk. */
.trip-route { display: grid; gap: var(--s-1); }
.trip-group { margin-bottom: var(--s-4); }
.trip-group .app-list { margin-bottom: 0; }
.trip-entry { cursor: pointer; }
.trip-entry input[type="checkbox"] {
  width: 24px;
  height: 24px;
  flex: none;
  margin: 10px;            /* a 44px target around the box */
  accent-color: var(--primary);
}
.trip-entry-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.trip-entry.is-packed .trip-entry-name {
  text-decoration: line-through;
  color: var(--muted);
}
.trip-entry-go {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 1.3rem;
  text-decoration: none;
}
.trip-entry-go:hover { text-decoration: none; color: var(--primary); }

/* ---------- Assistant: FAB + chat panel ----------
   The chat borrows the secretary app's design language — 14px bubbles capped
   at 85%, a rounded input bar whose focus ring lives on the container, a
   Talk pill, and a breathing voice orb — recolored with FindIt's tokens. */
/* Several assistant elements set their own display (flex/grid), which beats
   the UA's [hidden] rule — without this, the panel can never close. */
#voice-assistant [hidden] { display: none !important; }
.voice-fab {
  position: fixed;
  right: max(var(--s-4), env(safe-area-inset-right));
  bottom: max(var(--s-5), env(safe-area-inset-bottom));
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--on-primary);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  z-index: 40;
  transition: transform 120ms ease, background 120ms ease;
}
.voice-fab:hover { background: var(--primary-hover); }
.voice-fab:active { transform: scale(0.95); }
.voice-fab svg { width: 28px; height: 28px; }
.voice-assistant.is-open .voice-fab { display: none; }

.chat-round-btn.is-small { width: 44px; height: 44px; }
.chat-round-btn.is-small svg { width: 20px; height: 20px; }

/* ---------- the chat sheet (v2.24) ----------
   ONE bottom sheet. A grabber on the top edge in every size: drag to any
   height (voice.js settles it on bar, half or full; on iPad/desktop it may
   rest anywhere, snapping only near those), tap to swap between the bar
   and the last size, drag below the bar to close. One X. The composer is
   pinned to the bottom at every height, and a live call sits in the same
   sheet — never a separate screen.

   The rules that made the old panel glide still hold:
   - BOTTOM-ANCHORED in every size (`inset: auto 0 0 0`, the desktop card
     by `bottom`). A box pinned at the top shrinks by raising its bottom
     edge — the v1.96 "chat goes up" bug.
   - The height is the custom property `--chat-h`, never an inline
     `height`: an inline height beats every class rule, a variable is read
     BY them, so `.is-bar` can still say `height: auto`.
   - A drag writes a height every frame and is never tweened (`is-dragging`);
     settling glides, and reduced motion turns the glide off. */
.chat-panel {
  /* Its own snapshot during a page swap: the map's pins carry view-
     transition-names and draw in the ::view-transition layer, which
     flashed them over the chat on every applied plan. */
  view-transition-name: chat-panel;
  position: fixed;
  inset: auto 0 0 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  height: var(--chat-h, 50%);
  max-height: 100%;
  background: var(--bg);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  transition: height 300ms cubic-bezier(0.22, 1, 0.36, 1);
}
/* At bar height the sheet is its content: the grabber row and whatever
   sits at the bottom (composer, or call bar + composer). */
.chat-panel.is-bar { height: auto; }
.chat-panel.is-bar .chat-thread {
  flex: none;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}
/* Full on a phone: clear of the notch. */
.chat-panel.is-full { padding-top: env(safe-area-inset-top); border-radius: 0; }
.chat-panel.is-dragging { transition: none; user-select: none; }

.chat-top {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
}
/* The one grabber: a 44px-tall target across the middle of the top edge. */
.chat-grip {
  width: min(220px, 60%);
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  cursor: grab;
  /* The drag is ours: without this iOS scrolls the page instead. */
  touch-action: none;
}
.chat-grip:active { cursor: grabbing; }
.chat-grip:focus-visible { outline: 3px solid var(--accent); outline-offset: -6px; border-radius: 12px; }
.chat-grip-bar {
  display: block;
  width: 40px;
  height: 5px;
  margin: 0 auto;
  border-radius: 3px;
  background: var(--border);
}
.chat-grip:hover .chat-grip-bar { background: var(--muted); }
/* The one X, always in the same corner. */
.chat-icon-btn.chat-x {
  position: absolute;
  top: 0;
  right: 4px;
  width: 44px;
  height: 44px;
}
/* At bar height in a call the X has nothing to do — a call never hides the
   chat, and End is right there — so it steps out of the way. */
.chat-panel.in-call.is-bar .chat-icon-btn.chat-x { visibility: hidden; }
/* iPad / desktop width: a strip along the card's left edge. */
.chat-width { display: none; }

.chat-bottom { flex: none; }

@media (min-width: 720px) and (min-height: 560px) {
  /* A card that moves (v2.27) — and only where voice.js's DESK says so: a
     phone in landscape (844×390) keeps its bottom sheet. */
  /* A card that moves (v2.27): held by its right/bottom offsets, which its
     header drags (voice.js wireMove) — so it still grows up and to the left
     from where it rests. Size and spot glide with Secretary's ease. */
  .chat-panel {
    inset: auto;
    right: var(--chat-right, var(--s-5));
    bottom: var(--chat-bottom, var(--s-5));
    width: var(--chat-w, 420px);
    max-width: calc(100vw - var(--chat-right, var(--s-5)) - 8px);
    height: var(--chat-h, min(680px, calc(100vh - var(--s-7))));
    /* The same 8px limit voice.js's placeCard keeps from the top (GAP): a
       larger margin here squeezed a card dragged against the top edge. */
    max-height: calc(100vh - var(--chat-bottom, var(--s-5)) - 8px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: height 340ms cubic-bezier(0.22, 0.9, 0.32, 1),
                width 340ms cubic-bezier(0.22, 0.9, 0.32, 1),
                right 340ms cubic-bezier(0.22, 0.9, 0.32, 1),
                bottom 340ms cubic-bezier(0.22, 0.9, 0.32, 1);
  }
  .chat-top { cursor: grab; }
  .chat-grip { cursor: ns-resize; }
  .chat-panel.is-moving { transition: none; user-select: none; }
  .chat-panel.is-moving .chat-top { cursor: grabbing; }
  .chat-panel.is-full { padding-top: 0; border-radius: var(--radius-lg); }
  .chat-panel.is-opening { transform-origin: bottom right; }
  .chat-width {
    display: block;
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 10px;
    z-index: 3;
    cursor: ew-resize;
    touch-action: none;
  }
}

/* Opening (v2.27): up out of its corner with Secretary's ease. */
@keyframes chat-open {
  from { opacity: 0; transform: translateY(14px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}
.chat-panel.is-opening {
  transform-origin: bottom center;
  animation: chat-open 340ms cubic-bezier(0.22, 0.9, 0.32, 1);
}
@media (prefers-reduced-motion: reduce) {
  .chat-panel.is-opening { animation: none; }
}

/* ---------- the call, inside the chat ----------
   A slim bar on the composer, in the composer's own family: the live mic
   (mute, moving with your voice), what is happening, the voice chip, end. The thread above
   stays — the transcript and the assistant's replies land in it — and the
   text box below stays usable to type mid-call. */
.chat-callbar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: var(--s-2) var(--s-4) 0;
  padding: 2px 4px 2px 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
/* Secretary's live mic (v2.27): live, the accent disc grows and lifts with
   YOUR voice (--lvl, 0–1, set by voice.js from the mic's level); muted, it
   is grey, a step smaller and still. The 44px button never moves. */
.chat-call-mic {
  flex: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.chat-call-mic-disc {
  --lvl: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary);
  color: var(--on-primary);
  transform: translateY(calc(var(--lvl) * -3px)) scale(calc(1 + var(--lvl) * 0.16));
  box-shadow: 0 0 0 calc(2px + var(--lvl) * 6px) color-mix(in srgb, var(--primary) 30%, transparent);
  transition: transform 110ms cubic-bezier(0.22, 0.9, 0.32, 1), box-shadow 110ms ease,
              background-color 200ms ease, color 200ms ease;
}
.chat-call-mic-disc svg { width: 17px; height: 17px; }
.chat-call-mic .mic-slash { display: none; }
.chat-call-mic.is-muted .mic-slash { display: inline; }
.chat-call-mic.is-muted .chat-call-mic-disc {
  background: var(--surface-2);
  color: var(--muted);
  transform: scale(0.84);
  box-shadow: none;
}
.chat-call-mic:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-radius: 50%; }
.chat-call-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.chat-call-status { font-weight: 700; font-size: 0.9rem; }
.chat-call-line {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  color: var(--muted);
}
/* The latest line only matters when the thread is out of sight. */
.chat-panel:not(.is-bar) .chat-call-line { display: none; }
.chat-call-voice { position: relative; flex: none; }
.chat-call-chip {
  min-height: 44px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.chat-callbar .chat-round-btn { flex: none; }
/* During a call the composer keeps only the text box and Send: Talk,
   dictation, the camera and the + / mode chips would all fight the call
   for the microphone or the point of the moment. */
.chat-panel.in-call .chat-inputbar > :not(textarea):not(.chat-send) { display: none; }
.chat-panel.in-call #chat-text { flex: 1 1 auto; }   /* one row with Send */
.chat-panel.in-call #chat-attach-pill { display: none; }
@media (prefers-reduced-motion: reduce) {
  .chat-panel,
  .chat-thread { transition: none; }
  /* The signal stays, the movement goes: a halo that brightens instead. */
  .chat-call-mic-disc {
    transform: none;
    box-shadow: 0 0 0 calc(2px + var(--lvl) * 10px) color-mix(in srgb, var(--primary) 35%, transparent);
    transition: box-shadow 200ms ease, background-color 200ms ease, color 200ms ease;
  }
  .chat-call-mic.is-muted .chat-call-mic-disc { transform: none; }
}

.chat-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.chat-icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.chat-icon-btn svg { width: 18px; height: 18px; }

.chat-thread {
  min-height: 0;
  flex: 1;
  /* A number for the bar rule to tween FROM. `none` is not interpolatable,
     so without this the thread is cut to nothing on the first frame while
     the sheet is still gliding. */
  max-height: 100dvh;
  overflow-y: auto;
  padding: var(--s-5) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  /* Declared HERE rather than on `.chat-panel.is-bar .chat-thread`: that
     selector stops matching the instant the class comes off, so growing
     back would have no transition at all. */
  transition: max-height 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* A message (v2.27, Secretary's shapes): the person's bubble on the right
   (18px corners, the --bubble wash), the assistant's reply as plain text on
   the left, each with a quiet Copy / Speak row under it. */
/* Where else an add landed (v2.49): the paths, to tap. */
.chat-places { margin: 0 0 var(--s-2); padding: 0 var(--s-2); font-size: 0.875rem; color: var(--muted); }
.chat-places a { color: var(--ink); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.chat-msg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
}
.chat-msg.is-user { align-items: flex-end; }
/* One utterance the VAD split reads as one: same-speaker messages in a row
   sit closer together. */
.chat-msg.is-user + .chat-msg.is-user,
.chat-msg.is-assistant + .chat-msg.is-assistant { margin-top: calc(-1 * var(--s-2)); }
.chat-bubble {
  max-width: 85%;
  border-radius: 18px;
  padding: 10px 16px;
  font-size: 16px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.chat-bubble.is-user {
  align-self: flex-end;
  background: var(--bubble);
  color: var(--ink);
}
.chat-bubble.is-assistant {
  align-self: flex-start;
  max-width: 94%;
  padding: 2px 0;
  color: var(--ink);
}
/* Copy and Speak: drawn small and quiet, but every hit is 44px — the row
   overlaps the gap around it so it costs little height. Always shown (not
   on tap): on a touch screen a hidden action is a missing one. */
.chat-msg-actions {
  display: flex;
  margin: -4px -12px -10px;
}
.chat-msg:has(> .chat-bubble:empty) > .chat-msg-actions { visibility: hidden; }
.chat-msg-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  opacity: 0.75;
  cursor: pointer;
  transition: color 120ms ease, background 120ms ease, opacity 120ms ease;
}
.chat-msg-btn svg { width: 16px; height: 16px; }
.chat-msg-btn:hover { opacity: 1; color: var(--ink); background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.chat-msg-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: -4px; opacity: 1; }
.chat-msg-btn.is-done { color: var(--success); opacity: 1; }
.chat-msg-btn.is-loading,
.chat-msg-btn.is-playing { color: var(--primary); opacity: 1; }
.chat-msg-btn.is-loading svg { animation: chat-pulse 1s ease-in-out infinite; }
.chat-msg-btn.is-error { color: var(--danger); opacity: 1; }
/* Never read aloud into an open mic: dimmed (and refused) during a call
   or dictation. */
.chat-panel.in-call .chat-msg-speak,
.chat-panel.is-dictating .chat-msg-speak { opacity: 0.3; cursor: default; }
@media (prefers-reduced-motion: reduce) {
  .chat-msg-btn.is-loading svg { animation: none; }
}
.chat-typing span { animation: chat-pulse 1.2s ease-in-out infinite; color: var(--muted); }
/* A spoken turn waiting for its words (R46): its bubble is placed when the
   turn is committed, so it keeps its place in the conversation, and "…"
   holds it until the transcript lands. One the transcriber gave up on says
   so, quietly. */
.chat-bubble.is-pending::after { content: '…'; color: var(--muted); animation: chat-pulse 1.2s ease-in-out infinite; }
.chat-bubble.is-unheard { color: var(--muted); font-style: italic; }
/* Nothing to copy or read aloud there but FindIt's own words (v2.70). */
.chat-msg:has(> .chat-bubble.is-unheard) > .chat-msg-actions { display: none; }

/* Plan / tool-result cards */
.chat-card {
  align-self: stretch;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: var(--s-3);
}
.chat-card.is-applied { opacity: 0.75; }
.chat-card.is-dismissed { opacity: 0.5; }
.chat-card-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); }
.chat-card-row {
  display: flex;
  gap: var(--s-3);
  align-items: baseline;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.92rem;
}
.chat-card-label {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-width: 88px;
}
/* Linked rows: a stretched overlay makes the whole row the tap target, and
   a chevron says "this goes somewhere". */
.chat-card-row.has-link { position: relative; padding-right: 26px; }
.chat-card-row.has-link::after {
  content: '›';
  position: absolute;
  right: var(--s-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.1rem;
}
/* The raw tool error, folded away under a plain sentence (v1.89). Those
   strings are written to steer the model — paths, tokens, constraints — so
   they are available, not in your face. A 44px row keeps the disclosure
   tappable on the phone. */
.chat-card-why { margin-top: var(--s-2); }
.chat-card-why > summary {
  list-style: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.chat-card-why > summary::-webkit-details-marker { display: none; }
.chat-card-why > summary::before { content: '▸'; font-size: 10px; }
.chat-card-why[open] > summary::before { content: '▾'; }
.chat-card-why > p {
  margin: 0 0 var(--s-2);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.chat-card-go { position: absolute; inset: 0; border-radius: inherit; }
.chat-card-go:active { background: color-mix(in srgb, var(--ink) 6%, transparent); }

.chat-card-row.is-new   { border-left: 3px solid var(--success); }
.chat-card-row.is-move  { border-left: 3px solid var(--primary); }
.chat-card-row.is-add   { border-left: 3px solid var(--success); }
.chat-card-row.is-trash { border-left: 3px solid var(--danger); }
.chat-card-row.is-miss  { border-left: 3px solid var(--warn); }
.chat-card-row.is-find  { border-left: 3px solid var(--primary); }
@media (max-width: 520px) {
  .chat-card-row { flex-direction: column; gap: 2px; }
  .chat-card-label { min-width: 0; }
}

.chat-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.chat-card-btn {
  /* The buttons that delete things: a full touch target (v2.77). They
     measured 40px. */
  min-height: 44px;
  min-width: 44px;
  border-radius: 999px;
  padding: 8px 18px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
}
.chat-card-btn.is-apply {
  border: none;
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: var(--shadow-sm);
}
.chat-card-btn.is-apply:hover { background: var(--primary-hover); }
.chat-card-btn.is-dismiss {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}
.chat-card-btn.is-dismiss:hover { background: var(--surface-2); color: var(--ink); }
.chat-card-btn:disabled { opacity: 0.5; cursor: default; }

/* "What is this?" from a photo (v2.19, photoid.js): the lines the server
   reports as it works, then the answer by band. One component, rendered in
   the chat thread and in the quick-add sheet below. */
.photo-id { display: grid; gap: var(--s-2); min-width: 0; }
/* The name box and the chip row set their own display, which beats the
   hidden attribute's — and the sheet is on <body>, outside the chat's own
   `#voice-assistant [hidden]` rule. Without this the box showed while the
   job was still working. */
.photo-id [hidden] { display: none !important; }
.photo-id-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.photo-id-events li::before { content: '· '; }
/* The newest line while it is still working: a slow breath, so a long
   identification reads as alive rather than stuck. */
.photo-id[data-state="working"] .photo-id-events li:last-child {
  color: var(--ink);
  animation: chat-pulse 1.6s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .photo-id[data-state="working"] .photo-id-events li:last-child { animation: none; }
}
.photo-id-headline {
  margin: 0;
  font-weight: 600;
  font-size: 15px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.photo-id-ask { margin: 0; color: var(--muted); font-size: 14px; }
.photo-id-status:empty { display: none; }
.photo-id-status { margin: 0; font-size: 14px; color: var(--muted); }
/* Chips wrap rather than scroll: at 390px three candidate names do not fit
   on a line, and a hidden fourth is a choice nobody sees. */
.photo-id-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.photo-id-chip {
  min-height: 44px;
  max-width: 100%;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  text-align: left;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
}
.photo-id-chip:active { background: color-mix(in srgb, var(--ink) 8%, var(--surface-2)); }
.photo-id-chip.is-other { background: transparent; color: var(--muted); }
.photo-id-chip:disabled { opacity: 0.5; cursor: default; }
.photo-id-name { display: flex; gap: var(--s-2); }
.photo-id-name-input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  /* 16px or iOS zooms the page on focus, and the zoom sticks. */
  font-size: 16px;
}
.photo-id-name-go { min-height: 44px; touch-action: manipulation; }

/* The quick-add host: a card on <body>, above the FAB, so the refresh that
   draws the new pin cannot take the rename chips with it. photoid.js lifts
   it above the little chat (--photo-id-lift) and the on-screen keyboard
   (--photo-id-kb); with the chat full it stays put and paints OVER the
   panel (z 50), so its chips and name box are reachable in every size.
   Its own view-transition-name keeps it above the map pins (which carry
   theirs) during the refresh after a commit, instead of under them. */
.photo-id-sheet {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(max(var(--photo-id-lift, 0px),
                   max(var(--s-5), env(safe-area-inset-bottom)) + 72px)
               + var(--photo-id-kb, 0px));
  width: min(480px, calc(100vw - 2 * var(--s-4)));
  max-height: min(60dvh, calc(100dvh - var(--photo-id-lift, 0px)
                              - var(--photo-id-kb, 0px) - 112px
                              - env(safe-area-inset-top)));
  overflow-y: auto;
  z-index: 56;
  view-transition-name: photo-id-sheet;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: var(--s-3) var(--s-4) var(--s-4);
}
/* Sticky, so the × (cancel) is still there after the card scrolls down to
   a focused name box. */
.photo-id-sheet-head {
  position: sticky;
  top: calc(-1 * var(--s-3));
  z-index: 1;
  margin-top: calc(-1 * var(--s-3));
  padding-top: var(--s-3);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
.photo-id-sheet-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.photo-id-sheet-close {
  min-width: 44px;
  min-height: 44px;
  margin-right: calc(-1 * var(--s-2));
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  touch-action: manipulation;
}

/* Input bar: the focus ring lives on the container, not the textarea.
   Two rows — the textarea owns the top line, the controls the bottom one.
   Five buttons on the same line as the text left it ~70px wide on a phone:
   the placeholder wrapped, the auto-grow made the box two lines tall, and
   the words floated above the buttons. */
/* The composer (v2.27, Secretary's): ONE row — + | the box | mic | Talk,
   Send taking Talk's place once there is text — in a soft pill. */
.chat-inputbar {
  /* Anchor for the + menu popover. */
  position: relative;
  flex: none;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 2px;
  margin: var(--s-2) var(--s-4);
  margin-bottom: max(var(--s-4), env(safe-area-inset-bottom));
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.chat-inputbar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}
.chat-inputbar textarea {
  /* The rest of the row: + on its left, the mic and Talk on its right. */
  flex: 1 1 auto;
  min-width: 0;
  /* One line when empty; autosize() grows it with the text. The global
     textarea rule's min-height: 80px is for form pages — here it left the
     placeholder marooned at the top of a box three lines tall. 44px is
     one line that is still a full-size touch target. */
  min-height: 44px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  /* 16px floor: anything smaller makes iOS Safari zoom the page on focus —
     and this is the control the app is tapped into most, so the zoom sticks
     after blur and shoves Send/Talk off the fixed-width bar. */
  font-size: 16px;
  line-height: 1.4;
  padding: 11px 4px;
  max-height: 140px;
}
.chat-inputbar textarea::placeholder { color: var(--muted); opacity: 0.8; }
.chat-send {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--on-primary);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.chat-send:hover { background: var(--primary-hover); }
.chat-send svg { width: 20px; height: 20px; }
/* Talk: the accent circle with the waveform — the live call. */
.chat-talk {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--on-primary);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: background 120ms ease, transform 80ms ease;
}
.chat-talk:hover { background: var(--primary-hover); }
.chat-talk:active { transform: scale(0.94); }
.chat-talk svg { width: 20px; height: 20px; }

/* The + and the mic: quiet circles, no border (Secretary's small
   buttons) — they feed the composer; Talk is the one filled control. */
.chat-compose-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.chat-compose-btn:hover { background: var(--surface-2); }
.chat-compose-btn svg { width: 21px; height: 21px; }
.chat-plus svg { width: 23px; height: 23px; }
.chat-plus[aria-expanded="true"] { background: var(--surface-2); }
.chat-dictate:disabled { cursor: default; opacity: 0.65; }
.chat-compose-btn:focus-visible,
.chat-talk:focus-visible,
.chat-send:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chat-dictate.is-recording {
  background: var(--danger);
  border-color: transparent;
  color: var(--on-primary);
  animation: mic-pulse 1.6s ease-in-out infinite;
}
.chat-dictate.is-working { animation: chat-breathe 1.2s ease-in-out infinite; }

/* Recording bar: discard left, live waveform and elapsed time centre, keep
   right — the same shape as the dictation control in Secretary. */
.chat-recorder {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-2) var(--s-4);
  margin-bottom: max(var(--s-4), env(safe-area-inset-bottom));
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.chat-rec-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--on-primary);
  transition: transform 80ms ease, filter 120ms ease;
}
.chat-rec-btn svg { width: 18px; height: 18px; }
.chat-rec-btn:active { transform: scale(0.94); }
.chat-rec-btn:hover { filter: brightness(1.08); }
.chat-rec-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.chat-rec-btn.is-cancel { background: var(--danger); }
.chat-rec-btn.is-accept { background: var(--success); }

.chat-rec-wave {
  flex: 1;
  min-width: 0;
  height: 34px;
  /* The canvas paints itself in currentColor, so the bars follow the theme. */
  color: var(--primary);
}
.chat-rec-time {
  flex: none;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

/* Dictation's states (v2.25). The box stays above the row — the live words
   land in it — so the box gives up its buttons and its bottom margin. */
.chat-panel.is-dictating .chat-inputbar > :not(textarea) { display: none; }
.chat-panel.is-dictating .chat-inputbar { margin-bottom: 0; }
.chat-rec-status {
  flex: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
}
.chat-rec-spin {
  display: none;
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  animation: chat-rec-spin 0.8s linear infinite;
}
@keyframes chat-rec-spin { to { transform: rotate(360deg); } }
/* Waiting on something (the session, the last segment, the upload): a
   spinner and the words for it, never a still, silent row. */
.chat-recorder[data-state="starting"] .chat-rec-spin,
.chat-recorder[data-state="finishing"] .chat-rec-spin,
.chat-recorder[data-state="transcribing"] .chat-rec-spin { display: block; }
.chat-recorder[data-state="starting"] .chat-rec-wave { opacity: 0.35; }
.chat-recorder[data-state="finishing"] .chat-rec-wave,
.chat-recorder[data-state="transcribing"] .chat-rec-wave,
.chat-recorder[data-state="error"] .chat-rec-wave,
.chat-recorder[data-state="error"] .chat-rec-time { display: none; }
.chat-recorder[data-state="finishing"] .chat-rec-status,
.chat-recorder[data-state="transcribing"] .chat-rec-status,
.chat-recorder[data-state="error"] .chat-rec-status { flex: 1; min-width: 0; }
.chat-recorder[data-state="error"] .chat-rec-status { font-weight: 500; }
/* Nothing to keep yet, or already on its way. */
.chat-recorder[data-state="starting"] .is-accept,
.chat-recorder[data-state="finishing"] .is-accept,
.chat-recorder[data-state="transcribing"] .is-accept,
.chat-recorder[data-state="error"] .is-accept { display: none; }

@media (prefers-reduced-motion: reduce) {
  .chat-dictate.is-recording,
  .chat-dictate.is-working { animation: none; }
  .chat-rec-spin { animation: none; border-top-color: var(--border); }
}

.chat-round-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 90ms ease, background 120ms ease, border-color 120ms ease;
}
.chat-round-btn:active { transform: scale(0.94); }
.chat-round-btn:hover { border-color: var(--muted); }
.chat-round-btn svg { width: 20px; height: 20px; }
/* Muted reads as red + a slash through the mic — unmissable state. */
.chat-round-btn .mic-slash { display: none; }
.chat-round-btn.is-muted .mic-slash { display: block; }
.chat-round-btn.is-muted {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 15%, transparent);
  color: var(--danger);
}
/* The + menu (v2.27): the camera, a library photo, a file, and the
   assistant's brainpower — everything that used to crowd the composer. */
.chat-plus-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: min(268px, calc(100vw - 2 * var(--s-4)));
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: chat-menu-up 160ms cubic-bezier(0.22, 0.9, 0.32, 1) both;
}
/* Drop-UP: the composer lives at the bottom of the screen, so the menu
   opens above the chip. An animation rather than a transition, because
   `#voice-assistant [hidden] { display: none !important }` means the box
   goes display:none -> flex, which no transition can cross. */
/* Brainpower: a group inside the + menu, under a hairline. */
.chat-mode-menu {
  display: flex;
  flex-direction: column;
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}
.chat-plus-head {
  margin: 4px 12px 2px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}
@keyframes chat-menu-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.chat-mode-opt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 48px;
  padding: 8px 12px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}
.chat-mode-opt:hover { background: var(--surface-2); }
.chat-mode-opt.is-current {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary);
}
.chat-mode-opt.is-current .chat-mode-name { font-weight: 700; }
.chat-mode-name { font-size: 0.95rem; font-weight: 600; }
.chat-mode-note { font-size: 0.78rem; color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .chat-plus-menu { animation: none; }
}

.chat-plus-opt {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.chat-plus-opt:hover { background: var(--surface-2); }
.chat-plus-opt svg { flex: none; width: 20px; height: 20px; color: var(--muted); }
.chat-attach-pill {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0 var(--s-3);
  padding: var(--s-2) var(--s-3);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-size: 0.85rem;
}
.chat-attach-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-attach-remove {
  flex: none;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.chat-attach-remove:hover { background: var(--border); color: var(--ink); }

/* The voice picker opens above the call bar's chip. */
.voice-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 6;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  min-width: 230px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.voice-menu-head {
  grid-column: 1 / -1;
  margin: 0;
  padding: 2px 8px 4px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.voice-opt {
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  text-align: left;
  cursor: pointer;
}
.voice-opt:hover { background: var(--surface-2); }
.voice-opt.is-current {
  background: color-mix(in srgb, var(--primary) 8%, transparent);
  color: var(--primary);
  font-weight: 700;
}

.chat-round-btn.is-end {
  border-color: color-mix(in srgb, var(--danger) 50%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger);
}
.chat-round-btn.is-end:hover { background: color-mix(in srgb, var(--danger) 22%, transparent); }

@keyframes chat-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
@keyframes chat-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-typing span,
  .chat-bubble.is-pending::after { animation: none; }

}

/* ---------- Form action bar (item_form, location_form) ----------
   One row, at the top of the card, that sticks to the viewport once the
   site header scrolls away — so Save is one tap from anywhere on the form
   and there is no second row at the bottom. sticky rather than fixed: the
   header is in flow and its height varies (it wraps to a column under
   720px), so a fixed bar would have to know it and would leave a hole in
   the card; sticky starts where the row already is, holds at the top edge,
   and lets go when the form's own bottom passes — exactly when it stops
   being useful. Nothing between here and <html> may gain overflow or
   transform, or this quietly turns back into an ordinary row. */
.form-actions-top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  /* Sticky boxes are positioned, so a later positioned sibling
     (.photo-pick-label is relative) would paint over the stuck bar
     without this. 20 is the "floating chrome" slot: under the FAB (40),
     chat (50) and sheets (60). */
  z-index: 20;
  /* Bleed to the card's edges so the stuck bar spans the card rather than
     the field column; the fields stay --s-6 in. Opaque, so the fields
     scrolling under it are hidden, not ghosted through. */
  margin: 0 calc(-1 * var(--s-6));
  padding: var(--s-3) var(--s-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  justify-content: space-between;
}
/* Go back: chevron tight against its word, natural width; Save takes the
   rest of the row on a phone. */
.form-back { flex: 0 0 auto; gap: var(--s-1); padding-left: 12px; }
@media (max-width: 520px) {
  .form-actions-top .btn.primary { flex: 1; }
}
/* Icon-in-a-button: the two photo buttons carry a glyph, so Move it and Go
   back carry an SVG the same size as the text. */
.btn > svg { width: 1.15em; height: 1.15em; flex: none; }
/* Whatever the browser scrolls to has to land under the stuck bar, not
   behind it. A failed `required` scrolls the CONTROL, not its wrapper —
   Chromium put the Name box flush at the viewport top, fully under the
   bar, with the "fill out this field" bubble pointing at Go back — so the
   controls carry the margin themselves: the bar (~72px) plus the label
   above the control (~32px) and a little air, on top of the phone's own
   inset, which is where the bar sits. */
.big-form input, .big-form textarea, .big-form select {
  scroll-margin-top: calc(120px + env(safe-area-inset-top, 0px));
}
.big-form .field, .big-form .form-error {
  scroll-margin-top: calc(80px + env(safe-area-inset-top, 0px));
}
/* A form page is typing, not talking: the mic sat on top of Move it and
   the photo help text on a phone. Same rule select mode uses below. */
body:has(.big-form) .voice-fab { display: none; }

/* ---------- Select mode (pick several, then move or trash) ---------- */
/* One visual language for every selectable surface: rows, cards, tree nodes
   and map pins all take the same ring and check. */
.select-start[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); }

body.is-selecting [data-select-id] {
  position: relative;
  /* A tap picks rather than opens, so kill the double-tap delay and the
     text selection a long press would otherwise start. */
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
body.is-selecting [data-select-id]::after {
  content: '';
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  z-index: 2;
}
body.is-selecting [data-select-id].is-picked {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
}
body.is-selecting [data-select-id].is-picked::after {
  border-color: var(--primary);
  background: var(--primary)
    /* the check, drawn rather than shipped as an asset */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 12.5 9.5 18 20 6.5'/%3E%3C/svg%3E")
    center / 16px 16px no-repeat;
}
/* Pins are absolutely placed on the board; the generic ring rule above must
   not drop them back into normal flow and collapse the map. */
body.is-selecting .map-pin { position: absolute; }
/* Pins are circles on a canvas: put the check on the disc, not the label. */
body.is-selecting .map-pin::after { top: 0; right: 0; }
body.is-selecting .map-pin.is-picked .map-pin-disc { border-color: var(--primary); }
body.is-selecting .map-pin.is-picked { outline: none; }
/* Outline rows: room for the check at the row's end (v2.43). */
body.is-selecting .ot-link { padding-right: 44px; }
body.is-selecting .ot-link::after { top: 50%; margin-top: -12px; }

/* While picking, the mic would sit on top of the action bar. */
body.is-selecting .voice-fab { display: none; }
/* A live call keeps its sheet (at bar height) above the action bar, by the
   bar's measured top (voice.js sets --select-lift); the fallback only
   covers the instant before it is measured. */
body.is-selecting .chat-panel.in-call {
  bottom: var(--select-lift, calc(max(var(--s-3), env(safe-area-inset-bottom)) + 96px));
}
/* Arrange and Select both redefine what a tap does; only one at a time. */
body.is-selecting #map-arrange { display: none; }
/* Keep the bar off the last row. */
body.is-selecting .site-main { padding-bottom: 96px; }

.select-bar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(var(--s-3), env(safe-area-inset-bottom));
  z-index: 45;
  width: min(560px, calc(100vw - 2 * var(--s-3)));
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.select-count {
  flex: 1;
  min-width: 0;
  padding: 0 var(--s-1);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.select-bar-btn {
  min-height: 44px;
  padding: 0 var(--s-3);
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  touch-action: manipulation;
}
.select-bar-btn.is-danger { color: var(--danger); }
/* A phone can't hold the count and five 44px buttons on one line (v2.52):
   with one thing picked (Edit showing) Done ran off the screen at 320, 375
   and 390, and "1 selected" was squeezed under Move. So below 480px the
   count is its own small line on top and the buttons share the line below,
   each whole (never narrower than its word). */
@media (max-width: 480px) {
  .select-bar {
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px var(--s-2) var(--s-2);
  }
  .select-count {
    order: -1;
    flex: 1 0 100%;
    padding: 0 var(--s-1);
    font-size: 0.8rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .select-bar-btn {
    flex: 1 1 auto;
    min-width: 44px;
    padding: 0 6px;
    white-space: nowrap;
  }
  /* The two-line bar is 18px taller, and with a home bar the zoom's −
     tucked 5px under it (R32 review): the zoom rises by the same. */
  body.fullscreen-map.is-selecting .map-zoom {
    bottom: calc(max(var(--s-5), env(safe-area-inset-bottom)) + 94px);
  }
}
.select-bar-btn[disabled] { opacity: 0.4; }
.select-bar-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.select-sheet { position: fixed; inset: 0; z-index: 60; }
.select-sheet-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  /* Dragging the backdrop must not pan the page behind the sheet. Taps still
     land — touch-action never blocks a click. */
  touch-action: none;
}
/* Bottom sheet on a phone: thumb-reachable, and the keyboard pushes it up
   rather than covering it. */
.select-sheet-card {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(560px, 100vw);
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  padding-bottom: env(safe-area-inset-bottom);
}
.select-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-4) var(--s-2);
  border-bottom: 1px solid var(--border);
}
.select-sheet-head h2 { margin: 0; font-size: 1.15rem; }
.select-sheet-close {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.6rem;
  line-height: 1;
  border-radius: var(--radius);
}
/* Scrolling to the end of the destination list must not start scrolling the
   page underneath it. */
.select-sheet-body { padding: var(--s-4); overflow-y: auto; overscroll-behavior: contain; }
/* The destination browser (picker.js) rides the select-sheet chrome. A
   FIXED height keeps the sheet from bouncing as levels of different sizes
   swap in while drilling: with max-height alone the top of the card sat
   at three different heights across home, a two-row level and the root,
   so the Back button moved out from under the finger on every trip. The
   picker is the only sheet that swaps screens, so only it is pinned. */
.picker .select-sheet-card { height: 85dvh; }
.picker-head { justify-content: flex-start; flex: none; }
.picker-head .picker-title {
  flex: 1;
  min-width: 0;
  /* A long name wrapped to three lines and ate the sheet. Two, then … */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.picker-back {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
}
.picker-back:hover { background: var(--surface-2); }
.picker-back svg { width: 22px; height: 22px; }
/* A class display beats the UA's [hidden] rule (same trap as .picker-scroll
   [hidden] below): without this the Back button stays drawn at "All your
   spots" and taps do nothing. */
.picker-back[hidden] { display: none !important; }
.picker-crumb {
  /* `overflow: hidden` makes this the ONE column item flexbox may crush
     to nothing when the list is taller than the sheet — the level label
     was clipped to its top 4px. Never shrink it; ellipsize instead. */
  flex: none;
  margin: 0;
  padding: var(--s-2) var(--s-4) 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.picker-crumb[hidden] { display: none !important; }
/* Home screen + list scroll together inside one body, so the footer's
   "Move here" stays reachable however many rows there are. */
.picker-scroll {
  flex: 1;
  min-height: 40dvh;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.picker-list {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  align-content: start;
}
.picker-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  min-height: 52px;
  padding: var(--s-2) var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.picker-row:hover { background: var(--surface-2); }
.picker-row:active { background: var(--border); }
.picker-row-initial {
  flex: none;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--primary);
  font-weight: 700;
}
.picker-row-initial.is-person { border-radius: 35%; }
.picker-row-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.picker-row-chevron { flex: none; color: var(--muted); font-size: 1.3rem; }
.picker-empty { margin: auto; }
/* A class display beats the UA's [hidden] rule, so the empty shortcut box
   went on drawing its divider on every drilled-in level — a stray line
   under the crumb that looked like the list had a heading. */
.picker-scroll [hidden] { display: none !important; }
/* "New spot" / "New thing", right under the level's name — the picker is
   where you find out the place you wanted doesn't exist yet. Dashed, so
   they read as somewhere to make one rather than somewhere to go. */
.picker-add {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
}
.picker-add-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: var(--s-2) var(--s-3);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.picker-add-btn:hover { background: var(--surface-2); color: var(--ink); }
.picker-add-plus {
  font-size: 1.15rem;
  line-height: 1;
  color: var(--primary);
}
.picker-add-form { display: flex; gap: var(--s-2); width: 100%; }
.picker-add-input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 16px;   /* iOS zooms the page below 16px */
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.picker-add-go { flex: none; }
.picker-add-cancel {
  flex: none;
  width: 44px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.picker-add-error {
  width: 100%;
  margin: var(--s-2) 0 0;
  color: var(--danger);
  font-size: 0.9rem;
}
.picker-foot {
  flex: none;
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
}
/* `.btn` never wraps, so "Move into Crawlspace Next to Downstairs Kitchen"
   ran off both edges of the button (v2.17 — Back on home lands on exactly
   that kind of level). Let a long name wrap inside it instead; the button
   grows past its 48px and the name stays whole. */
.picker-foot .picker-here {
  width: 100%;
  min-height: 48px;
  white-space: normal;
  overflow-wrap: anywhere;
}
.picker-foot .picker-here:disabled { opacity: 0.45; cursor: default; }
/* The sheet's opening screen (v2.17, "three and three"): the level the
   thing is on — where it is now first, outlined, then its siblings, under
   the parent's name — a rule, then a few likely places. The level block
   scrolls inside itself at about three and a half rows (the half row is
   the scroll hint); Back in the header goes to the full explorer. It
   replaced v2.16's single holder row with a caret beside it, and before
   that the "Right above" shortcuts and the list of every top-level spot. */
.picker-home { display: flex; flex-direction: column; gap: var(--s-1); }
/* 52px is .picker-row's min-height — keep the two in step. `flex: none`
   on the rows, or the column would squash them to fit the cap instead of
   scrolling. */
.picker-level {
  display: flex;
  flex-direction: column;
  gap: var(--s-1);
  max-height: calc(3.5 * 52px + 3 * var(--s-1));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.picker-level .picker-row { flex: none; }
.picker-row.is-current { border-color: var(--primary); }
/* The path above a suggested row, under its name — one line, clipped,
   never wrapped. Run right-to-left so the ellipsis lands at the START:
   what gets cut is the far-off top of the tree, never the nearest parent
   (which was exactly the part "Indigo › Navigation Desk › Insid…" lost). The
   <bdi> inside isolates the names, so they still read left-to-right and a
   trailing ")" or digit doesn't jump to the other end. */
.picker-row-crumb {
  display: block;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: left;
}
/* Why a suggestion is there — "3 recent moves" / "41 things · 6 spots" —
   so a learned row can be told from a guess by size. */
.picker-row-hint { display: block; margin-top: 1px; }
.picker-nowhere { margin: 0; padding: var(--s-2) var(--s-3); }
/* A level that wouldn't load, on whichever screen is showing; the list
   is hidden on the home screen, so it can't carry the message. */
.picker-error { margin: 0; color: var(--danger); font-size: 0.9rem; }
.picker-rule { height: 1px; margin: var(--s-2) 0; background: var(--border); }
.picker-home-head {
  margin: 0 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
/* "All your spots": the way to everything else, said quietly. */
.picker-row.is-quiet {
  min-height: 44px;
  border-style: dashed;
  color: var(--muted);
}
/* The form enhancement drops Browse… right after the select. */
.picker-browse { margin-top: var(--s-2); }

.select-dest-filter {
  width: 100%;
  font: inherit;
  font-size: 16px;   /* iOS zooms the page below 16px */
  padding: 10px 12px;
  margin-bottom: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.select-dest-list { display: grid; gap: var(--s-1); }
.select-dest {
  display: grid;
  gap: 1px;
  width: 100%;
  min-height: 48px;
  padding: var(--s-2) var(--s-3);
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  color: var(--ink);
  touch-action: manipulation;
}
.select-dest:hover { background: var(--surface-2); }
.select-dest[disabled] { opacity: 0.5; }
.select-dest-name { font-weight: 600; }
.select-dest-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-3);
  margin-top: var(--s-4);
}
.select-warn {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius);
  background: var(--danger-surface);
  color: var(--danger);
  font-size: 0.9rem;
}

/* Read aloud, never drawn. */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* ---------- the lasso (v2.12) ---------- */

/* Drawn in viewport pixels ABOVE the board but outside its transform, so
   the stroke tracks the finger exactly at any zoom. Never a pointer target:
   the finger drawing it is already captured by the viewport. */
.map-lasso {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}
.map-lasso path {
  fill: color-mix(in srgb, var(--accent) 14%, transparent);
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 7 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
/* The canvas inside a thing normally lets a vertical drag scroll the page
   (`pan-y`, above) — but in select mode a drag on the canvas IS the lasso,
   and touch-action is decided at touchdown, far too late to set from the
   gesture. So it is decided when select mode opens instead. The page still
   scrolls by dragging anywhere outside the 3:4 box. */
body.is-selecting .thing-map-frame[data-map-embed] .thing-map-viewport {
  touch-action: none;
}

/* Undo and Redo travel together (v2.11). Redo is icon-only: a second
   full-width pill would crowd the Arrange row at 390px, and the mirrored
   arrow says everything the word would. */
.map-undo-pair {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.map-undo-pill.is-redo {
  position: relative;
  padding-inline: 8px;
  flex: 0 0 auto;
}
/* 44px to the finger without 44px of row (v2.52): a wider Redo would take
   10px from Undo's label, and at 320 "Undo moving a label" fits with 3px
   to spare. The reach is 5px either side — the row's 4px gap and the
   clear water before the ⋯ button. */
.map-undo-pill.is-redo::before {
  content: '';
  position: absolute;
  inset: 0 -5px;
}

/* ---------- Direction labels on a canvas (v2.23) ----------
   Bow, Stern, Top, Bottom: words on the same pan/zoom board as the pins —
   so they scale and travel with them — but a tag, not a disc. Outside
   Arrange they let every touch through (a pin under one stays tappable, a
   pan that starts on one still pans); in Arrange they are handles, with a
   44px hit area around a ~30px tag. */
.map-label {
  position: absolute;
  /* ONE on-screen size at every zoom, like a street name on a map: the
     position rides the board's camera, the size is counter-scaled by the
     same --cam-z the board scales by. A label in the clear draws exactly at
     its stored spot (v2.29); --edge-dx/dy (map.js, compassLabels) and
     --edge-rot pin one whose spot is off screen or under the chrome to the
     edge it lies past (turned along a side) — a visual offset only;
     left/top stay the stored world position. No transition:
     the camera writes per frame. Collision math never reads labels. */
  transform: translate(-50%, -50%) translate(var(--edge-dx, 0px), var(--edge-dy, 0px))
             scale(calc(1 / var(--cam-z, 1))) rotate(var(--edge-rot, 0deg));
  max-width: 220px;
  padding: 5px 12px 6px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in oklab, var(--primary) 55%, transparent);
  background: color-mix(in oklab, var(--surface) 86%, transparent);
  color: var(--primary);
  font-family: var(--font-display);
  font-weight: 600;
  /* ~15px text in a ~31px pill, on screen, at any zoom. */
  font-size: 0.95rem;
  line-height: 1.15;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.thing-map[data-editing="1"] .map-label {
  pointer-events: auto;
  cursor: grab;
  border-style: dashed;
  overflow: visible;
  /* As for a pin: or, on a thing's page — where the canvas hands vertical
     swipes back to the page (pan-y) — the browser scrolled instead of
     moving the label and cancelled the touch. */
  touch-action: none;
}
/* 30px pill + 9px either side = a 48px target on screen — across the
   tag whether it lies level or, pinned, turned along a side. */
.thing-map[data-editing="1"] .map-label::after {
  content: '';
  position: absolute;
  inset: -9px -9px;
}
/* The safety net: a pinned label that still meets a pin goes BEHIND the
   pins (the board is its own stacking context) and dims — a thing is never
   hidden by a label, under any camera. */
.map-label.is-under {
  z-index: -1;
  opacity: 0.55;
}
/* Pinned to an edge: a solid, lifted tag with a chevron toward where the
   label really is — "that way", like a compass mark. */
.map-label.is-edge {
  background: color-mix(in oklab, var(--surface) 95%, transparent);
  box-shadow: var(--shadow-sm);
}
.map-label.is-edge::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 7px 2px -1px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  vertical-align: middle;
  opacity: 0.85;
  transform: rotate(calc(var(--edge-angle, 0deg) + 45deg));
}
.map-label.is-dragging {
  cursor: grabbing;
  box-shadow: var(--shadow-md);
  background: var(--surface);
}

/* The add / edit sheet (labels.js). Rises from the bottom like the map's
   other sheets; --label-kb lifts it above the iOS keyboard. */
.label-sheet {
  position: fixed;
  z-index: 60;
  left: 0;
  right: 0;
  bottom: var(--label-kb, 0px);
  max-width: 560px;
  margin: 0 auto;
  padding: var(--s-4) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom, 0px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
}
/* .btn's display:inline-flex outranks the hidden attribute; the sheet
   hides Delete (adding) and the chips (editing) with it. */
.label-sheet [hidden] { display: none !important; }
.label-sheet-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.25rem;
  margin: 0 0 var(--s-3);
}
.label-sheet-row { display: flex; gap: var(--s-2); }
.label-sheet-row input[type="text"] {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  font-size: max(16px, 1rem);
}
.label-sheet-row .btn { min-height: 48px; padding: 0 18px; }
.label-chip-group {
  margin: var(--s-3) 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.label-chip-row { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.label-chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1.5px solid color-mix(in oklab, var(--primary) 45%, transparent);
  background: var(--surface-2);
  color: var(--primary);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  touch-action: manipulation;
}
.label-chip:active { background: var(--bubble); }
.label-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.label-sheet-error { margin: var(--s-2) 0 0; color: var(--danger); font-weight: 500; }
.label-sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-top: var(--s-3);
}
.label-sheet-actions .btn { min-height: 44px; }
.label-sheet-actions [data-label-delete] { margin-right: auto; }

/* ---------- One app (v2.26): every signed-in page in the map's language ----------
   Kiron: "switching between map and my things or the trips tab just looks
   so different." Every page that isn't the map now wears app_page.html: the
   map's floating ☰ + search bar, the map's pegboard ground, a back chip +
   title pill like the map's crumb chip, and content on cards. The rules:
   - Ground is the canvas's own: --surface-2 with the 26px peg dots. Content
     sits on --surface, exactly as the map's floating chrome does.
   - Floating things (the bar, the crumb, action pills) take --shadow-md;
     content cards take --shadow-sm and a hairline. Nothing heavier.
   - 8px grid; ≥44px targets; one list-row component (.app-list / .app-row)
     for every list — My Things, Trips, People, loans, Trash, Spend. */
.app-page {
  background-color: var(--surface-2);
  background-image: radial-gradient(circle, var(--peg-dot) 1px, transparent 1px);
  background-size: 26px 26px;
}
.app-page .site-main {
  max-width: none;
  margin: 0;
  padding: 0;
}
/* The map's bar, but in the page's flow: it sticks, and a fade from the
   ground lets the content slide under it cleanly. */
.app-page .map-topbar {
  position: sticky;
  top: 0;
  left: auto;
  right: auto;
  padding: max(var(--s-3), env(safe-area-inset-top)) max(var(--s-3), env(safe-area-inset-right))
           var(--s-5) max(var(--s-3), env(safe-area-inset-left));
  margin-bottom: calc(-1 * var(--s-3));
  background: linear-gradient(to bottom, var(--surface-2) 64%, color-mix(in srgb, var(--surface-2) 0%, transparent));
}
/* The menu's head: the wordmark. */
.map-menu-brand {
  display: block;
  padding: var(--s-2) 14px var(--s-3);
  margin: 0 0 var(--s-1);
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}

.app-shell {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  /* Room at the bottom for the voice button (60px at its inset, see
     .voice-fab) plus a gap, so scrolled to the end no row's count or
     action is ever under it. */
  --fab-room: calc(max(var(--s-5), env(safe-area-inset-bottom)) + 60px + var(--s-5));
  padding: var(--s-1) max(var(--s-4), env(safe-area-inset-right)) var(--fab-room)
           max(var(--s-4), env(safe-area-inset-left));
}
.app-shell.is-wide { max-width: 1080px; }
/* Nothing inside a page may widen it (v2.26 review): nav.js clamps every
   popover into the viewport on open, but a phone can lay out one frame at
   the unclamped spot first — enough to stretch the layout viewport for
   good. clip, not hidden: it is no scroll container, so the forms' sticky
   Save bar keeps sticking. */
.app-shell { overflow-x: clip; }

.app-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-bottom: var(--s-4);
}
/* The map's crumb chip, as a page's title: ‹ goes up a level, the name is
   the page's h1. */
.app-crumb {
  position: relative;          /* the ‹ link's ::after covers the whole pill */
  display: inline-flex;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  padding: 2px var(--s-5) 2px 2px;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}
.app-crumb-back {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink);
}
.app-crumb-back:hover { background: var(--surface-2); color: var(--primary); text-decoration: none; }
/* The WHOLE pill goes back (v2.35), not only the ‹: the link stretches over
   the title. The title stays the page's own h1, outside the link. */
.app-crumb-back::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 999px;
}
.app-crumb:has(.app-crumb-back:hover) .app-crumb-back { background: var(--surface-2); color: var(--primary); }
.app-crumb-back:focus-visible { outline: none; }
.app-crumb:has(.app-crumb-back:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.app-crumb-back svg { width: 20px; height: 20px; }
.app-crumb-title {
  min-width: 0;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  margin-left: auto;
}
.app-actions:empty { display: none; }
.app-actions .btn,
.app-actions .select-start {
  min-height: 44px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
}
.app-actions .btn.secondary,
.app-actions .btn.ghost,
.app-actions .select-start { background: var(--surface); border-color: transparent; color: var(--ink); }
.app-actions .btn.secondary:hover,
.app-actions .btn.ghost:hover { background: var(--surface-2); }
/* Destructive actions stay quiet until chosen: red words on a plain pill. */
.app-actions .btn.danger,
.app-actions .btn.ghost.danger-link { background: var(--surface); color: var(--danger); border-color: transparent; }
.app-actions .btn.danger:hover { background: var(--danger-surface); }
.app-actions form { margin: 0; }
.app-lede {
  max-width: 62ch;
  margin: 0 var(--s-1) var(--s-5);
  color: var(--muted);
}

/* Every target on an app page is a full-size one. */
.app-page .btn { min-height: 44px; }

/* A card: the content surface. */
.app-card {
  margin: 0 0 var(--s-4);
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.app-card > :last-child { margin-bottom: 0; }
.app-card > h2,
.app-card-title {
  margin: 0 0 var(--s-2);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
}
.app-card > p.muted { font-size: 0.95rem; }

/* A titled group of cards or rows. */
.app-section { margin: 0 0 var(--s-5); }
.app-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-3);
  margin: 0 var(--s-1) var(--s-2);
}
.app-section-head h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}
.app-section-head .muted { font-size: 0.875rem; }
.app-section-head .btn { padding: 6px 14px; font-size: 0.9rem; border-radius: 999px; }

/* The one list row. A card of rows separated by hairlines; each row is a
   lead (thumb / initial / icon), the text (title over meta), and a trail
   (a value, a chevron, or one action). A whole-row link is .app-row-link. */
.app-list {
  list-style: none;
  margin: 0 0 var(--s-4);
  padding: 0;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.app-row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 64px;
  padding-right: var(--s-4);
}
.app-row + .app-row { border-top: 1px solid var(--border); }
.app-row-link,
.app-row-body {
  flex: 1 1 auto;
  min-width: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) 0 var(--s-2) var(--s-4);
  color: var(--ink);
}
.app-row-link:hover { text-decoration: none; }
.app-row:has(> .app-row-link:hover) { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.app-row-link:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.app-row-lead {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
}
.app-row-lead.is-round { border-radius: 50%; }
.app-row-lead img { width: 100%; height: 100%; object-fit: cover; }
.app-row-lead svg,
.app-row-lead .loc-icon { width: 22px; height: 22px; }
.app-row-text {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.app-row-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.app-row-meta {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.35;
}
.app-row-value {
  flex: none;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.app-row-chev {
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.app-row form { margin: 0; flex: none; }
.app-row .btn { flex: none; border-radius: 999px; }
.app-row.is-empty {
  justify-content: center;
  padding: var(--s-5) var(--s-4);
  color: var(--muted);
}
.app-row.is-alert .app-row-meta strong { color: var(--danger); }

/* A fold: one section of a long page (My Things' spots), closed until
   tapped — a card whose head is a row and whose body is more rows. */
.app-fold {
  margin: 0 0 var(--s-3);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.app-fold-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 64px;
  padding: var(--s-2) var(--s-4);
  cursor: pointer;
  list-style: none;
}
.app-fold-head::-webkit-details-marker { display: none; }
.app-fold-head:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.app-fold-head:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.app-fold-chev {
  flex: none;
  width: 20px;
  height: 20px;
  color: var(--muted);
  transition: transform 160ms ease;
}
.app-fold[open] > .app-fold-head .app-fold-chev { transform: rotate(180deg); }
.app-fold-body { border-top: 1px solid var(--border); }
.app-rows { list-style: none; margin: 0; padding: 0; }
.app-rows + .app-rows { border-top: 1px solid var(--border); }
.app-row.is-spot > .app-row-link { padding-left: calc(var(--s-4) + var(--depth, 0) * 20px); }
.app-row.is-spot .app-row-lead { background: transparent; color: var(--primary); }
.app-fold-cards { padding: var(--s-3); }
.app-fold-empty { margin: 0; padding: var(--s-3) var(--s-4); font-size: 0.9rem; }

/* My Things' one filter card. */
.filter-bar.app-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2) var(--s-3);
}
.my-things-query { margin-top: calc(-1 * var(--s-2)); }
.filter-bar.app-card select { flex: 1 1 160px; min-height: 44px; font-size: 16px; }
.filter-bar.app-card .check { min-height: 44px; display: inline-flex; align-items: center; gap: var(--s-2); }
.filter-bar-end { display: flex; gap: var(--s-2); margin-left: auto; }
.filter-bar-end .view-toggle { display: flex; gap: 0; }
.filter-bar-end .view-toggle .btn:first-child { border-radius: 999px 0 0 999px; }
.filter-bar-end .view-toggle .btn:last-child { border-radius: 0 999px 999px 0; }
.filter-bar-end > .btn { border-radius: 999px; }

@media (prefers-reduced-motion: reduce) {
  .app-fold-chev { transition: none; }
}

.spend-row .spend-bar { margin: 4px 0 2px; }
.app-footnote { margin: 0 var(--s-1); }

/* Full-size targets for the controls the app pages share. */
.app-page .big-form input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.app-page .big-form select,
.app-page select,
.app-page .icon-option { min-height: 44px; }
.app-page .icon-option { min-width: 44px; }
.app-lede .map-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 0 2px; margin: 0; }
.app-lede .map-crumbs a,
.app-lede .map-crumbs [aria-current] { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
.app-lede .map-crumbs a:first-child { padding-left: 0; }
.app-section-head .btn { min-height: 44px; }
.tag-card h3 a { display: inline-flex; align-items: center; min-height: 44px; }
.filter-bar-end > .btn,
.filter-bar-end .view-toggle .btn { min-height: 44px; padding-top: 0; padding-bottom: 0; }
.filter-bar-end { align-items: center; }

@media (max-width: 419px) { .site-nav .nav-about { display: none; } }

/* The forms' one action row inside an app card: it bleeds to the card's own
   edges (the card is --s-4 in, not --s-6) and pins just under the floating
   ☰ + search bar, not under the status bar — that bar now sticks too. */
.app-page .big-form.app-card { padding: var(--s-4); }
.app-page .form-actions-top {
  top: calc(max(var(--s-3), env(safe-area-inset-top)) + 60px);
  margin: calc(-1 * var(--s-4)) calc(-1 * var(--s-4)) var(--s-4);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.app-page .big-form input,
.app-page .big-form textarea,
.app-page .big-form select { scroll-margin-top: calc(190px + env(safe-area-inset-top, 0px)); }
.app-page .big-form .field,
.app-page .big-form .form-error { scroll-margin-top: calc(150px + env(safe-area-inset-top, 0px)); }

/* On a phone the action pills take their own line under the title and
   wrap — nothing in an action row may hide behind a sideways scroll (the
   primary action comes first in the markup, so it is never the one that
   wraps out of sight). */
@media (max-width: 719px) {
  .app-actions {
    flex: 1 1 100%;
    margin-left: 0;
  }
}

@media (min-width: 720px) {
  .app-shell { padding-top: var(--s-2); }
  .app-crumb-title { font-size: 1.4rem; }
}

/* ---------- Auth pages (v2.21) ----------
   (Kept at the end of the file: it restyles .map-pin, and the map's own
   rules for it must stay the first ones a reader — or a test — finds.)
   Login, signup and the password pages are a small piece of the map: its
   pegboard, a few pins (the real .map-pin markup, resized), and the form on
   a sheet. Phone first: brand, pins, then the sheet rising from the bottom,
   all in normal flow so iOS can scroll a field above the keyboard. From
   760px the sheet floats in the middle and the pins sit around it. The
   site header, footer and assistant are not rendered here at all
   (auth_base.html empties their blocks). */
.auth-page { background: var(--surface-2); }
.auth-page .site-main {
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.auth-page .messages {
  position: fixed;
  z-index: 5;
  top: calc(env(safe-area-inset-top, 0px) + var(--s-3));
  left: var(--s-4);
  right: var(--s-4);
  margin: 0;
}

.auth-shell {
  --knob: var(--surface);
  position: relative;
  flex: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--surface-2);
  background-image: radial-gradient(circle, var(--peg-dot) 1px, transparent 1px);
  background-size: 26px 26px;
  background-position: 13px 13px;
}
html[data-theme="dark"] .auth-shell { --knob: var(--ink); }

.auth-brand {
  position: relative;
  z-index: 1;
  padding: calc(env(safe-area-inset-top, 0px) + var(--s-6))
           calc(env(safe-area-inset-right, 0px) + var(--s-5))
           0
           calc(env(safe-area-inset-left, 0px) + var(--s-5));
}
.auth-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.5rem;
  line-height: 1;
  /* No negative tracking: it fused the d's serif into the I ("Findlt"). */
  letter-spacing: 0.01em;
  font-variation-settings: 'opsz' 144;
}
.auth-mark { width: 44px; height: 44px; flex: none; overflow: visible; }
.auth-mark-box { fill: var(--primary); }
.auth-mark-lid { fill: var(--primary-hover); }
.auth-mark-lens { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.auth-pitch {
  margin: var(--s-2) 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.4;
  max-width: 30ch;
}

/* The pins: positions are fractions of their box (--x/--y on a phone,
   --wx/--wy wide), the way map_x/map_y are. Decoration, so no pointer. */
.auth-pins {
  position: relative;
  flex: 1 0 150px;
  min-height: 150px;
  pointer-events: none;
}
.auth-pins .map-pin { left: var(--x); top: var(--y); width: 84px; }
.auth-pins .map-pin.is-wide { display: none; }
.auth-pins .map-pin-disc { width: 56px; height: 56px; }
.auth-pins .map-pin-icon { width: 28px; height: 28px; }
.auth-pins .map-pin-label { font-size: 0.7rem; }
/* The one that was found: accent ring, and a ping twice as the page opens
   — the only motion on the page, and none for reduced motion. */
.auth-pins .is-found .map-pin-disc {
  overflow: visible;
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--accent) 22%, transparent), var(--shadow-md);
}
.auth-pins .is-found .map-pin-disc::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: 0;
  animation: auth-ping 1.6s cubic-bezier(0.2, 0.7, 0.3, 1) 0.5s 2 both;
}
@keyframes auth-ping {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.9); opacity: 0; }
}

.auth-sheet {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  /* Narrow stays 24px a side; a wide phone-layout screen (iPad mini) keeps
     the form to 440px down the middle instead of stretching the fields. */
  padding: var(--s-6)
           calc(env(safe-area-inset-right, 0px) + max(var(--s-5), (100vw - 440px) / 2))
           calc(env(safe-area-inset-bottom, 0px) + var(--s-5))
           calc(env(safe-area-inset-left, 0px) + max(var(--s-5), (100vw - 440px) / 2));
}
.auth-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.6rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 var(--s-4);
}
.auth-lede { margin: calc(-1 * var(--s-2)) 0 var(--s-4); color: var(--muted); }

.auth-form { display: flex; flex-direction: column; gap: var(--s-4); }
.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-field label { font-weight: 600; font-size: 0.92rem; }
/* 16px or iOS zooms in on focus; 52px tall for a thumb. */
.auth-field input[type="text"],
.auth-field input[type="email"],
.auth-field input[type="password"] {
  min-height: 52px;
  padding: 12px 14px;
  font-size: max(16px, 1rem);
  border-radius: var(--radius);
  background: var(--bg);
  scroll-margin-block: 96px;
}
.auth-field.has-error input { border-color: var(--danger); }
.auth-secret { position: relative; }
.auth-secret input[type="password"],
.auth-secret input[type="text"] { padding-right: 56px; }
.auth-reveal {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
}
.auth-reveal:hover { color: var(--ink); }
.auth-reveal:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.auth-reveal[aria-pressed="true"] { color: var(--primary); }
.auth-eye { width: 22px; height: 22px; }
.auth-eye-slash { display: none; }
.auth-reveal[aria-pressed="true"] .auth-eye-slash { display: inline; }

.auth-help { margin: 0; color: var(--muted); font-size: 0.85rem; }
.auth-rules {
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}
.auth-rules li { position: relative; padding-left: 14px; }
.auth-rules li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.6em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.6;
}
.auth-sheet .form-error p, .auth-field-error p { margin: 0; }
.auth-field-error { color: var(--danger); font-size: 0.88rem; font-weight: 500; }
/* The app's own error banner (.form-error), sized for the sheet. */
.auth-sheet .form-error {
  margin: 0;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--radius);
  border: 1px solid color-mix(in oklab, var(--danger) 35%, transparent);
  background: var(--danger-surface);
  font-weight: 500;
}

/* "Remember me": the whole row is the label, 48px tall, the box a switch. */
.auth-remember {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: 48px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.auth-remember input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--border);
  cursor: pointer;
  transition: background-color 0.18s ease;
}
.auth-remember input[type="checkbox"]::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--knob);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease;
}
.auth-remember input[type="checkbox"]:checked { background: var(--primary); }
.auth-remember input[type="checkbox"]:checked::after { transform: translateX(20px); }
.auth-remember input[type="checkbox"]:focus { outline: none; }
.auth-remember input[type="checkbox"]:focus-visible {
  outline: 3px solid color-mix(in oklab, var(--primary) 40%, transparent);
  outline-offset: 2px;
}
.auth-remember-text { display: flex; flex-direction: column; line-height: 1.25; }
.auth-remember-text > span:first-child { font-weight: 600; }
.auth-remember-hint { color: var(--muted); font-size: 0.82rem; }

.auth-submit {
  min-height: 52px;
  margin-top: var(--s-1);
  border-radius: var(--radius);
  font-size: 1.05rem;
  font-weight: 600;
  touch-action: manipulation;
}
.auth-submit:disabled { opacity: 0.8; cursor: progress; }
.auth-form[aria-busy="true"] .auth-submit::before {
  content: '';
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: auth-spin 0.8s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-actions { display: grid; gap: var(--s-3); }
.auth-actions .btn { min-height: 52px; border-radius: var(--radius); }
.auth-alt { margin: var(--s-4) 0 0; text-align: center; color: var(--muted); }
/* v2.65: "By creating an account you agree to…" under the button. */
.auth-legal { margin: var(--s-3) 0 0; font-size: 0.85rem; text-align: center; color: var(--muted); }
.auth-legal a { color: var(--primary); text-underline-offset: 3px; }

/* v2.66: Continue with Apple · Continue with Google. Each in its maker's
   own style: Apple's black (white on the dark theme), Google's white with a
   grey edge (its dark variant on the dark theme), the logo then the words,
   centred. One size for both — Apple's no less prominent — and 52px tall,
   like the button under them. */
.social-signin { display: grid; gap: var(--s-3); }
.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.social-btn:hover { text-decoration: none; }
.social-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.social-btn:disabled { opacity: 0.6; cursor: progress; }
.social-logo { width: 20px; height: 20px; flex: none; }
.social-apple {
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
}
.social-apple .social-logo { margin-top: -3px; }      /* the leaf sits high in its box */
html[data-theme="dark"] .social-apple { background: #fff; color: #000; }
.social-google {
  background: #fff;
  color: #1f1f1f;
  border-color: #747775;
  font-family: Roboto, system-ui, -apple-system, sans-serif;
  font-weight: 500;
}
html[data-theme="dark"] .social-google { background: #131314; color: #e3e3e3; border-color: #8e918f; }
.social-error:not([hidden]) { margin: 0; }
.auth-or {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: var(--s-4) 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.auth-or::before, .auth-or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.account-signin .social-signin { margin-top: var(--s-3); }

/* v2.74 (R49): the welcome screen, after the sign-in screen Kiron sent. The
   mark and name in the upper half on the app's own background; at the
   bottom, the ways in as pills of one height and width — Google outlined
   (this device's last account under it, with a ›), OR, Apple filled (never
   less prominent than Google: App Review 4.8), Log in or sign up — and the
   Terms line. Each maker's colours come from .social-google / .social-apple
   above, light and dark. */
.welcome {
  flex: 1;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0px) + var(--s-5))
           calc(env(safe-area-inset-right, 0px) + 16px)
           calc(env(safe-area-inset-bottom, 0px) + var(--s-4))
           calc(env(safe-area-inset-left, 0px) + 16px);
}
.welcome-page { background: var(--bg); }
.welcome-brand {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  text-align: center;
  padding-bottom: var(--s-5);
}
.welcome-mark { width: 76px; height: 76px; }
.welcome-name {
  margin: var(--s-2) 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.4rem;
  line-height: 1;
  letter-spacing: 0.01em;
  font-variation-settings: 'opsz' 144;
}
.welcome-pitch { margin: 0; max-width: 18rem; color: var(--muted); }
.welcome-actions { display: grid; gap: 12px; }
.welcome-btn {
  min-height: 54px;
  border-radius: 999px;
  font-size: 1.05rem;
}
.welcome-btn .welcome-btn-text { display: grid; justify-items: center; line-height: 1.2; }
.welcome-btn.has-hint {
  display: grid;
  grid-template-columns: 24px 1fr 24px;
  min-height: 62px;
  padding: 6px 18px;
}
.welcome-hint {
  font-size: 0.85rem;
  font-weight: 400;
  opacity: 0.75;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.welcome-chevron { font-size: 1.5rem; line-height: 1; opacity: 0.7; justify-self: end; }
.welcome-form {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #747775;       /* Google's neutral outline, so the two outlined pills match */
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  touch-action: manipulation;
}
html[data-theme="dark"] .welcome-form { border-color: #8e918f; }
.welcome-form:hover { text-decoration: none; }
.welcome-form:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.welcome-or {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin: 2px 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.welcome-or::before, .welcome-or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.welcome-forget { margin: 0; text-align: center; }
.welcome-link {
  min-height: 44px;
  padding: 0 var(--s-3);
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.welcome-legal { margin: var(--s-2) 0 0; font-size: 0.8rem; text-align: center; color: var(--muted); }
.welcome-legal a { color: var(--ink); text-underline-offset: 3px; }
.auth-back { margin: 0 0 var(--s-3); }
.auth-back a { display: inline-block; padding: 10px 0; }
.signin-row { padding: var(--s-3) var(--s-4); }      /* like Sharing's rows */
.signin-row .app-row-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.signin-row-action { flex: none; }
.signin-row-action.btn, .signin-row-action .btn { min-height: 44px; }
.auth-alt a {
  display: inline-block;
  padding: 10px 4px;
  color: var(--primary);
  font-weight: 600;
  text-underline-offset: 3px;
}
/* A way out that is a POST (v2.80: leaving a sign-up revokes its token),
   worn like the links beside it. */
.auth-alt form { display: inline; }
.auth-alt button {
  display: inline-block;
  min-height: 44px;
  padding: 10px 4px;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
/* Present for Keychain (whose password is this?), invisible to everyone.
   Typed selector, or the global input[type="text"] width:100% wins and the
   page scrolls sideways. */
input[type="text"].auth-hidden-username {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  overflow: hidden;
  clip-path: inset(50%);
  pointer-events: none;
}

@media (min-width: 760px) {
  .auth-shell {
    display: grid;
    grid-template-columns: 1fr minmax(0, 420px) 1fr;
    grid-template-rows: 1fr auto auto 1.2fr;
    padding: calc(env(safe-area-inset-top, 0px) + var(--s-6)) var(--s-5)
             calc(env(safe-area-inset-bottom, 0px) + var(--s-6));
  }
  .auth-brand { grid-column: 2; grid-row: 2; padding: 0 0 var(--s-5); }
  .auth-wordmark { font-size: 3rem; }
  .auth-mark { width: 52px; height: 52px; }
  .auth-sheet {
    grid-column: 2;
    grid-row: 3;
    padding: var(--s-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
  }
  .auth-pins { position: absolute; inset: 0; min-height: 0; z-index: 0; }
  .auth-pins .map-pin { left: var(--wx); top: var(--wy); width: 96px; }
  .auth-pins .map-pin.is-wide { display: flex; }
  .auth-pins .map-pin-disc { width: 76px; height: 76px; }
  .auth-pins .map-pin-icon { width: 40px; height: 40px; }
  .auth-pins .map-pin-label { font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-pins .is-found .map-pin-disc::after { animation: none; }
  .auth-remember input[type="checkbox"],
  .auth-remember input[type="checkbox"]::after { transition: none; }
  .auth-form[aria-busy="true"] .auth-submit::before {
    animation: none;
    border-right-color: currentColor;
    opacity: 0.5;
  }
}

/* ---------- A thing's photo: its own shape, a crop, two buttons (v2.35) ---------- */

/* Any cropped photo (photo_tags.photo_crop): the frame around it clips, the
   image is placed so the crop region covers the frame. The inline style
   carries the numbers; these frames needed an anchor. */
img[data-crop] {
  position: absolute;
  inset: auto;
  max-width: none;
  max-height: none;
  object-fit: fill;
  border-radius: 0;
}
.app-row-lead, .item-row-thumb, .map-search-thumb { position: relative; }

/* The thing page: the photo at its own shape, up to 60vh — never cover-
   cropped to 4:3, which cut every portrait. The box keeps its card look and
   letterboxes a tall photo; only the placeholder keeps the 4:3 box. */
.detail-photo { position: relative; overflow: visible; }
.detail-photo.has-photo { aspect-ratio: auto; }
.detail-photo-frame {
  position: relative;
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: calc(var(--radius) - 1px);
}
.detail-photo-frame > img:not([data-crop]) {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  max-height: 60svh;
  object-fit: contain;
}
.detail-photo-frame.is-cropped {
  aspect-ratio: var(--crop-shape);
  width: min(100%, calc(60vh * var(--crop-shape)));
  width: min(100%, calc(60svh * var(--crop-shape)));
}
.detail-photo-tools {
  position: absolute;
  right: var(--s-2);
  bottom: var(--s-2);
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.photo-tool {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  cursor: pointer;
}
.photo-tool:hover { color: var(--primary); }
.photo-tool:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-tool svg { width: 20px; height: 20px; }
.photo-add { position: relative; }
.photo-add-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: max-content;
  max-width: min(300px, calc(100vw - 32px));
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.photo-add-opt {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 var(--s-4);
  border-radius: calc(var(--radius) - 4px);
  overflow: hidden;
  font-weight: 600;
  cursor: pointer;
}
.photo-add-opt:hover, .photo-add-opt:focus-within { background: var(--surface-2); }
/* The input covers its row, so the tap that opens the camera or the
   chooser lands on the real control (the edit form's pick button does the
   same) — reliable on iOS, where a scripted click can be refused. */
.photo-add-opt input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.photo-tools-status {
  order: -1;
  margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow-md);
  font-size: 0.875rem;
}
.photo-tools-status:empty { display: none; }
.detail-photo.is-busy .detail-photo-frame { opacity: 0.6; }

/* Several photos (v2.42): the main photo, then a row of thumbnails, main
   first; a tap opens the viewer. Each thumb is a 56px square target. */
.detail-photos { min-width: 0; }
.detail-photo-frame[data-photo-view] { cursor: zoom-in; }
.detail-photo-frame[data-photo-view]:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-strip {
  display: flex;
  gap: var(--s-2);
  margin: var(--s-2) 0 0;
  padding: 2px 2px var(--s-1);
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.photo-strip::-webkit-scrollbar { display: none; }
.photo-strip li { flex: none; }
.photo-thumb {
  position: relative;
  display: block;
  width: 56px;
  height: 56px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.photo-thumb img:not([data-crop]) { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo-thumb.is-main { border: 2px solid var(--primary); }
.photo-thumb:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.photo-add-opt.is-append { border-top: 1px solid var(--border); margin-top: 2px; }
.photo-add-room { display: block; font-weight: 400; color: var(--muted); font-size: 0.8rem; }

/* The viewer: full screen, the photos side by side in a scroll-snap track.
   The track pans sideways only (touch-action: pan-x) and never hands a
   scroll to the page (overscroll-behavior: contain); html.viewer-open
   holds the page still behind it. */
html.viewer-open, html.viewer-open body { overflow: hidden; }
.photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #0b0e0f;
  color: #fff;
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.pv-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
  min-height: 56px;
  padding: 6px var(--s-2);
}
.pv-count { font-weight: 600; font-variant-numeric: tabular-nums; }
.pv-spacer { width: 44px; }
.pv-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
}
.pv-btn svg { width: 22px; height: 22px; }
.pv-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.pv-btn:disabled { opacity: 0.3; cursor: default; }
.pv-track {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior: contain;
  touch-action: pan-x;
  scrollbar-width: none;
}
.pv-track::-webkit-scrollbar { display: none; }
.pv-track:focus-visible { outline: none; }
.pv-slide {
  position: relative;
  flex: 0 0 100%;
  margin: 0;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}
/* The image box fills the slide and the photo is contained in it: a
   percentage max-height inside a grid resolved against a row sized by the
   photo itself, and a tall photo ran off a laptop screen. */
.pv-slide img {
  position: absolute;
  inset: var(--s-2);
  width: calc(100% - 2 * var(--s-2));
  height: calc(100% - 2 * var(--s-2));
  object-fit: contain;
  pointer-events: none;
}
.pv-badge {
  position: absolute;
  left: 50%;
  bottom: var(--s-3);
  transform: translateX(-50%);
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  font-size: 0.85rem;
  font-weight: 600;
}
/* The side arrows are for a mouse; a finger swipes. */
.pv-step { position: absolute; top: 50%; transform: translateY(-50%); }
.pv-prev { left: max(var(--s-2), env(safe-area-inset-left)); }
.pv-next { right: max(var(--s-2), env(safe-area-inset-right)); }
@media (hover: none), (pointer: coarse) { .pv-step { display: none; } }
.pv-menu {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 56px);
  right: max(var(--s-2), env(safe-area-inset-right));
  z-index: 2;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 4px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.pv-menu[hidden] { display: none; }
.pv-menu-item {
  min-height: 48px;
  padding: 0 var(--s-4);
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.pv-menu-item[hidden] { display: none; }
.pv-menu-item:hover, .pv-menu-item:focus-visible { background: var(--surface-2); outline: none; }
.pv-menu-item:disabled { opacity: 0.4; cursor: default; }
.pv-menu-item.is-danger { color: var(--danger); }
.pv-status {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + var(--s-6));
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  font-size: 0.9rem;
}
.pv-status:empty { display: none; }

/* The crop editor: a full-screen sheet with the whole photo and a box.
   Nothing in it scrolls or zooms the page (touch-action: none). */
html.crop-open, html.crop-open body { overflow: hidden; }
.crop-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: #0b0e0f;
  color: #fff;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.crop-bar, .crop-tools {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px var(--s-2);
}
.crop-bar { justify-content: space-between; min-height: 56px; }
.crop-tools { justify-content: center; padding-bottom: var(--s-3); }
.crop-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.crop-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 0 var(--s-4);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.crop-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.crop-btn.is-done { background: var(--primary); color: var(--on-primary); }
.crop-btn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.2); }
.crop-btn:disabled { opacity: 0.5; }
.crop-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.crop-img {
  position: absolute;
  display: block;
  max-width: none;
  pointer-events: none;
}
.crop-box {
  position: absolute;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.6);
  outline: 1px solid rgba(255, 255, 255, 0.9);
  cursor: move;
  /* Thirds, as a camera shows them. */
  background:
    linear-gradient(90deg, transparent calc(33.33% - 0.5px), rgba(255,255,255,0.35) calc(33.33% - 0.5px),
                    rgba(255,255,255,0.35) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px),
                    transparent calc(66.67% - 0.5px), rgba(255,255,255,0.35) calc(66.67% - 0.5px),
                    rgba(255,255,255,0.35) calc(66.67% + 0.5px), transparent calc(66.67% + 0.5px)),
    linear-gradient(180deg, transparent calc(33.33% - 0.5px), rgba(255,255,255,0.35) calc(33.33% - 0.5px),
                    rgba(255,255,255,0.35) calc(33.33% + 0.5px), transparent calc(33.33% + 0.5px),
                    transparent calc(66.67% - 0.5px), rgba(255,255,255,0.35) calc(66.67% - 0.5px),
                    rgba(255,255,255,0.35) calc(66.67% + 0.5px), transparent calc(66.67% + 0.5px));
}
/* Every handle is a 44px touch square centred on its corner or edge; what
   you see is a white bracket or bar inside it. Corners sit above edges. */
.crop-handle { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; }
.crop-handle::before { content: ''; position: absolute; }
.crop-handle[data-edge="nw"] { left: 0; top: 0; cursor: nwse-resize; }
.crop-handle[data-edge="ne"] { left: 100%; top: 0; cursor: nesw-resize; }
.crop-handle[data-edge="sw"] { left: 0; top: 100%; cursor: nesw-resize; }
.crop-handle[data-edge="se"] { left: 100%; top: 100%; cursor: nwse-resize; }
.crop-handle[data-edge="n"] { left: 50%; top: 0; cursor: ns-resize; }
.crop-handle[data-edge="s"] { left: 50%; top: 100%; cursor: ns-resize; }
.crop-handle[data-edge="w"] { left: 0; top: 50%; cursor: ew-resize; }
.crop-handle[data-edge="e"] { left: 100%; top: 50%; cursor: ew-resize; }
.crop-handle[data-edge="nw"], .crop-handle[data-edge="ne"],
.crop-handle[data-edge="sw"], .crop-handle[data-edge="se"] { z-index: 2; }
.crop-handle[data-edge="nw"]::before { left: 19px; top: 19px; width: 20px; height: 20px; border-left: 3px solid #fff; border-top: 3px solid #fff; }
.crop-handle[data-edge="ne"]::before { left: 5px; top: 19px; width: 20px; height: 20px; border-right: 3px solid #fff; border-top: 3px solid #fff; }
.crop-handle[data-edge="sw"]::before { left: 19px; top: 5px; width: 20px; height: 20px; border-left: 3px solid #fff; border-bottom: 3px solid #fff; }
.crop-handle[data-edge="se"]::before { left: 5px; top: 5px; width: 20px; height: 20px; border-right: 3px solid #fff; border-bottom: 3px solid #fff; }
.crop-handle[data-edge="n"]::before, .crop-handle[data-edge="s"]::before { left: 10px; top: 20px; width: 24px; height: 4px; border-radius: 2px; background: #fff; }
.crop-handle[data-edge="w"]::before, .crop-handle[data-edge="e"]::before { left: 20px; top: 10px; width: 4px; height: 24px; border-radius: 2px; background: #fff; }

/* ---------- You, in the corner (v2.48) ---------- */

/* The You dock: a pill in the bottom-right corner of your own canvases that
   lifts into a panel — your avatar, where you are, what is on you. dock.js
   sets --dock-right / --dock-bottom (above the chat / call sheet, the voice
   button or the Things tab, beside the zoom) and --dock-room (how tall the
   panel may grow). Under the chat sheet (50), over the map's chrome (20). */
.you-dock {
  position: fixed;
  right: var(--dock-right, calc(max(var(--s-3), env(safe-area-inset-right)) + 52px));
  bottom: var(--dock-bottom, calc(max(var(--s-5), env(safe-area-inset-bottom)) + 68px));
  z-index: 45;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
/* No room above a tall sheet: it steps aside (measured as nothing). */
.you-dock.is-squeezed { display: none; }
.you-dock.is-dragging-out { pointer-events: none; }
.you-dock.is-dragging-out .you-dock-panel { opacity: 0.3; }
.you-dock-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-md);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.you-dock-pill-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary);
  flex: none;
}
.you-dock-pill-svg { width: 18px; height: 18px; }
/* Your face (v2.50): the same 30px circle, so the pill never changes size. */
.you-dock-pill-icon.has-face, .you-dock-avatar.has-face, .account-avatar-face.has-face { overflow: hidden; padding: 0; }
.you-dock-pill-icon img, .you-dock-avatar img, .account-avatar-face img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.you-dock-caret { width: 16px; height: 16px; color: var(--muted); transition: transform 160ms ease; }
.you-dock.is-open .you-dock-caret { transform: rotate(180deg); }
.you-dock-pill:focus-visible, .you-dock button:focus-visible, .you-dock-menu-row:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}
/* A pin held over the dock in Move: it opens for it. */
.you-dock.is-drop-open .you-dock-pill {
  transform: scale(1.08);
  box-shadow: 0 0 0 3px var(--accent), var(--shadow-lg);
}
.you-dock.is-gulp .you-dock-pill { animation: you-dock-gulp 360ms ease; }
.you-dock.is-nudged .you-dock-pill { animation: you-dock-nudge 360ms ease; }
@keyframes you-dock-gulp { 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
@keyframes you-dock-nudge {
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(3px); }
}

/* The panel lifts out of the corner, above the pill — against the window's
   right edge (over the zoom: it is an overlay you opened), not the pill's,
   which stands beside the zoom and would push a 330px panel off a phone. */
.you-dock-panel {
  position: fixed;
  right: max(var(--s-3), env(safe-area-inset-right));
  bottom: calc(var(--dock-bottom, 120px) + var(--dock-pill-h, 44px) + var(--s-2));
  width: min(330px, calc(100vw - 2 * var(--s-3)));
  max-height: max(200px, var(--dock-room, 60vh));
  display: flex;
  flex-direction: column;
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  transform-origin: bottom right;
  animation: you-dock-open 220ms cubic-bezier(0.22, 0.9, 0.32, 1);
}
.you-dock-panel[hidden] { display: none; }
@keyframes you-dock-open { from { opacity: 0; transform: translateY(12px) scale(0.92); } }
.you-dock-head { display: flex; align-items: center; gap: var(--s-2); }
.you-dock-avatar {
  width: 56px;
  height: 56px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary);
}
.you-dock-avatar-svg { width: 32px; height: 32px; }
/* It is a button now (v2.50): a tap changes it. */
button.you-dock-avatar { font: inherit; cursor: pointer; padding: 0; touch-action: manipulation; }
button.you-dock-avatar:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- your avatar: the sheet and the circle (v2.50) ---------- */
html.avatar-open, html.avatar-open body { overflow: hidden; }
.avatar-sheet { position: fixed; inset: 0; z-index: 75; display: flex; align-items: flex-end; justify-content: center; }
.avatar-sheet-backdrop { position: absolute; inset: 0; background: var(--scrim, rgba(0, 0, 0, 0.45)); }
.avatar-sheet-card {
  position: relative;
  width: min(420px, 100%);
  max-height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4) var(--s-4) max(var(--s-4), env(safe-area-inset-bottom));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.avatar-sheet-card.is-crop { align-items: center; }
.avatar-sheet-title { margin: 0; font-size: 1.125rem; }
.avatar-sheet-title:focus { outline: none; }
.avatar-sheet-sub { margin: 0; }
.avatar-pick, .avatar-remove, .avatar-cancel { min-height: 48px; }
.avatar-pick { position: relative; overflow: hidden; cursor: pointer; }
/* The whole button is the file input's target. */
.avatar-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.avatar-sheet-msg { margin: 0; color: var(--danger); font-weight: 600; }
.avatar-sheet-msg[hidden] { display: none; }
.avatar-stage {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-2);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.avatar-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.avatar-stage-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
/* The circle that is kept; the rest dimmed. */
.avatar-stage-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 999px color-mix(in srgb, #000 55%, transparent);
  outline: 2px solid #fff;
  outline-offset: -2px;
  pointer-events: none;
}
.avatar-zoom {
  width: min(300px, 100%);
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  accent-color: var(--primary);
}
.avatar-zoom:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.avatar-actions { display: flex; gap: var(--s-2); width: 100%; justify-content: flex-end; }
.avatar-actions .btn { min-height: 48px; min-width: 96px; }
/* Account's card and the thing page's "On you" line. */
.account-avatar-row { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-3); }
.account-avatar-row p { margin: 0; }
.account-avatar-face {
  width: 72px;
  height: 72px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 3px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 16%, var(--surface));
  color: var(--primary);
}
.account-avatar-svg { width: 40px; height: 40px; }
.on-you-face { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid var(--primary); }
.you-dock-where { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.you-dock-title {
  margin: 0;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.you-dock-path {
  margin: 0;
  max-width: 100%;
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  direction: rtl;
  text-align: left;
}
.you-dock-here, .you-dock-ask, .you-dock-all {
  min-height: 44px;
  padding: 6px 14px;
  border-radius: 999px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
}
.you-dock-here { min-height: 36px; padding: 4px 12px; border: 1px solid var(--primary); background: transparent; color: var(--primary); }
/* 36px drawn, 44px to the finger. */
.you-dock-here { position: relative; }
.you-dock-here::after { content: ''; position: absolute; inset: -4px -2px; }
.you-dock-close {
  width: 44px;
  height: 44px;
  flex: none;
  align-self: flex-start;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.you-dock-close svg { width: 22px; height: 22px; }
.you-dock-slots {
  list-style: none;
  margin: var(--s-2) 0 0;
  padding: 0;
  overflow-y: auto;
  min-height: 0;
  flex: 1 1 auto;
  /* dock.js drags a slot out, and scrolls a long list itself. */
  touch-action: none;
}
.you-dock-slot { position: relative; }
.you-dock-slot + .you-dock-slot { border-top: 1px solid var(--border); }
.you-dock-slot-btn {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 2px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* Held a moment: it lifts, ready to be carried out. */
.you-dock-slot.is-lifted .you-dock-disc { transform: scale(1.1); box-shadow: var(--shadow-md); border-color: var(--primary); }
.you-dock-disc {
  position: relative;
  transition: transform 120ms ease;
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface-2);
  overflow: visible;
}
.you-dock-disc img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.you-dock-initial { font-weight: 700; color: var(--muted); }
.you-dock-badge {
  position: absolute;
  right: -4px;
  bottom: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 0.75rem;
  font-weight: 700;
}
.you-dock-slot-text { min-width: 0; display: flex; flex-direction: column; }
.you-dock-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you-dock-meta { font-size: 0.8125rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.you-dock-empty { margin: var(--s-2) 0 0; color: var(--muted); }
.you-dock-foot { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-2); }
.you-dock-ask { border: 0; background: var(--primary); color: var(--on-primary); }
.you-dock-all { border: 1px solid var(--border); background: var(--surface); color: var(--ink); }
/* A slot's menu: Open, Put it here, Put it back — a row of actions that
   opens under the slot (inside the scrolling list, so never clipped). */
.you-dock-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 0 var(--s-2) 52px;
}
.you-dock-menu-row {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
.you-dock-menu-row:hover { border-color: var(--primary); }
/* What the dock just did, in a line above it (a passing toast). */
.dock-toast {
  position: fixed;
  right: max(var(--s-3), env(safe-area-inset-right));
  bottom: var(--toast-bottom, 96px);
  z-index: 47;
  max-width: min(320px, calc(100vw - 2 * var(--s-3)));
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}
.dock-toast[hidden] { display: none; }
/* A thing on its way out of the dock, under the finger. */
.dock-ghost {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
  will-change: transform;
}
.dock-ghost .you-dock-disc { width: 56px; height: 56px; box-shadow: var(--shadow-lg); border-color: var(--primary); }
.dock-ghost-name {
  max-width: 120px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dock-ghost.is-returning { transition: transform 200ms ease; }
@media (prefers-reduced-motion: reduce) {
  .you-dock-pill, .you-dock-caret, .you-dock-disc { transition: none; }
  .you-dock-panel, .you-dock.is-gulp .you-dock-pill, .you-dock.is-nudged .you-dock-pill { animation: none; }
  .dock-ghost.is-returning { transition: none; }
}

.on-you-row { align-items: center; }
.on-you-chip { background: color-mix(in srgb, var(--primary) 18%, var(--surface)); color: var(--primary); font-weight: 700; }
.on-you-row .btn.small { min-height: 44px; }

/* ---------- Ordered? and same-or-two (v2.38) ---------- */
.ordered-row { flex-wrap: wrap; padding-top: var(--s-2); padding-bottom: var(--s-2); }
.ordered-actions, .twin-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.ordered-actions { flex: 1 1 100%; padding-left: var(--s-4); }
.ordered-actions .btn, .twin-actions .btn { min-height: 44px; }
.twin-card { margin: var(--s-3) 0; }
.twin-question { margin: 0 0 var(--s-2); font-weight: 600; }

/* ---------- AI consent, privacy, support (v2.44) ---------- */

/* The consent sheet: over everything (the chat sheet, a call bar), a bottom
   sheet on a phone and a card on anything wider. Modal: the page stays put. */
html.consent-open, html.consent-open body { overflow: hidden; }
.consent-sheet {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 env(safe-area-inset-right) 0 env(safe-area-inset-left);
  background: var(--scrim);
}
.consent-sheet[hidden] { display: none; }
.consent-card {
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s-5) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom));
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
}
@media (min-width: 600px) {
  .consent-sheet { align-items: center; }
  .consent-card { border-radius: var(--radius-lg); padding-bottom: var(--s-5); }
}
.consent-card h2 { margin: 0 0 var(--s-3); font-family: var(--font-display); font-size: 1.35rem; }
.consent-card p { margin: 0 0 var(--s-3); line-height: 1.45; }
.consent-list { margin: 0 0 var(--s-3); padding-left: 1.1rem; line-height: 1.45; }
.consent-list li { margin-bottom: var(--s-2); overflow-wrap: anywhere; }
/* The answer is always in reach: on a short screen the text scrolls and
   the two buttons stay at the bottom of the sheet. */
.consent-actions {
  position: sticky;
  bottom: calc(-1 * (var(--s-4) + env(safe-area-inset-bottom)));
  display: flex;
  gap: var(--s-2);
  margin: var(--s-4) calc(-1 * var(--s-4)) 0;
  padding: var(--s-3) var(--s-4) calc(var(--s-4) + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
}
@media (min-width: 600px) { .consent-actions { bottom: calc(-1 * var(--s-5)); padding-bottom: var(--s-5); } }
.consent-actions .btn { flex: 1; min-height: 48px; }
.ai-state { margin: 0 0 var(--s-2); }
.ai-what { margin: 0 0 var(--s-3); }
/* "AI this month" (v2.56): one line, a thin bar, and what stops when it runs out. */
.ai-month { margin: 0 0 var(--s-3); }
.ai-month-line { margin: 0 0 var(--s-1); }
.ai-month-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: 0 0 var(--s-2);
}
.ai-month-bar > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.map-search-consent {
  padding: 0;
  border: 0;
  background: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  min-height: 32px;
}

.legal-page h2 { margin-top: var(--s-5); }
.legal-page h2:first-child { margin-top: 0; }
.legal-page li { margin-bottom: var(--s-2); overflow-wrap: anywhere; }

.support-form .field { margin-bottom: var(--s-4); }
.support-form input[type="text"], .support-form input[type="email"], .support-form textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: var(--s-2) var(--s-3);
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.support-form textarea { resize: vertical; min-height: 140px; }
.support-form .btn { min-height: 48px; min-width: 120px; }
/* The honeypot: off-screen for people, there for a bot to fill. */
.support-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.support-sent h2 { margin-top: 0; }
.support-links { margin: var(--s-4) 0 0; }
.support-inbox .support-text { display: block; margin-top: var(--s-2); white-space: normal; overflow-wrap: anywhere; }

/* ---------- Delete account (v2.45) ---------- */
.account-danger .app-row-title { color: var(--danger); }
.account-delete h2 { margin-top: 0; }
.delete-list { padding-left: 1.1rem; line-height: 1.5; }
.delete-list li { margin-bottom: var(--s-2); overflow-wrap: anywhere; }
.delete-warning { color: var(--danger); }
.delete-form { margin-top: var(--s-4); }
.delete-form .field { margin-bottom: var(--s-4); }
.delete-form input {
  width: 100%;
  box-sizing: border-box;
  min-height: 44px;
  padding: var(--s-2) var(--s-3);
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.delete-submit, .delete-cancel { width: 100%; min-height: 48px; margin-top: var(--s-2); }
@media (min-width: 600px) {
  .delete-submit, .delete-cancel { width: auto; min-width: 200px; }
}

