/* =========================================================================
   CJ Plans — mobile-first PWA styling
   Design goals: native feel, big touch targets, safe-area aware, no
   website-in-a-box tells (no tap highlight, no accidental text selection,
   no overscroll bounce leaking the page background).
   ========================================================================= */

:root {
  color-scheme: light dark;   /* native date/time pickers follow the OS theme */
  --rose: #ff6f9c;
  --rose-deep: #e0567a;
  --indigo: #7b6cff;
  --teal: #3fd0c9;
  --amber: #ffb454;
  --slate: #8892a6;
  --blue: #4d9bff;

  --bg: #110f18;
  --bg-elev: #1b1825;
  --bg-elev-2: #262131;
  --line: #2f2a3c;
  --text: #f4f1fa;
  --text-dim: #a89fbd;
  --text-faint: #6f6786;
  --accent: var(--teal);
  --accent-2: var(--indigo);
  --grad: linear-gradient(135deg, var(--teal), var(--indigo));
  --danger: #ff5a6a;
  --ok: #45d17a;

  /* Surfaces. Dark mode separates layers with a hairline; light mode with a
     soft shadow and no line at all — a border on every card is the one thing
     that most says "prototype". Both resolve through these two tokens. */
  --card-border: var(--line);
  --shadow-1: none;
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 -8px 40px rgba(0, 0, 0, 0.5);
  --press: color-mix(in srgb, var(--text) 7%, transparent);   /* row/icon press tint */
  --raise: color-mix(in srgb, var(--text) 13%, var(--bg-elev-2)); /* the lifted segment */

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 24px;
  --tap: 46px;               /* minimum finger-sized target */
  --header-h: 54px;
  --tabbar-h: 64px;

  /* One curve for everything that moves, and a springier one for things that
     should land (sheets, toasts, a check popping in). */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.35, 0.44, 1);

  /* Safe-area insets (notch, home indicator, gesture bar) */
  --sa-top: env(safe-area-inset-top, 0px);
  --sa-bottom: env(safe-area-inset-bottom, 0px);
  --sa-left: env(safe-area-inset-left, 0px);
  --sa-right: env(safe-area-inset-right, 0px);
}

/* Light palette: applied via the OS preference when no explicit theme is set,
   and always when [data-theme="light"] is forced. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    --bg: #f7f2f6;
    --bg-elev: #ffffff;
    --bg-elev-2: #f3ebf1;
    --line: #eadfe7;
    --text: #1f1827;
    --text-dim: #6a6174;
    --text-faint: #a59db0;
    --card-border: transparent;
    --shadow-1: 0 1px 2px rgba(40, 24, 52, 0.05), 0 8px 24px -10px rgba(40, 24, 52, 0.14);
    --shadow-2: 0 10px 30px rgba(40, 24, 52, 0.16);
    --shadow-3: 0 -8px 40px rgba(40, 24, 52, 0.18);
    --press: color-mix(in srgb, var(--text) 6%, transparent);
    --raise: #ffffff;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f2f6;
  --bg-elev: #ffffff;
  --bg-elev-2: #f3ebf1;
  --line: #eadfe7;
  --text: #1f1827;
  --text-dim: #6a6174;
  --text-faint: #a59db0;
  --card-border: transparent;
  --shadow-1: 0 1px 2px rgba(40, 24, 52, 0.05), 0 8px 24px -10px rgba(40, 24, 52, 0.14);
  --shadow-2: 0 10px 30px rgba(40, 24, 52, 0.16);
  --shadow-3: 0 -8px 40px rgba(40, 24, 52, 0.18);
  --press: color-mix(in srgb, var(--text) 6%, transparent);
  --raise: #ffffff;
}
/* Forced dark (in case the OS is light but the user picked dark). */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #110f18;
  --bg-elev: #1b1825;
  --bg-elev-2: #262131;
  --line: #2f2a3c;
  --text: #f4f1fa;
  --text-dim: #a89fbd;
  --text-faint: #6f6786;
  --card-border: var(--line);
  --shadow-1: none;
  --shadow-2: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-3: 0 -8px 40px rgba(0, 0, 0, 0.5);
  --press: color-mix(in srgb, var(--text) 7%, transparent);
  --raise: color-mix(in srgb, var(--text) 13%, var(--bg-elev-2));
}

* { box-sizing: border-box; }

/* Kill the mobile-web tells */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  /* No text selection by default — feels like an app, not a page. */
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;   /* removes the 300ms tap delay + double-tap zoom */
}

/* Re-enable selection only where reading/copying matters */
input, textarea, [contenteditable="true"], .selectable {
  -webkit-user-select: text;
  user-select: text;
}
/* When the keyboard opens the browser scrolls the focused field just barely into
   view — which on a phone means flush against the bottom edge, i.e. underneath
   the fixed tab bar. Reserve that much room so it always stops short of it. */
input, textarea, select, [contenteditable="true"] {
  scroll-margin-bottom: calc(var(--tabbar-h) + var(--sa-bottom) + 16px);
  scroll-margin-top: calc(var(--header-h) + var(--sa-top) + 8px);
}

button, .btn { font-family: inherit; }
/* Kill the iOS/WebKit default grey button + input chrome everywhere. Every
   control in this app supplies its own background/border. */
button {
  -webkit-appearance: none; appearance: none;
  background: transparent; border: none; color: inherit; cursor: pointer;
}
input, textarea, select {
  -webkit-appearance: none; appearance: none;
  background-color: transparent;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
:focus:not(:focus-visible) { outline: none; }

/* ---- Splash -------------------------------------------------------------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(123, 108, 255, 0.22), transparent 60%),
    var(--bg);
  transition: opacity 0.4s ease;
}
.splash.hide { opacity: 0; pointer-events: none; }
.splash-mark { filter: drop-shadow(0 10px 30px rgba(63, 208, 201, 0.35)); animation: pop 0.6s ease; }
.splash-name { font-size: 26px; font-weight: 700; letter-spacing: 0.5px; }
.splash-spin {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes pop { 0% { transform: scale(0.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Auto night-mode dim: a soft warm veil over everything (taps pass through). It
   only ever dims — never fully opaque — so the always-on tablet stays readable
   but easy on the eyes at night. */
.dim-overlay {
  position: fixed; inset: 0; z-index: 200; pointer-events: none;
  background: #140d04; /* warm near-black — cuts brightness and blue light */
  opacity: 0; transition: opacity 1.1s ease;
}

/* ---- App shell ----------------------------------------------------------- */
.app { min-height: 100%; display: flex; flex-direction: column; }

.appbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: var(--sa-top);
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  /* Flat while the page sits at the top; the hairline and a whisper of shadow
     only appear once content is scrolling underneath (app.js toggles it). */
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.appbar.scrolled { border-bottom-color: var(--line); box-shadow: 0 4px 18px -12px rgba(0, 0, 0, 0.35); }
.appbar-row {
  height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  /* The counters used to butt straight up against the screen title. */
  gap: 14px;
  padding: 0 16px;
  padding-left: max(16px, var(--sa-left));
  padding-right: max(16px, var(--sa-right));
}
.appbar-title { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.appbar-sub { font-size: 12px; color: var(--text-dim); font-weight: 500; }
.appbar-actions { display: flex; gap: 8px; }

.icon-btn {
  min-width: var(--tap); min-height: var(--tap);
  display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text);
  border-radius: 999px; font-size: 20px; cursor: pointer;
  transition: background 0.18s var(--ease), transform 0.18s var(--ease);
}
.icon-btn:active { background: var(--press); transform: scale(0.9); }
.icon-btn svg { width: 22px; height: 22px; }

/* Scroll region between header and tab bar */
.screen {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  padding-left: max(14px, var(--sa-left));
  padding-right: max(14px, var(--sa-right));
  /* keep content above the fixed tab bar + gesture area */
  padding-bottom: calc(var(--tabbar-h) + var(--sa-bottom) + 90px);
}

/* ---- Bottom tab bar ------------------------------------------------------ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex;
  padding-bottom: var(--sa-bottom);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
/* Material-style tabs: the icon sits in a pill that fills behind the active
   one, so the selection reads as a shape rather than only a colour change. */
.tab {
  flex: 1; min-height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; padding: 6px 0 4px; border: none; background: transparent; cursor: pointer;
  color: var(--text-faint); font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
  transition: color 0.2s var(--ease);
  -webkit-touch-callout: none;
}
.tab .ic {
  display: flex; align-items: center; justify-content: center;
  width: 54px; height: 30px; border-radius: 999px;
  font-size: 21px; line-height: 1;
  background: transparent;
  transition: background 0.22s var(--ease), transform 0.22s var(--ease-spring);
}
.tab .ic svg { width: 23px; height: 23px; display: block; transition: transform 0.22s var(--ease-spring); }
.tab.active { color: var(--accent); font-weight: 700; }
.tab.active .ic { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.tab.active .ic svg { stroke-width: 2.3; }
.tab:active .ic { transform: scale(0.88); }

/* ---- Cards & lists ------------------------------------------------------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 15px;
  margin-bottom: 12px;
}
.card.pad-lg { padding: 20px; }
.section-title { font-size: 12px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.07em; margin: 22px 6px 8px; }
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }

.list-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 6px; min-height: var(--tap);
  border-bottom: 1px solid var(--line);
  border-radius: 10px;
  transition: background 0.15s var(--ease);
}
.list-item[data-tap]:active { background: var(--press); }
.list-item:last-child { border-bottom: none; }
.list-item .grow { flex: 1; min-width: 0; }
/* The take-the-rest-of-the-row child of any flex row. It used to only be
   defined inside .list-item, so the same class quietly did nothing anywhere
   else it was used. */
.grow { flex: 1; }
.list-item .title { font-weight: 600; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--bg-elev-2); color: var(--text-dim);
}
.pill.rose   { background: color-mix(in srgb, var(--rose) 22%, transparent); color: var(--rose); }
.pill.indigo { background: color-mix(in srgb, var(--indigo) 24%, transparent); color: var(--indigo); }
.pill.teal   { background: color-mix(in srgb, var(--teal) 22%, transparent); color: var(--teal); }
.pill.amber  { background: color-mix(in srgb, var(--amber) 26%, transparent); color: #d98a1f; }
.pill.blue   { background: color-mix(in srgb, var(--blue) 22%, transparent); color: var(--blue); }
.pill.slate  { background: color-mix(in srgb, var(--slate) 26%, transparent); color: var(--slate); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* ---- Buttons ------------------------------------------------------------- */
.btn {
  min-height: var(--tap); padding: 0 18px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-elev-2); color: var(--text);
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: transform 0.18s var(--ease-spring), filter 0.15s, background 0.15s, box-shadow 0.18s;
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: var(--grad); border: none; color: #fff;
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent-2) 70%, transparent);
}
.btn.primary:active { filter: brightness(1.06); box-shadow: 0 3px 10px -6px color-mix(in srgb, var(--accent-2) 70%, transparent); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }

/* Floating action button */
.fab {
  position: fixed; z-index: 25;
  right: max(18px, var(--sa-right));
  bottom: calc(var(--tabbar-h) + var(--sa-bottom) + 16px);
  width: 58px; height: 58px; border-radius: 20px; border: none;
  background: var(--grad);
  color: #fff; font-size: 28px; line-height: 1; cursor: pointer;
  box-shadow: 0 12px 30px rgba(123, 108, 255, 0.4);
  transition: transform 0.18s var(--ease-spring);
}
.fab:active { transform: scale(0.9); }

/* Hoisted into the top bar (see app.js relocateFab): compact header button. */
.fab.fab--top {
  position: static; z-index: auto;
  right: auto; bottom: auto; left: auto;
  width: var(--tap); height: var(--tap); min-width: var(--tap);
  border-radius: 13px; box-shadow: none; font-size: 26px;
}
.fab.fab--top:active { transform: scale(0.9); }

/* ---- Forms --------------------------------------------------------------- */
label.field, div.field { display: block; margin-bottom: 12px; }
label.field > span, div.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; min-height: var(--tap);
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 13px;
  padding: 11px 14px; font-size: 16px;  /* 16px: no zoom-on-focus */
  font-family: inherit;
  appearance: none; -webkit-appearance: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { min-height: 84px; resize: vertical; line-height: 1.45; }
.input::placeholder { color: var(--text-faint); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); outline: none; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; }

/* Tick boxes. The blanket `appearance: none` further up strips the native box,
   so draw our own — finger-sized, and obviously tappable. */
input[type="checkbox"] {
  width: 26px; height: 26px; flex: none; margin: 0; position: relative;
  border: 2px solid var(--line); border-radius: 8px;
  background: var(--bg); cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); animation: check-pop 0.3s var(--ease-spring); }
input[type="checkbox"]:checked::after {
  content: ""; position: absolute; left: 7px; top: 2px;
  width: 6px; height: 12px;
  border: solid var(--bg); border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
input[type="checkbox"]:active { transform: scale(0.9); }
/* A whole checkbox row reads as one tappable thing. */
label.field:has(input[type="checkbox"]) {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 13px; min-height: var(--tap); cursor: pointer;
}
label.field:has(input[type="checkbox"]) > span { margin: 0; font-size: 14.5px; color: var(--text); }

.check {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  border: 2px solid var(--line); background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; cursor: pointer; transition: background 0.15s, border-color 0.15s, transform 0.15s var(--ease-spring);
}
.check:active { transform: scale(0.9); }
.check.on { background: var(--grad); border-color: transparent; animation: check-pop 0.3s var(--ease-spring); }

.seg { display: flex; background: var(--bg-elev-2); border: 1px solid transparent; border-radius: 13px; padding: 3px; gap: 2px; }
.seg button {
  flex: 1; min-height: 38px; border: none; background: transparent; color: var(--text-dim);
  border-radius: 10px; font-weight: 600; font-size: 13px; cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s, transform 0.18s var(--ease-spring), box-shadow 0.18s;
}
.seg button:active { transform: scale(0.96); }
/* The selected segment is the raised one — a lift, not a tint, so it reads the
   same whatever the accent is. */
.seg button.on {
  background: var(--raise); color: var(--text); font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}

/* Toggle switch (notification prefs) */
.switch { position: relative; flex: none; width: 50px; height: 30px; border: none; border-radius: 999px; background: color-mix(in srgb, var(--text) 18%, var(--bg-elev-2)); cursor: pointer; transition: background .22s var(--ease); align-self: center; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.3); transition: transform .22s var(--ease-spring), width .15s; }
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(20px); }
.switch:active::after { width: 28px; }
.switch.on:active::after { transform: translateX(16px); }

/* Public-mode eye in the top bar. Off it's just another grey icon; on it wears
   the accent and a dot, so "is the private side hidden right now?" is answerable
   from across the table. `.holding` is the press-and-hold it takes to leave. */
.public-btn {
  position: relative;
  /* Its own space. Flush against the ❤️ it was a coin-flip on a phone. */
  margin-right: 8px;
  -webkit-touch-callout: none; user-select: none; -webkit-user-select: none;
}
.public-btn.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.public-btn.on::after {
  content: ""; position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
/* Waiting for the second tap that leaves public mode. */
.public-btn.armed { animation: public-armed 1s ease-in-out infinite; }
@keyframes public-armed { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* Heart button in the top bar + its send/receive animations */
.heart-btn svg { fill: var(--rose); stroke: var(--rose); }
.heart-btn.beat { animation: heart-beat .5s ease; }
@keyframes heart-beat { 0% { transform: scale(1); } 30% { transform: scale(1.35); } 55% { transform: scale(.9); } 100% { transform: scale(1); } }

.float-heart { position: fixed; z-index: 3000; pointer-events: none; font-size: 26px; line-height: 1; transform: translate(-50%, -50%); animation: heart-float 1.6s ease-out forwards; }
@keyframes heart-float {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(.4); }
  20%  { opacity: 1; transform: translate(calc(-50% + var(--dx, 0px) * .3), -70%) scale(1.1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -220%) scale(.9); }
}

/* ---- Sheet / modal ------------------------------------------------------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(8, 5, 14, 0.42);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 0.25s var(--ease);
}
.sheet-backdrop.show { opacity: 1; }
.sheet {
  width: 100%; max-width: 560px;
  background: var(--bg-elev);
  border-radius: 28px 28px 0 0;
  border: 1px solid var(--card-border); border-bottom: none;
  box-shadow: var(--shadow-3);
  padding: 8px 18px calc(18px + var(--sa-bottom));
  padding-left: max(16px, var(--sa-left));
  padding-right: max(16px, var(--sa-right));
  /* dvh, not vh: with the keyboard open the sheet must fit the space that is
     actually left, or its Save button sits under the keyboard. */
  max-height: 90vh; max-height: 90dvh; overflow-y: auto;
  overscroll-behavior: contain;   /* scrolling a long sheet must not drag the page behind it */
  transform: translateY(100%); transition: transform 0.36s var(--ease);
}
.sheet-backdrop.show .sheet { transform: translateY(0); }
/* While a finger drags it, it follows 1:1 — no easing fighting the thumb. */
.sheet.dragging { transition: none; }
.sheet-grip { width: 36px; height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--text) 18%, transparent); margin: 6px auto 14px; }
.sheet h2 { margin: 0 0 14px; font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }

