/* ════════════════════════════════════════════════════════════════
   Nat & Dan — design system
   See DESIGN_NOTES.md for the rules. The short version:
   • Colour comes from tokens. Components never hardcode a hue.
   • Ink is the primary action colour; Ember is the one accent and
     belongs to progress and "now". --c-* tints are data, not chrome.
   • Type comes from the ramp. Big numbers use the rounded face.
   • Shadows only on things that float: tab bar, sheets, toasts.
   ════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* Surfaces */
  --bg:          #F4F2EF;
  --surface:     #FFFFFF;
  --sheet-bg:    #F4F2EF;
  --fill:        rgba(40,30,25,0.055);
  --fill-2:      rgba(40,30,25,0.10);
  --fill-3:      rgba(40,30,25,0.16);
  --pressed:     rgba(40,30,25,0.05);

  /* Ink — text and the primary action */
  --ink:         #1B1714;
  --ink-2:       #4F4844;
  --ink-3:       #6E6660;   /* AA on --surface and --bg */
  --faint:       rgba(27,23,20,0.26);  /* icons & chevrons only — never text */
  --on-ink:      #FFFFFF;

  /* Lines */
  --sep:         rgba(27,23,20,0.09);
  --sep-strong:  rgba(27,23,20,0.18);

  /* Ember — the single accent */
  --accent:      #EE5A3B;
  --accent-ink:  #B23E1F;   /* accent as text: links, "now" labels */
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --on-accent:   #FFFFFF;

  --success:     #2E9A66;
  --danger:      #D2392F;

  /* Data tints */
  --c-red:    #C93C3C;
  --c-orange: #B0640F;
  --c-green:  #2B8550;
  --c-blue:   #2E6CC6;
  --c-purple: #7650C2;
  --c-pink:   #BE3C76;
  --c-teal:   #0F7D77;
  --c-gold:   #A87A10;

  /* Floating chrome */
  --glass:        rgba(248,246,243,0.74);
  --glass-line:   rgba(255,255,255,0.7);
  --glass-edge:   rgba(40,30,25,0.07);
  --shadow-float: 0 1px 2px rgba(40,30,25,0.06), 0 10px 30px rgba(40,30,25,0.13);
  --shadow-sheet: 0 -20px 60px rgba(40,30,25,0.18);
  --scrim:        rgba(20,16,14,0.32);

  /* Radii — concentric */
  --r-card:  22px;
  --r-inner: 14px;
  --r-field: 12px;
  --r-tile:  9px;
  --r-sheet: 30px;
  --r-pill:  999px;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, 'Segoe UI', sans-serif;
  --font-round: ui-rounded, 'SF Pro Rounded', -apple-system, BlinkMacSystemFont, 'Inter', system-ui, sans-serif;

  --fs-hero:     64px;
  --fs-large:    34px;  --ls-large:  -0.8px;
  --fs-title:    24px;  --ls-title:  -0.5px;
  --fs-title3:   20px;  --ls-title3: -0.35px;
  --fs-headline: 17px;  --ls-head:   -0.3px;
  --fs-body:     17px;  --ls-body:   -0.3px;
  --fs-callout:  16px;  --ls-callout:-0.25px;
  --fs-subhead:  15px;  --ls-sub:    -0.15px;
  --fs-footnote: 13px;  --ls-foot:   -0.05px;
  --fs-caption:  12px;  --ls-cap:     0;
  --fs-micro:    11px;  --ls-micro:   0.06px;

  /* Motion */
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease:   cubic-bezier(0.4, 0, 0.2, 1);
  --t-fast: 0.16s;
  --t-med:  0.3s;
  --t-slow: 0.5s;

  --gutter: 16px;
  --tabbar-h: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), 10px);
}

/* Dark — automatic, unless a light appearance is chosen explicitly */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="blush"]) {
    color-scheme: dark;
    --bg: #0B0A09; --surface: #1B1917; --sheet-bg: #121110;
    --fill: rgba(255,240,230,0.07); --fill-2: rgba(255,240,230,0.12); --fill-3: rgba(255,240,230,0.18);
    --pressed: rgba(255,240,230,0.06);
    --ink: #F6F2EE; --ink-2: rgba(246,242,238,0.78); --ink-3: rgba(246,242,238,0.58);
    --faint: rgba(246,242,238,0.28); --on-ink: #141210;
    --sep: rgba(255,240,230,0.09); --sep-strong: rgba(255,240,230,0.18);
    --accent: #FF7556; --accent-ink: #FF8F74; --on-accent: #1F0A04;
    --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
    --success: #3DC584; --danger: #FF6259;
    --c-red: #FF7A72; --c-orange: #FFAE55; --c-green: #5BD38D; --c-blue: #7AB0FF;
    --c-purple: #B99BFF; --c-pink: #FF85B8; --c-teal: #4FD1C7; --c-gold: #F1C55A;
    --glass: rgba(30,28,26,0.72); --glass-line: rgba(255,255,255,0.08); --glass-edge: rgba(0,0,0,0.5);
    --shadow-float: 0 1px 2px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.5);
    --shadow-sheet: 0 -20px 60px rgba(0,0,0,0.6);
    --scrim: rgba(0,0,0,0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0B0A09; --surface: #1B1917; --sheet-bg: #121110;
  --fill: rgba(255,240,230,0.07); --fill-2: rgba(255,240,230,0.12); --fill-3: rgba(255,240,230,0.18);
  --pressed: rgba(255,240,230,0.06);
  --ink: #F6F2EE; --ink-2: rgba(246,242,238,0.78); --ink-3: rgba(246,242,238,0.58);
  --faint: rgba(246,242,238,0.28); --on-ink: #141210;
  --sep: rgba(255,240,230,0.09); --sep-strong: rgba(255,240,230,0.18);
  --accent: #FF7556; --accent-ink: #FF8F74; --on-accent: #1F0A04;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --success: #3DC584; --danger: #FF6259;
  --c-red: #FF7A72; --c-orange: #FFAE55; --c-green: #5BD38D; --c-blue: #7AB0FF;
  --c-purple: #B99BFF; --c-pink: #FF85B8; --c-teal: #4FD1C7; --c-gold: #F1C55A;
  --glass: rgba(30,28,26,0.72); --glass-line: rgba(255,255,255,0.08); --glass-edge: rgba(0,0,0,0.5);
  --shadow-float: 0 1px 2px rgba(0,0,0,0.5), 0 10px 30px rgba(0,0,0,0.5);
  --shadow-sheet: 0 -20px 60px rgba(0,0,0,0.6);
  --scrim: rgba(0,0,0,0.55);
}

