/* ══════════════════════════════════════════════════════════════════════════
   Eileen — Neumorphic (Soft UI) design system
   Rules honoured: monochromatic base, 2-layer soft shadows, 12–22px radii,
   150ms press, ≥44px touch targets, ≥4.5:1 body text in BOTH themes.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Near-white with a periwinkle tint — verified: ink 12.3:1, muted 6.1:1,
     accent 5.3:1, white-on-accent 5.9:1. Every tone icon clears 3:1. */
  --surface:     #F2F1FA;
  --surface-alt: #EBEAF6;
  --sh-dark:     #C9C6E4;
  --sh-light:    #FFFFFF;
  --ink:         #2C2A45;
  --muted:       #5A5680;
  --accent:      #5B4FD6;
  --on-accent:   #FFFFFF;
  --danger:      #A82F4C;

  --tone-indigo: #4A3FA8;
  --tone-amber:  #8A5A0E;
  --tone-teal:   #0C6B69;
  --tone-rose:   #A94A62;

  --stage-bg:    #E4E2F3;

  /* Soft-UI shadow recipes (2 layers, per neumorphism spec) */
  --sh-raise:    6px 6px 14px var(--sh-dark), -6px -6px 14px var(--sh-light);
  --sh-raise-sm: 4px 4px 9px var(--sh-dark), -4px -4px 9px var(--sh-light);
  --sh-inset:    inset 4px 4px 9px var(--sh-dark), inset -4px -4px 9px var(--sh-light);
  --sh-inset-sm: inset 3px 3px 6px var(--sh-dark), inset -3px -3px 6px var(--sh-light);

  /* Radii */
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* 4/8 spacing rhythm */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
  --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px;

  /* Motion */
  --press: 150ms;
  --ease:  cubic-bezier(0.4, 0, 0.2, 1);

  /* Simulated iPhone safe areas (overridden by env() on real devices) */
  --safe-top: 56px;
  --safe-bot: 26px;
}

[data-theme="dark"] {
  /* Dark periwinkle — verified: ink 12.7:1, muted 6.5:1, accent 7.9:1,
     ink-on-accent 8.8:1. Every tone icon clears 3:1. */
  --surface:     #252338;
  --surface-alt: #2A2840;
  --sh-dark:     #191826;
  --sh-light:    #322F4A;
  --ink:         #EAE8FA;
  --muted:       #A9A5C8;
  --accent:      #B6B2FF;
  --on-accent:   #1B1A28;
  --danger:      #F290A4;

  --tone-indigo: #B3ACF7;
  --tone-amber:  #E3B76A;
  --tone-teal:   #63D0CA;
  --tone-rose:   #F09CAE;

  --stage-bg:    #16151F;

  --sh-raise:    6px 6px 14px var(--sh-dark), -6px -6px 14px var(--sh-light);
  --sh-raise-sm: 4px 4px 9px var(--sh-dark), -4px -4px 9px var(--sh-light);
  --sh-inset:    inset 4px 4px 9px var(--sh-dark), inset -4px -4px 9px var(--sh-light);
  --sh-inset-sm: inset 3px 3px 6px var(--sh-dark), inset -3px -3px 6px var(--sh-light);
}

/* ── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--stage-bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; cursor: pointer; }
ol, ul { margin: 0; padding: 0; list-style: none; }
h1, h2, p { margin: 0; }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.ico {
  width: 24px; height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.ico--sm { width: 18px; height: 18px; }

/* ── Desktop preview stage ──────────────────────────────────────────────── */
.stage {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 5vw, 72px);
  padding: var(--s10) var(--s6);
  background:
    radial-gradient(1100px 620px at 30% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    var(--stage-bg);
}