/* ---- Hero / feature bits ------------------------------------------------- */
.hero {
  background: linear-gradient(140deg, color-mix(in srgb, var(--teal) 26%, var(--bg-elev)), color-mix(in srgb, var(--indigo) 26%, var(--bg-elev)));
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg); padding: 20px; margin-bottom: 14px;
  box-shadow: var(--shadow-1);
}
.count-big { font-size: 44px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.count-unit { font-size: 14px; color: var(--text-dim); font-weight: 600; }
.count-grid { display: flex; gap: 18px; margin-top: 6px; }
.count-grid > div { text-align: center; }
.count-grid .n { font-size: 30px; font-weight: 800; }
.count-grid .l { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

.progress { height: 10px; border-radius: 999px; background: var(--bg-elev-2); overflow: hidden; border: none; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal), var(--indigo)); transition: width 0.6s var(--ease); }
/* Several claims on one bar, laid end to end — an account's balance split
   between the savings goals linked to it. */
.progress.seg-bar { display: flex; }
.progress.seg-bar > i { border-radius: 0; flex: none; }
.progress.seg-bar > i:first-child { border-radius: 999px 0 0 999px; }
.progress.seg-bar > i:last-child { border-radius: 0 999px 999px 0; }

.dual-time { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; }
.dual-time .who { color: var(--text-dim); font-weight: 700; }

.emoji-scale { display: flex; justify-content: space-between; gap: 6px; }
.emoji-scale button {
  flex: 1; aspect-ratio: 1; max-width: 62px;
  border: 1px solid var(--line); background: var(--bg); border-radius: 14px;
  font-size: 26px; cursor: pointer; transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.emoji-scale button.on { border-color: var(--accent); background: var(--bg-elev-2); transform: translateY(-2px) scale(1.05); }

.moodbars { display: flex; align-items: flex-end; gap: 4px; height: 56px; }
.moodbars > i { flex: 1; background: var(--bg-elev-2); border-radius: 4px 4px 0 0; min-height: 4px; }

/* ---- Solar (drive tracker) ----------------------------------------------- */
.solar-slider { margin-top: 14px; }
.solar-val { font-weight: 800; font-size: 15px; color: var(--c, var(--accent)); min-width: 22px; text-align: right; }
.solar-range {
  width: 100%; height: 10px; margin: 8px 0 0; border-radius: 999px; appearance: none; -webkit-appearance: none;
  background: var(--bg-elev-2); cursor: pointer; outline: none;
}
.solar-range.unset { opacity: 0.55; }
.solar-range::-webkit-slider-thumb {
  appearance: none; -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid var(--c, var(--accent)); box-shadow: 0 1px 4px rgba(0,0,0,.35); cursor: pointer;
}
.solar-range::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 3px solid var(--c, var(--accent)); cursor: pointer;
}
.solar-stats { display: flex; gap: 8px; margin: 10px 0 2px; }
.solar-stat { flex: 1; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 12px 6px; text-align: center; }
.solar-stat-v { font-size: 22px; font-weight: 800; color: var(--c, var(--accent)); line-height: 1; }
.solar-stat-l { font-size: 11px; font-weight: 600; color: var(--text-dim); margin-top: 4px; text-transform: uppercase; letter-spacing: .4px; }
.solar-dow { display: flex; gap: 6px; }
.solar-dow-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.solar-dow-bar { width: 100%; display: flex; align-items: flex-end; }
.solar-dow-bar > i { width: 100%; border-radius: 4px 4px 0 0; min-height: 4px; }
.solar-dow-l { font-size: 11px; color: var(--text-dim); }
.solar-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.solar-freq { display: flex; align-items: center; gap: 8px; }
.solar-freq-l { font-size: 13px; min-width: 96px; flex: none; }
.solar-freq-bar { flex: 1; height: 8px; background: var(--bg-elev-2); border-radius: 999px; overflow: hidden; }
.solar-freq-bar > i { display: block; height: 100%; background: var(--rose); border-radius: 999px; }
.solar-freq-n { font-size: 12px; font-weight: 700; color: var(--text-dim); min-width: 18px; text-align: right; }
.solar-vit { margin-top: 4px; }
.solar-ring { display: block; }
.solar-recap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.solar-recap-c { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 10px 6px; text-align: center; }
.solar-recap-v { font-size: 18px; font-weight: 800; }
.solar-recap-l { font-size: 10.5px; font-weight: 600; color: var(--text-dim); margin-top: 3px; text-transform: uppercase; letter-spacing: .3px; }
.solar-kegel { justify-content: center; padding: 16px 0 4px; }
.solar-orb {
  width: 120px; height: 120px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev-2); color: var(--text-dim); font-weight: 800; font-size: 15px;
  transform: scale(.7); transition: transform 3s linear, background 3s linear, color 3s linear;
}
.solar-orb.squeeze { transform: scale(1); background: color-mix(in srgb, var(--rose) 40%, transparent); color: var(--text); }
.solar-labdate { width: auto; flex: none; padding: 6px 10px; font-size: 13px; color-scheme: light dark; }

.empty { text-align: center; color: var(--text-dim); padding: 44px 16px; font-size: 15px; font-weight: 600; line-height: 1.5; }
.empty .faint { font-weight: 500; font-size: 13.5px; margin-top: 2px; }
.empty .big {
  display: inline-flex; align-items: center; justify-content: center;
  width: 72px; height: 72px; border-radius: 50%; margin-bottom: 12px;
  background: var(--bg-elev-2); font-size: 32px; line-height: 1;
}

/* ---- Auth screen --------------------------------------------------------- */
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: none; background: transparent; color: var(--accent);
  font-size: 13px; font-weight: 700; cursor: pointer; padding: 6px 8px; border-radius: 8px;
}
.pw-toggle:active { background: var(--bg-elev-2); }

.auth-wrap {
  min-height: 100%;
  display: flex; flex-direction: column; justify-content: center;
  padding: 24px;
  padding-top: calc(24px + var(--sa-top));
  padding-bottom: calc(24px + var(--sa-bottom));
  max-width: 440px; margin: 0 auto;
}
.auth-wrap::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(70% 50% at 20% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(60% 45% at 90% 100%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 70%);
}
.auth-logo { text-align: center; margin-bottom: 26px; }
.auth-logo img { box-shadow: 0 14px 34px -10px color-mix(in srgb, var(--accent-2) 60%, transparent); }
.auth-logo .name { font-size: 30px; font-weight: 800; margin-top: 12px; letter-spacing: -0.02em; }
.auth-logo .tag { color: var(--text-dim); font-size: 14px; margin-top: 4px; }

/* ---- Collapsible "details" (e.g. cycle method note) ---------------------- */
.key-fallback { margin-bottom: 4px; }
.key-fallback > summary { cursor: pointer; color: var(--text-dim); font-size: 13px; padding: 6px 0; list-style: none; }
.key-fallback > summary::-webkit-details-marker { display: none; }
.key-fallback > summary::before { content: "▸ "; }
.key-fallback[open] > summary::before { content: "▾ "; }

/* ---- Autocomplete (city picker) ------------------------------------------ */
.ac-menu {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 6; margin-top: 6px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; max-height: 260px; overflow-y: auto;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}
.ac-item {
  display: block; width: 100%; text-align: left; padding: 13px 14px;
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  color: var(--text); font-size: 14.5px; cursor: pointer; min-height: var(--tap);
}
.ac-item:last-child { border-bottom: none; }
.ac-item:active { background: var(--bg-elev-2); }

/* ---- Toasts -------------------------------------------------------------- */
.toasts {
  position: fixed; left: 0; right: 0; z-index: 60;
  bottom: calc(var(--tabbar-h) + var(--sa-bottom) + 14px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 16px;
}
.toast {
  background: color-mix(in srgb, var(--bg-elev-2) 92%, transparent); color: var(--text);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 11px 18px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-2);
  animation: toastin 0.4s var(--ease-spring); max-width: 92%;
  text-align: center;
}
.toast.err { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 55%, var(--line)); }
@keyframes toastin { from { transform: translateY(16px) scale(0.92); opacity: 0; } }

/* ---- Calendar month grid ------------------------------------------------- */
.cal-title { background: transparent; border: none; color: var(--text); font-weight: 800; font-size: 18px; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.cal-title:active { background: var(--bg-elev-2); }
/* minmax(0,1fr) lets columns shrink below their content — otherwise a long
   event title stretches the whole grid past its container and overlaps the
   day panel. Cells clip their own overflow so chips never spill out. */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin-bottom: 4px; }
.cal-wd { text-align: center; font-size: 10.5px; font-weight: 700; color: var(--text-faint); padding-bottom: 2px; }
.cal-wd.weekend { color: var(--amber); }
.cal-wd.monday { color: var(--ok); }
.cal-cell {
  position: relative; aspect-ratio: 1 / 0.78;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: 1px solid transparent; border-radius: 12px;
  background: var(--bg-elev); color: var(--text);
  box-shadow: var(--shadow-1);
  font-size: 14px; cursor: pointer; padding: 0; overflow: hidden; min-width: 0;
  transition: transform 0.15s var(--ease-spring), background 0.15s, border-color 0.15s;
}
.cal-cell:active { transform: scale(0.9); }
.cal-cell.dim { background: transparent; color: var(--text-faint); }
/* Weekends read as weekends at a glance; Monday gets its own light green so the
   start of the week is just as easy to find. Cycle tints below still win. */
.cal-cell.weekend { background: color-mix(in srgb, var(--amber) 14%, var(--bg-elev)); }
.cal-cell.weekend .cal-num { color: var(--amber); font-weight: 700; }
.cal-cell.monday { background: color-mix(in srgb, var(--ok) 12%, var(--bg-elev)); }
.cal-cell.weekend.dim, .cal-cell.monday.dim { background: transparent; }
.cal-cell.today .cal-num { color: var(--accent); font-weight: 800; }
.cal-cell.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg-elev)); }
.cal-num { line-height: 1; }
.cal-dots { position: absolute; bottom: 5px; display: flex; gap: 3px; height: 5px; }
.cal-dots > i { width: 5px; height: 5px; border-radius: 50%; }

/* Cycle overlay on the month calendar: whole-cell tint so it reads at a glance */
/* Fertile window = soft teal band. Ovulation (the single peak day inside it) is
   a SOLID teal fill so it clearly stands out from the lighter fertile days. */
.cal-cell.cyc-fertile { background: color-mix(in srgb, var(--teal) 20%, var(--bg-elev)); }
/* predicted period = dashed rose ring + light tint, distinct from an actual period */
.cal-cell.cyc-pred { background: color-mix(in srgb, var(--rose) 16%, var(--bg-elev)); border: 1.5px dashed color-mix(in srgb, var(--rose) 60%, var(--line)); }
.cal-cell.cyc-period { background: color-mix(in srgb, var(--rose) 40%, var(--bg-elev)); }
.cal-cell.cyc-period .cal-num { color: #fff; font-weight: 800; }
/* Ovulation = keep the fertile tint behind it (so event chips stay readable) but
   mark the peak day with a solid teal badge around the number. */
.cal-cell.cyc-ovul { background: color-mix(in srgb, var(--teal) 20%, var(--bg-elev)); }
.cal-cell.cyc-ovul .cal-num {
  color: #fff; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 1.55em; height: 1.55em; padding: 0 0.3em;
  background: var(--teal); border-radius: 999px;
}

/* Draggable daily tracker boxes (Lunar day log) */
.sortable-list { display: flex; flex-direction: column; }
.sortable-item { padding: 4px 0; }
.sortable-item + .sortable-item { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; }
.sortable-item.dragging { opacity: 0.85; background: color-mix(in srgb, var(--accent) 9%, var(--bg-elev)); border-radius: 12px; box-shadow: 0 6px 20px rgba(0,0,0,0.18); }
.sort-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; padding: 4px 2px; }
.drag-handle { color: var(--text-faint); font-size: 20px; line-height: 1; padding: 8px 10px; margin: -8px -4px -8px -8px; border-radius: 8px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.drag-handle:active { cursor: grabbing; background: color-mix(in srgb, var(--accent) 12%, transparent); }
/* Savings goals: whole cards drag by their grip. */
.sv-list { display: flex; flex-direction: column; }
.sv-item.dragging { opacity: 0.9; box-shadow: 0 8px 22px rgba(0,0,0,0.25); border-color: var(--accent); }
.chip.sm { min-height: 30px; padding: 0 11px; font-size: 12px; }
.step { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg-elev); color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.step:active { background: color-mix(in srgb, var(--accent) 14%, var(--bg-elev)); }
.day-drop { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; cursor: pointer; color: var(--text); margin-bottom: 8px; }
.day-drop:active { background: color-mix(in srgb, var(--accent) 8%, var(--bg-elev)); }

/* ---- Question of the day ------------------------------------------------- */
.qotd-card { border: 1px solid color-mix(in srgb, var(--teal) 30%, var(--line)); }
.qotd-answer { background: var(--bg); border-radius: 12px; padding: 10px 12px; margin-top: 10px; font-size: 14.5px; line-height: 1.45; }

.hidden { display: none !important; }
a { color: var(--accent); }
.view-enter { animation: viewin 0.28s var(--ease); }
/* Tabs slide in from the side they sit on in the bar, so moving between them
   feels like turning pages rather than a screen blinking into another one. */
.view-enter.dir-left { animation-name: view-from-right; }
.view-enter.dir-right { animation-name: view-from-left; }
/* A background repaint (realtime push, midnight, coming back after a while)
   redraws the same screen — sliding it in again just reads as a flicker. */
.view-enter.view-quiet { animation: none; }
@keyframes viewin { from { opacity: 0; transform: translateY(8px); } }
@keyframes view-from-right { from { opacity: 0; transform: translateX(28px); } }
@keyframes view-from-left { from { opacity: 0; transform: translateX(-28px); } }
/* Sub-tabs inside a section do the same, smaller. */
.sub-enter { animation: viewin 0.24s var(--ease); }
.sub-enter.dir-left { animation-name: sub-from-right; }
.sub-enter.dir-right { animation-name: sub-from-left; }
@keyframes sub-from-right { from { opacity: 0; transform: translateX(18px); } }
@keyframes sub-from-left { from { opacity: 0; transform: translateX(-18px); } }

/* Respect users who ask the OS to reduce motion — disable the animated
   flourishes (view transitions, splash, spinner, sheet slide). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .view-enter { animation: none; opacity: 1; }
}

/* ---- Calendar event-title chips (desktop grid) --------------------------- */
.cal-chips { display: none; flex-direction: column; gap: 3px; width: 100%; overflow: hidden; }
.cal-chip {
  display: block; font-size: 11px; line-height: 1.4; padding: 1px 6px; border-radius: 6px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
}
.cal-more { font-size: 10.5px; color: var(--text-faint); padding-left: 4px; }

/* ---- Desktop / wide screens: center the app, roomy calendar -------------- */
@media (min-width: 820px) {
  .appbar-row { max-width: 760px; margin-inline: auto; width: 100%; }
  .screen { max-width: 760px; margin-inline: auto; width: 100%; }
  .screen.wide { max-width: 1060px; }
  .tabbar {
    left: 50%; right: auto; transform: translateX(-50%);
    width: 100%; max-width: 760px; border-radius: 18px 18px 0 0;
  }
  .toasts { max-width: 760px; margin-inline: auto; }

  /* Roomy month grid with event titles instead of dots. */
  .wide .cal-grid { gap: 6px; }
  .wide .cal-cell {
    aspect-ratio: auto; min-height: 108px;
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    padding: 6px 7px; gap: 4px; font-size: 13px;
  }
  .wide .cal-num { align-self: flex-start; }
  .wide .cal-dots { display: none; }
  .wide .cal-chips { display: flex; }
  .wide .cal-cell.sel { box-shadow: inset 0 0 0 1px var(--accent); }
}

/* ---- Calendar: Upcoming panel + landscape two-column layout -------------- */
.cal-upcoming { margin-top: 8px; }
@media (min-width: 820px), (orientation: landscape) and (min-width: 700px) {
  .cal-layout { display: flex; gap: 18px; align-items: flex-start; }
  .cal-main { flex: 1 1 auto; min-width: 0; }
  .cal-side { flex: 0 0 310px; width: 310px; }
  .cal-upcoming { margin-top: 16px; }
}

/* ---- Calendar week view (a real time grid) -------------------------------
   Hours down the left, a column per day, events placed and sized by their
   actual times. One scroller does both axes: the hour gutter is sticky-left
   and the day headers sticky-top, so a phone scrolls sideways through the
   week rather than cramming seven columns into 390px.
   --------------------------------------------------------------------- */
.wkt-scroll {
  overflow: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: min(64vh, 640px);
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg-elev);
}
.wkt {
  display: grid;
  grid-template-columns: 46px repeat(7, minmax(108px, 1fr));
  position: relative;
}

/* Sticky corner + hour gutter (left) and day headers (top). */
/* Stacking, low to high: events (1) < now-line (2) < hour gutter (3) <
   all-day band (4) < its gutter cell (5) < day headers (6) < corner (7). */
