/* ----------------------------------------------------------------
   Chase Limitless · Limi — dark "Liquid Glass" theme
   A mid-dark grey room lit by orange + blue glow; long flowing wave
   ribbons are the stage (left ~66%); the conversation rail is docked
   on the right (~33%). All class/ID names match the JS.
----------------------------------------------------------------- */

/* (page-to-page crossfade lives further down with the other transition rules) */

:root {
  /* ---- brand (parity-locked: tests/theme-parity.test.mjs byte-compares these
         the Idea Builder's copy of these was retired 2026-09-07) ---- */
  --orange:      #ff8a3d;
  --blue:        #4f9bff;

  /* ---- COMPATIBILITY ALIAS LAYER ----
     The old glass names are now aliases onto the surface system below. ~60
     existing var() call sites keep working untouched, and the parity test keeps
     passing because both files carry the same alias STRING. Do not re-inline a
     literal here: the whole point is that one surface change moves everything. */
  --glass:        var(--surf-app);
  --glass-soft:   var(--surf-card);
  --glass-border: var(--line);
  --glass-shadow: var(--e2);
  --glass-edge:   var(--edge);
  --blur:         blur(24px) saturate(150%);

  /* ---- THE ROOM — a lit space, not a painted wall.
         Studio is a dim studio with one warm lamp high right and a cool bounce
         low left. The room used to be flat, so nothing could cast a shadow and
         every surface had to announce itself with a 1px white border (112 of
         them). Give the room a real falloff and surfaces can be LIFTS instead. */
  --room-2:    #2c3038;
  --room-1:    #202329;
  --room-0:    #14161b;
  --room-bg:   #1c1f25;
  --room-warm: rgba(255,148,78,0.30);
  --room-cool: rgba(70,140,255,0.26);
  --vignette:  radial-gradient(128% 108% at 50% 44%, transparent 42%, rgba(0,0,0,0.34) 100%);

  /* ---- SURFACES — one ladder, relative by construction ---- */
  --surf-app:   linear-gradient(180deg, rgba(255,255,255,0.085), rgba(255,255,255,0.038));
  --surf-card:  rgba(255,255,255,0.07);
  --surf-bar:   rgba(49,54,63,0.86);
  --surf-float: rgba(37,41,50,0.96);
  --surf-press: rgba(255,255,255,0.12);
  --surf-hover: rgba(255,255,255,0.045);
  --surf-sunk:  rgba(0,0,0,0.26);
  --scrim:      rgba(8,10,14,0.62);

  /* ---- LINES + ELEVATION. --line replaces the 112 hand-rolled 1px borders;
         --e1/--e2/--e3 replace 63 distinct box-shadow values. --e-bar is the
         only shadow in the app that points UP (it lives under the tab bar). */
  --line:        rgba(255,255,255,0.085);
  --line-strong: rgba(255,255,255,0.18);
  --edge: inset 0 1px 0 rgba(255,255,255,0.10);
  --rim:  inset 0 1px 0 rgba(255,255,255,0.18), inset 0 -1px 10px rgba(0,0,0,0.18);
  --e1: 0 1px 2px rgba(0,0,0,0.32);
  --e2: 0 8px 24px -6px rgba(0,0,0,0.50), 0 2px 6px rgba(0,0,0,0.28);
  --e3: 0 24px 60px -12px rgba(0,0,0,0.62), 0 4px 12px rgba(0,0,0,0.34);
  --e-bar: 0 -8px 24px -10px rgba(0,0,0,0.45);
  --blur-s: blur(10px) saturate(140%);
  --blur-m: blur(18px) saturate(150%);
  --blur-l: var(--blur);

  /* ---- INK. --ink-soft is FROZEN at the value the old comment fought for; the
         room got darker instead, so every recorded ratio improved without
         touching it: .task-sub 4.7 to 6.65, inactive tab 5.2 to 6.58, and
         .il-sub 3.11 (a recorded FAILURE) to 6.02 on the new --ink-dim tier. */
  --ink:          #eef1f7;
  --ink-soft:     #b0bccf;
  --ink-dim:      #a7b3c5;
  --ink-onroom:   #c6d0e0;
  /* NON-TEXT BY CONTRACT: never put a word in this colour. Untagged area dots,
     unlinked goal marks, the sheet grip, divider ticks. */
  --ink-faint:     rgba(176,188,207,0.42);
  --ink-faint-ctl: rgba(176,188,207,0.55);
  --accent-ink:   #ffb27a;
  /* Dark ink on the orange fill. White on --orange measured 2.35:1, a live AA
     failure on the single most-tapped control in the app. This is 7.65:1 and
     keeps the brand hue byte-identical. */
  --on-accent:    #241304;
  /* Re-valued from #7bb4ff. NO LONGER the active tab label (that is --ink now,
     at 7.39:1). Consumers: .count, .jr-due, .task.pinned .task-more, --act-mark;
     as a bare .count on the rail this measures 6.85:1, up from 4.69:1. */
  --blue-deep:    #96c6ff;
  --focus:        #4f9bff;

  /* ---- STATE AS LIGHT — a wash across the row, not a coloured left stripe ---- */
  --tint-stern: linear-gradient(100deg, rgba(255,91,91,0.18), rgba(255,91,91,0) 46%);
  --tint-firm:  linear-gradient(100deg, rgba(244,177,63,0.18), rgba(244,177,63,0) 46%);
  --tint-good:  linear-gradient(100deg, rgba(70,200,150,0.18), rgba(70,200,150,0) 46%);
  --tint-warm:  rgba(255,138,61,0.18);
  --gentle:     #5b9dff;
  --stern:      #ff5b5b;
  --stern-ink:  #ffb0b0;
  --firm:       #f4b13f;
  --firm-ink:   #ffd894;
  --good:       #46c896;
  --good-ink:   #7fe0b4;

  /* ---- STAGE — the light around the canvas. Replaces the desktop edge beams,
         which existed only to hide a hard glow cut at the canvas boundary. */
  --stage-warm:  rgba(255,150,80,0.18);
  --stage-cool:  rgba(90,165,255,0.15);
  --stage-floor: rgba(255,140,60,0.10);
  --stage-ceil:  rgba(0,0,0,0.28);
  --speech-fill: rgba(43,48,60,0.50);
  --speech-ink:  #eef1f7;

  /* ---- ACCENTS. Both old consumers are gone (the header rainbow underline and
         the stage beams). They are now the two ends of the one brand gradient.
         Never use --brand-grad on a glyph under 32px. */
  --accent-warm: #ff8a3d;
  --accent-cool: #4f9bff;
  --brand-grad: linear-gradient(140deg, var(--accent-warm), var(--accent-cool));

  --radius:   24px;
  --radius-s: 16px;
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 22px;
  --r-2xl: 28px;
  --r-pill: 999px;
  --font: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* ---- TYPE. The file had 280 font-size declarations across 46 values,
         including 0.82/0.83/0.84/0.85/0.86/0.88rem — six sizes inside one pixel.
         Hierarchy is WEIGHT, not size. The 15/16 adjacency is deliberate: body
         is 15px, but anything you can TYPE INTO is 16px, and that 1px is the
         only thing stopping iOS Safari force-zooming the page on focus. */
  --t-2xs:   11px;
  --t-xs:    12px;
  --t-sm:    13px;
  --t-base:  15px;
  --t-field: 16px;
  --t-md:    17px;
  --t-lg:    20px;
  --t-xl:    24px;
  --t-2xl:   30px;
  --w-reg: 400;
  --w-med: 500;
  --w-semi: 600;
  --w-bold: 700;
  --lh-tight: 1.2;
  --lh-body: 1.38;
  --lh-loose: 1.5;

  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 14px;
  --sp-5: 16px;
  --sp-6: 20px;
  --sp-7: 28px;

  --hdr-h: 52px;
  /* 76px + safe area. Platform tab bars are 49pt (iOS) / 80dp (Material) once
     you add the label row; 56 and then 64 both squeezed the active pill into a
     collar around the icon with the label hanging out of its bottom edge
     (measured: label overflowed the lamp by 4px). This is ONE number now — the
     on-device block used to redeclare it. */
  --bar-h: 76px;
  /* the bottom bar's active pill — see the .tbtn block. LAMP_W in
     js/tabbar.js mirrors --tb-pill-w and must be changed with it. */
  --tb-pill-w: 60px;
  --tb-pill-h: 40px;
  --tb-pad: 7px;
  --tb-gap: 4px;
  /* written by the visualViewport shim in js/tabbar.js; inert until then */
  --kb: 0px;
  /* the height the app fills. dvh in a browser tab; in an installed iPhone app
     the html[data-standalone] rule below and then js/boot/viewport.js replace
     it (see there). Every rule that sizes the shell reads this. */
  --app-h: 100dvh;
  --press: scale(0.965);
  --m-press: 90ms;

  /* Motion tokens — every animation draws from these so the whole app moves
     with one voice. Transform/opacity only. */
  --m-fast: 130ms;
  --m-base: 240ms;
  --m-slow: 340ms;
  --e-out:    cubic-bezier(0.2, 0, 0, 1);
  --e-spring: cubic-bezier(0.34, 1.35, 0.4, 1);
  --e-inout:  cubic-bezier(0.45, 0, 0.15, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  /* a SOLID fallback under the lit room below. iOS rubber-band overscroll pulls
     past body::before, so this is the colour the user sees at the bounce. */
  background: var(--room-bg);
}

/* Smooth CROSSFADE between the app's pages (main ↔ The Brief ↔ Idea Board)
   instead of a hard white-flash reload. Shared by all pages via styles.css.
   Progressive enhancement: browsers without view transitions just navigate as
   before. (iOS Safari 18.2+ and Chrome support cross-document transitions.) */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.26s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ---------- custom liquid-glass icons (replace Apple emoji) ----------
   A [data-icon="name"] slot is filled with an inline SVG by js/icons-ui.js.
   The SVG scales to the surrounding font-size, so it drops into emoji spots. */
[data-icon] { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
/* The glyph IS the icon now (no tile/border), so size it generously — like an emoji. */
.gicon { width: 1.35em; height: 1.35em; display: inline-block; vertical-align: -0.28em; flex: none; }
/* a touch bigger in the header chips + standalone icon marks */
.hdr-btn [data-icon] .gicon, .hb-ico .gicon, .goal-mark .gicon, .ic-source .gicon, .guest-badge .gicon { width: 1.55em; height: 1.55em; }

/* ---------- THE ROOM — a lit space, not a painted wall ----------
   Layer order (top to bottom): vignette, warm lamp, cool bounce, the wall
   itself falling from --room-2 at the ceiling to --room-0 at the floor.
   The vignette is what replaces the desktop stage edge beams: the frame now
   comes from the light falling off at the corners, not from two drawn lines. */
body::before {
  content: "";
  position: fixed;
  inset: -20%;
  z-index: -2;
  background:
    var(--vignette),
    radial-gradient(58vw 58vw at 86% -10%,  var(--room-warm), transparent 62%),
    radial-gradient(62vw 62vw at -14% 108%, var(--room-cool), transparent 62%),
    linear-gradient(176deg, var(--room-2) 0%, var(--room-1) 46%, var(--room-1) 68%, var(--room-0) 100%);
  background-attachment: fixed;
}
/* a second, slowly drifting wash so the light feels alive */
body::after {
  content: "";
  position: fixed;
  inset: -30%;
  z-index: -1;
  background:
    radial-gradient(46vw 46vw at 22% 28%, var(--room-cool), transparent 62%),
    radial-gradient(44vw 44vw at 78% 72%, var(--room-warm), transparent 62%);
  opacity: 0.5;
  filter: blur(12px);
  animation: drift 22s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(-2%, -1%, 0) scale(1);    opacity: 0.85; }
  to   { transform: translate3d( 3%,  2%, 0) scale(1.08); opacity: 1;    }
}
/* The Brief paints its own opaque backdrop — this drifting wash is fully
   covered there, so it would be pure hidden compositing cost */
body.brief-body::after { content: none; }

.hidden { display: none !important; }

/* ---------- themed scrollbars (default was a white bar in dark mode) ---------- */
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.22) transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.18);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.32); background-clip: padding-box; }
[data-theme="light"] * { scrollbar-color: rgba(40,50,70,0.30) transparent; }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(40,50,70,0.30); background-clip: padding-box; }

/* ---------- the liquid-glass surface ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow), var(--glass-edge);
}

/* ---------- the installed iPhone app ----------
   html[data-standalone="ios"] is stamped by js/boot/viewport.js, and ONLY in
   a home-screen app whose page draws under the status bar (safe-area top > 0).
   iOS 26+ launches that app with dvh short by the status bar until something
   scrolls, which is the gap under the bottom bar that a swipe fixed. Standalone
   has no browser chrome, so the large viewport is the window: size off that.
   The html floor makes the document's own flow reach the bottom edge, because
   WebKit sizes the app to what the flow asks for; it subtracts --kb like the
   shell does, so an open keyboard never leaves scroll room under the shell.
   viewport.js then refines --app-h to measured px. Everywhere else --app-h
   stays 100dvh, exactly as before v145. */
@supports (height: 100lvh) {
  html[data-standalone="ios"] { --app-h: 100lvh; }
}
html[data-standalone="ios"] { min-height: calc(var(--app-h) - var(--kb, 0px)); }

/* ---------- full-screen centered views (setup / sign-in) ---------- */
.screen { min-height: var(--app-h); }

#setup-notice, #signin-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card { padding: 30px; }

.setup-card { max-width: 460px; }
.setup-card h1 { margin-top: 0; }
.setup-card code {
  background: var(--surf-press);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.signin-card {
  max-width: 380px;
  width: 100%;
  text-align: center;
  padding: 40px 32px;
}
.signin-card h1 { margin: 18px 0 4px; font-size: 1.8rem; letter-spacing: -0.5px; }
.tagline   { color: var(--ink-soft); margin: 0 0 26px; }
.fineprint { color: var(--ink-soft); font-size: 0.8rem; margin: 18px 0 0; }
/* the "New here?" line under the sign-in button — same quiet weight, but it has
   to read as tappable, since it's a stranger's only route to the setup guide */
.fineprint + .fineprint { margin-top: 8px; }
.fineprint a { color: var(--orange); text-decoration: none; border-bottom: 1px solid rgba(255,138,61,0.4); padding-bottom: 1px; }
.fineprint a:hover { border-bottom-color: var(--orange); }

/* ---------- emblem (the Chase Limitless mark) ---------- */
.emblem {
  display: inline-flex;
  width: 42px;
  height: 42px;
  flex: none;
  /* The mark is a rounded tile with transparent corners, so drop-shadow traces
     the tile itself — it reads as a lifted chip, not a halo. Cool light only:
     the old orange glow was built for the cliff-diver glyph and fought the
     mark's blue rim light. The lift is what sells it on glass; the faint blue
     just continues the rim light off the edge. */
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.45))
          drop-shadow(0 0 10px rgba(120,170,255,0.28));
}
.emblem svg, .emblem img { width: 100%; height: 100%; display: block; }
.emblem-xl { width: 76px; height: 76px; margin: 0 auto; }

/* ---------- buttons ---------- */
.btn {
  font: inherit;
  border: none;
  border-radius: var(--r-md);
  padding: 11px 20px;
  font-size: var(--t-sm);
  font-weight: var(--w-semi);
  cursor: pointer;
  transition: transform 0.06s ease, box-shadow 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}
/* any button carrying an icon: center the icon with its label (text-only buttons unaffected) */
.btn:has([data-icon]) { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(135deg, var(--orange), #ff6a2b);
  /* was #fff, which measured 2.60:1 on this fill in every theme — a live AA
     failure on the most-tapped control in the app. Dark ink is 7.65:1 and the
     brand hue is untouched. */
  color: var(--on-accent);
  font-weight: var(--w-semi);
  box-shadow: var(--e2), inset 0 1px 0 rgba(255,255,255,0.32);
}
.btn-primary:hover { box-shadow: var(--e3), inset 0 1px 0 rgba(255,255,255,0.4); }
.btn-ghost {
  background: var(--surf-card);
  color: var(--ink-soft);
  padding: 9px 14px;
  border: 1px solid var(--line);
  -webkit-backdrop-filter: var(--blur-s);
  backdrop-filter: var(--blur-s);
}
.btn-ghost:hover { color: var(--ink); background: var(--surf-press); }
/* Destructive actions (delete my account, and anything like it). --stern-ink,
   not --stern: the raw stern red measured too low as TEXT — the same finding
   recorded at .limi-msg.tone-stern. The tint only appears on hover so a
   destructive control is legible at rest and unmistakable under the finger,
   rather than shouting from across the screen. */
.btn-danger { color: var(--stern-ink); }
.btn-danger:hover {
  color: var(--stern-ink);
  background: color-mix(in srgb, var(--stern) 16%, transparent);
  border-color: color-mix(in srgb, var(--stern) 45%, transparent);
}

/* ---------- app header ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 22px;
  padding-top: max(12px, env(safe-area-inset-top));
  /* the SIDE insets matter too: rotate an iPhone and iOS reports 47px of notch /
     rounded-corner on the left and right. Only the ≤600px portrait block padded
     horizontally, and landscape (844px wide) never reaches it — so the logo and
     the Sign out pill sat under the cut-out. Padded here so every width gets it. */
  padding-left: max(22px, env(safe-area-inset-left));
  padding-right: max(22px, env(safe-area-inset-right));
  background: rgba(28,30,35,0.55);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--line);
}
/* The 3px orange-white-blue underline is GONE. An elevated bar separates by
   casting a shadow onto the content beneath it, which is what --e2 on
   .app-header now does; a painted rainbow rule reads as decoration. */

/* The two 3px accent beams that used to frame the stage on desktop are GONE.
   They were never decoration: they sat exactly on the canvas boundary and hid a
   hard cut where focusGlow's radial peak landed on the element edge (measured a
   +21 step in one device pixel, ~600px tall, down both sides). The cut is fixed
   at its source in js/wave.js now, and the frame comes from --vignette. */
/* min-width:0 is what lets the NAME give way instead of the buttons. A flex
   item won't shrink below its content by default, so a long product name used
   to push the header's action chips down — "Chase Limitless" squeezed the Idea
   Board chip to 42px on a 320px screen, under the 44px touch minimum. Now the
   text truncates and the chips (flex: none, below) keep their full target. */
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-text { min-width: 0; overflow: hidden; }
.brand-text strong {
  display: block; line-height: 1.05; font-size: 1.05rem; letter-spacing: -0.3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub { color: var(--ink-soft); font-size: 0.76rem; }
.account { display: flex; align-items: center; gap: 8px; }
/* The header's email only: Settings has its own copy (#user-email-settings),
   which must never inherit the header's truncation or its phone hiding. */
.app-header .user-email {
  color: var(--ink-soft);
  font-size: 0.8rem;
  max-width: 30vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* header action buttons (icon + label; label collapses on phone) */
/* flex: none — these are touch targets, they are never the thing that gives. */
.hdr-btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; flex: none; }
.hb-ico { font-size: 1rem; line-height: 1; }
/* the Idea Board chip — a liquid-glass orange jewel beside the logo */
.board-chip {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  margin-left: 8px;
  padding: 8px 15px;
  font-size: var(--t-sm);
  font-weight: var(--w-semi);
  /* was #fff, which measured 1.84:1 once Day's sky sat behind the translucent
     orange glass. --on-accent is dark ink and reads on the chip in all three. */
  color: var(--on-accent);
  border-radius: var(--r-md);
  border: 1px solid rgba(255,236,212,0.45);
  /* OPAQUE on purpose. While this was translucent the label's contrast rode on
     whatever room was behind it: #fff measured 1.84:1 over Day's sky, and dark
     ink measured 2.85:1 over Studio's. Opaque pins the pair at 7.65:1 everywhere. */
  background: linear-gradient(135deg, #ffb25c, #ff7a3a 55%, #ff6a52);
  box-shadow:
    0 6px 20px rgba(255,108,44,0.4),
    0 0 22px rgba(255,140,70,0.22),
    inset 0 1px 1px rgba(255,255,255,0.6),
    inset 0 -4px 10px rgba(168,54,16,0.28);
  text-shadow: 0 1px 1px rgba(255,225,195,0.45);
  transition: transform var(--m-base) var(--e-out), box-shadow var(--m-base) var(--e-out), filter var(--m-base) var(--e-out);
}
/* glossy specular top + faint inner refraction */
.board-chip::before {
  content: "";
  position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(130% 80% at 50% -35%, rgba(255,255,255,0.6), rgba(255,255,255,0) 58%),
    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 42%);
}
/* a slow liquid sheen that drifts across the glass (compositor-only transform) */
.board-chip::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 0; width: 45%; z-index: -1;
  background: linear-gradient(105deg, transparent, rgba(255,255,255,0.5), transparent);
  transform: translateX(-220%) skewX(-18deg);
  animation: chipSheen 5.5s ease-in-out infinite;
}
@keyframes chipSheen {
  0%, 62% { transform: translateX(-220%) skewX(-18deg); }
  100%    { transform: translateX(360%)  skewX(-18deg); }
}
/* "compositor-only transform" was the intent, but a z-index:-1 pseudo inside an
   isolated, backdrop-filtered chip never gets its own layer — so this infinite
   sheen billed the MAIN THREAD ~56 style recalcs a SECOND, forever, for a 36px
   decoration (measured on an iPhone 14: 60/s running vs 3.6/s cancelled).
   will-change: transform was tried first and changed nothing. So: the shine is
   a pointer-era flourish — keep it where there IS a pointer, and give phones,
   which never see a hover state anyway, the static glass and their CPU back. */
@media (hover: none) {
  .board-chip::after { animation: none; }
}
.board-chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.07) saturate(1.05);
  box-shadow:
    0 10px 28px rgba(255,108,44,0.55),
    0 0 30px rgba(255,150,80,0.36),
    inset 0 1px 1px rgba(255,255,255,0.75),
    inset 0 -4px 10px rgba(168,54,16,0.32);
}
.board-chip .hb-ico { font-size: 1.05rem; filter: drop-shadow(0 1px 1px rgba(120,40,10,0.4)); }

/* ================================================================
   WORKSPACE — wave stage (66%) + conversation rail (33%)
================================================================ */
.workspace {
  width: 100%;
  margin: 0 auto;
  padding: 22px;
  min-height: calc(100dvh - 62px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;   /* wave fills the left, narrow rail on the right */
  gap: 20px;
  align-items: stretch;
}

/* ---------- the wave stage ---------- */
.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  text-align: center;
  padding: 14px 0;
  /* soft light filling the whole stage — fades out before any edge, so no box.
     Each theme brings its own; Night sets both to transparent (a moon lights
     nothing but itself), which is what retires the old
     [data-theme="space"] .stage { background: none } override. */
  background:
    radial-gradient(82% 64% at 50% 50%, var(--stage-warm), transparent 72%),
    radial-gradient(66% 50% at 50% 50%, var(--stage-cool), transparent 74%);
}
/* the floor bounce + ceiling falloff that give the stage a top and a bottom
   without drawing a single line. z-index 0 keeps it under the canvas. */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  /* BOTH radial, deliberately. A full-width linear ceiling band gets cut at the
     stage box's left/right edges and paints a hard vertical step into the room
     (measured 28,31,37 -> 22,24,28 in one pixel). Radials fade to transparent
     before they reach any edge, so the stage has a top and a bottom but no box. */
  background:
    radial-gradient(120% 46% at 50% 104%, var(--stage-floor), transparent 70%),
    radial-gradient(80% 46% at 50% -10%, var(--stage-ceil), transparent 62%);
}

/* ---------- the flowing-wave canvas (Limi's presence) ---------- */
.limi-wave {
  display: block;
  position: relative;
  z-index: 1;
  width: 100%;
  height: 68vh;   /* scales with the screen — no hard cap, fills any monitor */
}
.limi-latest, .stage-hint { position: relative; z-index: 1; }

/* Limi's latest line — an Apple-style Liquid Glass box (text + word-hop unchanged).
   Padding & radius in em, so the whole box scales with the text size. */
.limi-latest {
  position: relative;
  isolation: isolate;   /* clean stacking context for the glass layers */
  overflow: visible;    /* let the cursive glow + flowing line breathe */
  margin: 0;
  max-width: 38ch;
  padding: 0.8em 1.3em;
  font-size: clamp(1.02rem, 1.5vw, 1.45rem);
  line-height: 1.5;
  font-weight: 500;
  text-align: center;
  color: #f4f7fc;
  border-radius: 1.2em;
  /* only the OUTER glow lives here; the glass is built in the layers below */
  box-shadow:
    0 24px 60px rgba(0,0,0,0.5),
    0 0 36px rgba(255,140,70,0.15),
    0 0 54px rgba(80,150,255,0.15);
  /* text: slightly liquid-glossy + a soft magical glow (cool with a warm hint) */
  text-shadow:
    0 -0.5px 0 rgba(255,255,255,0.55),
    0 1px 2px rgba(0,0,0,0.3),
    0 0 12px rgba(190,212,255,0.42),
    0 0 22px rgba(255,182,130,0.18);
  transition: opacity 0.4s ease;
}
/* Layer 1 — the lens: warps the background through the glass like molded glass */
.limi-latest::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  border-radius: inherit;
  -webkit-backdrop-filter: blur(8px) brightness(1.06) saturate(1.4);
  backdrop-filter: blur(8px) brightness(1.06) saturate(1.4);
  /* NO SVG refraction filter here: the old animated #glass-distortion
     (feTurbulence + feDisplacementMap) re-rasterized this box on the CPU
     every frame over the live canvas and janked the whole stage. */
}
/* Layer 2 — specular: white tint + lit rounded edge + inner light */
.limi-latest::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    radial-gradient(120% 95% at 50% -20%, rgba(255,255,255,0.18), rgba(255,255,255,0) 55%),
    linear-gradient(135deg, rgba(255,255,255,0.10), rgba(255,255,255,0.015));
  border: 1px solid var(--line-strong);
  box-shadow:
    inset 0 1.5px 2px rgba(255,255,255,0.45),
    inset 0 -2px 6px rgba(255,255,255,0.10);
}
/* each word hops in, staggered, so the line looks actively spoken */
.limi-latest .word {
  display: inline-block;
  opacity: 0;
  animation: wordHop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes wordHop {
  0%   { opacity: 0; transform: translateY(0.5em) scale(0.92); }
  60%  { opacity: 1; transform: translateY(-0.1em) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
/* hidden until Limi has actually said something (JS toggles .has-text) */
.limi-latest:not(.has-text) { display: none; }

/* the glowing line that slowly flows around the box */
@property --flow-angle { syntax: '<angle>'; inherits: false; initial-value: 0deg; }
.lg-flow {
  position: absolute; inset: 0; z-index: 0; border-radius: inherit; padding: 1.6px; pointer-events: none;
  background: conic-gradient(from var(--flow-angle),
    transparent 0deg 80deg, rgba(255,176,110,0.85) 112deg, rgba(255,255,255,0.95) 130deg,
    rgba(120,175,255,0.9) 148deg, transparent 180deg 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  filter: drop-shadow(0 0 6px rgba(255,180,120,0.55)) drop-shadow(0 0 8px rgba(120,170,255,0.5));
  animation: flowRound 8s linear infinite;
}
@keyframes flowRound { to { --flow-angle: 360deg; } }

/* phase 1: the Outfit line that word-hops in */
.lg-text { position: relative; z-index: 1; display: inline-block; transition: opacity 0.45s ease; }

/* phase 2: the same line re-written per-letter in cursive */
.lg-cursive { position: relative; z-index: 1; display: none; }
.lg-cursive.show { display: inline-block; }
.lg-cur-text {
  display: inline-block;
  font-family: "Caveat", cursive; font-weight: 600;
  font-size: 1.5em; line-height: 1.32; letter-spacing: 0.5px;
  text-align: center; max-width: 100%;
  color: #f4f8ff;
}
/* keep each word's letters together so lines only break BETWEEN words */
.lg-cur-text .cw { display: inline-block; white-space: nowrap; }
/* each letter focuses in softly with a shine that flares and fades (no blocky edges) */
.lg-cur-text .ch {
  display: inline-block; opacity: 0;
  animation: chWrite 0.6s ease forwards; animation-delay: var(--d, 0s);
  text-shadow: 0 0 3px rgba(190,212,255,0.3), 0 1px 2px rgba(0,0,0,0.4);
}
@keyframes chWrite {
  0%   { opacity: 0; transform: translateY(0.12em); filter: blur(2.4px);
         text-shadow: 0 0 16px rgba(255,255,255,0.95), 0 0 30px rgba(200,222,255,0.9); }
  45%  { opacity: 1; filter: blur(0.4px);
         text-shadow: 0 0 11px rgba(255,255,255,0.8), 0 0 20px rgba(200,222,255,0.6); }
  100% { opacity: 1; transform: translateY(0); filter: blur(0);
         text-shadow: 0 0 3px rgba(190,212,255,0.28), 0 1px 2px rgba(0,0,0,0.4); }
}

.stage-hint { color: var(--ink-soft); font-size: 0.82rem; }

/* ================================================================
   THE RAIL — Chat / Tasks
================================================================ */
.rail {
  display: flex;
  flex-direction: column;
  padding: 8px;
  min-height: 0;
  position: sticky;
  top: 78px;
  max-height: calc(100dvh - 100px);
}

.rail-tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  margin-bottom: 6px;
}
.tab {
  flex: 1;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  border-radius: 12px;
  padding: 9px 12px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tab:hover { color: var(--ink); }
.tab.is-active {
  color: var(--blue-deep);
  background: var(--surf-press);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.rail-panel { display: flex; flex-direction: column; min-height: 0; flex: 1; }

/* ---------- Limi feed ---------- */
.limi-feed {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 10px 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.limi-msg {
  position: relative;
  align-self: flex-start;
  max-width: 92%;
  background: var(--glass-soft);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gentle);
  border-radius: var(--radius-s);
  box-shadow: 0 8px 22px rgba(0,0,0,0.3);
  padding: 13px 15px 13px 16px;
  animation: rise 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
  transition: opacity 0.6s ease;
}
.msg-head { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; padding-bottom: 7px; border-bottom: 1px solid var(--glass-border); }
.limi-msg .who {
  font-size: var(--t-2xs);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  /* was --ink-soft over the tinted bubble, measured 3.03:1 Studio / 2.74:1 Day */
  color: var(--ink);
  font-weight: var(--w-bold);
}
/* overflow-wrap: a pasted reel/URL is ONE unbreakable token — without this it
   painted 197px outside the bubble and turned #limi-feed into a sideways
   scroller on a phone. (.task-title / .wins-text already break; this was a gap.) */
.limi-msg p { margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.limi-msg.tone-firm  { border-left-color: var(--firm); }
.limi-msg.tone-stern { border-left-color: var(--stern); }
/* --firm/--stern themselves measured too low as text on the bubble; --stern-ink is the
   lightened pair meant to carry words. The border-left still uses --stern. */
.limi-msg.tone-stern .who { color: var(--stern-ink); }

/* Ian's own messages — right-aligned, tinted */
.user-msg {
  align-self: flex-end;
  max-width: 88%;
  background: linear-gradient(135deg, rgba(255,138,61,0.22), rgba(79,155,255,0.22));
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  border-bottom-right-radius: 6px;
  padding: 11px 14px;
  animation: rise 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
  transition: opacity 0.6s ease;
}
.user-msg p { margin: 0; line-height: 1.45; overflow-wrap: anywhere; }

/* history bubbles replayed on load skip the entrance animation (no fly-in) */
.limi-msg.no-rise, .user-msg.no-rise { animation: none; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* small avatar chip inside bubbles (JS sets text "Li") */
.limi-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--blue));
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.5px;
  flex: none;
  box-shadow: 0 2px 10px rgba(79,155,255,0.45);
}
.limi-mark.big { width: 64px; height: 64px; font-size: 1.4rem; margin: 0 auto; }
.limi-mark.sm  { width: 22px; height: 22px; font-size: 0.55rem; }
/* when the mark holds Limi's infinity logo (not initials): white glyph, sized to the badge */
.limi-mark .gicon { width: 78%; height: 78%; }
.limi-mark .gicon [stroke]:not([stroke="none"]) { stroke: #fff; }
.limi-mark .gicon [fill]:not([fill="none"]) { fill: #fff; }

/* "Limi is typing…" dots */
.typing { display: inline-flex; gap: 5px; align-items: center; padding: 3px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 0.9; } }

/* ---------- guest chime-in bubbles ---------- */
.guest-msg {
  align-self: flex-start;
  max-width: 92%;
  margin: -2px 0 0 22px;
  background: var(--glass-soft);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-left: 3px solid var(--guest-accent, var(--ink-soft));
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.28);
  padding: 10px 14px;
  animation: rise 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
  transition: opacity 0.6s ease;
}
.guest-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--glass-border); }
.guest-badge {
  width: 27px; height: 27px;
  border-radius: 50%;
  background: var(--surf-press);
  border: 2px solid var(--guest-accent, var(--ink-soft));
  font-size: 0.98rem;
  line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  flex: none;
}
.guest-name {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  color: var(--guest-accent, var(--ink-soft));
}
.guest-msg p { margin: 0; line-height: 1.45; font-size: 0.94rem; overflow-wrap: anywhere; }

/* ---------- chat input (pinned at bottom of the chat panel) ---------- */
.chat-form {
  display: flex;
  gap: 8px;
  padding: 10px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.chat-send {
  flex: none;
  width: 44px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}
/* mic button (talk to Limi) */
.mic-btn {
  flex: none; width: 44px; padding: 0; font-size: 1.05rem; line-height: 1;
  background: var(--surf-card); color: var(--ink);
  border: 1px solid var(--line);
}
.mic-btn:hover { background: rgba(255,255,255,0.16); }
.mic-btn.listening {
  background: linear-gradient(135deg, var(--orange), var(--blue));
  color: #fff; border-color: transparent;
  animation: micPulse 1.1s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,138,61,0.45); }
  50%      { box-shadow: 0 0 0 7px rgba(255,138,61,0); }
}
[data-theme="light"] .mic-btn { background: rgba(40,72,112,0.06); border-color: rgba(40,72,112,0.2); }
[data-theme="light"] .mic-btn:hover { background: rgba(40,72,112,0.12); }

/* ---------- add form (Tasks tab) ---------- */
.add-form { padding: 12px; margin: 6px 6px 18px; }
.input {
  font: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  background: var(--surf-card);
  color: var(--ink);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--ink-soft); }