/* Blush — the warm pink option, a light theme with a rose accent */
:root[data-theme="blush"] {
  --bg: #FAF0EE; --sheet-bg: #FAF0EE;
  --fill: rgba(150,60,80,0.06); --fill-2: rgba(150,60,80,0.10); --fill-3: rgba(150,60,80,0.16);
  --pressed: rgba(150,60,80,0.05);
  --ink: #26151A; --ink-2: #5A4148; --ink-3: #7A5F66;
  --faint: rgba(38,21,26,0.26);
  --sep: rgba(120,40,60,0.10); --sep-strong: rgba(120,40,60,0.18);
  --accent: #E0587E; --accent-ink: #AE3459;
  --glass: rgba(252,244,243,0.76); --glass-edge: rgba(150,60,80,0.08);
  --shadow-float: 0 1px 2px rgba(150,60,80,0.07), 0 10px 30px rgba(150,60,80,0.15);
  --shadow-sheet: 0 -20px 60px rgba(150,60,80,0.18);
}

/* ── Base ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  font-family: var(--font);
  font-size: var(--fs-body); line-height: 1.38; letter-spacing: var(--ls-body);
  background: var(--bg); color: var(--ink);
  max-width: 480px; margin: 0 auto; min-height: 100vh;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-synthesis-weight: none;
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
input, textarea, select { font: inherit; color: inherit; }
svg.lucide { flex-shrink: 0; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.num { font-family: var(--font-round); font-variant-numeric: tabular-nums; }

@media (min-width: 700px) {
  html { background: color-mix(in srgb, var(--bg) 86%, #000); }
  body { box-shadow: 0 0 0 0.5px var(--sep), 0 30px 80px rgba(20,16,14,0.14); }
}

/* ── Launch ─────────────────────────────────────────────────────── */
#app-loader {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; background: var(--bg);
  transition: opacity var(--t-slow) var(--ease);
}
#app-loader.hide { opacity: 0; pointer-events: none; }
.loader-mark { width: 64px; height: 64px; color: var(--accent); animation: breathe 1.8s var(--ease) infinite; }
@keyframes breathe { 0%,100% { opacity: .35; transform: scale(.94); } 50% { opacity: 1; transform: scale(1); } }

/* ── Navigation bar ─────────────────────────────────────────────── */
/* Sticky, transparent at rest; glass and a centred small title once the
   large title has scrolled away. */
.navbar {
  position: sticky; top: 0; z-index: 60;
  padding-top: var(--safe-top);
  transition: background var(--t-med) var(--ease), box-shadow var(--t-med) var(--ease);
}
.navbar.scrolled {
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  box-shadow: 0 0.5px 0 var(--sep);
}
.navbar-inner {
  position: relative; height: 48px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 8px;
}
.navbar-title {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -40%);
  max-width: 60%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: var(--fs-headline); font-weight: 600; letter-spacing: var(--ls-head);
  opacity: 0; pointer-events: none;
  transition: opacity var(--t-fast) var(--ease), transform var(--t-med) var(--spring);
}
.navbar.scrolled .navbar-title, .navbar.always-title .navbar-title { opacity: 1; transform: translate(-50%, -50%); }
.navbar-side { display: flex; align-items: center; gap: 2px; min-width: 44px; }
.navbar-side.end { justify-content: flex-end; }
.nav-back {
  display: flex; align-items: center; gap: 0;
  height: 44px; padding: 0 8px 0 2px;
  font-size: var(--fs-body); color: var(--accent-ink);
  transition: opacity var(--t-fast) var(--ease);
}
.nav-back svg { width: 28px; height: 28px; stroke-width: 2.2; margin-right: -2px; }
.nav-back:active { opacity: .4; }

/* Round bar buttons */
.bar-btn {
  width: 44px; height: 44px; display: grid; place-items: center;
  border-radius: 50%; color: var(--ink);
  transition: transform var(--t-fast) var(--spring), opacity var(--t-fast) var(--ease);
}
.bar-btn > span {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 50%; background: var(--fill);
}
.bar-btn svg { width: 19px; height: 19px; stroke-width: 2.2; }
.bar-btn:active { transform: scale(.9); opacity: .6; }
.bar-btn.primary > span { background: var(--ink); color: var(--on-ink); }

/* ── Views ──────────────────────────────────────────────────────── */
main { padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 28px); }
.view { display: none; }
.view.active { display: block; animation: view-in var(--t-med) var(--spring); }
.view.push-in { animation: push-in 0.42s var(--spring); }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes push-in { from { opacity: .4; transform: translateX(28%); } }