.wkt-corner, .wkt-adg, .wkt-gutter { position: sticky; left: 0; z-index: 3; background: var(--bg-elev); }
.wkt-corner, .wkt-dh { position: sticky; top: 0; z-index: 6; }
.wkt-corner { z-index: 7; border-bottom: 1px solid var(--line); }

.wkt-dh {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: none; border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--bg-elev); color: var(--text);
  min-height: 46px; padding: 6px 2px; cursor: pointer;
}
.wkt-dh.weekend { background: color-mix(in srgb, var(--amber) 16%, var(--bg-elev)); }
.wkt-dh.monday { background: color-mix(in srgb, var(--ok) 14%, var(--bg-elev)); }
.wkt-dh.cyc-fertile { background: color-mix(in srgb, var(--teal) 22%, var(--bg-elev)); }
.wkt-dh.cyc-pred { background: color-mix(in srgb, var(--rose) 16%, var(--bg-elev)); }
.wkt-dh.cyc-period { background: color-mix(in srgb, var(--rose) 40%, var(--bg-elev)); }
.wkt-dh.cyc-period .wkt-wd, .wkt-dh.cyc-period .wkt-num { color: #fff; }
.wkt-dh.sel { box-shadow: inset 0 -3px 0 var(--accent); }
.wkt-dh.today .wkt-num {
  color: #fff; background: var(--accent); border-radius: 999px;
  min-width: 22px; padding: 2px 5px; text-align: center;
}
.wkt-wd { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--text-dim); }
.wkt-num { font-size: 16px; font-weight: 800; line-height: 1.1; }

/* All-day / important-dates banner under the headers. */
.wkt-adg {
  position: sticky; top: var(--wkt-head, 47px); z-index: 5;
  border-bottom: 1px solid var(--line);
  font-size: 8.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-faint); display: flex; align-items: center; justify-content: flex-end;
  padding: 0 5px 0 2px;
}
.wkt-ad {
  position: sticky; top: var(--wkt-head, 47px); z-index: 4;
  border-left: 1px solid var(--line); border-bottom: 1px solid var(--line);
  background: var(--bg-elev);
  display: flex; flex-direction: column; gap: 2px; padding: 3px; min-height: 22px;
}
.wkt-ad.weekend { background: color-mix(in srgb, var(--amber) 7%, var(--bg-elev)); }
.wkt-adev {
  border: none; border-radius: 5px; padding: 3px 6px; text-align: left; cursor: pointer;
  font-size: 10.5px; font-weight: 700; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0;
}

/* Hour gutter: each label sits just under its own line. (It is already
   position:sticky above — don't re-declare position here or it unsticks.) */
.wkt-hr {
  position: absolute; right: 5px; margin-top: 2px;
  font-size: 10px; font-weight: 600; color: var(--text-faint); white-space: nowrap;
}

/* Day columns: hour rules painted as a background, events placed on top. */
.wkt-col {
  position: relative; border-left: 1px solid var(--line);
  background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--wkt-hour, 46px));
}
.wkt-col.weekend { background-color: color-mix(in srgb, var(--amber) 7%, transparent); }
.wkt-col.today { background-color: color-mix(in srgb, var(--accent) 8%, transparent); }