.input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(79,155,255,0.25);
}
.input[type="date"] { color-scheme: dark; }
.add-row { display: flex; gap: 10px; margin-top: 10px; }
.input-date { flex: 1; }
.add-row .btn-primary { flex: none; }

/* ================================================================
   CHECKLISTS — the lists you build and run (js/checklists.js + -ui.js).
   Successor to the going-out prep: same engine, same feel, but the list
   is yours and there can be many. Every surface takes its colour from
   ONE pair of accent tokens set by a .ck-accent-* class, so a list is
   recognisably itself in the header, the pop-up and the open list.
================================================================ */
.ck-accent-cool   { --ck-a: #46d6ff; --ck-b: #2f80ff; }
.ck-accent-warm   { --ck-a: #ff8a3d; --ck-b: #ff5e7a; }
.ck-accent-green  { --ck-a: #37d39a; --ck-b: #46d6ff; }
.ck-accent-violet { --ck-a: #9b6bff; --ck-b: #2f80ff; }
/* Anything that forgets to declare a pair still gets a sane one. :where() keeps
   this at ZERO specificity — as a plain selector it tied with .ck-accent-* and,
   coming later in the file, won every tie: every chip, card and template
   rendered blue no matter which colour the list actually had. */
:where(.ck-chip, .ck-card, .ckr-card, .cks-row, .cks-tpl, .cks-accent) { --ck-a: #46d6ff; --ck-b: #2f80ff; }

/* ---------- the run pop-up ---------- */
.ck-overlay {
  position: fixed; inset: 0; z-index: 220;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10,12,16,0.58);
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
}
.ck-overlay.hidden { display: none; }
.ck-card {
  position: relative; width: 100%; max-width: 400px; padding: 24px 22px 18px; border-radius: 22px;
  max-height: 88dvh; overflow-y: auto; text-align: center;
  animation: goPop 0.26s cubic-bezier(0.2,0.9,0.3,1.2);
}
@keyframes goPop { from { opacity: 0; transform: translateY(14px) scale(0.95); } to { opacity: 1; transform: none; } }
.ck-close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 10px; cursor: pointer;
  font-size: 0.9rem; color: var(--ink); background: var(--surf-card); border: 1px solid var(--line);
}
.ck-close:hover { background: rgba(255,255,255,0.16); }
.ck-emoji { font-size: 2.6rem; line-height: 1; margin: 2px 0 8px; }
.ck-emoji .gicon { width: 1em; height: 1em; vertical-align: middle; }
.ckr-ico .gicon { width: 1.3em; height: 1.3em; vertical-align: -0.28em; }
.journal-icon .gicon { width: 1em; height: 1em; vertical-align: -0.16em; }
@media (prefers-reduced-motion: reduce) { .ck-card { animation: none; } }
.ck-title { margin: 0 0 4px; font-size: 1.2rem; letter-spacing: -0.3px; }
.ck-sub { margin: 0 0 14px; font-size: 0.88rem; color: var(--ink-soft); line-height: 1.4; }
.ck-bar { height: 8px; border-radius: 99px; background: var(--surf-press); overflow: hidden; margin: 0 0 5px; }
.ck-bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--ck-a), var(--ck-b)); transition: width 0.4s cubic-bezier(.22,1,.36,1); }
[data-theme="light"] .ck-bar { background: rgba(40,72,112,0.12); }
.ck-count { font-size: 0.72rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 12px; }

/* ---------- item rows (shared by the pop-up and the open-list card) ---------- */
.ck-list { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.ck-item {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 13px; cursor: pointer;
  background: var(--surf-card); border: 1px solid var(--line); transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}
[data-theme="light"] .ck-item { background: rgba(40,72,112,0.05); }
.ck-item:hover { background: var(--surf-press); }
.ck-check {
  flex: none; width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  font-size: 0.8rem; font-weight: 800; color: #fff; background: var(--surf-card);
  border: 1.5px solid rgba(255,255,255,0.22); transition: all 0.15s;
}
.ck-item.is-checked { border-color: color-mix(in srgb, var(--ck-a) 50%, transparent); }
.ck-item.is-checked .ck-check { background: linear-gradient(135deg, var(--ck-a), var(--ck-b)); border-color: transparent; }
.ck-item.is-checked .ck-label { text-decoration: line-through; opacity: 0.55; }
.ck-label { font-size: 0.95rem; line-height: 1.3; }

.ck-actions { display: flex; gap: 9px; margin-top: 14px; }
.ck-clear { flex: none; font: inherit; font-size: 0.85rem; padding: 10px 16px; border-radius: 11px; cursor: pointer;
  background: transparent; color: var(--ink-soft); border: 1px solid var(--line-strong); }
.ck-clear:hover { color: var(--ink); background: var(--surf-card); }
.ck-go { flex: 1; }
.ck-gate-actions { margin-top: 18px; }
.ck-no { flex: none; font: inherit; font-size: 0.9rem; padding: 11px 16px; border-radius: 12px; cursor: pointer;
  background: transparent; color: var(--ink-soft); border: 1px solid var(--line-strong); }
.ck-no:hover { color: var(--ink); background: var(--surf-card); }
.ck-yes { flex: 1; }
.ck-edit { margin-top: 10px; font: inherit; font-size: 0.8rem; padding: 6px 10px; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--ink-soft); border: none; text-decoration: underline; text-underline-offset: 3px; }
.ck-edit:hover { color: var(--ink); }
/* the card's main button wears the LIST's colour, not the app's orange — inside
   this card the list is the subject, and the orange read as a second, louder
   call to action competing with the ticks */
.ck-card .btn-primary {
  background: linear-gradient(135deg, var(--ck-a), var(--ck-b));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--ck-b) 40%, transparent), inset 0 1px 0 rgba(255,255,255,0.35);
}
.ck-card .btn-primary:hover {
  box-shadow: 0 10px 30px color-mix(in srgb, var(--ck-b) 55%, transparent), inset 0 1px 0 rgba(255,255,255,0.4);
}

/* ---------- the header chips ---------- */
/*  The pinned chips are capped BY WIDTH, not by JS: the header row measured
    332px inside a 320px screen back when it held ONE going-out chip, so the
    narrow breakpoints below drop pins entirely and leave the door chip, which
    still reaches every list in one tap. Nothing is ever unreachable, it just
    takes one more tap on a small screen. */
.ck-chips { display: flex; align-items: center; gap: 6px; margin-left: 8px; }
/* three pins on a laptop; the phone block cuts this to one and the 320px block
   to none. Capping in CSS (not JS) means the same markup ships everywhere and a
   rotation re-caps instantly with no re-render. */
.ck-chips .ck-chip:nth-child(n+4) { display: none; }
/*  An IDLE pin is quiet dark glass with a hint of its colour in the rim: the
    Idea Board's orange jewel is the header's one headline, and three saturated
    jewels beside it turned the row into a sweet shop. The colour arrives when
    it means something — a RUNNING list fills with its accent, glows and shows
    its count, so the live one is the thing your eye lands on. */
.ck-chip {
  position: relative; isolation: isolate; flex: none;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 11px; border-radius: 14px; cursor: pointer;
  color: var(--ink); font: inherit; font-size: 0.8rem; font-weight: 700;
  border: 1px solid color-mix(in srgb, var(--ck-a) 30%, rgba(255,255,255,0.14));
  background: var(--surf-card);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  transition: transform 0.18s ease, box-shadow 0.28s ease, background 0.28s ease, border-color 0.28s ease;
}
[data-theme="light"] .ck-chip { background: rgba(40,72,112,0.06); }
.ck-chip:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--ck-a) 16%, rgba(255,255,255,0.06));
  border-color: color-mix(in srgb, var(--ck-a) 50%, transparent);
}
.ck-chip-count { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.2px; color: #fff; text-shadow: 0 1px 2px rgba(10,20,45,0.55); }

/* running = filled with its colour, breathing, counting */
.ck-chip.is-running {
  color: #fff;
  border-color: color-mix(in srgb, var(--ck-a) 55%, rgba(255,255,255,0.35));
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--ck-a) 42%, transparent),
    color-mix(in srgb, var(--ck-b) 38%, transparent));
  animation: ckPulse 2.6s ease-in-out infinite;
}
.ck-chip.is-running::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(130% 80% at 50% -35%, rgba(255,255,255,0.55), rgba(255,255,255,0) 58%),
    linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0) 42%);
}
.ck-chip.is-running .hb-ico { filter: drop-shadow(0 1px 1px rgba(20,40,80,0.45)); }
/* finished but not yet cleared: colour stays, the pulse stops */
.ck-chip.is-finished { animation: none; }
@keyframes ckPulse {
  0%, 100% { box-shadow: 0 4px 14px color-mix(in srgb, var(--ck-b) 26%, transparent); }
  50%      { box-shadow: 0 6px 22px color-mix(in srgb, var(--ck-b) 55%, transparent), 0 0 16px color-mix(in srgb, var(--ck-a) 40%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .ck-chip.is-running { animation: none; } }

/* the door chip — deliberately quieter than the Idea Board's orange jewel;
   it's a way IN to your lists, not a headline */
.checklists-chip {
  padding: 8px 11px; border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--surf-card);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: background 0.18s ease, transform 0.18s ease;
}
.checklists-chip:hover { background: var(--surf-press); transform: translateY(-1px); }
[data-theme="light"] .checklists-chip { background: rgba(40,72,112,0.06); border-color: rgba(40,72,112,0.16); }

/* ---------- a running checklist, mirrored into the Open list ---------- */
#checklist-runs:empty { display: none; }
.ckr-card {
  margin: 0 0 10px; border-radius: 14px; overflow: hidden;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--ck-a) 16%, transparent),
    color-mix(in srgb, var(--ck-b) 10%, transparent));
  border: 1px solid color-mix(in srgb, var(--ck-a) 34%, transparent);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}
.ckr-card.is-done { background: linear-gradient(180deg, rgba(20,120,60,0.18), rgba(20,120,60,0.08)); border-color: rgba(20,120,60,0.4); }
.ckr-head {
  width: 100%; display: flex; align-items: center; gap: 9px; padding: 11px 13px;
  font: inherit; cursor: pointer; background: transparent; border: none; color: var(--ink); text-align: left;
}
.ckr-ico { font-size: 1.1rem; flex: none; }
.ckr-title { flex: 1; font-size: 0.92rem; font-weight: 600; }
.ckr-count { font-size: 0.74rem; font-weight: 700; color: var(--ink-soft); padding: 2px 8px; border-radius: 99px; background: var(--surf-press); }
.ckr-card.is-done .ckr-count { color: #11532e; background: rgba(20,120,60,0.22); }
.ckr-chev { flex: none; font-size: 0.8rem; color: var(--ink-soft); }
.ckr-body { padding: 0 11px 11px; }
.ckr-body.hidden { display: none; }
.ckr-body .ck-list { margin: 2px 0 0; }
.ckr-clear { margin-top: 9px; width: 100%; font: inherit; font-size: 0.78rem; padding: 8px; border-radius: 10px; cursor: pointer;
  background: transparent; color: var(--ink-soft); border: 1px solid var(--line); }
.ckr-clear:hover { color: var(--ink); background: var(--surf-card); }

/* ================================================================
   CHECKLIST MANAGER — the index + editor sheet (js/checklists-ui.js)
================================================================ */
.cks-overlay {
  position: fixed; inset: 0; z-index: 222;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10,12,16,0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.cks-overlay.hidden { display: none; }
.cks-card {
  width: 100%; max-width: 440px; padding: 20px 22px 22px; border-radius: 20px;
  max-height: 86dvh; overflow-y: auto;
  animation: rise 0.22s ease;
}
.cks-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cks-head h2 { margin: 0; font-size: 1.15rem; letter-spacing: -0.3px; }
.cks-close {
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; flex: none;
  font-size: 0.95rem; color: var(--ink);
  background: var(--surf-card); border: 1px solid var(--line);
}
.cks-close:hover { background: rgba(255,255,255,0.16); }
.cks-hint { margin: 0 0 14px; font-size: 0.85rem; color: var(--ink-soft); line-height: 1.45; }

/* --- index rows --- */
.cks-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cks-row {
  display: flex; align-items: center; gap: 9px; padding: 10px 11px; border-radius: 13px;
  background: var(--surf-card); border: 1px solid var(--line);
}
[data-theme="light"] .cks-row { background: rgba(40,72,112,0.05); }
.cks-row-ico { flex: none; font-size: 1.25rem; line-height: 1; }
.cks-row-ico .gicon { width: 1em; height: 1em; vertical-align: -0.15em; }
.cks-row-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cks-row-name { font-size: 0.94rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cks-row-meta { font-size: 0.74rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cks-act {
  flex: none; width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font: inherit; font-size: 0.85rem;
  color: var(--ink-soft); background: var(--surf-card); border: 1px solid var(--line);
}
.cks-act:hover { color: var(--ink); background: rgba(255,255,255,0.15); }
.cks-pin.is-on { color: #ffcf5e; }
.cks-run {
  flex: none; font-size: 0.8rem; font-weight: 700; padding: 7px 13px; border-radius: 10px; cursor: pointer;
  color: #fff; border: 1px solid color-mix(in srgb, var(--ck-a) 45%, rgba(255,255,255,0.4));
  background: linear-gradient(135deg, color-mix(in srgb, var(--ck-a) 55%, transparent), color-mix(in srgb, var(--ck-b) 50%, transparent));
}
.cks-run:hover { filter: brightness(1.08); }
.cks-new { width: 100%; }

/* --- the empty state / starter templates --- */
.cks-empty { margin-bottom: 14px; }
.cks-empty-line { margin: 0 0 10px; font-size: 0.86rem; color: var(--ink-soft); }
.cks-tpls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cks-tpl {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  padding: 11px 12px; border-radius: 13px; cursor: pointer; font: inherit; text-align: left;
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--ck-a) 34%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--ck-a) 15%, transparent), color-mix(in srgb, var(--ck-b) 9%, transparent));
  transition: transform 0.15s ease, filter 0.15s ease;
}
.cks-tpl:hover { transform: translateY(-1px); filter: brightness(1.1); }
.cks-tpl-ico { font-size: 1.3rem; line-height: 1; }
.cks-tpl-ico .gicon { width: 1em; height: 1em; }
.cks-tpl-name { font-size: 0.88rem; font-weight: 600; }
.cks-tpl-n { font-size: 0.72rem; color: var(--ink-soft); }

/* --- the editor --- */
.cks-field { display: block; margin: 0 0 14px; }
.cks-label { display: block; margin-bottom: 6px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.7px; color: var(--ink-soft); }
.cks-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.cks-icon {
  height: 40px; border-radius: 11px; cursor: pointer; font-size: 1.2rem; line-height: 1;
  display: grid; place-items: center;
  background: var(--surf-card); border: 1px solid var(--line);
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}
.cks-icon .gicon { width: 1em; height: 1em; }
.cks-icon:hover { background: var(--surf-press); transform: translateY(-1px); }
.cks-icon.is-on { border-color: rgba(255,255,255,0.55); background: rgba(255,255,255,0.18); }
.cks-accents { display: flex; gap: 6px; flex-wrap: wrap; }
.cks-accent {
  flex: 1; min-width: 72px; padding: 9px 10px; border-radius: 11px; cursor: pointer; font: inherit; font-size: 0.8rem; font-weight: 600;
  color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--ck-a) 40%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--ck-a) 30%, transparent), color-mix(in srgb, var(--ck-b) 24%, transparent));
  opacity: 0.62; transition: opacity 0.15s ease, transform 0.15s ease;
}
.cks-accent.is-on { opacity: 1; transform: translateY(-1px); border-color: rgba(255,255,255,0.55); }
.cks-resets { display: flex; gap: 6px; }
.cks-reset {
  flex: 1; display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: 9px 10px; border-radius: 11px; cursor: pointer; font: inherit; text-align: left; color: var(--ink);
  background: var(--surf-card); border: 1px solid var(--line);
  transition: background 0.14s ease, border-color 0.14s ease;
}
.cks-reset:hover { background: var(--surf-press); }
.cks-reset.is-on { background: rgba(255,255,255,0.16); border-color: rgba(255,255,255,0.45); }
.cks-reset-label { font-size: 0.84rem; font-weight: 600; }
.cks-reset-hint { font-size: 0.68rem; color: var(--ink-soft); line-height: 1.25; }

.cks-items { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.cks-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 11px;
  background: var(--surf-card); border: 1px solid var(--line);
}
[data-theme="light"] .cks-item { background: rgba(40,72,112,0.05); }
.cks-item-grip { flex: none; color: var(--ink-soft); font-size: 0.9rem; }
.cks-item-label { flex: 1; min-width: 0; font-size: 0.88rem; overflow-wrap: anywhere; }
.cks-item-up, .cks-item-del {
  flex: none; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 0.8rem;
  color: var(--ink-soft); background: var(--surf-card); border: 1px solid var(--line);
}
.cks-item-up:hover, .cks-item-del:hover { color: var(--ink); background: rgba(255,255,255,0.15); }
.cks-item-up[disabled] { opacity: 0.3; cursor: default; }
.cks-item-empty { font-size: 0.82rem; color: var(--ink-soft); padding: 4px 2px; }
.cks-add { display: flex; gap: 8px; }
.cks-add .input { flex: 1; min-width: 0; }
.cks-add .btn { flex: none; }

.cks-switches { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 16px; }
.cks-switch { display: flex; align-items: center; gap: 9px; font-size: 0.88rem; cursor: pointer; }
.cks-switch input { width: 18px; height: 18px; accent-color: var(--orange); flex: none; }
.cks-foot { display: flex; gap: 9px; }
.cks-back { flex: none; font: inherit; font-size: 0.85rem; padding: 10px 16px; border-radius: 11px; cursor: pointer;
  background: transparent; color: var(--ink-soft); border: 1px solid var(--line-strong); }
.cks-back:hover { color: var(--ink); background: var(--surf-card); }
.cks-save { flex: 1; }

.settings-overlay {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10,12,16,0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.settings-overlay.hidden { display: none; }
.settings-card {
  width: 100%; max-width: 420px; padding: 20px 22px; border-radius: 20px;
  max-height: 86dvh; overflow-y: auto;
  animation: rise 0.22s ease;
}
.settings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.settings-head h2 { margin: 0; font-size: 1.15rem; letter-spacing: -0.3px; }
.settings-close {
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer; flex: none;
  font-size: 0.95rem; color: var(--ink);
  background: var(--surf-card); border: 1px solid var(--line);
}
.settings-close:hover { background: rgba(255,255,255,0.16); }
.settings-section { padding: 15px 0; border-top: 1px solid var(--line); }
.settings-section:first-of-type { border-top: none; padding-top: 8px; }
.settings-section h3 { margin: 0 0 5px; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.7px; color: var(--ink-soft); }
.settings-hint { margin: 0 0 11px; font-size: 0.85rem; color: var(--ink-soft); line-height: 1.45; }
/* every Settings button is a phone tap target: 44px, Apple's floor */
.settings-section .btn { min-height: 44px; }
.settings-section a.btn { display: inline-flex; align-items: center; } /* a link ignores min-height until it is a box */
/* the privacy page is a button-styled link: no underline (no bare hyperlinks) */
#privacy-open { text-decoration: none; }

/* ---------- win-sound bar (lives in Settings) ---------- */
.sound-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 0; padding: 8px 11px;
  border-radius: 13px;
  background: var(--surf-card);
  border: 1px solid var(--line);
}
.sound-label { font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap; }
.sound-select {
  flex: 1; min-width: 0; font: inherit; font-size: 0.85rem;
  color: var(--ink); background: var(--surf-card);
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px;
  min-height: 44px;
}
.sound-select option { color: #1a1a1a; }
.sound-btn {
  flex: none; width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
  font-size: 0.9rem; line-height: 1; border: 1px solid var(--line);
  background: var(--surf-card); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.sound-btn:hover { background: rgba(255,255,255,0.16); }
.sound-btn.is-muted { opacity: 0.55; }

/* ---------- momentum: daily goal + routine ---------- */
.mom-card { padding: 12px 14px; margin: 4px 4px 12px; border-radius: 14px; }
.mom-row { display: flex; align-items: center; gap: 10px; }
.mom-title { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--ink-soft); font-weight: 600; flex: 1; }
.mom-count { font-size: 1.05rem; font-weight: 700; }
.mom-quota { font: inherit; font-weight: 700; color: var(--accent-ink); background: none; border: none; border-bottom: 1px dashed currentColor; cursor: pointer; padding: 0 1px; }
.mom-streak { font-size: 0.95rem; font-weight: 700; display: inline-flex; align-items: center; gap: 5px; }
.mom-bar { height: 8px; border-radius: 99px; background: var(--surf-press); overflow: hidden; margin: 9px 0 7px; }
.mom-bar > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--orange), #ff5e7a); transition: width 0.45s cubic-bezier(.22,1,.36,1); }
.mom-sub { font-size: 0.78rem; color: var(--ink-soft); display: flex; align-items: center; flex-wrap: wrap; gap: 2px 5px; }
/* icons in the momentum rows match the text height (the global 1.35em emoji-slot
   size + baseline drop makes them ride high next to small bold text) */
.mom-streak .gicon, .mom-sub .gicon, .mom-drawer-meta .gicon, .mom-hint .gicon { width: 1.15em; height: 1.15em; vertical-align: -0.18em; }
[data-theme="light"] .mom-bar { background: rgba(40,72,112,0.12); }

/* routine drawer */
#momentum-routine { margin: 6px 4px 14px; }
.mom-drawer-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  font: inherit; font-size: 0.84rem; font-weight: 600; color: var(--ink-soft);
  background: var(--surf-card); border: 1px solid var(--line);
  border-radius: 11px; padding: 9px 12px; cursor: pointer;
}
.mom-drawer-head:hover { color: var(--ink); }
.mom-drawer-meta { font-weight: 700; color: var(--ink); display: inline-flex; align-items: center; gap: 5px; }
[data-theme="light"] .mom-drawer-head { background: rgba(40,72,112,0.05); border-color: rgba(40,72,112,0.14); }
.mom-routine { padding: 8px 4px 2px; }
.mom-habits { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.mom-habit { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.mom-check {
  position: relative;
  flex: none; width: 22px; height: 22px; border-radius: 7px; cursor: pointer;
  border: 2px solid var(--ink-soft); background: var(--surf-card);
  color: #fff; font-size: 0.8rem; line-height: 1; display: grid; place-content: center;
}
/* same 22px-box / 44px-finger problem as .check — pad, don't grow */
.mom-check::before { content: ""; position: absolute; inset: -11px; }
.mom-habit.is-done .mom-check { background: linear-gradient(135deg, var(--orange), var(--blue)); border-color: transparent; }
.mom-habit-label { flex: 1; line-height: 1.3; }
.mom-habit.is-done .mom-habit-label { text-decoration: line-through; color: var(--ink-soft); }
.mom-habit-del { position: relative; flex: none; background: none; border: none; color: var(--ink-soft); cursor: pointer; font-size: 0.8rem; opacity: 0; transition: opacity 0.15s; }
.mom-habit:hover .mom-habit-del { opacity: 1; }
.mom-habit-del:hover { color: var(--stern); }
/* touch has no hover, so on a phone this ✕ was a permanently invisible 22×17px
   control: removing a habit was undiscoverable, and a stray edge-tap fired an
   unexplained confirm. Show it, and pad the strike zone out to ~44px WITHOUT
   changing the painted glyph (a real 44px button would fatten every row). */
@media (hover: none), (pointer: coarse) {
  .mom-habit-del { opacity: 0.55; }
  .mom-habit-del::after { content: ""; position: absolute; inset: -13px -12px; }
}
.mom-add { display: flex; gap: 8px; }
.mom-add .input { padding: 9px 12px; }
.mom-add .btn { flex: none; width: 42px; padding: 0; font-size: 1.1rem; }
.mom-hint { font-size: 0.74rem; color: var(--ink-soft); margin: 8px 0 0; font-style: italic; }
.mom-empty { color: var(--ink-soft); font-style: italic; font-size: 0.85rem; padding: 4px; }
[data-theme="light"] .mom-check { background: rgba(40,72,112,0.06); }

/* ---------- Wins ("Already Accomplished") ---------- */
#panel-wins { overflow-y: auto; padding: 4px; }
.wins-card { margin-bottom: 18px; }
/* input + button on ONE row (no awkward stacked gap) */
#panel-wins .wins-add { display: flex; flex-direction: row; align-items: stretch; gap: 8px; margin: 0 4px 16px; }
#panel-wins .wins-add .input { flex: 1; min-width: 0; }
#panel-wins .wins-add .btn { flex: none; white-space: nowrap; padding: 0 18px; }
.wins-list { list-style: none; margin: 0; padding: 0; }
.wins-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin: 6px 4px; border-radius: 12px;
  background: var(--surf-card);
}
[data-theme="light"] .wins-item { background: rgba(40,72,112,0.05); }
.wins-dot {
  flex: none; width: 20px; height: 20px;
  display: grid; place-items: center; border-radius: 99px;
  font-size: 0.7rem; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--orange), #ff5e7a);
}
.wins-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.wins-text { font-size: 0.92rem; line-height: 1.3; word-break: break-word; }
.wins-time { font-size: 0.68rem; color: var(--ink-soft); }
.wins-del {
  position: relative;
  flex: none; background: none; border: none; cursor: pointer;
  color: var(--ink-soft); font-size: 0.85rem; opacity: 0; transition: opacity 0.15s;
  padding: 2px 4px; line-height: 1;
}
.wins-item:hover .wins-del, .wins-item:focus-within .wins-del { opacity: 0.7; }
.wins-del:hover { opacity: 1 !important; color: var(--orange); }
/* Same hover-only trap as .mom-habit-del, but worse: a finger never hovers, so
   this 18×18 ✕ was invisible AND unlabelled on the right edge of every win —
   one stray tap silently deleted the entry. Make it visible on touch and give
   it a real ~44px strike zone (painted size untouched, rows stay compact). */
@media (hover: none), (pointer: coarse) {
  .wins-del { opacity: 0.55; }
  .wins-del::after { content: ""; position: absolute; inset: -13px -13px; }
}
/* a mouse needs less, but not 18px: 28px is the macOS control floor */
@media (hover: hover) and (pointer: fine) {
  .wins-del::after { content: ""; position: absolute; inset: -5px; }
}
.wins-item.is-past { padding: 6px 10px; background: transparent; }
.wins-item.is-past .wins-dot { width: 16px; height: 16px; background: var(--surf-press); color: var(--ink-soft); }
.wins-item.is-past .wins-text { font-size: 0.85rem; color: var(--ink-soft); }
.wins-history { margin-top: 6px; }
.wins-day-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 12px 6px 2px; padding-top: 8px; border-top: 1px solid var(--line);
}
[data-theme="light"] .wins-day-head { border-top-color: rgba(40,72,112,0.10); }
.wins-day-name { font-size: 0.82rem; font-weight: 600; }
.wins-day-count { font-size: 0.76rem; color: var(--ink-soft); font-weight: 600; }
.wins-day-count.is-hit { color: var(--orange); }
.wins-list-past { margin-bottom: 2px; }

/* ---------- task lists ---------- */
#panel-tasks { overflow-y: auto; padding: 4px; }
.section-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 0 0 12px 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.count {
  display: inline-block;
  min-width: 20px;
  text-align: center;
  background: rgba(79,155,255,0.22);
  color: var(--blue-deep);
  border-radius: var(--r-pill);
  padding: 0 7px;
  font-size: 0.74rem;
  font-weight: 700;
}
.task-section { margin-bottom: 22px; }
.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

/* "Due first" sort toggle, right-aligned in the Open header */
.sort-btn {
  margin-left: auto;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surf-card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px 11px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.sort-btn:hover { color: var(--ink); border-color: rgba(255,255,255,0.25); }
.sort-btn.on {
  color: #fff;
  background: rgba(79,155,255,0.22);
  border-color: var(--blue);
}

/* ---- Organize bar: view switch (List/Type/Due) + Tidy + Auto-sort ---- */
.task-organize {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 14px;
}
.view-seg {
  display: inline-flex;
  background: var(--surf-card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px;
}
.view-seg .vseg {
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  border-radius: var(--r-pill);
  padding: 5px 13px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.18s ease;
}
.view-seg .vseg:hover { color: var(--ink); }
.view-seg .vseg.on {
  color: #fff;
  background: linear-gradient(135deg, rgba(79,155,255,0.32), rgba(155,107,255,0.30));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.org-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surf-card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}
.org-act:hover { color: var(--ink); border-color: rgba(255,255,255,0.26); }
.org-act:disabled { opacity: 0.6; cursor: default; }
.org-act .gicon { width: 1.1em; height: 1.1em; }
#autosort-list { margin-left: auto; }
/* "Pause all" is a break-glass action, not a daily one — icon-only ghost that
   stays quiet at the end of the bar until you go looking for it. */
#pause-all {
  padding: 5px 8px;
  background: transparent;
  border-color: transparent;
  opacity: 0.4;
}
#pause-all:hover {
  opacity: 1;
  background: var(--surf-card);
  border-color: rgba(255,255,255,0.16);
}
[data-theme="light"] #pause-all:hover { background: rgba(40,72,112,0.08); border-color: rgba(40,72,112,0.18); }

/* ---- "By type" view: stacked area section headers within the open list ---- */
.task-group-head {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 7px;
  padding: 0 2px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
}
.task-group-head:first-child { margin-top: 2px; }
.task-group-head .gicon { width: 1.15em; height: 1.15em; }
.task-group-head .tg-name { color: var(--ink); }
.task-group-head .tg-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--area, var(--ink-soft));
  background: color-mix(in srgb, var(--area, #8a93a6) 16%, transparent);
  border-radius: var(--r-pill);
  padding: 1px 9px;
  text-transform: none;
  letter-spacing: 0;
}

/* Goals view — goal folder headers inside the open task list */
.goal-folder .tg-count { margin-left: auto; }
.goal-folder .gf-bar {
  flex: 0 0 54px;
  height: 4px;
  border-radius: var(--r-pill);
  background: var(--surf-press);
  overflow: hidden;
}
.goal-folder .gf-fill {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--area, #8a93a6);
}
.goal-folder .gf-add {
  font-size: 1rem;
  line-height: 1;
  padding: 0 4px;
}
.goal-new-row {
  list-style: none;
  margin: 14px 0 4px;
  text-align: center;
}

/* ---- "Do first" pinned task: a warm tint + a left accent PILL (a pseudo-
   element, not border-left, so it layers cleanly over .task.overdue's red
   border instead of losing the cascade fight when a task is both). ---- */
.task.do-first {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255,138,61,0.11), rgba(255,138,61,0.03)),
    var(--glass);
}
.task.do-first::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 3px;
  background: var(--orange);
  pointer-events: none;
}

/* ---- Transient toast for Tidy / Auto-sort feedback ---- */
.org-toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 14px);
  z-index: 9000;
  max-width: min(86vw, 420px);
  font-size: 0.86rem;
  font-weight: 600;
  color: #fff;
  background: rgba(22,26,38,0.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 11px 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.org-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ Idea Loop: collapsible Top-5 from the Idea Board ============ */
.idea-loop {
  margin: 4px 0 16px;
  /* The tasks panel is a flex COLUMN; a flex item with overflow:hidden (below) gets
     min-height:0, so a content-full panel CRUSHES this section to a ~2px sliver —
     the "invisible Idea Loop" bug. flex:none keeps its natural height; the panel
     scrolls instead. */
  flex: none;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-s);
  background:
    linear-gradient(180deg, rgba(155,107,255,0.10), rgba(79,155,255,0.05)),
    var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  box-shadow: var(--glass-shadow), var(--glass-edge);
  overflow: hidden;
}
.idea-loop-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  font: inherit;
  text-align: left;
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 13px 15px;
  cursor: pointer;
}
.idea-loop-head .il-icon { display: inline-flex; }
.idea-loop-head .il-icon .gicon { width: 1.4em; height: 1.4em; }
.il-titles { display: flex; flex-direction: column; line-height: 1.15; }
.il-title { font-weight: 700; font-size: 0.98rem; }
.il-sub { color: var(--ink-soft); font-size: 0.76rem; }
.il-count {
  margin-left: auto;
  min-width: 22px;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #9b6bff, var(--blue));
  border-radius: var(--r-pill);
  padding: 2px 8px;
}
.il-count.zero { display: none; }
.il-chev {
  margin-left: 10px;
  color: var(--ink-soft);
  transition: transform 0.22s ease;
}
.idea-loop.collapsed .il-count.zero + .il-chev { margin-left: auto; }
.idea-loop:not(.collapsed) .il-chev { transform: rotate(180deg); }