.stage__panel { max-width: 290px; }
.stage__eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
}
.stage__title { margin: var(--s2) 0 var(--s3); font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.stage__note  { font-size: 15px; color: var(--muted); margin-bottom: var(--s8); }
.stage__group { margin-bottom: var(--s6); }
.stage__label { display: block; font-size: 13px; font-weight: 700; margin-bottom: var(--s2); color: var(--muted); }
.stage__hint  { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

.segmented {
  display: flex; gap: var(--s1);
  padding: var(--s1);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-inset-sm);
}
.segmented__btn {
  flex: 1;
  min-height: 44px;
  padding: 0 var(--s3);
  border-radius: var(--r-pill);
  font-size: 13px; font-weight: 700; color: var(--muted);
  white-space: nowrap;
  transition: color var(--press) var(--ease), box-shadow var(--press) var(--ease);
}
.segmented__btn.is-on {
  color: var(--accent);
  background: var(--surface);
  box-shadow: var(--sh-raise-sm);
}

.devcard {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-raise-sm);
}
.devcard__icon { display: grid; place-items: center; color: var(--accent); }
.devcard__text { display: flex; flex-direction: column; min-width: 0; }
.devcard__name { font-size: 15px; font-weight: 800; letter-spacing: -.01em; }
.devcard__dims {
  font-size: 12px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Device frame ───────────────────────────────────────────────────────── */
/* `zoom` (not transform) so the shrunk device still reserves correct layout
   space — app.js sets it so the whole phone fits short laptop screens. */
.device { flex: none; zoom: var(--dev-zoom, 1); }

.device__frame {
  position: relative;
  width: var(--dev-w, 393px);
  height: var(--dev-h, 852px);
  border-radius: 54px;
  background: var(--surface);
  overflow: hidden;
  isolation: isolate;
  /* Titanium bezel + ambient lift */
  box-shadow:
    0 0 0 12px #35324A,
    0 0 0 14px #6B6788,
    0 34px 70px rgba(20, 22, 34, .40),
    0 8px 20px rgba(20, 22, 34, .22);
}

.device__island {
  position: absolute; top: 11px; left: 50%;
  transform: translateX(-50%);
  width: 124px; height: 36px;
  border-radius: var(--r-pill);
  background: #0A0B0F;
  z-index: 40;
  pointer-events: none;
}

.device__home {
  position: absolute; bottom: 9px; left: 50%;
  transform: translateX(-50%);
  width: 140px; height: 5px;
  border-radius: var(--r-pill);
  background: var(--ink);
  opacity: .28;
  z-index: 30;
  pointer-events: none;
}

/* ── App shell ──────────────────────────────────────────────────────────── */
.app {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.hdr {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
  padding: calc(var(--safe-top) + var(--s4)) var(--s5) var(--s4);
}

.hdr__id { display: flex; align-items: center; gap: var(--s3); min-width: 0; }

.hdr__text { display: flex; flex-direction: column; min-width: 0; }
.hdr__name { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.hdr__date { font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }

.btn-round {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--sh-raise-sm);
  transition: box-shadow var(--press) var(--ease), color var(--press) var(--ease);
}
.btn-round:active { box-shadow: var(--sh-inset-sm); color: var(--accent); }

/* ── Day selector ───────────────────────────────────────────────────────── */
/* Sticky inside the scroller and fully opaque, so the timeline passes cleanly
   behind it. Bled to the frame edges with negative margins that cancel the
   scroller's padding — otherwise content would show through the gutters. */
.days {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin: 0 calc(var(--s5) * -1) var(--s2);
  padding: var(--s2) var(--s5) var(--s5);
  background: var(--surface);
  transition: box-shadow 200ms var(--ease);
}
.app.is-scrolled .days {
  box-shadow: 0 12px 16px -12px var(--sh-dark);
}

.day {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  min-height: 62px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-raise-sm);
  color: var(--muted);
  font-weight: 700;
  transition: box-shadow var(--press) var(--ease), color var(--press) var(--ease);
}
.day__letter { font-size: 11px; line-height: 1; font-weight: 800; letter-spacing: .04em; opacity: .75; }
.day__num { font-size: 15px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.day__dot {
  width: 6px; height: 6px;
  border-radius: var(--r-pill);
  background: currentColor;
  opacity: .9;
}
.day__dot--off { background: none; box-shadow: inset 0 0 0 1.5px currentColor; opacity: .5; }

.day:active { box-shadow: var(--sh-inset-sm); }
.day.is-sel {
  box-shadow: var(--sh-inset-sm);
  color: var(--accent);
}
.day.is-today .day__letter::after {
  content: '';
  position: absolute; top: 7px; right: 8px;
  width: 5px; height: 5px;
  border-radius: var(--r-pill);
  background: var(--tone-rose);
}

/* ── Scroll region ──────────────────────────────────────────────────────── */
.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 var(--s5) calc(var(--safe-bot) + var(--s8));
  scrollbar-width: none;
}


.scroll::-webkit-scrollbar { display: none; }

/* ── "Now" card ─────────────────────────────────────────────────────────── */
.now {
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-raise);
  padding: var(--s5);
  margin-bottom: var(--s5);
}

.now__top { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); }

.now__badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 11px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
}
.now__badge--idle { background: var(--surface); color: var(--muted); box-shadow: var(--sh-inset-sm); }