.wkt-ev {
  position: absolute; z-index: 1;
  display: flex; flex-direction: column; gap: 1px;
  border: none; border-radius: 6px; padding: 3px 5px;
  text-align: left; font-size: 11px; font-weight: 700; line-height: 1.2;
  color: #fff; cursor: pointer; overflow: hidden;
  box-shadow: inset 3px 0 0 var(--wkt-own, transparent);
}
.wkt-ev.lightbg, .wkt-adev.lightbg { color: #17131f; }
.wkt-t {
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
}
.wkt-time { font-size: 9.5px; font-weight: 600; opacity: .85; white-space: nowrap; }

/* Now-line on today's column. */
.wkt-now { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.wkt-now::before {
  content: ""; position: absolute; left: -3px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--danger);
}


/* ---- Album filter chips -------------------------------------------------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; margin: 0 -2px 4px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: none; min-height: 36px; padding: 7px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--text-dim);
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  user-select: none; -webkit-user-select: none;
  transition: background 0.18s var(--ease), color 0.18s, border-color 0.18s, transform 0.18s var(--ease-spring), box-shadow 0.18s;
}
.chip:active { transform: scale(0.95); }
.chip.on { background: var(--bg-elev-2); color: var(--text); border-color: var(--accent); }
/* The sub-nav row marks the CURRENT screen, so its active chip is inverted —
   solid text-on-background — the way a selected filter reads in Maps or
   Photos. Unmistakable in either theme and with any accent. */
.chips.subnav .chip { border-color: transparent; background: var(--bg-elev-2); box-shadow: var(--shadow-1); }
.chips.subnav .chip.on {
  background: var(--text); color: var(--bg); border-color: var(--text);
  font-weight: 700; box-shadow: 0 6px 16px -8px color-mix(in srgb, var(--text) 60%, transparent);
}
.chip.dragging {
  position: relative; z-index: 5; cursor: grabbing; touch-action: none;
  box-shadow: 0 8px 20px rgba(0,0,0,.3); border-color: var(--accent);
  transition: none; will-change: transform;
}

/* ---- Shared daily board (Plans landing) ---------------------------------- */
.board-head { display: flex; align-items: center; gap: 12px; margin: 0 2px 12px; }
.board-date { font-size: 20px; font-weight: 800; }
.board-time { font-size: 20px; font-weight: 700; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.board-wx { font-size: 15px; color: var(--text-dim); font-weight: 600; }
.board-head .grow { flex: 1; }
.board-fs { color: var(--text-dim); }

.board-cols { display: flex; gap: 12px; align-items: flex-start; }
.board-col { flex: 1 1 0; min-width: 0; }
.board-col-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.board-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; }
.board-name { font-weight: 800; font-size: 16px; }
.board-progress { flex: none; font-size: 12.5px; font-weight: 700; color: var(--text-dim); background: var(--bg-elev-2); border-radius: 999px; padding: 3px 10px; }
.board-progress.done { color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--bg-elev-2)); }
.board-sec {
  position: relative; display: flex; align-items: center; gap: 10px;
  width: 100%; margin: 8px 0 0; padding: 0 13px;
  min-height: 46px;
  border: 1px solid var(--card-border); border-radius: 14px;
  background: var(--bg-elev); color: var(--text);
  font-size: 12.5px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase;
  cursor: pointer; overflow: hidden; text-align: left;
  transition: border-color 0.15s, transform 0.08s;
}
/* The bar IS the progress meter — it fills from the left as you tick things off. */
.board-sec-fill { position: absolute; inset: 0 auto 0 0; width: 0; transition: width 0.3s ease; pointer-events: none; }
.board-sec-chev { position: relative; flex: none; font-size: 11px; opacity: 0.55; width: 10px; }
.board-sec-label { position: relative; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-sec-count {
  position: relative; flex: none;
  font-size: 12px; font-weight: 800; letter-spacing: 0;
  color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.board-sec.all-done { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.board-sec.all-done .board-sec-count { color: var(--accent); }
/* A longer horizon is a glance, not the job at hand — quieter until you open it. */
.board-sec.horizon { color: var(--text-dim); font-size: 11.5px; }
.board-sec:active { transform: scale(0.99); }
/* Items sit slightly inset under their bar so the grouping is obvious. */
.board-sec-items { padding: 8px 0 2px; }
.board-sec-items:empty { display: none; }

.board-foldall {
  width: 100%; margin-top: 12px; padding: 9px;
  border: 1px dashed var(--line); border-radius: 11px;
  background: transparent; color: var(--text-faint);
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.board-foldall:active { color: var(--text-dim); }
.board-empty { color: var(--text-faint); font-size: 13px; padding: 10px 2px; }

.task-card {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; border-radius: 16px; margin-bottom: 8px;
  cursor: pointer; transition: transform 0.16s var(--ease-spring), background 0.15s, opacity 0.2s;
  border: 1px solid transparent;
}
.task-card:active { transform: scale(0.97); }
.task-card.done .task-check { animation: check-pop 0.3s var(--ease-spring); }
.task-card.done { opacity: 0.6; }
.task-emoji { font-size: 22px; flex: none; line-height: 1; }
.task-label { flex: 1; min-width: 0; }
.task-label > div:first-child { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; line-height: 1.3; }
.task-time-badge { flex: none; font-size: 12.5px; font-weight: 700; color: var(--text-dim); font-variant-numeric: tabular-nums; margin-right: 2px; }
.task-card.done .task-label > div:first-child { text-decoration: line-through; color: var(--text-dim); }
.sched-next { background: color-mix(in srgb, var(--accent) 12%, transparent); border-radius: 10px; }
.task-check {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line); display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px; font-weight: 800;
}

/* Feelings wheel (mood) --------------------------------------------------- */
.feel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.feel-core, .feel-sub {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; min-height: 66px; padding: 8px 6px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer; text-align: center;
}
.feel-core { border-color: color-mix(in srgb, var(--fc) 45%, var(--line)); }
.feel-sub { min-height: 46px; }
.feel-core:active, .feel-sub:active,
.feel-sub.on { background: color-mix(in srgb, var(--fc) 20%, var(--bg-elev)); border-color: var(--fc); }

/* Radial feelings wheel (SVG), rendered inline on the Mood page. It scales to
   the full available width so the whole wheel is visible at once — no popup,
   no scrollbars. */
.fw-inline { margin: 2px auto 4px; width: 100%; }
.fw { display: block; width: 100%; height: auto; margin: 0 auto; touch-action: manipulation; }

/* Wheel size slider — thumb sized for fingers on phone/tablet. */
input[type="range"].wheel-size {
  -webkit-appearance: none; appearance: none;
  height: 6px; border-radius: 999px; background: var(--line); cursor: pointer;
}
input[type="range"].wheel-size::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--bg-elev); box-shadow: 0 1px 4px rgba(0,0,0,.3);
}
input[type="range"].wheel-size::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent);
  border: 2px solid var(--bg-elev);
}
.fw path, .fw circle[data-fl] { stroke: #14101a; stroke-width: 1.4; cursor: pointer; transition: fill .12s ease; }
.fw path.sel, .fw circle[data-fl].sel { stroke: #fff; stroke-width: 4; }
.fw path.part { stroke: #fff; stroke-width: 2.5; stroke-dasharray: 10 8; }
.fw path.hot, .fw circle[data-fl].hot { stroke: #fff; stroke-width: 5; }
.fw.fw-focus path, .fw.fw-focus circle[data-fl] { stroke-width: 3; }
.fw.fw-focus path.sel { stroke-width: 6; }
.fw text { pointer-events: none; user-select: none; -webkit-user-select: none; }

/* Guided picker: a line of context under the mode switch (back button when
   drilled into one emotion, hint text otherwise). */
/* While the magnifier owns the gesture, the wheel stops being a scroll surface
   — otherwise Android steals the drag halfway through aiming. */
.fw-inline.fw-grab, .fw-inline.fw-grab .fw { touch-action: none; }

.fw-crumb {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  min-height: 26px; margin: 2px 0 4px;
}
.feel-chip.tapper { border: none; cursor: pointer; font-family: inherit; }
.feel-chip.tapper:active { transform: scale(0.96); }

/* Press-and-hold magnifier for the whole wheel. It floats above the finger so
   the thumb never covers the thing it is aiming at, and only commits on lift. */
.fw-loupe {
  position: fixed; z-index: 90; display: none; pointer-events: none;
  transform: translate(-50%, -50%);
}
.fw-loupe.on { display: block; }
.fw-loupe-glass {
  width: 148px; height: 148px; border-radius: 50%; overflow: hidden;
  border: 3px solid var(--bg-elev); background: var(--bg-elev);
  box-shadow: 0 10px 30px rgba(0,0,0,.45), 0 0 0 1px var(--line);
}
.fw-loupe-glass .fw { width: 148px; height: 148px; }
.fw-loupe-x {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px;
  margin: -11px 0 0 -11px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.9); box-shadow: 0 0 0 1px rgba(0,0,0,.5);
}
.fw-loupe-tip {
  position: absolute; left: 50%; top: 100%; transform: translate(-50%, 8px);
  white-space: nowrap; padding: 5px 12px; border-radius: 999px;
  font-size: 14px; font-weight: 800; color: #fff; background: var(--slate);
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}

/* Chosen feelings, shown on the check-in card. */
.feel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.feel-chip { padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; color: #fff; background: var(--fc, var(--slate)); }

/* Mood history: one card per day, holding everything that day recorded. */
.mood-day { padding: 12px 14px; margin-bottom: 8px; }
.mood-day.blank { opacity: 0.55; }
.mood-note {
  margin-top: 9px; padding: 8px 11px; border-radius: 10px;
  background: var(--bg); border-left: 3px solid var(--line);
  font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
}
.needs-pill {
  flex: none; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  color: var(--text-dim); background: var(--bg-elev-2); white-space: nowrap;
}
.needs-bar {
  height: 6px; border-radius: 999px; margin-top: 10px; overflow: hidden;
  background: linear-gradient(to right, var(--ok) 0 var(--met), var(--bg-elev-2) var(--met) 100%);
}
.moodbars.tappable > i { cursor: pointer; }
.moodbars.tappable > i:active { filter: brightness(1.3); }

/* ---- Photo gallery ------------------------------------------------------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 12px; }
.photo-cell {
  position: relative; aspect-ratio: 1 / 1; border: none; padding: 0;
  background: var(--bg-elev-2); border-radius: 10px; overflow: hidden; cursor: pointer;
  transition: transform 0.08s;
}
.photo-cell:active { transform: scale(0.96); }
.photo-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tag {
  position: absolute; left: 5px; bottom: 5px; max-width: 80%;
  background: rgba(0,0,0,0.55); color: #fff; font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Full-screen photo viewer */
.photo-viewer { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,0.93); display: flex; flex-direction: column; }
.photo-bar { display: flex; align-items: center; gap: 4px; padding: calc(6px + var(--sa-top)) 8px 6px; }
.photo-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.photo-full { width: 100%; height: 100%; object-fit: contain; }
.photo-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 46px; height: 66px; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.35); color: #fff; border: none; border-radius: 12px;
  font-size: 30px; line-height: 1; cursor: pointer;
}
.photo-nav.prev { left: 8px; }
.photo-nav.next { right: 8px; }
.photo-nav:active { background: rgba(0,0,0,0.55); }
.photo-nav.photo-nav-hide { display: none; }
.photo-meta { color: #fff; padding: 14px 18px calc(18px + var(--sa-bottom)); text-align: center; }
.photo-meta .faint { color: #c9c2d6; }

@media (min-width: 820px) {
  .photo-grid { grid-template-columns: repeat(5, 1fr); }
}

/* =========================================================================
   Plan — inline-editable day schedule + week grid
   ========================================================================= */
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 2px 0; }
.plan-date { flex: 1; background: transparent; border: none; color: var(--text); font-weight: 800; font-size: 17px; padding: 8px; border-radius: 10px; cursor: pointer; }
.plan-date:active { background: var(--bg-elev-2); }

.plan-list { display: flex; flex-direction: column; gap: 8px; }
.plan-hint { color: var(--text-faint); font-size: 13.5px; text-align: center; padding: 22px 14px; line-height: 1.5; }
.plan-add {
  width: 100%; min-height: var(--tap);
  border: 1px dashed var(--line); background: transparent; color: var(--text-dim);
  border-radius: 13px; font-weight: 600; font-size: 14.5px; cursor: pointer; font-family: inherit;
}
.plan-add:active { background: var(--bg-elev-2); }

.blk { display: flex; align-items: center; gap: 10px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.blk-check { width: 24px; height: 24px; flex: none; border-radius: 7px; border: 2px solid var(--line); background: transparent; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; cursor: pointer; }
.blk-check.on { background: var(--grad); border-color: transparent; }
.blk-times { display: flex; flex-direction: column; gap: 5px; flex: none; }

/* Custom themed time pill (replaces the native time input) */
.timepill {
  min-height: 32px; padding: 5px 12px;
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text);
  border-radius: 10px; font-size: 13px; font-weight: 700; font-family: inherit;
  cursor: pointer; white-space: nowrap; text-align: center;
}
.timepill.empty { color: var(--text-faint); font-weight: 500; }
.timepill:active { transform: scale(0.96); background: var(--bg); }
.med-time.timepill { min-width: 96px; }
.blk-time {
  width: 92px; background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text); font-size: 13px; font-weight: 600; padding: 5px 8px; font-family: inherit;
  text-align: center; min-height: 30px;
  appearance: none; -webkit-appearance: none;
}
.blk-time:focus { border-color: var(--accent); outline: none; }
.blk-time::-webkit-calendar-picker-indicator { opacity: 0.5; margin-left: 2px; }
.med-time::-webkit-calendar-picker-indicator { opacity: 0.6; }
.blk-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.blk-title { width: 100%; background: transparent; border: none; color: var(--text); font-size: 15.5px; font-weight: 600; padding: 2px 0; font-family: inherit; }
.blk-title:focus { outline: none; }
.blk-title::placeholder { color: var(--text-faint); font-weight: 500; }
.blk-title.struck { text-decoration: line-through; color: var(--text-faint); }
.blk-sub { display: flex; align-items: center; gap: 9px; }
.blk-dot { width: 15px; height: 15px; border-radius: 50%; border: none; flex: none; cursor: pointer; }
.blk-who { background: transparent; border: none; font-size: 12px; font-weight: 700; cursor: pointer; padding: 0; }
.blk-del { width: 30px; height: 30px; flex: none; border: none; background: transparent; color: var(--text-faint); font-size: 13px; cursor: pointer; border-radius: 8px; }
.blk-del:active { background: var(--bg-elev-2); color: var(--danger); }

.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.week-col { background: var(--bg-elev); border: 1px solid var(--line); border-radius: 12px; padding: 6px 4px; min-height: 116px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; overflow: hidden; }
.week-col.today { border-color: var(--accent); }
.week-dh { display: flex; flex-direction: column; align-items: center; line-height: 1.1; margin-bottom: 2px; }
.week-wd { font-size: 9.5px; font-weight: 700; color: var(--text-faint); text-transform: uppercase; }
.week-dn { font-size: 15px; font-weight: 800; }
.week-col.today .week-dn { color: var(--accent); }
.week-empty { text-align: center; color: var(--text-faint); font-size: 12px; margin-top: 6px; }
.week-chip { font-size: 9.5px; line-height: 1.35; padding: 2px 4px; border-radius: 5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.week-ct { opacity: 0.75; }
.week-more { font-size: 9.5px; color: var(--text-faint); text-align: center; }

/* =========================================================================
   Cycle — calendar states + logging panel
   ========================================================================= */
.cyc-hero { background: linear-gradient(140deg, color-mix(in srgb, var(--rose) 28%, var(--bg-elev)), color-mix(in srgb, var(--indigo) 20%, var(--bg-elev))); }
.cyc-cell { overflow: visible; }
.cyc-cell.fertile { background: color-mix(in srgb, var(--teal) 20%, var(--bg-elev)); }
.cyc-cell.predicted { border: 1.5px dashed color-mix(in srgb, var(--rose) 70%, var(--line)); }
.cyc-cell.period { background: var(--rose); border-color: transparent; }
.cyc-cell.period .cal-num { color: #fff; font-weight: 800; }
.cyc-cell.ovul { box-shadow: inset 0 0 0 2px var(--teal); }
.cyc-mark { position: absolute; bottom: 3px; font-size: 15px; line-height: 0; }
.cyc-mood { flex: 1; aspect-ratio: 1; max-width: 58px; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; font-size: 22px; cursor: pointer; transition: transform 0.1s, border-color 0.15s, background 0.15s; }
.cyc-mood.on { border-color: var(--accent); background: var(--bg-elev-2); transform: translateY(-1px) scale(1.05); }
.cyc-legend { display: flex; gap: 16px; justify-content: center; margin: 12px 0 4px; }
.cyc-leg { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.cyc-leg i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }

/* =========================================================================
   Log — meals / movement / water / routine rows
   ========================================================================= */
.log-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.log-row:last-child { border-bottom: none; }
.log-slot { width: 34px; height: 34px; flex: none; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; font-size: 16px; cursor: pointer; }
.log-slot.static { border: none; background: transparent; }
.log-numwrap { display: flex; align-items: center; gap: 2px; flex: none; }
.log-num { width: 52px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-size: 13px; padding: 5px 6px; text-align: right; font-family: inherit; appearance: none; -webkit-appearance: none; }
.log-unit { font-size: 11px; color: var(--text-faint); }
.poop-count { flex: none; min-width: 56px; text-align: center; font-size: 30px; font-weight: 800; }
.poop-bar { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-elev); }
.poop-bar-ic { font-size: 20px; }
.poop-bar-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 18px; font-weight: 700; cursor: pointer; }
.poop-bar-btn.add { background: var(--grad); border: none; color: #fff; }
.poop-bar-n { cursor: pointer; padding: 6px 0; min-width: 26px; text-align: center; font-size: 20px; font-weight: 800; }
.poop-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.poop-cal-wd { text-align: center; font-size: 11px; color: var(--text-faint); padding-bottom: 2px; }
.poop-cal-day { position: relative; aspect-ratio: 1; min-height: 40px; border: 1px solid transparent; border-radius: 10px; background: var(--bg); color: var(--text); padding: 3px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: inherit; }
.poop-cal-day.today { border-color: var(--line); }
.poop-cal-day.sel { border-color: var(--accent); }
.poop-cal-day.future { opacity: 0.35; cursor: default; }
.poop-cal-date { position: absolute; top: 3px; left: 5px; font-size: 10px; color: var(--text-faint); }
.poop-cal-n { font-size: 17px; font-weight: 800; }
.poop-cal-flag { position: absolute; bottom: 1px; right: 3px; font-size: 9px; }
.poop-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.poop-stat { text-align: center; background: var(--bg); border-radius: 10px; padding: 8px 2px; }
.poop-stat-n { font-size: 18px; font-weight: 800; }
.poop-stat-l { font-size: 11px; color: var(--text-faint); }
.poop-split { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 12px; gap: 2px; }
.poop-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.poop-day { text-align: center; padding: 6px 0 4px; border-radius: 10px; background: var(--bg); }
.poop-day.cur { outline: 1px solid var(--accent); }
.poop-day.future { opacity: 0.35; }
.poop-n { font-size: 17px; font-weight: 800; line-height: 1.2; }
.poop-wd { font-size: 11px; color: var(--text-faint); }
.med-time { width: 98px; flex: none; }
.card-x { flex: none; width: 26px; height: 26px; border: none; background: transparent; color: var(--text-faint); font-size: 12px; cursor: pointer; border-radius: 8px; margin-left: 6px; }
.card-x:active { background: var(--bg-elev-2); color: var(--danger); }

/* =========================================================================
   Landscape / tablet: move the tab bar to a vertical side rail.
   Kicks in whenever the screen is wider than tall and roomy enough (tablets
   and large phones in landscape). Portrait keeps the bottom bar.
   ========================================================================= */
@media (orientation: landscape) and (min-width: 700px) {
  .app { padding-left: calc(88px + var(--sa-left)); }

  .tabbar {
    top: 0; bottom: 0; left: 0; right: auto;
    width: calc(88px + var(--sa-left));
    flex-direction: column; justify-content: flex-start; gap: 4px;
    transform: none; max-width: none; border-radius: 0;
    padding-top: calc(var(--sa-top) + 14px);
    padding-bottom: calc(var(--sa-bottom) + 14px);
    padding-left: var(--sa-left);
    border-top: none; border-right: 1px solid var(--line);
  }
  .tab { flex: none; width: 100%; min-height: 60px; padding: 6px 4px; }

  /* No bottom bar to clear anymore. */
  .screen { padding-bottom: calc(var(--sa-bottom) + 40px); }

  /* Keep the FAB clear of the left rail, anchored bottom-right of content. */
  .fab { left: auto; }

  /* Calendar fits the screen — the whole month is visible without page
     scrolling (great on the Fire HD 10 in landscape). The screen becomes a
     flex column so the month grid fills whatever height is left after the
     header; the day + Upcoming column scrolls on its own if it gets long. */
  .cal-screen { overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
  .cal-screen > .view-enter { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .cal-layout { flex: 1; min-height: 0; }
  .cal-main { height: 100%; display: flex; flex-direction: column; min-height: 0; }
  .cal-main .cal-grid { flex: 1; min-height: 0; margin-bottom: 0; grid-template-rows: auto repeat(6, 1fr); }
  /* The week time grid fills the leftover height instead of its 64vh cap. */
  .cal-main .wkt-scroll { flex: 1; min-height: 0; max-height: none; }
  .cal-cell, .wide .cal-cell { aspect-ratio: auto; min-height: 0; }
  .cal-side { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
}

/* ---- Scrollable emoji picker (js/emoji.js) ------------------------------- */
.emoji-panel {
  max-height: 220px; overflow-y: auto; -webkit-overflow-scrolling: touch;
  margin-top: 6px; padding: 4px 8px 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  overscroll-behavior: contain;
}
.emoji-cat {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg);
  font-size: 11px; font-weight: 700; color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.5px; padding: 6px 2px 4px;
}
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.emoji-btn {
  font-size: 22px; line-height: 1; padding: 6px 0; border-radius: 8px;
  background: transparent; border: none; cursor: pointer;
}
.emoji-btn:active { background: var(--bg-elev-2); transform: scale(0.9); }
.emoji-btn.on { background: color-mix(in srgb, var(--accent) 28%, transparent); }

/* ---- Board drag-to-reorder (timeless tasks) ------------------------------ */
.task-grip {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 22px; margin: 0 -2px 0 -5px; color: var(--text-faint);
  cursor: grab; touch-action: none;
}
.task-grip:active { cursor: grabbing; }
.task-card.dragging {
  transform: none; position: relative; z-index: 5;
  opacity: 0.96; box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

/* ---- Board: what you picked for an options task -------------------------- */
.task-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.task-sub:empty { display: none; }

/* ---- Bingo goals card ---------------------------------------------------- */
/* The whole sheet has to be visible at a glance: the grid is square, so cap it
   by the viewport height as well as the card width, then size the text off the
   cell width so bigger boards keep readable labels. */
.bingo-grid {
  display: grid; gap: 5px; --cells: 5;
  width: 100%; max-width: min(100%, 58vh); margin-inline: auto;
  container-type: inline-size;
}
.bingo-cell {
  position: relative; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 6px 5px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-elev); color: var(--text);
  font-size: clamp(10.5px, calc(100cqw / var(--cells) * 0.175), 17px);
  font-weight: 600; line-height: 1.2; text-align: center;
  cursor: pointer; overflow: hidden; transition: transform .08s, background .15s;
}
.bingo-cell > span { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bingo-cell:active { transform: scale(0.95); }
.bingo-cell.blank { color: var(--text-faint); font-size: clamp(18px, calc(100cqw / var(--cells) * 0.28), 30px); border-style: dashed; }
.bingo-cell.on { background: color-mix(in srgb, var(--accent) 26%, var(--bg-elev)); border-color: var(--accent); }
.bingo-cell.won { background: color-mix(in srgb, var(--accent) 46%, var(--bg-elev)); box-shadow: inset 0 0 0 2px var(--accent); }
.bingo-cell:disabled { cursor: default; opacity: 0.85; }

/* ---- Workout flow player (full-screen, hands-free) ----------------------- */
.flow-player {
  position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: flex; align-items: stretch; justify-content: center;
  padding: calc(14px + var(--sa-top)) 16px calc(14px + var(--sa-bottom));
}
.flow-inner { width: 100%; max-width: 460px; display: flex; flex-direction: column; }
.flow-bar { height: 4px; border-radius: 3px; background: var(--bg-elev-2); overflow: hidden; margin: 12px 0 4px; }
.flow-bar > i { display: block; height: 100%; background: var(--accent); transition: width 0.9s linear; }
.flow-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 20px 4px; }
.flow-count { font-size: 60px; font-weight: 800; line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; }
.flow-step { font-size: 22px; font-weight: 800; line-height: 1.2; }
.flow-cue { font-size: 14.5px; color: var(--text-dim); line-height: 1.55; max-width: 34ch; }
.flow-pos { text-align: center; font-size: 12px; color: var(--text-faint); }

/* ---- Anniversary counters, in the top row beside the 👅 / ❤️ ------------- */
.appbar-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.together-mini {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  gap: 3px;                          /* the two counters were touching */
  flex: none; border: none; background: none;
  padding: 2px 8px 2px 0; margin: 0;
  cursor: pointer; line-height: 1.2;
}
.together-mini[hidden] { display: none; }
.together-item { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.together-name { font-size: 10px; line-height: 1.1; color: var(--text-faint); }
.together-val {
  font-size: 11px; font-weight: 800; color: var(--text-dim);
  font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.together-item.today .together-val { color: var(--rose); }
/* On a narrow phone the title yields before the counters wrap. */
.appbar-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appbar-row > .row { min-width: 0; flex: 1 1 auto; }
.appbar-actions { flex: 0 0 auto; }

/* ---- The idea bubble (drag it anywhere, tap to jot) ---------------------- */
.idea-bubble {
  position: fixed; z-index: 35;
  width: 52px; height: 52px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; line-height: 1;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--line));
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-elev));
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
  transition: transform 0.12s, box-shadow 0.12s;
}
.idea-bubble:active { transform: scale(0.92); }
.idea-bubble.dragging { cursor: grabbing; transform: scale(1.08); box-shadow: 0 10px 26px rgba(0, 0, 0, 0.36); transition: none; }
/* Out of the way of the tab bar's safe area on short screens. */
@media (max-height: 520px) { .idea-bubble { width: 44px; height: 44px; font-size: 20px; } }

/* ---- House screen (a wall tablet, no chrome) ----------------------------- */
/* Everything is sized in vmin so the same layout reads on a 7" hand-me-down
   and a 12" tablet without a media query per device. */
.kiosk-mode .appbar, .kiosk-mode .tabbar { display: none !important; }
.kiosk-mode .screen { padding: 0; max-width: none; height: 100dvh; }
.kiosk-mode .idea-bubble { display: none; }

.kiosk {
  position: relative;
  min-height: 100dvh;
  display: flex; flex-direction: column; gap: 2.2vmin;
  padding: calc(3vmin + var(--sa-top)) calc(3.5vmin + var(--sa-right)) calc(3vmin + var(--sa-bottom)) calc(3.5vmin + var(--sa-left));
}
.kiosk-loading { text-align: center; padding: 40px; color: var(--text-faint); }

.kiosk-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 3vmin; }
.kiosk-date { font-size: clamp(13px, 2.6vmin, 24px); font-weight: 700; color: var(--text-dim); }
.kiosk-clock { font-size: clamp(34px, 11vmin, 118px); font-weight: 800; line-height: 0.95; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.kiosk-wx { display: flex; flex-direction: column; gap: 0.6vmin; text-align: right; flex: none; }
.kiosk-wx-row { display: flex; gap: 1.4vmin; align-items: baseline; justify-content: flex-end; }
.kiosk-wx-who { font-size: clamp(11px, 2vmin, 18px); font-weight: 800; }
.kiosk-wx-val { font-size: clamp(13px, 2.5vmin, 23px); font-weight: 700; white-space: nowrap; }

.kiosk-togethers { display: flex; gap: 2vmin; flex-wrap: wrap; }
.kiosk-together {
  flex: 1 1 44%; min-width: 0;
  background: linear-gradient(135deg, color-mix(in srgb, var(--rose) 16%, var(--bg-elev)), var(--bg-elev) 76%);
  border: 1px solid color-mix(in srgb, var(--rose) 26%, var(--line));
  border-radius: 2vmin; padding: 1.6vmin 2vmin;
}
.kiosk-together-label { font-size: clamp(9px, 1.7vmin, 15px); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.kiosk-together-big { font-size: clamp(15px, 3.4vmin, 32px); font-weight: 800; line-height: 1.15; margin-top: 0.4vmin; }
.kiosk-together-sub { font-size: clamp(10px, 1.8vmin, 16px); color: var(--text-faint); margin-top: 0.3vmin; }

.kiosk-hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 1vmin; padding: 1vmin 0;
}
.kiosk-hero-label { font-size: clamp(11px, 2vmin, 19px); font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); }
.kiosk-trip { font-size: clamp(22px, 6vmin, 62px); font-weight: 800; line-height: 1.05; }
.kiosk-count { display: flex; align-items: baseline; gap: 0.8vmin; flex-wrap: wrap; justify-content: center; margin-top: 0.5vmin; }
.kiosk-num { font-size: clamp(38px, 13vmin, 150px); font-weight: 800; line-height: 0.9; color: var(--accent); font-variant-numeric: tabular-nums; }
.kiosk-unit { font-size: clamp(15px, 4vmin, 42px); font-weight: 700; color: var(--text-dim); margin-right: 1.6vmin; }
.kiosk-trip-sub { font-size: clamp(11px, 2.1vmin, 20px); color: var(--text-dim); }
.kiosk-trip-wx { font-weight: 700; }

.kiosk-next { display: flex; flex-direction: column; gap: 1vmin; }
.kiosk-next-row { display: flex; align-items: center; gap: 2vmin; background: var(--bg-elev); border-radius: 1.6vmin; padding: 1.2vmin 2vmin; }
.kiosk-next-days { font-size: clamp(16px, 3.6vmin, 34px); font-weight: 800; color: var(--accent); min-width: 2.4em; text-align: right; font-variant-numeric: tabular-nums; }
.kiosk-next-body { min-width: 0; }
.kiosk-next-title { font-size: clamp(12px, 2.4vmin, 22px); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kiosk-next-when { font-size: clamp(10px, 1.8vmin, 16px); color: var(--text-faint); }

/* Deliberately faint — it's there to get out, not to be pressed by accident. */
.kiosk-exit {
  position: absolute; top: calc(1.5vmin + var(--sa-top)); right: calc(1.5vmin + var(--sa-right));
  width: 40px; height: 40px; border-radius: 50%;
  border: none; background: transparent; color: var(--text-faint);
  font-size: 17px; cursor: pointer; opacity: 0.35;
}
.kiosk-exit:active { opacity: 1; }

/* The ticking half of an anniversary counter. */
.together-clock { font-size: 10px; font-weight: 700; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.kiosk-together-clock { font-size: clamp(12px, 2.4vmin, 22px); font-weight: 800; color: var(--rose); font-variant-numeric: tabular-nums; margin-top: 0.2vmin; }

/* ---- Ducks (getting them in a row) --------------------------------------- */
/* One duck is drawn once and tinted by the `color` of its container, so a
   whole pondful costs one path set. */
.duck-svg { display: block; overflow: visible; transform: scaleX(var(--flip, 1)); }
.d-body { fill: currentColor; }
.d-hi   { fill: rgba(255, 255, 255, 0.22); }
.d-wing { fill: rgba(0, 0, 0, 0.14); }
.d-beak, .d-foot { fill: #f0952f; }
.d-eye  { fill: #221d2b; }

.duck-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.duck-count { font-weight: 700; text-transform: none; letter-spacing: 0; color: var(--text-faint); }
.duck-mute { font-size: 17px; flex: none; }

/* ---- the pond ---- */
.pond {
  position: relative; overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
  background:
    radial-gradient(130% 90% at 18% -10%, color-mix(in srgb, var(--blue) 34%, transparent), transparent 68%),
    linear-gradient(180deg, color-mix(in srgb, var(--blue) 27%, var(--bg-elev)), color-mix(in srgb, var(--indigo) 21%, var(--bg-elev)));
  padding: 16px 8px 18px;
  min-height: 116px;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.pond .ripple {
  position: absolute; pointer-events: none; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.pond .r1 { width: 190px; height: 46px; left: -40px; top: 22%; animation: pond-drift 17s linear infinite; }
.pond .r2 { width: 130px; height: 34px; right: -30px; top: 58%; animation: pond-drift 23s linear infinite reverse; }
.pond .r3 { width: 240px; height: 60px; left: 30%; bottom: -14px; animation: pond-drift 29s linear infinite; }
@keyframes pond-drift { from { transform: translateX(-14px); } 50% { transform: translateX(14px); } to { transform: translateX(-14px); } }

.pond-grid { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 14px 0; }
.pond-empty, .bank-empty {
  position: relative; z-index: 1;
  text-align: center; color: var(--text-dim); font-size: 13px; font-weight: 600;
  padding: 26px 18px; line-height: 1.5; max-width: 300px; margin: 0 auto;
}

/* ---- one duck in place ---- */
.duck-slot {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 0 2px;
  background: none; border: none;
  touch-action: pan-y;
  transition: opacity 0.15s, margin 0.16s cubic-bezier(.2,.7,.3,1);
}
.duck-wrap { position: relative; transform: translate(var(--jx, 0px), var(--jy, 0px)) rotate(var(--rot, 0deg)); }
.duck-bob { animation: duck-bob var(--dur, 3.6s) ease-in-out infinite; animation-delay: var(--delay, 0s); }
@keyframes duck-bob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-5px) rotate(-2.5deg); }
}
/* On land they waddle instead of bob. */
.duck-bob.walking { animation-name: duck-waddle; animation-duration: 1.5s; }
@keyframes duck-waddle {
  0%, 100% { transform: rotate(-3.5deg) translateY(0); }
  50%      { transform: rotate(3.5deg) translateY(-2px); }
}
/* The little wake a floating duck leaves. */
.duck-ripple {
  position: absolute; left: 50%; bottom: -5px; width: 46px; height: 10px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.30), transparent 75%);
  animation: duck-wake 3.6s ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes duck-wake { 0%, 100% { transform: translateX(-50%) scale(1); opacity: .75; } 50% { transform: translateX(-50%) scale(1.28); opacity: .35; } }

.duck-name {
  font-size: 11px; font-weight: 700; line-height: 1.2; text-align: center;
  max-width: 100px; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.duck-num {
  position: absolute; top: -4px; left: -2px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 999px;
  background: var(--bg-elev); border: 1px solid var(--line);
  color: var(--text-dim); font-size: 10.5px; font-weight: 800; line-height: 16px; text-align: center;
}
.duck-shared { position: absolute; top: -2px; right: 0; font-size: 10px; opacity: .7; }

/* ---- the bank (the row) ---- */
.bank {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--ok) 26%, var(--line));
  background-image:
    repeating-linear-gradient(78deg, color-mix(in srgb, var(--ok) 45%, transparent) 0 2px, transparent 2px 9px),
    linear-gradient(180deg, color-mix(in srgb, var(--ok) 7%, var(--bg-elev)), color-mix(in srgb, var(--ok) 19%, var(--bg-elev)));
  background-size: 100% 15px, 100% 100%;
  background-position: bottom left, top left;
  background-repeat: repeat-x, no-repeat;
  padding: 12px 10px 16px;
  overflow-x: auto;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.bank.drop-hint { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.bank.drop-ready {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 45%, transparent);
  transform: scale(1.01);
}
.row-strip { display: flex; align-items: flex-end; gap: 6px; min-height: 92px; width: max-content; min-width: 100%; }
.row-strip .duck-slot { flex: none; width: 88px; touch-action: auto; }
/* Where a dragged-in duck would land. */
.row-strip .duck-slot.gap-before { margin-left: 40px; }
.row-strip .duck-slot.gap-after  { margin-right: 40px; }

/* ---- picking one up ---- */
.duck-ghost {
  position: fixed; z-index: 60; pointer-events: none;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.35));
  transition: none;
}
.duck-ghost .duck-bob { animation-duration: 0.7s; }
.duck-slot.lifted { opacity: 0.22; }
.duck-slot.dragging { z-index: 5; transition: none; filter: drop-shadow(0 10px 14px rgba(0, 0, 0, 0.32)); }
.duck-slot.escaping { opacity: 0.85; filter: drop-shadow(0 16px 20px rgba(0, 0, 0, 0.4)); }
.duck-slot.flying { opacity: 0; transform: translateY(-60px) scale(0.7) !important; transition: all 0.25s ease; }

/* ---- all of them, finally, in a row ---- */
.ducks-win {
  border-color: color-mix(in srgb, var(--amber) 45%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--amber) 20%, var(--bg-elev)), color-mix(in srgb, var(--teal) 14%, var(--bg-elev)) 70%);
}
.ducks-win .win-line { margin-top: 10px; font-size: 19px; letter-spacing: 4px; text-align: center; animation: win-march 2.4s ease-in-out infinite; }
@keyframes win-march { 0%, 100% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }

.duck-confetti {
  position: fixed; top: -30px; z-index: 70; pointer-events: none;
  animation: duck-fall 2.6s cubic-bezier(.35,.1,.6,1) forwards;
}
@keyframes duck-fall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translateY(105vh) rotate(420deg); opacity: 0; }
}

/* ---- the duck sheet ---- */
.duck-preview { display: flex; justify-content: center; padding: 4px 0 14px; }
.duck-field { margin-bottom: 12px; }
.duck-field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.duck-swatches { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.duck-swatch {
  padding: 5px 6px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg-elev-2);
  line-height: 0;
}
.duck-swatch.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--bg-elev-2)); }
.duck-swatch:active { transform: scale(0.93); }

.duck-parade { display: flex; justify-content: center; align-items: flex-end; gap: 2px; }
.flown-head {
  display: flex; justify-content: space-between; align-items: center; width: 100%;
  padding: 14px 14px; font-size: 14px; font-weight: 700;
}


/* ===========================================================================
   MOTION & POLISH — the shared feel of the main app
   Everything here is a primitive the views already use; nothing below is
   view-specific. The doll module resolves through the same tokens and is left
   exactly as it was.
   =========================================================================== */

/* A tick landing: a small overshoot, the way a native checkbox settles. */
@keyframes check-pop { 0% { transform: scale(0.75); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* ---- Skeleton while a screen loads ------------------------------------------
   Replaces the "Loading…" line. Held invisible for the first beat so a fetch
   that comes back in 100ms never flashes anything at all; a slow one gets a
   shimmer in the shape of what's coming. util.js/loading() builds it. */
.skel { padding: 4px 2px; opacity: 0; animation: skel-in 0.35s var(--ease) 0.2s forwards; }
@keyframes skel-in { to { opacity: 1; } }
.skel-line, .skel-card {
  display: block; border-radius: 8px; margin: 0 0 10px;
  background: linear-gradient(90deg, var(--bg-elev-2) 25%, color-mix(in srgb, var(--text) 9%, var(--bg-elev-2)) 50%, var(--bg-elev-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skel-line { height: 14px; width: 100%; }
.skel-line.w60 { width: 60%; height: 18px; border-radius: 9px; }
.skel-line.w80 { width: 80%; }
.skel-line.w40 { width: 40%; }
.skel-card { height: 92px; border-radius: var(--radius); margin-top: 14px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---- Pull to refresh ----------------------------------------------------------
   A ring that rides down with the finger from under the app bar, spins while
   the screen rebuilds, and tucks away. app.js/wirePullToRefresh drives it. */
.ptr {
  position: fixed; left: 50%; z-index: 22;
  top: calc(var(--sa-top) + var(--header-h) + 6px);
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-elev); box-shadow: var(--shadow-2), 0 0 0 1px var(--card-border);
  transform: translate(-50%, -64px) scale(0.6); opacity: 0;
  transition: transform 0.3s var(--ease-spring), opacity 0.2s;
  pointer-events: none;
}
.ptr.pulling { transition: none; }
.ptr.loading { transform: translate(-50%, 8px) scale(1); opacity: 1; }
.ptr-spin {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent);
  transform: rotate(var(--ptr-rot, 0deg));
}
.ptr.loading .ptr-spin { animation: spin 0.8s linear infinite; }

/* ---- Small things that add up ------------------------------------------------ */
.screen { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--text) 18%, transparent) transparent; }
.pill { letter-spacing: 0.01em; }
.timepill { transition: transform 0.15s var(--ease-spring), background 0.15s; }
.day-drop, .board-sec, .plan-add, .step { transition: transform 0.15s var(--ease-spring), background 0.15s, border-color 0.15s; }
.day-drop:active, .plan-add:active { transform: scale(0.98); }
.emoji-scale button, .cyc-mood { transition: transform 0.18s var(--ease-spring), border-color 0.15s, background 0.15s; }
.splash-mark { animation: pop 0.7s var(--ease-spring); }
.splash-name { letter-spacing: -0.02em; }
.ac-menu { box-shadow: var(--shadow-2); border-color: var(--card-border); }
.blk { box-shadow: var(--shadow-1); border-color: var(--card-border); }
.week-col, .solar-stat, .solar-recap-c { border-color: var(--card-border); box-shadow: var(--shadow-1); }
.board-sec { box-shadow: var(--shadow-1); }
.hero { border-color: var(--card-border); }
/* Dark mode keeps hairlines; in light the interior cards inside a card do too,
   or they vanish into the white behind them. */
.card .card, .card .solar-stat, .card .solar-recap-c, .card .week-col { border-color: var(--line); box-shadow: none; }

/* A card or row that was built with a tap handler (util.js/el marks it) gives
   under the finger the way a button does. */
.card[data-tap], .list-item[data-tap] { cursor: pointer; transition: transform 0.16s var(--ease-spring), background 0.15s, box-shadow 0.16s; }
.card[data-tap]:active { transform: scale(0.985); }

/* Coarse pointers (phones): none of the hover-only affordances; keep every
   press response instant. */
@media (hover: hover) {
  .btn:hover { filter: brightness(1.04); }
  .list-item[data-tap]:hover, .icon-btn:hover { background: var(--press); }
  .chip:hover:not(.on) { border-color: color-mix(in srgb, var(--text) 25%, var(--line)); }
}

/* ===========================================================================
   HOME MODULE
   Uses the app's own palette and shapes — same cards, same radius, same accent,
   so it reads as part of CJ Plans rather than a separate skin. Light/dark and
   any accent change come free because everything below resolves through the
   :root tokens.
   =========================================================================== */

/* ---- app-bar 🏠 button --------------------------------------------------- */
/* Far left; the negative margin pulls it back onto the row's own 16px padding
   so the title doesn't lose a tap target of width at 360px. */
/* Accented, unlike every other app-bar icon, so the way back into the panel is
   recognisable from anywhere in the app rather than reading as a generic home. */
.home-btn { flex: none; margin-left: -8px; color: var(--accent); }

.doll { padding-bottom: 96px; }
.doll-title {
  font-size: 13px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.6px; margin: 0 0 10px;
}
.doll-subtitle {
  font-size: 13px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.6px; margin: 0 0 10px;
}
.doll-card {
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.doll-quiet { color: var(--text-faint); font-size: 13.5px; margin: 0; line-height: 1.5; }
.doll-plain { color: var(--text); font-size: 15px; margin: 0; line-height: 1.5; }
.doll-rule { height: 1px; background: var(--line); margin: 16px 0 14px; }

/* 1. state band — every state is warm. A bad-doll day reads as a note, never
   as an alarm, so none of these three uses the danger colour. */
.doll-band {
  border-radius: var(--radius-sm); padding: 13px 16px; margin-bottom: 8px;
  border: 1px solid var(--line); background: var(--bg-elev);
  font-size: 16px; font-weight: 600;
}
.doll-band.is-good    { border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); background: color-mix(in srgb, var(--amber) 12%, var(--bg-elev)); }
.doll-band.is-neutral { border-color: var(--line); background: var(--bg-elev); }
.doll-band.is-bad     { border-color: color-mix(in srgb, var(--rose) 38%, var(--line)); background: color-mix(in srgb, var(--rose) 10%, var(--bg-elev)); }
.doll-band.is-unset   { color: var(--text-faint); font-weight: 500; }
.doll-phrase {
  font-size: 15px; font-style: italic; color: var(--text-dim);
  margin: 0 0 14px; padding: 0 4px; line-height: 1.5;
}

/* Her "I'm wet" tap — under the band, above everything owed. Rose because it
   is the one control on this page that is only ever hers to offer. The settled
   state is quieter than the ready one on purpose: it has already been said. */
.doll-wet {
  display: block; width: 100%; min-height: var(--tap); margin: 0 0 10px;
  border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--rose) 45%, var(--line));
  background: color-mix(in srgb, var(--rose) 14%, var(--bg-elev));
  color: var(--text); font: inherit; font-size: 15px; font-weight: 600;
  padding: 12px 14px; letter-spacing: 0.2px;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}
.doll-wet:active { transform: scale(0.99); }
.doll-wet.is-sent {
  background: transparent; border-color: var(--line);
  color: var(--text-faint); font-weight: 500; cursor: default;
}

/* 2/5. ritual + maintenance steps */
.doll-step {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px; min-height: var(--tap); cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.doll-step:last-child { border-bottom: none; }
.doll-tick { color: var(--text-faint); font-size: 13px; width: 14px; flex: none; }
.doll-step.on .doll-tick { color: var(--accent); }
.doll-step-text { flex: 1; font-size: 15px; line-height: 1.35; }
.doll-step.on .doll-step-text { color: var(--text-dim); }
.doll-mini {
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text);
  border-radius: 10px; font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 7px 13px; cursor: pointer;
}

/* 3. instructions */
.doll-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px; min-height: var(--tap); border-bottom: 1px solid var(--line);
}
.doll-row:last-of-type { border-bottom: none; }
.doll-row-text { flex: 1; font-size: 15px; line-height: 1.35; }
.doll-row.on .doll-row-text { color: var(--text-dim); }
.doll-row-state { font-size: 12.5px; color: var(--text-faint); }
/* A second line inside a row: what was asked for, kept under the date so a
   confirmed window still says what he agreed to. */
.doll-rownote { display: block; font-size: 12px; color: var(--text-faint); line-height: 1.4; margin-top: 2px; }
.doll-tag {
  font-size: 11px; font-weight: 700; color: var(--accent);
  border: 1px solid var(--line); border-radius: 8px; padding: 3px 7px;
}
/* Locked, not hidden — the sequence is meant to be legible. */
.doll-cam {
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--accent);
  width: 42px; height: 38px; border-radius: 10px; font-size: 15px; cursor: pointer; flex: none;
}
/* "Can't today" — same tap weight as everything else, never styled as failure. */
.doll-cant-row { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.doll-cant {
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text-dim);
  border-radius: 13px; font: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 18px; min-height: var(--tap); cursor: pointer;
}
.doll-row.set-aside .doll-row-text { color: var(--text-faint); }
.doll-linkbtn {
  border: none; background: none; color: var(--text-faint); font: inherit;
  font-size: 12.5px; text-decoration: underline; cursor: pointer; padding: 6px 4px;
}