.title-block { padding: 0 var(--gutter) 14px; }
.eyebrow {
  font-size: var(--fs-footnote); font-weight: 600; letter-spacing: 0.2px;
  text-transform: uppercase; color: var(--ink-3);
  margin-bottom: 2px;
}
.large-title {
  font-size: var(--fs-large); font-weight: 700; letter-spacing: var(--ls-large);
  line-height: 1.1; text-wrap: balance;
}
.lede { font-size: var(--fs-subhead); color: var(--ink-3); margin-top: 6px; line-height: 1.4; letter-spacing: var(--ls-sub); }

/* Section heading above a card */
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 26px var(--gutter) 9px;
}
.section-head h2 {
  font-size: var(--fs-title3); font-weight: 700; letter-spacing: var(--ls-title3);
}
.section-head .sub { font-size: var(--fs-footnote); color: var(--ink-3); }
.link-btn {
  font-size: var(--fs-subhead); font-weight: 500; color: var(--accent-ink);
  padding: 6px 0; letter-spacing: var(--ls-sub);
  transition: opacity var(--t-fast) var(--ease);
}
.link-btn:active { opacity: .45; }
.group-label {
  font-size: var(--fs-footnote); color: var(--ink-3);
  padding: 22px calc(var(--gutter) + 4px) 7px;
}

/* ── Cards & rows ───────────────────────────────────────────────── */
.card {
  margin: 0 var(--gutter) 12px;
  background: var(--surface); border-radius: var(--r-card);
  overflow: hidden; position: relative;
}
.card-pad { padding: 18px; }
.card + .card { margin-top: 0; }

.row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  min-height: 50px; padding: 11px 16px;
  width: 100%; text-align: left; text-decoration: none;
  background: var(--surface);
  transition: background var(--t-fast) var(--ease);
}
.row + .row::before, .row + .row-add::before {
  content: ''; position: absolute; top: 0; right: 0; left: var(--inset, 16px);
  height: 0.5px; background: var(--sep);
}
button.row:active, a.row:active, .row.tappable:active { background: var(--pressed); }
.row-body { flex: 1; min-width: 0; }
.row-title {
  font-size: var(--fs-callout); line-height: 1.32; letter-spacing: var(--ls-callout);
  overflow-wrap: anywhere;
}
.row-sub {
  font-size: var(--fs-footnote); color: var(--ink-3); line-height: 1.35;
  margin-top: 2px; overflow-wrap: anywhere;
}
.row-value { flex-shrink: 0; font-size: var(--fs-subhead); color: var(--ink-3); letter-spacing: var(--ls-sub); }
.row-chev { width: 16px; height: 16px; color: var(--faint); stroke-width: 2.6; flex-shrink: 0; }
.row.danger .row-title { color: var(--danger); }
.row.accent .row-title { color: var(--accent-ink); }

/* Squircle icon tile, iOS Settings style. Tinted tiles are the one place a
   --c-* tint is used as chrome: each tile identifies a destination. */
.tile {
  width: 30px; height: 30px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: var(--r-tile);
  background: var(--tint, var(--ink-3)); color: #fff;
}
.tile svg { width: 17px; height: 17px; stroke-width: 2.2; }
.tile.soft { background: var(--fill); color: var(--ink-2); }
.tile.lg { width: 40px; height: 40px; border-radius: 12px; }
.tile.lg svg { width: 21px; height: 21px; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 20px; border-radius: var(--r-pill);
  font-size: var(--fs-subhead); font-weight: 600; letter-spacing: var(--ls-sub);
  white-space: nowrap;
  transition: transform var(--t-fast) var(--spring), opacity var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.btn svg { width: 17px; height: 17px; stroke-width: 2.3; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-primary { background: var(--ink); color: var(--on-ink); }
.btn-accent  { background: var(--accent); color: var(--on-accent); }
.btn-tinted  { background: var(--fill); color: var(--ink); }
.btn-tinted.accent { background: var(--accent-soft); color: var(--accent-ink); }
.btn-plain   { color: var(--accent-ink); padding: 0 8px; }
.btn-danger  { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: var(--fs-footnote); }
.btn-sm svg { width: 15px; height: 15px; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* Inline "add" row at the foot of a list */
.row-add {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 50px; padding: 11px 16px;
  color: var(--accent-ink); font-size: var(--fs-callout); letter-spacing: var(--ls-callout);
  transition: background var(--t-fast) var(--ease);
}
.row-add:active { background: var(--pressed); }
.row-add .plus {
  width: 24px; height: 24px; flex-shrink: 0; display: grid; place-items: center;
}
.row-add svg { width: 20px; height: 20px; stroke-width: 2.2; }

/* ── Chips & badges ─────────────────────────────────────────────── */
.chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px var(--gutter) 14px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--r-pill);
  font-size: var(--fs-footnote); font-weight: 500;
  background: var(--surface); color: var(--ink-2);
  box-shadow: inset 0 0 0 0.5px var(--sep);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform var(--t-fast) var(--spring);
}
.chip:active { transform: scale(.95); }
.chip.active { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tint); }
.chip.active .dot { background: currentColor; }