.now__pulse {
  width: 6px; height: 6px; border-radius: var(--r-pill);
  background: currentColor;
  animation: pulse 2.2s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.now__icon {
  display: grid; place-items: center;
  width: 52px; height: 52px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-inset-sm);
}
.now__row { display: flex; align-items: center; gap: var(--s4); }
.now__body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.now__title { font-size: 21px; font-weight: 800; letter-spacing: -.015em; line-height: 1.2; }
.now__meta { font-size: 16px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }

.now__track {
  height: 10px;
  margin-top: var(--s4);
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-inset-sm);
  overflow: hidden;
}
.now__fill {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--accent);
  transition: width 600ms var(--ease);
}
.now__next {
  margin-top: var(--s3);
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.now__next b { color: var(--ink); font-weight: 800; }

/* ── Master day toggle ──────────────────────────────────────────────────── */
.master {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
  padding: var(--s5);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-raise-sm);
  margin-bottom: var(--s8);
}
.master__txt { display: flex; flex-direction: column; min-width: 0; }
.master__title { font-size: 16px; font-weight: 800; }
.master__sub { font-size: 13px; font-weight: 600; color: var(--muted); }

/* ── Switch (44px target, inset track + raised thumb) ───────────────────── */
.switch {
  flex: none;
  display: grid; place-items: center;
  width: 62px; height: 44px;
  border-radius: var(--r-pill);
}
.switch__track {
  position: relative;
  display: block;
  width: 58px; height: 32px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-inset-sm);
  transition: background var(--press) var(--ease);
}
.switch__thumb {
  position: absolute; top: 4px; left: 4px;
  width: 24px; height: 24px;
  border-radius: var(--r-pill);
  background: var(--surface);
  box-shadow: var(--sh-raise-sm);
  transition: transform 220ms var(--ease), background var(--press) var(--ease);
}
.switch[aria-checked="true"] .switch__track { background: var(--accent); }
.switch[aria-checked="true"] .switch__thumb { transform: translateX(26px); background: var(--sh-light); }
.switch:active .switch__thumb { width: 30px; }

/* ── Section heading ────────────────────────────────────────────────────── */
.sec {
  font-size: 12px; font-weight: 800;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted);
  margin-bottom: var(--s4);
  padding-left: var(--s1);
}

/* ── Timeline ───────────────────────────────────────────────────────────── */
.tl { display: flex; flex-direction: column; gap: var(--s4); }

.tl__item { position: relative; display: flex; align-items: stretch; gap: var(--s3); }

/* The card body is the edit trigger; the bell is a separate control. */
.tl__main {
  flex: 1;
  min-width: 0;
  display: flex; align-items: center; gap: var(--s4);
  padding: var(--s4);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-raise-sm);
  text-align: left;
  transition: box-shadow var(--press) var(--ease), opacity var(--press) var(--ease);
}
.tl__main:active { box-shadow: var(--sh-inset-sm); }

.tl__icon {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  flex: none;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-inset-sm);
}
.tone-indigo { color: var(--tone-indigo); }
.tone-amber  { color: var(--tone-amber); }
.tone-teal   { color: var(--tone-teal); }
.tone-rose   { color: var(--tone-rose); }

.tl__body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.tl__title {
  display: block;
  font-size: 13.5px; font-weight: 700; color: var(--muted);
  letter-spacing: .01em; line-height: 1.25;
}
.tl__time {
  display: block;
  font-size: 19px; font-weight: 800; color: var(--ink);
  letter-spacing: -.02em; line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* The "Settled by" / "Approx." qualifier stays quiet next to the numerals. */
.tl__note { font-size: 12.5px; font-weight: 700; color: var(--muted); }

.tl__bell {
  flex: none;
  display: grid; place-items: center;
  width: 46px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-raise-sm);
  color: var(--accent);
  transition: box-shadow var(--press) var(--ease), color var(--press) var(--ease);
}
.tl__bell:active { box-shadow: var(--sh-inset-sm); }
.tl__bell.is-muted { color: var(--muted); box-shadow: var(--sh-inset-sm); }

/* Item states — never colour-only: shape/opacity/label carry the meaning too */
.tl__item.is-done .tl__main { box-shadow: var(--sh-inset-sm); opacity: .62; }
.tl__item.is-now  .tl__main { box-shadow: var(--sh-raise), 0 0 0 2px var(--accent); }
.tl__item.is-now  .tl__title { color: var(--accent); }