/* 4. presentation */
.doll-pres {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 15px;
}
.doll-pres:last-of-type { border-bottom: none; }
.doll-pres-slot { color: var(--text-faint); font-size: 13px; }
.doll-pres-val { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
/* One piece on her page: its photograph, then what he called it. */
.doll-piece { display: flex; align-items: center; gap: 10px; text-align: right; }
/* Setting it, on the card. A slot is a name, the pieces on it, a box to type
   into, and — folded away — her closet for that slot. No sheet: the popup this
   replaced hid what she was already wearing behind the button that opened it. */
.doll-slot { padding: 12px 0 6px; border-top: 1px solid var(--line); }
.doll-slot:first-of-type { border-top: none; }
.doll-slot-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; min-height: 26px; margin-bottom: 8px;
}
.doll-slot-name {
  font-size: 13px; font-weight: 700; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.6px;
}
.doll-slot-on { margin-bottom: 10px; }
/* The piece, not just its name. A slot stores what he TYPED, so the picture is
   found by matching the word against her closet (pieceFor) — anything he wrote
   himself simply has no thumbnail and reads as a word. */
.doll-thumb {
  width: 26px; height: 26px; flex: none; display: block;
  border-radius: 7px; object-fit: cover; background: var(--bg-elev-2);
}
.doll-thumb.is-big { width: 44px; height: 44px; border-radius: 9px; }
.doll-chip-pic { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px 6px 6px; }
/* A piece that's on her, and the way it comes off: the × is part of the chip,
   so taking a top off is the same one tap that put it on. */
.doll-chip-x { margin-left: 8px; color: var(--text-faint); font-size: 15px; line-height: 1; }
.doll-chip.on .doll-chip-x { color: var(--accent); }
.doll-slot-in { margin-bottom: 8px; }
.doll-slot .doll-rail { margin-top: 6px; }

/* The instruction IS the input — tap the words and fix them, no sheet, no edit
   mode. Bare until it's touched, so a list of five still reads as a list. */
.doll-inline-in {
  flex: 1; min-height: 40px; padding: 8px 10px; font-size: 15px;
  background: none; border-color: transparent;
}
.doll-inline-in:focus { background: var(--bg); border-color: var(--accent); }
.doll-addbox { margin-top: 12px; }

/* Tomorrow's presentation on her page: the same rows, set apart and dimmed so
   they read as something to prepare for rather than something owed now. */
.doll-ahead { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.doll-ahead .doll-pres { opacity: 0.75; }
.doll-ahead .doll-pres:last-of-type { border-bottom: none; }

/* 5b. periodic maintenance — the gap is stated and nothing more. No colour
   coding by overdue-ness anywhere in this block, on purpose. */
.doll-periodic { margin-top: 12px; display: flex; flex-direction: column; }
.doll-since {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  border: none; background: none; color: var(--text-dim); font: inherit;
  font-size: 13.5px; text-align: left; padding: 10px 2px; min-height: var(--tap); cursor: pointer;
}
.doll-since-sep, .doll-since-when { color: var(--text-faint); }
/* Done for this cadence: the same filled bubble and the same softened text as a
   ticked daily item. There is deliberately no rule for the UNdone state beyond
   the empty circle — no colour, no weight, nothing that turns "weekly" into
   something she is failing. */
.doll-since.on .doll-tick { color: var(--accent); }
.doll-since.on .doll-since-text { color: var(--text-dim); }

/* 6. windows */
.doll-window { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.doll-window-state { color: var(--text-faint); font-size: 13px; }

/* 7. corrections */
.doll-correction { border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); }
.doll-corr-item { font-size: 15.5px; line-height: 1.4; }
.doll-corr-meta { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; }

.doll-btn {
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text);
  border-radius: 13px; font: inherit; font-size: 14.5px; font-weight: 600;
  padding: 12px 18px; min-height: var(--tap); cursor: pointer; margin-top: 12px;
}
.doll-btn.block { display: block; width: 100%; }
.doll-btn:active { transform: scale(0.98); }
.doll-btn.accent { background: var(--grad); border-color: transparent; color: #fff; }
.doll-pick {
  display: block; width: 100%; text-align: left; margin-bottom: 8px;
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text);
  border-radius: 13px; font: inherit; font-size: 15px; padding: 13px 14px;
  min-height: var(--tap); cursor: pointer;
}
.doll-check { display: flex; align-items: center; gap: 10px; padding: 10px 2px; font-size: 15px; }

/* ---- his side ------------------------------------------------------------ */
.doll-pending { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
/* Every pending line is a door to the card that settles it. */
.doll-owed {
  display: flex; align-items: flex-start; gap: 10px; width: 100%;
  padding: 10px 2px; font: inherit; font-size: 14.5px; line-height: 1.4;
  min-height: var(--tap); text-align: left; cursor: pointer;
  border: none; background: none; color: var(--text);
}
.doll-owed:active { background: var(--bg-elev-2); border-radius: 10px; }
.doll-owed-dot { color: var(--accent); flex: none; }
.doll-owed-text { flex: 1; min-width: 0; }
.doll-owed-go { flex: none; color: var(--text-faint); font-size: 18px; line-height: 1; }

/* Where a pending line just took you. One pass, then it leaves you alone. */
@keyframes doll-flash {
  0%   { box-shadow: 0 0 0 2px transparent; }
  25%  { box-shadow: 0 0 0 2px var(--accent); }
  100% { box-shadow: 0 0 0 2px transparent; }
}
.doll-flash { animation: doll-flash 1.5s ease-out; }
.doll-glance {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 8px; margin-bottom: 12px;
}
.doll-glance-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.doll-glance-val { font-size: 15px; font-weight: 700; }
.doll-glance-lab { font-size: 10px; color: var(--text-faint); text-align: center; }
.doll-glance-note { margin: -4px 4px 12px; }
.doll-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.doll-shot {
  flex: none; width: 108px; border: 1px solid var(--line); background: var(--bg-elev-2);
  border-radius: var(--radius-sm); padding: 0 0 6px; cursor: pointer; overflow: hidden;
}
.doll-shot img { width: 100%; height: 108px; object-fit: cover; display: block; }
.doll-shot.seen { opacity: 0.5; }
.doll-shot-cap { display: block; font-size: 11px; color: var(--text-faint); padding: 6px 6px 0; text-align: left; }
.doll-review-img { width: 100%; border-radius: var(--radius-sm); display: block; }
.doll-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.doll-chip {
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text);
  border-radius: 11px; font: inherit; font-size: 13.5px; padding: 9px 12px; cursor: pointer;
}
.doll-chip.on { border-color: var(--accent); color: var(--accent); }
.doll-states { display: flex; gap: 8px; }
.doll-state-btn {
  flex: 1; border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text-dim);
  border-radius: 12px; font: inherit; font-size: 13px; font-weight: 600;
  padding: 12px 6px; min-height: var(--tap); cursor: pointer;
}
.doll-state-btn.on { border-color: var(--accent); color: var(--text); }

/* His read-only look at her page. Inert by construction — nothing inside can be
   tapped, so previewing can never write an action as her. */
.doll-previewbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 12px; font-size: 12.5px; color: var(--text-faint);
}
/* Inert, but NOT dimmed to the point of being hard to read — he needs to see
   exactly what she sees, state band included. */
.doll-preview { pointer-events: none; }
/* Live preview: he's testing her page for real, so everything works and nothing
   is dimmed. Taps write as her. */
.doll-preview.is-live { pointer-events: auto; opacity: 1; }
.doll-previewbar.is-live { border-style: solid; border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); color: var(--text); }
/* …except navigation. The correction line only switches which tab is shown, so
   it stays tappable in the preview; everything that would WRITE as her does not.
   Without this it looked broken from his side — the click went nowhere. */
.doll-preview .doll-nudge { pointer-events: auto; }

/* The line on her main page pointing at an open correction. It carries the TIER
   colour of the most severe one, matching the 4px bar on the correction cards
   themselves — so the colour means something. It used to be an amber wash, which
   read as the same element as the state band directly above it. */
.doll-nudge {
  --nt: var(--tier-light);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; margin-bottom: 12px; cursor: pointer;
  background: var(--bg-elev);
  border: 1px solid var(--line); border-left: 4px solid var(--nt);
  color: var(--text); border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; padding: 12px 14px; min-height: var(--tap);
}
.doll-nudge.is-firm    { --nt: var(--tier-firm); }
.doll-nudge.is-serious { --nt: var(--tier-serious); }
.doll-nudge-go { color: var(--text-faint); font-size: 17px; }
/* Sent back. Amber, the firm-correction colour: this is owed, not optional. */
.doll-nudge.is-again { --nt: var(--tier-firm); }
/* The same thing said down at the card that actually takes the new photo, so
   "take another one" sits next to the button that takes it. */
.doll-again { margin: 10px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--tier-firm); }
.doll-clear { padding: 40px 8px; text-align: center; }

/* Asks him a question; never announces a verdict about her. */
.doll-decide {
  margin: 12px 0 0; font-size: 13.5px; line-height: 1.5;
  color: var(--text-dim); font-style: italic;
}

/* Confirmations archive */
.doll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.doll-grid .doll-shot { width: auto; }

/* ---- her closet ---------------------------------------------------------- */
/* A horizontal rail when he's picking a slot, a grid when she's browsing. */
.doll-rail { display: flex; gap: 10px; overflow-x: auto; padding: 2px 0 6px; }
.doll-rail .doll-shot { flex: none; }
.doll-closet-tile { position: relative; }
/* Onto her, from the shelf, in one tap. Top-right so it clears the ★ (top-left)
   and the drag grip (bottom-right) — three corners, three different jobs. */