.tag {
  display: inline-flex; align-items: center; vertical-align: 1px;
  height: 20px; padding: 0 7px; border-radius: 6px;
  font-size: var(--fs-micro); font-weight: 600; letter-spacing: var(--ls-micro);
  background: color-mix(in srgb, var(--tint, var(--ink-3)) 13%, transparent);
  color: var(--tint, var(--ink-3));
  white-space: nowrap;
}
.tag-health  { --tint: var(--c-orange); }
.tag-finance { --tint: var(--c-green); }
.tag-gear    { --tint: var(--c-blue); }
.tag-admin   { --tint: var(--c-pink); }
.tag-home    { --tint: var(--c-purple); }
.tag-new     { --tint: var(--c-red); }
.tag-borrow  { --tint: var(--c-blue); }
.tag-either  { --tint: var(--c-orange); }
.tag-wait    { --tint: var(--c-green); }
.tag-symptom { --tint: var(--c-orange); }
.tag-mood    { --tint: var(--c-purple); }
.tag-midwife { --tint: var(--c-pink); }
.tag-general { --tint: var(--c-teal); }
.tag-now     { --tint: var(--accent-ink); }

.badge {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
  height: 24px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: var(--fs-caption); font-weight: 600;
  background: var(--fill); color: var(--ink-3);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; stroke-width: 2.8; }
.badge.now  { background: var(--accent); color: var(--on-accent); }
.badge.done { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.badge.warn { background: color-mix(in srgb, var(--c-red) 12%, transparent); color: var(--c-red); }

/* ── Progress ───────────────────────────────────────────────────── */
.bar {
  height: 6px; border-radius: var(--r-pill); background: var(--fill-2); overflow: hidden;
}
.bar > i {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: var(--accent);
  transition: width 0.9s var(--spring);
}
.bar.ink > i { background: var(--ink); }
.bar.success > i { background: var(--success); }

/* Small progress ring (used on phase headers and summaries) */
.mini-ring { width: 30px; height: 30px; flex-shrink: 0; transform: rotate(-90deg); }
.mini-ring circle { fill: none; stroke-width: 3.4; }
.mini-ring .track { stroke: var(--fill-2); }
.mini-ring .val { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 0.9s var(--spring); }
.mini-ring.done .val { stroke: var(--success); }

/* ── Segmented control ──────────────────────────────────────────── */
.seg {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  margin: 0 var(--gutter) 16px; padding: 2px; height: 36px;
  border-radius: 10px; background: var(--fill-2);
}
.seg button {
  position: relative; z-index: 1;
  font-size: var(--fs-footnote); font-weight: 500; color: var(--ink);
  border-radius: 8px;
  transition: font-weight var(--t-fast);
}
.seg button[aria-selected="true"] { font-weight: 600; }
.seg-thumb {
  position: absolute; top: 2px; bottom: 2px; left: 2px;
  border-radius: 8px; background: var(--surface);
  box-shadow: 0 3px 8px rgba(0,0,0,0.12), 0 0 0 0.5px rgba(0,0,0,0.04);
  transition: transform var(--t-med) var(--spring);
}
:root[data-theme="dark"] .seg-thumb { background: #3A3633; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]):not([data-theme="blush"]) .seg-thumb { background: #3A3633; } }
.seg.small { margin: 0; height: 32px; }

/* ── Checkbox ───────────────────────────────────────────────────── */
.check {
  position: relative; flex-shrink: 0;
  width: 44px; height: 44px; margin: -10px -8px -10px -10px;
  display: grid; place-items: center;
}
.check i {
  width: 24px; height: 24px; border-radius: 50%;
  box-shadow: inset 0 0 0 1.6px var(--sep-strong);
  display: grid; place-items: center;
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.check svg { width: 13px; height: 13px; stroke: var(--on-accent); stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 16; stroke-dashoffset: 16; }
.check[aria-checked="true"] i { background: var(--accent); box-shadow: none; }
.check[aria-checked="true"] svg { stroke-dashoffset: 0; }
.check.pop i { animation: pop 0.42s var(--bounce); }
.check.pop svg { transition: stroke-dashoffset 0.32s 0.06s var(--ease); }
@keyframes pop { 0% { transform: scale(.7); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* ── Task rows ──────────────────────────────────────────────────── */
.task { align-items: flex-start; --inset: 52px; }
.task .row-body { padding-top: 1px; cursor: pointer; }
.task.done .row-title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--sep-strong); }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 4px; }
.task.leaving { opacity: 0; transition: opacity var(--t-med) var(--ease); }

/* Phase cards: header + rows */
.phase-head {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 64px; padding: 14px 16px; text-align: left;
  transition: background var(--t-fast) var(--ease);
}
.phase-head:active { background: var(--pressed); }
.phase-head .row-title { font-weight: 600; }
.phase-chev { width: 16px; height: 16px; color: var(--faint); stroke-width: 2.6; transition: transform var(--t-med) var(--spring); }
.phase.collapsed .phase-chev { transform: rotate(-90deg); }
.phase:not(.collapsed) .phase-head { box-shadow: inset 0 -0.5px 0 var(--sep); }
.phase.collapsed .phase-body { display: none; }
.phase.current { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 40%, transparent); }

/* Summary strip on Plan */
.summary {
  display: flex; align-items: center; gap: 16px;
}
.summary .big {
  font-family: var(--font-round); font-size: 40px; font-weight: 700; line-height: 1;
  letter-spacing: -1px; font-variant-numeric: tabular-nums;
}
.summary .big small { font-size: 20px; color: var(--ink-3); font-weight: 600; letter-spacing: -0.3px; }
.summary .meta { flex: 1; min-width: 0; }
.summary .meta .bar { margin-top: 10px; }
.summary .label { font-size: var(--fs-footnote); color: var(--ink-3); }

/* ── Today: hero ────────────────────────────────────────────────── */
.hero { padding: 22px 18px 18px; text-align: center; }
.ring-wrap { position: relative; width: 236px; max-width: 72vw; aspect-ratio: 1; margin: 2px auto 0; }
.ring-wrap svg { width: 100%; height: 100%; overflow: visible; }
.ring-wrap .tick { stroke: var(--fill-3); stroke-width: 3.2; stroke-linecap: round; }
.ring-wrap .tick.on { stroke: var(--accent); }
.ring-wrap .tick.now { stroke: var(--accent); stroke-width: 4.4; }
.ring-wrap .tick.anim { opacity: 0; animation: tick-in 0.5s var(--ease) forwards; }
@keyframes tick-in { from { opacity: 0; } to { opacity: 1; } }
.ring-wrap .now-dot { fill: var(--accent); }
.ring-wrap .now-halo { fill: var(--accent); opacity: .18; transform-box: fill-box; transform-origin: center; animation: halo 2.6s var(--ease) infinite; }
@keyframes halo { 0%,100% { transform: scale(1); opacity: .18; } 50% { transform: scale(1.55); opacity: .06; } }
.ring-wrap .tri-label { font-family: var(--font); font-size: 8.5px; font-weight: 600; fill: var(--ink-3); letter-spacing: 0.4px; text-anchor: middle; dominant-baseline: middle; }
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.ring-week {
  font-family: var(--font-round); font-size: var(--fs-hero); font-weight: 700;
  line-height: 0.95; letter-spacing: -2.5px; font-variant-numeric: tabular-nums;
}
.ring-unit { font-size: var(--fs-subhead); font-weight: 600; color: var(--ink-2); margin-top: 4px; letter-spacing: var(--ls-sub); }
.ring-days { font-size: var(--fs-footnote); color: var(--ink-3); margin-top: 1px; }

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin-top: 18px; padding-top: 16px; border-top: 0.5px solid var(--sep);
}
.stat + .stat { box-shadow: inset 0.5px 0 0 var(--sep); }
.stat-val {
  font-family: var(--font-round); font-size: var(--fs-title); font-weight: 700;
  letter-spacing: -0.5px; line-height: 1.1; font-variant-numeric: tabular-nums;
}
.stat-label { font-size: var(--fs-caption); color: var(--ink-3); margin-top: 3px; }