.tl__flag {
  display: inline-block;
  margin-left: var(--s2);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10px; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
  vertical-align: 1px;
  white-space: nowrap;
}

/* Whole-day-off dimming */
.tl.is-off { opacity: .48; }

.foot {
  margin-top: var(--s8);
  font-size: 12.5px; font-weight: 600;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}

/* ── Scrim + sheets ─────────────────────────────────────────────────────── */
.scrim {
  position: absolute; inset: 0;
  background: rgba(18, 19, 28, .46);
  z-index: 50;
  opacity: 0;
  transition: opacity 240ms var(--ease);
}
.scrim.is-open { opacity: 1; }

.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  z-index: 60;
  padding: var(--s3) var(--s5) calc(var(--safe-bot) + var(--s5));
  border-radius: 30px 30px 0 0;
  background: var(--surface-alt);
  box-shadow: 0 -14px 34px rgba(20, 22, 34, .22);
  transform: translateY(100%);
  transition: transform 320ms var(--ease);
  max-height: 88%;
  overflow-y: auto;
  scrollbar-width: none;
}
.sheet::-webkit-scrollbar { display: none; }
.sheet.is-open { transform: translateY(0); }

.sheet__grip {
  display: block;
  width: 42px; height: 5px;
  margin: 0 auto var(--s4);
  border-radius: var(--r-pill);
  background: var(--muted);
  opacity: .35;
}
.sheet__title { font-size: 20px; font-weight: 800; letter-spacing: -.015em; margin-bottom: var(--s5); }
.sheet__body { display: flex; flex-direction: column; gap: var(--s5); }
.sheet__hint { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-top: calc(var(--s3) * -1); }
.sheet__actions { display: flex; gap: var(--s3); margin-top: var(--s6); }

/* ── Fields + rows ──────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--s2); }
.field[hidden] { display: none; }
.field__label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field__input {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--s4);
  border: 0;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-inset-sm);
  font-size: 17px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  appearance: none;
}
select.field__input {
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
                    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) 24px, calc(100% - 14px) 24px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 44px;
}
input[type="time"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }

.row {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s4);
  min-height: 52px;
}
.row__label { font-size: 15px; font-weight: 700; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  min-height: 52px;
  padding: 0 var(--s5);
  border-radius: var(--r-md);
  font-size: 15px; font-weight: 800;
  transition: box-shadow var(--press) var(--ease), opacity var(--press) var(--ease);
}
.btn--primary {
  flex: 1;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--sh-raise-sm);
}
.btn--primary:active { box-shadow: var(--sh-inset-sm); opacity: .92; }

.btn--ghost {
  flex: 1;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--sh-raise-sm);
}
.btn--ghost:active { box-shadow: var(--sh-inset-sm); }

.btn--chip {
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 44px;
  padding: 0 var(--s4);
  border-radius: var(--r-pill);
  background: var(--surface);
  color: var(--accent);
  font-size: 14px;
  box-shadow: var(--sh-raise-sm);
}
.btn--chip:active { box-shadow: var(--sh-inset-sm); }
.btn--chip[disabled] { color: var(--muted); box-shadow: var(--sh-inset-sm); cursor: default; opacity: .7; }
.btn--danger { color: var(--danger); }

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: absolute;
  left: var(--s5); right: var(--s5);
  bottom: calc(var(--safe-bot) + var(--s5));
  z-index: 70;
  padding: var(--s3) var(--s4);
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--surface);
  font-size: 14px; font-weight: 700;
  text-align: center;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
}
.toast.is-open { opacity: 1; transform: translateY(0); }

/* ── Narrow desktop windows: drop the side panel, keep the phone framed ─── */
/* A narrow window is not a phone. Losing the frame here was the bug — it left a
   naked column floating in space with no safe-area padding. */
@media (max-width: 1000px) {
  .stage { gap: 0; padding: var(--s5) var(--s4); }
  .stage__panel { display: none; }
}

/* ── Actual phones: full bleed, real safe areas ─────────────────────────── */
@media (max-width: 560px), (hover: none) and (pointer: coarse) {
  .stage { display: block; padding: 0; background: var(--surface); }
  .stage__panel { display: none; }
  .device { height: 100%; }
  .device__frame {
    width: 100%;
    max-width: none;
    height: 100dvh;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .device__island, .device__home { display: none; }
  :root {
    --safe-top: env(safe-area-inset-top, 12px);
    --safe-bot: env(safe-area-inset-bottom, 12px);
  }
}

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

/* ── Wheel time picker (iOS alarm-drum style) ───────────────────────────── */
.picker {
  --row: 44px;
  --rows: 5;
  position: relative;
  display: flex;
  justify-content: center;
  gap: var(--s1);
  height: calc(var(--row) * var(--rows));
  padding: 0 var(--s3);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--sh-inset-sm);
  overflow: hidden;
  touch-action: pan-y;
}