.doll-put {
  position: absolute; top: 5px; right: 5px;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; font-size: 15px; line-height: 1; font-weight: 700;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border: 1px solid var(--line); color: var(--text-dim); cursor: pointer;
}
.doll-put.on { background: var(--accent); border-color: transparent; color: #06201f; }
/* What he's building, at the top of his closet: the day, and every piece on her
   for it. He picks from here, so here is where it has to say what's set. */
.doll-dressing {
  position: sticky; top: 0; z-index: 3;
  max-height: 40vh; overflow-y: auto;
}
.doll-dressing .doll-slot { display: flex; align-items: baseline; gap: 10px; padding: 8px 0 2px; }
.doll-dressing .doll-slot-name { flex: 0 0 74px; }

.doll-closet-tile.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.doll-noimg {
  display: flex; align-items: center; justify-content: center;
  height: 108px; color: var(--text-faint); font-size: 20px; background: var(--bg-elev-2);
}

/* ---- time set aside ------------------------------------------------------ */
.doll-when { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.doll-when-day { font-size: 17px; font-weight: 700; }
.doll-when-time { font-size: 13px; color: var(--text-dim); }
/* A maintenance item he's switched off for the day, on his side only —
   she never sees a struck-through row. */
.doll-off { text-decoration: line-through; color: var(--text-faint); }

/* ---- unmet corrections --------------------------------------------------- */
/* Visible weight without alarm: amber, not --danger. She should know a
   consequence is involved; she should not be looking at a red error about
   herself. The tally is of what's outstanding now — clearing one removes it,
   so nothing here ever accumulates. */
.doll-tabcount {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--amber); color: #2a1f06;
  font-size: 11px; font-weight: 800; line-height: 18px; text-align: center; flex: none;
}
/* Her ask for a picture of him: same shape as the for-him button, outlined
   rather than filled, so the two read as a pair pointing opposite ways. */
.doll-forhim.is-ask { margin-top: 8px; background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.doll-forhim.is-ask .doll-forhim-cam { background: transparent; color: inherit; }

/* A correction past its clear-by turns the chip's number rose — warm, not
   --danger, like every state on her side. */
.doll-tabcount.is-hot { background: var(--rose); color: #fff; }
/* Emoji she sends back on an answer of his (Questions). Same pick buttons as
   the More row so it reads as part of the room, not a chat app. */
.doll-react { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.doll-react .doll-pickbtn { font-size: 17px; padding: 5px 9px; line-height: 1; }
.doll-react .doll-pickbtn.on { transform: scale(1.12); }
.doll-react-read { font-size: 20px; margin: 4px 0 0 2px; line-height: 1; }
.doll-strip-cell { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
.doll-strip-cell .doll-react-read { margin: 0; }
/* Chocolates: one stamp per piece, newest last, each a button so a wrong
   time can be put right. */
.doll-choc-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.doll-choc { border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
/* The mileage date grid: tap the days you made the same drive. */
.mi-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 6px 0 10px; }
.mi-grid .dow { font-size: 10.5px; color: var(--text-faint); text-align: center; font-weight: 700; }
.mi-grid button { min-height: 34px; border: 1px solid var(--line); background: var(--bg-elev); color: var(--text); border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; }
.mi-grid button.on { background: var(--accent); color: #fff; border-color: transparent; font-weight: 700; }
.mi-grid button.main { outline: 2px solid var(--accent); outline-offset: -2px; }
.mi-grid button:disabled { opacity: .35; cursor: default; }
.idea-img { display: block; width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius-sm); margin-top: 10px; }

/* Past its clear-by: same colour, more weight. Never a different, louder hue. */
.doll-nudge.is-unmet {
  background: color-mix(in srgb, var(--nt) 13%, var(--bg-elev));
  border-color: color-mix(in srgb, var(--nt) 45%, var(--line));
  border-left-color: var(--nt);
  font-weight: 600;
}
.doll-correction.is-unmet { border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); }
.doll-unmet-flag {
  display: inline-block; margin-bottom: 8px; padding: 3px 9px; border-radius: 8px;
  background: color-mix(in srgb, var(--amber) 22%, transparent);
  color: var(--amber); font-size: 11.5px; font-weight: 800; letter-spacing: 0.4px;
}
.doll-pending { margin: 10px 0 0; font-size: 14px; line-height: 1.5; color: var(--text); }
/* What she put forward, on both sides. */
.doll-offer {
  margin-top: 6px; padding: 9px 12px; font-size: 14.5px; line-height: 1.45;
  background: var(--bg-elev-2); border-radius: var(--radius-sm);
  border-left: 3px solid var(--amber);
}

/* ---- sleep (a protected domain — supported, never graded) ---------------- */
.doll-stamps { display: flex; gap: 10px; margin-top: 12px; }
.doll-stamp {
  flex: 1; min-height: var(--tap); border: 1px solid var(--line);
  background: var(--bg-elev-2); color: var(--text);
  border-radius: 13px; font: inherit; font-size: 14px; font-weight: 600;
  padding: 12px 10px; cursor: pointer;
}
.doll-stamp.done {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; cursor: pointer; background: transparent;
}
.doll-stamp-lab { font-size: 11px; color: var(--text-faint); }
.doll-stamp-val { font-size: 15px; font-weight: 700; }
.doll-alarms { display: flex; gap: 8px; margin-top: 10px; }
.doll-alarms .doll-mini { flex: 1; }

/* ---- records ------------------------------------------------------------- */
.doll-dayrow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--text);
  border-radius: var(--radius-sm); font: inherit; font-size: 14.5px;
  padding: 13px 14px; min-height: var(--tap); margin-bottom: 8px;
}
.doll-dayrow.on { border-color: var(--accent); }
.doll-dayrow-date { font-weight: 700; }
.doll-dayrow-bits { color: var(--text-faint); font-size: 12.5px; text-align: right; }
.doll-daydetail { margin-top: -2px; }

/* An editable library row — the label itself is the tap target. */
.doll-rowedit {
  flex: 1; text-align: left; border: none; background: none; color: var(--text);
  font: inherit; font-size: 15px; line-height: 1.35; padding: 4px 0; cursor: pointer;
}

/* Reordering a standing list, on the row itself rather than in a separate
   rearranging mode. Faint until touched: the order matters, but not enough to
   put two more pieces of furniture in front of the words. */
.doll-moves { display: flex; flex: none; gap: 2px; margin-left: 2px; }
.doll-move {
  border: none; background: none; color: var(--text-faint);
  font: inherit; font-size: 15px; line-height: 1;
  min-width: 30px; min-height: 34px; padding: 8px 6px;
  border-radius: var(--radius-sm); cursor: pointer;
}
.doll-move:hover:not([disabled]) { color: var(--text); background: var(--bg-elev-2); }
.doll-move[disabled] { opacity: .25; cursor: default; }

/* The daily reminder rows: the time first, because that is what you scan for
   when there is more than one. A switched-off row stays legible — it is a
   thing you turned off, not a thing that failed. */
.doll-remind-at {
  flex: none; min-width: 52px; font-variant-numeric: tabular-nums;
  font-size: 13px; font-weight: 700; color: var(--accent);
}
.doll-row.is-off .doll-remind-at { color: var(--text-faint); }
.doll-row.is-off .doll-rowedit { color: var(--text-faint); }

/* Sizes: the label on the left, the size itself in a box you type straight into.
   Narrow and right-aligned so a column of them reads as a table. */
.doll-sizeval {
  flex: 0 0 auto; width: 124px; min-height: 40px;
  text-align: right; padding: 8px 11px; font-size: 15px;
}
.doll-sizenote { display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* Her initial in the app bar — the panel's marker. Matches the avatars used on
   the board, and stays legible at 24px where a drawn glyph doesn't. */
/* (.home-initial retired — the app-bar mark is a bell again, see app.js) */

/* How often a maintenance item comes round, on his adjuster. A label, never a
   warning — no colour changes by how overdue something is. */
.doll-cadence { display: block; font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* ---- state and tier colour ------------------------------------------------
   Two ramps, defined once and used everywhere the pair shows up: her state band
   and his three state buttons; every correction and consequence card, on both
   sides. The aliases point at palette tokens, so the light theme's overrides
   follow automatically. */
:root {
  --state-good: var(--ok);
  --state-neutral: var(--slate);
  --state-bad: var(--rose);
  --tier-light: var(--blue);
  --tier-firm: var(--amber);
  --tier-serious: var(--rose);
}

.doll-band.is-good    { border-color: color-mix(in srgb, var(--state-good) 45%, var(--line)); background: color-mix(in srgb, var(--state-good) 12%, var(--bg-elev)); }
.doll-band.is-neutral { border-color: color-mix(in srgb, var(--state-neutral) 40%, var(--line)); background: color-mix(in srgb, var(--state-neutral) 10%, var(--bg-elev)); }
.doll-band.is-bad     { border-color: color-mix(in srgb, var(--state-bad) 40%, var(--line)); background: color-mix(in srgb, var(--state-bad) 12%, var(--bg-elev)); }

/* His three buttons carry the same colour unselected, so the choice reads
   before it's made — the selected one just fills in. */
.doll-state-btn.is-good    { --st: var(--state-good); }
.doll-state-btn.is-neutral { --st: var(--state-neutral); }
.doll-state-btn.is-bad     { --st: var(--state-bad); }
.doll-state-btn.is-good, .doll-state-btn.is-neutral, .doll-state-btn.is-bad {
  border-color: color-mix(in srgb, var(--st) 34%, var(--line));
  color: color-mix(in srgb, var(--st) 62%, var(--text-dim));
}
.doll-state-btn.is-good.on, .doll-state-btn.is-neutral.on, .doll-state-btn.is-bad.on {
  border-color: var(--st);
  background: color-mix(in srgb, var(--st) 18%, var(--bg-elev-2));
  color: var(--text);
}

/* The state as read back in Records. */
.doll-state-val.is-good    { color: var(--state-good); }
.doll-state-val.is-neutral { color: var(--state-neutral); }
.doll-state-val.is-bad     { color: var(--state-bad); }

/* Tier: light → firm → serious. The pill carries it, and a stripe down the
   card's leading edge carries it again for anyone reading at arm's length. */
.doll-corr-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doll-tier {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
.doll-tier.is-light   { color: var(--tier-light);   background: color-mix(in srgb, var(--tier-light) 18%, transparent); }
.doll-tier.is-firm    { color: var(--tier-firm);    background: color-mix(in srgb, var(--tier-firm) 18%, transparent); }
.doll-tier.is-serious { color: var(--tier-serious); background: color-mix(in srgb, var(--tier-serious) 20%, transparent); }
/* Where it happens — a plain chip, not a colour: the tier is the weight, this is only the place. */
.doll-tier.is-mode    { color: var(--text-dim); background: color-mix(in srgb, var(--text-dim) 14%, transparent); }

.doll-correction.is-light   { border-left: 4px solid var(--tier-light); }
.doll-correction.is-firm    { border-left: 4px solid var(--tier-firm); }
.doll-correction.is-serious { border-left: 4px solid var(--tier-serious); }

.doll-subtitle.is-light   { color: var(--tier-light); }
.doll-subtitle.is-firm    { color: var(--tier-firm); }
.doll-subtitle.is-serious { color: var(--tier-serious); }

/* ---- the module's nav ------------------------------------------------------
   Two rows, every chip always on screen. The strip used to scroll sideways
   with the scrollbar hidden, which put her Punishments chip off the edge of a
   360px phone with nothing to say it existed. Now the day's rooms WRAP — each
   row's chips grow to fill it, so two rows read as one control, not a ragged
   cloud — and the reference rooms sit under them as the closet's small chips. */
.doll-nav { margin-bottom: 14px; }
.doll-tabs { flex-wrap: wrap; overflow: visible; margin-bottom: 0; }
.doll-tabs button {
  flex: 1 0 auto; white-space: nowrap; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
/* "Something is here." A dot and never a number — the count is reserved for
   what is past its time (.doll-tabcount). This rule was missing entirely, so
   the Corrections dot had been an invisible empty span since it was written. */
.doll-tabdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.doll-more { margin: 8px 2px 0; gap: 6px; }
.doll-more .doll-pickbtn { font-size: 12px; padding: 7px 10px; }

/* Two half-width taps on his Today, where two full-width buttons stacked. */
.doll-btnrow { display: flex; gap: 8px; margin: 0 0 12px; }
.doll-btnrow > .doll-btn { flex: 1 1 0; width: auto; margin-top: 0; }

/* The Set-up list rows carry how many each list holds on the right. */
.doll-pick { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* His glance cells are buttons now — the two ritual ones lead to Assign. */
button.doll-glance-cell {
  border: none; background: none; font: inherit; color: inherit;
  padding: 0; cursor: pointer;
}

/* Her draw: three face-down cards on a consequence he's left to chance. The
   only playful surface in the module, so it gets the one bit of motion. */
.doll-draw { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.doll-draw-card {
  aspect-ratio: 3 / 4; border-radius: 14px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 16%, var(--bg-elev-2)), var(--bg-elev-2));
  display: flex; align-items: center; justify-content: center;
  transition: transform .16s ease, box-shadow .16s ease;
}
.doll-draw-card:active { transform: translateY(2px) scale(0.97); }
.doll-draw-card:disabled { opacity: .5; cursor: default; }
.doll-draw-mark { font-size: 26px; font-weight: 800; color: color-mix(in srgb, var(--accent) 70%, var(--text)); }

/* ---- her asks ------------------------------------------------------------ */
.doll-ask { padding: 12px 0; border-bottom: 1px solid var(--line); }
.doll-ask:last-of-type { border-bottom: none; }
.doll-ask-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.doll-ask-what { font-size: 15px; font-weight: 600; line-height: 1.35; }
.doll-ask-why { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--text-dim); white-space: pre-wrap; }
.doll-ask-img { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-sm); margin-top: 8px; }
/* "Not now" is stated, never coloured as an error — she asked, that's all. */
.doll-ask-state { font-size: 11.5px; color: var(--text-faint); flex: none; }
.doll-ask-state.is-yes { color: var(--ok); }
.doll-ask-state.is-no { color: var(--text-faint); }

/* ---- daily expectations -------------------------------------------------- */
/* A reference, not a checklist: no tick, no done state, no progress. */
.doll-exp { display: flex; align-items: baseline; gap: 10px; padding: 7px 2px; font-size: 15px; line-height: 1.4; }
.doll-exp-n { font-size: 11.5px; font-weight: 700; color: var(--accent); min-width: 14px; }
.doll-exp-dot { color: var(--text-faint); }
.doll-exp-text { flex: 1; }
.doll-exp-since { font-size: 12px; color: var(--text-faint); }

/* The standing-expectations line on her Today. Quiet on purpose: it's a pointer
   to what's always true, not another thing to do today. */
.doll-standing {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; margin-bottom: 12px; cursor: pointer;
  background: transparent; border: 1px dashed var(--line);
  color: var(--text-dim); border-radius: var(--radius-sm);
  font: inherit; font-size: 13.5px; padding: 11px 14px; min-height: var(--tap);
}

/* Her "for him" photo button — top of her page, separate from the outfit
   confirmation, which keeps its own button in the presentation card. */
.doll-forhim {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; cursor: pointer; min-height: var(--tap);
  background: var(--grad); border: none; color: #fff;
  border-radius: var(--radius-sm); font: inherit; font-size: 15px; font-weight: 700;
  padding: 13px 16px;
}
.doll-forhim:active { transform: scale(0.99); }
.doll-forhim-cam { font-size: 15px; }
.doll-forhim-thumb {
  flex: none; width: 64px; height: 64px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
}
.doll-forhim-line { margin: 6px 2px 0; font-size: 12.5px; color: var(--text-faint); text-align: center; }

/* The running list inside an add-many sheet, so you can see what you've already
   added without closing it. */
.doll-added { margin-top: 12px; }
.doll-added:empty { display: none; }
.doll-added-row {
  font-size: 14px; color: var(--text-dim); padding: 7px 10px; margin-bottom: 6px;
  background: var(--bg-elev-2); border-radius: var(--radius-sm);
}

/* ---- his date header ------------------------------------------------------ */
.doll-datehead {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 2px 4px 10px;
}
.doll-datehead-day { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.doll-datehead-tz { font-size: 12.5px; color: var(--text-faint); flex: none; }
.doll-datehead-side { display: flex; align-items: center; gap: 10px; flex: none; }

/* The summons. Bare on purpose — no card, no label, no border: a thing that
   sends her a message the second it is tapped should not look like part of the
   page furniture. The tap target is a full 44px even though the glyph is 22,
   because it lives at the top of a phone screen next to nothing else. */
.doll-summon {
  border: 0; background: none; padding: 0; margin: 0; cursor: pointer;
  width: 44px; height: 44px; margin: -11px -8px -11px 0;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; -webkit-tap-highlight-color: transparent;
}
.doll-summon-face { font-size: 23px; display: block; filter: saturate(1.05); }
.doll-summon:active .doll-summon-face { transform: scale(0.88); }
.doll-summon-face { transition: transform 90ms ease; }
/* Timing chips in the sheet: five across on a phone, wrapping if the words grow. */
.doll-summon-row { display: flex; flex-wrap: wrap; gap: 8px; }
.doll-summon-row .doll-btn { flex: 1 1 auto; padding: 12px 12px; }

/* ---- Records dashboard ----------------------------------------------------
   Six panes. On a phone they're sub-tabs, one at a time. On a computer the
   sub-tabs disappear and every pane is on screen at once, in two columns. Same
   markup either way — the layout is the only thing that changes. */
.doll-dash { display: grid; gap: 16px; }
.doll-dash-tabs { margin-bottom: 0; }
.dash-pane.is-off { display: none; }
.dash-pane > .doll-title { margin-top: 0; }
.doll-shotfilters { margin-bottom: 6px; }

@media (min-width: 900px) {
  .doll-dash {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
    grid-template-areas:
      "rhythm   photos"
      "becoming photos"
      "history  photos"
      "played   photos"
      "days     photos";
    align-items: start;
    column-gap: 22px;
  }
  .doll-dash-tabs { display: none; }
  .dash-pane.is-off { display: block; }
  .pane-rhythm { grid-area: rhythm; }
  .pane-becoming { grid-area: becoming; }
  .pane-photos { grid-area: photos; }
  .pane-history { grid-area: history; }
  .pane-days { grid-area: days; }
  .pane-played { grid-area: played; }
}

/* Look-back switch: one week or two. */
.doll-winseg { margin-bottom: 12px; }

/* ---- rhythm figures -------------------------------------------------------
   Averages over a window he picks, on his side only. Not a streak, not a score,
   and never shown to her: this is for noticing, not for holding over anyone. */
.doll-stat {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 9px 2px 4px; font-size: 15px;
}
.doll-stat-lab { color: var(--text-dim); }
.doll-stat-val { font-weight: 650; text-align: right; }
.doll-bar {
  height: 5px; border-radius: 3px; background: var(--bg-elev-2);
  overflow: hidden; margin: 0 2px 8px;
}
.doll-bar > span { display: block; height: 100%; border-radius: 3px; background: var(--grad); }

/* ---- photo tiles: state at a glance --------------------------------------- */
.doll-shot { position: relative; }
.doll-shot.v-seen { opacity: 0.62; }
.doll-shot.v-waiting { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.doll-shot.v-sentback { border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); }
.doll-shot-flag {
  position: absolute; top: 6px; right: 6px;
  background: var(--accent); color: #06201f;
  font-size: 10px; font-weight: 800; letter-spacing: 0.02em;
  padding: 2px 6px; border-radius: 7px;
}
.doll-shot-stars {
  display: block; font-size: 11px; color: var(--amber);
  padding: 2px 6px 0; text-align: left; letter-spacing: 1px;
}

/* ---- rating ---------------------------------------------------------------- */
.doll-stars { display: flex; gap: 6px; }
.doll-star {
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text-faint);
  border-radius: var(--radius-sm); font-size: 20px; line-height: 1;
  flex: 1; min-height: var(--tap); cursor: pointer;
}
.doll-star.on { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 45%, var(--line)); }
.doll-stars-read { margin: 8px 0 0; color: var(--amber); font-size: 17px; letter-spacing: 2px; }
.doll-linkbtn.block { display: block; width: 100%; text-align: center; }

/* ---- Assign: the three bands ----------------------------------------------
   Tomorrow / Today / Standing / Set up. The page used to be one flat pile of
   cards with nothing saying which day any of them landed on; the band is the
   thing that says it, so the cards under it can drop the date from their own
   titles. */
.doll-sec { margin: 26px 2px 12px; }
.doll-sec:first-child { margin-top: 4px; }
.doll-sec-top {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--line);
}
.doll-sec-title {
  font-size: 12px; font-weight: 800; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}
.doll-sec-when { font-size: 13px; color: var(--text-dim); text-align: right; }
.doll-sec-note { margin: 8px 2px 0; font-size: 12.5px; color: var(--text-faint); line-height: 1.5; }
/* A band that folds. The whole header row is the tap (an invisible button laid
   over it, so it has a name for a screen reader); the chevron says which way
   it is. Folded, the note under it is replaced by what's inside. */
.doll-sec.is-foldable .doll-sec-top { position: relative; cursor: pointer; }
.doll-sec-toggle { position: absolute; inset: -6px 0; background: none; border: 0; cursor: pointer; }
.doll-sec-chev {
  margin-left: auto; color: var(--text-faint); font-size: 15px; line-height: 1;
  transition: transform 0.15s ease; display: inline-block;
}
.doll-sec.is-folded .doll-sec-chev { transform: rotate(-90deg); }
.doll-sec.is-folded .doll-sec-top { border-bottom-color: color-mix(in srgb, var(--line) 60%, transparent); }

/* What tomorrow already holds, before you scroll into the cards that set it. */
.doll-sec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.doll-secchip {
  font-size: 11.5px; padding: 4px 9px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text-faint);
}
.doll-secchip.is-set {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}

/* A maintenance item switched off for a single day. */
.doll-row-text.doll-off { color: var(--text-faint); text-decoration: line-through; }

/* Starter templates, offered as taps. Tinted by the tier they'd land in, using
   the same ramp as the correction cards — light / firm / serious. */
.doll-chip.is-light   { border-color: color-mix(in srgb, var(--tier-light) 45%, var(--line)); color: var(--tier-light); }
.doll-chip.is-firm    { border-color: color-mix(in srgb, var(--tier-firm) 45%, var(--line)); color: var(--tier-firm); }
.doll-chip.is-serious { border-color: color-mix(in srgb, var(--tier-serious) 45%, var(--line)); color: var(--tier-serious); }

/* ---- device lock ---------------------------------------------------------
   The lock screen and the privacy cover both sit above everything, including
   sheets and the tab bar, and both paint an opaque background so nothing
   underneath can show through a translucent gap. */

.cj-lock,
.cj-privacy {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: calc(var(--sa-top) + 24px) 20px calc(var(--sa-bottom) + 24px);
  -webkit-user-select: none;
  user-select: none;
}

.cj-privacy { gap: 12px; }
.cj-privacy-name {
  font-weight: 800;
  letter-spacing: .06em;
  font-size: 20px;
  color: var(--text-dim);
}

.cj-lock-logo { border-radius: 16px; opacity: .9; }
.cj-lock-msg {
  color: var(--text-dim);
  font-size: 14.5px;
  min-height: 20px;
  text-align: center;
}

.cj-lock-dots { display: flex; gap: 13px; margin: 4px 0 10px; }
.cj-lock-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--text-faint);
  transition: background .12s, border-color .12s, transform .12s;
}
.cj-lock-dot.on {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.12);
}
.cj-lock-dots.shake { animation: cj-lock-shake .38s; }
@keyframes cj-lock-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  45% { transform: translateX(8px); }
  70% { transform: translateX(-5px); }
}

.cj-lock-pad {
  display: grid;
  grid-template-columns: repeat(3, 76px);
  gap: 14px;
  margin-top: 6px;
}
.cj-lock-key {
  height: 68px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  font-size: 25px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s, transform .08s;
}
.cj-lock-key:active { background: var(--bg-elev-2); transform: scale(.94); }
.cj-lock-key.wide { font-size: 20px; }

@media (max-height: 640px) {
  .cj-lock-pad { grid-template-columns: repeat(3, 66px); gap: 11px; }
  .cj-lock-key { height: 58px; font-size: 22px; }
}

/* ---- ritual steps: a box per step -----------------------------------------
   Every step is its own checkbox, ticked when she actually does it. There is no
   closing "send" any more, and neither ritual disappears at a cutoff — a step
   missed in the morning stays tickable at four in the afternoon. */