.size-card { display: flex; gap: 14px; align-items: flex-start; }
.size-figure {
  flex-shrink: 0; width: 56px; height: 56px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
}
.size-figure svg { width: 26px; height: 26px; stroke-width: 1.9; }
.size-like { font-size: var(--fs-headline); font-weight: 600; letter-spacing: var(--ls-head); line-height: 1.25; }
.size-measures { display: flex; gap: 14px; margin-top: 3px; font-size: var(--fs-footnote); color: var(--ink-3); }
.size-measures b { color: var(--ink); font-weight: 600; font-family: var(--font-round); font-variant-numeric: tabular-nums; }
.size-dev { font-size: var(--fs-subhead); color: var(--ink-2); line-height: 1.45; margin-top: 12px; letter-spacing: var(--ls-sub); }

/* Quick call buttons */
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 var(--gutter) 12px; }
.quick a {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 14px; border-radius: 18px; background: var(--surface);
  text-decoration: none; min-width: 0;
  transition: transform var(--t-fast) var(--spring), background var(--t-fast) var(--ease);
}
.quick a:active { transform: scale(.97); background: var(--pressed); }
.quick .q-label { font-size: var(--fs-subhead); font-weight: 600; letter-spacing: var(--ls-sub); line-height: 1.2; }
.quick .q-sub { font-size: var(--fs-caption); color: var(--ink-3); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick .tile { border-radius: 50%; }

/* ── Appointments ───────────────────────────────────────────────── */
.date-tile {
  flex-shrink: 0; width: 48px; text-align: center; line-height: 1;
  padding: 7px 0 8px; border-radius: var(--r-inner); background: var(--fill);
}
.date-tile .m { font-size: var(--fs-micro); font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--accent-ink); }
.date-tile .d { display: block; font-family: var(--font-round); font-size: 22px; font-weight: 700; margin-top: 3px; font-variant-numeric: tabular-nums; }
.date-tile.today { background: var(--accent); }
.date-tile.today .m, .date-tile.today .d { color: var(--on-accent); }
.appt { align-items: flex-start; --inset: 76px; }
.appt .row-title { font-weight: 600; }
.appt .meta { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 4px; font-size: var(--fs-footnote); color: var(--ink-3); }
.appt .meta span { display: inline-flex; align-items: center; gap: 5px; }
.appt .meta svg { width: 13px; height: 13px; stroke-width: 2.2; }
.appt.past { opacity: .55; }