.idea-loop-body {
  max-height: 1600px;
  opacity: 1;
  padding: 0 12px 12px;
  transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
}
.idea-loop.collapsed .idea-loop-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  pointer-events: none;
  /* opacity + pointer-events hide it from the MOUSE only — "Surface my top 5",
     the refresh and the "Open board" link stayed in the tab order and in
     VoiceOver even though the head advertises aria-expanded="false".
     visibility is the one that actually removes them; delayed to the end of
     the collapse so the fade still plays. */
  visibility: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease,
              visibility 0s linear 0.3s;
}

.idea-loop-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.loop-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px 12px;
  animation: loopIn 0.26s ease both;
}
@keyframes loopIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}
.loop-main { flex: 1; min-width: 0; }
.loop-head-row { display: flex; align-items: center; gap: 8px; }
.loop-tag {
  flex: none;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--r-pill);
}
.loop-item[data-tag="build"] .loop-tag { color: var(--blue); background: rgba(79,155,255,0.16); }
.loop-item[data-tag="life"] .loop-tag { color: #37d39a; background: rgba(55,211,154,0.16); }
.loop-title { margin: 0; font-weight: 650; font-size: 0.9rem; color: var(--ink); }
.loop-sum { margin: 3px 0 0; font-size: 0.8rem; line-height: 1.35; color: var(--ink-soft); }
.loop-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex: none;
}
.loop-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #37d39a, var(--blue));
  border: 0;
  border-radius: var(--r-pill);
  padding: 5px 11px;
  cursor: pointer;
}
.loop-add .gicon { width: 1em; height: 1em; }
.loop-del {
  font: inherit;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  padding: 0 6px;
  cursor: pointer;
}
.loop-del:hover { color: var(--stern); }

.idea-loop-empty { margin: 6px 2px 2px; font-size: 0.84rem; color: var(--ink-soft); }
.idea-loop-empty.hidden { display: none; }
.idea-loop-empty a { color: var(--blue); font-weight: 600; }
.il-link {
  font: inherit;
  font-weight: 700;
  color: var(--blue);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.idea-loop-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.il-act {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--surf-card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
.il-act:hover { color: var(--ink); border-color: rgba(255,255,255,0.26); }
.il-act:disabled { opacity: 0.55; cursor: default; }
.il-act .gicon { width: 1em; height: 1em; }
.il-open { margin-left: auto; }

/* ---- Storage drawer: older open tasks, tucked away but still nagged ---- */
.storage-section { margin-bottom: 22px; }
.storage-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font: inherit; color: var(--ink-soft);
  background: var(--surf-card); border: 1px solid var(--line);
  border-radius: 11px; padding: 9px 12px; cursor: pointer; text-align: left;
}
.storage-head:hover { color: var(--ink); }
.storage-head-main { font-size: 0.92rem; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.storage-head-hint { font-size: 0.72rem; color: var(--ink-soft); opacity: 0.75; font-weight: 500; }
#storage-list { margin-top: 10px; }
[data-theme="light"] .storage-head { background: rgba(40,72,112,0.05); border-color: rgba(40,72,112,0.14); }
@media (max-width: 600px) { .storage-head-hint { display: none; } }

/* Drawer header + a bulk action beside it (Paused → "Resume all"). The toggle
   takes the slack; min-width:0 keeps a long head from crushing the action out. */
.storage-head-row { display: flex; align-items: center; gap: 8px; }
.storage-head-row .storage-head { flex: 1 1 auto; min-width: 0; }
.head-act {
  flex: 0 0 auto;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surf-card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.head-act:hover { color: var(--ink); border-color: rgba(255,255,255,0.25); }
.head-act:disabled { opacity: 0.55; cursor: default; }
[data-theme="light"] .head-act { background: rgba(40,72,112,0.05); border-color: rgba(40,72,112,0.14); }

.task {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-s);
  box-shadow: var(--glass-shadow), var(--glass-edge);
  padding: 13px 15px;
  transition: transform 0.12s ease, box-shadow 0.18s ease;
}
.task:hover { transform: translateY(-1px); box-shadow: 0 20px 50px rgba(0,0,0,0.4), var(--glass-edge); }
.task.overdue { border-left: 4px solid var(--stern); }

.check {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border: 2px solid var(--ink-soft);
  border-radius: 7px;
  cursor: pointer;
  flex: none;
  margin-top: 2px;
  display: grid;
  place-content: center;
  background: var(--surf-card);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}
/* Marking a task done is THE most-repeated action in the app, and the drawn box
   is 22×22 — half Apple's 44px minimum, so thumb taps landed on the <li> and
   nothing happened. Pad the strike zone to 44×44 with an invisible pseudo
   instead of growing the square (the small tick is the look Ian wants).
   The ✓ lives on ::after, so the pad uses ::before. */
.check::before { content: ""; position: absolute; inset: -11px; }
.check:checked { background: linear-gradient(135deg, var(--orange), var(--blue)); border-color: transparent; }
.check:checked::after { content: "✓"; color: #fff; font-size: 0.85rem; line-height: 1; }

.task-body { flex: 1; min-width: 0; }
.task-title { font-size: 0.99rem; font-weight: 500; line-height: 1.38; color: var(--ink); word-break: break-word; }
.task.is-done .task-title { text-decoration: line-through; color: var(--ink-soft); }

.chip {
  font-size: 0.72rem;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--surf-press);
  color: var(--ink-soft);
  font-weight: 500;
}
.chip.due-today { background: rgba(244,177,63,0.20);  color: #ffcf7a; }
.chip.overdue   { background: rgba(255,91,91,0.20);   color: #ff9a9a; }
.chip.dodge     { background: rgba(255,91,91,0.20);   color: #ff9a9a; }

.linkbtn {
  font: inherit;
  font-size: 0.8rem;
  background: none;
  border: none;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 6px 9px;
  border-radius: 9px;
  transition: background 0.15s ease, color 0.15s ease;
}
.linkbtn:hover { background: var(--surf-press); color: var(--ink); }
.linkbtn.danger:hover { color: #ff9a9a; background: rgba(255,91,91,0.14); }

/* ---------- minimal task box: title hero + quiet sub-line ---------- */
.task-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 16px; /* keep the line a constant height so dots line up row-to-row */
  margin-top: 6px;
  font-size: 0.78rem;
  line-height: 1.2;
  color: var(--ink-soft);
}

/* small area colour dot — faint hollow ring when untagged, filled when set.
   sized in a fixed centered box so it shares a baseline with the goal marker */
.area-dot {
  position: relative;
  width: 12px; height: 12px;
  border-radius: 50%;
  flex: none;
  align-self: center;
  cursor: pointer;
  background: transparent;
  border: 1.5px solid var(--ink-soft);
  opacity: 0.5;
  transition: opacity 0.15s ease, transform 0.12s ease;
}
/* untagged = a faint hollow dot (tap to set area); tagged = the area's own icon, tinted */
.area-dot.set { background: transparent; border-color: transparent; opacity: 1; width: auto; height: auto; }
.area-dot.set .gicon { width: 16px; height: 16px; display: block; }
.area-dot.set .gicon [stroke]:not([stroke="none"]) { stroke: var(--area); }
.area-dot.set .gicon [fill]:not([fill="none"]) { fill: var(--area); }
.area-dot:hover { opacity: 1; transform: scale(1.18); }

/* goal marker — always present (dim), brightens when a goal is linked.
   centered in a fixed box so it stays even with the area dot */
.goal-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  flex: none;
  align-self: center;
  font-size: 0.8rem;
  line-height: 1;
  cursor: pointer;
  /* was 0.3 — at that weight an unlinked marker read as decoration, not as the
     tap target that opens the goal picker */
  opacity: 0.5;
  transition: opacity 0.15s ease, transform 0.12s ease;
}
/* Two DIFFERENT pickers (life area / goal) drawn 12px and 16px wide, 8px apart.
   Give each a ~44px-tall invisible strike zone; where the two pads overlap the
   later element (.goal-mark) wins, so each effectively owns its own half of the
   gap instead of both being a coin-flip. Painted glyphs are unchanged. */
.area-dot::before, .goal-mark::before { content: ""; position: absolute; inset: -14px -13px; }
/* match the (hollow) goal icon to the solid area dot so the two markers read as an even pair */
.goal-mark .gicon { width: 16px; height: 16px; }
.goal-mark.set { opacity: 1; }
.goal-mark:hover { opacity: 1; transform: scale(1.15); }

/* due text on the marker line; strike badges drop to their own line below */
.task-strikes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 5px; font-size: 0.76rem; }
.due-text { color: var(--ink-soft); white-space: nowrap; }
/* Through the state tokens, not fixed hex: the old #ffcf7a / #ff9a9a were
   picked for the dark themes and measured 1.45:1 and 2.03:1 on Day's white. */
.due-text.overdue { color: var(--stern-ink); font-weight: 600; }
.due-text.today   { color: var(--firm-ink); font-weight: 600; }
/* THE ESCALATION RAMP, finally on screen (v132).
   These replace .dodge-text / .push-text, which were two hardcoded hex values
   predating the token system — so dodge 1 and dodge 5 painted identically and
   the ramp was invisible on the one surface anyone looks at. The tokens twenty
   lines up existed the whole time.
   --*-ink, not the raw tokens: the same finding as .btn-danger records, that
   raw --stern measures too low against this surface AS TEXT. --gentle is the
   exception, it is already a light blue and reads fine. */
.strike-state {
  white-space: nowrap;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
/* the dot carries the colour at a glance; the words carry it for anyone who
   cannot separate these hues, which is why the label changes too and not just
   the paint */
.strike-state::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}
.strike-state.is-gentle { color: var(--gentle); }
.strike-state.is-firm   { color: var(--firm-ink); }
.strike-state.is-stern  { color: var(--stern-ink); }

/* Forgiveness, said out loud. Green because it is genuinely good news: the
   record is going down. This is the only place someone can learn that it can. */
.strike-ease { color: var(--good-ink); white-space: nowrap; opacity: 0.9; }
.strike-ease::before { content: "↓ "; }

/* ---- In progress: the live pulse on work Ian has actually started ---- */
.prog-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #4cc38a;
  font-weight: 600;
  white-space: nowrap;
}
.prog-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
  animation: prog-pulse 1.8s ease-in-out infinite;
}
@keyframes prog-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.8); }
  50%      { opacity: 1;    transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) { .prog-dot { animation: none; } }
/* started > overdue on the row edge: green says "he's ON it" — this rule sits
   AFTER .task.overdue on purpose so it wins when a task is both */
.task.in-progress { border-left: 4px solid #4cc38a; }

/* the ⋯ button, pushed to the right edge of the sub-line */
.task-more {
  position: relative;
  margin-left: auto;
  flex: none;
  font: inherit;
  font-size: 1.15rem;
  line-height: 0.5;
  color: var(--ink-soft);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 9px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}
/* line-height:0.5 keeps the dots tight against the sub-line — and made the
   painted button 36×15px. On a phone that 15px strip is the ONLY way to reach
   Do first / Push a day / Edit / Delete (the .task-tools hover gate is dead on
   touch), so a missed tap silently did nothing. Pad the hit area out to ~44×44
   and leave the glyph exactly where it is. Asymmetric on purpose: the DOWNWARD
   reach stops at 8px, exactly .task-tools' margin-top, so the pad can never
   swallow the top edge of a tool button once the row is open. */
.task-more::after { content: ""; position: absolute; inset: -14px -6px -8px; }
.task-more:hover { background: var(--surf-press); color: var(--ink); }
.task.pinned .task-more { color: var(--blue-deep); background: rgba(79,155,255,0.16); }

/* collapsible tools — peek on hover (desktop), pinned open on click / tap */
.task-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  /* max-height/opacity/overflow all leave the ~10 buttons in the a11y tree AND
     the tab order: VoiceOver read "Do first / Push a day / … / ✕ Delete" after
     EVERY task title, and a double-tap fired the real action on something that
     isn't on screen. visibility:hidden is what actually takes them out; the
     0s-delayed transition keeps the collapse fade intact. */
  visibility: hidden;
  transition: max-height 0.22s ease, opacity 0.18s ease, margin-top 0.22s ease,
              visibility 0s linear 0.22s;
}
@media (hover: hover) {
  .task:hover .task-tools { max-height: 360px; opacity: 1; margin-top: 8px; visibility: visible; transition-delay: 0s; }
}
.task.pinned .task-tools { max-height: 360px; opacity: 1; margin-top: 8px; visibility: visible; transition-delay: 0s; }
.task-tools .linkbtn { font-size: 0.82rem; display: inline-flex; align-items: center; gap: 5px; }
/* the date picker opens via the "Change date" button — keep the input itself
   out of the way (1px, invisible) so only its native popup shows */
.date-tool { position: relative; display: inline-flex; }
.row-date-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; }
/* touch screens: iOS can't open a date picker from script, so the invisible
   input covers the button and the tap opens the native picker directly */
@media (pointer: coarse) {
  .row-date-input { inset: 0; width: 100%; height: 100%; pointer-events: auto; }
}

/* ---------- undo toast (To-board move) ---------- */
.undo-toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 260; /* above settings(200)/tidy(210)/checklists(220-222)/creator(240) — the undo countdown must stay reachable */
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 16px 13px;
  border-radius: 13px;
  background: rgba(28,30,35,0.92);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--line-strong);
  box-shadow: 0 14px 38px rgba(0,0,0,0.5);
  color: var(--ink);
  font-size: 0.86rem;
  max-width: min(92vw, 420px);
  opacity: 0;
  overflow: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.undo-toast.show { opacity: 1; transform: translate(-50%, 0); }
.undo-msg { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.undo-btn {
  font: inherit;
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--orange);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  flex: none;
  white-space: nowrap;
}
.undo-btn:hover { text-decoration: underline; }
.undo-bar {
  position: absolute;
  left: 0; bottom: 0;
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg, var(--orange), var(--blue));
  transform-origin: left;
}
.undo-toast.show .undo-bar { animation: undo-countdown 5s linear forwards; }
@keyframes undo-countdown { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- life-area categories ---------- */
/* labelled field wrapper — gives the picker / filter real breathing room */
.area-field { margin: 14px 0 4px; }
.area-filter-field { margin: 14px 6px 16px; }
.area-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--ink-soft);
  margin-bottom: 7px;
}
.area-label em { font-style: normal; opacity: 0.7; }

/* even grid: equal-width chips, rows that line up (no ragged wrap) */
.area-pick,
.area-filter {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 7px;
}

/* a single chip — shared look for picker + filter */
.area-opt,
.area-filt {
  font: inherit;
  font-size: 0.78rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 11px;
  cursor: pointer;
  text-align: center;
  color: var(--ink-soft);
  background: var(--surf-card);
  border: 1px solid var(--line);
  transition: background var(--m-fast) var(--e-out), color var(--m-fast) var(--e-out), border-color var(--m-fast) var(--e-out), box-shadow var(--m-fast) var(--e-out);
}
.area-opt:hover,
.area-filt:hover { color: var(--ink); border-color: var(--area, rgba(255,255,255,0.30)); }

/* selected (picker) / active (filter) — filled with the area's own colour */
.area-opt.on,
.area-filt.on {
  /* was #fff on a 30% tint of the area colour, which measured 1.17:1 in Day.
     The tint now carries the SELECTED state and the label keeps --ink, so the
     contrast no longer depends on which area colour happens to be behind it. */
  color: var(--ink);
  font-weight: var(--w-semi);
  background: color-mix(in srgb, var(--area, #8893a7) 22%, transparent);
  border-color: color-mix(in srgb, var(--area, #8893a7) 55%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--area, #8893a7) 30%, transparent);
}

/* keyword suggestion — a dashed ring "tap to accept", only until you choose */
.area-opt.suggested:not(.on) {
  border-style: dashed;
  border-color: var(--area);
  color: var(--ink);
}

/* the area tag chip shown on each task row (clickable to change it) */
.chip.area-tag {
  color: #fff;
  cursor: pointer;
  background: color-mix(in srgb, var(--area) 24%, transparent);
  border: 1px solid color-mix(in srgb, var(--area) 55%, transparent);
}
/* inline area editor that drops open on a task row */
.row-area-edit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(86px, 1fr));
  gap: 6px;
  width: 100%;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

/* ---------- goal links on a task row ---------- */
.row-goal-edit {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}
.goal-opt {
  font: inherit;
  font-size: 0.78rem;
  padding: 6px 11px;
  border-radius: var(--r-pill);
  cursor: pointer;
  color: var(--ink-soft);
  background: var(--surf-card);
  border: 1px solid var(--line);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.goal-opt:hover { color: var(--ink); border-color: rgba(255,255,255,0.3); }
.goal-opt.on {
  color: #fff;
  background: color-mix(in srgb, var(--orange) 28%, transparent);
  border-color: var(--orange);
}
.goal-edit-hint { font-size: 0.8rem; color: var(--ink-soft); font-style: italic; padding: 2px 0; }

/* ---------- Goals tab ---------- */
.goal-why { resize: vertical; min-height: 44px; margin-top: 10px; line-height: 1.4; }

.goals-list { display: flex; flex-direction: column; gap: 10px; padding: 0 6px; }
.goal-group {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--ink-soft);
  margin: 12px 2px 2px;
}
.goal-group.achieved { color: #46c98b; }

.goal-card { padding: 14px 15px; border-radius: var(--radius-s); }
.goal-card.is-done { opacity: 0.6; }

.goal-head { display: flex; align-items: flex-start; gap: 8px; }
.goal-title { font-weight: 600; line-height: 1.35; flex: 1; min-width: 0; word-break: break-word; }
.goal-card.is-done .goal-title { text-decoration: line-through; }
.goal-why-text { margin: 8px 0 0; font-size: 0.85rem; color: var(--ink-soft); line-height: 1.45; }
.goal-due-text { margin-top: 7px; font-size: 0.78rem; color: var(--ink-soft); }

.goal-progress { display: flex; align-items: center; gap: 9px; margin-top: 11px; }
.goal-bar {
  flex: 1;
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--surf-press);
  overflow: hidden;
}
.goal-bar span {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--orange), var(--blue));
  transition: width 0.35s ease;
}
.goal-prog-label { font-size: 0.74rem; color: var(--ink-soft); white-space: nowrap; }

.goal-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 11px; }
.goal-task-add { display: flex; margin-top: 10px; }
.goal-task-add .input { font-size: 0.88rem; padding: 9px 12px; }

.empty { color: var(--ink-soft); font-style: italic; padding: 4px 8px; }

/* ================================================================
   JOURNAL → TASKS — drop a photo of handwritten notes
================================================================ */
.journal-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  margin: 6px 6px 14px;
  padding: 18px 16px;
  border-radius: var(--radius-s);
  border: 1.5px dashed rgba(255,255,255,0.28);
  background: var(--surf-card);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.08s ease;
}
.journal-drop:hover { border-color: rgba(255,170,90,0.6); background: var(--surf-card); }
.journal-drop:focus-visible { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(79,155,255,0.25); }
.journal-drop.is-over { border-color: var(--orange); background: rgba(255,140,70,0.12); transform: scale(1.01); }
.journal-icon { font-size: 1.5rem; line-height: 1; }

/* compact variant — a slim row tucked under the add-task form */
.journal-mini {
  flex-direction: row; align-items: center; justify-content: center; gap: 8px;
  text-align: left; margin: 10px 0 0; padding: 9px 12px;
}
.journal-mini .journal-icon { font-size: 1.05rem; }
.journal-mini-label { font-size: 0.84rem; color: var(--ink-soft); }
.journal-mini:hover .journal-mini-label { color: var(--ink); }

.journal-review { margin: 0 6px 16px; }
.jr-card { padding: 14px; border-radius: var(--radius-s); }
.jr-head { font-size: 0.84rem; line-height: 1.45; color: var(--ink); margin-bottom: 12px; }
.jr-reading { font-size: 0.9rem; color: var(--ink); display: flex; align-items: center; gap: 10px; line-height: 1.4; }
.jr-spin {
  width: 16px; height: 16px; flex: none; border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.25); border-top-color: var(--orange);
  animation: jrSpin 0.8s linear infinite;
}
@keyframes jrSpin { to { transform: rotate(360deg); } }

.jr-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.jr-item { display: flex; align-items: flex-start; gap: 10px; }
.jr-item.jr-flag { padding: 8px; margin: -8px; border-radius: 12px; background: rgba(244,177,63,0.10); border: 1px solid rgba(244,177,63,0.22); }
.jr-check { width: 18px; height: 18px; flex: none; margin-top: 6px; accent-color: var(--orange); cursor: pointer; }
.jr-body { flex: 1; min-width: 0; }
.jr-title {
  font: inherit; width: 100%; color: var(--ink);
  background: var(--surf-card); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 10px;
}
.jr-title:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 2px rgba(79,155,255,0.2); }
.jr-meta { display: flex; gap: 8px; align-items: center; margin-top: 5px; flex-wrap: wrap; }
.jr-due { font-size: 0.72rem; background: rgba(79,155,255,0.16); color: var(--blue-deep); border-radius: var(--r-pill); padding: 1px 8px; }
.jr-tag { font-size: 0.7rem; background: rgba(244,177,63,0.2); color: #ffcf7a; border-radius: var(--r-pill); padding: 1px 8px; }
.jr-q { font-size: 0.78rem; color: #ffcf7a; margin-top: 6px; line-height: 1.4; }
.jr-actions { display: flex; gap: 8px; }
.jr-actions .btn { padding: 9px 16px; font-size: 0.86rem; }

/* ================================================================
   PHONE / NARROW — stack: wave on top, rail below
================================================================ */
@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 1fr;
    gap: 16px;
    /* horizontal safe areas: in iPhone landscape this block (not the ≤600px
       portrait one) is what runs, and 16px of padding put the chat input and
       the send arrow under the notch / rounded corners */
    padding: 16px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
    min-height: 0;
  }
  .stage { padding: 14px 8px 4px; gap: 14px; }
  .limi-wave { height: min(34dvh, 280px); }
  .stage-hint { display: none; }
  .rail {
    position: static;
    max-height: none;
    height: 70dvh;
  }
  .app-header .user-email { max-width: 34vw; }
}

/* the swipe dots live below the panes; hidden on desktop */
.swipe-dots { display: none; }

/* ================================================================
   iPHONE — swipe carousel: pane 1 = Limi's wave, pane 2 = chat/tasks.
   Tuned for ~393px screens (iPhone 16), safe areas, big tap targets.
================================================================ */
@media (max-width: 600px) {
  /* header: clean, EVENLY-spaced icon buttons (everything the same size) */
  .app-header { padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); gap: 8px;
    padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .brand { gap: 8px; }
  /* The mark joins the uniform 36px header row (see .board-chip/#settings-btn
     below) instead of standing 6px taller than everything else. That evenness
     is the point — and the 6px it gives back is what keeps the Idea Board
     chip's 44px strike zone clear of the settings button once the longer
     "Chase Limitless" pushes the row along. */
  .brand .emblem { width: 36px; height: 36px; }
  .brand-text strong { font-size: 0.96rem; }
  /* A 320px fold has NO slack left in this row — brand + actions + account fill
     it exactly — so an unbounded name eats the Idea Board chip's strike zone.
     Capped, the name truncates to "Chase Limi…", which is the same shortening
     the home-screen icon uses, so it reads as intended rather than as damage. */
  @media (max-width: 360px) { .brand-text { max-width: 92px; } }
  .brand-sub { display: none; }               /* reclaim space — cleaner one-line brand */
  .app-header .user-email { display: none; }  /* you know who you are */
  .account { gap: 8px; }
  .hdr-btn .hb-txt { display: none; }          /* icon-only on phone */

  /* every header action = one uniform 36×36 rounded button, equal gaps */
  .board-chip, #settings-btn, .checklists-chip, .ck-chip {
    width: 36px; height: 36px; min-width: 36px; padding: 0; margin: 0;
    display: inline-flex; align-items: center; justify-content: center; border-radius: 11px;
  }
  .board-chip .hb-ico, #settings-btn .hb-ico, .checklists-chip .hb-ico, .ck-chip .hb-ico { font-size: 1.15rem; }
  /* ONE pinned chip on a phone. This row is the tightest real estate in the app
     (see the 320px block further down — it measured 332px inside 320 with a
     single extra chip), so pins past the first are dropped rather than allowed
     to squeeze the brand or a touch target. The door chip still opens all of
     them, so nothing becomes unreachable. */
  .ck-chips { margin-left: 0; gap: 8px; }
  .ck-chips .ck-chip:nth-child(n+2) { display: none; }

  /* A manager row is name + meta + FOUR controls. Kept on one line the name is
     what gives ("Sunday r…", "Deep wo…") — the one part you actually read. So
     on a phone the row wraps: the name owns the top line, the controls drop
     under it at full touch size. */
  .cks-row { flex-wrap: wrap; row-gap: 9px; }
  .cks-row-ico { order: 1; }
  .cks-row-text { order: 2; flex: 1 1 auto; }
  .cks-act, .cks-run { order: 3; }
  .cks-act { width: 38px; height: 38px; }
  .cks-pin { margin-left: auto; }  /* push the control cluster to the right edge */
  /* Run wraps onto its own line — auto margin keeps it under the cluster
     instead of stranded at the far left with a row of dead space beside it */
  .cks-run { margin-left: auto; padding: 9px 18px; }
  .cks-tpls { grid-template-columns: 1fr; }
  /* a running chip loses its count on the phone — 36px is not enough for icon
     AND text, and the glow already says "this one is live" */
  .ck-chip-count { display: none; }
  #signout-btn { height: 36px; display: inline-flex; align-items: center; padding: 0 12px; font-size: 0.8rem; }

  /* The app fills the screen: header on top, swipe area takes the rest.

     min-height:0 is LOad-BEARING. `.screen` sets `min-height: 100dvh`, and a
     min-height always beats a smaller height — so this rule's height was being
     discarded outright. Measured 2026-08-20: --kb could be forced to 100px and
     #app-view did not move one pixel. The keyboard shim has been inert since
     the day it was written, and every gap-at-the-bottom report traces back
     here, because whether the shell tracked the screen depended entirely on
     iOS getting round to recomputing dvh — which a scroll forces, which is why
     the gap "goes away when I swipe" (Ian, 2026-08-20).

     dvh, not svh: svh is the SMALL viewport, the height with the browser
     chrome EXPANDED. Pinning to it means that the moment iOS collapses the
     chrome the shell is short by exactly the toolbar's height and the room's
     background shows under the tab bar. dvh is the unit that tracks the
     viewport the user actually has. --kb then handles the soft keyboard, which
     no viewport unit reacts to.

     --app-h, not a literal 100dvh (v145): the same report came back from the
     INSTALLED app, where iOS 26+ hands dvh a height short by the status bar at
     launch. --app-h is 100dvh everywhere except there; see the
     html[data-standalone] rule near the top and js/boot/viewport.js. */
  #app-view { display: flex; flex-direction: column;
    height: calc(var(--app-h) - var(--kb, 0px));
    min-height: 0; }

  /* workspace = horizontal swipe carousel of two full-width panes */
  .workspace {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    grid-template-columns: none;
    gap: 0;
    padding: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .workspace::-webkit-scrollbar { display: none; }
  .workspace > .stage,
  .workspace > .rail {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    min-height: 0;
    scroll-snap-align: center;
  }

  /* pane 1 — Limi's presence, centred and roomy */
  .stage {
    justify-content: center;
    padding: 14px max(14px, env(safe-area-inset-left)) 14px max(14px, env(safe-area-inset-right));
    gap: 16px;
  }
  .limi-wave { height: min(44dvh, 360px); }
  .limi-latest { font-size: clamp(1.05rem, 5vw, 1.3rem); max-width: 24ch; padding: 0.8em 1.15em;
    background: rgba(26,30,40,0.42); -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px); }
  /* the animated SVG "liquid glass" lens is too heavy on phones — it glitches
     and freezes — so drop the lens + the continuous glow ring; keep the crisp
     specular border (::after) and the cursive write-in. */
  .limi-latest::before { display: none; }
  .lg-flow { display: none; }
  .lg-cur-text .ch { filter: none !important; }
  /* the blurred, drifting background wash is a phone GPU hog — keep the colour,
     drop the blur + animation so nothing repaints every frame. */
  body::after { animation: none; filter: none; }

  /* pane 2 — chat/tasks rail fills the pane, scrolls internally */
  .rail { padding: 8px; border-radius: 0; }
  .limi-feed { padding: 6px 8px 10px; }
  .limi-msg, .guest-msg { max-width: 95%; }
  /* Drop the per-bubble backdrop blur on phones — re-blurring every bubble as the
     feed scrolls is the main scroll-jank source. A touch more opacity keeps them
     readable without the frost; the user-msg keeps its orange/blue tint. */
  .limi-msg, .user-msg, .guest-msg { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
  .limi-msg, .guest-msg { background: var(--surf-press); }
  .chat-form { padding-bottom: 10px; }         /* dots row handles the safe area */

  /* comfortable tap targets (Apple's ~44px guideline) */
  .tab { padding: 12px 12px; font-size: 0.9rem; }
  .chat-send { width: 50px; }
  .input { padding: 13px 14px; }
  .task { padding: 14px; }

  /* swipe page indicator */
  .swipe-dots {
    display: flex; gap: 7px; justify-content: center; align-items: center;
    padding: 9px 0 calc(7px + env(safe-area-inset-bottom));
  }
  .swipe-dots span { position: relative; width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.26); transition: width 0.2s ease, background 0.2s ease; }
  .swipe-dots span.on { background: var(--orange); width: 18px; border-radius: 4px; }
  /* these dots are click targets (swipe-nav.js) at 7×7 — a tap sweep showed the
     live strike zone was ±9px and nothing more. Pad it out, but ASYMMETRICALLY:
     the chat input sits directly above this row, so the pad only reaches up as
     far as the chat form's own bottom padding and spends the rest downward into
     the home-indicator gap. Sideways it grows OUTWARD from the pair and only
     3px into the 7px gap — a symmetric pad let the second dot's pad cover the
     first one entirely and made dot 1 untappable (measured). */
  .swipe-dots span::before { content: ""; position: absolute; inset: -19px -8px -24px; }
  .swipe-dots span:first-child::before { left: -19px; }
  .swipe-dots span:last-child::before  { right: -19px; }
}

/* ================================================================
   VERY NARROW (320px — SE 1st gen, Display Zoom on, Fold cover screen)
   The header packs brand + Idea Board + Checklists + Settings + Sign out.
   At 320 that row measured 332px, so the WHOLE document could be panned
   12px sideways and "Sign out" was sliced in half by the screen edge.
================================================================ */
@media (max-width: 340px) {
  .app-header {
    gap: 6px;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(8px, env(safe-area-inset-right));
  }
  .account { gap: 6px; }
  #signout-btn { padding: 0 9px; font-size: 0.74rem; }
  /* No pinned chips at all down here. This is the width that overflowed with
     ONE extra chip in the row, so the pins go and the door chip stays. */
  .ck-chips { display: none; }
}

/* ================================================================
   PHONE IN LANDSCAPE (short viewport). Every breakpoint in this file is
   width-based, so a rotated iPhone (844×390) fell out of the ≤600px swipe
   carousel and into the ≤900px STACKED layout — header 70 + stage 240 +
   rail 273 = a 630px document inside 390px of height. The tab row, the
   feed and the chat input were all below the fold, so tapping "Tasks"
   looked like it did nothing. Short screens go side-by-side instead.
   Scoped ≥601px so the portrait carousel above is never touched.
================================================================ */
@media (min-width: 601px) and (max-width: 900px) and (max-height: 500px) {
  #app-view { display: flex; flex-direction: column;
    height: calc(var(--app-h) - var(--kb, 0px)); min-height: 0; }
  .workspace {
    flex: 1;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left));
  }
  .stage { padding: 4px 0; gap: 8px; justify-content: center; }
  .limi-wave { height: min(52svh, 190px); }
  .rail { position: static; height: 100%; max-height: none; min-height: 0; }
}

/* ---------- respect reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  body::after, .limi-latest { animation: none !important; }
  .limi-latest .word { animation: none !important; opacity: 1 !important; }
  .board-chip::after { animation: none !important; }
  /* letters appear at once instead of writing in (opacity: 0 base relies on the animation) */
  .lg-cur-text .ch { animation: none !important; opacity: 1 !important; }
}

/* ---------- theme toggle (in Settings) ---------- */
.theme-toggle {
  display: flex; gap: 6px; padding: 4px; border-radius: 12px;
  background: var(--surf-card); border: 1px solid var(--line);
}
.theme-opt {
  flex: 1; font: inherit; font-size: 0.88rem; padding: 9px 10px; border-radius: 9px; min-height: 44px;
  cursor: pointer; border: none; background: transparent; color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}
.theme-opt.is-active { background: var(--surf-press); color: var(--ink); font-weight: var(--w-semi); box-shadow: var(--edge); }

/* ================================================================
   NIGHT MODE — deep space. The MOON is drawn in the wave canvas (js/wave.js),
   dead-centre where the Day sun sits, so switching Day↔Night keeps the disc
   in the exact same spot. Stars orbit it (behind + in front) and STORM while
   Limi speaks. Here we only set the backdrop + the ambient static starfield;
   the moon + orbiting stars are canvas-drawn.
================================================================ */
/* ---- NIGHT's token block. Until now Night overrode ZERO design tokens: it
       wore Studio's entire glass, ink and shadow set and only repainted the
       backdrop. A single small hard source at 4100K does not make grey
       highlights, so surfaces here are tinted blue-white and shadows go deeper
       and tighter than Studio's. ---- */