.doll-step {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 4px; min-height: var(--tap);
  border: none; background: none; color: var(--text); font: inherit;
  font-size: 15px; text-align: left; cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.doll-step:last-child { border-bottom: none; }
.doll-box {
  flex: none; width: 22px; height: 22px; border-radius: 7px;
  border: 2px solid var(--line); background: var(--bg-elev-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; line-height: 1; color: transparent;
}
.doll-box.on { border-color: var(--accent); background: var(--accent); color: #06201f; }
.doll-step.on .doll-step-text { color: var(--text-faint); }
/* The one that's live now reads first; the other is present, not shouting. */
.doll-ritual.is-live { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

/* ---- closet: favorites and shelves -----------------------------------------
   A star is the only mark a piece carries. It says "this one" and nothing else:
   no count of how often it's worn, and nothing that could read as a score. */
.doll-fav {
  position: absolute; top: 6px; left: 6px;
  background: color-mix(in srgb, var(--accent) 88%, var(--bg));
  color: #06201f; font-size: 11px; font-weight: 800; line-height: 1;
  padding: 3px 5px; border-radius: 7px;
}
.doll-closetfilters { margin-bottom: 2px; }
/* Nothing filed under it yet — still there to be seen and still tappable. */
.doll-chip.is-none { opacity: 0.45; }
.doll-chip.is-none.on { opacity: 1; }

/* Each shelf's heading carries its own "add", so a piece goes straight onto the
   shelf she's looking at instead of being filed afterwards. */
.doll-cathead {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 10px; margin-top: 20px;
}
.doll-cathead .doll-title { margin: 0 0 8px; }
.doll-count {
  display: inline-block; margin-left: 8px; padding: 1px 7px; border-radius: 8px;
  background: var(--bg-elev-2); color: var(--text-faint);
  font-size: 11px; font-weight: 700; letter-spacing: 0;
}
.doll-cathead .doll-linkbtn { flex: none; padding: 2px 2px 8px; }
.doll-catempty { margin: 0 4px 2px; font-size: 12.5px; }
/* Every shelf is a tab, whether or not anything is on it — the closet shows what
   it has room for, not only what's in it. */
/* The two ways into the closet — which shelf, and what a piece is for. Both are
   wrapped clouds rather than scrolling strips (a strip cut its own ends off and
   meant tapping right over and over), and both are deliberately SMALL: sixteen
   shelves in full-size tabs pushed the first garment most of a phone screen
   down. Every option still shows; it just doesn't shout. */
.doll-pickrow {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 5px; margin: 10px 0 0;
}
.doll-pickcap {
  font-size: 10px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-faint); flex: none;
  /* min-width, never width: the label sizes itself to whatever word is in it —
     a fixed width can only ever be right for one string, and "SHELF" broke into
     "SHEL / F". The minimum is only there to line the two rows up. */
  min-width: 38px; white-space: nowrap;
}
.doll-pickbtn {
  flex: none; border: 1px solid var(--line); background: var(--bg-elev-2);
  color: var(--text-dim); border-radius: 9px; font: inherit; font-size: 11.5px;
  padding: 6px 9px; cursor: pointer; white-space: nowrap;
}
.doll-pickbtn.on {
  border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--bg-elev-2));
}
.doll-pickbtn.is-none { opacity: 0.42; }
.doll-pickbtn.is-none.on { opacity: 1; }
/* A piece can be for several things at once, so these are taps, not a choice. */
.doll-wearpick { gap: 7px; }
.doll-wearpick .doll-chip { padding: 8px 11px; font-size: 13px; }

/* ---- sets -------------------------------------------------------------------
   A set points at pieces that are already on the shelves. It is drawn as a card
   of thumbnails rather than a tile, so it never reads as one more garment — and
   nothing in the closet counts it as one. */
.doll-set {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px; margin-top: 10px; font: inherit;
  color: var(--text);
}
.doll-set-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.doll-set-name { font-size: 15px; font-weight: 700; }
.doll-set-rail { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.doll-set-cell {
  flex: none; width: 54px; height: 54px; border-radius: 9px; overflow: hidden;
  background: var(--bg-elev-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
}
.doll-set-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.doll-set-word { font-size: 9.5px; line-height: 1.15; text-align: center; padding: 3px; color: var(--text-faint); }
.doll-setcat {
  margin: 0 2px 6px; font-size: 10px; font-weight: 800;
  letter-spacing: 0.08em; text-transform: uppercase;
}

/* ---- moving a piece between shelves ----------------------------------------
   Press and hold a tile and the whole shelf under the finger lights up. The
   shelf block is the target, not the grid, so there's a lot of it to hit. */
.doll-shelf {
  padding: 0 8px 8px; margin: 0 -8px;
  border-radius: 14px; transition: background 0.12s ease, box-shadow 0.12s ease;
}
.doll-shelf.is-drop {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent);
}
/* The grip is the one part of a tile the browser is told never scrolls, which is
   what makes a drag off it reliable instead of a coin toss against the page. */
.doll-grip {
  position: absolute; right: 4px; bottom: 24px;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 9px; font-size: 13px; line-height: 1; letter-spacing: 1px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  color: var(--text-dim); cursor: grab;
  pointer-events: none;   /* a hint, not a handle — the hold on the tile lifts it */
}
.doll-grip:active { cursor: grabbing; }

/* Every shelf, brought to the finger. Fifteen of them down a scrolling page is
   too far to drag one at a time, so they come up while a piece is off the
   ground and go away the moment it lands. */
.doll-dropbar {
  position: fixed; left: 0; right: 0; z-index: 190;
  bottom: calc(var(--tabbar-h) + var(--sa-bottom));
  padding: 10px 12px 12px; pointer-events: none;
  background: color-mix(in srgb, var(--bg-elev) 97%, transparent);
  border-top: 1px solid var(--line);
  box-shadow: 0 -14px 34px rgba(0, 0, 0, 0.4);
  transform: translateY(106%); transition: transform 0.16s ease-out;
}
.doll-dropbar.is-up { transform: none; }
.doll-dropbar-head { margin: 0 2px 8px; font-size: 12px; color: var(--text-faint); }
.doll-dropbar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 5px; }
.doll-drop-chip {
  min-height: 34px; padding: 5px 6px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text);
  font: inherit; font-size: 11.5px; line-height: 1.15; text-align: center;
}
.doll-drop-chip.is-drop {
  border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-elev-2));
}

.doll-drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 200; pointer-events: none;
  border-radius: 12px; overflow: hidden; background: var(--bg-elev);
  border: 1px solid var(--accent); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.45);
}
.doll-drag-ghost img { display: block; width: 100%; height: auto; }
.doll-drag-ghost span { display: block; padding: 12px 10px; font-size: 12.5px; font-weight: 700; }
body.doll-dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
body.doll-dragging .doll-closet-tile { touch-action: none; }
body.doll-dragging .doll-shot img { pointer-events: none; }
.doll-closet-tile.is-lifted { opacity: 0.3; }
.doll-draghint { margin: 10px 2px 0; font-size: 12px; }

/* Sorting what's already in there: one row per proposed move, all of them
   unticked-able, nothing moved until she says so. */
.doll-move { align-items: flex-start; gap: 12px; }
.doll-move-name { display: block; font-size: 15px; }
.doll-move-to { display: block; font-size: 12.5px; color: var(--text-faint); margin-top: 2px; }

/* ---- the state, as a dial -------------------------------------------------
   Three buttons became a ramp he can land anywhere on. It reads as a fill and a
   word — never a number, and never on her page as a mark out of a hundred. It is
   one day's reading: nothing averages it, carries it forward, or charts it. */
.doll-meter {
  height: 8px; border-radius: 5px; background: var(--bg-elev-2);
  overflow: hidden; margin: 10px 0 0;
}
.doll-meter-fill {
  height: 100%; border-radius: 5px; width: 0;
  background: var(--slate); transition: width 120ms linear;
}
.doll-meter.is-good   .doll-meter-fill { background: var(--amber); }
.doll-meter.is-neutral .doll-meter-fill { background: var(--slate); }
.doll-meter.is-bad    .doll-meter-fill { background: var(--rose); }

.doll-meter-head { display: flex; justify-content: center; padding-bottom: 2px; }
.doll-meter-word { font-size: 17px; font-weight: 700; color: var(--text-faint); }
.doll-meter-word.is-good   { color: var(--amber); }
.doll-meter-word.is-neutral { color: var(--text-dim); }
.doll-meter-word.is-bad    { color: var(--rose); }

/* The slider itself, themed — the native one is unreadable on this ground. */
.doll-meter-input {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: var(--tap); background: none; margin: 0; cursor: pointer;
}
.doll-meter-input::-webkit-slider-runnable-track { height: 8px; background: transparent; }
.doll-meter-input::-moz-range-track { height: 8px; background: transparent; }
.doll-meter-input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--text); border: 3px solid var(--bg-elev);
  box-shadow: 0 1px 6px rgba(0,0,0,0.35); margin-top: -9px;
}
.doll-meter-input::-moz-range-thumb {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--text); border: 3px solid var(--bg-elev);
  box-shadow: 0 1px 6px rgba(0,0,0,0.35);
}

/* The three named points, still tappable — the ramp didn't take them away. */
.doll-meter-scale { display: flex; gap: 8px; }
.doll-meter-tick {
  flex: 1; min-height: 38px; border: 1px solid var(--line);
  background: var(--bg-elev-2); color: var(--text-dim);
  border-radius: 11px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.doll-meter-tick.on.is-good   { border-color: var(--amber); color: var(--amber); }
.doll-meter-tick.on.is-neutral { border-color: var(--text-dim); color: var(--text); }
.doll-meter-tick.on.is-bad    { border-color: var(--rose); color: var(--rose); }

/* The questions line on Today — same shape as the correction one, in the
   accent rather than a tier colour: a question waiting is not a correction. */
.doll-nudge.is-question { --nt: var(--accent); }
.doll-nudge-text { text-align: left; }

/* ---- Phones: the top row has to FIT ----------------------------------------
   Measured at 390px (iPhone): the actions cluster alone came to 421px and could
   not shrink, so the document was 451px wide and the whole app swiped sideways.
   The title was crushed to zero. Three things fix it — let the cluster shrink,
   size the controls for the screen that's actually there, and drop the two
   controls that mean nothing on a phone. */
.appbar-actions { min-width: 0; flex: 0 1 auto; }
.appbar-row > .row { gap: 2px; }
/* A guard, not the fix: `clip` doesn't create a scroll container, so it can't
   break the sticky bar the way `overflow-x: hidden` on <html> would. */
.app { overflow-x: clip; }

@media (max-width: 560px) {
  .appbar-row {
    gap: 8px; height: auto; min-height: var(--header-h); padding-block: 5px;
    padding-left: max(8px, var(--sa-left));
    padding-right: max(8px, var(--sa-right));
  }
  .appbar-actions { gap: 0; }
  .icon-btn { min-width: 38px; font-size: 18px; border-radius: 10px; }
  .icon-btn svg { width: 20px; height: 20px; }
  .fab.fab--top { width: 40px; min-width: 40px; height: 40px; font-size: 23px; }
  /* Hidden for SPACE, not capability: the ~40px is load-bearing, and inside the
     installed app the screen is already fullscreen. */
  .fs-btn { display: none; }
  /* The running clock is the decorative half of the counter; the elapsed time
     is the half that means something. */
  .together-clock { display: none; }
  .together-mini { padding-right: 4px; }
  .appbar-title { font-size: 17px; }
}

@media (max-width: 400px) {
  .together-name { font-size: 9.5px; }
  .together-val { font-size: 10.5px; }
  .icon-btn { min-width: 34px; font-size: 17px; }
  .fab.fab--top { width: 36px; min-width: 36px; height: 36px; font-size: 21px; }
}

/* Below this the counters lose to the title — they have their own page. */
@media (max-width: 340px) {
  .together-mini { display: none; }
}

/* A long pasted link in an ask or an answer was the other way a page could get
   wider than the phone. Breaks only when a word genuinely cannot fit. */
.screen { overflow-wrap: break-word; }
.screen img { max-width: 100%; }

/* ---- Side-scrolling rails ---------------------------------------------------
   Every one of these is a finger-flick strip. Two things they all need on a
   phone: flicking past the end must not hand the gesture to the browser's
   swipe-back (which would leave the screen mid-scroll), and none of them should
   show a scrollbar gutter — they're rails, not scroll panes. */
.chips,
.bank,
.doll-strip,
.doll-rail,
.doll-tabs,
.hscroll {
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar,
.bank::-webkit-scrollbar,
.doll-strip::-webkit-scrollbar,
.doll-rail::-webkit-scrollbar,
.doll-tabs::-webkit-scrollbar,
.hscroll::-webkit-scrollbar { display: none; }

/* ---- Reorder mode (views/reorder.js) --------------------------------------
   A grip that is always on screen is a grip you snag every time you scroll, so
   it only exists while the section's ⇅ is switched on. */
.ro-grip {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 24px; align-self: stretch; color: var(--text-faint);
  cursor: grab; touch-action: none;
}
.ro-grip:active { cursor: grabbing; }
.ro-item.dragging {
  position: relative; z-index: 5; opacity: 0.96;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.32);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
/* While the mode is on, the cards are handles — not buttons. */
.ro-on .ro-item { cursor: default; }
.btn.ghost.on { background: color-mix(in srgb, var(--accent) 22%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
/* Board cards stop being checkboxes while the mode is on, so they stop looking
   like ones. */
.ro-on .task-check { opacity: 0.3; }


/* ---- Becoming: his notes and his own metrics -------------------------------
   His side only. Same tokens as the rest of the module, so it inherits the
   theme and the accent like every other card. */
.doll-cardhead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.trk-jot { margin-top: 0; margin-bottom: 12px; }

.trk-pill {
  font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 8px; border-radius: 999px;
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--text-faint);
  flex: none;
}
.trk-metric-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; }

/* A reading, set inside the note sheet. */
.trk-reading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 9px 2px; border-bottom: 1px solid var(--line); }
.trk-reading:last-of-type { border-bottom: 0; }
.trk-reading-name { flex: 1 1 auto; min-width: 0; font-size: 14.5px; }
.trk-reading-set { display: flex; align-items: center; gap: 6px; flex: none; }
.trk-reading-val { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; font-size: 15px; }
.trk-reading-hint { flex: 1 0 100%; font-size: 12.5px; color: var(--text-faint); }
.trk-dot {
  width: 30px; height: 30px; border-radius: 999px; flex: none;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--text);
  font-size: 13.5px; line-height: 1; cursor: pointer;
}
.trk-dot.wide { width: auto; padding: 0 12px; border-radius: 999px; }
.trk-dot.on { background: var(--grad); border-color: transparent; color: #fff; }

/* Shape, not score: unlabelled bars, oldest to newest. */
.trk-spark { display: flex; align-items: flex-end; gap: 3px; height: 34px; margin: 2px 2px 12px; }
.trk-spark-bar { flex: 1 1 0; min-width: 2px; border-radius: 2px 2px 0 0; background: var(--accent); opacity: .55; }

.trk-day { font-size: 12.5px; font-weight: 600; color: var(--text-faint); margin: 14px 2px 6px; }
.trk-note { padding: 8px 0; border-bottom: 1px solid var(--line); }
.trk-note:last-child { border-bottom: 0; }
.trk-note-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.trk-note-at { font-size: 12.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.trk-note-x { margin-left: auto; }
.trk-note-text { margin: 0; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; }

/* ---- "there's more over there" ----------------------------------------------
   A side-scrolling rail on a phone gives you no scrollbar and no shadow, so a
   row of chips that runs off the edge looks exactly like a row that ends there.
   The mask fades whichever edge still has content behind it — applied to the
   container, not its contents, so it stays pinned while the strip scrolls.
   util.js/wireScrollHints adds the classes. */
.rail-more-right {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 38px), transparent);
          mask-image: linear-gradient(to right, #000 calc(100% - 38px), transparent);
}
.rail-more-left {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 26px);
          mask-image: linear-gradient(to right, transparent, #000 26px);
}
.rail-more-left.rail-more-right {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 26px, #000 calc(100% - 38px), transparent);
          mask-image: linear-gradient(to right, transparent, #000 26px, #000 calc(100% - 38px), transparent);
}

/* ---- closet: where it lives, folding, packing --------------------------------
   A piece packed for an upcoming trip carries a 🧳 in the corner the ★ doesn't
   use. A heading folds its group away — the closet read one group at a time. */
.doll-packed {
  position: absolute; bottom: 24px; left: 6px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border: 1px solid var(--line); font-size: 12px; line-height: 1;
  padding: 3px 4px; border-radius: 7px;
}
.doll-foldable { cursor: pointer; user-select: none; }
.doll-fold { display: inline-block; width: 14px; color: var(--text-faint); }
.doll-packing:empty { display: none; }
.doll-trip .doll-cathead { margin-top: 0; }
.doll-trip .doll-setcat { margin: 6px 2px 4px; }

/* With a mouse, plain chip rows can be dragged sideways (app.js wireMouseRails). */
@media (hover: hover) and (pointer: fine) {
  .chips:not(.subnav), .hscroll { cursor: grab; }
  .chips:not(.subnav) > *, .hscroll > * { cursor: pointer; }
}