.next-appt { padding: 18px; }
.next-appt .kicker { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.next-appt .when-big { font-family: var(--font-round); font-size: var(--fs-title); font-weight: 700; letter-spacing: -0.5px; }
.next-appt h3 { font-size: var(--fs-title3); font-weight: 700; letter-spacing: var(--ls-title3); line-height: 1.2; margin-top: 12px; }
.next-appt .meta { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: var(--fs-subhead); color: var(--ink-2); }
.next-appt .meta span { display: flex; align-items: center; gap: 8px; }
.next-appt .meta svg { width: 16px; height: 16px; color: var(--ink-3); stroke-width: 2; }
.next-appt .btn-row { margin-top: 16px; }

.disclosure {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 14px 16px; font-size: var(--fs-callout); color: var(--ink-2);
}
.disclosure .phase-chev { margin-left: auto; transform: rotate(-90deg); }
.disclosure[aria-expanded="true"] .phase-chev { transform: none; }

/* ── Journal ────────────────────────────────────────────────────── */
.day-head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 20px calc(var(--gutter) + 4px) 8px;
}
.day-head b { font-size: var(--fs-subhead); font-weight: 600; letter-spacing: var(--ls-sub); }
.day-head span { font-size: var(--fs-footnote); color: var(--ink-3); }
.entry { padding: 15px 16px; cursor: pointer; transition: background var(--t-fast) var(--ease); }
.entry:active { background: var(--pressed); }
.entry-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: var(--fs-footnote); color: var(--ink-3); }
.entry-meta .who {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: 10px; font-weight: 700; background: var(--fill-2); color: var(--ink-2);
}
.entry-meta .time { font-variant-numeric: tabular-nums; }
.entry-text { font-size: var(--fs-callout); line-height: 1.5; letter-spacing: var(--ls-callout); white-space: pre-wrap; overflow-wrap: anywhere; }
.entry.clamp .entry-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── More / settings ────────────────────────────────────────────── */
.profile-card { display: flex; align-items: center; gap: 14px; padding: 16px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
  background: var(--accent-soft); color: var(--accent-ink);
  font-family: var(--font-round); font-size: var(--fs-title3); font-weight: 700;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 34px; height: 34px; font-size: var(--fs-footnote); }

.toggle { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.toggle input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.toggle i { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--fill-3); transition: background var(--t-med) var(--ease); }
.toggle i::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16);
  transition: transform var(--t-med) var(--spring);
}
.toggle input:checked + i { background: var(--success); }
.toggle input:checked + i::after { transform: translateX(20px); }