:root[data-theme="space"] {
  background: var(--room-bg);

  --room-2:    #141d38;
  --room-1:    #0a0f22;
  --room-0:    #04060e;
  --room-bg:   #070b18;
  --room-warm: rgba(46,66,116,0.12);
  --room-cool: transparent;
  --vignette:  radial-gradient(132% 112% at 50% 42%, transparent 38%, rgba(0,0,0,0.46) 100%);

  --surf-app:   linear-gradient(180deg, rgba(168,194,255,0.115), rgba(126,158,224,0.05));
  --surf-card:  rgba(182,204,255,0.085);
  --surf-bar:   rgba(27,38,70,0.88);
  --surf-float: rgba(18,26,50,0.96);
  --surf-press: rgba(182,204,255,0.14);
  --surf-hover: rgba(182,204,255,0.05);
  --surf-sunk:  rgba(0,0,0,0.34);
  --scrim:      rgba(2,4,10,0.68);

  --line:        rgba(168,194,255,0.10);
  --line-strong: rgba(168,194,255,0.22);
  --edge: inset 0 1px 0 rgba(182,204,255,0.12);
  --rim:  inset 0 1px 0 rgba(196,216,255,0.22), inset 0 -1px 10px rgba(0,2,10,0.30);
  --e1: 0 1px 2px rgba(0,0,0,0.45);
  --e2: 0 8px 24px -6px rgba(0,0,0,0.62), 0 2px 6px rgba(0,0,0,0.38);
  --e3: 0 24px 60px -12px rgba(0,0,0,0.72), 0 4px 12px rgba(0,0,0,0.44);
  --e-bar: 0 -8px 24px -10px rgba(0,0,0,0.60);

  --ink-onroom: #b9c6e2;
  --focus:      #7ab4ff;

  --tint-stern: linear-gradient(100deg, rgba(255,91,91,0.20), rgba(255,91,91,0) 46%);
  --tint-firm:  linear-gradient(100deg, rgba(244,177,63,0.20), rgba(244,177,63,0) 46%);
  --tint-good:  linear-gradient(100deg, rgba(70,200,150,0.20), rgba(70,200,150,0) 46%);
  --tint-warm:  rgba(255,138,61,0.20);

  --stage-warm:  transparent;
  --stage-cool:  transparent;
  --stage-floor: rgba(40,64,120,0.16);
  --stage-ceil:  rgba(0,0,0,0.34);
  --speech-fill: rgba(24,33,60,0.55);

  --accent-warm: #ffa05c;
  --accent-cool: #8fbcff;
}
[data-theme="space"] body { background: transparent; }
[data-theme="space"] body::before {
  /* a NATURAL moonlit night: deep blue-black, one whisper of cool sky-glow
     centred where the moon sits — no purple nebulas (there are none next to
     a bright moon), no washes fighting the starfield. The lamp position moves
     to the moon; the wall stops and the vignette come from Night's tokens. */
  background:
    var(--vignette),
    radial-gradient(120vw 90vw at 50% 44%, var(--room-warm), transparent 64%),
    linear-gradient(180deg, var(--room-0) 0%, var(--room-1) 48%, var(--room-2) 72%, var(--room-0) 100%);
  animation: none;
}
[data-theme="space"] body::after { display: none; }  /* ambient stars live in the stage */

/* Night's stage light is `transparent` in its token block, so .stage needs no
   override at all now. .stage::after still runs, giving the moon a faint floor
   bounce and a darker ceiling — which is what stops the scene floating. */

/* The starfield now lives in the wave canvas (js/wave.js ensureStarfield):
   generated once per size with a REAL magnitude spread (few bright, hundreds
   faint), subtle colour variance, no repeating tile, and stars washed out
   inside the moon's glow the way moonlight actually drowns its neighbours.
   The .sky div stays as an (empty) layer hook. */
.sky { display: none; }
[data-theme="space"] .sky {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  /* one soft halo where the moon sits — the air around a bright moon carries
     its light. Static: no animation, no filter, nothing the compositor has to
     re-rasterise, and it sits UNDER the canvas (z-index 0 vs the canvas' 1). */
  background: radial-gradient(38% 30% at 50% 50%, rgba(150,178,236,0.16), transparent 68%);
}

/* ================================================================
   DAY MODE — light theme (toggle in Settings). Dark is the default.
   Most surfaces flip via these variable overrides; the rest are the
   hardcoded interactive bits, flipped to dark-on-light below.
================================================================ */
:root[data-theme="light"] {
  /* Deepened from #24323f / #58697b to sit on the near-opaque white cards below.
     Measured on the real composited surfaces: --ink on a card over the sky is
     14.64:1 (was 11.08) and --ink-soft is 7.81:1 (was 4.77). */
  --ink:      #1b2734;
  --ink-soft: #41525f;
  --ink-dim:  #566878;
  /* text with NO surface under it — the .stage-hint used to sit on the raw sky
     at 4.22:1, a live AA failure. On the sky at its deepest this is 4.87:1. */
  --ink-onroom: #2b3d4e;
  --ink-faint:     rgba(77,95,114,0.38);
  --ink-faint-ctl: rgba(60,80,102,0.55);
  --accent-ink: #9c3d08;
  /* --blue-deep is NO LONGER the active tab label (that is --ink, at 10.81:1).
     Its live consumers are now .count, .jr-due and --act-mark: as a bare .count
     on the rail panel it measures 6.56:1, up from the 5.4 recorded here before. */
  --blue-deep: #1a4f9e;
  --focus:     #1f6fd8;

  --room-2:    #7fb0dd;
  --room-1:    #a8cbe8;
  --room-0:    #c4dcee;
  --room-bg:   #b9d4ea;
  --room-warm: rgba(255,240,205,0.45);
  --room-cool: transparent;
  --vignette:  radial-gradient(126% 104% at 50% 52%, transparent 46%, rgba(38,74,124,0.18) 100%);

  /* Day desaturates rather than saturates: a near-opaque white surface over a
     blue sky turns radioactive at 150%. */
  --surf-app:   linear-gradient(180deg, rgba(230,240,250,0.88), rgba(222,235,247,0.82));
  --surf-card:  rgba(255,255,255,0.93);
  --surf-bar:   rgba(244,249,254,0.90);
  --surf-float: rgba(252,254,255,0.97);
  --surf-press: rgba(28,58,96,0.09);
  --surf-hover: rgba(28,58,96,0.045);
  --surf-sunk:  rgba(28,58,96,0.11);
  --scrim:      rgba(30,52,86,0.34);
  --blur-s: blur(10px) saturate(120%);
  --blur-m: blur(18px) saturate(125%);

  --line:        rgba(24,52,88,0.10);
  --line-strong: rgba(24,52,88,0.22);
  --edge: inset 0 1px 0 rgba(255,255,255,0.85);
  --rim:  inset 0 1px 0 rgba(255,255,255,1), inset 0 -1px 10px rgba(30,62,104,0.06);
  --e1: 0 1px 2px rgba(30,62,104,0.10);
  --e2: 0 10px 26px -8px rgba(30,62,104,0.24), 0 2px 6px rgba(30,62,104,0.10);
  --e3: 0 26px 60px -14px rgba(30,62,104,0.30), 0 4px 12px rgba(30,62,104,0.14);
  --e-bar: 0 -8px 24px -12px rgba(30,62,104,0.20);

  --tint-stern: linear-gradient(100deg, rgba(212,60,60,0.14), rgba(212,60,60,0) 46%);
  --tint-firm:  linear-gradient(100deg, rgba(230,160,30,0.16), rgba(230,160,30,0) 46%);
  --tint-good:  linear-gradient(100deg, rgba(30,160,110,0.15), rgba(30,160,110,0) 46%);
  --tint-warm:  rgba(255,122,40,0.16);
  --gentle:     #2f6ad0;
  --stern:      #d43c3c;
  --stern-ink:  #a8322f;
  --firm:       #e6a01e;
  --firm-ink:   #8a5c05;
  --good:       #1ea06e;
  --good-ink:   #0f6b4a;

  /* Day gets its own stage light for the first time. It used to inherit
     Studio's orange wash over a blue sky, which is where the mud came from. */
  --stage-warm:  rgba(255,236,190,0.34);
  --stage-cool:  rgba(150,200,240,0.22);
  --stage-floor: rgba(255,242,206,0.40);
  --stage-ceil:  rgba(90,140,190,0.16);
  --speech-fill: rgba(255,255,255,0.80);
  --speech-ink:  #1b2734;

  --accent-warm: #f2b21a;
  --accent-cool: #2f8fe0;

  /* the alias layer, restated so tests/theme-parity.test.mjs finds it in THIS
     block (it asserts each shared key is present here, not merely inherited) */
  --glass:        var(--surf-app);
  --glass-soft:   var(--surf-card);
  --glass-border: var(--line);
  --glass-shadow: var(--e2);
  --glass-edge:   var(--edge);
}

/* a soft daytime SKY — blue up top, fading to a warm sun-haze horizon.
   The root needs the day colour too (like Night sets its own) — html otherwise
   keeps the dark default and flashes dark on iOS rubber-band overscroll. */
:root[data-theme="light"] { background: var(--room-bg); }
[data-theme="light"] body { background: var(--room-bg); }
[data-theme="light"] body::before {
  /* A real sky is DEEPEST at the zenith and palest at the horizon. This one ran
     the other way, which is half of why Day looked washed out: the top of the
     screen was the lightest thing on it, so nothing could sit in front of it. */
  background:
    var(--vignette),
    radial-gradient(90vw 55vw at 50% 112%, var(--room-warm), transparent 62%),
    linear-gradient(180deg, var(--room-2) 0%, var(--room-1) 42%, var(--room-0) 78%, var(--room-0) 100%);
}
[data-theme="light"] body::after {
  /* soft drifting clouds + warm haze */
  background:
    radial-gradient(42vw 26vw at 24% 22%, rgba(255,255,255,0.34), transparent 62%),
    radial-gradient(48vw 28vw at 80% 66%, rgba(255,248,232,0.26), transparent 62%);
}

/* interactive surfaces: flip white-on-dark → dark-on-light, with tighter
   borders so each component reads as a defined card on the light background */
[data-theme="light"] .app-header { background: rgba(226,239,251,0.62); border-bottom-color: rgba(40,72,112,0.12); }
[data-theme="light"] .btn-ghost { background: rgba(32,44,72,0.05); border-color: rgba(32,44,72,0.20); color: var(--ink-soft); }
[data-theme="light"] .btn-ghost:hover { color: var(--ink); background: rgba(32,44,72,0.10); }
[data-theme="light"] .input,
[data-theme="light"] .sound-select { background: rgba(250,253,255,0.72); border-color: rgba(40,72,112,0.22); }
[data-theme="light"] .input[type="date"] { color-scheme: light; }
[data-theme="light"] .tab.is-active { background: rgba(32,44,72,0.09); box-shadow: inset 0 1px 0 rgba(255,255,255,0.6); }
[data-theme="light"] .chat-form { border-top-color: rgba(32,44,72,0.14); }
[data-theme="light"] .limi-msg,
[data-theme="light"] .guest-msg { border-color: rgba(32,44,72,0.16); }
[data-theme="light"] .guest-badge { background: rgba(32,44,72,0.06); }
[data-theme="light"] .settings-close,
[data-theme="light"] .sound-btn,
[data-theme="light"] .sound-bar,
[data-theme="light"] .theme-toggle { background: rgba(32,44,72,0.05); border-color: rgba(32,44,72,0.18); }
[data-theme="light"] .settings-close:hover,
[data-theme="light"] .sound-btn:hover { background: rgba(32,44,72,0.10); }
[data-theme="light"] .theme-opt.is-active { background: rgba(32,44,72,0.10); box-shadow: inset 0 1px 0 rgba(255,255,255,0.7); }
[data-theme="light"] .settings-section { border-top-color: rgba(32,44,72,0.12); }
[data-theme="light"] .settings-overlay { background: rgba(40,55,90,0.32); }
[data-theme="light"] .user-msg { border-color: rgba(32,44,72,0.14); }
/* was a hardcoded #2f6ad0 = 3.53:1 on its own blue pill; follow the token */
[data-theme="light"] .count { background: rgba(79,130,235,0.18); color: var(--blue-deep); }
[data-theme="light"] .journal-drop { border-color: rgba(32,44,72,0.28); background: rgba(32,44,72,0.03); }
[data-theme="light"] .journal-drop:hover { border-color: rgba(255,150,80,0.8); background: rgba(255,150,80,0.07); }
[data-theme="light"] .setup-card code { background: rgba(32,44,72,0.08); }
[data-theme="light"] .swipe-dots span { background: rgba(32,44,72,0.25); }

/* task list — the checkbox, date chips, and action buttons need real borders
   + shading on light, or they vanish into the card */
