/* ============================================================
   MyLifeInMilan — red / black / white.
   Black sidebar chrome, cream workspace, white cards, red as the
   single accent. No logos — a wordmark + a small red mark.
   ============================================================ */

/* ---------- Self-hosted fonts (kills the font FOUC + the Google-Fonts privacy leak)
   Montserrat (body/UI) and Bitcount Single (the wordmark) were loaded from Google's
   render-blocking stylesheet, so text flashed in a fallback font then snapped — very
   visible in the sidebar wordmark and the landing hero. Serving them same-origin (and
   preloading the latin files in base.html) means they're ready at first paint.
   Montserrat is a variable font: one file covers weights 200–700. `swap` keeps a
   graceful fallback if a file is ever slow. Material Symbols stays on Google (display=block
   already hides its glyphs until loaded, so it doesn't flash text). ---------- */
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 200 700; font-display: swap;
  src: url("../fonts/montserrat-latin.311d352d9323.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat"; font-style: normal; font-weight: 200 700; font-display: swap;
  src: url("../fonts/montserrat-latinext.d16dfe26bcd7.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Bitcount Single"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/bitcount-single-latin.26dab3263e94.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bitcount Single"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("../fonts/bitcount-single-latinext.ccc1b0863c94.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Material Symbols, SELF-HOSTED + SUBSET to only the ~53 icons we use (the full Google font is
   3.9 MB, which loaded slowly and left the sidebar icons blank for seconds = the FOUC). This is
   a 56 KB subset built by pruning the ligature table to our icon names, so the icon ligatures
   ("today", "map", …) still resolve. Variable axes kept (FILL 0/1, wght) so filled/weighted
   icons still work. Preloaded in base.html -> ready at first paint. To refresh after adding a NEW
   icon name to a template, re-run the subset (see the commit that introduced static/fonts). */
@font-face {
  font-family: "Material Symbols Outlined"; font-style: normal; font-weight: 100 700; font-display: block;
  src: url("../fonts/material-symbols-subset.e77e0dae6347.woff2") format("woff2");
}

:root {
  /* ---------- Palette: red / black / white ---------- */
  --red:        #E11D2A;            /* the one accent: active nav, CTAs, "near" */
  --red-dark:   #B3141F;            /* hover / pressed */
  --red-soft:   rgba(225, 29, 42, 0.10);
  --red-ring:   rgba(225, 29, 42, 0.30);

  --ok:         #2E7D52;            /* success (toasts) */
  --warn:       #B26A00;            /* warning (toasts) */

  --ink:        #161519;            /* near-black: sidebar, headings, body text */
  --ink-2:      #232227;            /* sidebar hover */
  --ink-3:      #2D2C33;            /* sidebar active surface */

  --paper:      #FFFFFF;            /* cards / panels */
  --cream:      #F6F5F2;            /* workspace background */
  --cream-2:    #EFEEEA;            /* subtle fills, input rest */

  --text:       #161519;
  --muted:      rgba(22, 21, 25, 0.60);
  --faint:      rgba(22, 21, 25, 0.42);
  --line:       rgba(22, 21, 25, 0.13);
  --line-soft:  rgba(22, 21, 25, 0.07);

  --sidebar-fg:    rgba(255, 255, 255, 0.74);
  --sidebar-fg-on: #FFFFFF;

  /* ---------- Spacing (8px scale + 4px half-step) ---------- */
  --space-xxs: 4px;  --space-xs: 8px;  --space-s: 12px;
  --space-m: 16px;   --space-l: 24px;  --space-xl: 32px;  --space-xxl: 40px;

  /* ---------- Radii ---------- */
  --radius-s: 6px;  --radius-m: 12px;  --radius-l: 18px;  --radius-pill: 999px;

  /* ---------- Shadows (subtle) ---------- */
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-s:  0 1px 2px rgba(0,0,0,0.05), 0 2px 6px rgba(0,0,0,0.04);
  --shadow-m:  0 2px 4px rgba(0,0,0,0.05), 0 10px 24px -6px rgba(0,0,0,0.12);

  /* ---------- Motion ---------- */
  --ease:        cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-reveal: cubic-bezier(0.16, 1, 0.3, 1);
  --t-fast: 140ms var(--ease);
  --t:      220ms var(--ease);

  /* ---------- Layout ---------- */
  --sidebar-w: clamp(228px, 18vw, 272px);
  --content-max: 1440px;
  --topbar-h: 60px;
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--cream);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { color: var(--ink); letter-spacing: -0.02em; line-height: 1.12; margin: 0; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 3px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(22,21,25,0.22); border-radius: 999px; border: 3px solid var(--cream); }
::-webkit-scrollbar-thumb:hover { background: rgba(22,21,25,0.36); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; }
}

/* ---------- Material Symbols ---------- */
.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal; font-style: normal; line-height: 1;
  display: inline-block; vertical-align: middle; white-space: nowrap; direction: ltr;
  /* These four guard the icon LIGATURES and used to come from Google's stylesheet (now that the
     font is self-hosted, we must set them ourselves). Without text-transform:none a parent
     `text-transform: uppercase` (e.g. the distance filter) uppercases the ligature text
     "directions_walk" -> no match -> the raw word shows instead of the icon. letter-spacing +
     word-wrap:normal stop spacing from splitting a ligature; font-feature-settings:'liga'
     keeps ligatures on. */
  letter-spacing: normal; text-transform: none; word-wrap: normal;
  font-feature-settings: 'liga';
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Pixel-art utilities ----------
   Montserrat carries everything; "Bitcount Single" is a spot face used only for
   the wordmark and a few retro labels. .pixel-perfect keeps low-res sprites
   crisp at any scale (browsers smooth-scale <img> by default). */
.pixel-perfect { image-rendering: pixelated; image-rendering: crisp-edges; }
.font-pixel { font-family: "Bitcount Single", "Montserrat", system-ui, sans-serif; letter-spacing: 0; }

/* ============================================================
   LAYOUT — sidebar + main
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  max-width: calc(100vw - 52px);
  background: var(--ink); color: #fff;
  display: flex; flex-direction: column;
  padding: 22px 14px 16px; gap: 14px;
  position: fixed; inset: 0 auto 0 0; z-index: 100;
  overflow-y: auto;
  transition: transform var(--t);
}

/* Brand — pixel spritz logo on a light tile + Bitcount Single wordmark.
   The tile keeps the dark-outlined sprite legible on the dark sidebar. */
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 14px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand__mark { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; padding: 3px; background: #fff; border-radius: 7px; box-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.brand__mark img { width: 100%; height: 100%; display: block; }
.brand__name { font-family: "Bitcount Single", "Montserrat", system-ui, sans-serif; font-weight: 400; font-size: 1.18rem; letter-spacing: 0.02em; color: #fff; line-height: 1; }
.brand__name b { color: var(--red); font-weight: 400; }

.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nav--main { flex: 1 1 auto; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: var(--radius-m);
  color: var(--sidebar-fg); font-weight: 500; font-size: 0.95rem;
  transition: background var(--t-fast), color var(--t-fast);
}
.nav a .material-symbols-outlined { font-size: 21px; opacity: 0.85; flex-shrink: 0; }
.nav a:hover { background: var(--ink-2); color: #fff; }
.nav a.is-active { background: var(--ink-3); color: #fff; box-shadow: inset 3px 0 0 0 var(--red); }
.nav a.is-active .material-symbols-outlined { opacity: 1; color: var(--red); }
.nav__divider { border: 0; border-top: 1px solid rgba(255,255,255,0.08); margin: 8px 2px; }

.sidebar__foot { margin-top: auto; padding-top: 12px; border-top: 1px solid rgba(255,255,255,0.08); display: flex; flex-direction: column; gap: 8px; }
.userline { display: flex; align-items: center; gap: 10px; padding: 4px 8px; min-width: 0; }
.userline__avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.userline__name { font-size: 0.78rem; color: rgba(255,255,255,0.7); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signout { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: transparent; color: var(--sidebar-fg); font: inherit; font-weight: 500; cursor: pointer; border-radius: var(--radius-m); text-align: left; transition: background var(--t-fast), color var(--t-fast); }
.signout .material-symbols-outlined { font-size: 21px; opacity: 0.85; }
.signout:hover { background: var(--ink-2); color: #fff; }

/* Main column */
.main { flex: 1 1 auto; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }

/* Top bar holds only the mobile menu toggle now, so it's hidden on desktop
   (re-shown in the ≤1024px query below) — no empty sticky strip eating space. */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h); display: none; align-items: center; gap: 14px;
  padding: 0 clamp(16px, 3vw, 36px);
  background: rgba(246,245,242,0.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-soft);
}
.hamburger { display: none; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--paper); cursor: pointer; color: var(--ink); }
.topbar__spacer { flex: 1 1 auto; }
/* Feed-only "Filtri" pill, right side of the topbar. Shown ONLY ≤640px (the range where
   the feed's filter stack un-pins and becomes the sheet) — same recipe as .locchip. */
.topbar-filters {
  display: none; align-items: center; gap: 6px; margin-left: auto;
  padding: 7px 13px; border-radius: var(--radius-pill);
  background: var(--paper); border: 1px solid var(--line);
  font-size: 0.85rem; font-weight: 600; color: var(--ink); cursor: pointer;
}
.topbar-filters .material-symbols-outlined { font-size: 18px; color: var(--red); }
.filters-backdrop { display: none; }
/* The topbar slot the feed's date picker MOVES into on phones (placeDatebar in feed.html
   relocates the one .feed-datebar node; the slot is empty everywhere else, so these rules
   are inert outside ≤640px feed pages). Compact controls with a red calendar icon, tighter paddings,
   ellipsised labels capped so two open menus never crowd the Filtri pill. Panels anchor
   RIGHT — left-anchored from mid-topbar they'd run off narrow screens. The topbar has no
   overflow clipping and the panel's z-index rides inside the topbar's z-50 context, so
   the dropdown paints above the page. */
.topbar-when { display: flex; flex: 1 1 auto; min-width: 0; justify-content: center; }
.topbar-when .feed-datebar {
  width: auto; max-width: 100%; padding: 2px; gap: 4px;
  flex-wrap: nowrap; box-shadow: none;
}
.topbar-when .feed-datebar__icon { display: none; }
.topbar-when .feed-datefield { flex: 0 1 auto; }
/* Never two fields visible at once now, so no between-fields divider (base + ≤360px
   rules would draw a stray left edge on the lone day button). */
.topbar-when .feed-datefield + .feed-datefield {
  margin-left: 0; padding-left: 0; border-left: 0;
  border-top: 0; padding-top: 0;
}
.topbar-when .date-menu__button {
  min-width: 0; max-width: 56vw; gap: 5px;
  font-size: 0.8rem; font-weight: 700; padding: 7px 5px 7px 8px;
}
.topbar-when .date-menu__button [data-date-label] {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topbar-when .date-menu__panel { left: auto; right: 0; }
.locchip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--radius-pill);
  background: var(--paper); border: 1px solid var(--line);
  font-size: 0.85rem; font-weight: 600; color: var(--ink);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.locchip .material-symbols-outlined { font-size: 18px; color: var(--red); }
.locchip:hover { border-color: var(--red); }
.locchip--empty { color: var(--muted); font-weight: 500; }
.locchip--empty .material-symbols-outlined { color: var(--muted); }

.content { flex: 1 1 auto; width: 100%; max-width: var(--content-max); margin: 0 auto; padding: clamp(20px, 3vw, 34px) clamp(16px, 3vw, 36px) 56px; }

/* ---------- Page head ---------- */
.content > h1, .page-head h1 { font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 700; }
.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: clamp(14px, 2vw, 22px);
}
.page-head h1,
.page-head .page-title,
.page-head .feed-title { margin: 0; }
.sub { color: var(--muted); margin: 6px 0 22px; font-size: 0.95rem; }
.sub strong { color: var(--ink); }

/* ---------- Toast notifications (see static/js/toast.js) ---------- */
.toast-container {
  position: fixed; top: calc(var(--topbar-h) + 12px); right: 18px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
  max-width: min(380px, calc(100vw - 36px)); pointer-events: none;
}
.toast {
  pointer-events: auto; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-m); box-shadow: var(--shadow-m); overflow: hidden;
  animation: toast-enter 0.22s var(--ease); position: relative;
}
.toast.toast-exit { animation: toast-exit 0.22s var(--ease) forwards; }
.toast-header { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; }
.toast-icon { font-size: 22px !important; flex-shrink: 0; margin-top: 1px; }
.toast-icon-success { color: var(--ok); }
.toast-icon-error { color: var(--red); }
.toast-icon-info { color: var(--ink); }
.toast-icon-warning { color: var(--warn); }
.toast-text { flex: 1; min-width: 0; font-size: 0.9rem; font-weight: 500; color: var(--ink); line-height: 1.4; }
.toast-close-btn { background: transparent; border: 0; cursor: pointer; color: var(--faint); padding: 1px; display: inline-flex; align-items: center; flex-shrink: 0; transition: color var(--t-fast); }
.toast-close-btn:hover { color: var(--ink); }
.toast-close-btn .material-symbols-outlined { font-size: 18px; }
.toast-progress { height: 2px; width: 100%; transform-origin: left center; animation: toast-progress linear forwards; background: var(--ink); }
.toast-success .toast-progress { background: var(--ok); }
.toast-error .toast-progress { background: var(--red); }
.toast-warning .toast-progress { background: var(--warn); }
@keyframes toast-enter { from { transform: translateX(16px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-exit { to { transform: translateX(16px); opacity: 0; } }
@keyframes toast-progress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ============================================================
   FEED — filters + cards + reference sidebar
   ============================================================ */
.page-with-sidebar { display: grid; grid-template-columns: minmax(0, 1fr) 288px; gap: clamp(18px, 2.4vw, 32px); align-items: start; }
.feed-shell { display: block; }
.feed-filters { min-width: 0; }
.feed-results { min-width: 0; }
/* During an AJAX filter swap the results dim briefly instead of the whole page reloading. */
.feed-results.is-loading { opacity: 0.5; transition: opacity 0.12s ease; pointer-events: none; }
@media (prefers-reduced-motion: reduce) { .feed-results.is-loading { transition: none; } }

/* Filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: end;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 16px; margin: 0 0 26px; box-shadow: var(--shadow-s);
}
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.filters input, .filters select {
  font: inherit; font-size: 0.9rem; color: var(--ink);
  background: var(--cream-2); border: 1px solid transparent; border-radius: var(--radius-s);
  padding: 8px 10px; min-width: 150px; max-width: 100%; transition: border-color var(--t-fast), background var(--t-fast);
}
.filters input:focus, .filters select:focus { outline: none; background: var(--paper); border-color: var(--red); }
.filters button { align-self: end; }

/* Interest picker — tri-state, expandable. Sits inline among the other filters. */
.interest-picker { position: relative; display: flex; flex-direction: column; gap: 5px; }
.interest-picker__caption { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.interest-picker__toggle {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font: inherit; font-size: 0.9rem; color: var(--ink); text-align: left;
  background: var(--cream-2); border: 1px solid transparent; border-radius: var(--radius-s);
  padding: 8px 10px; min-width: 180px; transition: border-color var(--t-fast), background var(--t-fast);
}
.interest-picker__toggle:hover { background: var(--paper); border-color: var(--line); }
.interest-picker.is-active .interest-picker__toggle { border-color: var(--red); background: var(--paper); }
.interest-picker__toggle > .material-symbols-outlined { font-size: 18px; color: var(--red); }
.interest-picker__summary { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.interest-picker__caret { font-size: 18px; color: var(--faint); transition: transform var(--t-fast); }
.interest-picker__toggle[aria-expanded="true"] .interest-picker__caret { transform: rotate(180deg); }
.interest-picker__panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  width: min(420px, 86vw);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l);
  box-shadow: var(--shadow-m); padding: 14px;
}
.interest-picker__hint { margin: 0 0 10px; font-size: 0.78rem; color: var(--muted); }
.interest-picker__chips { display: flex; flex-wrap: wrap; gap: 7px; }
.interest-chip {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  font: inherit; font-size: 0.82rem; line-height: 1; color: var(--ink);
  background: var(--cream-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 11px; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.interest-chip:hover { border-color: var(--faint); }
.interest-chip__icon { font-size: 15px; color: var(--faint); }
/* "Show only these" — selected/included. */
.interest-chip[data-state="in"] { background: var(--red); border-color: var(--red); color: #fff; }
.interest-chip[data-state="in"] .interest-chip__icon { color: #fff; }
/* "Hide these" — excluded. */
.interest-chip[data-state="out"] { background: transparent; border-color: var(--faint); color: var(--muted); text-decoration: line-through; }
.interest-chip[data-state="out"] .interest-chip__icon { color: var(--muted); text-decoration: none; }
/* Interests chips carry the category's own colour (icon + a soft tint when included), mirroring
   the Map palette, instead of the plain red used by the Source picker. */
.interest-chip--cat .interest-chip__icon { font-size: 16px; color: var(--cat, var(--faint)); }
.interest-chip--cat[data-state="in"] {
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  border-color: color-mix(in srgb, var(--cat) 50%, transparent); color: var(--ink); text-decoration: none;
}
.interest-chip--cat[data-state="in"] .interest-chip__icon { color: var(--cat); }
.interest-chip--cat[data-state="out"] { opacity: 0.5; }
.interest-chip--cat[data-state="out"] .interest-chip__icon { color: var(--cat); filter: grayscale(1); }
.interest-picker__actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.linklike { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 600; color: var(--red); }
.linklike:hover { text-decoration: underline; }
.linklike--reset {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red-soft); border: 1px solid var(--red-ring); border-radius: var(--radius-s);
  padding: 8px 12px; color: var(--red-dark); text-decoration: none;
}
.linklike--reset:hover { background: var(--red); border-color: var(--red); color: #fff; text-decoration: none; }
.linklike--reset[hidden] { display: none; }   /* class display:inline-flex otherwise beats the hidden attr */

/* Genre picker — searchable combobox (type to filter, click/arrow+enter to pick).
   Used by the Book Clubs genre filter; only genres present in the period are listed. */
.genre-picker { position: relative; display: flex; flex-direction: column; gap: 5px; }
.genre-picker__caption { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.genre-picker__field {
  display: flex; align-items: center; gap: 8px;
  background: var(--cream-2); border: 1px solid transparent; border-radius: var(--radius-s);
  padding: 0 6px 0 10px; min-width: 220px; transition: border-color var(--t-fast), background var(--t-fast);
}
.genre-picker__field:focus-within { background: var(--paper); border-color: var(--red); }
.genre-picker__icon { font-size: 18px; color: var(--red); flex: none; }
/* Scoped + explicit so the global `.filters input` rules (higher specificity) don't
   give this a second box + red focus border inside the field. */
.genre-picker__field .genre-picker__input {
  flex: 1; min-width: 0; font: inherit; font-size: 0.9rem; color: var(--ink);
  background: transparent; border: 0; border-radius: 0; padding: 8px 0; box-shadow: none;
}
.genre-picker__field .genre-picker__input:focus { outline: none; background: transparent; border-color: transparent; }
.genre-picker__input::placeholder { color: var(--muted); }
/* Scoped past the global `.filters button { align-self: end }`, which otherwise drags
   this button to the bottom of the field instead of centring it. */
.genre-picker__field .genre-picker__clear {
  display: inline-flex; align-items: center; justify-content: center; align-self: center; flex: none;
  width: 24px; height: 24px; line-height: 0;
  background: none; border: 0; cursor: pointer; color: var(--faint);
  border-radius: var(--radius-pill); transition: color var(--t-fast), background var(--t-fast);
}
.genre-picker__field .genre-picker__clear:hover { color: var(--ink); background: var(--line-soft); }
/* display:block + line-height:0 drops the inline-glyph descender gap so the icon sits dead-centre. */
.genre-picker__field .genre-picker__clear .material-symbols-outlined { font-size: 16px; display: block; line-height: 0; }
.genre-picker__list {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
  width: 100%; max-height: 280px; overflow-y: auto; margin: 0; padding: 6px; list-style: none;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-m);
}
.genre-picker__option {
  padding: 8px 10px; border-radius: var(--radius-s); cursor: pointer; font-size: 0.88rem; color: var(--ink);
}
.genre-picker__option:hover, .genre-picker__option.is-active { background: var(--cream-2); }
.genre-picker__option[aria-selected="true"] { color: var(--red); font-weight: 600; }

/* Inline location notice above the feed. */
.notice { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: var(--radius-l); margin: 0 0 20px; font-size: 0.9rem; box-shadow: var(--shadow-s); }
.notice p { margin: 0; flex: 1; min-width: 0; }
.notice > .material-symbols-outlined { font-size: 22px; flex: none; }
.notice .btn { flex: none; }
.notice--warn { background: #FBF1E0; border: 1px solid rgba(178, 106, 0, 0.28); color: #6E4A12; }
.notice--warn > .material-symbols-outlined { color: var(--warn); }
.btn--sm { padding: 7px 12px; font-size: 0.82rem; }

/* Cards grid */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }

.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 18px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-s); transition: box-shadow var(--t), transform var(--t), border-color var(--t);
}
.card:hover { box-shadow: var(--shadow-m); transform: translateY(-2px); border-color: var(--line); }
.card h3 { font-size: 1.06rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.card .when { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--muted); font-size: 0.84rem; font-weight: 500; }
.card .when .material-symbols-outlined { font-size: 16px; color: var(--faint); }
.card .when .dot { color: var(--line); }
/* Pin/cam icon stays glued to (and top-aligned with) its label, which wraps under it on long
   venue names — instead of the icon orphaning on the line above. */
.card .when__loc { display: inline-flex; align-items: flex-start; gap: 4px; min-width: 0; }
.card .when__loc > .material-symbols-outlined { flex: none; }
.card .book { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 0.92rem; }
.card .book > .material-symbols-outlined { font-size: 17px; color: var(--red); align-self: center; }
.card .book .book__title { font-weight: 700; color: var(--ink); }
/* The book is a Goodreads look-up link — make that legible (colour + underline + ext icon). */
.card .book .book__link { font-weight: 700; color: var(--red-dark); text-decoration: underline;
  text-decoration-color: rgba(199,42,42,0.4); text-underline-offset: 2px;
  display: inline-flex; align-items: center; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.card .book .book__link:hover { text-decoration-color: var(--red); }
.card .book .book__ext { font-size: 13px; opacity: 0.65; }
.card .book .book__author { color: var(--muted); font-weight: 500; }
/* Clamp to keep cards in a row visually even despite very different blurb lengths. */
.card .desc { color: rgba(22,21,25,0.78); font-size: 0.9rem; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 4; line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; align-items: center; padding-top: 4px; }
.card__media { display: block; border-radius: var(--radius-m, 12px); overflow: hidden; margin-bottom: 2px; }
.card__media img { width: 100%; height: 158px; object-fit: cover; display: block; transition: transform var(--t); }
.card__media:hover img { transform: scale(1.04); }
/* "Immagine non disponibile" placeholder — no image, or a hotlink that failed to load. */
.card__noimg { display: none; }
.card__media--empty { background: linear-gradient(135deg, var(--cream-2), #E6E4DF); }
.card__media--empty img { display: none; }
.card__media--empty .card__noimg {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; height: 158px; color: var(--faint); text-align: center; padding: 10px;
}
.card__noimg .material-symbols-outlined { font-size: 38px; opacity: 0.65; }
.card__noimg span:last-child { font-size: 0.76rem; font-weight: 600; letter-spacing: 0.01em; }
.card .where { color: var(--faint); font-size: 0.8rem; margin: -4px 0 0; overflow-wrap: anywhere; }

/* Feed controls: compact date selects plus the compact/full view toggle. */
.feed-title { margin-bottom: clamp(16px, 2.2vw, 24px); }
.feed-controls {
  display: flex; align-items: center; justify-content: flex-start; gap: 14px;
  margin: -2px 0 18px;
}
.datebar {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%;
  padding: 6px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-m); box-shadow: var(--shadow-xs);
}
.feed-datebar__icon { flex: 0 0 auto; font-size: 19px; color: var(--red); margin-left: 2px; }
.feed-datefield,
.date-menu { position: relative; display: inline-flex; align-items: center; min-width: 0; }
.feed-datefield[hidden] { display: none; }
.feed-datefield + .feed-datefield { margin-left: 1px; padding-left: 7px; border-left: 1px solid var(--line-soft); }
.date-menu__button {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; min-width: 130px; max-width: 100%;
  border: 0; border-radius: var(--radius-s); background: transparent; color: var(--ink);
  cursor: pointer; font: inherit; font-size: 0.86rem; font-weight: 650; line-height: 1;
  padding: 8px 8px; text-align: left;
  transition: background var(--t-fast), box-shadow var(--t-fast);
}
.feed-datefield--day .date-menu__button { min-width: 108px; }
.date-menu__button:hover,
.date-menu__button[aria-expanded="true"] { background: var(--cream-2); }
.date-menu__button:focus-visible { outline: none; box-shadow: inset 0 0 0 1px var(--red-ring); }
.date-menu__caret {
  flex: 0 0 auto; font-size: 18px; color: var(--faint); transition: transform var(--t-fast);
}
.date-menu__button[aria-expanded="true"] .date-menu__caret { transform: rotate(180deg); }
.date-menu__panel {
  position: absolute; top: calc(100% + 7px); left: 0; z-index: 55;
  min-width: max(100%, 190px); max-width: min(280px, calc(100vw - 32px));
  padding: 5px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-m); box-shadow: var(--shadow-m);
}
.feed-datefield--day .date-menu__panel { min-width: max(100%, 150px); }
.date-menu__option {
  display: flex; align-items: center; width: 100%; min-height: 34px;
  border: 0; border-radius: var(--radius-s); background: transparent; color: var(--ink);
  cursor: pointer; font: inherit; font-size: 0.84rem; font-weight: 600; text-align: left;
  padding: 8px 10px; white-space: nowrap;
}
.date-menu__option:hover { background: var(--cream-2); }
.date-menu__option.is-selected { background: var(--ink); color: var(--paper); }
.date-menu__panel[hidden] { display: none; }
.view-toggle {
  display: inline-flex; flex: 0 0 auto; gap: 2px; margin-left: auto; padding: 2px;
  border: 1px solid var(--line); border-radius: var(--radius-pill);
  background: var(--paper); box-shadow: var(--shadow-xs);
}
.view-toggle button {
  background: transparent; border: 0; border-radius: var(--radius-pill);
  cursor: pointer; font: inherit; font-size: 0.74rem; font-weight: 650; color: var(--muted);
  padding: 6px 12px; transition: background var(--t-fast), color var(--t-fast);
}
.view-toggle button:hover { background: var(--cream-2); color: var(--ink); }
.view-toggle button.is-active { background: var(--ink); color: var(--paper); }
.cards--compact .card__media,
.cards--compact .card .where,
.cards--compact .card .desc { display: none; }
.cards--compact .card { padding: 14px; gap: 6px; }

/* Tabs — Giochi di ruolo (Eventi / Bacheca). Links so ?view= works without JS. */
.tabs { display: flex; gap: 6px; margin: 0 0 18px; border-bottom: 1px solid var(--line); }
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; margin-bottom: -1px;
  font-size: 0.92rem; font-weight: 600; color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); border-bottom-color: var(--brand, var(--ink)); }
.tab .material-symbols-outlined { font-size: 20px; }
.tab__count {
  font-size: 0.74rem; font-weight: 700; line-height: 1; padding: 3px 7px; border-radius: var(--radius-pill);
  background: var(--cream-2, #efece6); color: var(--muted);
}
.tab.is-active .tab__count { background: var(--ink); color: #fff; }
.tab-panel[hidden] { display: none; }

/* Distance filter on the themed section pages (Magic / Giochi da tavolo e wargames / Sport). */
.section-filter { margin: 0 0 16px; }
/* Magic formats: any number of names, so compact pills that wrap (desktop) or scroll sideways
   in one row (phones), not the distance filter's 3-option grid. The distance slider sits below. */
.section-filter .format-pick { display: flex; flex-direction: column; gap: 6px; flex: 1 1 100%; min-width: 0; }
.format-pick__options { display: flex; flex-wrap: wrap; gap: 6px; }
.filters > .format-pick { grid-column: 1 / -1; }
.filters .format-pick .dchip { flex: 0 0 auto; flex-direction: row; width: auto; min-height: 34px; padding: 6px 12px; }
.filters .format-pick .dchip span:last-child { white-space: nowrap; }
.section-filter:has(.format-pick) { justify-content: flex-start; }   /* the slider sits under the formats, not dangling right */
.section-filter .format-pick ~ .distance-slider { margin-left: 0; }
@media (max-width: 640px) {
  .format-pick__options { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -12px; padding: 0 12px 2px; }   /* = .content's phone gutter */
  .format-pick__options::-webkit-scrollbar { display: none; }
}

/* Staff dashboard (events/dashboard.html) — replaces the old "Fonti" sidebar panel. */
.nav__badge { margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 18px; text-align: center; }
.dash-health { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius-l);
  border: 1px solid var(--line); background: var(--paper); margin: 0 0 18px; box-shadow: var(--shadow-s); }
.dash-health .material-symbols-outlined { font-size: 28px; }
.dash-health.is-ok .material-symbols-outlined { color: var(--ok, #2e7d32); }
.dash-health.is-alert { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.dash-health.is-alert .material-symbols-outlined { color: var(--red); }
.dash-health__text { display: flex; flex-direction: column; gap: 2px; }
.dash-health__text strong { font-size: 1rem; display: inline-flex; align-items: center; gap: 8px; }
.dash-health__badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red);
  color: #fff; font-size: 0.72rem; font-weight: 700; line-height: 20px; text-align: center; }
.dash-health__sub { font-size: 0.82rem; color: var(--muted); }
.dash-health__why { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.8rem; color: var(--muted); margin-top: 6px; }
.dash-health__item { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 8px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--paper); white-space: nowrap; }
.dash-health__item strong { font-weight: 600; color: var(--ink); font-size: inherit; }
.dash-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 0 0 22px; }
.dash-stat { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 16px;
  display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-s); }
.dash-stat__num { font-size: 1.7rem; font-weight: 700; color: var(--ink); line-height: 1; }
.dash-stat__label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
/* Budgets & usage — external-service spend cards (Firecrawl/GitHub/Gemini/Northflank/Neon). */
.dash-budgets { margin: 0 0 22px; }
.dash-budgets__title { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 10px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.dash-budgets__month { font-size: 0.72rem; font-weight: 600; color: var(--faint, var(--muted)); text-transform: none; letter-spacing: 0; }
.dash-budgets__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; }
.dash-budget { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-s); }
.dash-budget__svc { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.dash-budget__num { font-size: 1.5rem; font-weight: 700; color: var(--ink); line-height: 1.15; font-variant-numeric: tabular-nums; }
.dash-budget__num--sm { font-size: 1rem; }
.dash-budget__of { font-size: 0.9rem; font-weight: 600; color: var(--muted); margin-left: 2px; }
.dash-budget__sub { font-size: 0.72rem; color: var(--muted); line-height: 1.35; }
.dash-budget__link { color: var(--red); text-decoration: none; }
.dash-budget__link:hover { color: var(--red-dark, var(--red)); text-decoration: underline; }
.dash-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--paper); box-shadow: var(--shadow-s); }
.dash-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 560px; }
.dash-table th, .dash-table td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.dash-table th { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; }
.dash-table th.num, .dash-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dash-table tbody tr:last-child td { border-bottom: 0; }
.dash-src strong { display: block; }
.dash-slug { font-size: 0.72rem; color: var(--muted); }
.dash-muted { color: var(--faint, var(--muted)); }
.dash-row--down { background: color-mix(in srgb, var(--red) 6%, transparent); }
.dash-row--warn { background: color-mix(in srgb, var(--warn, #b26a00) 8%, transparent); }
.dash-pill { display: inline-block; padding: 3px 9px; border-radius: var(--radius-pill); font-size: 0.72rem; font-weight: 700;
  border: 1px solid transparent; white-space: nowrap; }
.dash-pill--ok { background: color-mix(in srgb, var(--ok, #2e7d32) 14%, transparent); color: var(--ok, #2e7d32); }
.dash-pill--info { background: var(--cream-2, #efece6); color: var(--muted); }
.dash-pill--warn { background: color-mix(in srgb, var(--warn, #b26a00) 16%, transparent); color: var(--warn, #b26a00); }
.dash-pill--down { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
/* Status column = PLAIN text (no chip), level conveyed by colour alone. The legend below still
   uses .dash-pill so the key reads as labelled swatches. */
.dash-status { font-weight: 600; font-size: 0.82rem; white-space: nowrap; }
.dash-status--ok { color: var(--ok, #2e7d32); }
.dash-status--info { color: var(--muted); }
.dash-status--warn { color: var(--warn, #b26a00); }
.dash-status--down { color: var(--red); }
/* "Fetched via" tier column: PLAIN text naming the rung that last fetched the source
   (fetch / firecrawl / stealth / residential). Firecrawl/residential tiers get a coloured
   word — no chip — so a credit-spending fetch stands out from a free datacenter fetch. */
.dash-tier { white-space: nowrap; }
.dash-tier__name { font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.dash-tier--firecrawl, .dash-tier--firecrawl_stealth { color: var(--warn, #b26a00); }
.dash-tier--firecrawl_stealth { font-weight: 700; }
.dash-tier--fetch_residential, .dash-tier--nodriver_residential { color: var(--accent, #7C3AED); }
.dash-tier__lock { margin-left: 6px; font-size: 0.66rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.03em; color: var(--red); }
/* "Categorized by" column — plain text naming how a source classifies its events (cursor:help
   because it carries a percentage-breakdown tooltip). */
.dash-method { font-size: 0.82rem; color: var(--muted); white-space: nowrap; cursor: help; }
/* Muted (ignore_notifications) rows: real status still shown, just dimmed + a small bell-off. */
.dash-row--muted td { opacity: 0.6; }
.dash-notif { display: inline-flex; align-items: center; gap: 5px; }
.dash-notif input { cursor: pointer; margin: 0; }
.dash-notif__lbl { font-size: 0.7rem; color: var(--muted); }
.dash-legend { margin: 22px 0 0; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--paper); padding: 0 16px; }
.dash-legend > summary { cursor: pointer; padding: 13px 2px; font-weight: 600; font-size: 0.88rem; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 8px; }
.dash-legend > summary::-webkit-details-marker { display: none; }
.dash-legend > summary::before { content: "help"; font-family: "Material Symbols Outlined"; font-size: 19px; color: var(--red); }
.dash-legend[open] > summary { border-bottom: 1px solid var(--line); }
.dash-legend__list { list-style: none; margin: 0; padding: 12px 0 16px; display: grid; gap: 11px; }
/* First column sizes to the WIDEST pill (max-content) so a long label like the Italian
   "Raccolta non riuscita" can't overflow a fixed width and collide with its description. */
.dash-legend__list li { display: grid; grid-template-columns: max-content 1fr; align-items: baseline; gap: 14px; font-size: 0.85rem; color: var(--ink); }
.dash-legend__list .dash-pill { justify-self: start; white-space: nowrap; }
.dash-legend__list li > span:last-child { color: var(--muted); }
@media (max-width: 560px) { .dash-legend__list li { grid-template-columns: 1fr; gap: 3px; } }
.dash-foot { margin: 20px 0 0; }
.dash-foot a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius-pill);
  background: var(--paper); border: 1px solid var(--line); color: var(--ink);
  font-size: 0.84rem; font-weight: 600; text-decoration: none;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.dash-foot a:hover { border-color: var(--red); color: var(--red-dark); box-shadow: var(--shadow-s); }
.dash-foot a .material-symbols-outlined { font-size: 18px; color: var(--red); }

/* --- User-activity dashboard: KPIs + aggregate bar charts (no chart lib, just CSS bars) --- */
.act-kpis { max-width: 460px; }
.act-viz-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(16px, 2.4vw, 26px); margin: 0 0 24px; }
@media (max-width: 680px) { .act-viz-grid { grid-template-columns: 1fr; } }
.act-viz { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 18px 20px; box-shadow: var(--shadow-s); }
.act-viz__title { font-size: 0.98rem; font-weight: 700; margin: 0 0 2px; }
.act-viz .sidehint { margin: 0 0 14px; }
.act-chart { display: flex; flex-direction: column; gap: 9px; }
.act-viz--wide { margin: 0 0 24px; }
.act-spark { display: flex; gap: 2px; height: 96px; }
/* Each day is a full-height hover target (native title tooltip works even on zero-count days). */
.act-spark__day { flex: 1 1 0; display: flex; align-items: flex-end; border-radius: 2px; }
.act-spark__day:hover { background: var(--cream-2); }
.act-spark__bar { width: 100%; min-height: 2px; background: var(--red); border-radius: 2px 2px 0 0; }
.act-spark__axis { display: flex; justify-content: space-between; margin-top: 4px; font-size: 0.76rem; color: var(--faint); }
.act-row { display: grid; grid-template-columns: 132px 1fr 34px; align-items: center; gap: 10px; font-size: 0.84rem; }
.act-row__label { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-row__track { background: var(--cream-2); border-radius: 999px; height: 10px; overflow: hidden; }
.act-row__bar { display: block; height: 100%; border-radius: 999px; min-width: 3px; background: var(--ink); transition: width var(--t); }
.act-row__bar--sec { background: var(--red); }
.act-row__bar--src { background: var(--ink); }
.act-row__bar--srcin { background: #2563EB; }
.act-row__bar--srcout { background: var(--faint); }
.act-row__count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.act-empty { color: var(--muted); font-size: 0.85rem; padding: 6px 0 2px; }
.act-badge { font-size: 0.76rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; background: var(--cream-2); }
.act-badge--7 { color: var(--ok, #2e7d32); }
.act-badge--30 { color: var(--ink); }
.act-badge--off { color: var(--faint); }
.act-toggle { margin: 4px 0 22px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.act-toggle__label { display: inline-flex; align-items: center; gap: 10px; font-size: 0.9rem; font-weight: 600; color: var(--ink); cursor: pointer; background: var(--paper); border: 1.5px solid var(--line); border-radius: 999px; padding: 9px 16px; box-shadow: var(--shadow-s); transition: border-color var(--t), background var(--t), color var(--t); }
.act-toggle__label:hover { border-color: var(--red); }
.act-toggle__label input { width: 17px; height: 17px; accent-color: var(--red); cursor: pointer; }
.act-toggle.is-on .act-toggle__label { border-color: var(--red); background: var(--cream-2); color: var(--red-dark); }

/* Dashboard tabs (Sources / Data quality) — client-side panel switch. */
.dash-tabs { display: flex; gap: 4px; margin: 0 0 20px; border-bottom: 2px solid var(--line); }
.dash-tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border: 0; background: none;
  font: inherit; font-size: 0.86rem; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color var(--t-fast), border-color var(--t-fast); }
.dash-tab .material-symbols-outlined { font-size: 18px; }
.dash-tab:hover { color: var(--ink); }
.dash-tab.is-active { color: var(--red); border-bottom-color: var(--red); }
.dash-panel.is-hidden { display: none; }

/* Sortable column headers — click to sort, a caret marks the active column + direction. */
.dash-th--sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.dash-th--sortable:hover { color: var(--ink); }
.dash-th--sortable::after { content: "\2195"; margin-left: 5px; font-size: 0.78em; opacity: 0.35; }
.dash-table th.num.dash-th--sortable::after { margin-left: 4px; }
.dash-th--sortable.is-sorted { color: var(--ink); }
.dash-th--sortable.is-sorted[data-dir="asc"]::after { content: "\2191"; opacity: 0.9; }
.dash-th--sortable.is-sorted[data-dir="desc"]::after { content: "\2193"; opacity: 0.9; }

/* Data-quality stat cards carry a small sub-line under the label. */
.dash-stats--quality { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.dash-stat__sub { font-size: 0.72rem; color: var(--faint, var(--muted)); }

.dash-quality-hint { font-size: 0.78rem; color: var(--muted); margin: 6px 0 14px; }

/* Per-source classification mix — a compact stacked bar per row (segments = % of each mechanism).
   Colours are shared with the legend below + via .dash-method--<key>. */
.dash-classbar { display: flex; width: 150px; max-width: 100%; height: 12px; border-radius: 6px;
  overflow: hidden; background: var(--cream-2, #efece6); }
.dash-classbar__seg { height: 100%; min-width: 1px; }
.dash-classlegend { font-size: 0.74rem; color: var(--muted); margin: 6px 0 12px; display: flex;
  flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.dash-classlegend strong { color: var(--ink); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.dash-classlegend__item { display: inline-flex; align-items: center; gap: 6px; }
.dash-classlegend__item::before { content: ""; width: 11px; height: 11px; border-radius: 3px; background: currentColor; }
/* Per-method accent colours (native = source taxonomy, ai = Gemini, etc.) — used by the legend
   text (currentColor swatch) AND the stacked-bar segments (background). */
.dash-method--native { color: var(--ok, #2e7d32); } .dash-classbar__seg.dash-method--native { background: var(--ok, #2e7d32); }
.dash-method--keyword { color: #2563EB; } .dash-classbar__seg.dash-method--keyword { background: #2563EB; }
.dash-method--ai { color: var(--accent, #7C3AED); } .dash-classbar__seg.dash-method--ai { background: var(--accent, #7C3AED); }
.dash-method--default { color: var(--warn, #b26a00); } .dash-classbar__seg.dash-method--default { background: var(--warn, #b26a00); }
.dash-method--none { color: var(--muted); } .dash-classbar__seg.dash-method--none { background: var(--muted); }

/* Cross-source duplicate overlaps (Data-quality tab) — a small, calm aligned table. */
.dash-dupes { margin: 4px 0 22px; }
.dash-dupes__table { border-collapse: collapse; font-size: 0.84rem; min-width: 280px; }
.dash-dupes__table th { text-align: left; font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); font-weight: 700; padding: 0 18px 6px 0; }
.dash-dupes__table td { padding: 5px 18px 5px 0; color: var(--ink); border-top: 1px solid var(--line); }
.dash-dupes__table .num { text-align: right; padding-right: 0; font-variant-numeric: tabular-nums; color: var(--muted); }
.dash-dupes__table th.num { text-align: right; padding-right: 0; }

/* Quality % cell — a small coloured chip flags the worst offenders. */
.dash-q { font-weight: 700; font-variant-numeric: tabular-nums; }
.dash-q--ok { color: var(--ok, #2e7d32); }
.dash-q--warn { color: var(--warn, #b26a00); }
.dash-q--bad { color: var(--red); }

/* Page heading breathing room (e.g. Book Clubs h1 above its filter card) */
.page-title { margin-bottom: clamp(14px, 2vw, 22px); }

/* Day section headers (This Week / Next Week feeds) */
.day-head { font-size: 0.95rem; font-weight: 700; color: var(--ink); margin: 24px 0 12px; padding-bottom: 7px; border-bottom: 2px solid var(--line); text-transform: capitalize; }
.day-section:first-child .day-head { margin-top: 2px; }

/* Week band — the "Questa settimana / Prossima settimana" divider inside the united feed. */
.week-band {
  font-size: 1.15rem; font-weight: 800; color: var(--ink); margin: 30px 0 4px;
  letter-spacing: 0.01em; display: flex; align-items: center; gap: 12px;
}
.week-band::after { content: ""; flex: 1; height: 2px; background: var(--line); border-radius: 2px; }
/* `display:flex` above out-specifies the [hidden] UA rule, so restore it for the range filter. */
.week-band[hidden] { display: none; }
#feedCards .card[hidden] { display: none; }
.week-band:first-child { margin-top: 2px; }
.week-band + .day-section .day-head { margin-top: 10px; }

/* Distance multi-select — toggle bucket chips (combine e.g. close + medium) */
.distance-pick { display: flex; flex: 0 0 auto; flex-direction: column; align-self: end; gap: 5px; min-width: max-content; }
.distance-pick__cap { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.distance-pick__options { display: flex; align-items: center; gap: 7px; flex-wrap: nowrap; width: max-content; }
.filters .dchip,
.distance-pick--inline .dchip { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 8px 11px; border-radius: var(--radius-s);
  border: 1px solid var(--line); font-size: 0.78rem; font-weight: 700; color: var(--ink);
  flex: 0 0 auto; text-transform: uppercase; letter-spacing: 0.05em; background: var(--paper); cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t); }
.filters .dchip span:last-child { white-space: nowrap; }
.dchip:hover { border-color: var(--muted); color: var(--ink); }
/* relative: the hidden input must stay inside its chip — escaping a sideways-scrolling row
   (Magic formats) it widened the whole page on phones and pushed the bottom bar off-screen. */
.dchip { position: relative; }
.dchip input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
/* Selected look is driven by :checked (via :has), NOT only the server-rendered `is-on` class.
   The weekly feed swaps just #feedResults on an AJAX filter, leaving the filter form (and its
   chips) un-rerendered — so an `is-on`-only style never updated after a click and multi-select
   looked broken. `:has(input:checked)` reflects the live checkbox state, so each chip toggles its
   highlight instantly and you can stack several. `is-on` is kept for the SSR/no-JS state. */
.dchip.is-on, .dchip:has(input:checked) { background: var(--red); color: #fff; border-color: var(--red); }
.dchip .material-symbols-outlined { font-size: 18px; color: var(--red); }
.dchip.is-on .material-symbols-outlined, .dchip:has(input:checked) .material-symbols-outlined { color: #fff; }
.dchip input:focus-visible + span, .dchip:focus-within { outline: 2px solid var(--red); outline-offset: 2px; }

/* Google sign-in button (login page) */
.gbtn { display: inline-flex; align-items: center; gap: 10px; background: #fff; color: #3c4043; border: 1px solid var(--line); border-radius: var(--radius-m, 12px); padding: 11px 18px; font-weight: 600; font-size: 0.95rem; text-decoration: none; box-shadow: var(--shadow-s); transition: box-shadow var(--t), border-color var(--t); }
.gbtn:hover { box-shadow: var(--shadow-m); border-color: var(--muted); }
.gbtn__logo { flex: none; }

/* Tags + chips */
/* De-chipped card meta (category + distance). These read as quiet inline LABELS — a colour
   dot + text, an icon + text — so the only rounded "pills" left on screen are the genuinely
   clickable filters. Less pill monotony, clearer interactive/decorative hierarchy. */
.card .meta { gap: 14px; }
.cat-label { display: inline-flex; align-items: center; gap: 5px; font-size: 0.78rem; font-weight: 600; color: var(--ink); }
.cat-label__icon { font-size: 17px; line-height: 1; flex: none; }
.dist-label { display: inline-flex; align-items: center; gap: 4px; font-size: 0.76rem; font-weight: 600; color: var(--muted); }
.dist-label .material-symbols-outlined { font-size: 16px; line-height: 1; }
/* Three distinct shades so the range reads at a glance: near = warm red, doable = strong ink,
   out-of-the-way = faded. Before, only --close had a colour, so "Ci sta" and "Fuori mano" both
   fell back to the same muted grey and were indistinguishable. */
.dist-label--close { color: var(--red-dark); }
.dist-label--medium { color: var(--ink); }
.dist-label--far { color: var(--faint); }

.tag { font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--cream-2); color: var(--muted); }
/* Category chip: neutral pill, the per-category colour carried by the Material icon. */
.tag.cat { background: var(--cream-2); color: var(--ink); display: inline-flex; align-items: center; gap: 5px; }
.tag.cat .cat__icon { font-size: 15px; line-height: 1; }
.chip { font-size: 0.72rem; font-weight: 700; padding: 3px 9px; border-radius: var(--radius-pill); display: inline-flex; align-items: center; gap: 4px; }
.chip.close { background: var(--red); color: #fff; }
.chip.medium { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.chip.far { background: var(--ink); color: #fff; }
.chip.approx { font-weight: 600; opacity: 0.9; }
.chip.close.approx { background: var(--red-soft); color: var(--red-dark); }
.chip.far.approx { background: var(--cream-2); color: var(--ink); }

/* Card footer links */
.cardlinks { display: flex; gap: 12px; align-items: center; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.cardlinks a { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 0.84rem; color: var(--red-dark); }
.cardlinks a .material-symbols-outlined { font-size: 15px; }
.cardlinks a:hover { color: var(--red); }
.reason { color: var(--faint); font-size: 0.74rem; }
.cardlinks__favorite { margin-left: auto; display: flex; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  background: transparent; border: 0; color: var(--faint); cursor: pointer;
  transition: color var(--t-fast), transform var(--t-fast);
}
.icon-btn .material-symbols-outlined { font-size: 20px; }
.icon-btn:hover { color: var(--ink); }
/* Kill the square focus box left after a mouse click; keep a ring for keyboard users only. */
.icon-btn:focus { outline: none; }
.icon-btn:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 50%; }
.star:hover { color: var(--red); transform: translateY(-1px); }
.star.on { color: var(--red); }
.star.on .material-symbols-outlined { font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 24; }

/* ---------- Reference sidebar ---------- */
.sidepanel {
  position: sticky; top: calc(var(--topbar-h) + 16px);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 18px; box-shadow: var(--shadow-s);
}
.sidepanel h2 { font-size: 0.95rem; font-weight: 700; margin: 0 0 3px; }
.sidehint { color: var(--muted); font-size: 0.78rem; margin: 0 0 12px; }
.place-list { display: flex; flex-direction: column; }
.place-row { display: flex; gap: 10px; align-items: flex-end; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line-soft); color: var(--ink); }
.place-row:last-child { border-bottom: 0; }
/* Distance label sits bottom-right, small and quiet; must never wrap ("Fuori mano"
   split under its icon looks broken). */
.place-row .dist-label { flex: none; white-space: nowrap; font-size: 0.68rem; }
.place-row .dist-label .material-symbols-outlined { font-size: 14px; }
.place-row:hover .place-main strong { color: var(--red-dark); }
.place-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.place-main strong { font-size: 0.85rem; line-height: 1.2; transition: color var(--t-fast); overflow-wrap: anywhere; }
.place-main span { color: var(--muted); font-size: 0.74rem; line-height: 1.25; overflow-wrap: anywhere; }

/* A second titled block inside a sidepanel (e.g. LARP under RPG groups). */
.side-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

.side-details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.side-details > summary, .nested-details > summary { cursor: pointer; color: var(--ink); font-size: 0.82rem; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 6px; }
.side-details > summary::before, .nested-details > summary::before { content: "chevron_right"; font-family: "Material Symbols Outlined"; font-size: 18px; color: var(--faint); transition: transform var(--t-fast); }
.side-details[open] > summary::before, .nested-details[open] > summary::before { transform: rotate(90deg); }
.nested-details { margin-top: 8px; }
.nested-details > summary { font-weight: 600; font-size: 0.8rem; }
.mini-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.mini-row { display: flex; flex-direction: column; gap: 1px; }
.mini-row strong { font-size: 0.8rem; }
.mini-row span, .research-items { color: var(--muted); font-size: 0.74rem; line-height: 1.4; }
.research-items { margin: 6px 0 0; }

/* ---------- Empty / section titles ---------- */
.empty { color: var(--muted); background: var(--paper); border: 1px dashed var(--line); border-radius: var(--radius-l); padding: 32px 24px; text-align: center; }
.empty code { background: var(--cream-2); padding: 1px 6px; border-radius: 4px; font-size: 0.85em; }
/* The inline heart in the favourites empty-state: the real (red) Material favourite icon. */
.fav-empty-heart { color: var(--red); font-size: 1.15em; vertical-align: -3px; }
.section-title { display: inline-flex; align-items: center; margin: 30px 0 12px; color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; cursor: pointer; }

/* ============================================================
   FORMS (settings, delete)
   ============================================================ */
form.stack { display: flex; flex-direction: column; gap: 18px; max-width: 560px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 24px; box-shadow: var(--shadow-s); }
form.stack > div { display: flex; flex-direction: column; gap: 6px; }
form.stack label { font-weight: 600; font-size: 0.9rem; }
form.stack input[type=text], form.stack input[type=email], form.stack select {
  font: inherit; width: 100%; color: var(--ink); background: var(--cream-2);
  border: 1px solid transparent; border-radius: var(--radius-s); padding: 10px 12px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
form.stack input:focus, form.stack select:focus { outline: none; background: var(--paper); border-color: var(--red); }
.helptext { color: var(--muted); font-size: 0.8rem; font-weight: 400; }
.danger { color: var(--red-dark); font-weight: 600; }
.errorlist { color: var(--red-dark); list-style: none; padding: 0; margin: 4px 0; font-size: 0.85rem; }

/* Settings */
.settings-stack { display: flex; flex-direction: column; gap: 16px; width: 100%; max-width: min(1120px, 100%); }
.settings-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 20px; box-shadow: var(--shadow-s);
}
.settings-card--row {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
}
.settings-card__head { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.settings-card__icon {
  width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: var(--radius-s); background: var(--red-soft); color: var(--red);
}
.settings-card h2 { font-size: 1rem; font-weight: 700; letter-spacing: 0; margin: 0 0 3px; }
.settings-card p { color: var(--muted); margin: 0; font-size: 0.88rem; }
.settings-form { display: flex; flex-direction: column; gap: 18px; }
.settings-section { display: flex; flex-direction: column; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.settings-section:last-of-type { padding-bottom: 0; border-bottom: 0; }
.field-row { display: flex; flex-direction: column; gap: 6px; }
.field-row label { font-weight: 600; font-size: 0.9rem; }
.field-row select,
.field-row input[type="email"],
.field-row input[type="password"],
.field-row input[type="number"],
.field-row input[type="text"] {
  font: inherit; width: 100%; color: var(--ink); background: var(--cream-2);
  border: 1px solid transparent; border-radius: var(--radius-s); padding: 10px 12px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.field-row select:focus,
.field-row input[type="email"]:focus,
.field-row input[type="password"]:focus,
.field-row input[type="number"]:focus,
.field-row input[type="text"]:focus { outline: none; background: var(--paper); border-color: var(--red); }
.invite-field { max-width: 420px; }
.settings-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.settings-actions--inline { justify-content: flex-end; }
.settings-card[hidden], .settings-actions[hidden] { display: none; }   /* their display:flex beats the hidden attr */

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--red); color: #fff; border: 1px solid var(--red);
  border-radius: var(--radius-s); padding: 10px 18px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn:active { transform: translateY(1px); }
.btn .material-symbols-outlined { font-size: 19px; }
.btn.secondary { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: var(--cream-2); border-color: var(--line); }
.btn--danger { background: var(--paper); color: var(--red-dark); border-color: var(--line); }
.btn--danger:hover { background: var(--red-soft); color: var(--red-dark); border-color: var(--red-ring); }

/* Privacy link at the bottom of Settings (was a site-wide footer) */
.settings-privacy { color: var(--faint); font-size: 0.8rem; text-align: center; margin: 22px 0 4px; }
.settings-privacy a { color: inherit; }

/* ============================================================
   AUTH SHELL — login / request access (anonymous)
   ============================================================ */
.layout--auth { display: grid; place-items: center; min-height: 100vh; padding: 24px; background:
  linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px) 0 0 / 26px 26px,
  linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px) 0 0 / 26px 26px,
  radial-gradient(90% 70% at 50% -10%, rgba(225,29,42,0.22), transparent 60%),
  linear-gradient(180deg, #1b1922, #141319); }
.authshell { width: 100%; max-width: 390px; }
.authbrand { display: flex; align-items: center; gap: 12px; justify-content: center; margin-bottom: 22px; }
.authbrand .brand__mark { width: 44px; height: 44px; border-radius: 10px; padding: 5px; }
.authbrand .brand__name { color: #fff; font-size: 1.7rem; }
.authbrand .brand__name b { color: var(--red); }
.authtag { text-align: center; color: rgba(255,255,255,0.74); font-size: 0.92rem; margin: 0 0 22px; }

.auth-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 26px 24px; box-shadow: var(--shadow-m); }
.auth-card h1 { font-size: 1.3rem; font-weight: 700; margin: 0 0 4px; }
.auth-card h2 { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 18px 0 10px; }
.auth-card p { color: var(--muted); font-size: 0.92rem; }
.auth-card hr { border: 0; border-top: 1px solid var(--line-soft); margin: 18px 0; }

/* allauth emits class-less elements — style them in scope */
.auth-card form p { display: flex; flex-direction: column; gap: 5px; margin: 0 0 12px; color: var(--text); }
.auth-card label { font-weight: 600; font-size: 0.85rem; }
.auth-card input[type=text], .auth-card input[type=email], .auth-card input[type=password] {
  font: inherit; width: 100%; color: var(--ink); background: var(--cream-2);
  border: 1px solid transparent; border-radius: var(--radius-s); padding: 11px 13px;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.auth-card input:focus { outline: none; background: var(--paper); border-color: var(--red); }
.auth-card button[type=submit] {
  width: 100%; background: var(--red); color: #fff; border: 1px solid var(--red);
  border-radius: var(--radius-s); padding: 11px 16px; font: inherit; font-weight: 600; cursor: pointer;
  transition: background var(--t-fast);
}
.auth-card button[type=submit]:hover { background: var(--red-dark); }
/* Social provider list (Google) */
.auth-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.auth-card ul a {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: var(--radius-s);
  background: var(--ink); color: #fff; font-weight: 600; font-size: 0.92rem;
  transition: background var(--t-fast);
}
.auth-card ul a:hover { background: var(--ink-2); }

/* Login card — branded, centred, echoes the landing hero (invite pill + 1-click Google) */
.login { text-align: center; }
.login__badge {
  display: inline-block; margin: 0 0 16px; padding: 0; border-radius: 0;
  background: transparent; color: var(--ink-3);
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em;
}
.auth-card .login h1 { font-size: 1.35rem; margin: 0 0 6px; }
.login__lede { color: var(--muted); font-size: 0.92rem; margin: 0 auto 20px; max-width: 28ch; }
.gbtn--block { width: 100%; justify-content: center; padding: 13px 18px; font-size: 1rem; }
.login__fine { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--faint); font-size: 0.78rem; margin: 14px 0 0; }
.login__fine .material-symbols-outlined { font-size: 16px; }

/* ============================================================
   LANGUAGE TOGGLE (topbar EN / IT)
   ============================================================ */
.langtoggle { display: inline-flex; gap: 2px; padding: 2px; background: var(--paper); border: 1px solid rgba(0,0,0,0.12); border-radius: 999px; }
.langtoggle .lang {
  border: 0; background: transparent; cursor: pointer; font: inherit; font-weight: 700;
  font-size: 0.72rem; letter-spacing: 0.04em; color: #8a8a8a; padding: 4px 10px;
  border-radius: 999px; transition: background 0.15s ease, color 0.15s ease;
}
.langtoggle .lang:hover { color: var(--ink); }
.langtoggle .lang.is-active { background: var(--red); color: #fff; }

/* Dark variant — reads on the landing hero's dark pixel field */
.langtoggle--dark { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.16); }
.langtoggle--dark .lang { color: rgba(255,255,255,0.6); }
.langtoggle--dark .lang:hover { color: #fff; }
.langtoggle--dark .lang.is-active { background: var(--red); color: #fff; }
.langtoggle--lg { padding: 3px; margin-bottom: 4px; }
.langtoggle--lg .lang { padding: 8px 22px; font-size: 0.9rem; }
.lp-lang { position: absolute; top: 18px; right: 18px; z-index: 2; }

/* ============================================================
   REVEALS (calm fade-up)
   ============================================================ */
/* Scroll-reveal. Default is VISIBLE so there is no flash of blank content on first paint
   (the old `.reveal { opacity:0 }` hid every card until the body-end JS ran — a FOUC on every
   page load, and a permanent blank if JS was slow/off). The JS adds `is-pending` ONLY to cards
   that start below the fold, so on-screen content renders instantly while off-screen cards still
   fade in as you scroll. */
.reveal { opacity: 1; }
.reveal.is-pending { opacity: 0; transform: translateY(16px); transition: opacity 0.5s var(--ease-reveal), transform 0.5s var(--ease-reveal); }
.reveal.is-pending.is-revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal.is-pending { opacity: 1; transform: none; transition: none; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  /* Drawer: wider than the desktop rail (Material's min(320, vw-56)), and
     overscroll-behavior stops a drag inside it from chaining to the page. */
  .sidebar {
    transform: translateX(-100%); box-shadow: var(--shadow-m);
    width: min(320px, calc(100vw - 56px)); max-width: none;
    overscroll-behavior: contain;
  }
  html.sb-open .sidebar { transform: none; }
  /* Lock the page while the drawer is open — otherwise dragging on the drawer
     or the backdrop scrolled the feed behind it (two scroll surfaces fighting).
     touch-action: none is what actually stops backdrop drag on iOS. */
  html.sb-open, html.sb-open body { overflow: hidden; }
  html.sb-open body { touch-action: none; }
  .main { margin-left: 0; }
  .topbar { display: flex; }
  .hamburger { display: inline-flex; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.4); opacity: 0; pointer-events: none; transition: opacity var(--t); z-index: 90; }
  html.sb-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
}

@media (max-width: 880px) {
  /* minmax(0,…), not bare 1fr: wide content (book rows, tab strips) must shrink/scroll,
     not blow the column past the viewport. */
  .page-with-sidebar { grid-template-columns: minmax(0, 1fr); }
  .sidepanel { position: static; padding: 16px; }
  .place-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 0 18px;
  }
  .place-row { min-width: 0; }
  .distance-pick { min-width: 0; }
  .distance-pick__options { flex-wrap: wrap; width: auto; }
  .settings-card--row { align-items: flex-start; flex-direction: column; }
  .settings-actions--inline { justify-content: flex-start; }
}

@media (max-width: 640px) {
  :root { --topbar-h: 58px; }
  body { font-size: 14px; }
  .topbar { padding: 0 12px; }
  .hamburger { width: 42px; height: 42px; }
  .content { padding: 16px 12px 40px; }
  .content > h1 { font-size: 1.42rem; }
  .page-head { gap: 10px; margin-bottom: 14px; align-items: flex-start; }
  .page-head h1 { font-size: 1.42rem; }
  .sub { margin: 4px 0 16px; font-size: 0.88rem; }

  .notice {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 10px;
    padding: 12px;
    border-radius: 14px;
  }
  .notice .btn {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: center;
  }

  .filters {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 10px;
    align-items: start;
    padding: 14px;
    margin-bottom: 22px;
    border-radius: 16px;
  }
  /* The genre picker rides the FULL row: its field keeps a 220px min-width (desktop
     combobox), which overflows a half-width column — and since the dropdown is
     width:100% of the picker, the panel ended up NARROWER than the input you type in,
     reading as cropped. Full row + min-width:0 keeps field and panel the same width. */
  .filters > label:first-child,
  .filters > .genre-picker,
  .filters > .distance-pick,
  .filters > noscript { grid-column: 1 / -1; }
  .filters > label,
  .filters > .interest-picker,
  .filters > .genre-picker,
  .filters > .distance-pick { min-width: 0; width: 100%; }
  .filters label,
  .interest-picker,
  .distance-pick { gap: 4px; }
  .filters input,
  .filters select,
  .interest-picker__toggle {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    font-size: 0.86rem;
  }
  .interest-picker__toggle { padding: 8px 9px; gap: 7px; }
  .interest-picker__toggle > .material-symbols-outlined,
  .interest-picker__caret { font-size: 17px; }
  .interest-picker__panel {
    width: calc(100vw - 32px);
    max-height: min(440px, 64vh);
    overflow-y: auto;
    padding: 12px;
    border-radius: 14px;
  }
  .filters > .interest-picker:nth-of-type(2) .interest-picker__panel {
    left: auto;
    right: 0;
  }

  .distance-pick__options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }
  .filters .dchip {
    flex-direction: column;
    gap: 4px;
    width: 100%;
    min-width: 0;
    min-height: 58px;
    padding: 7px 6px;
    font-size: 0.68rem;
    line-height: 1.12;
    text-align: center;
    letter-spacing: 0.02em;
  }
  .filters .dchip .material-symbols-outlined { font-size: 20px; }
  .filters .dchip span:last-child { white-space: normal; overflow-wrap: anywhere; }

  .feed-controls {
    display: block;
    margin: 0 0 14px;
  }
  .feed-datebar {
    width: 100%;
    gap: 5px;
  }
  .feed-datefield { flex: 1 1 0; }
  .date-menu__button {
    min-width: 0;
    font-size: 0.8rem;
    padding-left: 7px;
  }
  .feed-datefield--day { flex: 0.8 1 0; }
  .view-toggle { margin-left: auto; }
  .view-toggle button { padding: 6px 10px; font-size: 0.71rem; }
  .tabs {
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 1px;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: 0 0 auto;
    padding: 9px 10px;
    font-size: 0.84rem;
  }
  .tab .material-symbols-outlined { font-size: 18px; }
  .tab__count { padding: 3px 6px; }
  .week-band { margin-top: 24px; font-size: 1rem; gap: 9px; }
  .day-head { margin: 20px 0 10px; font-size: 0.92rem; }

  .cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .card { padding: 15px; border-radius: 14px; gap: 9px; }
  .card:hover { transform: none; }
  .card h3 { font-size: 1rem; }
  .card__media img,
  .card__media--empty .card__noimg { height: 136px; }
  .card .when { gap: 5px; font-size: 0.8rem; }
  .card .desc { -webkit-line-clamp: 3; line-clamp: 3; font-size: 0.86rem; }
  .card .meta { gap: 8px 12px; }
  .cat-label,
  .dist-label { max-width: 100%; }
  .cat-label { font-size: 0.74rem; }
  .cardlinks { gap: 8px; }
  .cardlinks a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cardlinks__favorite { flex: 0 0 auto; }
  .sidepanel {
    border-radius: 14px;
    padding: 14px;
  }
  .sidepanel h2 { font-size: 0.9rem; }
  .sidehint { margin-bottom: 8px; }
  .place-list {
    display: flex;
    flex-direction: column;
  }
  .place-row { padding: 10px 0; }
  .empty { padding: 24px 18px; border-radius: 14px; }

  .layout--auth { padding: 18px 12px; align-items: start; }
  .authshell { max-width: 100%; }
  .authbrand .brand__mark { width: 38px; height: 38px; }
  .authbrand .brand__name { font-size: 1.38rem; }
  .auth-card { padding: 22px 18px; border-radius: 14px; }

  form.stack,
  .settings-stack,
  .settings-card { max-width: none; }
  form.stack,
  .settings-card { padding: 18px 16px; border-radius: 14px; }
  .settings-card__head { gap: 10px; }
  .settings-card__icon { width: 32px; height: 32px; }
  .settings-actions,
  .settings-actions--inline { width: 100%; }
  .settings-actions .btn,
  .settings-actions--inline .btn,
  form.stack .btn { width: 100%; justify-content: center; }
  .langtoggle--lg { width: 100%; }
  .langtoggle--lg .lang { flex: 1 1 0; text-align: center; padding-inline: 10px; }
  .locmap { height: min(420px, 56vh); border-radius: 14px; }

  .dash-health { align-items: flex-start; padding: 12px; border-radius: 14px; }
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .dash-table-wrap { border-radius: 14px; }
}

@media (max-width: 360px) {
  .filters { grid-template-columns: 1fr; }
  .filters > .interest-picker:nth-of-type(2) .interest-picker__panel {
    left: 0;
    right: auto;
  }
  .feed-datebar { flex-wrap: wrap; }
  .feed-datebar__icon { display: none; }
  .feed-datefield { flex: 1 1 100%; }
  .feed-datefield + .feed-datefield {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid var(--line-soft);
    padding-top: 4px;
  }
  .distance-pick__options { gap: 6px; }
  .filters .dchip { font-size: 0.64rem; padding-inline: 4px; }
  .view-toggle { gap: 10px; }
}

/* ============================================================
   LANDING — public marketing page at "/" (anonymous visitors)
   ============================================================ */
.lp { background: #141319; display: flex; flex-direction: column; min-height: 100vh; }

/* Hero — dark pixel-grid field with the spritz logo + pixel wordmark */
.lp-hero {
  position: relative; flex: 1 1 auto; min-height: 92vh; display: grid; place-items: center;
  text-align: center; padding: 84px 24px 44px; overflow: hidden;
  background:
    linear-gradient(rgba(255,255,255,0.035) 2px, transparent 2px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(255,255,255,0.035) 2px, transparent 2px) 0 0 / 40px 40px,
    radial-gradient(85% 60% at 50% -6%, rgba(225,29,42,0.24), transparent 60%),
    linear-gradient(180deg, #1b1922 0%, #141319 100%);
}
.lp-hero__inner { position: relative; max-width: 760px; }
.lp-logo {
  width: 104px; height: 104px; margin: 0 auto 24px; display: grid; place-items: center;
  background: #fff; border-radius: 22px; padding: 13px;
  box-shadow: 0 12px 34px -10px rgba(0,0,0,0.6);
}
.lp-logo img { width: 100%; height: 100%; display: block; }
.lp-wordmark {
  font-family: "Bitcount Single", "Montserrat", system-ui, sans-serif;
  color: #fff; font-weight: 400; line-height: 1; letter-spacing: 0.02em; margin: 0;
  font-size: clamp(2.3rem, 6.6vw, 4rem);
}
.lp-wordmark b { color: var(--red); font-weight: 400; }
.lp-tag { color: rgba(255,255,255,0.76); font-size: clamp(1rem, 2.4vw, 1.2rem); margin: 18px auto 8px; max-width: 32ch; }
.lp-note { color: rgba(255,255,255,0.42); font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; margin: 0 0 30px; }
.lp-cta {
  display: inline-flex; align-items: center; gap: 9px;
  background: var(--red); color: #fff; font-weight: 600; font-size: 1rem;
  padding: 13px 26px; border-radius: var(--radius-s);
  box-shadow: 0 10px 26px -8px rgba(225,29,42,0.65);
  transition: background var(--t-fast), transform var(--t-fast);
}
.lp-cta:hover { background: var(--red-dark); transform: translateY(-1px); }
.lp-cta:active { transform: translateY(0); }
.lp-cta .material-symbols-outlined { font-size: 20px; }

.lp-foot {
  background: #141319; color: rgba(255,255,255,0.5); font-size: 0.82rem;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 4px 16px; padding: 20px clamp(20px, 5vw, 40px);
}
.lp-foot a { color: rgba(255,255,255,0.8); }

/* ---------- Staff source-health panel (left sidebar, staff only) ---------- */
.sysstatus {
  margin: var(--space-s) 0 0;
  padding: 10px var(--space-s) 11px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-m);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
  color: var(--sidebar-fg);
}
.sysstatus--alert { border-color: var(--red-ring); background: var(--red-soft); }
.sysstatus__head { display: flex; align-items: center; gap: 6px; font-weight: 700; letter-spacing: 0.02em; color: var(--sidebar-fg-on); }
.sysstatus__head .material-symbols-outlined { font-size: 18px; }
.sysstatus--ok    .sysstatus__head .material-symbols-outlined { color: #5BD08C; }
.sysstatus--alert .sysstatus__head .material-symbols-outlined { color: #FF8A8A; }
.sysstatus__title { flex: 1 1 auto; }
.sysstatus__badge { min-width: 19px; height: 19px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--red); color: #fff; font-weight: 700; font-size: 11px; text-align: center; line-height: 19px; }

.sysstatus__list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 9px; }
.sysstatus__item { display: flex; align-items: flex-start; gap: 8px; }
.sysstatus__dot { margin-top: 5px; width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.sysstatus__dot--down { background: #FF5B66; box-shadow: 0 0 0 3px rgba(255,91,102,0.15); }
.sysstatus__dot--warn { background: #F0A500; }
.sysstatus__dot--info { background: rgba(255,255,255,0.40); }

.sysstatus__body { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; }
.sysstatus__top { display: flex; align-items: baseline; gap: 8px; }
.sysstatus__name { flex: 1 1 auto; min-width: 0; color: var(--sidebar-fg-on); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sysstatus__count { flex: 0 0 auto; color: var(--sidebar-fg); font-size: 11px; font-variant-numeric: tabular-nums; }

.sysstatus__bot { display: flex; align-items: center; gap: 7px; min-width: 0; }
.sysstatus__tag { flex: 0 0 auto; padding: 1px 7px; border-radius: var(--radius-pill); font-size: 10px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; white-space: nowrap; }
.sysstatus__tag--down { background: rgba(255,91,102,0.18); color: #FF9AA1; }
.sysstatus__tag--warn { background: rgba(240,165,0,0.18); color: #F4B740; }
.sysstatus__tag--info { background: rgba(255,255,255,0.10); color: var(--sidebar-fg); }
.sysstatus__slug { flex: 1 1 auto; min-width: 0; color: rgba(255,255,255,0.38); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.sysstatus__note { margin: 10px 0 0; color: var(--sidebar-fg); line-height: 1.45; }
.sysstatus__note--ok { margin: 6px 0 0; color: rgba(255,255,255,0.5); }
.sysstatus__note a { color: var(--sidebar-fg-on); text-decoration: underline; white-space: nowrap; }

/* ============================================================
   MAP — quartieri + macro-category explorer (events/map.html)
   ============================================================ */
.mapfilters {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: start;
  gap: 14px 18px; margin: 16px 0 14px;
}
.mapdates { align-self: start; }
.mapdates .date-menu__button { min-width: 172px; }
.mapcatwrap { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.maphelp { margin: 0; font-size: 0.72rem; color: var(--muted); }
.mapmeta { margin: 0 0 10px; }
.mapmeta strong { font-size: 1.15rem; font-weight: 800; color: var(--ink); }
.mapmeta span { color: var(--muted); font-size: 0.84rem; }
.mapcanvas--full { height: clamp(480px, 74vh, 780px); }

/* Category filter — tri-state chips mirroring the weekly feed's interest picker. Click cycles
   off -> include -> exclude; double-click solos. The colour lives in the icon; the chip's own
   look carries the state (include = tinted, exclude = dimmed + struck). --cat = its brand hue.
   The whole group sits in a subtle inset tray so the 15 chips read as one tidy palette. */
.mapcats {
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 5px;
  padding: 7px; border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--paper); max-width: none; box-shadow: var(--shadow-xs);
}
.mapcat {
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; font: inherit;
  font-size: 0.76rem; font-weight: 600; line-height: 1; color: var(--ink); user-select: none;
  background: var(--cream-2); border: 1px solid transparent; border-radius: 8px; padding: 5px 8px;
  transition: background var(--t-fast), border-color var(--t-fast), opacity var(--t-fast);
}
.mapcat:hover { background: var(--paper); border-color: var(--line); }
.mapcat__icon { font-size: 17px; line-height: 1; flex: none; color: var(--cat, #6B7280); }
.mapcat__label { white-space: nowrap; }
.mapcat[data-state="in"] {
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  border-color: color-mix(in srgb, var(--cat) 45%, transparent);
}
.mapcat[data-state="out"] { opacity: 0.4; }
.mapcat[data-state="out"] .mapcat__icon { filter: grayscale(1); }
.mapcat[data-state="out"] .mapcat__label { text-decoration: line-through; }

@media (max-width: 560px) { .mapcats { max-width: none; } }

/* Side-panel readout of the hovered neighbourhood + its count (replaces the floating tooltip). */
.maphover { font-size: 0.82rem; font-weight: 700; color: var(--red-dark); min-height: 1.1em; margin: 0 0 6px; }
.maphover:empty { display: none; }

/* Clicking a Leaflet polygon focuses its SVG <path>, which the browser rings with a black
   bounding-box outline (the "weird black border"). Drop it — selection shows via the dashed
   red style instead. Keyboard focus is unaffected (paths aren't in the tab order). */
.leaflet-interactive:focus { outline: none; }

.maplayout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: clamp(16px, 2vw, 24px); align-items: start; }
.mapcanvas {
  position: relative; z-index: 0;  /* own stacking context: Leaflet's high z-indexes stay inside */
  height: clamp(420px, 64vh, 620px); border-radius: var(--radius-l); overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-s); background: var(--cream-2);
}
.mappanel {
  position: sticky; top: calc(var(--topbar-h) + 16px);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: 16px; box-shadow: var(--shadow-s);
  max-height: clamp(420px, 64vh, 620px); display: flex; flex-direction: column;
}
.mappanel__head { display: flex; align-items: baseline; gap: 6px; margin: 0 0 4px; }
.mappanel__head strong { font-size: 1.3rem; font-weight: 800; color: var(--ink); line-height: 1; }
.mappanel__head span { color: var(--muted); font-size: 0.84rem; }
.mappanel__head .linklike { margin-left: auto; }
.mappanel .sidehint { margin: 0 0 10px; }
.mapchips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.mapchips:empty { display: none; }
.qchip {
  display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
  font: inherit; font-size: 0.74rem; font-weight: 700; line-height: 1; color: #fff;
  background: var(--red); border: 0; border-radius: var(--radius-pill); padding: 5px 7px 5px 11px;
  transition: background var(--t-fast);
}
.qchip:hover { background: var(--red-dark); }
.qchip .material-symbols-outlined { font-size: 15px; }
.maplist { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1 1 auto; min-height: 0; }
.maprow { display: flex; gap: 9px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.maprow:last-child { border-bottom: 0; }
.maprow__dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; flex: none; }
.maprow__main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.maprow__main strong { font-size: 0.86rem; line-height: 1.25; color: var(--ink); transition: color var(--t-fast); }
.maprow:hover .maprow__main strong { color: var(--red-dark); }
.maprow__main span { color: var(--muted); font-size: 0.74rem; }
.mappanel .empty { padding: 18px 14px; }

/* Leaflet popup, scoped to win over the later-loaded leaflet.css (equal specificity) */
.maplayout .leaflet-popup-content, .homes .leaflet-popup-content { font-family: "Montserrat", system-ui, sans-serif; font-size: 0.84rem; line-height: 1.45; margin: 12px 14px; }
.maplayout .leaflet-popup-content a, .homes .leaflet-popup-content a { color: var(--red-dark); font-weight: 700; }

/* Saved location preview. */
.locmap {
  position: relative; z-index: 0;
  height: clamp(300px, 42vh, 420px); border-radius: var(--radius-m); overflow: hidden;
  border: 1px solid var(--line); margin: 6px 0 10px; background: var(--cream-2);
}

@media (max-width: 880px) {
  .mapfilters { grid-template-columns: 1fr; }
  .mapdates,
  .mapdates .date-menu,
  .mapdates .date-menu__button { width: 100%; }
  .mapcats { max-height: 190px; overflow-y: auto; }
  .maplayout { grid-template-columns: 1fr; }
  .mappanel { position: static; max-height: none; }
  .maplist { max-height: 360px; }
}

@media (max-width: 640px) {
  .mapfilters { gap: 10px; margin-bottom: 10px; }
  .mapdates { padding: 5px; }
  .mapdates .feed-datebar__icon { display: none; }
  .mapdates .date-menu__button { min-width: 0; min-height: 38px; }
  .mapcats {
    gap: 4px;
    padding: 6px;
    max-height: 150px;
    border-radius: 12px;
  }
  .mapcat {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    padding: 7px 7px;
    font-size: 0.72rem;
  }
  .mapcat__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mapmeta { margin-bottom: 8px; }
  .mapcanvas--full,
  .mapcanvas { height: min(520px, 62vh); border-radius: 14px; }
  .leaflet-control-container .leaflet-top,
  .leaflet-control-container .leaflet-bottom { z-index: 450; }
}

/* ============================================================
   FEED v5 (2026-07) — macro-tab toolbar + one visible controls row (no popovers)
   ============================================================ */

/* Day headers: weekday leads (the datum you scan for), date + count support it, and the
   whole row STICKS (just under the toolbar) while its day's cards scroll under —
   calendar-style orientation in a long feed. */
:root { --feed-toolbar-h: 56px; }
/* Sticky-stack bookkeeping: the controls row (dates/fonte/distance/view) sticks under the
   toolbar on every viewport, so the day heads must dock BELOW it. --feed-controls-h is
   measured live in feed.html (a ResizeObserver, so the taller phone layout is covered). */
:root { --feed-sticky-controls-h: var(--feed-controls-h, 0px); }
/* A paper band, same chrome as the filter card — so when it sticks it docks FLUSH under
   the tab card (top overlaps the card's edge by 2px: no cream sliver between them). */
.day-head {
  display: flex; align-items: baseline; gap: 8px;
  position: sticky; top: calc(var(--feed-toolbar-h) + var(--feed-sticky-controls-h) - 2px); z-index: 10;
  margin: 24px 0 12px; padding: 9px 14px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m);
}
.day-head__name { font-weight: 700; }
.day-head__date { font-weight: 500; color: var(--muted); font-size: 0.88em; }
.day-head__count {
  margin-left: auto; font-size: 0.72rem; font-weight: 700; color: var(--muted);
  background: var(--cream-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 2px 8px; line-height: 1.3;
}

/* THE TOOLBAR — replaces the old white filter card entirely: one quiet sticky row (search +
   macro tabs), so the events start basically at the top. The fine controls live VISIBLY in
   the results' controls row, next to the date menus. */
/* ONE component: the filter panel is a single white card — tabs + sub-tabs in the sticky
   top half (.feed-filters), the controls row (dates/fonte/distance, AJAX-swapped) fused on
   as the card's bottom half (see .feed-controls below). Sticky lives on the WRAPPER
   (.feed-filters): the form's own parent is only as tall as itself, so sticking the form
   would stop the moment its parent scrolls off — the wrapper participates in the tall
   .feed-shell instead. Its height is mirrored into --feed-toolbar-h by a ResizeObserver in
   feed.html, which keeps the day headers sticking exactly underneath. */
.feed-shell .feed-filters {
  position: sticky; top: 0; z-index: 30;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-l) var(--radius-l) 0 0; border-bottom: 0;
  padding: 4px 14px 0;
}
.filters--toolbar {
  display: block; margin: 0; padding: 0;
  background: transparent; border: 0; border-radius: 0; box-shadow: none;
}
.ftoolbar { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; min-height: 62px; }
/* The search label needs the .filters--toolbar prefix to out-rank the generic
   `.filters label` column layout. */
.filters--toolbar .ftoolbar__search {
  display: flex; flex-direction: row; align-items: center; gap: 6px; flex: none;
  font-size: inherit; font-weight: 400; text-transform: none; letter-spacing: 0;
  background: var(--cream-2); border: 1px solid transparent; border-radius: 999px;
  padding: 0 4px 0 10px; transition: border-color var(--t-fast), background var(--t-fast);
}
.filters--toolbar .ftoolbar__search:focus-within { background: var(--paper); border-color: var(--red); }
.filters--toolbar .ftoolbar__search > .material-symbols-outlined { font-size: 17px; color: var(--faint); flex: none; }
.filters--toolbar .ftoolbar__search input {
  width: 110px; min-width: 0; font: inherit; font-size: 0.86rem; color: var(--ink);
  background: transparent; border: 0; padding: 8px 6px 8px 0; transition: width var(--t-fast);
}
.filters--toolbar .ftoolbar__search input:focus { outline: none; width: 170px; background: transparent; border-color: transparent; }

/* Macro tabs — Meetup-style: icon over label, underline marks the active one. Single
   select; "Tutti" is the reset. Short labels + flex:1 keep every tab the SAME width. */
.fam-tabs { display: flex; align-items: stretch; gap: 2px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.fam-tabs::-webkit-scrollbar { display: none; }
.ftab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  flex: 1 1 0; min-width: 0; cursor: pointer; padding: 10px 10px 11px;
  font: inherit; font-size: 0.86rem; font-weight: 600; line-height: 1; color: var(--muted);
  background: none; border: 0; border-bottom: 2px solid transparent;
  transition: color var(--t-fast), border-color var(--t-fast);
}
.ftab:hover { color: var(--ink); }
.ftab__icon { font-size: 23px; color: var(--fam, var(--faint)); transition: transform var(--t-fast); }
.ftab:hover .ftab__icon { transform: translateY(-1px); }
.ftab.is-active { color: var(--ink); border-bottom-color: var(--fam, var(--ink)); }
.ftab__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Preferite's companion: a small round "edit in Settings" control ON the tab face, right
   of the heart (an <a> can't nest in the tab <button>, so tab + link share a wrapper and
   the link is absolutely placed on the icon row). 24px target — touch-ok. */
.ftab-wrap { position: relative; display: flex; flex: 1 1 0; min-width: 0; }
.ftab-wrap .ftab { flex: 1 1 auto; width: 100%; }
.ftab__edit {
  position: absolute; top: 7px; left: calc(50% + 16px);
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  color: var(--red); background: var(--red-soft); border: 1px solid var(--red-ring);
  text-decoration: none;
}
.ftab__edit:hover { background: var(--red); color: #fff; }
.ftab__edit .material-symbols-outlined { font-size: 14px; }
.ftab__edit[hidden] { display: none; }

/* Subcategory tabs: a smaller second line of the same tab language. */
.sub-tabs { padding: 2px 0 8px; }
.sub-tabs[hidden] { display: none; }
.sub-tabs__group { display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.sub-tabs__group[hidden] { display: none; }
.ftab--sub {
  flex: none; flex-direction: row; gap: 6px; padding: 8px 12px; font-size: 0.84rem;
  border-bottom-width: 2px;
}
.ftab--sub.is-active { color: var(--ink); border-bottom-color: var(--cat, var(--fam, var(--ink))); }
.ftab__subicon { font-size: 17px; color: var(--cat, var(--fam, var(--faint))); flex: none; }

/* Settings: the Categories card — sidebar sections + favourite categories as ONE chip
   language with ONE save. The native checkbox is hidden; a chip is its own control:
   neutral at rest, category-tinted with a check glyph when selected. */
.favcat-block { margin-top: 4px; }
.favcat-block + .favcat-block { margin-top: 20px; }
.favcat-block__cap {
  display: block; font-size: 0.78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink);
}
.favcat-block__hint { margin: 2px 0 10px; font-size: 0.8rem; color: var(--muted); }
/* Card grid at every width (owner: desktop pills looked "shitty" next to the mobile grid).
   auto-fill keeps cards ~180px+ wide; grid-auto-rows 1fr = uniform heights. */
.favcat-group__choices {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-auto-rows: 1fr; gap: 8px;
}
.favcat-choice {
  position: relative; display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  min-width: 0; font-size: 0.86rem; font-weight: 600; color: var(--muted);
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-s);
  padding: 9px 14px; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.favcat-choice span:last-of-type { overflow-wrap: anywhere; }
.favcat-choice:hover { border-color: color-mix(in srgb, var(--cat) 55%, transparent); color: var(--ink); }
.favcat-choice .material-symbols-outlined { font-size: 17px; color: var(--cat, var(--faint)); }
.favcat-choice input {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.favcat-choice:has(input:checked) {
  background: color-mix(in srgb, var(--cat) 13%, transparent);
  border-color: color-mix(in srgb, var(--cat) 55%, transparent);
  color: var(--ink);
}
/* Selected chip shows a check glyph. Its 15px slot is ALWAYS reserved (opacity
   fade, not width growth) — the old width animation reflowed the label, so a chip
   wrapped to two lines the moment you clicked it and the whole grid jumped. */
.favcat-choice::after {
  content: "check"; font-family: "Material Symbols Outlined"; font-size: 15px;
  width: 15px; flex: none; margin-left: auto; opacity: 0; color: var(--cat, var(--ink));
  transition: opacity var(--t-fast);
}
.favcat-choice:has(input:checked)::after { opacity: 1; }
.favcat-choice input:focus-visible ~ * { outline: 2px solid var(--red); outline-offset: 2px; }
/* Onboarding: the tiny "has its own sidebar section" star marker on a chip. */
.favcat-choice__star { font-size: 13px; color: var(--warn, #D97706); flex: none; }

/* The controls row = the BOTTOM HALF of the single filter card: it lives in the
   AJAX-swapped results region, but fuses onto .feed-filters visually (same paper, shared
   side borders, bottom radius). Dates + Fonte sit LEFT; distance chips push RIGHT. */
.feed-controls {
  flex-wrap: wrap;
  /* Sticks just under the tab toolbar so the date menus (and the view toggle) stay
     clickable however far you scroll — on phones too (offset in the 1024px block). */
  position: sticky; top: calc(var(--feed-toolbar-h) - 2px); z-index: 20;
  margin: 0 0 22px; padding: 12px 14px;
  background: var(--paper); border: 1px solid var(--line); border-top: 1px solid var(--line-soft);
  border-radius: 0 0 var(--radius-l) var(--radius-l);
}
/* View toggle sits at the tabs row's right end (see _filters.html) — the tabs flex-shrink
   and scroll, so this row never wraps however many date fields the controls row grows. */
.ftoolbar .view-toggle { flex: 0 0 auto; align-self: center; }
.feed-controls .interest-picker__caption { display: none; }
.feed-controls .interest-picker { flex-direction: row; }
/* Inside the card every field is WHITE with a thin border (owner: the grey blobs read as
   one mush) — and the Date + Fonte fields share ONE explicit recipe: same background in
   every state, same radius, same 0.9rem/700 type, same grey caret. Active state = a red
   ring, never a background change. */
.feed-controls .datebar,
.feed-controls .interest-picker__toggle {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m);
  box-shadow: none; font-size: 0.9rem; font-weight: 700; color: var(--ink);
}
.feed-controls .interest-picker__toggle { min-width: 170px; padding: 12px 12px; }
.feed-controls .interest-picker__toggle:hover { background: var(--paper); border-color: var(--faint); }
.feed-controls .interest-picker.is-active .interest-picker__toggle {
  background: var(--paper); border-color: var(--red-ring);
}
.feed-controls .date-menu__button { font-size: 0.9rem; font-weight: 700; color: var(--ink); }
/* Beat `.interest-picker__toggle > .material-symbols-outlined { color: red }` for the
   CARET specifically — the datebar caret is grey, this must match. */
.feed-controls .interest-picker__toggle > .interest-picker__caret { color: var(--faint); font-size: 18px; }
.distance-pick--inline { display: flex; flex-direction: row; align-items: center; gap: 6px; min-width: 0; align-self: center; margin-left: auto; }
.distance-pick--inline .distance-pick__cap { display: none; }
.distance-pick--inline .dchip { background: var(--paper); border-color: var(--line); }
.distance-pick--inline .dchip:hover { border-color: var(--faint); }

/* Family clusters inside the Categorie picker panel: thin colour-tagged captions so the
   fine chips read as small groups. */
.interest-picker__groups { display: flex; flex-direction: column; gap: 10px; }
.interest-group { display: flex; flex-direction: column; gap: 6px; }
.interest-group__cap {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted);
}
.interest-group__cap::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--fam, var(--faint)); flex: none;
}

@media (max-width: 1024px) {
  /* The mobile topbar is sticky at top:0 — the toolbar rides under it, day rows under both.
     The toolbar keeps its single-row shape; family chips scroll horizontally. */
  .feed-shell .feed-filters { top: var(--topbar-h); }
  .feed-controls { top: calc(var(--topbar-h) + var(--feed-toolbar-h) - 2px); }
  .day-head { top: calc(var(--topbar-h) + var(--feed-toolbar-h) + var(--feed-sticky-controls-h) - 2px); }
}
/* The page-head search field (feed) — same quiet pill as the card's inner fields. */
.headsearch {
  display: flex; align-items: center; gap: 6px; flex: none; margin-left: auto;
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
  padding: 0 4px 0 12px; transition: border-color var(--t-fast);
}
.headsearch:focus-within { border-color: var(--red); }
.headsearch > .material-symbols-outlined { font-size: 17px; color: var(--faint); flex: none; }
.headsearch input {
  width: 140px; min-width: 0; font: inherit; font-size: 0.88rem; color: var(--ink);
  background: transparent; border: 0; padding: 9px 8px 9px 0; transition: width var(--t-fast);
}
.headsearch input:focus { outline: none; width: 200px; }

@media (max-width: 640px) {
  /* Tabs stop stretching and scroll horizontally, at a size that keeps ~5 on a phone.
     Search shares the page-head row with the title. */
  .ftab { flex: none; padding: 8px 9px 9px; font-size: 0.72rem; gap: 4px; }
  .ftab-wrap { flex: none; }
  .ftab__icon { font-size: 20px; }
  .ftab--sub { padding: 7px 9px; font-size: 0.76rem; }
  .feed-shell .feed-filters { padding: 0 10px; }
  .ftoolbar { min-height: 56px; gap: 6px; }
  /* Phones: the pinned stack ate half the screen (owner), so it rides in NORMAL FLOW —
     still at the top of the page, just scrolls away. The "Filtri" topbar pill re-opens
     it as a fixed sheet via body.filters-sheet-open (rules at the end of this block).
     Day heads become plain in-flow separators (NOT sticky): the topbar's scroll-spy day
     button (spyDay in feed.html) carries the "which day am I in" job instead. */
  .feed-shell .feed-filters { position: static; }
  .feed-controls { position: static; padding: 10px; gap: 8px; }
  .day-head { position: static; }
  .topbar-filters { display: inline-flex; }
  /* Toggle lives in the tabs row (grid on phones): give it a centered row of its own
     under the tab grid, and let the toolbar wrap to fit it. */
  .ftoolbar { flex-wrap: wrap; }
  .ftoolbar .view-toggle { width: fit-content; margin: 0 auto 8px; }
  /* Date + Fonte become two identical full-width rows. */
  .feed-controls .datebar,
  .feed-controls .interest-picker,
  .feed-controls .interest-picker__toggle { width: 100%; min-width: 0; }
  /* Page head wraps: row 1 = title, row 2 = full-width search. */
  .page-head { flex-wrap: wrap; }
  .page-head .headsearch { order: 3; flex: 1 1 100%; margin-left: 0; }
  .page-head .headsearch input,
  .page-head .headsearch input:focus { flex: 1; width: auto; }
  /* Feed distance chips: 3 equal columns inside the card instead of a nowrap
     pill row that overflowed the viewport. The INLINE variant has no
     .distance-pick__options wrapper (chips are direct children of
     .distance-pick--inline), so the grid goes on the container itself — the
     old wrapper-targeting rule matched nothing and the chips fell back to a
     ragged flex row. Same icon-over-label treatment as .filters .dchip above:
     equal-height cells (stretch, not the inherited center), centered stack. */
  .feed-controls .distance-pick--inline {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch; width: 100%; gap: 8px; margin-left: 0;
  }
  .feed-controls .distance-pick--inline .dchip {
    flex-direction: column; justify-content: center; gap: 4px;
    min-width: 0; min-height: 58px; padding: 7px 6px;
    font-size: 0.68rem; line-height: 1.12; text-align: center; letter-spacing: 0.02em;
  }
  .feed-controls .distance-pick--inline .dchip .material-symbols-outlined { font-size: 20px; }
  .feed-controls .distance-pick--inline .dchip span:last-child { white-space: normal; overflow-wrap: anywhere; }

  /* Macro tabs: 2x4 grid so ALL eight tabs (Tutti · Preferiti · 6 macros) are
     visible at once — the scroll row hid the tail ("Forma…") and nobody
     realised it scrolled. Sub-tabs (.ftab--sub) keep their scroll row. The
     taller toolbar is fine: --feed-toolbar-h is measured live by the
     ResizeObserver in feed.html, so the day-head sticky offset follows. */
  .fam-tabs {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0 2px; width: 100%; overflow: visible;
  }
  .fam-tabs .ftab,
  .fam-tabs .ftab-wrap { width: 100%; min-width: 0; }

  /* Seam under the sticky toolbar: close the card's bottom edge (base style
     leaves it open for the fused controls row) so the tab row never visually
     collides with the day band docking beneath it; a soft shadow lifts the
     card off whatever scrolls under. The controls row drops its own soft top
     border — the toolbar's border is now the divider (one line, not two). */
  .feed-shell .feed-filters {
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 16px -14px rgba(25, 23, 22, 0.35);
  }
  .feed-controls { border-top: 0; }

  /* Sub-tabs grid out too (2 columns — labels are long), same "everything
     visible" language as the macro tabs above. [hidden] must keep winning. */
  .sub-tabs__group {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px; overflow: visible;
  }
  .sub-tabs__group[hidden] { display: none; }
  .sub-tabs__group .ftab--sub {
    width: 100%; min-width: 0; justify-content: center;
    white-space: normal; text-align: center;
  }

  /* Narrow screens: force 2 columns — auto-fill at 180px min would collapse to 1. */
  .favcat-group__choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* THE FILTERS SHEET — body.filters-sheet-open (toggled by the topbar Filtri pill /
     backdrop, see feed.html). Pure CSS on the body class: the sheet's two halves are
     .feed-filters (stable) + .feed-controls (AJAX-swapped), and both pick these rules
     straight back up after a region swap — no per-element JS state to lose.
     Stack: backdrop 44 < sheet 45 < topbar 50; day-heads (10) stay under everything.
     The vertical math reuses --feed-toolbar-h (ResizeObserver-measured .feed-filters
     height, still correct when fixed) so the controls half docks flush under the tabs
     half, same -2px seam the sticky version used. */
  body.filters-sheet-open { overflow: hidden; }  /* freeze scroll while the sheet is up */
  body.filters-sheet-open .feed-shell .feed-filters {
    position: fixed; top: var(--topbar-h); left: 0; right: 0; z-index: 45;
    margin: 0; border-radius: 0;
  }
  body.filters-sheet-open .feed-controls {
    position: fixed; top: calc(var(--topbar-h) + var(--feed-toolbar-h) - 2px);
    left: 0; right: 0; z-index: 45; margin: 0;
    max-height: calc(100dvh - var(--topbar-h) - var(--feed-toolbar-h));
    overflow-y: auto;
    border-radius: 0 0 var(--radius-l) var(--radius-l);
    box-shadow: 0 16px 26px -14px rgba(25, 23, 22, 0.45);
  }
  /* The sheet body scrolls (overflow-y above), which CLIPS the Fonte picker's
     absolutely-positioned dropdown — chips were cut off. In-flow inside the sheet:
     the panel expands the scrollable stack instead of escaping it. */
  body.filters-sheet-open .feed-controls .interest-picker__panel {
    position: static; width: 100%; max-height: none;
    box-shadow: none; border: 1px solid var(--line); margin-top: 6px;
  }
  body.filters-sheet-open .filters-backdrop {
    display: block; position: fixed; inset: 0; z-index: 44;
    background: rgba(25, 23, 22, 0.35);
  }
}

@media (max-width: 400px) {
  .mapcat { flex-basis: 100%; }
}

/* Invite auth */
.login-form { display: grid; gap: 12px; width: 100%; }
.login-form label { display: grid; gap: 6px; color: var(--ink); font-weight: 700; font-size: 0.84rem; text-align: left; }
.login-form input[type=email],
.login-form input[type=password] {
  width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink); padding: 9px 11px; font: inherit;
}
.login-form .errorlist { margin: 0; padding-left: 18px; color: var(--red-dark); font-size: 0.82rem; text-align: left; }
/* On the dark login panel the deep red is unreadable — lift it. */
.lp-login-panel .login-form .errorlist { color: #ff8f96; }
.login__forgot {
  display: block; margin-top: 2px; color: rgba(255,255,255,0.55);
  font-size: 0.8rem; text-decoration: none; text-align: center;
}
.login__forgot:hover { color: #fff; text-decoration: underline; }
/* Beats `.lp-login-panel p` (the SOLO-SU-INVITO tag style) — body copy must NOT be shouty caps. */
.lp-login-panel p.lp-login-panel__text {
  margin: 0; color: rgba(255,255,255,0.75); font-size: 0.9rem; font-weight: 400;
  line-height: 1.5; text-align: left; text-transform: none; letter-spacing: 0;
}
.hp-field { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; }
.btn--block { width: 100%; justify-content: center; }
.login__divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0; }
.login__divider::before,
.login__divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.lp-hero-main { display: grid; justify-items: center; }
.lp-hero-main[hidden],
.lp-login-panel[hidden] { display: none !important; }
.lp-login-panel {
  width: min(380px, calc(100vw - 32px)); display: grid; gap: 14px;
  padding: 20px; border: 1px solid rgba(255,255,255,0.18); border-radius: 8px;
  background: rgba(21, 20, 25, 0.82); box-shadow: 0 20px 80px rgba(0,0,0,0.34);
  backdrop-filter: blur(10px);
}
.lp-login-panel__head { display: flex; align-items: center; gap: 12px; text-align: left; }
.lp-login-panel__logo {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px;
  background: #fff; flex: none;
}
.lp-login-panel__logo img { width: 34px; height: 34px; }
.lp-login-panel h1 { margin: 0; color: #fff; font-size: 1.6rem; line-height: 1; }
.lp-login-panel p { margin: 4px 0 0; color: rgba(255,255,255,0.68); font-size: 0.78rem; font-weight: 800; text-transform: uppercase; }
.lp-login-panel .login-form label { color: #fff; }
.lp-login-panel .login-form input { background: #fff; }
.lp-login-panel .login__divider { color: rgba(255,255,255,0.62); }
.lp-login-panel .login__divider::before,
.lp-login-panel .login__divider::after { background: rgba(255,255,255,0.18); }
.lp-cta--submit { border: 0; cursor: pointer; }

.category-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.category-choice {
  display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--cream-2);
  color: var(--ink); font-size: 0.86rem; font-weight: 700;
}
.category-choice input { flex: none; }
.category-choice__star {
  margin-left: auto; font-size: 16px; color: var(--red);
  font-variation-settings: 'FILL' 1, 'wght' 600, 'GRAD' 0, 'opsz' 20;
}
.category-choice__icon { flex: none; font-size: 18px; color: var(--muted); }
.category-grid__legend {
  display: flex; align-items: center; gap: 5px; margin: 6px 0 0;
  color: var(--muted); font-size: 0.8rem;
}
.category-grid__legend .category-choice__star { margin-left: 0; }

/* ---------- Onboarding (sidebar-less focused shell) ---------- */
.onb { min-height: 100vh; display: flex; flex-direction: column; }
.onb__bar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--ink, #191716); padding: 10px 18px;
}
.onb__bar .signout { width: auto; }
.onb__bar .brand { padding: 0; border-bottom: 0; }
.onb__main { width: min(860px, 100%); margin: 0 auto; padding: 34px 20px 64px; }

.sidebar-section-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sidebar-section-choice {
  display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: 10px;
  min-height: 52px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--paper); color: var(--ink); font-size: 0.88rem; font-weight: 800;
  transition: border-color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast);
}
.sidebar-section-choice:has(input:checked) {
  border-color: color-mix(in srgb, var(--red) 42%, var(--line));
  background: color-mix(in srgb, var(--red) 7%, var(--paper));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 18%, transparent);
}
.sidebar-section-choice input { width: 16px; height: 16px; margin: 0; }
.sidebar-section-choice__icon { font-size: 21px; color: var(--red-dark); }

@media (max-width: 680px) {
  .sidebar-section-grid { grid-template-columns: 1fr; }
}

.invite-list { display: grid; gap: 8px; }
.invite-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.invite-row:last-child { border-bottom: 0; }
.invite-row span { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
/* Distance and location controls: generous touch targets, bounded mobile height. */
/* Compact distance control, matching the source/date fields. */
.distance-slider { display: flex; align-items: center; gap: 10px; flex: 0 1 310px; min-width: 240px; margin-left: auto; padding: 4px 12px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper); font-size: .8rem; font-weight: 700; }
.distance-slider__label { display: inline-flex; align-items: center; gap: 6px; }
.distance-slider__label .material-symbols-outlined { color: var(--red); font-size: 18px; }
.distance-slider output { min-width: 48px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.distance-slider input[type=range] { flex: 1; width: 100%; min-width: 50px; min-height: 34px; padding: 0; margin: 0; accent-color: var(--red); cursor: pointer; border: 0; box-shadow: none; }
.distance-slider:focus-within { border-color: var(--red); }
.location-controls { display: grid; gap: 10px; }
.location-marker { background: var(--red); border: 3px solid white; border-radius: 50%; box-shadow: 0 1px 5px #0008; }
.location-controls #point-status:empty, .address-results:empty { display: none; }
.address-combobox { position: relative; min-width: 0; }
.address-search-row { display: flex; gap: 8px; }
.address-input { position: relative; min-width: 0; flex: 1; }
.address-search-row input { min-width: 0; width: 100%; }
.address-results { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 5px); max-height: min(300px, 42vh); overflow-y: auto; overscroll-behavior: contain; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper); box-shadow: var(--shadow-s); }
.address-results[hidden] { display: none; }
.address-option { display: flex; flex-direction: column; gap: 3px; min-height: 48px; padding: 10px 12px; border-radius: var(--radius-s); cursor: pointer; overflow-wrap: anywhere; text-align: left; }
.address-option strong { font-size: .85rem; font-weight: 600; }
.address-option span { font-size: .76rem; color: var(--muted); }
.address-option span:empty { display: none; }
.address-option:hover, .address-option[aria-selected=true] { background: var(--red-soft); }
.map-event-pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 12px; }
.map-event-pager button { min-width: 44px; min-height: 44px; cursor: pointer; }
#feedResults.is-loading .feed-controls { pointer-events: auto; }
@media (max-width: 640px) {
  body.filters-sheet-open .feed-controls .interest-picker { display: block; width: 100%; }
  body.filters-sheet-open .interest-picker__toggle { width: 100%; min-height: 44px; }
  body.filters-sheet-open .interest-picker__panel { width: 100%; margin-top: 8px; }
  .distance-slider { flex-basis: 100%; width: 100%; min-width: 0; margin-left: 0; }
  .topbar-when .feed-datebar__icon { display: inline-block; }
  .address-search-row { flex-wrap: wrap; }
}

/* Map filters share the feed's field styling; category choices overlay the map. */
.mapfilters { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mapdates { padding: 0; width: 210px; align-self: auto; box-shadow: none; }
.mapdates .date-menu { width: 100%; }
.mapdates .date-menu__button { min-width: 0; min-height: 44px; padding: 10px 12px; gap: 8px; }
.map-category-picker { width: 190px; display: block; }
.map-category-picker summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 12px; cursor: pointer; list-style: none; font-size: .86rem; font-weight: 700; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); }
.map-category-picker summary::-webkit-details-marker { display: none; }
.map-category-picker summary > .material-symbols-outlined:first-child { font-size: 19px; color: var(--red); }
.map-category-picker summary .date-menu__caret { margin-left: auto; }
.map-category-picker[open] summary { border-color: var(--red-ring); }
.map-category-picker[open] summary .date-menu__caret { transform: rotate(180deg); }
.map-category-picker summary:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
#mapCategoryCount:empty { display: none; }
#mapCategoryCount { color: var(--red-dark); font-size: .75rem; }
.map-category-panel { position: absolute; z-index: 60; top: calc(100% + 7px); left: 0; width: min(620px, 100%); padding: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow-m); }
.map-category-panel > button { display: block; margin: 0 0 10px auto; font-size: .8rem; }
.map-category-panel .mapcats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 0; max-height: min(52dvh, 360px); overflow-y: auto; border: 0; box-shadow: none; }
.map-category-panel .mapcat { min-height: 44px; padding: 9px 10px; border-color: var(--line-soft); font-size: .78rem; }
.map-category-panel .mapcat__label { white-space: normal; line-height: 1.35; text-align: left; }
.mapfilters .distance-slider { flex: 1 1 260px; max-width: 340px; }
.mapdates .feed-datebar__icon { display: inline-block; }

/* One calendar trigger. Week/day choices share its popup; reopening starts at periods. */
.date-menu__caret, .interest-picker__caret { display: block; width: 18px; height: 18px; flex: 0 0 18px; overflow: visible; transform-origin: center; transition: none; }
.feed-datebar { position: relative; padding: 0; gap: 0; }
.feed-datebar > .feed-datefield { position: static; border-radius: inherit; }
.feed-datebar .feed-range-menu { min-height: 44px; padding: 10px 12px; gap: 8px; border-radius: calc(var(--radius-m) - 1px); }
.feed-datebar .feed-range-menu [data-date-label] { flex: 1; }
.feed-datebar .feed-datefield--day { position: static; width: 0; flex: none; margin: 0; padding: 0; border: 0; }
.feed-datebar .feed-day-menu { display: none; }
.feed-datebar .feed-datefield--day .date-menu__panel { top: calc(100% + 7px); left: 0; }
.feed-datebar .feed-datebar__icon { display: inline-block; }
.topbar-when .feed-datebar { padding: 0; gap: 0; border-color: var(--red-ring); background: var(--red-soft, #fff5f5); }
.topbar-when .feed-range-menu { min-height: 44px; }
.topbar-when .feed-datefield--day .date-menu__panel { left: auto; right: 0; }
@media (max-width: 640px) {
  .mapdates, .map-category-picker { width: auto; flex: 1 1 0; min-width: 0; }
  .mapdates .date-menu__button, .map-category-picker summary { font-size: .8rem; padding: 9px 10px; }
  .mapfilters .distance-slider { flex-basis: 100%; max-width: none; }
}

.location-attribution { font-size: .7rem; color: var(--muted); }
.location-controls .locmap { height: 220px; margin: 0; }


@media (max-width: 480px) {
  .address-search-row { flex-wrap: wrap; }
  .address-input { flex-basis: 100%; }
  .address-search-row button { margin-left: auto; }
}

/* ==========================================================================
   Planner (opt-in todo list). One responsive layout: phones see one day at a time,
   desktop sees the whole week side by side — same features on both.
   ========================================================================== */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.phead__actions { display: flex; align-items: center; gap: 8px; }
.pseg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper); }
.pseg a { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 34px; padding: 0 10px; border-radius: var(--radius-pill); color: var(--muted); text-decoration: none; font-weight: 700; font-size: .82rem; }
.pseg a.is-active { background: var(--ink); color: var(--paper); }
.pseg .material-symbols-outlined { font-size: 19px; }


.pstrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 14px; }
.pstrip__day { height: 64px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink); text-decoration: none; }
.pstrip__wd { font-size: .62rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; opacity: .6; }
.pstrip__num { font-size: 1.05rem; font-weight: 700; line-height: 1; }
.pstrip__day.is-today .pstrip__num { color: var(--red); }
.pstrip__day.is-selected { background: var(--ink); border-color: var(--ink); color: #fff; }
.pstrip__day.is-selected .pstrip__num { color: #fff; }
.pstrip__dots { display: flex; gap: 3px; height: 5px; }
.pstrip__dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--red); }
.pstrip__dots i.is-done { background: rgba(22,21,25,.25); }
.pstrip__dots i.is-event { border-radius: 1px; transform: rotate(45deg); background: #7C3AED; }
.pstrip__day.is-selected .pstrip__dots i { background: #fff; }
.pstrip__day.is-selected .pstrip__dots i.is-done { opacity: .5; }

.pgoals { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; padding-bottom: 2px; scrollbar-width: none; }
.pgoal { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; padding: 7px 12px 7px 7px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-xs); font: inherit; color: var(--ink); cursor: grab; text-align: left; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pgoal__icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 18px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); }
.pgoal__body { display: flex; flex-direction: column; gap: 4px; }
.pgoal__title { font-weight: 600; font-size: .82rem; line-height: 1; }
.pgoal__title span { color: var(--muted); font-weight: 500; }
.pgoal__pips { display: flex; gap: 3px; }
.pgoal__pips i { width: 14px; height: 5px; border-radius: 999px; background: rgba(22,21,25,.1); }
.pgoal__pips i.is-done { background: var(--c); }
.pgoal__pips i.is-planned { background: color-mix(in srgb, var(--c) 30%, white); outline: 1px solid var(--c); }

.pweek { display: block; }
.pday { display: none; flex-direction: column; gap: 6px; }
.pday.is-selected { display: flex; }
.pday__head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; margin: 0 2px; font-size: 1.05rem; }
.pday__count { font-size: .75rem; font-weight: 700; color: var(--muted); }
.pday__short { display: none; }

.plist { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.ptask { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 4px 6px 8px; border-bottom: 1px solid var(--line-soft); background: var(--paper); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ptask__check { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--c); background: var(--paper); color: transparent; display: grid; place-items: center; padding: 0; cursor: pointer; }
.ptask__check .material-symbols-outlined { font-size: 18px; }
.ptask.is-pending { opacity: .6; pointer-events: none; }   /* just added, still saving */
.ptask__icon { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 8px; display: grid; place-items: center; font-size: 17px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); }
.ptask__title { flex: 1; min-width: 0; display: flex; flex-direction: column; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; line-height: 1.25; -webkit-user-drag: none; }
.ptask__title > span { overflow-wrap: anywhere; }
.ptask__title small { display: flex; align-items: center; gap: 3px; font-size: .72rem; font-weight: 500; color: var(--muted); }
.ptask__title small .material-symbols-outlined { font-size: 14px; }
.ptask__grip { padding: 0 4px; font-size: 20px; color: rgba(22,21,25,.28); cursor: grab; }
.ptask__from { padding: 3px 8px; border-radius: 999px; background: var(--red-soft); color: var(--red-dark); font-size: .7rem; font-weight: 700; }
.ptask__plan { display: inline-flex; align-items: center; gap: 3px; min-height: 34px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--cream); font: inherit; font-size: .75rem; font-weight: 600; color: var(--ink); cursor: pointer; }
.ptask__plan .material-symbols-outlined { font-size: 16px; }
.ptask.is-done { background: #FAFAF8; }
.ptask.is-done .ptask__check { background: rgba(22,21,25,.3); border-color: transparent; color: #fff; }
.ptask.is-done .ptask__title { color: rgba(22,21,25,.45); font-weight: 500; text-decoration: line-through; }
.ptask.is-done .ptask__icon { opacity: .45; filter: grayscale(1); }
.ptask.is-missed .ptask__title > span { color: var(--muted); }
.plist__add { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 46px; padding: 0 14px; border: 0; background: transparent; font: inherit; font-size: .85rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.plist__add:hover { color: var(--ink); }
.plist__empty { margin: 0; padding: 12px 14px; color: var(--faint); }

.pleft { background: var(--paper); border: 1px solid var(--red-ring); border-radius: 14px; padding: 4px 4px 0; }
.pleft__head { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 4px 0 8px; font-size: .85rem; font-weight: 600; }
.pleft__head > .material-symbols-outlined { color: var(--red); font-size: 20px; }
.pleft__btn { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--red); color: #fff; font: inherit; font-size: .75rem; font-weight: 600; cursor: pointer; }
.pleft__btn .material-symbols-outlined { font-size: 17px; }
.pleft .ptask { border-bottom: 0; border-top: 1px solid var(--line-soft); }

.pevent { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 6px 10px; border-radius: 14px; color: var(--ink); text-decoration: none; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 13%, white) 0 6px, color-mix(in srgb, var(--c) 6%, white) 6px 12px); border: 1px solid color-mix(in srgb, var(--c) 30%, white); }
.pevent__icon { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 10px; display: grid; place-items: center; background: var(--c); color: #fff; font-size: 18px; }
.pevent__body { display: flex; flex-direction: column; min-width: 0; }
.pevent__body b { font-size: .88rem; overflow-wrap: anywhere; }
.pevent__body small { display: flex; align-items: center; gap: 3px; font-size: .74rem; color: var(--muted); }
.pevent__body small .material-symbols-outlined { font-size: 14px; }

.panytime { margin-top: 16px; }

@media (min-width: 1141px) {
  .pstrip { display: none; }
  .pweek { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: start; }
  .pday { display: flex; }
  .pday__head { font-size: .85rem; }
  .pday__long { display: none; }
  .pday__short { display: inline; }
  .pday.is-today .pday__head { color: var(--red); }
  /* Agenda rows borrow the hour calendar's .hblock look: tinted, compact, bold. */
  .pweek .ptask { gap: 5px; min-height: 40px; padding: 5px 6px; border-color: var(--paper); background: color-mix(in srgb, var(--c) 18%, white); }
  .pweek .ptask.is-done { background: #EFEEEA; }
  .pweek .ptask__grip { display: none; }
  .pweek .ptask__icon { width: auto; height: auto; background: none; font-size: 15px; }
  .pweek .ptask__check { width: 18px; height: 18px; border-width: 1.5px; }
  .pweek .ptask__check .material-symbols-outlined { font-size: 12px; }
  .pweek .ptask__title { font-size: .75rem; font-weight: 700; line-height: 1.15; }
  .pweek .ptask__title small { font-size: .64rem; }
  .pweek .pleft__head { flex-wrap: wrap; }
  .panytime .plist { max-width: 560px; }
}

/* Drag & drop */
html.p-dragging, html.p-dragging * { cursor: grabbing !important; }
.is-lifted { opacity: .35; }
.pghost { position: fixed; left: 0; top: 0; z-index: 1000; pointer-events: none; border-radius: 12px; box-shadow: var(--shadow-m); opacity: .95; }
.p-dragging .pstrip__day { border-style: dashed; }
.pstrip__day.is-over, .pday.is-over > .plist, .panytime.is-over .plist { background: var(--red-soft); outline: 2px dashed var(--red); outline-offset: -2px; }
.p-dragging .hblock, .p-dragging .hchip, .p-dragging .hnow { pointer-events: none; }
.p-dragging .hslot:not(.is-hour) { border-top: 1px dashed rgba(22,21,25,.10); }
.hslot.is-over { background: rgba(225,29,42,.14); border-radius: 4px; }
.hlane.is-over { background: rgba(225,29,42,.10); outline: 1.5px dashed var(--red); outline-offset: -2px; }

/* Hour calendar: the whole visible day fits the screen (planner.js sizes it). */
.hgrid { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-l); overflow: hidden; }
.hgrid__top, .hgrid__body { display: grid; grid-template-columns: 40px repeat(var(--cols), minmax(0, 1fr)); }
.hgrid__top { position: relative; z-index: 3; background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 6px 12px -10px rgba(0,0,0,.25); }
.hgrid__head { display: flex; align-items: center; justify-content: center; gap: 5px; height: 32px; border-left: 1px solid var(--line-soft); font-size: .62rem; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.hgrid__head b { font-size: .85rem; color: var(--ink); }
.hgrid__head.is-today b { padding: 1px 7px; border-radius: 999px; background: var(--red); color: #fff; }
.hgrid__head.is-past b { color: var(--muted); }
.hgrid__inbox { padding: 9px 0 0 12px; font-size: 15px; color: var(--faint); }
@media (max-width: 640px) { .hgrid__head { flex-direction: column; gap: 1px; height: 40px; } }   /* 7 columns on a phone: "MER 21" doesn't fit side by side */
.hlane { min-height: 34px; padding: 3px; display: flex; flex-direction: column; gap: 3px; border-left: 1px solid var(--line-soft); }
.hchip { display: flex; align-items: center; gap: 4px; height: 26px; padding: 0 6px; border-radius: 7px; border: 1px solid transparent; background: color-mix(in srgb, var(--c) 15%, white); cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hchip .material-symbols-outlined { flex: 0 0 auto; font-size: 14px; color: var(--c); }
.hchip a { min-width: 0; font-size: .7rem; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-user-drag: none; }
.hchip.is-done { background: #F2F1EE; }
.hchip.is-done a { color: var(--faint); text-decoration: line-through; }
.hchip.is-done .material-symbols-outlined { color: var(--faint); }
.hchip.is-missed, .hblock.is-missed { border: 1.5px dashed var(--red); }
.hgrid__body { height: 560px; padding: 6px 0 10px; }
.hgutter { position: relative; }
.hgutter__label { position: absolute; right: 6px; transform: translateY(-50%); font-size: .62rem; font-weight: 600; color: var(--faint); }
.hgutter__label.is-first { transform: none; }
.hgutter__label[hidden] { display: none; }
.hcol { position: relative; display: flex; flex-direction: column; border-left: 1px solid var(--line-soft); }
.hcol.is-today { background: rgba(225,29,42,.03); }
.hslot { flex: 1 1 0; min-height: 0; border-top: 1px solid transparent; }
.hslot.is-hour { border-top-color: rgba(22,21,25,.08); }
.hslot[hidden] { display: none; }
.hblock { position: absolute; left: 2px; right: 2px; box-sizing: border-box; padding: 3px 4px; border-radius: 6px; border: 1px solid var(--paper); overflow: hidden; display: flex; flex-direction: column; gap: 1px; background: color-mix(in srgb, var(--c) 18%, white); color: var(--ink); text-decoration: none; cursor: grab; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.hblock[hidden] { display: none; }
.hblock--event { cursor: pointer; background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 14%, white) 0 6px, color-mix(in srgb, var(--c) 7%, white) 6px 12px); border-color: color-mix(in srgb, var(--c) 35%, white); }
.hblock__row { display: flex; align-items: center; gap: 3px; min-width: 0; }
.hblock__row > .material-symbols-outlined { flex: 0 0 auto; font-size: 13px; color: var(--c); }
.hblock__title { flex: 1; min-width: 0; font-size: .68rem; font-weight: 700; line-height: 1.15; color: inherit; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; -webkit-user-drag: none; }
.hblock__time { padding-left: 16px; font-size: .62rem; font-weight: 600; opacity: .7; }
.hblock.is-short { justify-content: center; padding-top: 0; padding-bottom: 0; }
.hblock.is-short .hblock__time { display: none; }
.hblock__check { width: 16px; height: 16px; flex: 0 0 auto; border-radius: 50%; border: 1.5px solid var(--c); background: var(--paper); color: transparent; padding: 0; display: grid; place-items: center; cursor: pointer; }
.hblock__check .material-symbols-outlined { font-size: 11px; }
.hblock.is-done { background: #EFEEEA; color: var(--faint); }
.hblock.is-done .hblock__title { text-decoration: line-through; }
.hblock.is-done .hblock__row > .material-symbols-outlined { color: var(--faint); }
.hblock.is-done .hblock__check { background: rgba(22,21,25,.3); border-color: transparent; color: #fff; }
.hblock__resize { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; cursor: ns-resize; touch-action: none; }
.hblock__resize::after { content: ""; position: absolute; left: 50%; bottom: 2px; width: 16px; height: 3px; margin-left: -8px; border-radius: 2px; background: currentColor; opacity: .25; }
.hnow { position: absolute; left: 0; right: 0; height: 2px; background: var(--red); z-index: 2; pointer-events: none; }
.hnow::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); }
.hedge { display: none; position: absolute; left: 0; right: 0; height: 22px; z-index: 5; align-items: center; justify-content: center; color: var(--red); }
.p-dragging .hedge { display: flex; }
.p-dragging .hedge[hidden] { display: none; }
.hedge--top { top: 0; background: linear-gradient(to bottom, rgba(225,29,42,.18), rgba(225,29,42,0)); }
.hedge--bot { bottom: 0; background: linear-gradient(to top, rgba(225,29,42,.18), rgba(225,29,42,0)); }
@media (min-width: 1025px) {
  .hgrid__top, .hgrid__body { grid-template-columns: 52px repeat(var(--cols), minmax(0, 1fr)); }
  .hblock__title, .hchip a { font-size: .75rem; }
}

/* Quick-add sheet: bottom sheet on phones, centred dialog on desktop. */
.psheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; margin: auto auto 0; padding: 0; border: 0; border-radius: 18px 18px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 -10px 30px -10px rgba(0,0,0,.3); }
.psheet::backdrop { background: rgba(0,0,0,.4); }
@media (min-width: 641px) { .psheet { margin: auto; border-radius: var(--radius-l); } }
/* Phones: bottom edge on the visible area's bottom (above the keyboard when it's up), never taller
   than what's visible. planner.js keeps --vv-bottom / --vv-h in sync with the visual viewport. */
@media (max-width: 640px) {
  .psheet[open] { inset: auto 0 auto 0; top: var(--vv-bottom, 100dvh); transform: translateY(-100%); margin: 0 auto; max-height: calc(var(--vv-h, 100dvh) - 12px); }
}
.psheet__form { --c: #6B7280; display: flex; flex-direction: column; gap: 14px; padding: 8px 16px 20px; }
.psheet__grab { width: 40px; height: 4px; align-self: center; border-radius: 999px; background: rgba(22,21,25,.15); }
.psheet__titlerow { display: flex; align-items: center; gap: 10px; }
.psheet__preview { width: 44px; height: 44px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; font-size: 22px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, white); }
.psheet__titlerow input { flex: 1; min-width: 0; padding: 8px 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: 1.1rem; font-weight: 600; color: var(--ink); }
.pchips { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.pchip { position: relative; display: inline-flex; align-items: center; gap: 5px; min-height: 38px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-size: .82rem; font-weight: 600; color: var(--ink); white-space: nowrap; text-decoration: none; cursor: pointer; }
.pchip input { position: absolute; opacity: 0; pointer-events: none; }
.pchip .material-symbols-outlined { font-size: 17px; color: var(--c, currentColor); }
.pchip:has(input:checked) { border-color: var(--c, var(--ink)); background: color-mix(in srgb, var(--c, #161519) 13%, white); }
.pchips--plain .pchip:has(input:checked) { border-color: var(--ink); background: var(--ink); color: #fff; }
.pchips--plain .pchip:has(input:checked) .material-symbols-outlined { color: #fff; }
.pchip:has(input:focus-visible), .picon:has(input:focus-visible), .pwd:has(input:focus-visible), .pcolour:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 2px; }
.pchip--add { width: 38px; padding: 0; justify-content: center; border-style: dashed; color: var(--muted); }
.pchip.is-static { cursor: default; background: color-mix(in srgb, var(--c) 12%, white); border-color: color-mix(in srgb, var(--c) 35%, white); }
.picons { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; border: 0; }
.picon { position: relative; height: 42px; display: grid; place-items: center; border-radius: 12px; border: 1px solid transparent; background: var(--cream); color: rgba(22,21,25,.7); cursor: pointer; }
.picon[hidden] { display: none; }
.picon input { position: absolute; opacity: 0; pointer-events: none; }
.picon .material-symbols-outlined { font-size: 21px; }
.picon:has(input:checked) { border: 2px solid var(--c, var(--ink)); background: color-mix(in srgb, var(--c, #161519) 13%, white); color: var(--c, var(--ink)); }
.psheet__row { display: flex; align-items: flex-start; gap: 8px; }
.psheet__lead { flex: 0 0 auto; margin-top: 9px; font-size: 20px; color: var(--faint); }
.psheet__goal { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--cream); }
.psheet__goal label { display: flex; align-items: baseline; gap: 4px; font-weight: 600; color: var(--muted); }
.pstep { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
.pstep__value { width: 3ch; border: 0; background: transparent; font: inherit; font-size: 1.3rem; font-weight: 700; text-align: center; color: var(--ink); -moz-appearance: textfield; appearance: textfield; }
.pstep__value::-webkit-inner-spin-button, .pstep__value::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.psheet__custom { display: flex; flex-direction: column; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--cream); }
.pweekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.pwd { position: relative; height: 40px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); font-weight: 700; cursor: pointer; }
.pwd input { position: absolute; opacity: 0; pointer-events: none; }
.pwd:has(input:checked) { border-color: var(--red); background: var(--red); color: #fff; }
.pinterval { display: flex; align-items: center; gap: 6px; font-size: .85rem; font-weight: 600; }
.pinterval input { width: 5ch; }
.psheet__date input, .pinterval input, .psheet__time input { padding: 8px 10px; border: 1px solid transparent; border-radius: var(--radius-s); background: var(--cream-2); font: inherit; color: var(--ink); }
.psheet__actions { display: flex; align-items: center; gap: 8px; }
.psheet__time { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.psheet__submit { flex: 1; min-height: 48px; }
[data-show-for][hidden], [data-show-for-when][hidden], [data-show-for-kind][hidden], [data-unit-weeks][hidden], [data-unit-days][hidden] { display: none; }

/* Edit / new-category pages */
.pform { max-width: 640px; }
.pform__back { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: .85rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.pform .sub .material-symbols-outlined { font-size: 16px; vertical-align: -3px; }
.pform__card { display: flex; flex-direction: column; gap: 16px; }
.pform__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.pform__grid input, .pform__grid select { width: 100%; padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-s); background: var(--cream-2); font: inherit; color: var(--ink); }
.pform__hint { font-size: .75rem; color: var(--faint); }
.pcolours { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; margin: 0; padding: 0; border: 0; }
.pcolour { position: relative; aspect-ratio: 1; max-width: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--c); color: transparent; cursor: pointer; }
.pcolour input { position: absolute; opacity: 0; pointer-events: none; }
.pcolour:has(input:checked) { color: #fff; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--c); }

/* Settings switches */
.pswitches { display: flex; flex-direction: column; }
.pswitch-row { display: flex; align-items: center; gap: 12px; min-height: 54px; border-top: 1px solid var(--line-soft); }
.pswitch-row > .material-symbols-outlined { width: 34px; flex: 0 0 auto; text-align: center; color: var(--muted); }
.pswitch-row__label { flex: 1; min-width: 0; font-weight: 600; }
.pswitch-row__label small { display: block; font-size: .78rem; font-weight: 500; color: var(--muted); }
.pswitch-row a.pswitch-row__label { color: var(--ink); text-decoration: none; }
.pswitch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.pswitch input { position: absolute; inset: 0; z-index: 1; margin: 0; opacity: 0; cursor: pointer; }
.pswitch span { position: absolute; inset: 0; border-radius: 999px; background: rgba(22,21,25,.2); transition: background var(--t-fast); }
.pswitch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform var(--t-fast); }
.pswitch input:checked + span { background: var(--red); }
.pswitch input:checked + span::after { transform: translateX(20px); }
.pswitch input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
.pswitch-swatches { display: flex; }
.pswitch-swatches i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--paper); background: var(--c); }
.pswitch-swatches i + i { margin-left: -7px; }

/* Bottom bar: phones/tablets only (the sidebar has room on desktop). What's in the bar
   leaves the hamburger drawer, which keeps Map, Settings and the staff tools. */
.bottombar { display: none; }
/* No env(safe-area-inset-bottom) padding: without viewport-fit=cover it's 0 elsewhere, and
   Firefox Android grew the bar by its URL bar's height while that bar was showing. */
@media (max-width: 1024px) {
  .bottombar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: flex; height: 64px; padding: 0 4px; background: var(--ink); }
  .bottombar a { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: rgba(255,255,255,.62); text-decoration: none; font-size: .66rem; font-weight: 600; white-space: nowrap; }
  .bottombar .material-symbols-outlined { width: 48px; height: 28px; display: grid; place-items: center; border-radius: 999px; font-size: 22px; }
  .bottombar a.is-active { color: #fff; }
  .bottombar a.is-active .material-symbols-outlined { background: rgba(225,29,42,.24); color: #FF5A64; font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
  .has-bottombar .main { padding-bottom: 64px; }
  .nav .in-bar { display: none; }
}

/* Planner guide (Settings → How it works): looping animations, one line each. */
.pguide { display: flex; flex-direction: column; align-items: center; gap: 24px; max-width: 420px; margin: 0 auto; }
.pguide > .pform__back { align-self: flex-start; }
.pguide__slide { display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; }
.pguide__slide[hidden] { display: none; }
.pguide__slide h2 { margin: 0; font-size: 1.35rem; text-align: center; }
.pguide__art { position: relative; width: 326px; height: 240px; max-width: 100%; border-radius: 18px; border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow-m); overflow: hidden; font-size: 12px; }
.pguide__art .material-symbols-outlined { font-size: 15px; }
.pguide__nav { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; }
.pguide__dots { display: flex; gap: 6px; }
.pguide__dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: rgba(22,21,25,.2); cursor: pointer; transition: width var(--t); }
.pguide__dots button.is-active { width: 24px; background: var(--red); }
.pguide__btns { display: flex; gap: 8px; width: 100%; }
.pguide__next, .pguide__done { flex: 1; }
.pguide__btns [hidden] { display: none; }
.g-chip { position: absolute; left: 11px; top: 22px; z-index: 2; width: 120px; height: 46px; box-sizing: border-box; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 7px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 6px 16px -6px rgba(0,0,0,.25); font-size: 13px; }
.g-chip b { display: block; margin-bottom: 4px; line-height: 1; }
.g-tile { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); }
.g-tile .material-symbols-outlined { font-size: 18px; }
.g-pips { display: flex; gap: 3px; }
.g-pips i { width: 12px; height: 5px; border-radius: 999px; background: rgba(22,21,25,.12); }
.g-pips i.on { background: #059669; }
.g-strip { position: absolute; left: 11px; top: 122px; display: grid; grid-template-columns: repeat(7, 40px); gap: 4px; }
.g-cell { height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); }
.g-cell small { font-size: 9px; font-weight: 700; color: var(--muted); }
.g-cell b { font-size: 15px; }
.g-cell i { width: 5px; height: 5px; border-radius: 50%; background: #059669; }
.g-col { position: absolute; top: 20px; width: 130px; height: 200px; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; padding-top: 10px; border-radius: 12px; background: var(--cream); color: var(--muted); font-size: 10px; font-weight: 700; }
.g-col b { font-size: 16px; }
.g-col--today { background: rgba(225,29,42,.06); color: var(--red); }
.g-col--today b { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--red); color: #fff; }
.g-item { position: absolute; z-index: 2; width: 106px; height: 32px; box-sizing: border-box; display: flex; align-items: center; gap: 4px; padding: 0 6px; border-radius: 8px; background: color-mix(in srgb, var(--c, #D97706) 15%, white); box-shadow: 0 6px 14px -6px rgba(0,0,0,.25); font-size: 11px; font-weight: 600; }
.g-item .material-symbols-outlined { color: var(--c, #D97706); }
.g-item--done { z-index: 1; background: #EFEEEA; color: var(--faint); text-decoration: line-through; box-shadow: none; }
.g-item--done .material-symbols-outlined { color: var(--faint); }
.g-card { position: absolute; left: 16px; top: 16px; width: 294px; height: 124px; box-sizing: border-box; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); }
.g-card small { font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--red); }
.g-line { position: absolute; left: 26px; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.g-line i, .g-row i { width: 18px; height: 18px; flex: 0 0 auto; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--c); }
.g-cap { position: absolute; left: 18px; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--muted); }
.g-row { position: absolute; left: 16px; top: 182px; z-index: 2; width: 294px; height: 40px; box-sizing: border-box; display: flex; align-items: center; gap: 8px; padding: 0 6px 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; }
.g-row > span:first-of-type { flex: 1; }
.g-btn { display: flex; align-items: center; gap: 3px; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; }
.g-lane { position: absolute; left: 0; right: 0; top: 0; height: 58px; background: #FAFAF8; border-bottom: 1px solid var(--line); }
.g-hour { position: absolute; left: 44px; right: 14px; height: 0; border-top: 1px solid rgba(22,21,25,.08); }
.g-hour small { position: absolute; left: -28px; top: -7px; font-size: 10px; font-weight: 600; color: var(--faint); }
.g-block { position: absolute; left: 70px; z-index: 2; width: 230px; box-sizing: border-box; display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; overflow: hidden; border-radius: 8px; background: color-mix(in srgb, var(--c) 18%, white); }
.g-block b { display: flex; align-items: center; gap: 4px; }
.g-block b .material-symbols-outlined { color: var(--c); }
.g-block small { padding-left: 19px; font-size: 10.5px; font-weight: 600; opacity: .7; }
.g-times { position: relative; display: block; height: 14px; }
.g-times span { position: absolute; left: 19px; }
.g-handle { position: absolute; left: 50%; bottom: 3px; width: 22px; height: 3px; margin-left: -11px; border-radius: 999px; background: var(--c); opacity: .5; }
.g-finger { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); }
.g-edge { position: absolute; left: 44px; right: 14px; top: 0; height: 30px; display: flex; justify-content: center; color: var(--red); background: linear-gradient(to bottom, rgba(225,29,42,.18), rgba(225,29,42,0)); }
.g-edge .material-symbols-outlined { font-size: 18px; }
@keyframes g-goal { 0%,12% { transform: translate(0,0) scale(1); opacity: 1; } 50%,62% { transform: translate(92px,104px) scale(.45); opacity: 1; } 70%,100% { transform: translate(92px,104px) scale(.45); opacity: 0; } }
@keyframes g-cell { 0%,55% { background: #fff; border-color: rgba(22,21,25,.13); } 62%,100% { background: rgba(5,150,105,.12); border-color: #059669; } }
@keyframes g-dot { 0%,60% { opacity: 0; transform: scale(0); } 68%,100% { opacity: 1; transform: scale(1); } }
@keyframes g-pip { 0%,60% { background: rgba(22,21,25,.12); } 68%,100% { background: color-mix(in srgb, #059669 35%, white); } }
@keyframes g-carry { 0%,15% { transform: translate(0,0); } 55%,100% { transform: translate(156px,0); } }
@keyframes g-carryb { 0%,50% { border-color: #E11D2A; } 60%,100% { border-color: transparent; } }
@keyframes g-plan { 0%,32% { transform: translateY(0); } 62%,100% { transform: translateY(-82px); } }
@keyframes g-press { 0%,18% { background: #F6F5F2; color: #161519; } 24%,30% { background: #161519; color: #fff; } 36%,100% { background: #F6F5F2; color: #161519; } }
@keyframes g-lift { 0%,15% { transform: translate(0,0); opacity: 1; } 50% { transform: translate(40px,96px); opacity: 1; } 58%,100% { transform: translate(40px,96px); opacity: 0; } }
@keyframes g-block { 0%,52% { opacity: 0; transform: scaleY(.4); } 62%,100% { opacity: 1; transform: scaleY(1); } }
@keyframes g-grow { 0%,20% { height: 46px; } 60%,100% { height: 96px; } }
@keyframes g-finger { 0%,15% { transform: translateY(0); opacity: 0; } 20% { transform: translateY(0); opacity: .35; } 60% { transform: translateY(50px); opacity: .35; } 70%,100% { transform: translateY(50px); opacity: 0; } }
@keyframes g-t1 { 0%,40% { opacity: 1; } 45%,100% { opacity: 0; } }
@keyframes g-t2 { 0%,40% { opacity: 0; } 45%,100% { opacity: 1; } }
@keyframes g-up { 0%,15% { transform: translateY(0); } 50%,100% { transform: translateY(-100px); } }
@keyframes g-zone { 0%,52% { opacity: 1; } 62%,100% { opacity: 0; } }
@keyframes g-new { 0%,58% { opacity: 0; } 70%,100% { opacity: 1; } }
.a-goal { animation: g-goal 3.4s infinite; }
.a-cell { animation: g-cell 3.4s infinite; }
.a-dot { animation: g-dot 3.4s infinite; }
.a-pip { animation: g-pip 3.4s infinite; }
.a-carry { border: 1.5px dashed var(--red); animation: g-carry 3s infinite, g-carryb 3s infinite; }
.a-plan { animation: g-plan 3.4s infinite; }
.a-press { animation: g-press 3.4s infinite; }
.a-lift { animation: g-lift 3.2s infinite; }
.a-block { transform-origin: top; animation: g-block 3.2s infinite; }
.a-grow { animation: g-grow 3.2s infinite; }
.a-finger { animation: g-finger 3.2s infinite; }
.a-t1 { animation: g-t1 3.2s infinite; }
.a-t2 { animation: g-t2 3.2s infinite; }
.a-up { box-shadow: 0 6px 14px -6px rgba(0,0,0,.25); animation: g-up 3.4s infinite; }
.a-zone { animation: g-zone 3.4s infinite; }
.a-new { animation: g-new 3.4s infinite; }
@media (prefers-reduced-motion: reduce) {
  .a-goal, .a-cell, .a-dot, .a-pip, .a-carry, .a-plan, .a-press, .a-lift, .a-block, .a-grow, .a-finger, .a-t1, .a-t2, .a-up, .a-zone, .a-new { animation: none; }
}

/* Section pages (Games, Magic): the filter row is a slim control, not a card. The generic
   `.filters label` rule (column, uppercase) must not reach the distance slider. */
.section-filter { background: none; border: 0; box-shadow: none; padding: 0; justify-content: flex-end; }
.section-filter .distance-slider { flex-direction: row; text-transform: none; letter-spacing: 0; color: var(--ink); font-size: .8rem; }

/* Planner — compact week switcher: ‹ 12 – 18 Oct ›, plus "Today" only when you left it. */
.pweek-bar { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.pweek-bar .pseg { margin-left: auto; }
.pswitch-week { display: inline-flex; align-items: center; height: 40px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--paper); }
.pswitch-week a { width: 36px; height: 38px; display: grid; place-items: center; border-radius: var(--radius-pill); color: var(--ink); text-decoration: none; }
.pswitch-week a:hover { background: var(--cream-2); }
.pswitch-week a:not([href]) { opacity: .3; pointer-events: none; }   /* a month back: the planner keeps no older days */
.pswitch-week a .material-symbols-outlined { font-size: 20px; }
.pswitch-week > span { padding: 0 4px; min-width: 9em; text-align: center; font-size: .85rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }   /* fixed width: the arrows stay put while clicking through weeks */
.ptoday { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: var(--radius-pill); background: var(--ink); color: #fff; font-size: .78rem; font-weight: 700; text-decoration: none; }

/* Anytime: always open; when empty it only shows up while dragging, as a drop zone. */
.panytime h2 { margin: 0 2px 8px; font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.panytime.is-empty { display: none; }
.p-dragging .panytime.is-empty { display: block; }
.panytime__drop { display: grid; place-items: center; height: 56px; border: 2px dashed var(--line); border-radius: 14px; color: var(--faint); }

/* Add button: thumb-reach floating button on phones/tablets, header button on desktop. */
.pfab { display: none; }
@media (max-width: 1024px) {
  .phead__add { display: none; }
  .pfab { position: fixed; right: 16px; bottom: calc(64px + 16px); z-index: 55; width: 56px; height: 56px; display: grid; place-items: center; border: 0; border-radius: 18px; background: var(--red); color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 10px 24px -6px rgba(225,29,42,.55); cursor: pointer; }
  .pfab .material-symbols-outlined { font-size: 30px; }
  .planner { padding-bottom: 72px; }
}

/* Sheet: the icon grid opens from the big icon (it's optional), so the sheet stays short. */
.psheet__preview { border: 0; cursor: pointer; padding: 0; }
.psheet__preview:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.psheet .picons[hidden] { display: none; }
@media (min-width: 641px) { .psheet__grab { display: none; } .psheet__form { padding-top: 18px; } }
.psheet--small { max-width: 440px; }
/* Delete on a repeating task: a small menu that opens from the Delete button, "only this one / this and following". */
.pform__actions [popovertarget] { anchor-name: --pdelete; }
.pdelete { position-anchor: --pdelete; position-area: top span-right; position-try-fallbacks: flip-block; inset: auto; margin: 0 0 6px;
  padding: 6px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper); box-shadow: var(--shadow-m); }
.pdelete:popover-open { display: flex; flex-direction: column; }
.pdelete button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: var(--radius-s); background: none;
  color: var(--red-dark); font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer; }
.pdelete button:hover { background: var(--red-soft); }
.pdelete .material-symbols-outlined { font-size: 20px; }
.psheet__preview .material-symbols-outlined { font-size: 22px; }
.section-filter .distance-slider input[type=range] { min-width: 0; padding: 0; background: none; }
@media (max-width: 640px) {
  .section-filter { display: flex; flex-wrap: wrap; }
  .section-filter .distance-slider { flex: 1 1 100%; }
}
.pseg button { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 34px; padding: 0 12px; border: 0; border-radius: var(--radius-pill); background: transparent; font: inherit; font-size: .82rem; font-weight: 700; color: var(--muted); cursor: pointer; }
.pseg button.is-active { background: var(--ink); color: var(--paper); }
.sideseg { display: flex; margin-bottom: 12px; }
.sideseg button { flex: 1; }
.sidepanel [data-side-panel][hidden] { display: none; }
/* Unfinished: one strip above the week (clipped corners, items flow in a grid on desktop). */
.pleft { padding: 0; overflow: hidden; margin-bottom: 14px; }
.pleft__head { min-height: 48px; padding: 0 8px 0 14px; }
.pleft__items { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.pleft .ptask { border-top: 1px solid var(--line-soft); border-bottom: 0; }

/* The selected day lives in the glass top bar on phones/tablets. */
.ptopday { font-weight: 700; font-size: 1rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptopday::first-letter { text-transform: uppercase; }
@media (max-width: 1140px) { .pday__head { display: none; } }

/* Bottom bar: icons only (labels stay for screen readers). */
@media (max-width: 1024px) {
  .bottombar { height: 58px; }
  .bottombar a { gap: 0; }
  .bottombar .material-symbols-outlined { width: 56px; height: 34px; font-size: 25px; }
  .has-bottombar .main { padding-bottom: 58px; }
  .pfab { bottom: calc(58px + 16px); }
}

/* Quick-add sheet v2: category circles + segmented controls instead of chip clouds. */
.psheet__titlecol { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.psheet__catname { min-height: 12px; font-size: .68rem; font-weight: 700; letter-spacing: .05em; line-height: 1; text-transform: uppercase; color: var(--c); }
.psheet__titlerow .psheet__titlecol input { min-height: 36px; padding: 2px 0 4px; font-size: 1.3rem; }
.pcats { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 2px; border: 0; }
.pcat { position: relative; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--c) 14%, white); color: var(--c); cursor: pointer; transition: transform var(--t-fast), background var(--t-fast); }
.pcat input { position: absolute; opacity: 0; pointer-events: none; }
.pcat .material-symbols-outlined { font-size: 20px; }
.pcat:hover { transform: scale(1.06); }
.pcat:has(input:checked) { background: var(--c); color: #fff; box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--c); }
.pcat:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: 5px; }
.pcat--add { --c: var(--muted); background: transparent; border: 1.5px dashed var(--line); color: var(--muted); }
.ptiles { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; min-width: 0; margin: 0; padding: 3px; border: 0; border-radius: 14px; background: var(--cream-2); }
.ptile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; padding: 6px 2px; border-radius: 11px; font-size: .68rem; font-weight: 600; line-height: 1.15; text-align: center; color: var(--muted); cursor: pointer; transition: background var(--t-fast), color var(--t-fast); }
.ptile--row { flex-direction: row; gap: 6px; min-height: 44px; font-size: .78rem; }
.ptile input { position: absolute; opacity: 0; pointer-events: none; }
.ptile .material-symbols-outlined { font-size: 21px; }
.ptile:hover { color: var(--ink); }
.ptile:has(input:checked) { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.06); }
.ptile:has(input:checked) .material-symbols-outlined { color: var(--c, var(--red)); font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
.ptile:has(input:focus-visible) { outline: 2px solid var(--red); outline-offset: -2px; }
.psheet__custom { background: var(--cream); }
.psheet__custom .ptiles { background: var(--cream-2); }
.psheet__time { height: 48px; padding: 0 4px 0 10px; border-radius: var(--radius-s); background: var(--cream-2); }
.psheet__time input { padding: 0; background: transparent; border: 0; }
.psheet__date input { width: 100%; height: 44px; }

/* Day heads are plain text lines (they were flex rows, which spread "Today · Sun 18 Oct"). */
.pday__head { display: block; }
.ptask__title small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ptask__title small .material-symbols-outlined { display: inline-block; vertical-align: -3px; margin-right: 2px; }

/* Unfinished strip: items are small cards; when empty it only appears as a drop zone. */
.pleft__items { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 10px 10px; }
.pleft .ptask { flex: 1 1 260px; max-width: 380px; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; }
.pleft.is-empty { display: none; }
.p-dragging .pleft.is-empty { display: block; }
.p-dragging .pleft.is-empty .pleft__items { min-height: 44px; }
.pleft.is-over { background: var(--red-soft); outline: 2px dashed var(--red); outline-offset: -2px; }
.g-card small, .g-cap, .g-col small, .g-cell small { text-transform: uppercase; }
@media (min-width: 1141px) { .pday__today { display: none; } }
@media (max-width: 1140px) { .pweek .pday__head { display: none; } }
/* One header row: title · period switcher · view toggle · add (title hides on phones:
   the glass top bar and the active tab already say where you are). */
.phead { flex-wrap: wrap; justify-content: flex-start; }
.phead .pweek-bar { margin: 0; }
.phead__actions { margin-left: auto; }
@media (max-width: 1024px) { .phead > h1 { display: none; } }
.pcats { gap: 4px 5px; }
.pcat { width: 38px; height: 38px; }
/* Section tabs on phones: even columns, icon above the label (no tab pushed off-screen). */
@media (max-width: 640px) {
  .tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; }
  .tab { flex-direction: column; gap: 2px; padding: 8px 4px; font-size: .74rem; text-align: center; white-space: normal; line-height: 1.15; }
  .tab .tab__count { position: absolute; transform: translate(14px, -2px); font-size: .62rem; padding: 2px 5px; }
  .tab { position: relative; }
}
/* Resize grip: easy to hit (bigger on touch), slim on 30-min blocks so they stay draggable. */
.hblock__resize { height: 14px; }
.hblock__resize::after { bottom: 4px; width: 28px; height: 4px; margin-left: -14px; opacity: .3; }
.hblock:hover .hblock__resize::after { opacity: .55; }
.hblock.is-short .hblock__resize { height: 7px; }
.hblock.is-short .hblock__resize::after { bottom: 1px; width: 18px; height: 3px; margin-left: -9px; }
@media (pointer: coarse) {
  .hblock__resize { height: 20px; }
  .hblock__resize::after { width: 32px; margin-left: -16px; opacity: .45; }
}
.psheet__cap { margin: 4px 2px -4px; font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
/* Weekly goal chips: a touch bigger and tinted with their colour, so they read as targets. */
.pgoal { gap: 10px; padding: 9px 14px 9px 9px; border-color: color-mix(in srgb, var(--c) 30%, white); background: color-mix(in srgb, var(--c) 7%, white); box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px -6px color-mix(in srgb, var(--c) 45%, transparent); }
.pgoal__icon { width: 38px; height: 38px; border-radius: 11px; font-size: 21px; background: var(--c); color: #fff; }
.pgoal__title { font-size: .9rem; font-weight: 700; }
.pgoal__title span { font-weight: 600; }
.pgoal__pips i { width: 18px; height: 6px; }
.pgoal__pips i.is-planned { background: color-mix(in srgb, var(--c) 28%, white); }
.pgoal:hover { border-color: var(--c); }
.psheet__group { display: flex; flex-direction: column; gap: 6px; }
.psheet__group .psheet__cap { margin: 0 2px; }
/* A task's note (edit popup): a soft box under the title that grows with what's written. */
.psheet__note { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid transparent; border-radius: 12px; background: color-mix(in srgb, var(--c) 7%, var(--paper)); cursor: text; transition: border-color var(--t-fast); }
.psheet__note:focus-within { border-color: color-mix(in srgb, var(--c) 50%, white); }
.psheet__note .material-symbols-outlined { margin-top: 1px; font-size: 18px; color: var(--muted); }
.psheet__note textarea { flex: 1; min-width: 0; min-height: 2.8em; max-height: 40vh; padding: 0; border: 0; outline: 0; background: transparent; resize: none; field-sizing: content; font: inherit; font-size: .92rem; line-height: 1.4; color: var(--ink); }
.psheet__hint { margin: -2px 4px 0; font-size: .74rem; color: var(--muted); }
.psheet__hint[hidden] { display: none; }
/* Category list under the form: each chip opens that category for editing. */
.pcatlist { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.pcatlist__chip { background: color-mix(in srgb, var(--c) 10%, white); border-color: color-mix(in srgb, var(--c) 30%, white); }
.pcatlist__chip:hover { border-color: var(--c); }
.pchip .pcatlist__edit { margin-left: 2px; font-size: 15px; color: var(--muted); opacity: .7; }
.pcatlist__chip.is-current { border-color: var(--c); box-shadow: 0 0 0 1px var(--c); }

/* --- Event-finder chat (templates/events/_chat.html, static/js/chat.js) ------------------
   Ink bubble bottom-right (the red one is the planner's +), a native <dialog> panel: a card
   anchored bottom-right on desktop, full screen on phones. */
.chatfab { position: fixed; right: 24px; bottom: 24px; z-index: 55; width: 56px; height: 56px; display: grid; place-items: center; border: 0; border-radius: 18px; background: var(--ink); color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.1), 0 10px 24px -6px rgba(22,21,25,.55); cursor: pointer; transition: transform var(--t-fast), background var(--t-fast); }
.chatfab:hover { background: var(--ink-3); transform: translateY(-2px); }
.chatfab:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }
.chatfab .material-symbols-outlined { font-size: 26px; font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }
@media (max-width: 1024px) {
  .chatfab { right: 16px; bottom: calc(64px + 16px); }   /* same spot and size as the planner's + */
  body:has(.pfab) .chatfab { bottom: calc(64px + 16px + 56px + 12px); }   /* stacked above the planner's + */
}

.chat { position: fixed; inset: auto 24px 24px auto; margin: 0; padding: 0; width: min(420px, calc(100vw - 48px)); height: min(660px, calc(100dvh - 48px)); max-width: none; max-height: none; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px -12px rgba(22,21,25,.35); overflow: hidden; }
.chat[open] { display: flex; flex-direction: column; animation: chat-in .22s var(--ease-reveal); transform-origin: bottom right; }
.chat::backdrop { background: rgba(22,21,25,.14); }
@keyframes chat-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@media (max-width: 640px) {
  .chat { inset: 0 0 auto 0; width: 100%; height: 100dvh; border: 0; border-radius: 0; }
  .chat[open] { animation-name: chat-up; }
}
@keyframes chat-up { from { opacity: 0; transform: translateY(24px); } }

.chat__head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--line); }
.chat__title { flex: 1; min-width: 0; font-size: 1rem; font-weight: 700; }

.chat__log { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--cream); }
.chat__empty { margin: auto 0; display: flex; flex-direction: column; gap: 14px; }
.chat__empty[hidden] { display: none; }
.chat__empty p { margin: 0; font-size: .95rem; line-height: 1.45; color: var(--muted); }
.chat__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chat__chip { min-height: 38px; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font: inherit; font-size: .85rem; font-weight: 600; color: var(--ink); cursor: pointer; transition: border-color var(--t-fast); }
.chat__chip:hover { border-color: var(--ink); }
.chat__msg--user { align-self: flex-end; max-width: 85%; padding: 9px 14px; border-radius: 18px 18px 6px 18px; background: var(--ink); color: #fff; font-size: .93rem; line-height: 1.4; white-space: pre-line; overflow-wrap: anywhere; }
.chat__msg--bot { display: flex; flex-direction: column; gap: 10px; }
.chat__text { margin: 0; font-size: .95rem; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.chat__note { display: flex; align-items: flex-start; gap: 6px; font-size: .84rem; line-height: 1.4; color: var(--muted); }
.chat__note .material-symbols-outlined { font-size: 18px; color: var(--faint); }
.chat__note { flex-wrap: wrap; }
.chat__retry { margin-left: 24px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); font: inherit; font-size: .82rem; font-weight: 600; color: var(--ink); cursor: pointer; font-variant-numeric: tabular-nums; }
.chat__retry:hover:not(:disabled) { border-color: var(--ink); }
.chat__retry:disabled { color: var(--faint); cursor: default; }
.chat__places { padding: 4px 14px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper); }
.chat__places > p { margin: 8px 0 0; font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.chat__cards { display: flex; flex-direction: column; gap: 8px; }
.chat__cards .card { padding: 12px 14px; gap: 6px; box-shadow: none; }
.chat__cards .card:hover { transform: none; box-shadow: var(--shadow-m); }
.chat__cards .card h3 { font-size: .96rem; }
.chat__cards .card .desc { display: none; }
.chat__typing { display: flex; gap: 5px; padding: 8px 2px; }
.chat__typing > span:not(.visually-hidden) { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: chat-dot 1.1s infinite ease-in-out; }
.chat__typing > span:nth-child(2) { animation-delay: .15s; }
.chat__typing > span:nth-child(3) { animation-delay: .3s; }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .3; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }

.chat__compose { display: flex; align-items: flex-end; gap: 6px; margin: 0; padding: 10px 10px 12px 12px; border-top: 1px solid var(--line); background: var(--paper); }
.chat__compose textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 120px; overflow-y: hidden; resize: none; padding: 10px 14px; border: 1px solid transparent; border-radius: 22px; background: var(--cream-2); font: inherit; font-size: .95rem; line-height: 1.35; color: var(--ink); outline: 0; transition: border-color var(--t-fast), background var(--t-fast); }
.chat__compose textarea:focus { background: var(--paper); border-color: var(--red); }
.chat__mic, .chat__send { position: relative; flex: none; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; transition: background var(--t-fast), color var(--t-fast); }
.chat__mic[hidden] { display: none; }
.chat__mic { background: transparent; color: var(--muted); }
.chat__mic:hover { background: var(--cream-2); color: var(--ink); }
.chat__mic:disabled { opacity: .5; cursor: progress; }
.chat__mic.is-on { background: var(--red); color: #fff; }
.chat__mic.is-on::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--red); animation: chat-pulse 1.2s infinite ease-out; }
@keyframes chat-pulse { from { opacity: .7; transform: scale(.9); } to { opacity: 0; transform: scale(1.25); } }
.chat__timer { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: 4px; font-size: .7rem; font-weight: 700; color: var(--red); font-variant-numeric: tabular-nums; }
.chat__send { background: var(--red); color: #fff; }
.chat__send:hover:not(:disabled) { background: var(--red-dark); }
.chat__send:disabled { background: var(--cream-2); color: var(--faint); cursor: default; }
.chat__send .material-symbols-outlined { font-size: 22px; }
.chat :focus-visible:not(textarea) { outline: 2px solid var(--red); outline-offset: 2px; }
@media (pointer: coarse) { .chat__mic, .chat__send { width: 44px; height: 44px; } }
@media (max-width: 640px) { .chat__compose textarea { font-size: 16px; } }   /* iOS zooms into smaller inputs */

/* --- Linked calendars (templates/planner/calendars.html) ----------------------------------
   The guide is drawn, not screenshotted: small neutral mock screens, one red ring per step. */
.pcal { display: flex; flex-direction: column; gap: 18px; }
.pcal h1 { margin-bottom: -10px; }
.pcal__list { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pcal__item { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 10px 8px 10px 10px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--paper); }
.pcal__dot { width: 32px; height: 32px; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--c); color: #fff; cursor: pointer; transition: background .15s, box-shadow .15s; }
.pcal__dot .material-symbols-outlined { font-size: 17px; }
.pcal__dot:hover, .pcal__dot[aria-expanded="true"] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--c); }
.pcal__colours { flex-basis: 100%; padding: 6px 2px 2px; border-top: 1px solid var(--line-soft); }
.pcal__colours .pcolours { grid-template-columns: repeat(9, minmax(0, 36px)); gap: 10px; }
.pcal__name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pcal__name small { display: flex; align-items: center; gap: 4px; font-size: .78rem; color: var(--muted); }
.pcal__warn { display: inline-flex; align-items: center; gap: 3px; color: var(--red-dark); }
.pcal__warn .material-symbols-outlined { font-size: 15px; }
.pcal__add { display: flex; flex-direction: column; gap: 14px; }
.pcal__add input { width: 100%; padding: 11px 12px; border: 1px solid transparent; border-radius: var(--radius-s); background: var(--cream-2); font: inherit; color: var(--ink); }
.pcal__add input:focus { outline: none; background: var(--paper); border-color: var(--red); }
.pcal__add label small { font-weight: 500; color: var(--faint); }
.pcal__add .btn { align-self: flex-start; }
.pcal__guide { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.pcal__guide h2 { font-size: 1.05rem; }
.pcal__guide .ptile span { font-size: .85rem; }
.pcal__guide:not(:has(input[value="outlook"]:checked)) [data-guide="outlook"],
.pcal__guide:has(input[value="outlook"]:checked) [data-guide="google"] { display: none; }
.pcal__steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.pcal__steps li { display: flex; flex-direction: column; gap: 8px; counter-increment: step; }
.pcal__steps p { margin: 0; font-size: .88rem; line-height: 1.4; color: var(--muted); }
.pcal__steps p::before { content: counter(step); display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--ink); color: #fff; font-size: .72rem; font-weight: 700; }
.pcal__steps b { color: var(--ink); }
.pcal__note { margin: 0; font-size: .8rem; color: var(--faint); }
.gmock { position: relative; min-height: 112px; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: var(--shadow-s); font-size: 11px; color: rgba(22,21,25,.7); }
.gmock small { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.pcal__panel { display: flex; flex-direction: column; gap: 10px; }
.pcal__open { align-self: flex-start; }
.pcal__hint { margin: -4px 0 4px; font-size: .84rem; color: var(--muted); }
.pcal__hint a { color: var(--red-dark); font-weight: 600; }
.gmock__cal { align-self: flex-start; padding: 3px 8px 3px 4px; border-radius: 6px; }
.gmock__h { font-size: 12px; color: var(--ink); }
.pcal__steps li > p a { color: var(--red-dark); font-weight: 600; }
.gmock .material-symbols-outlined { font-size: 16px; }
.gmock__bar { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--ink); }
.gmock__sp { flex: 1; }
.gmock__on { color: var(--ink); }
.gmock__menu { align-self: flex-end; display: flex; flex-direction: column; gap: 2px; width: 120px; padding: 4px; border-radius: 8px; background: var(--paper); box-shadow: var(--shadow-m); }
.gmock__menu span { padding: 4px 8px; border-radius: 6px; }
.gmock__cal { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ink); }
.gmock__cal i { width: 10px; height: 10px; border-radius: 3px; background: #2563EB; }
.gmock__sub { align-self: flex-start; max-width: calc(100% - 20px); margin-left: 16px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gmock__input { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border-radius: 6px; background: var(--cream-2); white-space: nowrap; overflow: hidden; }
.gmock__input .material-symbols-outlined { flex: none; padding: 2px; border-radius: 6px; }
.gmock__eye { margin-left: auto; color: var(--muted); }
.gmock__row { display: flex; gap: 6px; }
.gmock__select { min-width: 0; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gmock__btn { align-self: flex-start; padding: 5px 12px; border-radius: 6px; background: #0F6CBD; color: #fff; font-weight: 600; }
.gmock__link { display: flex; gap: 8px; padding: 5px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; }
.gmock__link b { flex: none; width: 30px; color: var(--ink); }
/* The click target: a red ring, like the site's focus ring. */
.gmock__hit { position: relative; z-index: 1; box-shadow: 0 0 0 2px var(--red), 0 0 0 6px rgba(225,29,42,.15); background: var(--paper); color: var(--ink); font-weight: 600; }
.gmock__btn.gmock__hit { background: #0F6CBD; color: #fff; }
.hchip--event { cursor: default; border-style: dashed; border-color: color-mix(in srgb, var(--c) 45%, white); }
.hchip--event > span:last-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pevent:not([href]) { cursor: default; }

/* Cerca casa (homes/index.html): map left and sticky, panel right; phones stack the map on top. */
.homes { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(330px, 1fr); gap: var(--space-l); align-items: start; }
.homes__mapcol { position: sticky; top: var(--space-l); }
.homes__map { height: calc(100vh - 2 * var(--space-l)); min-height: 440px; border-radius: var(--radius-l); border: 1px solid var(--line); background: var(--cream-2); }
.homes__map.is-drawing { cursor: crosshair; touch-action: none; }   /* a finger draws instead of scrolling */
/* .leaflet-marker-icon too: leaflet.css loads later and sets display: block, which un-centres the × */
.leaflet-marker-icon.homes__shape-x { display: grid; place-items: center; border-radius: 50%; background: var(--paper); color: var(--red); font-size: 16px; font-weight: 800; line-height: 1; box-shadow: var(--shadow-s); cursor: pointer; }
.homes__shape-x:hover { background: var(--red); color: #fff; }
#area-draw[aria-pressed="true"] { background: var(--red-dark); border-color: var(--red-dark); }
.homes__maphint { position: absolute; left: 12px; bottom: 12px; z-index: 500; margin: 0; background: var(--paper); border-radius: var(--radius-pill); padding: 5px 12px; font-size: 0.8rem; font-weight: 600; box-shadow: var(--shadow-s); }
.homes__maphint:empty { display: none; }
.homes__dest { background: var(--paper); border: 5px solid var(--red); border-radius: 50%; box-shadow: var(--shadow-s); }
.homes__panel { display: flex; flex-direction: column; gap: var(--space-m); min-width: 0; }
.homes__head { margin-bottom: var(--space-l); }
.homes__head .page-title { margin-bottom: 4px; }
.homes__guide { margin-top: var(--space-s); max-width: 72ch; }
.homes__guide > summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; color: var(--ink); font-size: 0.88rem; font-weight: 700; }
.homes__guide > summary::-webkit-details-marker { display: none; }
.homes__guide > summary .material-symbols-outlined { font-size: 18px; color: var(--red); }
.homes__guide ul { margin: var(--space-xs) 0 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 0.88rem; }
.homes__status { margin: 0; color: var(--muted); }
.homes__status.is-too_broad, .homes__status.is-failed { color: var(--warn); }
.homes__form { display: flex; flex-direction: column; gap: var(--space-m); background: var(--paper); border-radius: var(--radius-l); padding: var(--space-l); box-shadow: var(--shadow-xs); }
.homes__area { display: flex; flex-direction: column; gap: var(--space-xs); }
.seg { display: inline-flex; align-self: flex-start; background: var(--cream-2); border-radius: var(--radius-pill); padding: 3px; }
.seg__btn { border: 0; background: transparent; font: inherit; font-size: 0.85rem; font-weight: 600; padding: 7px 14px; border-radius: var(--radius-pill); color: var(--muted); cursor: pointer; transition: background var(--t-fast), color var(--t-fast); }
.seg__btn[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-xs); }
.homes__drawtools { display: flex; gap: var(--space-xs); flex-wrap: wrap; }
.homes__drawtools[hidden], .homes [data-auto-only][hidden] { display: none; }   /* class display:flex otherwise beats the hidden attr */
.btn--sm { padding: 6px 12px; font-size: 0.82rem; }
.btn--sm .material-symbols-outlined { font-size: 17px; }
.homes__rules { border-top: 1px solid var(--line-soft); padding-top: var(--space-m); }
.homes__rules > summary { list-style: none; display: flex; align-items: flex-start; gap: var(--space-s); cursor: pointer; }
.homes__rules > summary::-webkit-details-marker { display: none; }
.homes__chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 auto; min-width: 0; }
.homes__chips .chip { font-weight: 600; color: var(--ink); }
.homes__rules-title { display: none; flex: 1 1 auto; font-weight: 700; }
.homes__rules[open] .homes__chips { display: none; }
.homes__rules[open] .homes__rules-title { display: block; }
.homes__dirty { display: none; color: var(--warn); font-size: 0.78rem; font-weight: 700; white-space: nowrap; }
.homes.is-dirty .homes__dirty { display: inline; }
.homes__edit { display: inline-flex; align-items: center; gap: 4px; color: var(--red); font-weight: 700; font-size: 0.85rem; white-space: nowrap; }
.homes__edit .material-symbols-outlined { font-size: 18px; }
.homes__edit-close, .homes__rules[open] .homes__edit-open { display: none; }
.homes__rules[open] .homes__edit-close { display: inline; }
.homes__group { border: 0; padding: 0; margin: var(--space-l) 0 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-s); }
.homes__group legend { padding: 0; margin-bottom: var(--space-s); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.homes .locmap { display: none; }   /* the destination shows on the big map instead */
.homes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-s) var(--space-m); align-items: end; }
.homes__check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 0.9rem; min-height: 42px; }
.homes__label { font-weight: 600; font-size: 0.9rem; }
.homes__toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.homes__toggle { position: relative; }
.homes__toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.homes__toggle span { display: inline-block; padding: 6px 12px; border-radius: var(--radius-pill); border: 1px solid var(--line); font-size: 0.82rem; font-weight: 600; color: var(--muted); transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast); }
.homes__toggle input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.homes__toggle input:focus-visible + span { outline: 2px solid var(--red-ring); outline-offset: 2px; }
.homes .settings-actions { margin-top: var(--space-m); }
.homes__go { display: flex; flex-direction: column; gap: 6px; }
.homes__go .btn { width: 100%; }
.homes__go .notice { margin: 0; padding: 10px 12px; font-size: 0.85rem; box-shadow: none; }
.homes__go .notice[hidden] { display: none; }
/* Email ticked: the button starts the weekly monitoring, not just one search. */
.homes__go:not(:has(input[name=email_me]:checked)) .homes__run-watch,
.homes__go:has(input[name=email_me]:checked) .homes__run-now { display: none; }
.homes__go .homes__check { min-height: 0; font-weight: 500; font-size: 0.85rem; color: var(--muted); }
.homes__go .btn[disabled] { background: var(--cream-2); border-color: var(--cream-2); color: var(--muted); cursor: not-allowed; }
.homes__results-title { font-size: 1rem; display: flex; align-items: baseline; gap: var(--space-xs); margin: var(--space-xs) 0 0; }
.homes__results-title small { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.homecards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-xs); }
.homecard { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: var(--space-s); padding: 10px; background: var(--paper); border: 1px solid transparent; border-radius: var(--radius-m); color: inherit; text-decoration: none; box-shadow: var(--shadow-xs); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.homecard:hover, .homecard.is-hot { border-color: var(--red-ring); box-shadow: var(--shadow-s); }
.homecard__img { width: 92px; height: 74px; border-radius: var(--radius-s); object-fit: cover; background: var(--cream-2); display: block; }
.homecard__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.homecard__price { display: flex; align-items: baseline; font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.homecard__price b { font-size: 1rem; color: var(--ink); margin-right: 8px; }
.homecard__new { margin-left: 8px; color: var(--red); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.homecard__title { font-weight: 600; font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.homecard__meta, .homecard__move { font-size: 0.78rem; color: var(--muted); }
.homecard__move { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.homecard__portal { margin-left: auto; padding-left: var(--space-xs); color: var(--faint); font-size: 0.72rem; }
.mline { font-style: normal; font-weight: 800; font-size: 0.66rem; line-height: 1.5; color: #fff; border-radius: 4px; padding: 0 5px; }
.mline--m1 { background: #E3001B; }
.mline--m2 { background: #00A650; }
.mline--m3 { background: #F5B800; color: var(--ink); }
.mline--m4 { background: #0067B1; }
.mline--m5 { background: #8D5AA6; }
@media (max-width: 980px) {
  .homes { grid-template-columns: 1fr; }
  .homes__mapcol { position: relative; top: auto; }
  .homes__map { height: 46vh; min-height: 300px; }
  .homes__form { padding: var(--space-m); }
}