.appearance { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 14px 12px; }
.appearance button {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  font-size: var(--fs-caption); font-weight: 500; color: var(--ink-2);
}
.appearance .swatch {
  width: 100%; aspect-ratio: 0.82; border-radius: 12px; position: relative; overflow: hidden;
  box-shadow: inset 0 0 0 0.5px var(--sep-strong);
  transition: box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--spring);
}
.appearance button:active .swatch { transform: scale(.96); }
.appearance button[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.appearance button[aria-pressed="true"] .swatch { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.swatch i { position: absolute; left: 14%; right: 14%; height: 12%; border-radius: 4px; }
.swatch i:nth-child(1) { top: 16%; }
.swatch i:nth-child(2) { top: 36%; right: 34%; }
.swatch i:nth-child(3) { top: 62%; height: 20%; border-radius: 6px; }
.sw-system { background: linear-gradient(135deg, #F4F2EF 50%, #0B0A09 50%); }
.sw-system i { background: rgba(127,120,115,0.45); }
.sw-light { background: #F4F2EF; } .sw-light i { background: #fff; } .sw-light i:nth-child(3) { background: #EE5A3B; }
.sw-dark { background: #0B0A09; } .sw-dark i { background: #2A2725; } .sw-dark i:nth-child(3) { background: #FF7556; }
.sw-blush { background: #FAF0EE; } .sw-blush i { background: #fff; } .sw-blush i:nth-child(3) { background: #E0587E; }

.footnote { font-size: var(--fs-footnote); color: var(--ink-3); padding: 8px calc(var(--gutter) + 4px) 0; line-height: 1.4; }

/* ── Resources ──────────────────────────────────────────────────── */
.res { --inset: 58px; }
.res .row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .row-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res .tag { margin-left: 6px; }
.res-more {
  width: 40px; height: 40px; margin: -8px -10px -8px 0; flex-shrink: 0;
  display: grid; place-items: center; color: var(--faint); border-radius: 50%;
}
.res-more svg { width: 18px; height: 18px; stroke-width: 2.2; }
.res-more:active { background: var(--pressed); }
.kv { --inset: 16px; }
.kv .k { width: 128px; flex-shrink: 0; font-size: var(--fs-subhead); color: var(--ink-3); letter-spacing: var(--ls-sub); }
.kv .v { flex: 1; min-width: 0; font-size: var(--fs-subhead); letter-spacing: var(--ls-sub); overflow-wrap: anywhere; }
a.kv .v { color: var(--accent-ink); }

/* ── Assistant ──────────────────────────────────────────────────── */
.chat { padding: 0 var(--gutter); display: flex; flex-direction: column; gap: 8px; }
.msg { display: flex; }
.msg.user { justify-content: flex-end; }
.bubble {
  max-width: 86%; padding: 10px 14px; border-radius: 20px;
  font-size: var(--fs-subhead); line-height: 1.47; letter-spacing: var(--ls-sub);
  background: var(--surface); overflow-wrap: anywhere;
}
.msg.assistant .bubble { border-bottom-left-radius: 6px; }
.msg.user .bubble { background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 6px; }
.bubble p { margin: 0 0 8px; } .bubble p:last-child { margin: 0; }
.bubble ul, .bubble ol { margin: 0 0 8px; padding-left: 20px; }
.bubble li { margin-bottom: 3px; }
.bubble strong { font-weight: 600; }
.bubble a { color: var(--accent-ink); }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: typing 1.2s infinite var(--ease); }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%,60%,100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.chat-intro { text-align: center; padding: 8px 24px 18px; }
.chat-intro .tile { margin: 0 auto 12px; }
.chat-intro h3 { font-size: var(--fs-title3); font-weight: 700; letter-spacing: var(--ls-title3); }
.chat-intro p { font-size: var(--fs-subhead); color: var(--ink-3); margin-top: 6px; line-height: 1.45; }
.suggestions { display: flex; flex-direction: column; gap: 8px; padding: 4px var(--gutter) 0; }
.suggestions button {
  text-align: left; padding: 13px 16px; border-radius: 16px; background: var(--surface);
  font-size: var(--fs-subhead); letter-spacing: var(--ls-sub); color: var(--ink);
  display: flex; align-items: center; gap: 10px;
  transition: transform var(--t-fast) var(--spring), background var(--t-fast) var(--ease);
}
.suggestions button svg { width: 16px; height: 16px; color: var(--accent-ink); stroke-width: 2.2; }
.suggestions button:active { transform: scale(.98); background: var(--pressed); }
.composer {
  position: fixed; z-index: 70;
  left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + var(--tabbar-h) + 10px);
  width: min(460px, calc(100% - 20px));
  display: flex; align-items: flex-end; gap: 8px;
  padding: 6px 6px 6px 16px; border-radius: 26px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  box-shadow: inset 0 0.5px 0 var(--glass-line), 0 0 0 0.5px var(--glass-edge), var(--shadow-float);
}
.composer textarea {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; resize: none;
  padding: 9px 0; max-height: 120px; line-height: 1.35;
  font-size: var(--fs-callout); letter-spacing: var(--ls-callout);
}
.composer textarea::placeholder { color: var(--ink-3); }
.send-btn {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--on-ink);
  transition: transform var(--t-fast) var(--spring), opacity var(--t-fast) var(--ease);
}
.send-btn svg { width: 18px; height: 18px; stroke-width: 2.5; }
.send-btn:active { transform: scale(.9); }
.send-btn:disabled { opacity: .25; }
.view-assistant-pad { height: 90px; }
.disclaimer { text-align: center; font-size: var(--fs-caption); color: var(--ink-3); padding: 14px 32px 0; line-height: 1.4; }

/* ── Baby names ─────────────────────────────────────────────────── */
.name-stage { padding: 6px var(--gutter) 0; }
.name-card {
  position: relative; background: var(--surface); border-radius: 28px;
  padding: 54px 24px 28px; text-align: center; touch-action: pan-y;
  transition: transform var(--t-slow) var(--spring), opacity var(--t-med) var(--ease);
  will-change: transform;
}
.name-card.dragging { transition: none; }
.name-card .count { position: absolute; top: 16px; left: 0; right: 0; font-size: var(--fs-caption); color: var(--ink-3); font-weight: 500; }
.name-card .nm { font-family: var(--font-round); font-size: 40px; font-weight: 700; letter-spacing: -1px; line-height: 1.1; overflow-wrap: anywhere; }
.name-card .hint { font-size: var(--fs-footnote); color: var(--ink-3); margin-top: 8px; }
.name-card .stamp {
  position: absolute; top: 18px; padding: 4px 10px; border-radius: 8px;
  font-size: var(--fs-footnote); font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  opacity: 0; border: 2px solid currentColor;
}
.name-card .stamp.yes { left: 18px; color: var(--success); transform: rotate(-10deg); }
.name-card .stamp.no  { right: 18px; color: var(--ink-3); transform: rotate(10deg); }
.vote { display: flex; justify-content: center; gap: 22px; margin-top: 26px; }
.vote button {
  width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center;
  transition: transform var(--t-fast) var(--spring);
}
.vote button:active { transform: scale(.88); }
.vote svg { width: 28px; height: 28px; stroke-width: 2.4; }
.vote .no { background: var(--fill-2); color: var(--ink-2); }
.vote .yes { background: var(--accent); color: var(--on-accent); }
.name-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px; }
.name-chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 36px; padding: 0 6px 0 14px; border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--ink);
  font-size: var(--fs-subhead); font-weight: 600;
}
.name-chip button { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; color: var(--ink-3); }
.name-chip svg { width: 15px; height: 15px; stroke-width: 2.4; }
.inline-add { display: flex; gap: 8px; padding: 0 var(--gutter) 14px; }
.inline-add .field { flex: 1; min-width: 0; background: var(--surface); }

/* ── Empty states & skeletons ───────────────────────────────────── */
.empty { text-align: center; padding: 36px 28px; }
.empty .tile { margin: 0 auto 14px; }
.empty h3 { font-size: var(--fs-headline); font-weight: 600; letter-spacing: var(--ls-head); }
.empty p { font-size: var(--fs-subhead); color: var(--ink-3); margin-top: 4px; line-height: 1.45; }
.empty .btn { margin-top: 16px; }
.empty.compact { padding: 22px 20px; }

.skeleton { padding: 14px 16px; display: flex; flex-direction: column; gap: 14px; }
.skeleton i {
  display: block; height: 14px; border-radius: 7px;
  background: linear-gradient(90deg, var(--fill) 25%, var(--fill-2) 50%, var(--fill) 75%);
  background-size: 300% 100%; animation: shimmer 1.4s linear infinite;
}
.skeleton i:nth-child(2) { width: 70%; } .skeleton i:nth-child(3) { width: 82%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }

/* ── Tab bar ────────────────────────────────────────────────────── */
.tabbar {
  position: fixed; z-index: 100;
  bottom: var(--safe-bottom); left: 50%; transform: translateX(-50%);
  width: min(460px, calc(100% - 20px)); height: var(--tabbar-h);
  display: flex; padding: 5px;
  border-radius: 32px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(24px) saturate(190%); backdrop-filter: blur(24px) saturate(190%);
  box-shadow: inset 0 0.5px 0 var(--glass-line), 0 0 0 0.5px var(--glass-edge), var(--shadow-float);
}
.tabbar button {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 27px; color: var(--ink-3);
  font-size: 10px; font-weight: 600; letter-spacing: 0.1px;
  transition: color var(--t-fast) var(--ease), background var(--t-med) var(--ease), transform var(--t-fast) var(--spring);
}
.tabbar svg { width: 24px; height: 24px; stroke-width: 1.8; transition: stroke-width var(--t-fast); }
.tabbar button:active { transform: scale(.92); }
.tabbar button[aria-current="page"] { color: var(--accent-ink); background: var(--fill); }
.tabbar button[aria-current="page"] svg { stroke-width: 2.3; }

/* ── Toast ──────────────────────────────────────────────────────── */
#toasts {
  position: fixed; z-index: 400; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + var(--tabbar-h) + 12px);
  width: min(400px, calc(100% - 28px));
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  max-width: 100%; min-height: 48px; padding: 6px 6px 6px 18px;
  border-radius: 24px; background: var(--ink); color: var(--on-ink);
  font-size: var(--fs-subhead); font-weight: 500; letter-spacing: var(--ls-sub);
  box-shadow: var(--shadow-float);
  opacity: 0; transform: translateY(14px) scale(.96);
  transition: opacity var(--t-med) var(--ease), transform var(--t-med) var(--spring);
}
.toast:not(:has(button)) { padding-right: 18px; }
.toast.show { opacity: 1; transform: none; }
.toast button {
  height: 36px; padding: 0 14px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--on-ink) 14%, transparent); color: var(--on-ink);
  font-size: var(--fs-footnote); font-weight: 600;
}