[data-theme="light"] .task:hover { box-shadow: 0 14px 32px rgba(45,52,70,0.16), var(--glass-edge); }
[data-theme="light"] .check { background: rgba(252,251,247,0.85); border-color: rgba(40,49,64,0.42); }
[data-theme="light"] .chip { background: rgba(40,49,64,0.07); border: 1px solid rgba(40,49,64,0.18); color: #4a5468; }
[data-theme="light"] .chip.due-today { background: rgba(225,150,20,0.16); border-color: rgba(225,150,20,0.34); color: #946607; }
[data-theme="light"] .chip.overdue,
[data-theme="light"] .chip.dodge { background: rgba(214,62,62,0.13); border-color: rgba(214,62,62,0.30); color: #b23c3b; }
[data-theme="light"] .linkbtn { background: rgba(40,49,64,0.05); border: 1px solid rgba(40,49,64,0.18); color: #4a5468; }
[data-theme="light"] .linkbtn:hover { background: rgba(40,49,64,0.10); color: var(--ink); }
[data-theme="light"] .linkbtn.danger:hover { color: #b23c3b; background: rgba(214,62,62,0.12); border-color: rgba(214,62,62,0.30); }

/* the "Give me inspiration" button (injected by quotes.js) — dark on light */
[data-theme="light"] .inspire-btn {
  color: #25323f;
  background: rgba(244,250,255,0.72);
  border-color: rgba(40,72,112,0.22);
  box-shadow: 0 6px 16px rgba(40,72,120,0.14), inset 0 1px 0 rgba(255,255,255,0.7);
}
[data-theme="light"] .inspire-btn:hover { background: rgba(248,252,255,0.92); box-shadow: 0 8px 20px rgba(40,72,120,0.18), inset 0 1px 0 rgba(255,255,255,0.78); }

/* Limi's glass line: dark, readable text on the light frosted box */
[data-theme="light"] .limi-latest {
  color: #1d2536;
  text-shadow: 0 1px 1px rgba(255,255,255,0.7);
  box-shadow: 0 18px 44px rgba(40,55,90,0.16), 0 0 30px rgba(255,150,80,0.10);
}
[data-theme="light"] .lg-cur-text { color: #243049; }
[data-theme="light"] .limi-latest::after { border-color: rgba(32,44,72,0.18); }
/* phones hardcode a DARK frosted backdrop on the speech box (perf block above)
   — in Day mode that left dark text on a dark box; give it a light frost instead */
@media (max-width: 600px) {
  [data-theme="light"] .limi-latest { background: rgba(244,249,255,0.55); }
}

/* ---------- nudges (push) settings ---------- */
.nudge-bar { display: flex; gap: 8px; flex-wrap: wrap; }
#nudge-toggle.is-on {
  color: #d6ffe6;
  background: rgba(46,204,113,0.16);
  border-color: rgba(46,204,113,0.4);
}
.nudge-status:empty { display: none; }
.nudge-status { margin-top: 8px; }

/* ============================================================
   Summon Limi — a stage button ("✦ Brief me", alongside the inspire
   button). Press it → the liquid-glass box MOMENTARILY transforms into
   four glass options → pick one → it "ignites" and Limi briefs you right
   there (text + her voice), then the box returns to its normal life.
   ============================================================ */
/* the trigger — mirrors quotes.js's .inspire-btn, stacked just below it */
.brief-me-btn {
  position: absolute; top: 50px; left: 50%; transform: translateX(-50%); z-index: 6;
  display: inline-flex; align-items: center; gap: 7px;
  font: inherit; font-size: 0.82rem; font-weight: 600; color: #f1f5ff; cursor: pointer;
  padding: 7px 15px; border-radius: var(--r-pill);
  background: var(--surf-card); border: 1px solid var(--line-strong);
  -webkit-backdrop-filter: blur(14px) saturate(160%); backdrop-filter: blur(14px) saturate(160%);
  box-shadow: 0 6px 18px rgba(0,0,0,0.28), inset 0 1px 0 rgba(255,255,255,0.25);
  transition: background 0.18s ease, transform 0.08s ease, box-shadow 0.2s ease, opacity 0.3s ease;
}
.brief-me-btn:hover { background: var(--surf-press); box-shadow: 0 8px 22px rgba(0,0,0,0.34), 0 0 18px rgba(150,180,255,0.18), inset 0 1px 0 rgba(255,255,255,0.3); }
.brief-me-btn:active { transform: translateX(-50%) translateY(1px); }
.brief-me-btn.is-open { background: rgba(150,180,255,0.2); border-color: rgba(170,195,255,0.5);
  box-shadow: 0 8px 22px rgba(0,0,0,0.34), 0 0 20px rgba(150,180,255,0.4), inset 0 1px 0 rgba(255,255,255,0.35); }
.brief-me-btn .bb-spark { color: #cfe0ff; filter: drop-shadow(0 0 5px rgba(150,190,255,0.85)); }

/* when the menu is open: show the box + recede the orb so the four options fit + take focus */
.limi-latest.sm-menu { display: block; }
.limi-wave { transition: height 0.28s ease; }
.stage.sm-active .limi-wave { height: 20svh; }
.stage.sm-active .stage-hint { display: none; } /* free space for the menu while choosing */ /* recede more so all 5 options fit on short laptops too */
/* while Limi speaks a LONG brief: recede the orb + the box becomes an auto-scrolling
   reading panel (follows the text down), held until she's done talking */
/* svh, not vh: the phone shell is a 100svh box, so an orb sized off the LARGE
   viewport doesn't actually free the space it promises when it recedes */
.stage.limi-talking .limi-wave { height: 26svh; }
.stage.limi-talking .stage-hint { display: none; }
.limi-latest.brief-scroll { max-height: 54vh; overflow-y: auto; overflow-x: hidden; }
.limi-latest.brief-scroll::-webkit-scrollbar { width: 6px; }
.limi-latest.brief-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 3px; }
/* Phone: this USED to be `max-height: none; overflow: visible` — "let the box
   grow naturally" — because a y-scroller inside the x-snap carousel glitched on
   iOS. But nothing in the phone shell can absorb that growth (#app-view is
   100svh, .workspace is overflow-y:hidden), so a 449-character brief rendered
   499px tall and its last sentence — the actual instruction — was sliced off
   below the screen with no way to scroll to it. Give it a real bounded reading
   panel back; the iOS glitch is cured by overscroll-behavior-y: contain, the
   same guard .rail-panel / .limi-feed already use, not by removing the scroll. */
@media (max-width: 760px) {
  .limi-latest.brief-scroll {
    /* 330px = header + receded orb + the stage's own gaps; the two env() terms
       pay for the notch (the header grows into it) and the home-indicator strip
       under the swipe dots, which otherwise eat the budget on a notched iPhone
       and push the bottom of the box back out of the pane. */
    max-height: calc(100svh - 330px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
  }
}

/* the four glass options — the box's momentary "menu" mode */
.sm-opts { display: none; flex-direction: column; gap: 7px; width: 100%;
  animation: smOptsIn 0.22s cubic-bezier(0.34,1.4,0.64,1); }
.limi-latest.sm-menu .sm-opts { display: flex; }
.limi-latest.sm-menu .lg-text,
.limi-latest.sm-menu .lg-cursive,
.limi-latest.sm-menu .lg-quote { display: none !important; } /* hide the line/quote while choosing (beats inline display) */
@keyframes smOptsIn { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }

.sm-opt {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 10px 13px; border-radius: 12px; cursor: pointer; font: inherit; font-size: 0.9rem; font-weight: 500; color: #f1f5fd;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.04));
  border: 1px solid var(--line-strong);
  -webkit-backdrop-filter: blur(10px) saturate(1.3); backdrop-filter: blur(10px) saturate(1.3);
  box-shadow: 0 6px 18px rgba(8,10,30,0.3), inset 0 1px 1px rgba(255,255,255,0.32);
  transition: transform 0.14s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.sm-opt:hover { transform: translateY(-2px);
  background: linear-gradient(135deg, rgba(255,255,255,0.24), rgba(255,255,255,0.08));
  box-shadow: 0 10px 26px rgba(8,10,30,0.4), 0 0 18px rgba(150,180,255,0.35), inset 0 1px 1px rgba(255,255,255,0.42); }
.sm-opt .sm-ico { flex: none; width: 1.5em; text-align: center; font-size: 1.05em; filter: drop-shadow(0 0 6px rgba(190,212,255,0.55)); }
.sm-opt .sm-label { line-height: 1.2; }

/* ---------- "When, then?" — the prompt a dodge opens ----------
   Borrows .sm-opt for the rows because a dodge prompt IS a sibling of the
   summon menu: same moment, same pick-one shape. It does NOT borrow .sm-opts,
   which is `display:none` unless it sits inside `.limi-latest.sm-menu` — reuse
   that wrapper here and the whole prompt renders invisible with no error and no
   failing selector, which is a specificity bug wearing a layout bug's clothes.
   Hence an own container with its own explicit display. */
.plan-scrim {
  /* 150, with the other sheets: at 95 it sat under the shell's bottom bar
     (z-index 100), which hid the sheet's last choice, "just not now". */
  position: fixed; inset: 0; z-index: 150;
  background: rgba(8,10,16,0.58);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.plan-sheet {
  display: flex; flex-direction: column; gap: 7px;
  width: min(420px, 100%);
  background: var(--room-1); border: 1px solid var(--line-strong);
  border-radius: 18px; padding: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.plan-sheet .plan-q { margin: 0; font-size: 1rem; font-weight: 650; color: var(--ink); }
.plan-sheet .plan-task { font-size: 0.84rem; color: var(--ink-dim); margin: 0 0 6px; }
.plan-skip {
  background: none; border: 0; color: var(--ink-dim); font: inherit; font-size: 0.84rem;
  padding: 10px 4px 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.plan-skip:hover { color: var(--ink-soft); }
/* the promise, on the task row */
.plan-text { white-space: nowrap; color: var(--gentle); }
.plan-text.is-broken { color: var(--firm-ink); }
@media (min-width: 601px) { .plan-scrim { align-items: center; } }

/* the "ignite" flash when you pick one */
.sm-opt.ignite { animation: smIgnite 0.44s ease forwards; }
@keyframes smIgnite {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.06);
         background: linear-gradient(135deg, rgba(195,220,255,0.9), rgba(135,170,255,0.6));
         box-shadow: 0 0 0 2px rgba(205,225,255,0.75), 0 0 36px rgba(150,185,255,0.95), inset 0 1px 2px rgba(255,255,255,0.7);
         color: #14213a; }
  100% { transform: scale(1.02);
         background: linear-gradient(135deg, rgba(195,220,255,0.72), rgba(135,170,255,0.42));
         box-shadow: 0 0 0 1px rgba(205,225,255,0.4), 0 0 22px rgba(150,185,255,0.55); }
}

/* gentle shimmer while Limi pulls the briefing together (before the text streams in) */
.limi-latest.sm-loading .lg-text { animation: smPulse 1.1s ease-in-out infinite; }
@keyframes smPulse { 0%,100% { opacity: 0.35; } 50% { opacity: 0.75; } }

/* "The Brief" topic tree — a second glass panel that flies out BESIDE the menu */
.sm-tree { display: none; position: absolute; left: calc(100% + 12px); top: 0; z-index: 4;
  flex-direction: column; gap: 5px; width: 188px; padding: 9px;
  border-radius: 15px; border: 1px solid var(--line-strong);
  background: rgba(22,26,40,0.88);
  -webkit-backdrop-filter: blur(16px) saturate(1.3); backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 18px 50px rgba(0,0,0,0.5);
  animation: smOptsIn 0.2s cubic-bezier(0.34,1.4,0.64,1); }
.limi-latest.sm-tree-open .sm-tree { display: flex; }
.sm-topic { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surf-card); color: #eef3fb;
  font: inherit; font-size: 0.88rem; cursor: pointer; transition: background 0.14s ease, transform 0.12s ease; }
.sm-topic:hover { background: rgba(255,255,255,0.15); transform: translateX(2px); }
.sm-topic.ignite { animation: smIgnite 0.44s ease forwards; }
.sm-topic-full { margin-top: 3px; font-size: 0.8rem; color: #cfe0ff; border-style: dashed; background: transparent; }
.sm-topic-back { display: none; font-size: 0.8rem; color: rgba(220,228,245,0.7); background: transparent; border-color: transparent; }
.sm-opt.is-branch { box-shadow: 0 0 0 2px rgba(150,180,255,0.45), 0 6px 18px rgba(8,10,30,0.3); }
[data-theme="light"] .sm-tree { background: rgba(255,255,255,0.96); border-color: rgba(40,72,112,0.16); }
[data-theme="light"] .sm-topic { color: #1d2740; background: rgba(40,72,112,0.06); border-color: rgba(40,72,112,0.16); }
[data-theme="light"] .sm-topic:hover { background: rgba(40,72,112,0.13); }
/* phone: no room beside the box → the tree REPLACES the options (with a Back) */
@media (max-width: 760px) {
  .sm-tree { position: static; left: auto; top: auto; width: 100%; margin-top: 7px; }
  .limi-latest.sm-tree-open .sm-opts { display: none; }
  .sm-topic-back { display: block; }
}

[data-theme="light"] .sm-opt { color: #1d2740;
  background: linear-gradient(135deg, rgba(40,72,112,0.1), rgba(40,72,112,0.03)); border-color: rgba(40,72,112,0.18); }
[data-theme="light"] .sm-opt:hover { background: linear-gradient(135deg, rgba(40,72,112,0.16), rgba(40,72,112,0.06)); }
[data-theme="light"] .brief-me-btn { color: #24304a; background: rgba(40,72,112,0.06); border-color: rgba(40,72,112,0.18); }
[data-theme="light"] .brief-me-btn:hover { background: rgba(40,72,112,0.12); }
@media (prefers-reduced-motion: reduce) { .sm-opts, .sm-opt.ignite { animation: none; } }

/* ============================================================
   Create your AI — the character builder modal
   ============================================================ */
.creator-overlay { position: fixed; inset: 0; z-index: 240; display: flex; align-items: center; justify-content: center;
  padding: 18px; background: rgba(8,10,20,0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.creator-overlay.hidden { display: none; }
.creator-card { width: min(460px, 100%); max-height: 88dvh; overflow-y: auto; border-radius: 22px; padding: 20px 22px 22px;
  border: 1px solid var(--line-strong); background: rgba(22,26,40,0.94);
  -webkit-backdrop-filter: blur(18px) saturate(1.3); backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6); color: #eef2fb; }
.creator-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.creator-head h2 { margin: 0; font-size: 1.3rem; letter-spacing: -0.3px; }
.cr-accent { background: linear-gradient(120deg, #ff8a3d, #ff5e7a, #2f80ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.creator-close { background: var(--surf-press); border: none; color: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 0.9rem; }
.creator-close:hover { background: rgba(255,255,255,0.18); }
.cr-field { display: block; margin-bottom: 16px; }
.cr-label { display: block; font-size: 0.82rem; font-weight: 600; color: rgba(230,236,248,0.85); margin-bottom: 7px; }
.cr-input { width: 100%; font: inherit; font-size: 1rem; padding: 11px 13px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surf-card); color: #fff; }
.cr-input:focus { outline: none; border-color: rgba(150,180,255,0.5); }
.cr-err { display: block; min-height: 1em; color: #ff9a9a; font-size: 0.78rem; margin-top: 5px; }
/* Bring-your-own-key block. Sits quietly below the personality dials: it is
   genuinely optional, so it must never read as a required step in setup. */
.cr-optional { font-weight: 500; font-size: 0.72rem; color: rgba(230,236,248,0.45);
  text-transform: uppercase; letter-spacing: 0.04em; margin-left: 6px; }
.cr-hint { font-size: 0.78rem; line-height: 1.45; color: rgba(230,236,248,0.6); margin: 0 0 9px; }
.cr-key-hint { margin: 7px 0 0; }
.cr-select { appearance: none; cursor: pointer;
  /* room for the chevron so a long provider label can't run under it */
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, rgba(230,236,248,0.55) 50%),
                    linear-gradient(135deg, rgba(230,236,248,0.55) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.cr-select option { background: #1b1f2a; color: #fff; }
.cr-key { margin-top: 9px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.86rem; }
[data-theme="light"] .cr-optional,
[data-theme="light"] .cr-hint { color: rgba(20,26,38,0.55); }
[data-theme="light"] .cr-select option { background: #fff; color: #141a26; }
.cr-sugg { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.cr-chip { font: inherit; font-size: 0.8rem; padding: 5px 11px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surf-card); color: #dfe6f5; }
.cr-chip:hover { background: rgba(150,180,255,0.2); }
.cr-chip.on { border-color: rgba(150,180,255,0.7); background: rgba(150,180,255,0.24); color: #fff; }
/* Pronoun picker. Its own row class on purpose — .cr-sugg carries the
   name-suggestion click handler, and these chips must not trip it. */
.cr-pronoun-row { display: flex; flex-wrap: wrap; gap: 6px; }
.cr-pronoun-custom { margin-top: 8px; }
.cr-arch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cr-arch-card { text-align: left; padding: 11px 12px; border-radius: 13px; cursor: pointer; font: inherit; color: #eef2fb;
  border: 1px solid var(--line); background: var(--surf-card); transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease; }
.cr-arch-card b { display: block; font-size: 0.9rem; margin-bottom: 3px; }
.cr-arch-card small { display: block; font-size: var(--t-xs); line-height: 1.3; color: var(--ink-soft); }
.cr-arch-card:hover { background: var(--surf-press); }
.cr-arch-card.on { border-color: rgba(150,180,255,0.7);
  box-shadow: 0 0 0 1px rgba(150,180,255,0.4), 0 8px 22px rgba(8,10,30,0.4); }
.cr-slider { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; }
.cr-slider .cr-slo, .cr-slider .cr-shi { font-size: var(--t-xs); color: var(--ink-soft); width: 64px; }
.cr-slider .cr-shi { text-align: right; }
.cr-range { flex: 1; accent-color: #8aa6ff; }
/* ---- Your cast (Settings): the guest-character list ---- */
.cast-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.cast-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surf-card); }
.cast-badge { width: 34px; height: 34px; border-radius: 50%; flex: none; display: flex; align-items: center;
  justify-content: center; font-size: 0.72rem; font-weight: 700; color: #fff;
  background: var(--guest-accent, #5b8fd6); }
.cast-badge [data-icon] { width: 20px; height: 20px; display: block; }
.cast-names { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cast-names b { font-size: 0.92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cast-names small { font-size: var(--t-xs); color: var(--ink-soft); }
/* flex:none — without a fixed footprint these two buttons (~180px) won the
   space fight against .cast-names and squeezed every name to 55px, so the
   roster read "David…" / "Tom …" on a 320px screen */
.cast-acts { display: flex; align-items: center; flex: none; }
@media (max-width: 360px) {
  .cast-row { flex-wrap: wrap; }
  .cast-names { flex: 1 0 100%; }
  .cast-acts { margin-left: 44px; }
}
.cast-act { font: inherit; font-size: 0.78rem; padding: 5px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surf-card); color: #dfe6f5; margin-left: 6px; }
.cast-act:hover { background: rgba(150,180,255,0.2); }
.cast-act.danger:hover { background: rgba(220,90,90,0.28); border-color: rgba(220,90,90,0.5); }
/* the roster: who is the MAIN AI right now */
.cast-row.active { border-color: color-mix(in srgb, var(--accent-warm) 55%, transparent); background: var(--tint-warm);
  box-shadow: 0 0 0 1px rgba(255,138,61,0.25) inset; }
.cast-main-chip { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  padding: 4px 9px; border-radius: var(--r-pill); margin-left: 6px; color: var(--on-accent);
  border: 1px solid color-mix(in srgb, var(--accent-warm) 55%, transparent);
  /* opaque for the same reason as .board-chip: this chip sits on the cast row's
     own warm tint, so a translucent fill made the label ride on that tint (4.33:1) */
  background: #ffb25c; white-space: nowrap; }
.cast-act.primary { border-color: rgba(255,138,61,0.5); color: #ffb37e; }
.cast-act.primary:hover { background: rgba(255,138,61,0.2); }
/* classic Limi's roster badge — her infinity mark on the brand gradient */
.cast-badge-limi { background: linear-gradient(135deg, var(--orange), var(--blue)); }
.cast-badge-limi .gicon { width: 22px; height: 22px; display: block; }
.cast-badge-limi .gicon [stroke]:not([stroke="none"]) { stroke: #fff; }
.cast-badge .gicon { width: 20px; height: 20px; }
/* the two Day .cast-row patches are retired: --surf-card / --line / --tint-warm
   already carry Day's own values, so the row no longer needs a per-theme copy. */
/* retired: .cast-names small uses --ink-soft, which is Day-aware and opaque
   (the 60%-alpha ink here measured 2.99:1 on the active row's warm tint). */
[data-theme="light"] .cast-act { color: #23407a; border-color: rgba(40,72,112,0.24); background: rgba(40,72,112,0.06); }
[data-theme="light"] .cast-act.primary { color: #c25b12; border-color: rgba(224,110,40,0.45); }
/* the Day patch here is retired: .cast-main-chip now uses --accent-ink and
   --tint-warm, which already carry Day's own values (9c3d08 measures 6.1:1). */

.cr-mode-hint { margin: -6px 0 14px; font-size: 0.8rem; line-height: 1.45; color: rgba(220,228,245,0.65); }
.cr-mode-hint:empty { display: none; }
[data-theme="light"] .cr-mode-hint { color: rgba(40,60,90,0.65); }
/* 1rem, not 0.92rem: under 16px iOS force-zooms the page the moment you tap in,
   and this is the FIRST field of the "describe your motivator" flow — inside a
   position:fixed card, so a zoomed page then hides Save/Cancel. Siblings
   (#cr-name/#cr-user/#cr-voice) inherit .cr-input's 1rem already. */
.cr-desc { resize: none; font-size: 1rem; line-height: 1.4; }
.cr-compile-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.cr-compile-btn { display: inline-flex; align-items: center; gap: 7px; }
.cr-compile-status { font-size: 0.78rem; color: rgba(220,228,245,0.7); min-height: 1em; }
.cr-style-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.cr-style-list:empty { display: none; }
.cr-style-note { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px;
  font-size: 0.78rem; line-height: 1.35; color: rgba(230,236,248,0.88);
  border: 1px solid rgba(150,180,255,0.22); background: rgba(150,180,255,0.08); }
.cr-style-note span { flex: 1; min-width: 0; }
.cr-style-x { flex: none; background: none; border: none; cursor: pointer; font-size: 0.7rem;
  color: rgba(220,228,245,0.55); padding: 2px 4px; border-radius: 6px; }
.cr-style-x:hover { color: #fff; background: rgba(220,90,90,0.3); }
[data-theme="light"] .cr-style-note { color: #2a3344; border-color: rgba(40,72,112,0.2); background: rgba(80,120,220,0.07); }
[data-theme="light"] .cr-style-x { color: rgba(40,60,90,0.55); }
.cr-divider { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px;
  font-size: 0.74rem; color: rgba(220,228,245,0.5); }
.cr-divider::before, .cr-divider::after { content: ""; flex: 1; height: 1px; background: var(--surf-press); }
[data-theme="light"] .cr-compile-status { color: rgba(40,60,90,0.65); }
[data-theme="light"] .cr-divider { color: rgba(40,60,90,0.5); }
[data-theme="light"] .cr-divider::before, [data-theme="light"] .cr-divider::after { background: rgba(40,72,112,0.16); }
.cr-voice-row { display: flex; align-items: center; gap: 8px; }
/* the emblem generator row — preview chip (drawn mark or live initials) + actions */
.cr-emblem-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cr-emblem-prev {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surf-card); border: 1px solid var(--line-strong);
  font-weight: 700; font-size: 0.78rem; letter-spacing: 0.5px; color: rgba(220,228,245,0.85);
}
.cr-emblem-prev .gicon { width: 27px; height: 27px; display: block; }
.cr-emblem-gen { display: inline-flex; align-items: center; gap: 6px; }
/* the real <input type=file> is driven by the "Upload a photo" button — hidden
   with clip rather than display:none so it stays focusable for keyboard users */
.cr-hidden-file { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* the hint under the row is a <span> inside a flex column — needs to block out */
.cr-emblem-row + .cr-hint { display: block; margin: 8px 0 0; }
/* the takes strip — this session's drawn marks, so a re-roll collects rather
   than overwrites. 38px chips: real thumb targets, per the mobile strike-zone
   rule the header layout learned the hard way. */
.cr-takes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.cr-take {
  width: 38px; height: 38px; border-radius: 50%; padding: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surf-card); border: 1.5px solid rgba(255,255,255,0.14);
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.cr-take:hover { border-color: rgba(150,180,255,0.45); transform: translateY(-1px); }
.cr-take.on { border-color: rgba(150,180,255,0.85); background: rgba(150,180,255,0.16); }
.cr-take .gicon { width: 26px; height: 26px; display: block; }
[data-theme="light"] .cr-take { background: rgba(80,120,220,0.06); border-color: rgba(40,72,112,0.22); }
[data-theme="light"] .cr-take.on { border-color: rgba(60,100,200,0.8); background: rgba(80,120,220,0.14); }
[data-theme="light"] .cr-emblem-prev { background: rgba(80,120,220,0.07); border-color: rgba(40,72,112,0.2); color: #2a3344; }
/* AI-PAINTED character icons: a real image fills the same round chips the
   initials/emblems use — cover-cropped and clipped to the circle. overflow on
   the chip (not radius on the img) so a bordered chip can't leak corners. */
.cr-emblem-prev, .limi-mark, .cast-badge, .guest-badge { overflow: hidden; }
.cr-emblem-prev img, .limi-mark img, .cast-badge img, .guest-badge img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block;
}
/* the "will answer" pill: painted icon sits inline like the hand-made glyphs */
.guest-target img { width: 1.2em; height: 1.2em; border-radius: 50%; object-fit: cover; vertical-align: -0.25em; }
/* a drawn emblem in the cast list sizes like the built-in faces */
.cast-badge .gicon { width: 20px; height: 20px; display: block; }
.cr-voice-sel { flex: 1; cursor: pointer; }
.cr-voice-prev { flex: none; width: 42px; height: 42px; border-radius: 12px; cursor: pointer; font-size: 0.9rem;
  border: 1px solid rgba(150,180,255,0.4); background: rgba(150,180,255,0.14); color: #eaf0ff;
  display: flex; align-items: center; justify-content: center; transition: background 0.15s ease, transform 0.1s ease; }
.cr-voice-prev:hover { background: rgba(150,180,255,0.26); }
.cr-voice-prev:active { transform: scale(0.94); }
.cr-voice-prev:disabled { opacity: 0.5; cursor: default; }
[data-theme="light"] .cr-voice-prev { color: #23407a; border-color: rgba(40,72,112,0.3); background: rgba(80,120,220,0.12); }
.creator-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.cr-textbtn { background: none; border: none; color: rgba(200,210,235,0.7); font: inherit; font-size: 0.8rem; cursor: pointer; text-decoration: underline; }
.cr-textbtn:hover { color: #fff; }
[data-theme="light"] .creator-card { background: rgba(255,255,255,0.97); color: #1c2436; border-color: rgba(40,72,112,0.16); }
[data-theme="light"] .cr-input { background: rgba(40,72,112,0.05); border-color: rgba(40,72,112,0.18); color: #1c2436; }
[data-theme="light"] .cr-arch-card { color: #1c2436; background: rgba(40,72,112,0.05); border-color: rgba(40,72,112,0.14); }
/* retired for the same reason: --ink-soft is already Day-correct here. */
[data-theme="light"] .creator-close { background: rgba(40,72,112,0.1); color: #1c2436; }
[data-theme="light"] .cr-label { color: #2a3344; }
@media (max-width: 480px) { .cr-arch { grid-template-columns: 1fr; } }

/* ---- Creator pop: branded color, per-archetype accents, fun dials ---- */
/* gradient hairline across the top of the card (matches the emblem gradient) */
.creator-card { position: relative; }
.creator-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, #ff8a3d, #ff5e7a 50%, #2f80ff); border-radius: 22px 22px 0 0; }

/* section labels → small-caps chips of intent */
.cr-label { text-transform: uppercase; letter-spacing: 0.07em; font-size: 0.72rem; }

/* every personality gets its own color; title wears it, selection glows with it */
.cr-arch-card[data-arch="mentor"] { --arch: #ff8a3d; }
.cr-arch-card[data-arch="hype"]   { --arch: #ff5e7a; }
.cr-arch-card[data-arch="calm"]   { --arch: #5b8fd6; }
.cr-arch-card[data-arch="savage"] { --arch: #e0483f; }
.cr-arch-card[data-arch="zen"]    { --arch: #3d9f6f; }
.cr-arch-card { border-left: 3px solid color-mix(in srgb, var(--arch, #8aa6ff) 55%, transparent);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease, transform 0.12s ease;
  position: relative; z-index: 0; }
/* the selection glow lives on a ::before that FADES in — a gradient set as
   `background` can't interpolate, so transitioning it just snapped on/off.
   z-index 0 on the card + -1 here pins the glow between the card's own
   background and its text. */
.cr-arch-card::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit;
  pointer-events: none; opacity: 0; transition: opacity 0.18s ease;
  background: linear-gradient(135deg, color-mix(in srgb, var(--arch, #8aa6ff) 24%, transparent), color-mix(in srgb, var(--arch, #8aa6ff) 8%, transparent)); }
.cr-arch-card b { color: var(--arch, inherit); }
.cr-arch-card:hover { transform: translateY(-1px); }
.cr-arch-card.on { border-color: var(--arch, #8aa6ff); transform: translateY(-1px);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--arch, #8aa6ff) 45%, transparent), 0 8px 22px rgba(8,10,30,0.35); }
.cr-arch-card.on::before { opacity: 1; }

/* each dial gets its own color: fire, gold, heart */
.cr-range[data-slider="intensity"] { accent-color: #ff6b4a; }
.cr-range[data-slider="humor"]     { accent-color: #ffb43d; }
.cr-range[data-slider="warmth"]    { accent-color: #ff5e7a; }
.cr-slider .cr-slo, .cr-slider .cr-shi { font-weight: 600; }
/* FIX: end labels were dark-theme-only colors — unreadable in Day theme */
[data-theme="light"] .cr-slider .cr-slo, [data-theme="light"] .cr-slider .cr-shi { color: rgba(40,60,90,0.55); }
[data-theme="light"] .cr-compile-status { color: rgba(40,60,90,0.65); }

/* the two magic buttons: gradient + glow (Build it, Bring it to life) */
#cr-save, .cr-compile-btn { border: none; font-weight: 700;
  background: linear-gradient(120deg, #ff8a3d, #ff5e7a 60%, #ff4d94);
  box-shadow: 0 8px 24px rgba(255,94,122,0.35);
  transition: transform 0.12s ease, box-shadow 0.15s ease; }
#cr-save:hover, .cr-compile-btn:hover:not(:disabled) { transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(255,94,122,0.45); }
#cr-save:active, .cr-compile-btn:active { transform: translateY(0) scale(0.98); }

/* ================================================================
   TIDY 2.0 + TASK DESCRIPTIONS  (self-contained block — appended)
   A task can carry an optional description. Tidy splits long titles
   into title + description behind a preview-and-approve modal w/ undo.
   ================================================================ */

/* ---- the quiet description line under a task title ---- */
.task-desc {
  font-size: 0.85rem; line-height: 1.4; color: var(--ink-soft);
  margin-top: 4px; white-space: pre-wrap; word-break: break-word; cursor: pointer;
}
.task-desc.collapsed {
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.task-desc-caret { color: var(--ink-soft); opacity: 0.7; margin-right: 5px; font-size: 0.78rem; }
.task.is-done .task-desc { text-decoration: line-through; opacity: 0.6; }

/* ---- inline description editor (row) + add-form textarea ---- */
.task-desc-input { width: 100%; margin-top: 8px; min-height: 38px; resize: vertical;
  font: inherit; font-size: 0.92rem; line-height: 1.4; }
.desc-edit-actions { display: flex; gap: 8px; margin-top: 6px; }

/* ---- merged Edit panel (title + details in one) ---- */
.task-edit { margin-top: 2px; display: flex; flex-direction: column; gap: 7px; }
.task-edit-title { width: 100%; font-size: 1rem; font-weight: 500; line-height: 1.38; }
.task-edit-desc { width: 100%; min-height: 42px; resize: vertical;
  font: inherit; font-size: 0.9rem; line-height: 1.4; }
/* iOS force-zooms the page for ANY text field under 16px, and app.js focuses
   the title the instant the editor opens — so editing a task (the most-used
   write path after adding one) zoomed the whole app and left it zoomed, where
   the .workspace scroll-snap carousel can be dragged to rest between panes.
   The title is now 1rem everywhere; the two smaller boxes keep their compact
   look on a mouse and go to 16px on a finger. */
@media (pointer: coarse) {
  .task-edit-desc, .task-desc-input { font-size: 1rem; }
}

/* ---- Tidy preview-and-approve modal ---- */
.tidy-overlay {
  position: fixed; inset: 0; z-index: 210;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  background: rgba(10,12,16,0.6);
  -webkit-backdrop-filter: blur(7px); backdrop-filter: blur(7px);
  opacity: 0; transition: opacity 0.18s ease;
}
.tidy-overlay.show { opacity: 1; }
.tidy-card {
  width: 100%; max-width: 560px; max-height: 88dvh;
  display: flex; flex-direction: column;
  padding: 18px 20px 16px; border-radius: 20px;
  background: rgba(24,26,32,0.94);
  -webkit-backdrop-filter: blur(16px) saturate(150%); backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--line);
  box-shadow: 0 22px 60px rgba(0,0,0,0.55);
  color: var(--ink); animation: rise 0.22s ease;
}
.tidy-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.tidy-head h2 { margin: 0; font-size: 1.12rem; letter-spacing: -0.3px; }
.tidy-sub { margin: 2px 0 12px; font-size: 0.82rem; color: var(--ink-soft); }
.tidy-close { width: 32px; height: 32px; border-radius: 10px; cursor: pointer; flex: none;
  font-size: 0.95rem; color: var(--ink);
  background: var(--surf-card); border: 1px solid var(--line); }
.tidy-close:hover { background: rgba(255,255,255,0.16); }
.tidy-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 2px; }
.tidy-row { border: 1px solid var(--line); border-radius: 13px; padding: 11px 12px;
  background: var(--surf-card); transition: opacity 0.18s ease, border-color 0.18s ease; }
.tidy-row.skipped { opacity: 0.42; }
.tidy-row-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tidy-before { font-size: 0.78rem; color: var(--ink-soft); word-break: break-word; }
.tidy-before s { opacity: 0.85; }
.tidy-arrow { color: var(--ink-soft); font-size: 0.8rem; margin: 5px 0 3px; }
.tidy-after-title { font-size: 0.96rem; font-weight: 600; color: var(--ink); word-break: break-word; }
.tidy-after-desc { font-size: 0.84rem; color: var(--ink-soft); margin-top: 4px; white-space: pre-wrap; word-break: break-word; }
.tidy-tag { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.4px; color: var(--ink-soft); opacity: 0.7; }
.tidy-toggle { flex: none; cursor: pointer; font: inherit; font-size: 0.78rem; font-weight: 600;
  padding: 4px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); color: var(--ink); background: var(--surf-card); }
.tidy-row.approved .tidy-toggle {
  background: linear-gradient(135deg, rgba(255,138,76,0.92), rgba(120,160,255,0.92));
  border-color: transparent; color: #0c0d10; }
.tidy-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.tidy-selall { font: inherit; font-size: 0.8rem; color: var(--ink-soft); background: none; border: none; cursor: pointer; padding: 6px 4px; }
.tidy-selall:hover { color: var(--ink); text-decoration: underline; }
.tidy-spacer { flex: 1; }
.tidy-cancel { font: inherit; font-size: 0.86rem; color: var(--ink); cursor: pointer;
  padding: 8px 14px; border-radius: 11px;
  background: var(--surf-card); border: 1px solid var(--line); }
.tidy-cancel:hover { background: rgba(255,255,255,0.16); }
.tidy-apply { font: inherit; font-size: 0.86rem; font-weight: 700; color: #0c0d10; cursor: pointer;
  padding: 8px 16px; border-radius: 11px; border: none;
  background: linear-gradient(135deg, var(--orange), var(--blue)); }
.tidy-apply:disabled { opacity: 0.5; cursor: default; }

/* light theme surfaces */
[data-theme="light"] .tidy-card { background: rgba(252,253,255,0.97); border-color: rgba(40,72,112,0.16); color: #1c2436; }
[data-theme="light"] .tidy-row { background: rgba(40,72,112,0.04); border-color: rgba(40,72,112,0.14); }
[data-theme="light"] .tidy-close,
[data-theme="light"] .tidy-cancel { background: rgba(40,72,112,0.08); color: #1c2436; border-color: rgba(40,72,112,0.18); }
[data-theme="light"] .tidy-toggle { background: rgba(40,72,112,0.06); color: #1c2436; border-color: rgba(40,72,112,0.2); }

/* ================================================================
   TASK STEPS  (sub-step checklist you check off — self-contained)
   ================================================================ */
.task-steps { list-style: none; margin: 8px 0 2px; padding: 5px 0 4px 11px;
  display: flex; flex-direction: column; gap: 4px;
  border-left: 2px solid rgba(255,255,255,0.12); }   /* indented sub-section */
.step { display: flex; align-items: flex-start; gap: 7px; padding: 1px 0; }
.step-mark { flex: none; width: 1.15em; text-align: center; color: var(--ink-soft); font-size: 0.8rem; line-height: 1.5; }
.step-mark .gicon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
/* step checkbox = the exact same custom square as the main task .check (it carries
   both classes); nothing to override here, it just inherits the .check look. */
.step-text { font-size: 0.88rem; line-height: 1.4; color: var(--ink); word-break: break-word; flex: 1; }
.step.done .step-text { text-decoration: line-through; color: var(--ink-soft); }
.step-del { flex: none; background: none; border: none; color: var(--ink-soft); cursor: pointer;
  opacity: 0; font-size: 0.78rem; padding: 0 4px; transition: opacity 0.15s ease; }
.step:hover .step-del, .task.pinned .step-del { opacity: 0.55; }   /* reachable on mobile via pinned row */
.step-del:hover { opacity: 1; color: #ff9a9a; }
/* the final step / goal — set apart at the end of the subsection */
.step-goal { margin-top: 5px; padding-top: 7px; border-top: 1px dashed rgba(255,255,255,0.18); }
.step-goal .step-mark { font-size: 0.98rem; }
.step-goal .step-text { font-weight: 600; }
.step-add { display: flex; gap: 8px; margin: 7px 0 2px 11px; }
.step-add-input { flex: 1; }
.step-badge { font-size: 0.74rem; color: var(--ink-soft); background: var(--surf-card);
  border: 1px solid var(--line); border-radius: var(--r-pill); padding: 1px 7px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 4px; }
.step-badge .gicon { width: 1.15em; height: 1.15em; }
.step-badge.all { color: #7fdd9b; border-color: rgba(127,221,155,0.4); }
[data-theme="light"] .step-badge { background: rgba(40,72,112,0.06); border-color: rgba(40,72,112,0.16); }

/* ================================================================
   MOTION SYSTEM (Instagram-quality pass, phase 1)
   Rules of the road (learned the hard way in this codebase):
   • transform/opacity ONLY — no filters, nothing layered over the
     live wave canvas (see the #glass-distortion note above).
   • Only the INCOMING panel animates: glass surfaces are expensive
     to composite, one panel at a time keeps phones at 60fps.
   • Item stagger is scoped to .panel-in-* so the constant
     innerHTML re-renders from Firestore snapshots never replay it.
   Kept at the END of the file so it wins the cascade.
   ================================================================ */

/* --- tab switches: the new panel slides in from the side you moved toward --- */
.panel-in-right { animation: panelInRight var(--m-base) var(--e-out) both; }
.panel-in-left  { animation: panelInLeft  var(--m-base) var(--e-out) both; }
@keyframes panelInRight { from { opacity: 0; transform: translateX(18px);  } to { opacity: 1; transform: none; } }
@keyframes panelInLeft  { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

/* task rows ride in with a short cascade — only while the panel is entering */
.panel-in-right .task, .panel-in-left .task {
  animation: itemRise var(--m-base) var(--e-out) both;
  animation-delay: 168ms; /* rows past the first seven share the last slot */
}
.panel-in-right .task:nth-child(1), .panel-in-left .task:nth-child(1) { animation-delay: 0ms; }
.panel-in-right .task:nth-child(2), .panel-in-left .task:nth-child(2) { animation-delay: 24ms; }
.panel-in-right .task:nth-child(3), .panel-in-left .task:nth-child(3) { animation-delay: 48ms; }
.panel-in-right .task:nth-child(4), .panel-in-left .task:nth-child(4) { animation-delay: 72ms; }
.panel-in-right .task:nth-child(5), .panel-in-left .task:nth-child(5) { animation-delay: 96ms; }
.panel-in-right .task:nth-child(6), .panel-in-left .task:nth-child(6) { animation-delay: 120ms; }
.panel-in-right .task:nth-child(7), .panel-in-left .task:nth-child(7) { animation-delay: 144ms; }
@keyframes itemRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* --- press feedback: every button gives a little under your finger --- */
button:not(.tab):active { transform: scale(0.965); transition: transform 80ms var(--e-out); }
.tab { transition: background 0.15s, color 0.15s, transform var(--m-fast) var(--e-out); }
.tab:active { transform: scale(0.94); }
/* …but `* { -webkit-tap-highlight-color: transparent }` below kills iOS's native
   flash for EVERYTHING, and the rules above only cover <button>/.btn. The most-
   tapped controls that aren't buttons — the done checkbox, the two task-row
   pickers, a checklist row, a pane dot — gave zero feedback, which on a slow
   frame reads as "the app ignored me" and earns a second tap. */
.check:active, .mom-check:active,
.area-dot:active, .goal-mark:active,
.swipe-dots span:active { transform: scale(0.9); transition: transform 80ms var(--e-out); }
.ck-item:active { transform: scale(0.985); background: var(--surf-press); }
[data-theme="light"] .ck-item:active { background: rgba(40,72,112,0.12); }

/* --- overlays: veil fades in on open, out on close (close adds .closing) --- */
#settings-overlay:not(.hidden), .creator-overlay:not(.hidden) {
  animation: veilIn var(--m-base) var(--e-out) both;
}
#settings-overlay.closing { animation: veilOut 160ms var(--e-out) both; }
@keyframes veilIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes veilOut { from { opacity: 1; } to { opacity: 0; } }

/* --- accessibility: all of the above collapses to instant --- */
@media (prefers-reduced-motion: reduce) {
  .panel-in-right, .panel-in-left,
  .panel-in-right .task, .panel-in-left .task,
  #settings-overlay:not(.hidden), .creator-overlay:not(.hidden),
  #settings-overlay.closing { animation: none !important; }
  button:not(.tab):active, .tab:active,
  .check:active, .mom-check:active, .area-dot:active, .goal-mark:active,
  .swipe-dots span:active, .ck-item:active { transform: none; }
}

/* ================================================================
   MOTION SYSTEM · PHASE 2 — the pill, the sheets, the pops
   ================================================================ */

/* --- sliding tab pill: one shared highlight that glides between tabs.
       The active tab's own background moves onto the pill so the switch
       is a visible slide (js/app.js positionPill drives transform/width). --- */
.rail-tabs { position: relative; }
.rail-tabs .tab { position: relative; } /* paint above the pill */
.tab-pill {
  position: absolute; top: 6px; bottom: 6px; left: 0; width: 0;
  border-radius: 12px;
  background: var(--surf-press);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
  pointer-events: none;
}
.tab-pill.live { transition: transform var(--m-base) var(--e-spring), width var(--m-base) var(--e-out); }
.tab.is-active { background: transparent; box-shadow: none; }
[data-theme="light"] .tab-pill { background: rgba(32,44,72,0.09); box-shadow: inset 0 1px 0 rgba(255,255,255,0.6); }
[data-theme="light"] .tab.is-active { background: transparent; box-shadow: none; }

/* --- a just-added task pops into existence (id-gated in app.js: never
       replays on snapshot re-renders, never fires on bulk data loads) --- */
.task-new { animation: taskPop var(--m-slow) var(--e-spring) both; }
@keyframes taskPop {
  from { opacity: 0; transform: scale(0.92) translateY(6px); }
  60%  { transform: scale(1.015); }
  to   { opacity: 1; transform: none; }
}

/* --- momentum bar: springy fill on progress, sweeps in with the panel --- */
.mom-bar > span { transition: width var(--m-slow) var(--e-spring); }
.panel-in-right .mom-bar > span, .panel-in-left .mom-bar > span {
  transform-origin: left; animation: barFill var(--m-slow) var(--e-out) both;
}
@keyframes barFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* --- phone: settings + creator become true bottom sheets --- */
@media (max-width: 600px) {
  .settings-overlay, .creator-overlay, .cks-overlay { align-items: flex-end; padding: 0; }
  .settings-card, .creator-card, .cks-card {
    width: 100%; max-width: 100%;
    border-radius: 22px 22px 0 0;
    max-height: 92dvh;
    padding-bottom: max(22px, env(safe-area-inset-bottom));
    animation: sheetUp var(--m-slow) var(--e-out);
  }
  #settings-overlay.closing .settings-card,
  .creator-overlay.closing .creator-card,
  .cks-overlay.closing .cks-card { animation: sheetDown 160ms var(--e-out) both; }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheetDown { from { transform: none; } to { transform: translateY(100%); } }

/* --- felt, not seen: no gray iOS tap flash; panel scrolls don't chain
       into the page (horizontal carousel untouched — y-axis only) --- */
* { -webkit-tap-highlight-color: transparent; }
.rail-panel, .limi-feed { overscroll-behavior-y: contain; }

/* --- reduced motion: phase 2 collapses to instant too --- */
@media (prefers-reduced-motion: reduce) {
  .tab-pill.live { transition: none; }
  .task-new,
  .panel-in-right .mom-bar > span, .panel-in-left .mom-bar > span,
  .settings-card, .creator-card, .cks-card,
  #settings-overlay.closing .settings-card,
  .creator-overlay.closing .creator-card,
  .cks-overlay.closing .cks-card { animation: none !important; }
  .mom-bar > span { transition: none; }
}

/* ================================================================
   MOTION SYSTEM · PHASE 3 (FRAMEWORK — finish + deploy next session)
   Drag-to-dismiss sheets, FLIP reorder, flag-gated Idea Board layer.
   ================================================================ */

/* --- sheet grip: the grab bar affordance (phone only, injected by JS) --- */
.sheet-grip { display: none; }
@media (max-width: 600px) {
  .sheet-grip { display: block; width: 40px; height: 4px; border-radius: 99px;
    margin: 0 auto 10px; background: rgba(255,255,255,0.22); flex: none; }
  [data-theme="light"] .sheet-grip { background: rgba(32,44,72,0.25); }
}

/* a drag-dismissed sheet keeps its dragged-away position — running sheetDown
   too would snap it back to the top first (the inline transform already
   carried it off-screen); only the veil still fades */
#settings-overlay.drag-dismissed.closing .settings-card,
.creator-overlay.drag-dismissed.closing .creator-card,
.cks-overlay.drag-dismissed.closing .cks-card { animation: none; }

/* --- FLIP reorder: inline transforms do the gliding; this class is the
       compositor hint + the test hook --- */
.flip-moving { will-change: transform; }

/* --- in-app Idea Board layer (flag-gated): a native-style push-over --- */
.board-layer {
  position: fixed; inset: 0; z-index: 150; /* under settings(200) + creator(240) */
  display: flex; flex-direction: column;
  background: #101319;
  animation: boardOver var(--m-slow) var(--e-out) both;
}
.board-layer.closing { animation: boardOut 300ms var(--e-out) both; }
.board-layer.hidden { display: none; }
[data-theme="light"] .board-layer { background: #eef1f8; }
.board-layer-bar { display: flex; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 14px 10px; }
.board-layer-title { font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.board-layer-mount { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; }
.board-layer-placeholder { padding: 40px 20px; text-align: center; color: var(--ink-soft); }
@keyframes boardOver { from { transform: translateX(100%); } to { transform: none; } }
@keyframes boardOut  { from { transform: none; } to { transform: translateX(100%); } }

/* --- reduced motion: phase 3 collapses to instant too --- */
@media (prefers-reduced-motion: reduce) {
  .board-layer, .board-layer.closing { animation: none !important; }
  .flip-moving { will-change: auto; }
}

/* ================================================================
   ACTIVITY — the owner-only usage dashboard (#activity-layer),
   board-layer's push-over pattern with hand-rolled charts inside.
   Single-hue marks via --act-mark; text stays in ink tokens.
   ================================================================ */
.activity-layer {
  position: fixed; inset: 0; z-index: 160; /* above board(150), under settings(200) */
  display: flex; flex-direction: column;
  background: #101319;
  animation: boardOver var(--m-slow) var(--e-out) both;
  --act-mark: var(--blue-deep);           /* light blue on dark, deep blue on Day */
  --act-track: rgba(255, 255, 255, 0.07);
  --act-line: rgba(255, 255, 255, 0.12);
}
.activity-layer.closing { animation: boardOut 300ms var(--e-out) both; }
.activity-layer.hidden { display: none; }
[data-theme="light"] .activity-layer {
  background: #eef1f8;
  --act-track: rgba(32, 44, 72, 0.08);
  --act-line: rgba(32, 44, 72, 0.16);
}
.activity-layer-bar { display: flex; align-items: center; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 14px 10px; }
.activity-layer-title { font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.activity-layer-mount { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain;
  padding: 4px 16px max(24px, env(safe-area-inset-bottom)); max-width: 720px; width: 100%; margin: 0 auto; }
.act-note { padding: 0 16px; max-width: 720px; margin: 0 auto; width: 100%; }

.act-range { display: inline-flex; gap: 4px; padding: 4px; border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--glass-border); margin: 6px 0 14px; }
.act-range-opt { border: 0; background: transparent; color: var(--ink-soft); font: inherit;
  font-size: 0.82rem; font-weight: 600; padding: 6px 12px; border-radius: var(--r-pill); cursor: pointer; }
.act-range-opt.is-on { background: rgba(255, 255, 255, 0.14); color: var(--ink); }
[data-theme="light"] .act-range { background: rgba(32, 44, 72, 0.05); }
[data-theme="light"] .act-range-opt.is-on { background: rgba(32, 44, 72, 0.12); }

.act-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
/* The goal and the nag proof, 2 by 2. Their labels are longer, so a wrapped
   one gets a reading line-height and the values share a baseline per row. */
.act-tiles.act-proof { grid-template-columns: repeat(2, 1fr); }
.act-proof .act-tile { justify-content: space-between; }
.act-proof .act-tile-label { line-height: 1.35; }
.act-tile { background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 13px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.act-tile-label { font-size: 0.72rem; color: var(--ink-soft); letter-spacing: 0.02em; }
.act-tile-value { font-size: 1.6rem; font-weight: 700; color: var(--ink); line-height: 1.15; }
[data-theme="light"] .act-tile { background: rgba(40, 72, 112, 0.05); border-color: rgba(32, 44, 72, 0.16); }

.act-sec { margin: 0 0 20px; }
.act-sec h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-soft); margin: 0 0 10px; }
.act-empty { color: var(--ink-soft); font-size: 0.9rem; margin: 4px 0; }

/* Day-by-day columns: thin marks, 4px rounded caps, square at the baseline. */
.act-days { display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 132px;
  border-bottom: 1px solid var(--act-line); padding-bottom: 0; }
.act-day { flex: 1 1 0; max-width: 26px; height: 100%; min-width: 0; position: relative;
  padding-top: 18px; /* headroom so the peak label never sits ON a full-height bar */
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  cursor: default; border-radius: 6px 6px 0 0; outline-offset: 2px; }
.act-day:hover, .act-day:focus-visible { background: rgba(255, 255, 255, 0.05); }
[data-theme="light"] .act-day:hover, [data-theme="light"] .act-day:focus-visible { background: rgba(32, 44, 72, 0.06); }
.act-day-fill { width: 100%; max-width: 22px; background: var(--act-mark);
  border-radius: 4px 4px 0 0; opacity: 0.75; }
.act-day-fill.is-today { opacity: 1; }
.act-day-val { position: absolute; top: 0; font-size: 0.7rem; font-weight: 700; color: var(--ink); }
.act-day-lab { font-size: 0.62rem; color: var(--ink-soft); height: 14px; line-height: 14px;
  margin-top: 2px; position: absolute; bottom: -18px; }
.act-days { margin-bottom: 22px; }

/* Feature popularity: horizontal bars, one hue, value at the bar end. */
.act-feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.act-feat { display: grid; grid-template-columns: 96px 1fr 40px; align-items: center; gap: 10px; }
.act-feat-name { font-size: 0.82rem; color: var(--ink-soft); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.act-feat-track { height: 12px; border-radius: 4px; background: var(--act-track); overflow: hidden; }
.act-feat-fill { height: 100%; background: var(--act-mark); border-radius: 0 4px 4px 0; opacity: 0.85; }
.act-feat-val { font-size: 0.82rem; font-weight: 700; color: var(--ink); text-align: right;
  font-variant-numeric: tabular-nums; }

.act-people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.act-person { display: flex; align-items: center; gap: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 13px; padding: 10px 14px; }
[data-theme="light"] .act-person { background: rgba(40, 72, 112, 0.05); border-color: rgba(32, 44, 72, 0.16); }
.act-person-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.act-person-name { font-weight: 700; color: var(--ink); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.act-person-seen { font-size: 0.74rem; color: var(--ink-soft); }
.act-spark { width: 84px; height: 26px; color: var(--ink-soft); flex: 0 0 auto; }
.act-spark-dot { fill: var(--act-mark); }
.act-person-side { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: 0 0 auto; }
.act-person-total { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.act-person-top { font-size: 0.72rem; color: var(--ink-soft); }

.act-tip { position: fixed; z-index: 5; pointer-events: none; padding: 6px 10px;
  border-radius: 9px; background: rgba(10, 13, 20, 0.92); border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--ink); font-size: 0.78rem; white-space: nowrap; transform: translateX(-50%);
  left: 0; top: 0; }
[data-theme="light"] .act-tip { background: rgba(255, 255, 255, 0.96); border-color: rgba(32, 44, 72, 0.22); }

@media (max-width: 480px) {
  .act-tiles { gap: 6px; }
  .act-tile { padding: 10px 10px; }
  .act-tile-value { font-size: 1.3rem; }
  .act-feat { grid-template-columns: 84px 1fr 36px; gap: 8px; }
  .act-spark { width: 64px; }
  .act-person-top { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .activity-layer, .activity-layer.closing { animation: none !important; }
}


/* ================================================================
   IDEA BOARD — shared by the standalone page (ideaboard.html) AND
   the in-app board layer (#board-layer). Moved here from the page's
   inline <style> during the phase-3 fold-in so one copy serves both.
   ================================================================ */
    .board-wrap { max-width: 1200px; margin: 0 auto;
      padding: calc(18px + env(safe-area-inset-top)) 16px calc(80px + env(safe-area-inset-bottom)); }
    .board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
    .board-head h1 { font-size: 1.3rem; margin: 0; letter-spacing: -0.3px; display: flex; align-items: center; gap: 9px; }
    .muted { color: var(--ink-soft); }
    .board-grid { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 18px; align-items: start; }
    /* minmax(0,1fr), NOT 1fr: plain `1fr` is `minmax(auto,1fr)`, so the track
       floors at the grid item's min-content — which .board-switch dragged out
       to 441px. That made the whole board 458px wide on every phone: the board
       panned sideways, Distill / Executed / Edit sat off-screen, and on the
       standalone page one swipe both switched boards AND scrolled the page. */
    @media (max-width: 820px) { .board-grid { grid-template-columns: minmax(0, 1fr); } }

    /* ---------- compose bar: a blank sticky you write on ---------- */
    .compose { display: flex; flex-direction: column; gap: 9px; padding: 14px; margin-bottom: 16px; }
    .compose.glass { border-radius: 4px; transform: rotate(-0.6deg);
      background: linear-gradient(178deg, rgba(255,244,170,0.13), rgba(255,238,140,0.07));
      border: 1.5px dashed rgba(255,240,170,0.45); box-shadow: none;
      -webkit-backdrop-filter: none; backdrop-filter: none; }
    [data-theme="light"] .compose.glass { background: linear-gradient(178deg, #fff6c8, #ffefad); border-color: rgba(150,120,20,0.45); }
    /* The tilt is the sticky-note motif and it belongs on the idea composer.
       The Wishlist bar is a URL field + an Add button over a board of square
       product tiles — tilted, it just read as crooked (Ian, 2026-08-15). */
    #wishlist-compose.compose.glass { transform: none;
      background: var(--surf-card); border: 1px solid var(--line); border-radius: 16px; }
    [data-theme="light"] #wishlist-compose.compose.glass { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12); }
    .compose-title { font-family: "Caveat", cursive; font-size: 1.45rem; font-weight: 700; width: 100%; padding: 4px 6px;
      background: transparent; color: #fff7d9; border: none; }
    .compose-title::placeholder { color: rgba(255,247,217,0.55); }
    [data-theme="light"] .compose-title { color: #4a3c14; }
    [data-theme="light"] .compose-title::placeholder { color: rgba(74,60,20,0.5); }
    .compose-title:focus { outline: none; }
    .compose-context { font: inherit; width: 100%; min-height: 48px; resize: vertical; padding: 8px 10px; border-radius: 9px;
      background: var(--surf-card); color: var(--ink); border: 1px solid var(--line); }
    [data-theme="light"] .compose-context { background: rgba(255,255,255,0.4); color: #3a3222; border-color: rgba(150,120,20,0.3); }
    .compose-row { display: flex; gap: 9px; flex-wrap: wrap; }
    .shot-btn { cursor: pointer; display: inline-flex; align-items: center; }

    /* ---------- reel import bar (a flowing section in the compose) ---------- */
    .reel-bar { display: flex; align-items: center; gap: 9px; margin-top: 4px; padding-top: 12px;
      border-top: 1px solid var(--line); }
    .reel-ico { font-size: 1rem; flex: none; opacity: 0.85; }
    .reel-url { flex: 1; min-width: 0; font: inherit; font-size: 0.9rem; padding: 10px 12px; border-radius: 11px;
      background: var(--surf-card); color: var(--ink); border: 1px solid var(--line); }
    .reel-bar .btn { flex: none; }
    /* idea vs philosophy toggle in the review modal */
    .reel-kind { display: flex; gap: 8px; }
    .rk-opt { flex: 1; font: inherit; font-size: 0.88rem; font-weight: 600; padding: 9px 8px; border-radius: 10px; cursor: pointer;
      background: var(--surf-card); color: var(--ink-soft); border: 1px solid var(--line); }
    .rk-opt.active { background: var(--orange); color: #fff; border-color: transparent; }
    /* the little "idea / philosophy" badge on a card */
    .ic-kind { align-self: flex-start; font-size: 0.6rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
      padding: 2px 8px; border-radius: 99px; background: rgba(0,0,0,0.12); color: rgba(0,0,0,0.62); margin-bottom: 3px; }
    .idea-card.kind-philosophy .ic-kind { background: rgba(74,15,55,0.16); color: rgba(74,15,55,0.78); }
    /* philosophies are taped up, not pinned */
    .idea-card.kind-philosophy .ic-pin { display: none; }
    .idea-card.kind-philosophy::before { content: ""; position: absolute; top: -9px; left: 50%; z-index: 4; pointer-events: none;
      width: 64px; height: 20px; transform: translateX(-50%) rotate(-3deg);
      background: rgba(255,255,255,0.28); box-shadow: 0 1px 3px rgba(0,0,0,0.18);
      border-left: 1px dashed rgba(255,255,255,0.4); border-right: 1px dashed rgba(255,255,255,0.4); }
    .ic-srclink { position: absolute; bottom: 6px; right: 16px; font-size: 0.72rem; opacity: 0.55; text-decoration: none; color: inherit; }
    .ic-srclink:hover { opacity: 0.9; text-decoration: underline; }

    /* ---------- two-board switch (Ideas ⟷ Executed) ---------- */
    /* Board switch = index tabs hanging off the glass frame. THE ALIGNMENT RULES,
       learned the hard way (Ian called this "uneven", 2026-08-15):
        · the row spans the frame EXACTLY (no side padding) — an inset row left
          the frame's rounded corners poking out either side of the tabs;
        · all three tabs are the same height and sit on the same baseline. The
          active one used to translateY(-3px), which broke the row's bottom edge
          AND opened a hairline between that tab and the frame it's tucked into.
          The active state is carried by fill + a lit top edge instead. */
    .board-switch { display: flex; gap: 6px; margin: 10px 0 0; padding: 0; position: relative; z-index: 2; }
    /* min-width:0 — flex items default to min-width:auto, so these three chips
       refused to shrink below their text and set the board's min-content width */
    .bswitch { flex: 1; min-width: 0; font: inherit; font-size: 0.9rem; font-weight: 600; padding: 11px 12px 12px; cursor: pointer;
      display: flex; align-items: center; justify-content: center; gap: 7px;
      border-radius: 12px 12px 0 0; margin-bottom: -1px;
      background: var(--surf-card); color: var(--ink-soft);
      border: 1px solid var(--line); border-bottom: none;
      -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
      transition: background 0.15s, color 0.15s; }
    .bswitch:hover { color: var(--ink); background: var(--surf-press); }
    /* was `color: #fff` on #f26f24 — 2.6:1, a WCAG failure the redesign's audit
       never reached because it only walked the stage, tasks and settings views.
       --on-accent is the same dark ink every other orange surface uses. */
    .bswitch.is-active { background: linear-gradient(180deg, #ff9a52, #f26f24); color: var(--on-accent); border-color: transparent;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), 0 -3px 12px -4px rgba(255,138,61,0.5); }
    /* the Milkplexity door (was the Builder door): a standalone pill button on
       its own row, detached from the view tabs because it is not a view */
    .builder-door-row { display: flex; justify-content: flex-end; margin: 14px 0 0; position: relative; z-index: 2; }
    .builder-door { display: inline-flex; align-items: center; gap: 8px;
      font: inherit; font-size: 0.92rem; font-weight: 700; letter-spacing: 0.1px;
      padding: 10px 18px; border-radius: var(--r-pill); text-decoration: none; color: #fff; cursor: pointer;
      background: linear-gradient(135deg, var(--orange), #ff6a2b); border: 1px solid var(--line-strong);
      box-shadow: 0 8px 24px rgba(255,122,47,0.35), inset 0 1px 0 rgba(255,255,255,0.35);
      transition: transform 0.15s, box-shadow 0.18s; }
    .builder-door:hover { transform: translateY(-1px);
      box-shadow: 0 10px 30px rgba(255,122,47,0.5), inset 0 1px 0 rgba(255,255,255,0.4); }
    .builder-door:active { transform: translateY(1px); }
    .builder-door .bd-go { opacity: 0.85; }
    .bs-count { font-size: 0.74rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: rgba(0,0,0,0.22); }
    .bswitch.is-active .bs-count { background: rgba(74,32,6,0.20); color: var(--on-accent); }
    /* A third of a phone is not much room for "Executed" + a count + an icon:
       at 390px the icon was being sliced in half by its own tab. Tighten first,
       and only below ~360px give the icon up — a clipped glyph looks broken,
       a missing one just looks plain. */
    @media (max-width: 560px) {
      .bswitch { font-size: 0.82rem; padding: 10px 8px 20px; gap: 5px; }
      .wish-ico .gicon, .bswitch .gicon { width: 1em; height: 1em; }
      .bs-count { font-size: 0.68rem; padding: 1px 6px; }
    }
    @media (max-width: 360px) {
      .bswitch { font-size: 0.78rem; padding: 10px 6px 20px; gap: 4px; }
      .bswitch [data-icon] { display: none; }
    }
    [data-theme="light"] .bswitch { background: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.12); }
    [data-theme="light"] .bswitch:hover { background: rgba(0,0,0,0.09); }

    /* the board itself: liquid-glass frame around a graphite pegboard.

       THE OVERHANG, measured 2026-08-20 after Ian said the tabs sat on the
       board "unnaturally": .frame carried `padding: 10px`, so the pegboard the
       eye reads as "the blackboard" started 11px (10 + the 1px border) inside
       the frame's edge — while .board-switch spanned the frame EXACTLY. The
       tabs therefore hung 11px past the board on BOTH sides at every width.
       That gutter was pure glass on a dark room: invisible, and the only thing
       it ever did was misalign the tabs. It is gone; the cork now fills the
       frame corner to corner and the tabs land on the board's real edges. */
    .frame { position: relative; z-index: 1; padding: 0; border-radius: 18px;
      background: var(--surf-card);
      -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
      border: 1px solid var(--line);
      box-shadow: 0 24px 60px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,138,61,0.08), 0 0 46px rgba(255,138,61,0.09); }
    [data-theme="light"] .frame { background: rgba(0,0,0,0.045); border-color: rgba(0,0,0,0.12);
      box-shadow: 0 20px 48px rgba(30,40,60,0.18); }
    /* 17px, not 18: it nests inside the frame's 18px radius less its 1px border,
       so the two curves stay concentric instead of leaving a bright crescent. */
    .board-stage.cork { border-radius: 17px; min-height: 380px; padding: 16px 16px 22px;
      background-color: #262b34; /* felt texture painted on via JS */
      box-shadow: inset 0 3px 18px rgba(0,0,0,0.5), inset 0 -2px 10px rgba(0,0,0,0.3);
      overflow: hidden; }
    [data-theme="light"] .board-stage.cork { background-color: #dde2ea;
      box-shadow: inset 0 3px 14px rgba(30,40,60,0.22), inset 0 -2px 8px rgba(30,40,60,0.12); }
    .board-stage.cork::before { content: ""; position: absolute; inset: 0; pointer-events: none;
      background-image: radial-gradient(rgba(255,255,255,0.055) 1px, transparent 1.4px); background-size: 26px 26px; }
    [data-theme="light"] .board-stage.cork::before { background-image: radial-gradient(rgba(30,40,60,0.1) 1px, transparent 1.4px); }
    .board-stage.cork::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 7;
      background: radial-gradient(90% 55% at 50% 0%, rgba(255,138,61,0.05), transparent 60%),
                  radial-gradient(120% 90% at 50% 20%, transparent 55%, rgba(0,0,0,0.26)); }
    [data-theme="light"] .board-stage.cork::after { background: radial-gradient(120% 90% at 50% 20%, transparent 60%, rgba(30,40,60,0.12)); }

    /* the board "flies up & right" out, and the other flies in from down-left */
    .board-stage { position: relative; }
    @keyframes boardFlyOut { to { transform: translate(70px, -64px) rotate(3deg) scale(0.94); opacity: 0; } }
    @keyframes boardFlyIn { from { transform: translate(-64px, 60px) rotate(-3deg) scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }
    .ideas-grid.fly-out { animation: boardFlyOut 0.26s cubic-bezier(0.4,0,0.7,0.2) forwards; }
    .ideas-grid.fly-in { animation: boardFlyIn 0.34s cubic-bezier(0.2,0.8,0.3,1); }
    @media (prefers-reduced-motion: reduce) { .ideas-grid.fly-out, .ideas-grid.fly-in { animation: none; } }

    /* a single card flying off to the Executed board */
    @keyframes cardFlyOff { to { transform: translate(160px, -200px) rotate(14deg) scale(0.5); opacity: 0; } }
    .idea-card.flying-off { animation: cardFlyOff 0.5s cubic-bezier(0.4,0,0.6,0.2) forwards; pointer-events: none; z-index: 6; }

    /* executed (shipped) cards: desaturated paper + a rotated rubber stamp */
    .idea-card.executed { filter: saturate(0.55) brightness(0.97); }
    .idea-card.executed .ic-title { text-decoration: none; }
    .idea-card.executed .ic-shipped { position: absolute; top: 44%; left: 50%; z-index: 5; pointer-events: none;
      transform: translate(-50%,-50%) rotate(-13deg);
      font-weight: 900; font-size: 1.05rem; letter-spacing: 0.2em; text-transform: uppercase;
      color: rgba(23,122,72,0.8); border: 3px solid rgba(23,122,72,0.8);
      padding: 3px 11px; border-radius: 6px; background: transparent; mix-blend-mode: multiply; }
    .idea-card.executed .ic-shipped span { display: none; } /* the old rocket icon has no place on a stamp */

    /* ---------- Wishlist ---------- */
    .wish-bar { display: flex; align-items: center; gap: 9px; }
    .wish-ico { font-size: 1.1rem; flex: none; }
    .wish-ico .gicon, .bswitch .gicon { width: 1.15em; height: 1.15em; vertical-align: -0.2em; }
    /* verdict dots (replace the status emoji) */
    .wv-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: 0.02em; }
    .wv-dot.get { background: #37d39a; } .wv-dot.maybe { background: #ffcf5e; } .wv-dot.skip { background: #ff5e6b; }
    .wish-bar .btn { flex: none; }
    .wish-img { width: 100%; max-height: 160px; object-fit: contain; border-radius: 12px; background: rgba(0,0,0,0.2); margin-bottom: 4px; }
    .wish-price-row { display: flex; gap: 9px; }
    .wish-price-in { flex: 1; } .wish-cur-in { width: 72px; flex: none; text-transform: uppercase; }
    .wish-verdict { display: flex; gap: 8px; margin-top: 12px; }
    .wv-opt { flex: 1; font: inherit; font-size: 0.84rem; font-weight: 600; padding: 9px 6px; border-radius: 10px; cursor: pointer;
      background: var(--surf-card); color: var(--ink-soft); border: 1px solid var(--line); }
    .wv-opt.active[data-verdict="get"]   { background: rgba(40,170,90,0.22);  border-color: rgba(40,170,90,0.6);  color: var(--ink); }
    .wv-opt.active[data-verdict="maybe"] { background: rgba(255,180,40,0.20);  border-color: rgba(255,180,40,0.6); color: var(--ink); }
    .wv-opt.active[data-verdict="skip"]  { background: rgba(230,70,70,0.20);   border-color: rgba(230,70,70,0.6);  color: var(--ink); }

    /* wishlist cards: a product tile, not a sticky note — color-coded by verdict */
    .idea-card.wish { background: linear-gradient(180deg, #2a2f39, #242832); color: var(--ink); padding-top: 14px; }
    [data-theme="light"] .idea-card.wish { background: linear-gradient(180deg, #ffffff, #f3f5f9); color: #2a2f3a; }
    .idea-card.wish::after { display: none; }
    .idea-card.wish .ic-pin { display: none; }
    .idea-card.wish[data-verdict="get"]   { border-left: 4px solid #28aa5a; }
    .idea-card.wish[data-verdict="maybe"] { border-left: 4px solid #ffb428; }
    .idea-card.wish[data-verdict="skip"]  { border-left: 4px solid #e64646; }
    .iw-thumb { width: 100%; height: 116px; object-fit: cover; border-radius: 9px; margin-bottom: 8px; background: rgba(0,0,0,0.18); }
    .iw-noimg { width: 100%; height: 70px; border-radius: 9px; margin-bottom: 8px; display: grid; place-items: center;
      background: var(--surf-card); font-size: 1.5rem; opacity: 0.5; }
    .iw-noimg .gicon { width: 1.5em; height: 1.5em; }
    .iw-title { font-family: inherit !important; font-size: 0.98rem !important; font-weight: 600; line-height: 1.25; }
    .iw-price { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 800; font-size: 1.05rem; margin: 4px 0 2px; }
    .iw-price.none { font-weight: 600; font-size: 0.82rem; opacity: 0.7; cursor: pointer; text-decoration: underline; }
    .iw-cur { font-size: 0.72rem; opacity: 0.7; font-weight: 700; }
    .iw-verdict-dot { width: 14px; height: 14px; border-radius: 50%; cursor: pointer; flex: none; border: none; padding: 0; }
    .iw-verdict-dot[data-v="get"]   { background: #28aa5a; }
    .iw-verdict-dot[data-v="maybe"] { background: #ffb428; }
    .iw-verdict-dot[data-v="skip"]  { background: #e64646; }
    .wish-total-pill { color: var(--ink-soft); }
    /* category picker (review modal) + filter chips (board) */
    .wish-cats { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
    .wc-opt { font: inherit; font-size: 0.8rem; padding: 7px 11px; border-radius: 99px; cursor: pointer;
      background: var(--surf-card); color: var(--ink-soft); border: 1px solid var(--line); }
    .wc-opt.active { background: var(--orange); color: #fff; border-color: transparent; }
    /* lives inside the cork now, above the notes — position:relative so it stays
       over the pegboard's dot texture, and z-index keeps it clear of .ideas-empty */
    .wish-filter { position: relative; z-index: 2; display: flex; flex-wrap: wrap; gap: 7px; margin: 2px 0 0; }
    .wish-filter.hidden + .ideas-grid { padding-top: 16px; }
    .wish-filter:not(.hidden) + .ideas-grid { padding-top: 14px; }
    .wf-chip { font: inherit; font-size: 0.78rem; padding: 6px 11px; border-radius: 99px; cursor: pointer;
      background: var(--surf-card); color: var(--ink-soft); border: 1px solid var(--line); }
    .wf-chip.active { background: rgba(255,138,61,0.18); border-color: rgba(255,138,61,0.5); color: var(--ink); }
    .iw-cat { align-self: flex-start; font-size: 0.66rem; font-weight: 700; padding: 2px 8px; border-radius: 99px;
      background: var(--surf-press); color: var(--ink-soft); margin-bottom: 4px; }

    /* ---------- sticky-note idea cards (native scroll, finger-friendly) ---------- */
    .ideas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 26px 18px; padding-top: 16px; }
    /* 164, not 150: at a 560px viewport the old floor packed THREE columns of
       157px, which is smaller than the two-column phone case and the tightest
       the notes ever got. This keeps 1 column at 320-390 and 2 at 430 exactly
       as before, and turns that 3x157 band into 2 comfortable columns. */
    @media (max-width: 560px) { .ideas-grid { grid-template-columns: repeat(auto-fill, minmax(164px, 1fr)); gap: 24px 14px; } }
    /* the empty / loading / load-failed line sits ON the cork, centred in it —
       it used to hang below the whole frame, so an empty board was a 380px slab
       of blank pegboard with an orphaned sentence underneath it */
    .ideas-empty { position: absolute; inset: 0; z-index: 1; margin: 0; padding: 30px 22px;
      display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
      text-align: center; text-wrap: balance; pointer-events: none; }
    .ideas-empty .btn { pointer-events: auto; } /* …but Retry still has to be clickable */

    .idea-card {
      /* the query container for .ic-title's type scale — see @container below.
         inline-size containment only; the pin and the dog-ear still paint
         outside the box because that is PAINT containment, which this is not. */
      container-type: inline-size;
      position: relative; display: flex; flex-direction: column; gap: 5px;
      padding: 22px 15px 13px; border-radius: 3px;
      background: linear-gradient(180deg, #ffe96b, #fcdf57); color: #34301a;
      box-shadow: 0 12px 22px rgba(0,0,0,0.28), 0 2px 5px rgba(0,0,0,0.16);
      transform: rotate(var(--tilt, -1deg));
      transition: transform 0.18s ease, box-shadow 0.18s ease;
    }
    .idea-card:hover { transform: rotate(0deg) translateY(-2px); box-shadow: 0 18px 30px rgba(0,0,0,0.34); z-index: 3; }
    .idea-card[data-stage="cyan"]    { background: linear-gradient(180deg, #8fe7ff, #5fd0ef); color: #0d3a47; }
    .idea-card[data-stage="magenta"] { background: linear-gradient(180deg, #ffa3da, #ff79c0); color: #4a0f37; }
    /* dog-eared corner */
    .idea-card::after { content: ""; position: absolute; right: 0; bottom: 0; border-style: solid;
      border-width: 0 0 18px 18px; border-color: transparent transparent rgba(0,0,0,0.13) transparent; }

    /* the pushpin holding the note down */
    .ic-pin { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 22px; height: 22px; z-index: 4; pointer-events: none;
      filter: drop-shadow(0 3px 3px rgba(0,0,0,0.35)); }

    .ic-top { display: flex; align-items: flex-start; gap: 7px; }
    .ic-stage { position: relative; flex: none; width: 13px; height: 13px; margin-top: 6px; border-radius: 50%; cursor: pointer; padding: 0;
      border: 1.5px solid rgba(0,0,0,0.35); background: conic-gradient(#fcdf57 0 33%, #5fd0ef 0 66%, #ff79c0 0); }
    /* 13×13 is the smallest control in the app — pad the strike zone, keep the dot */
    .ic-stage::before { content: ""; position: absolute; inset: -13px; }
    /* ---- the note title, and the two bugs that let it walk off the paper ----

       1. `flex: 1` leaves min-width at its `auto` default, so this box could not
          shrink below its longest word. Measured 2026-08-20: at a 430px
          viewport the board goes to two columns, the note is 176px wide, and
          the title box hung 14px PAST the note's right edge — carrying the
          cursive out onto the cork. At 560px it was 37px. That is Ian's "curvy
          off of the note". min-width:0 lets the box shrink to the note;
          overflow-wrap breaks the one word that still will not fit. BOTH are
          required — either alone still spills.

       2. `padding-right: 30px` cleared the absolutely-positioned ✕ so a reach
          for the end of the title did not hit delete. But it charged that 30px
          to EVERY line, on a note that can be 176px wide. The float below
          reserves the notch on the FIRST line only — where the ✕ actually is —
          and hands the full width back to every line after it. */
    .ic-title { margin: 0; font-family: "Caveat", cursive; font-size: 1.5rem; font-weight: 700;
      line-height: 1.14; flex: 1; min-width: 0; padding-right: 2px;
      overflow-wrap: break-word; hyphens: auto; }
    /* 22px = what the ✕ actually costs. .ic-del is 20px wide at right:6, and its
       ::before pads the strike zone by 8 more, so it reaches 34px in from the
       card edge — 19px past the title's own right edge. 22 clears that with a
       little air. The first pass used 28 and it cost the long word its last
       letter: "Foundermaxin / g" missed fitting by ~1px. */
    .ic-title::before { content: ""; float: right; width: 22px; height: 1.1em; }

    /* A 24px cursive on a 176px note is not a title, it is a wall. The card is
       the container so the type answers the NOTE's width, not the viewport's —
       a 2-column phone board and a 3-column desktop board can hand the same
       card the same width and get the same type. */
    @container (max-width: 208px) {
      .ic-title { font-size: 1.2rem; }
      .ic-title::before { width: 20px; }
      .ic-summary { font-size: 0.82rem; }
      .ic-notes li { font-size: 0.79rem; }
    }
    .ic-summary { margin: 0; font-size: 0.86rem; line-height: 1.4; }
    .ic-notes { margin: 2px 0 0; padding-left: 16px; display: flex; flex-direction: column; gap: 2px; }
    .ic-notes li { font-size: 0.83rem; line-height: 1.35; opacity: 0.92; }
    .ic-context { margin: 3px 0 0; font-size: 0.74rem; font-style: italic; opacity: 0.72; }
    /* keep every note sticky-note sized; long bodies clamp + fade until expanded */
    .ic-content { position: relative; max-height: 148px; overflow: hidden; }
    .idea-card.expanded .ic-content { max-height: none; }
    .idea-card.clamped:not(.expanded) .ic-content {
      -webkit-mask-image: linear-gradient(180deg, #000 66%, transparent);
      mask-image: linear-gradient(180deg, #000 66%, transparent);
    }
    .ic-expand { display: none; align-self: flex-start; margin-top: 6px; padding: 2px 0; cursor: pointer;
      font: inherit; font-size: 0.74rem; background: transparent; border: none; color: inherit; opacity: 0.72; text-decoration: underline; }
    .ic-expand:hover { opacity: 1; }
    .idea-card.clamped .ic-expand { display: inline-block; }
    /* Mora's verdict = a paper clipping stapled under the note */
    .ic-verdict { position: relative; margin: 12px -4px 0; padding: 9px 24px 8px 11px; border-radius: 1px;
      background: #f6f1e4; color: #40372a; box-shadow: 0 3px 7px rgba(0,0,0,0.22); transform: rotate(0.8deg);
      font-size: 0.82rem; line-height: 1.4; white-space: pre-wrap; transition: opacity 0.45s ease; }
    .ic-verdict::before { content: ""; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
      width: 20px; height: 7px; border: 2px solid #8b8b90; border-bottom: none; border-radius: 2px 2px 0 0; }
    .ic-verdict.typing { font-style: italic; opacity: 0.7; }
    .ic-verdict.fading { opacity: 0; }
    .ic-verdict-close { position: absolute; top: 3px; right: 4px; border: none; background: transparent; cursor: pointer;
      color: rgba(0,0,0,0.4); font-size: 0.8rem; line-height: 1; padding: 2px 4px; border-radius: 5px; }
    .ic-verdict-close:hover { background: rgba(0,0,0,0.12); color: rgba(0,0,0,0.72); }

    /* delete — subtle ✕ tucked in the top-right corner */
    .ic-del { position: absolute; top: 4px; right: 6px; width: 20px; height: 20px; border: none; background: transparent;
      color: rgba(0,0,0,0.32); font-size: 0.95rem; line-height: 1; cursor: pointer; border-radius: 50%; padding: 0; z-index: 4; }
    .ic-del:hover { color: rgba(0,0,0,0.7); background: rgba(0,0,0,0.09); }
    /* modest pad only — a full 44px halo here would reach further across the
       title than the ✕ already does, which is the mis-tap we're fixing */
    .ic-del::before { content: ""; position: absolute; inset: -8px; }

    .ic-actions { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; margin-top: 7px; }
    .ic-btn { position: relative; font: inherit; font-size: 0.74rem; padding: 4px 9px; border-radius: 7px; cursor: pointer;
      background: rgba(0,0,0,0.07); color: rgba(0,0,0,0.72); border: 1px solid rgba(0,0,0,0.15); }
    /* the action row is 23–29px tall on a phone. Pad VERTICALLY only: a
       horizontal pad would let neighbouring chips steal each other's taps. */
    .ic-btn::after { content: ""; position: absolute; inset: -7px 0; }
    .ic-btn:hover { background: rgba(0,0,0,0.13); }
    .ic-btn.task.done { background: rgba(20,120,60,0.20); border-color: rgba(20,120,60,0.55); color: #11532e; }
    .ic-btn.exec { background: rgba(255,138,61,0.22); border-color: rgba(255,138,61,0.55); color: #7a3410; font-weight: 600; }
    .ic-btn.exec:hover { background: rgba(255,138,61,0.34); }
    .ic-source { position: absolute; bottom: 6px; right: 18px; font-size: 0.72rem; opacity: 0.5; }

    /* the satisfying "tack it on the board" entrance */
    @keyframes noteStick {
      0%   { opacity: 0; transform: rotate(var(--tilt,-1deg)) translateY(-28px) scale(1.06); box-shadow: 0 26px 40px rgba(0,0,0,0.42); }
      55%  { opacity: 1; transform: rotate(var(--tilt,-1deg)) translateY(0) scale(0.99); }
      72%  { transform: rotate(var(--tilt,-1deg)) translateY(-4px) scale(1); }
      100% { transform: rotate(var(--tilt,-1deg)) translateY(0) scale(1); }
    }
    @keyframes pinDrop {
      0%   { transform: translateX(-50%) translateY(-24px) scale(1.5); opacity: 0; }
      55%  { transform: translateX(-50%) translateY(0) scale(1); opacity: 1; }
      70%  { transform: translateX(-50%) translateY(-2px) scale(1.1); }
      100% { transform: translateX(-50%) translateY(0) scale(1); }
    }
    .idea-card.sticking { animation: noteStick 0.62s cubic-bezier(0.2,0.7,0.3,1); animation-fill-mode: both; }
    .idea-card.sticking .ic-pin { animation: pinDrop 0.62s cubic-bezier(0.2,0.7,0.3,1); animation-delay: inherit; animation-fill-mode: both; }

    /* crumple-to-delete: scrunch to a paper ball, drop off the board */
    @keyframes crumpleBall {
      0%   { transform: rotate(var(--tilt,-1deg)) scale(1,1); border-radius: 3px; }
      16%  { transform: rotate(5deg) skewX(7deg) scale(0.84,0.72); }
      32%  { transform: rotate(-11deg) skewX(-9deg) scale(0.6,0.64); }
      48%  { transform: rotate(14deg) skewX(5deg) scale(0.36,0.4); border-radius: 34%; }
      60%  { transform: rotate(-4deg) scale(0.26,0.28); border-radius: 50%; }
      100% { transform: translateY(420px) rotate(220deg) scale(0.24,0.24); border-radius: 50%; opacity: 0.55; }
    }
    .idea-card.crumpling { animation: crumpleBall 0.8s cubic-bezier(0.45,0,0.6,1) forwards; pointer-events: none; z-index: 6; }
    .idea-card.crumpling > * { opacity: 0; transition: opacity 0.2s ease; }

    @media (prefers-reduced-motion: reduce) { .idea-card.sticking, .idea-card.sticking .ic-pin, .idea-card.crumpling { animation: none; } }

    /* ---------- screenshot review modal ---------- */
    .shot-modal { position: fixed; inset: 0; z-index: 150; /* over the shell's bottom bar (100), with the other sheets */ display: flex; align-items: center; justify-content: center;
      background: rgba(8,10,14,0.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); padding: 18px; }
    .shot-card { width: 100%; max-width: 540px; max-height: 86vh; overflow-y: auto; padding: 18px; }
    .shot-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
    .shot-sub { margin: 0 0 14px; font-size: 0.85rem; }
    .shot-item { display: flex; gap: 10px; padding: 11px 0; border-top: 1px solid var(--line); }
    .shot-keep { flex: none; padding-top: 3px; }
    .shot-keep input { width: 18px; height: 18px; accent-color: var(--orange); }
    .shot-fields { flex: 1; display: flex; flex-direction: column; gap: 6px; }
    .shot-title { font: inherit; font-weight: 600; width: 100%; padding: 8px 10px; border-radius: 9px;
      background: var(--surf-card); color: var(--ink); border: 1px solid var(--line); }
    .shot-notes { font: inherit; width: 100%; min-height: 60px; resize: vertical; padding: 8px 10px; border-radius: 9px;
      background: var(--surf-card); color: var(--ink); border: 1px solid var(--line); font-size: 0.88rem; }
    .shot-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
    .shot-spinner { width: 36px; height: 36px; margin: 2px auto 0; border-radius: 50%;
      border: 3px solid rgba(255,255,255,0.18); border-top-color: var(--orange); animation: shotspin 0.8s linear infinite; }
    @keyframes shotspin { to { transform: rotate(360deg); } }

    /* ---------- Mora Studio (right panel) ---------- */
    .panel { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
    .panel textarea { font: inherit; width: 100%; min-height: 84px; resize: vertical; border-radius: 12px; padding: 11px 13px;
      background: var(--surf-card); color: var(--ink); border: 1px solid var(--line); }
    .panel .row { display: flex; gap: 8px; }
    .studio-tabs { display: flex; gap: 6px; }
    .stab { flex: 1; font: inherit; font-size: 0.82rem; padding: 7px 8px; border-radius: 9px; cursor: pointer;
      background: var(--surf-card); color: var(--ink-soft); border: 1px solid var(--line); }
    .stab.active { background: var(--orange); color: #fff; border-color: transparent; }
    .tab-pane { display: flex; flex-direction: column; gap: 10px; }
    .tab-pane.hidden { display: none; }
    .spin-card { padding: 11px 13px; margin-bottom: 8px; border-left: 3px solid var(--orange); border-radius: 12px;
      background: var(--surf-card); border: 1px solid var(--line); border-left: 3px solid var(--orange); }
    .spin-card h4 { margin: 0 0 4px; font-size: 0.92rem; }
    .spin-card p { margin: 0 0 9px; font-size: 0.86rem; line-height: 1.4; color: var(--ink-soft); }
    .spin-card .drop { font-size: 0.78rem; padding: 4px 11px; }
    #ideas-out .drop-all { width: 100%; margin: 2px 0 4px; font-size: 0.82rem; }
    .mora-chat-log { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; padding-right: 2px; }
    .mc { padding: 8px 11px; border-radius: 12px; font-size: 0.9rem; line-height: 1.42; white-space: pre-wrap; max-width: 92%; }
    .mc.ian { align-self: flex-end; background: var(--orange); color: #fff; border-bottom-right-radius: 4px; }
    .mc.mora { align-self: flex-start; background: var(--surf-card); color: var(--ink); border-left: 3px solid var(--orange); border-bottom-left-radius: 4px; }
    .mc.typing { color: var(--ink-soft); font-style: italic; }
    .chat-input { min-height: 0 !important; height: 44px !important; flex: 1; }
    .mc-row { display: flex; gap: 7px; align-items: flex-start; max-width: 94%; align-self: flex-start; }
    .mc-row .mc { max-width: 100%; }
    .mc-avatar { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--orange); color: #fff;
      font-size: 0.72rem; font-weight: 700; line-height: 1; display: flex; align-items: center; justify-content: center; margin-top: 2px; }

    /* + the bottom inset, like .undo-toast and #org-toast already do — at a bare
       26px the whole pill rendered inside an iPhone's home-indicator strip */
    /* z-index 160: above the board's own sheets (.shot-modal, 150), whose
       validation notices ("Give it a title or some notes.") show here. */
    #board-toast { position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(20px);
      background: rgba(20,24,30,0.92); color: #fff; padding: 10px 18px; border-radius: var(--r-pill); font-size: 0.85rem;
      opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 160; }
    #board-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
    /* optimistic first paint: if signed in last time, show the board shell now */
    html.was-signed-in #board-main.hidden { display: block !important; }
/* in-app layer: the layer bar replaces the page's own header row */
.board-layer .board-head { display: none; }
.board-layer .board-wrap { padding-top: 6px; }

/* ================================================================
   TOUCH FINISH — the last coarse-pointer gaps
   Two classes of defect the mobile suite (demo/stub/verify-mobile.mjs)
   still caught after the main touch pass:

   1. iOS FORCE-ZOOM. Safari zooms the whole page when a focused field's
      font-size is under 16px, and it does NOT zoom back out. The task
      edit fields were fixed; these three families were missed. Note
      .row-date-input is the INVISIBLE overlay that opens the native date
      picker on touch (see the @media (pointer: coarse) rule above) — it
      is never seen, but focusing it still zoomed the page, so tapping
      "Change date" on a phone left the app zoomed in.

   2. HIT AREA. Header chrome, the rail tabs, "Brief me" and the momentum
      quota never got strike-zone pads. As everywhere else in this file,
      the pad is an invisible pseudo-element: the PAINTED size is
      untouched, only the tappable box grows. Nothing here changes a
      single pixel of the design.
================================================================ */
@media (pointer: coarse) {
  /* --- 1. never let a focused field zoom the page --- */
  .row-date-input { font-size: 16px; }
  .reel-url, .shot-notes, .sound-select { font-size: 1rem; }

  /* --- 2. strike zones for the remaining chrome --- */
  #settings-btn, #signout-btn, .tab, .brief-me-btn, .mom-quota { position: relative; }

  /* 36x36 -> 46x46 */
  #settings-btn::after { content: ""; position: absolute; inset: -5px; }
  /* 75x36 -> 75x46 (already wide enough) */
  #signout-btn::after  { content: ""; position: absolute; inset: -5px 0; }

  /* Chips that sit in a TIGHT STACK or ROW can't use a pad: with only a few px
     of gap, neighbouring pads overlap and each one clips the next, so the real
     strike zone never grows (measured: an 8px pad on .area-opt bought 7px, not
     16). These get honest height instead. Touch-only — the mouse keeps the
     compact chips. */
  .area-opt, .area-filt, .vseg, .org-act, .head-act, .journal-drop,
  .task-tools .linkbtn, .tab {
    min-height: 44px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  .journal-drop { justify-content: flex-start; }
  /* Icon-only now, so it needs real width to stay a fair thumb target. */
  #pause-all { min-width: 44px; }
  /* The ⋯ gateway: a 36x15 glyph with a thin pad still scanned at 38px tall,
     and it can't grow downward without swallowing the tool row it opens — so
     give it real box size. The row is already taller than this, so nothing
     shifts. Same for the mark-done checkbox: widen its pad rather than the
     22x22 painted square Ian tuned. */
  .task-more { min-height: 44px; min-width: 44px; }
  /* The pad has to out-paint the NEXT row: sibling .task rows come later in
     DOM order, so their background was covering the lower half of the pad and
     the strike zone measured smaller with a BIGGER pad. z-index lifts it clear.
     Kept to 14px so it never reaches into the neighbouring row's own checkbox —
     completing the wrong task would be a worse bug than a small target. */
  .check { z-index: 1; }
  .check::before { inset: -14px; }

  /* .task-tools is where Edit / ✕ Delete / Change date live — the whole reason
     the ⋯ button exists. They were 30px tall behind a 4px gap, so Delete sat one
     slip away from Edit. */
  /* 41 tall -> 45; width already >= 93 */
  .tab::after          { content: ""; position: absolute; inset: -2px 0; }
  /* 110x34 -> 110x44 */
  .brief-me-btn::after { content: ""; position: absolute; inset: -5px 0; }
  /* 13x21 -> 45x45 */
  .mom-quota::after    { content: ""; position: absolute; inset: -12px -16px; }

  /* The two header chips have BOTH pseudo-elements spoken for (specular
     ::before, sheen ::after) — but the sheen is already switched off on
     phones a few hundred lines up (it billed ~56 style recalcs/second for
     a 36px decoration), so on touch we reuse that slot as the strike pad.
     Both chips also clip with overflow:hidden (so the sheen can't escape the
     glass) — which would clip the pad too, so release it here. Safe, because
     the rule below repaints that pseudo as nothing at all. */
  .board-chip, .ck-chip, .checklists-chip { position: relative; overflow: visible; }
  .board-chip::after, .ck-chip::after, .checklists-chip::after {
    content: ""; position: absolute; inset: -7px; z-index: 0;
    top: -7px; bottom: -7px; left: -7px; width: auto;
    background: none; animation: none; transform: none;
  }
  /* Why -7 and not -5: at -5 the pad is 46px, which clears 44 VERTICALLY but
     measured only 42 across — the outward hit-walk loses about a pixel at each
     edge, and horizontally the chip is boxed in by the header's 8px gaps so
     there is nothing to absorb it. -7 makes the pad 50px, which still stops 1px
     short of the neighbouring control on both sides (the gap is 8px), so it
     buys the margin without ever stealing a tap that belongs to Settings.
     Verified with demo/stub/verify-mobile.mjs at 320px — the narrowest case. */
}

/* --- cross-file finishers -------------------------------------------------
   .cast-act pads used to be injected as a runtime <style> from js/cast.js so
   the fix could ship with the behaviour it protects; this is their real home.
   "Make main" sits ~5px from "Edit" on a 27px row, and a mis-tap silently
   swaps the whole assistant persona, so the pads are deliberately biased.   */
@media (pointer: coarse) {
  .cast-act { position: relative; }
  .cast-act::after { content: ""; position: absolute; inset: -9px -2px; }

  /* The board pans horizontally and so does the phone's pane carousel. Without
     this the browser arbitrates and the same swipe drives both. */
  .board-stage { touch-action: pan-y; }

  /* Long-press on a control should act, not select text or pop iOS's callout /
     link-preview sheet (#board-link is a real <a href>, so it did). Message
     bubbles and task text stay selectable — copying what Limi said is useful. */
  button, .tab, [role="button"], .check, .area-dot, .goal-mark, .builder-door,
  .ck-item, .cks-row, .cks-tpl, .sheet-grip, .settings-head, .creator-head, .task-more, .cast-act {
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  }
}

/* ================================================================
   THE APP TOUR — the spotlight lap for a first open (js/tour.js)
   One shade element (.tour-spot) whose enormous box-shadow IS the
   dimmer; the element itself is the transparent "hole" that glides
   from target to target. Sits above every surface it points into:
   board layer (150), settings (200), creator (240), toast (260).
   ================================================================ */
.tour-overlay {
  position: fixed; inset: 0; z-index: 280;
  opacity: 0; transition: opacity 0.24s ease;
}
.tour-overlay.is-in { opacity: 1; }
.tour-overlay.hidden { display: none; }

.tour-spot {
  position: absolute;
  box-shadow: 0 0 0 200vmax rgba(6, 8, 14, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.22);
  pointer-events: none;
  transition: top 0.5s var(--e-out), left 0.5s var(--e-out),
              width 0.5s var(--e-out), height 0.5s var(--e-out),
              border-radius 0.5s var(--e-out);
}

.tour-card {
  position: absolute; width: min(360px, calc(100vw - 24px));
  padding: 18px 20px 16px; border-radius: var(--radius-s);
  transition: top 0.45s var(--e-out), left 0.45s var(--e-out), opacity 0.17s ease;
}
/* Step changes: the card fades out where it stands, swaps its words and JUMPS
   to the next anchor while invisible, then fades back in — it never flies
   across the screen and its text never changes while readable (js/tour.js). */
.tour-card.leaving { opacity: 0; pointer-events: none; }
.tour-card.centered {
  top: 50% !important; left: 50% !important;
  transform: translate(-50%, -50%);
}
.tour-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.tour-count { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); }
.tour-skip {
  border: 0; background: none; cursor: pointer; padding: 4px 6px;
  font: inherit; font-size: 0.8rem; color: var(--ink-soft);
}
.tour-skip:hover { color: var(--ink); }
.tour-title { margin: 0 0 6px; font-size: 1.06rem; font-weight: 700; color: var(--ink); }
.tour-text { margin: 0 0 14px; font-size: 0.88rem; line-height: 1.55; color: var(--ink-soft); }
.tour-acts { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tour-acts .btn { padding: 7px 16px; font-size: 0.85rem; }
.tour-dots { display: flex; gap: 5px; }
.tour-dot { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); transition: background 0.2s ease, transform 0.2s ease; }
.tour-dot.on { background: var(--orange); transform: scale(1.35); }
[data-theme="light"] .tour-dot { background: rgba(20, 30, 50, 0.22); }
[data-theme="light"] .tour-dot.on { background: var(--orange); }

/* phone: the card is a sheet pinned to one edge — predictable, thumb-reachable,
   and (with .at-top, set by js/tour.js) it moves out of the way instead of
   sitting on top of the thing the spotlight is pointing at. */
@media (max-width: 600px) {
  .tour-card {
    top: auto !important; left: 12px !important; right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: auto;
    transition: opacity 0.17s ease; /* it hops edge-to-edge while invisible — never glide */
  }
  /* .centered's own `top/left: 50% !important` outranks the two rules above on
     specificity, and `right: 12px` still applied — so the welcome and wrap-up
     cards rendered as a 183px-wide, 410px-tall column jammed against the right
     edge. Restate the sheet geometry here, where it wins. */
  .tour-card.centered {
    transform: none;
    top: auto !important; left: 12px !important;
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .tour-card.at-top,
  .tour-card.centered.at-top {
    bottom: auto;
    top: max(12px, env(safe-area-inset-top)) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tour-overlay, .tour-spot, .tour-card, .tour-dot { transition: none; }
}

/* THE CLEAN ROOM — while the tour runs (html.tour-clean, set by js/tour.js),
   the app presents as a brand-new EMPTY install: no personal chat history,
   tasks, ideas, counts, or account email on screen. The tour teaches on the
   same blank canvas every new user starts with — and a replay or an
   over-the-shoulder demo never exposes real data. CSS only, nothing mutates:
   snapshots keep updating the hidden nodes, and dropping the class restores
   the exact live state. */
.tour-clean #limi-feed > *,
.tour-clean #open-list > *,
.tour-clean #done-list > *,
.tour-clean #paused-list > *,
.tour-clean #storage-list > *,
.tour-clean #momentum-goal,
.tour-clean #momentum-routine,
.tour-clean #idea-loop,
.tour-clean #checklist-runs,
.tour-clean #checklist-chips,
.tour-clean #paused-section,
.tour-clean #storage-section,
.tour-clean #journal-review,
.tour-clean #user-email,
.tour-clean #ideas-grid > * { display: none !important; }
/* keep layout, hide the words: the last Limi line on the stage + live counts */
.tour-clean #limi-latest,
.tour-clean .section-title .count,
.tour-clean .bs-count { visibility: hidden; }
/* and show the empty-state lines a brand-new account would actually see */
.tour-clean #open-empty.hidden,
.tour-clean #done-empty.hidden,
.tour-clean #ideas-empty.hidden { display: block !important; }

/* ================================================================
   HELP & FEEDBACK (js/feedback.js) — the "Send to Ian" box in
   Settings, and Ian's owner-only inbox under it.
   ================================================================ */
#settings-help .fb-kinds { margin-top: 12px; }
.fb-text { width: 100%; margin-top: 10px; resize: vertical; min-height: 68px; }
.fb-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.fb-status { margin: 0; }
.fb-status.fb-error { color: var(--stern); }

.fb-inbox { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fb-item {
  padding: 10px 12px; border-radius: 12px;
  background: var(--glass-soft); border: 1px solid var(--glass-border);
}
.fb-item-head { display: flex; align-items: center; gap: 8px; }
.fb-tag {
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: var(--r-pill); color: #fff; background: rgba(255, 255, 255, 0.16);
}
.fb-tag-bug { background: rgba(255, 91, 91, 0.32); }
.fb-tag-idea { background: rgba(255, 138, 61, 0.32); }
.fb-meta { flex: 1; min-width: 0; font-size: 0.72rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-del {
  border: 0; background: none; cursor: pointer; padding: 2px 6px;
  font-size: 0.82rem; color: var(--ink-soft); border-radius: 6px;
}
.fb-del:hover { color: var(--stern); }
.fb-item-text { margin: 6px 0 0; font-size: 0.85rem; line-height: 1.5; color: var(--ink); white-space: pre-wrap; word-break: break-word; }

/* ================================================================
   SHARE THE APP — the QR someone scans to get set up.
   Settings holds a small card; tapping it opens the full-screen
   version (z-index 300: above settings(200), creator(240), tour(280))
   so a code on a phone screen can be scanned from across a table.
   The QR itself is always dark-on-white regardless of theme —
   inverted codes fail on a lot of camera apps.
   ================================================================ */
.share-row { display: flex; gap: 14px; align-items: flex-start; }
.share-qr-mini {
  flex: none; cursor: pointer; padding: 8px; border-radius: 14px;
  background: #fff; border: 1px solid var(--line-strong);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: transform var(--m-fast) var(--e-out), box-shadow var(--m-base) var(--e-out);
}
.share-qr-mini:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(0,0,0,0.34); }
.share-qr-mini:active { transform: scale(0.97); }
.share-qr-slot { display: block; width: 104px; height: 104px; }
.share-qr-slot svg { display: block; width: 100%; height: 100%; }
.share-qr-hint { font-size: 0.62rem; font-weight: 600; color: #6b7280; letter-spacing: 0.01em; }

.share-acts { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.share-url {
  margin: 0; font-size: 0.8rem; color: var(--ink-soft);
  word-break: break-all; line-height: 1.4;
}
.share-acts .btn { font-size: 0.82rem; padding: 7px 13px; text-decoration: none; }

/* --- full-screen scan card --- */
.share-big {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center; padding: 22px;
  background: rgba(6,8,12,0.86);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; transition: opacity var(--m-base) var(--e-out);
}
.share-big.is-in { opacity: 1; }
.share-big.hidden { display: none; }
.share-big-card {
  width: 100%; max-width: 340px; text-align: center;
  padding: 22px 22px 18px; border-radius: 26px;
  background: linear-gradient(160deg, #fdfdfe, #eef1f6);
  box-shadow: 0 28px 70px rgba(0,0,0,0.5);
  transform: translateY(10px) scale(0.97);
  transition: transform var(--m-slow) var(--e-spring);
}
.share-big.is-in .share-big-card { transform: none; }
.share-big-title { margin: 0; font-size: 1.15rem; font-weight: 700; color: #1a1d24; letter-spacing: -0.3px; }
.share-big-sub { margin: 2px 0 14px; font-size: 0.86rem; font-weight: 600; color: #ff7a2f; }
.share-big-qr { width: 100%; max-width: 250px; margin: 0 auto; }
.share-big-qr svg { display: block; width: 100%; height: auto; }
.share-big-url { margin: 12px 0 0; font-size: 0.84rem; font-weight: 600; color: #3d444d; word-break: break-all; }
.share-big-note { margin: 5px 0 14px; font-size: 0.76rem; color: #6b7280; line-height: 1.45; }
.share-big-done { width: 100%; justify-content: center; }

@media (prefers-reduced-motion: reduce) {
  .share-big, .share-big-card, .share-qr-mini { transition: none; }
}
@media (max-width: 600px) {
  .share-row { flex-direction: column; align-items: center; text-align: center; }
  .share-acts { align-items: center; }
  .share-url { text-align: center; }
}

/* ---------------------------------------------------------------
   THE FIRST-RUN NUDGES ASK (js/nudge-ask.js)
   The card that earns the Apple permission prompt. Transition-based
   (.is-in) rather than keyframed, like .share-big: it is built and
   thrown away per showing, so there is no stale animation state to
   reset, and it stays out of the four shared bottom-sheet selector
   lists that a new sheet class otherwise has to join in lockstep.
   z-index 230 slots into the documented ladder between the checklist
   sheets (220/222) and the creator sheet (240): if the first-run
   creator is somehow still up it wins, which is the right way round.
   In practice the card only ever opens on an empty stage anyway. See
   BUSY_SELECTORS in the module.
   --------------------------------------------------------------- */
.nudge-ask {
  position: fixed; inset: 0; z-index: 230;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10,12,16,0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity var(--m-base) var(--e-out);
}
.nudge-ask.is-in { opacity: 1; }
.nudge-ask.hidden { display: none; }

.nudge-ask-card {
  width: 100%; max-width: 400px;
  padding: 22px 22px 18px;
  border-radius: 20px;
  text-align: center;
  /* same guard every other card in the app carries: a landscape phone, or a
     big accessibility text size, must scroll the card rather than push its
     buttons off the screen */
  max-height: 86dvh;
  overflow-y: auto;
  transform: translateY(12px) scale(0.975);
  transition: transform var(--m-slow) var(--e-spring);
}
.nudge-ask.is-in .nudge-ask-card { transform: none; }

/* the bell, sat in its own warm glass disc so the card leads with the
   same mark the Nudges toggle uses */
.nudge-ask-bell {
  width: 54px; height: 54px; margin: 2px auto 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,138,61,0.22), rgba(255,138,61,0.08));
  border: 1px solid rgba(255,138,61,0.34);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}
.nudge-ask-bell [data-icon] { font-size: 1.05rem; }

.nudge-ask-title {
  margin: 0 0 8px; font-size: 1.15rem; font-weight: 700;
  letter-spacing: -0.3px; color: var(--ink); line-height: 1.25;
}
.nudge-ask-body {
  margin: 0 0 10px; font-size: 0.88rem; line-height: 1.5; color: var(--ink-soft);
}
.nudge-ask-note {
  margin: 0 0 16px; font-size: 0.78rem; line-height: 1.45;
  color: var(--ink-soft); opacity: 0.78; min-height: 2.3em;
}
.nudge-ask-acts { display: flex; align-items: center; justify-content: center; gap: 10px; }
/* min-height: with only padding and line-height these measured 36 and 38px on a
   phone once the shell's system font replaced Outfit. 44px is the touch floor. */
.nudge-ask-acts .btn { font-size: 0.85rem; min-height: 44px; }
.nudge-ask-acts .btn:disabled { opacity: 0.55; pointer-events: none; }
/* the card takes focus itself (see openCard) so a reader announces the dialog;
   it must not paint a ring around the whole sheet for that */
.nudge-ask-card:focus { outline: none; }
.nudge-ask-card:focus-visible { outline: none; }
.nudge-ask-yes { flex: 1; justify-content: center; }

/* Day theme: the dark-surface rgbas above go invisible on a light card. */
[data-theme="light"] .nudge-ask { background: rgba(40,55,90,0.32); }
[data-theme="light"] .nudge-ask-bell {
  background: linear-gradient(135deg, rgba(255,122,47,0.18), rgba(255,122,47,0.06));
  border-color: rgba(255,122,47,0.30);
}

@media (prefers-reduced-motion: reduce) {
  .nudge-ask, .nudge-ask-card { transition: none; }
}

/* Phone: the house shape is a bottom sheet. Done with the same transform
   transition rather than the sheetUp/sheetDown keyframes, so it needs no
   entry in the .closing / reduced-motion / .drag-dismissed lists. */
@media (max-width: 600px) {
  .nudge-ask { align-items: flex-end; padding: 0; }
  .nudge-ask-card {
    max-width: 100%;
    border-radius: 22px 22px 0 0;
    padding: 24px 20px max(20px, env(safe-area-inset-bottom));
    max-height: 92dvh;
    transform: translateY(100%);
  }
  .nudge-ask-acts { flex-direction: column-reverse; }
  .nudge-ask-acts .btn { width: 100%; justify-content: center; }
}

/* the install card's numbered steps. A genuine sequence (Share, then Add to
   Home Screen, then open it), so it is an <ol> and the markers are the accent.
   Left-aligned inside an otherwise centred card: instructions you follow are
   read line by line, not admired. */
.nudge-ask-steps {
  margin: 4px 0 14px; padding: 0 0 0 1.35em;
  display: flex; flex-direction: column; gap: 9px;
  text-align: left;
  font-size: 0.86rem; line-height: 1.45; color: var(--ink-soft);
}
.nudge-ask-steps li { padding-left: 2px; }
.nudge-ask-steps li::marker { color: var(--accent); font-weight: var(--w-semi); }


/* ================================================================
   FIRST RUN + THE DAY-THREE OFFER  (js/firstrun.js)
   The one question a new account is asked, and the card that offers
   the character creator three days later. Same shape as .nudge-ask
   above, which is their sibling: centred card on desktop, bottom
   sheet on phone.
================================================================ */
.fr-overlay {
  position: fixed; inset: 0; z-index: 235;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10,12,16,0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity var(--m-base) var(--e-out);
}
.fr-overlay.is-in { opacity: 1; }
.fr-overlay.hidden { display: none; }

.fr-card {
  width: 100%; max-width: 440px;
  padding: 24px 24px 20px;
  border-radius: 20px;
  /* same guard every other card carries: a landscape phone, or a big
     accessibility text size, scrolls the card rather than pushing its
     buttons off the screen */
  max-height: 86dvh;
  overflow-y: auto;
  background: var(--surf-float);
  border: 1px solid var(--line);
  box-shadow: var(--e3);
  transform: translateY(12px) scale(0.975);
  transition: transform var(--m-slow) var(--e-spring);
}
.fr-overlay.is-in .fr-card { transform: none; }

.fr-eyebrow {
  margin: 0 0 8px; font-size: var(--t-xs); font-weight: var(--w-semi);
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft);
  opacity: 0.85;
}
.fr-card h2 {
  margin: 0 0 10px; font-size: 1.3rem; font-weight: var(--w-bold);
  letter-spacing: -0.4px; line-height: 1.22; color: var(--ink);
  text-wrap: balance;
}
.fr-sub {
  margin: 0 0 18px; font-size: 0.88rem; line-height: 1.5; color: var(--ink-soft);
}
.fr-form { display: flex; flex-direction: column; gap: 10px; }
.fr-input {
  width: 100%; font: inherit; font-size: var(--t-field);
  color: var(--ink);
  background: var(--surf-sunk);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 15px;
}
.fr-input::placeholder { color: var(--ink-soft); opacity: 0.7; }
.fr-input:focus-visible { outline: 2px solid var(--accent, var(--orange)); outline-offset: 1px; } /* --accent is never defined: without the fallback there was no ring */
.fr-err {
  margin: 0; min-height: 1.2em;
  font-size: 0.8rem; line-height: 1.35; color: var(--stern-ink);
}
.fr-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.fr-go { flex: 1 1 auto; justify-content: center; }
.fr-skip {
  background: none; border: 0; padding: 8px 4px; font: inherit;
  font-size: 0.82rem; color: var(--ink-soft); opacity: 0.8;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.fr-skip:hover { opacity: 1; }
.fr-skip:focus-visible { outline: 2px solid var(--accent, var(--orange)); outline-offset: 2px; border-radius: var(--r-xs); }

/* Day theme: the dark-surface rgba backdrop above goes invisible on a light
   ground, exactly as it does for .nudge-ask. */
[data-theme="light"] .fr-overlay { background: rgba(40,55,90,0.32); }

@media (prefers-reduced-motion: reduce) {
  .fr-overlay, .fr-card { transition: none; }
}

/* Phone: the house shape is a bottom sheet, same as .nudge-ask. */
@media (max-width: 600px) {
  .fr-overlay { align-items: flex-end; padding: 0; }
  .fr-card {
    max-width: 100%;
    border-radius: 22px 22px 0 0;
    padding: 24px 20px max(20px, env(safe-area-inset-bottom));
    max-height: 92dvh;
    transform: translateY(100%);
  }
  .fr-row { flex-direction: row-reverse; }
  .fr-go { width: auto; }
}


/* ================================================================
   WHAT'S NEW  (js/whatsnew.js)
   The user-facing changelog, and the only "unread" marker in the app.
   Third sibling of .nudge-ask and .fr-card, and deliberately the same
   shape: centred card on desktop, bottom sheet on phone. It is taller
   than either, because it is a list you scroll rather than a question
   you answer.
================================================================ */
.wn-overlay {
  position: fixed; inset: 0; z-index: 235;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(10,12,16,0.55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity var(--m-base) var(--e-out);
}
.wn-overlay.is-in { opacity: 1; }

.wn-card {
  width: 100%; max-width: 460px;
  /* the CARD is the flex column and the LIST inside it scrolls, so the
     header and the replay button stay put while the history moves. The
     other two sheets scroll as a whole because they are short enough to. */
  display: flex; flex-direction: column;
  max-height: 84dvh;
  border-radius: 20px;
  background: var(--surf-float);
  border: 1px solid var(--line);
  box-shadow: var(--e3);
  transform: translateY(12px) scale(0.975);
  transition: transform var(--m-slow) var(--e-spring);
  overflow: hidden; /* so the rounded corners clip the scroller */
}
.wn-overlay.is-in .wn-card { transform: none; }

.wn-head {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 20px 12px;
  flex: 0 0 auto;
}
.wn-head h2 {
  margin: 0; flex: 1 1 auto; min-width: 0;
  font-size: 1.22rem; font-weight: var(--w-bold);
  letter-spacing: -0.4px; color: var(--ink);
}
.wn-close {
  flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: var(--r-sm);
  display: grid; place-items: center;
  background: var(--surf-sunk); border: 1px solid var(--line);
  color: var(--ink-soft); font-size: 0.9rem; cursor: pointer;
}
.wn-close:hover { color: var(--ink); }
.wn-close:focus-visible { outline: 2px solid var(--accent, var(--orange)); outline-offset: 2px; }

.wn-scroll {
  flex: 1 1 auto;
  min-height: 0;               /* flex children default to min-height:auto and
                                  refuse to shrink — the documented crush trap */
  overflow-y: auto;
  padding: 0 20px 4px;
  display: flex; flex-direction: column; gap: 18px;
}

.wn-item { display: flex; flex-direction: column; gap: 7px; }
.wn-item + .wn-item { border-top: 1px solid var(--line); padding-top: 16px; }

.wn-item-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.wn-item-head h3 {
  margin: 0; font-size: 0.97rem; font-weight: var(--w-bold);
  letter-spacing: -0.2px; color: var(--ink); text-wrap: balance;
}
.wn-when {
  margin-left: auto; flex: 0 0 auto;
  font-size: var(--t-xs); color: var(--ink-soft); opacity: 0.75;
  font-variant-numeric: tabular-nums;
}
/* "New" is the ONE badge in this app, and it marks a release the person
   has not opened yet. It is never a count and never red: the tone
   contract reserves stern for something the user actually owes. */
.wn-tag {
  flex: 0 0 auto;
  font-size: 0.62rem; font-weight: var(--w-semi);
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 6px; border-radius: var(--r-xs);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
}

.wn-lines { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.wn-lines li { font-size: 0.86rem; line-height: 1.5; color: var(--ink-soft); }
.wn-lines li::marker { color: var(--ink-faint); }

.wn-foot {
  flex: 0 0 auto;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
}
.wn-tour { width: 100%; justify-content: center; }

/* ---- the unread dot -------------------------------------------------
   An ::after on a button that ALREADY exists, never a new element in the
   header row. Measured by the UI session: phone header slack is a constant
   34px and .brand (flex: 1 1 auto) absorbs it, so a new 36px sibling plus
   its gap comes straight out of the brand block, and the first casualty is
   the "with Limi" subtitle. This costs zero layout. */
.has-new { position: relative; }
.has-new::after {
  content: "";
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent, var(--orange)); /* --accent is never defined: the dot used to paint nothing */
  box-shadow: 0 0 0 2px var(--surf-float);
  pointer-events: none;
}
/* In the Settings list the button is full-width with text, so the dot rides
   beside the label instead of the corner. */
#whatsnew-open.has-new::after { top: 50%; right: 14px; transform: translateY(-50%); }
/* On a touch screen the Settings button's ::after is its tap pad (inset -5px),
   which pulled the dot off to the top-left and shrank the pad to 7px. There the
   dot rides on ::before and ::after goes back to being only the pad. */
#settings-btn.has-new::before {
  content: ""; position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent, var(--orange));
  box-shadow: 0 0 0 2px var(--surf-float);
  pointer-events: none;
}
#settings-btn.has-new::after { content: none; }
@media (pointer: coarse) {
  #settings-btn.has-new::after { content: ""; width: auto; height: auto; border-radius: 0; background: none; box-shadow: none; pointer-events: auto; }
}

@media (max-width: 600px) {
  .wn-overlay { align-items: flex-end; padding: 0; }
  .wn-card {
    max-width: 100%;
    border-radius: 22px 22px 0 0;
    max-height: 88dvh;
    transform: translateY(100%);
  }
  /* the home indicator: the foot is the last thing above it, so the padding
     goes there rather than on the card (which clips its scroller) */
  .wn-foot { padding-bottom: max(18px, env(safe-area-inset-bottom)); }
}


/* ================================================================
   PHONE NATIVE SHELL — bottom tab bar, compact header, compose sheet.
   Appended after the older ≤600px block on purpose: same specificity,
   later in the file, so these win without an !important anywhere.
================================================================ */

/* the bar is phone-only; desktop and phone-landscape keep the rail tabs */
.tabbar { display: none; }
.compose-scrim { display: none; }

@media (max-width: 600px) {
  /* ---------- compact header: 52px, no truncation, nothing wrapping ------- */
  .app-header {
    height: calc(var(--hdr-h) + env(safe-area-inset-top));
    /* longhand, deliberately: the old shorthand put inset-right in the 4th slot
       AND then set padding-left from inset-left, transposing the two. */
    padding-top: env(safe-area-inset-top);
    padding-bottom: 0;
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    gap: 10px;
    background: var(--surf-bar);
    -webkit-backdrop-filter: var(--blur-m);
    backdrop-filter: var(--blur-m);
    border-bottom: 1px solid var(--line);
  }
  .brand .emblem { width: 26px; height: 26px; border-radius: var(--r-xs); }
  .brand-text strong {
    font-size: var(--t-md);
    font-weight: var(--w-bold);
    letter-spacing: -0.3px;
    line-height: 1;
  }
  /* the name now FITS at every supported width (measured ~118px inside 390 and
     inside 320), so the old 92px clamp that produced "Chase Limi…" is gone */
  .brand-text { max-width: none; }

  /* Small phones (SE, mini, 320px): step the pill and the compose cell down
     together so four pills + the + still fit without the bar overflowing.
     Both come off the same tokens the lamp reads, so nothing drifts. */
  @media (max-width: 360px) {
    .tabbar { --tb-pill-w: 52px; grid-template-columns: repeat(4, 1fr) 70px; }
    .tbtn-compose { width: 52px; height: 52px; border-radius: 17px; }
  }

  /* ---------- the bottom bar ---------- */
  .tabbar {
    position: relative;          /* offsetParent for the lamp */
    z-index: 20;                 /* over content, under the board layer (150) */
    display: grid;
    grid-template-columns: repeat(4, 1fr) 78px;
    /* stretch, not center: .tbtn used to re-declare `height: var(--bar-h)`,
       but box-sizing is border-box and this bar has a 1px border-top — so the
       content box is --bar-h MINUS 1 and every tab button overhung it by 1px.
       That made the document 1px taller than the viewport (measured 853 vs
       852), which is all iOS needs to treat the page as scrollable and let the
       browser chrome drag. Stretching to the row cannot overhang by
       construction, whatever the border or the safe area turn out to be. */
    align-items: stretch;
    height: calc(var(--bar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: max(2px, env(safe-area-inset-left));
    padding-right: max(11px, env(safe-area-inset-right));
    background: var(--surf-bar);
    -webkit-backdrop-filter: var(--blur-m);
    backdrop-filter: var(--blur-m);
    border-top: 1px solid var(--line);
    box-shadow: var(--e-bar), var(--rim);
  }
  /* the bar now owns the bottom safe area that #swipe-dots used to pay for */
  .swipe-dots { display: none; }
  .chat-form { padding-bottom: 10px; }

  /* MANDATORY, not cosmetic. .rail carries .glass, whose backdrop-filter makes
     it a containing block AND a stacking context for its descendants — so the
     compose sheet's `position: fixed; z-index: 220` was being trapped inside
     .rail and painted UNDER the scrim (measured: the sheet came out blurred).
     The rail is a full-bleed pane on phone, so it has nothing to frost anyway. */
  .rail { -webkit-backdrop-filter: none; backdrop-filter: none; }

  /* The rail's own tab row is the bar's job now. It stays in the DOM (hidden):
     js/tabbar.js clicks these buttons to drive showTab(), so every consumer of
     .tab — showTab, positionPill, tour.js's clickTab — keeps working. */
  .rail-tabs { display: none; }

  /* #add-form lives in the compose SHEET on phone, not inline in the pane. The
     point of the rebuild: opening Tasks shows the LIST, not a wall of inputs. */
  #add-form:not(.is-sheet) { display: none; }
  /* the drag grip only belongs to the sheet presentation */
  #add-form:not(.is-sheet) .sheet-grip { display: none; }
}

/* ---------- the bar's geometry, written once ----------
   The pill sits behind the ICON ONLY and the label lives below it, clear of
   the pill entirely. The old bar wrapped both in one 56x44 box, which meant the
   label's descenders hung 4px out of its bottom edge and the icon had 5px of
   headroom: the "super tight collar" Ian called out (2026-08-20). Every number
   below is derived from these four and nothing else, so the pill can never
   crop the glyph again:

     7px   pad     .tbtn padding-top
     40px  pill    .tbtn-ico box == .tbar-lamp box   (icon 26px, 7px all round)
     4px   gap
     12px  label
     13px  pad     what is left of --bar-h (76)
*/
.tbtn {
  position: relative;            /* paint above the lamp */
  display: flex; flex-direction: column; align-items: center;
  justify-content: flex-start;
  gap: var(--tb-gap);
  padding-top: var(--tb-pad);
  height: auto;                  /* the grid row sizes these — see .tabbar */
  min-width: 0;                  /* grid items floor at min-content otherwise */
  border: none; background: none; cursor: pointer;
  color: var(--ink-dim);
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}
/* the icon box IS the pill's footprint — the lamp is painted to match it */
.tbtn-ico {
  display: flex; align-items: center; justify-content: center;
  /* min(): a grid item's min-width is `auto`, so a hard 60px here made each of
     the four columns 60px wide at minimum — 4x60 + 78 + padding = 331px, and
     the whole bar overflowed a 320px phone, shoving the + against the edge.
     Measured before this line went in: 1px of clearance at 320. */
  width: min(var(--tb-pill-w), 100%); height: var(--tb-pill-h);
  line-height: 0;
  transition: transform var(--m-base) var(--e-spring);
}
.tbtn-ico .gicon { width: 26px; height: 26px; }
/* Inactive glyphs step back so the lit one carries the row. They are graphical
   objects, not text — the label underneath is what has to hold contrast. */
.tbtn-ico .gicon { opacity: 0.66; transition: opacity var(--m-base) var(--e-out); }
.tbtn.is-on .tbtn-ico .gicon { opacity: 1; }
.tbtn-lbl { font-size: var(--t-xs); font-weight: var(--w-med); line-height: 1; letter-spacing: 0.1px; }
.tbtn.is-on { color: var(--accent-ink); }
.tbtn.is-on .tbtn-lbl { font-weight: var(--w-semi); }
.tbtn:active .tbtn-ico { transform: var(--press); transition: transform var(--m-press) var(--e-out); }

/* the compose cell: a filled brand target, not another label */
.tbtn-compose {
  justify-self: end; align-self: center;
  width: 56px; height: 56px; border-radius: 18px;
  padding-top: 0;
  margin-bottom: 6px;            /* optically centred on the pill+label block */
  background: linear-gradient(135deg, #ffb25c, #ff7a3a 55%, #ff6a52);
  color: var(--on-accent);
  box-shadow: 0 10px 22px -8px rgba(255,122,47,0.75),
              inset 0 1px 0 rgba(255,255,255,0.45),
              inset 0 -1px 0 rgba(120,40,10,0.18);
}
.tbtn-compose .tbtn-ico { width: auto; height: auto; }
.tbtn-compose .gicon { width: 27px; height: 27px; opacity: 1; }
/* THE GLYPH TRAP: every icon in js/icons.js paints itself with its own
   warm->blue brand gradient (stroke="url(#gi-plus)"), so the button's `color`
   never reached it and the + came out lavender-blue on an orange button. A CSS
   `stroke` beats the SVG presentation attribute, which is the only way to
   recolour these without forking the icon set.
   --on-accent (not #fff): measured 6.9:1 on this gradient, where white is
   2.6:1 and fails even the 3:1 floor for a graphical object. */
.tbtn-compose .gicon g { stroke: var(--on-accent); }
.tbtn-compose:active { transform: var(--press); }

/* The lamp: the lit pill behind the active icon. Constant size, so only
   transform animates. First consumer of --e-inout, defined and unused until
   now. Its box is the same --tb-pill-* pair the icon box uses; js/tabbar.js
   centres it with LAMP_W, which must stay in step with --tb-pill-w. */
.tbar-lamp {
  position: absolute; top: var(--tb-pad); left: 0;
  width: var(--tb-pill-w); height: var(--tb-pill-h);
  border-radius: 15px;
  /* TWO layers, not one. A single orange wash at 30% over a desaturated dark
     bar composites to mud — it read as a brown smudge rather than a lit pill.
     The white lift underneath raises the surface first, so the warm layer on
     top reads as light ON glass instead of stain IN it. */
  background:
    linear-gradient(180deg, rgba(255,213,180,0.16), rgba(255,255,255,0.04)),
    linear-gradient(180deg, rgba(255,150,74,0.34), rgba(255,108,52,0.16));
  box-shadow: inset 0 0 0 1px rgba(255,180,128,0.28),
              inset 0 1px 0 rgba(255,231,208,0.38),
              0 6px 16px -8px rgba(255,122,47,0.85);
  pointer-events: none;
  transition: none;
}
[data-theme="light"] .tbar-lamp {
  background: linear-gradient(180deg, rgba(255,138,61,0.26), rgba(255,122,47,0.14));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6),
              0 8px 18px -10px rgba(255,122,47,0.55);
}
.tbar-lamp.live { transition: transform var(--m-base) var(--e-inout); }
.tabbar.at-compose .tbar-lamp { opacity: 0; }

/* ---------- the compose sheet (phone) ----------
   #add-form is the app's real add-task form; on phone it lifts out of the
   tasks pane so the LIST is what you see when you open Tasks. */
@media (max-width: 600px) {
  .compose-scrim {
    display: block;
    position: fixed; inset: 0; z-index: 210;
    background: var(--scrim);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    animation: veilIn var(--m-base) var(--e-out);
  }
  .compose-scrim.hidden { display: none !important; }
  .compose-scrim.closing { animation: veilOut 180ms var(--e-out) both; }

  #add-form.is-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 220;
    max-height: calc(88dvh - var(--kb, 0px));
    overflow-y: auto;
    overscroll-behavior-y: contain;   /* y ONLY — x would break the carousel */
    margin: 0;
    padding: 14px max(14px, env(safe-area-inset-left))
             max(18px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-right));
    border-radius: var(--r-2xl) var(--r-2xl) 0 0;
    background: var(--surf-float);
    -webkit-backdrop-filter: var(--blur-l); backdrop-filter: var(--blur-l);
    box-shadow: var(--e3), var(--rim);
    animation: sheetUp var(--m-slow) var(--e-out);
  }
  .compose-scrim.closing ~ #add-form.is-sheet,
  #add-form.is-sheet.closing { animation: sheetDown 160ms var(--e-out) both; }
}

@media (prefers-reduced-motion: reduce) {
  .tbar-lamp.live { transition: none; }
  .tbtn-ico { transition: none; }
  .compose-scrim, .compose-scrim.closing,
  #add-form.is-sheet { animation: none !important; }
}


/* ================================================================
   DENSITY PASS — the single-card list, the compact row, the feed.
   Appended last so it wins on source order without !important.
================================================================ */

/* The list is ONE card with hairline-separated rows, not N floating glass
   cards each carrying a 44px shadow. Row: 10 + 20 + 3 + 16 + 10 = 58px. */
.task-list {
  margin: 0;
  gap: 0;
  background: var(--surf-card);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--e1), var(--edge);
}
/* NOT optional. .task-list now has overflow:hidden, which gives it min-height:0
   as a flex item, and a content-full #panel-tasks crushes it to a ~2px sliver —
   the same bug already documented for .idea-loop. The symptom (an invisible
   task list) reads as a Firestore failure, not a CSS one. */
.task-section { flex: none; }

.task {
  gap: 11px;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  padding: 10px 12px;
  transition: background var(--m-fast) var(--e-out);
}
.task + .task { border-top: 1px solid var(--line); }
.task:hover  { background: var(--surf-hover); transform: none; box-shadow: none; }
.task:active { background: var(--surf-hover); }
.task-title {
  font-size: var(--t-base);
  font-weight: var(--w-semi);
  line-height: var(--lh-tight);
  color: var(--ink);
  word-break: break-word;
}
.task-sub {
  font-size: var(--t-sm);
  font-weight: var(--w-med);
  color: var(--ink-soft);
  min-height: 16px;
  margin-top: 3px;
}
.task-strikes { font-size: var(--t-xs); margin-top: 4px; }

/* state is LIGHT across the row now, not a coloured left stripe.
   .in-progress MUST stay after .overdue — the documented cascade decision. */
.task.overdue     { background: var(--tint-stern); }
.task.in-progress { background: var(--tint-good); }

/* checkbox: the tick was white on the brand gradient at 2.72:1 */
.check {
  background: var(--surf-sunk);
  border: 2px solid var(--ink-faint-ctl);
  border-radius: var(--r-xs);
}
.check:checked { background: var(--brand-grad); border-color: transparent; }

/* ---------- the feed ---------- */
.limi-feed { gap: 6px; }
.limi-msg, .guest-msg, .user-msg {
  border: none;
  padding: 9px 13px;
  box-shadow: var(--e1);
}
.limi-msg, .guest-msg {
  background: var(--surf-card);
  border-radius: 18px 18px 18px 6px;
}
.user-msg { border-radius: 18px 18px 6px 18px; }
.limi-msg p, .guest-msg p, .user-msg p {
  font-size: var(--t-base);
  line-height: var(--lh-body);
}
/* escalation moves off border-left-color so the radius stays clean */
.limi-msg.tone-firm  { box-shadow: var(--e1), inset 2px 0 0 var(--firm); }
.limi-msg.tone-stern { box-shadow: var(--e1), inset 2px 0 0 var(--stern); }
/* consecutive turns from the same speaker drop the repeated mark (~26px each) */
.limi-msg + .limi-msg .limi-mark { visibility: hidden; }

/* ---------- the composer ---------- */
.chat-form {
  border-top: 1px solid var(--line);
  background: var(--surf-bar);
  -webkit-backdrop-filter: var(--blur-m);
  backdrop-filter: var(--blur-m);
}
#chat-input {
  font-size: var(--t-field);
  background: var(--surf-sunk);
  border-radius: var(--r-pill);
}
/* keeps the .chat-send class: js/voice.js inserts the mic BEFORE it, and a null
   there appends the mic after Send instead of throwing. */
.chat-send {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--orange);
  color: var(--on-accent);
  box-shadow: var(--e1);   /* the bloom is gone */
}
.chat-send:hover { box-shadow: var(--e2); }

/* ---------- the goal card: one line, not a 102px block ---------- */
.mom-bar { height: 6px; border-radius: var(--r-pill); }
.section-title {
  font-size: var(--t-2xs);
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

/* ---------- the SHOW filter: one scrollable row, not six wrapped pills ------
   #area-filter stays in the DOM and keeps its children: js/app.js iterates
   [...el.children] to read the active filter. */
@media (max-width: 600px) {
  #area-filter {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;   /* x only here — this is its own scroller */
    gap: 8px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  #area-filter::-webkit-scrollbar { display: none; }
  #area-filter .area-filt { flex: 0 0 auto; }
  .area-filter-field > label { font-size: var(--t-2xs); }
}


/* ---- getting to the first task row ----------------------------------------
   Measured on a 390x844 phone: the first task sat 423px below the top of the
   pane — momentum 101 + the filter field 67 + the Idea Loop 60, before a single
   task. These three reclaim ~150px of that. */
@media (max-width: 600px) {
  /* the goal card, on one line */
  .mom-card { padding: 9px 12px; margin: 4px 0 10px; border-radius: var(--r-md); }
  .mom-title { font-size: var(--t-2xs); }
  .mom-head { margin-bottom: 6px; }
  .mom-note { font-size: var(--t-xs); margin-top: 5px; }

  /* the filter row: label and pills share a line */
  .area-filter-field {
    display: flex; align-items: center; gap: 10px;
    margin: 0 0 10px;
  }
  .area-filter-field > label { flex: none; margin: 0; }
  .area-filter-field #area-filter { flex: 1; min-width: 0; }

  /* The Idea Loop is a "what else could I do" prompt, so it belongs AFTER the
     list of what you already said you'd do — not above it. #panel-tasks is a
     flex column, so order moves it without touching the markup or the JS.
     flex: none is the documented crush guard and MUST survive the move. */
  #idea-loop { order: 1; flex: none; margin-top: 12px; }
}


/* ---- the organize bar, on ONE line ----------------------------------------
   It was flex-wrap: wrap with a segment + three action pills, which stacked to
   three rows on a phone (~155px) and pushed the first task off the screen.
   It becomes one horizontally-scrollable row: the view segment stays put and
   the actions scroll to it. */
@media (max-width: 600px) {
  .task-organize {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;   /* x only: this is its own scroller */
    gap: 8px;
    margin: 2px 0 10px;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .task-organize::-webkit-scrollbar { display: none; }
  .task-organize > * { flex: 0 0 auto; }
  .view-seg { padding: 2px; }
  .view-seg .vseg { padding: 7px 12px; font-size: var(--t-sm); }
  .org-act { padding: 7px 12px; font-size: var(--t-sm); }
  .section-title { margin-bottom: 6px; }
}


/* ================================================================
   ON-DEVICE CORRECTIONS (Ian, real iPhone)
   Row rhythm, gutter alignment, breathing room, and a bar you can
   actually hit. Everything here is measured, not eyeballed.
================================================================ */

/* ---- 1. the task row's meta line -----------------------------------------
   .task-more carries min-height:44px under (pointer:coarse) and it lives
   INSIDE .task-sub, so it dictated a 44px meta row: the area/goal icons sat
   centred in it with ~14px of dead space above and below, which is what read
   as "skewed". The comment on that rule says "the row is already taller than
   this, so nothing shifts" — true when rows were ~115px, false now.
   Lift the button out of the flow instead: it keeps a full 44x44 strike zone,
   centred on the WHOLE row, and the meta line collapses to its real height. */
.task { position: relative; }
.task-body { padding-right: 46px; }
.task-more {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  margin: 0;
}
.task-sub { min-height: 18px; align-items: center; }

/* ---- 2. one gutter, one left edge ----------------------------------------
   Measured on a 393px phone: .task-list started at x=13, .section-title at 19,
   .task-organize at 13, the SHOW label somewhere else again. Four different
   left edges down one column is what makes a layout look unaligned. */
@media (max-width: 600px) {
  #panel-tasks, #panel-wins, #panel-goals {
    padding: 12px var(--sp-4) 4px;
  }
  #panel-tasks > *, #panel-wins > * { margin-left: 0; margin-right: 0; }
  .task-list { margin: 0; }
  .section-title { margin-left: 0; }
  .task-organize { margin-left: 0; }
  .mom-card { margin-left: 0; margin-right: 0; }
}


/* ---- 3. horizontal scrollers should LOOK scrollable ----------------------
   Both the filter row and the organize bar cut a pill mid-word at the right
   edge, which reads as a broken layout rather than as "there is more". A mask
   fades the last 22px so the cut is obviously a fade, not damage. */
@media (max-width: 600px) {
  #area-filter, .task-organize {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent 100%);
            mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent 100%);
  }
}


/* ================================================================
   THE GOAL CARD, and the HEADER — Ian, 2026-08-20:
   "the goal section... just looks so puny" / "the header is very bland,
   feels uneven, doesn't look flashy or professional".

   Both are done here in CSS ONLY, deliberately: a second Claude session was
   holding index.html and js/app.js at the time. Every hook these rules need
   (.goal-folder's .tg-name/.tg-count/.gf-bar/.gf-fill/.gf-add, and
   .brand/.hdr-btn/.account) already existed in the markup.
================================================================ */

/* ---- 1. a goal is not a section divider ---------------------------------
   .goal-folder inherited .task-group-head wholesale, so the most important
   thing in the Tasks pane rendered at 0.72rem UPPERCASE — the app's smallest
   type tier, the exact styling a "BY TYPE" divider gets — with its progress
   reduced to a 54px stub. That is the whole of "puny".

   "No goal" keeps the plain divider styling on purpose. The contrast between
   a card and a quiet rule IS the hierarchy; making both prominent would say
   the same thing twice and mean neither. */
.goal-folder {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "icon name count add"
    "bar  bar  bar   bar";
  align-items: center;
  column-gap: 10px;
  row-gap: 11px;
  margin: 18px 0 10px;
  padding: 13px 14px 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surf-card);
  position: relative;
  box-shadow: var(--e1);
  /* undo the divider's type entirely */
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.goal-folder:first-child { margin-top: 4px; }
/* the goal's life-area colour as a marker down the left edge. Tried
   `box-shadow: inset 3px 0 0` first: an inset shadow follows the border-radius,
   so it thinned into a crescent around both left corners and read as a stray
   highlight rather than a deliberate accent. An absolutely positioned bar, inset
   from top and bottom, stays a clean straight marker. It is out of flow, so it
   never becomes a grid item and cannot disturb the areas above. */
.goal-folder::before {
  content: "";
  position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--area, #8a93a6);
  box-shadow: 0 0 10px -2px var(--area, #8a93a6);
}
.goal-folder > [data-icon] { grid-area: icon; line-height: 0; color: var(--area, var(--ink-soft)); }
.goal-folder > [data-icon] .gicon { width: 19px; height: 19px; }
.goal-folder .tg-name {
  grid-area: name;
  font-size: 1rem; font-weight: var(--w-bold); line-height: 1.25;
  color: var(--ink); letter-spacing: -0.2px;
  /* goals are sentences Ian types, so they are long. Wrap to two lines and
     stop rather than run — the card's height is allowed to breathe. */
  overflow-wrap: break-word;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.goal-folder .tg-count {
  grid-area: count; margin-left: 0;
  font-size: 0.8rem; font-weight: 700; padding: 3px 10px;
  font-variant-numeric: tabular-nums;   /* 0/0 and 8/12 keep the same width */
}
/* the progress bar goes full width. The goal-gradient effect only motivates if
   the bar is legible enough to read at a glance — 54px x 4px was not. */
.goal-folder .gf-bar {
  grid-area: bar;
  flex: none; width: 100%; height: 8px;
  border-radius: var(--r-pill);
  background: var(--surf-press);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.28);
  overflow: hidden;
}
[data-theme="light"] .goal-folder .gf-bar { box-shadow: inset 0 1px 2px rgba(30,40,60,0.16); }
.goal-folder .gf-fill {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--area, #8a93a6) 62%, #ffffff),
    var(--area, #8a93a6));
  box-shadow: 0 0 10px -2px var(--area, #8a93a6);
  transition: width var(--m-slow) var(--e-out);
}
/* a real 30px control with a 46px strike zone, not a bare ＋ glyph */
.goal-folder .gf-add {
  grid-area: add; position: relative;
  width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.05rem; line-height: 1;
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--surf-press);
  border: 1px solid var(--line);
  transition: color var(--m-base) var(--e-out), background var(--m-base) var(--e-out);
}
.goal-folder .gf-add::after { content: ""; position: absolute; inset: -8px; }
.goal-folder .gf-add:hover { color: var(--ink); background: var(--surf-float); }
.goal-folder .gf-add:active { transform: var(--press); }

/* ---- 2. the header ------------------------------------------------------
   Measured before touching it, at 390px:

     emblem 26px | 8 | name | 8 | board 36 | 8 | (empty) | 8 | checklists 36
       ... then EIGHTY-THREE pixels of nothing ... settings 36

   That void is the "uneven". Four controls crammed into the left third and one
   marooned at the right edge is not a toolbar, it is two clusters that do not
   know about each other. #checklist-chips was also charging 16px of flex gap
   while being 0px wide whenever no list is pinned.

   The fix is the ordinary toolbar contract: identity left, actions right, one
   even rhythm inside the action group. */
#checklist-chips:empty { display: none; }
.brand { flex: 1 1 auto; }
/* margin-left:auto (was 8px) is what moves the action group to the right edge
   of .brand, which puts it directly beside .account's settings button. */
.board-chip { margin-left: auto; }

/* One resting size and one resting radius for all three header controls, so
   the group reads as a group. They were 36/36/36 already but only by accident
   of padding; this pins it. */
.hdr-btn { justify-content: center; }

/* iOS 26 brought a real page-subtitle slot to the toolbar, and this app has had
   the markup for one all along (.brand-sub, "with Limi") — hidden on phone in
   the v120 pass to "reclaim space". The space is there: the lockup is 31px of
   type in a 52px bar. It is the cheapest way to make the header say something. */
@media (max-width: 600px) {
  .brand-sub {
    display: block;
    font-size: 10.5px; font-weight: var(--w-med);
    line-height: 1.1; letter-spacing: 0.02em;
    color: var(--ink-dim);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .brand-text strong { line-height: 1.15; }
  /* one rhythm inside the action group: .brand's gap sets board->checklists and
     .app-header's sets checklists->settings, so they have to agree or the group
     reads as 2 + 1. Measured 10 then 8 before this. */
  .app-header { gap: 10px; }
  .brand { gap: 10px; }
  .account { gap: 10px; }
}

/* The surface itself. It was a flat fill plus a 1px rule — the definition of
   bland. Liquid Glass's actual idea is that the bar reads as a lit pane with
   content passing UNDER it, so: a top sheen, a hairline that is brightest in
   the middle where the content passes, and a soft drop beneath it for depth. */
.app-header::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -14px; height: 14px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.22), transparent);
}
[data-theme="light"] .app-header::after {
  background: linear-gradient(180deg, rgba(30,40,60,0.10), transparent);
}

/* The board chip was the only loud thing at rest, and its glow spilled BELOW
   the header's bottom edge (a 20px blur at 0.4 plus a 22px bloom on a 52px
   bar). iOS 26's rule is the useful one here: the resting state stays calm and
   the interaction state gets the energy. Same jewel, half the resting bloom,
   and the press earns it back. */
.board-chip {
  box-shadow:
    0 2px 8px rgba(255,108,44,0.22),
    inset 0 1px 1px rgba(255,255,255,0.55),
    inset 0 -3px 8px rgba(168,54,16,0.26);
}
.board-chip:active {
  transform: var(--press);
  box-shadow:
    0 6px 18px rgba(255,108,44,0.5),
    inset 0 1px 1px rgba(255,255,255,0.7),
    inset 0 -3px 8px rgba(168,54,16,0.3);
}

/* ---- 4. the bottom bar ----------------------------------------------------
   This block used to re-declare the bar's height, its lamp and its compose
   button on top of the base rules — three sources of truth for one bar, and
   the last one won by file order alone. It is all folded into the .tbtn /
   .tbar-lamp block above now, driven by --bar-h and the --tb-* pill tokens. */

/* ================================================================
   ON-DEVICE PASS 2 — Ian's four circles, 2026-08-20. All measured first.
================================================================ */

/* ---- 1. "why is the plus sign on the add task button all screwed up" -----
   Measured: the glyph sat 14.5px ABOVE the button's centre. .tbtn is a column
   flex with `justify-content: flex-start` — right for the four nav buttons,
   which hang their pill from a fixed padding-top — and the compose button
   inherited it while having its padding-top zeroed, so the + was pinned to the
   top edge of a 56px square. Mine, introduced with the v123 bar rebuild. */
.tbtn-compose { justify-content: center; }

/* ---- 2. "a random pause button not surrounded by any overlay" ------------
   #pause-all is an .org-act like Tidy and Auto-sort, but it overrode the chip
   away: background transparent, border transparent, opacity 0.4. Next to two
   filled chips that reads as an icon someone forgot to finish, and on a phone
   there is no hover to reveal the shell it was hiding. It keeps its lower
   priority through COLOUR now, not by dissolving its own container. */
#pause-all {
  padding: 7px 11px;
  background: var(--surf-card);
  border-color: var(--line);
  opacity: 1;
  color: var(--ink-dim);
}
#pause-all:hover {
  opacity: 1;
  color: var(--ink);
  background: var(--surf-press);
  border-color: var(--line-strong);
}
[data-theme="light"] #pause-all:hover { background: rgba(40,72,112,0.08); border-color: rgba(40,72,112,0.18); }

/* ---- 3. "why is the whole task section so tight" -------------------------
   Measured at 393px, all three inside the same 23..370 list:

     task row   content 35 .. 358   (12px padding)
     goal card  content 39 .. 356   (16/14px padding)
     divider    content 25 .. 368   (2px padding)  <- "NO GOAL" and its count

   So the divider's label sat 10px LEFT of every task title and its count ran
   10px further RIGHT than any row's ⋯ — it hugged the edges while everything
   else was inset. That is what reads as tight and unaligned. One content edge
   now: 35 on the left, 358 on the right, for rows, cards and dividers alike.

   The rule under the label stays full-bleed on purpose — an inset label over a
   full-width rule is a section divider; insetting both would just look like a
   short line. */
@media (max-width: 600px) {
  .task-group-head { padding-left: 12px; padding-right: 12px; }
  /* 11, not 12: the card carries a 1px border, so 1 + 11 lands its content on
     the same 35px edge as a borderless row. */
  .goal-folder { padding-left: 11px; padding-right: 11px; }
  /* and give the column back a little width — 14px a side on a 393px phone was
     more gutter than the content could spare */
  #panel-tasks, #panel-wins, #panel-goals { padding-left: var(--sp-3); padding-right: var(--sp-3); }
}

/* ---- 4. "why is there still a little gap between everything" -------------
   Inside the card: 19px above the title, 16px between title and bar, 15px
   below the bar — on a card only 78px tall, that is more air than content.
   Then a 26px void to the next divider (the card's 10px bottom margin plus the
   divider's 16px top), which on a goal with no tasks yet is the whole space
   between a goal and the next section.

   Tightened so the card reads as one object rather than three things sharing a
   border, and the divider that follows sits closer to what it divides. */
.goal-folder {
  padding-top: 12px; padding-bottom: 12px;
  row-gap: 8px;
  margin: 16px 0 8px;
}
.goal-folder + .task-group-head { margin-top: 14px; }


/* ================================================================
   ON-DEVICE PASS 3 — Ian, 2026-08-21. Measured before touched.
================================================================ */

/* ---- 1. "the pause button at the furthest swipe is still slightly off the
          screen. You can see its shadow on the right side" -----------------
   It is not off the screen. Measured at max scroll on a 393px phone: the last
   chip's right edge lands at 371.8 against a container edge of 372 — so it sits
   0.2px inside, which puts the WHOLE chip underneath the 22px mask fade that
   makes these rows look scrollable. The fade was doing its job on a chip that
   had nothing left to reveal, so the last control rendered permanently
   half-transparent. That is the "shadow".

   Scroll-end padding fixes it at the source: the chip now finishes clear of
   the fade, so the fade only ever dims something there IS more of. */
@media (max-width: 600px) {
  #area-filter, .task-organize { padding-right: 26px; }
}

/* ---- 2. "why is there a little gap above the Got it button? Shouldn't it be
          its own section?" ------------------------------------------------
   Yes, it should — and there were two separate things wrong.

   The gap is .nudge-ask-note's `min-height: 2.3em`. That reserve is right when
   the note carries a two-line live status ("asking iOS now…"), but the install
   card's line is short and now has numbered steps above it, so the reserve
   became a blank band sitting directly on top of the button.

   And Ian's instinct is the correct one: on a card that has just given you a
   numbered sequence to follow, "Got it" is not another line of the sequence,
   it is the way out. So it gets a real footer — a hairline and its own space —
   instead of being separated by an accident. Scoped to the card that has
   steps: the plain permission ask is a question with two answers and wants no
   divider between the question and the answering. */
.nudge-ask-steps ~ .nudge-ask-note { min-height: 0; margin-bottom: 0; }
.nudge-ask-steps ~ .nudge-ask-acts {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

/* ---- 3. "what is with the width of the task board? Why are there such huge
          edges on the left and right sides?" ------------------------------
   Measured on a 393px phone, the gutters stacked three deep:

     .rail      padding 8      (a pane that is already full-bleed here)
     #panel-*   padding 12
     .task      padding 12
     ---------------------------
     33px before the first character, both sides. 67px of a 393px screen — 17%
     of the phone — spent on nothing.

   The rail's 8px is the one with no job: on phone it is not a floating card
   beside a stage, it IS the pane. Dropping it and trimming the panel to 10
   puts text at 22px and hands 22px of width back to the content.

   max() rather than a flat number so a rotated iPhone still clears the notch —
   that inset is 47px in landscape and this is the rule that would put a task
   title under it. */
@media (max-width: 600px) {
  .rail { padding-left: 0; padding-right: 0; }
  .limi-feed { padding-left: 12px; padding-right: 12px; }
  #panel-tasks, #panel-wins, #panel-goals {
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
  }
}

/* ---- 4. swipe between destinations --------------------------------------
   The gesture lives in js/tabbar.js; showTab already owns the animation
   (.panel-in-left / .panel-in-right). This is the load-bearing half.

   `pan-y` on .workspace exists for a race, not a preference. tabbar.js needs
   ~8px of travel to tell a horizontal swipe from a vertical scroll. Left to
   itself iOS has already begun scrolling the carousel by then, and every
   touchmove after a scroll starts arrives cancelable:false -- so preventDefault
   silently does nothing and the carousel drags WHILE the module also steps a
   destination. Two movements, one finger: Ian's "very glitchy". Declaring pan-y
   means the browser never starts the scroll there is no longer time to cancel.
   The carousel is still scrolled, only ever by paneTo().

   It goes on .workspace, not .rail, because .stage (the Limi pane) is the other
   half of the carousel and is the screen the swipe failed hardest on.

   Two things MEASURED with real touch input via CDP, which honours touch-action
   (synthetic TouchEvents do not reach the gesture machinery at all):

   · pan-y on an ancestor does NOT block a descendant horizontal scroller. On a
     bare carousel: ancestor pan-y -> chips scrolled 246px, carousel 0. So this
     rule costs #area-filter and .task-organize nothing.
   · it is NOT what protects those rows in the app. Without pan-y they still
     scroll correctly, because armSwipe's startedInSideScroller() already
     declines the gesture. (A bare carousel with no listeners DOES steal it --
     390px — but registering a non-passive touchmove on the scroller takes it off
     the compositor fast path, so the app was never that case. Worth writing
     down: the probe and the app disagreed, and the app is the one that counts.)

   Which leaves an honest gap. Headless Chromium keeps touchmove cancelable
   through the axis lock, so the race above does not reproduce there -- pulling
   this rule leaves every behavioural check in verify-mobile green. The only
   thing guarding it is a computed-style assertion. It is a proxy, and it is
   labelled as one in the rig.

   One accessibility catch, because `pan-y` alone also forbids PINCH-ZOOM, and
   this rule now covers the entire app surface -- that would take the ability to
   zoom the app away from anyone who needs it. `pan-y pinch-zoom` gives back the
   gesture we never wanted to take. It is declared twice on purpose: a browser
   that does not know the `pinch-zoom` keyword drops the whole declaration as
   invalid and would silently fall back to `auto`, losing the fix above. The bare
   value goes first so it stands if the second is discarded.

   The bar is a gesture surface too, so its text must not select mid-swipe. */
@media (max-width: 600px) {
  .workspace {
    touch-action: pan-y;
    touch-action: pan-y pinch-zoom;
  }
  .tabbar {
    touch-action: pan-y;
    touch-action: pan-y pinch-zoom;
    -webkit-user-select: none; user-select: none;
  }
}


/* ---- 5. "why is the Brief me button kind of hidden under the UI" ----------
   Two things, and the first one is a rule that promised it changed nothing.

   The @media (pointer: coarse) strike-zone block sets `position: relative` on a
   list of controls so an ::after pad has something to anchor to, under a
   comment saying "Nothing here changes a single pixel of the design". True for
   the others — they were all static. NOT true for .brief-me-btn, which was
   already `position: absolute`. Forcing it to relative changed its positioning
   scheme outright on every touch device: from "placed 50px below the stage's
   top" to "wherever the flex column ends up, then nudged 50px down".

   And a relative `top` is invisible to layout. Nothing reserves those 50px, so
   the button is painted lower than the stage believes it to be, and whatever
   clearance it has above the tab bar is an accident of the leftover slack.

   Measured on a 393px phone with Limi speaking: 24.5px of clearance in a
   headless browser, which reports env(safe-area-inset-bottom) as 0 — but 7.5px
   once you emulate the 34px a real iPhone reports, and the button's own shadow
   spreads 18px, so it bled into the bar's backdrop-filter and read as sinking
   underneath it. No rig could ever have caught this: the inset is 0 in every
   headless browser we test in.

   The 50px becomes a margin, so the flex column actually accounts for it, and
   the stage keeps a floor of its own beneath the button. */
@media (pointer: coarse) {
  .brief-me-btn { top: 0; margin-top: 50px; }
}
@media (max-width: 600px) {
  /* a guaranteed gap to the bar that does not depend on leftover slack */
  .stage { padding-bottom: 16px; }
}

/* Owner-supplied Go. Limit. Less. wordmark, separate from the app icon. */
.signin-card .brand-wordmark { width: 184px; height: 184px; max-width: 100%; margin: 0 auto; filter: none; }
.signin-card .brand-wordmark img { object-fit: contain; }