/* The raised centre band marks the committed value. */
.picker__band {
  position: absolute;
  left: var(--s2); right: var(--s2);
  top: 50%;
  height: var(--row);
  margin-top: calc(var(--row) / -2);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--sh-raise-sm);
  pointer-events: none;
}

.picker__col {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* Half a viewport of padding top and bottom so the first and last values
     can still settle in the centre band. */
  padding-block: calc(var(--row) * (var(--rows) - 1) / 2);
  mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 76%, transparent);
}
.picker__col::-webkit-scrollbar { display: none; }
.picker__col:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: var(--r-md); }

.picker__item {
  height: var(--row);
  line-height: var(--row);
  min-width: 58px;
  scroll-snap-align: center;
  text-align: center;
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  opacity: .5;
  cursor: pointer;
  transition: color var(--press) var(--ease), opacity var(--press) var(--ease),
              font-size var(--press) var(--ease);
}
.picker__item.is-sel {
  color: var(--ink);
  opacity: 1;
  font-size: 23px;
  font-weight: 800;
}

.picker__sep {
  z-index: 1;
  align-self: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  pointer-events: none;
  margin-top: -2px;
}

/* Segmented control inside a sheet needs its own top margin rhythm */
.sheet .segmented[hidden] { display: none; }

/* ── Calendar panel ─────────────────────────────────────────────────────── */
.hdr__actions { display: flex; gap: var(--s2); flex: none; }

.btn-round--sm { width: 44px; height: 44px; }

.cal__bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s3);
}
.cal__month { font-size: 17px; font-weight: 800; letter-spacing: -.01em; }

.cal__dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--s1);
  margin-bottom: calc(var(--s3) * -1);
  font-size: 11px; font-weight: 800;
  letter-spacing: .08em;
  color: var(--muted);
  text-align: center;
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: var(--s1);
  /* The grid owns vertical gestures so a range drag is not read as a scroll. */
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.cal__day {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  min-height: 46px;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--sh-raise-sm);
  font-size: 14px; font-weight: 700;
  color: var(--ink);
  transition: box-shadow var(--press) var(--ease), color var(--press) var(--ease);
}
.cal__day:active { box-shadow: var(--sh-inset-sm); }
.cal__day--pad {
  box-shadow: none; background: none;
  color: var(--muted); opacity: .35;
  pointer-events: none;
}
.cal__day.is-sel { box-shadow: var(--sh-inset-sm); color: var(--accent); }
.cal__day.is-today::after {
  content: '';
  position: absolute; top: 5px; right: 6px;
  width: 5px; height: 5px;
  border-radius: var(--r-pill);
  background: var(--tone-rose);
}

/* Same dot language as the week strip: filled = on, hollow = off. */
.cal__dot {
  width: 5px; height: 5px;
  border-radius: var(--r-pill);
  background: currentColor;
}
.cal__dot--off { background: none; box-shadow: inset 0 0 0 1.5px currentColor; opacity: .45; }


/* Live preview of the span being dragged, before it is committed. */
.cal__day.is-drag {
  box-shadow: var(--sh-inset-sm), 0 0 0 2px var(--accent);
  color: var(--accent);
}

.cal__pick { margin-top: var(--s2); }

/* ── Update banner ──────────────────────────────────────────────────────── */
.update {
  position: absolute;
  left: var(--s4); right: var(--s4);
  bottom: calc(var(--safe-bot) + var(--s4));
  z-index: 65;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--r-lg);
  background: var(--surface-alt);
  box-shadow: var(--sh-raise), 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 240ms var(--ease), transform 240ms var(--ease);
}
.update.is-open { opacity: 1; transform: translateY(0); }
.update[hidden] { display: none; }

.update__text { display: flex; flex-direction: column; min-width: 0; flex: 1 1 140px; }
.update__title { font-size: 14px; font-weight: 800; letter-spacing: -.01em; }
.update__sub {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-wrap: pretty;
}

.update__actions { display: flex; gap: var(--s2); flex: 0 0 auto; margin-left: auto; }
.update__actions:empty { display: none; }

.btn--go { background: var(--accent); color: var(--on-accent); }
.btn--go:active { box-shadow: var(--sh-inset-sm); opacity: .92; }