/* ── Sheets ─────────────────────────────────────────────────────── */
.sheet-root { position: fixed; inset: 0; z-index: 200; }
.sheet-scrim {
  position: absolute; inset: 0; background: var(--scrim);
  animation: fade var(--t-med) var(--ease);
}
.sheet-root.closing .sheet-scrim { opacity: 0; transition: opacity var(--t-med) var(--ease); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(480px, 100%); max-height: calc(100vh - var(--safe-top) - 24px);
  display: flex; flex-direction: column;
  background: var(--sheet-bg);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  box-shadow: var(--shadow-sheet);
  animation: sheet-up 0.5s var(--spring);
  transition: transform 0.36s var(--spring);
}
.sheet.dragging { transition: none; }
.sheet-root.closing .sheet { transform: translate(-50%, 105%) !important; }
@keyframes sheet-up { from { transform: translate(-50%, 100%); } }
.sheet-grab { padding: 7px 0 0; touch-action: none; cursor: grab; }
.sheet-grab::before { content: ''; display: block; width: 36px; height: 5px; margin: 0 auto; border-radius: 3px; background: var(--sep-strong); }
.sheet-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 4px 8px 6px; min-height: 50px; touch-action: none;
}
.sheet-head h2 { font-size: var(--fs-headline); font-weight: 600; letter-spacing: var(--ls-head); text-align: center; }
.sheet-head .btn-plain { font-size: var(--fs-body); font-weight: 400; min-height: 44px; }
.sheet-head .btn-plain.strong { font-weight: 600; justify-self: end; }
.sheet-head > :first-child { justify-self: start; }
.sheet-body {
  overflow-y: auto; overscroll-behavior: contain;
  padding: 6px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + 28px);
}
.sheet-body .card { margin-left: 0; margin-right: 0; }

/* Form fields — grouped like an iOS inset list */
.fields { background: var(--surface); border-radius: var(--r-card); overflow: hidden; margin-bottom: 12px; }
/* Hairlines are a background image, not ::before — inputs can't have pseudo-elements */
.fields > * + * {
  background-image: linear-gradient(var(--sep), var(--sep));
  background-size: calc(100% - 16px) 0.5px; background-position: right top; background-repeat: no-repeat;
}
.fields > .pick-label + .pick { background-image: none; }
.fields > .row + .row::before { display: none; }
.fields .field { background: none; border-radius: 0; }
.field {
  display: block; width: 100%;
  min-height: 50px; padding: 14px 16px;
  border: 0; outline: 0; border-radius: var(--r-field);
  background: var(--fill);
  font-size: var(--fs-callout); letter-spacing: var(--ls-callout); color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
.field::placeholder { color: var(--ink-3); opacity: .85; }
textarea.field { resize: none; line-height: 1.5; min-height: 140px; }
.field-row { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 0 0 0 16px; }
.field-row > label { flex-shrink: 0; font-size: var(--fs-callout); letter-spacing: var(--ls-callout); }
.field-row .field { flex: 1; min-width: 0; text-align: right; padding-left: 0; color: var(--ink-2); }
.field-row select.field { padding-right: 34px; text-align-last: right;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23948C86' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 15 5 5 5-5M7 9l5-5 5 5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.field-row input[type="date"].field, .field-row input[type="time"].field { min-height: 50px; }
.field-hint { font-size: var(--fs-footnote); color: var(--ink-3); padding: 0 16px 14px; margin-top: -4px; line-height: 1.4; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px 14px; }
.pick-label { font-size: var(--fs-footnote); color: var(--ink-3); padding: 12px 16px 0; }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.sheet-actions .btn { width: 100%; min-height: 50px; font-size: var(--fs-callout); }

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ring-wrap .tick.anim { opacity: 1; }
}
