/* Flow — the visual system from flow-spec.md §4.
   Soft shadows only, generous radii, stroke icons, no hard borders except the
   1.5px ring on today's card. */

:root {
  --bg: #FAF6EF;
  --surface: #FFFFFF;
  --ink: #403B34;
  --ink-soft: #948B80;
  --ink-faint: #B7ADA0;

  --primary: #EE9C82;
  --primary-ink: #D97E5F;
  --primary-tint: #FBE7DD;

  --voice: #B071C0;
  --voice-tint: #EFE0F2;

  --success: #93BE86;
  --success-ink: #5F7E52;
  --success-tint: #E6F0E2;

  --warm: #D9A15F;
  --danger: #D98080;

  --r-card: 22px;
  --r-sheet: 30px;
  --r-btn: 18px;
  --r-pill: 20px;

  --sh-card: 0 6px 18px rgba(120, 100, 80, .06);
  --sh-raised: 0 4px 14px rgba(120, 100, 80, .07);
  --sh-primary: 0 10px 22px rgba(238, 156, 130, .40);
  --sh-voice: 0 6px 16px rgba(190, 143, 201, .22);
  --sh-success: 0 10px 22px rgba(147, 190, 134, .42);

  --pad: 20px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --bar-h: 52px;

  /* Per-day tints and dots, index 0 = Monday. */
  --tint-0: #FBE6E6; --dot-0: #E79A9A;
  --tint-1: #FCEBDC; --dot-1: #EBAE82;
  --tint-2: #FAF2D6; --dot-2: #D9C063;
  --tint-3: #E6F0E2; --dot-3: #93BE86;
  --tint-4: #E1EDF4; --dot-4: #85B4D2;
  --tint-5: #E6E7F4; --dot-5: #9AA0DC;
  --tint-6: #F0E4F1; --dot-6: #BE8FC9;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Nunito', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

button, input, select { font: inherit; color: inherit; }
button { border: 0; background: none; padding: 0; cursor: pointer; }
[hidden] { display: none !important; }

.fred { font-family: 'Fredoka', 'Nunito', system-ui, sans-serif; }
.subtle { color: var(--ink-soft); font-size: 14px; font-weight: 600; margin: 4px 0 0; }
.label { font-size: 12px; font-weight: 800; color: #B0A697; letter-spacing: .4px; margin: 0; }

.ico {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2.2;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
#i-mark circle, .brand-tile circle, .logo-tile circle { fill: currentColor; stroke: none; }

.screen { min-height: 100dvh; position: relative; }

/* ---------- 1 · Welcome ---------- */

.welcome {
  background: linear-gradient(180deg, #FDEDE4 0%, var(--bg) 46%, var(--bg) 100%);
  padding: 0 26px;
  display: flex; flex-direction: column; align-items: center;
  overflow: hidden;
}
.blob { position: absolute; border-radius: 50%; }
.blob-coral { top: -70px; right: -50px; width: 200px; height: 200px; background: #FBD9C9; opacity: .5; }
.blob-violet { top: 60px; left: -60px; width: 150px; height: 150px; background: #E9DFF0; opacity: .55; }

.welcome-logo {
  margin-top: clamp(64px, 14vh, 120px);
  z-index: 1; display: flex; flex-direction: column; align-items: center;
}
.logo-tile {
  width: 88px; height: 88px; border-radius: 28px;
  background: var(--primary); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 16px 34px rgba(238, 156, 130, .42);
}
.wordmark-xl { margin: 22px 0 0; font-size: 40px; font-weight: 600; letter-spacing: .3px; }
.tagline {
  margin: 10px 0 0; font-size: 16px; font-weight: 600; color: var(--ink-soft);
  text-align: center; line-height: 1.5; max-width: 250px;
}
.week-dots { margin-top: 44px; z-index: 1; display: flex; gap: 10px; }
.week-dots span { width: 15px; height: 15px; border-radius: 50%; }
.welcome-cta { position: absolute; left: 26px; right: 26px; bottom: calc(56px + var(--safe-b)); z-index: 1; }
.hint { margin: 16px 0 0; text-align: center; font-size: 13.5px; font-weight: 700; color: #B0A697; }

/* ---------- buttons ---------- */

.btn {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  border-radius: var(--r-btn); font-weight: 800;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-lg { height: 58px; font-size: 18px; width: 100%; }
.btn-md { height: 54px; border-radius: 17px; font-size: 17px; width: 100%; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--sh-primary); }
.btn-success { background: var(--success); color: #fff; box-shadow: var(--sh-success); }
.btn-danger { background: #FBE4E4; color: var(--danger); box-shadow: 0 6px 16px rgba(217, 128, 128, .18); }
.btn-quiet { height: 46px; width: 100%; color: #A99E8F; font-size: 14px; }
.btn-ghost {
  flex: 1; height: var(--bar-h); background: var(--surface);
  box-shadow: 0 6px 18px rgba(120, 100, 80, .08);
  color: #8A7F70; font-size: 13.5px; border-radius: 16px;
}
.icon-btn { display: grid; place-items: center; color: var(--ink-soft); }
.icon-btn.round { width: 34px; height: 34px; border-radius: 50%; background: var(--surface); box-shadow: 0 4px 12px rgba(120, 100, 80, .08); }
.icon-btn.square { width: 58px; height: 58px; border-radius: var(--r-btn); background: var(--surface); box-shadow: 0 6px 16px rgba(120, 100, 80, .08); }

.fab {
  width: var(--bar-h); height: var(--bar-h); border-radius: 16px;
  display: grid; place-items: center; flex-shrink: 0;
  transition: transform .12s ease;
}
.fab:active { transform: scale(.94); }
.fab-lg { width: 58px; height: 58px; border-radius: var(--r-btn); }
.fab-voice { background: var(--voice-tint); color: var(--voice); box-shadow: var(--sh-voice); }
.fab-add { background: var(--primary); color: #fff; box-shadow: 0 8px 18px rgba(238, 156, 130, .4); }

/* ---------- 2 · Board ---------- */

.board { padding: max(26px, env(safe-area-inset-top)) var(--pad) 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 9px; }
.brand-tile {
  width: 30px; height: 30px; border-radius: 10px;
  background: var(--primary); color: #fff; display: grid; place-items: center;
}
.wordmark { font-size: 19px; font-weight: 600; letter-spacing: .2px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #EADFD3;
  display: grid; place-items: center; font-weight: 800; color: #8A7A66; font-size: 14px;
}

/* Section switcher. Reuses the week-nav pill treatment rather than inventing a
   new colour: coral still means "primary action", not "work". */
.spaces {
  margin-top: 18px;
  display: flex; gap: 4px;
  background: var(--surface); border-radius: var(--r-pill);
  padding: 4px; box-shadow: var(--sh-raised);
}
.space {
  flex: 1; height: 34px; border-radius: 16px;
  font-weight: 800; font-size: 13.5px; color: var(--ink-soft);
  transition: background .18s ease, color .18s ease;
  position: relative;
}
.space[aria-selected="true"] { background: var(--primary-tint); color: var(--primary-ink); }

.greeting { margin-top: 22px; }
.greeting h2 { margin: 0; font-size: 27px; font-weight: 600; line-height: 1.15; }

.weeknav { margin-top: 16px; display: flex; align-items: center; gap: 10px; }
.nav-btn {
  width: 38px; height: 38px; border-radius: 12px; background: var(--surface);
  box-shadow: var(--sh-raised); display: grid; place-items: center; color: var(--ink-soft);
}
.nav-btn:active { transform: scale(.94); }
.nav-pill {
  flex: 1; height: 38px; border-radius: 12px; background: var(--primary-tint);
  color: var(--primary-ink); font-weight: 800; font-size: 14px;
}

.toast-slot { margin-top: 16px; }
.toast {
  background: var(--success-tint); border-radius: 16px; padding: 13px 16px;
  display: flex; align-items: center; gap: 11px;
  box-shadow: 0 6px 16px rgba(126, 174, 111, .16);
  font-weight: 800; font-size: 14px; color: var(--success-ink);
  animation: rise .35s ease both;
}
.toast-check {
  width: 26px; height: 26px; border-radius: 50%; background: var(--success); color: #fff;
  display: grid; place-items: center; flex-shrink: 0;
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.days {
  margin-top: 18px;
  display: flex; flex-direction: column; gap: 12px;
  padding-bottom: calc(var(--bar-h) + 46px + var(--safe-b));
}

.day {
  background: var(--surface); border-radius: var(--r-card); padding: 14px 16px;
  box-shadow: var(--sh-card);
  --dot: var(--ink-faint);
  animation: rise .3s ease both;
}
.day.today {
  background: var(--tint); border: 1.5px solid var(--dot); padding: 15px 16px;
  box-shadow: 0 8px 20px rgba(215, 140, 140, .14);
}
.day-head { display: flex; align-items: center; justify-content: space-between; }
.day-name { display: flex; align-items: center; gap: 9px; }
.day-name h3 { margin: 0; font-size: 16px; font-weight: 600; }
.daydot { width: 11px; height: 11px; border-radius: 50%; background: var(--dot); flex-shrink: 0; }
.day-date { font-size: 12px; font-weight: 700; color: var(--ink-faint); }
.day.today .day-date { color: color-mix(in srgb, var(--dot) 62%, var(--ink-soft)); }
.today-chip {
  background: var(--dot); color: #fff; font-size: 10px; font-weight: 800;
  padding: 2px 8px; border-radius: var(--r-pill); letter-spacing: .4px;
}

.items { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.day.today .items { margin-top: 12px; gap: 9px; }

.item { display: flex; align-items: center; gap: 11px; touch-action: pan-y; }
.item.dragging { opacity: .85; transform: scale(1.02); z-index: 2; position: relative; }
.item.lifted { transition: transform .18s ease; }
.tick {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--dot); background: none;
  display: grid; place-items: center; color: #fff;
  transition: background .15s ease;
}
.tick svg { width: 12px; height: 12px; stroke-width: 3.2; opacity: 0; transition: opacity .15s ease; }
.item.done .tick { background: var(--dot); }
.item.done .tick svg { opacity: 1; }
.item-title {
  flex: 1; font-size: 14px; font-weight: 700; text-align: left;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item.done .item-title { font-weight: 600; color: #9E837D; text-decoration: line-through; }
.item-time { font-size: 12px; font-weight: 700; color: var(--ink-faint); }
.day.today .item-time { color: color-mix(in srgb, var(--dot) 62%, var(--ink-soft)); }

.day-empty {
  margin-top: 10px; display: flex; align-items: center; gap: 10px;
  color: var(--ink-faint); font-size: 13.5px; font-weight: 700;
}
.day-empty .ico { width: 16px; height: 16px; stroke-width: 2.4; }

/* ---------- priority ----------
   Muted on purpose: these sit beside the pastel day colours, so a true red
   would be the loudest thing on a screen designed to feel calm. */

:root {
  --pri-high: #C96A62;
  --pri-high-soft: #F7E3E1;
  --pri-med: #C79246;
  --pri-med-soft: #F6EBDA;
}

.pri {
  flex: none; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: none;
}
.pri i {
  display: block; width: 10px; height: 10px; border-radius: 50%;
  background: transparent; border: 1.5px solid #DCD3C7;
  transition: background .15s ease, border-color .15s ease;
}
.pri[data-p="1"] i { background: var(--pri-med); border-color: var(--pri-med); }
.pri[data-p="2"] i { background: var(--pri-high); border-color: var(--pri-high); }
.pri:active i { transform: scale(.85); }

/* On a board, an unset marker would be noise on every row, so it only appears
   once a priority exists. In the backlog it is always there, since that is
   where triage happens. */
.item .pri[data-p="0"] { display: none; }
.backlog-item .pri[data-p="0"] { display: grid; }

/* The row itself carries a soft tint, so priority reads without hunting for dots. */
.item[data-p="1"] .item-title, .backlog-item[data-p="1"] .backlog-title { color: #8A6A32; }
.item[data-p="2"] .item-title, .backlog-item[data-p="2"] .backlog-title { color: #A24E45; }
.backlog-item[data-p="1"] { box-shadow: inset 3px 0 0 var(--pri-med), var(--sh-card); }
.backlog-item[data-p="2"] { box-shadow: inset 3px 0 0 var(--pri-high), var(--sh-card); }

/* priority chips in the edit sheet */
.pri-chips { margin-top: 12px; display: flex; gap: 8px; }
.pri-chip {
  flex: 1; height: 40px; border-radius: 14px;
  background: var(--surface); box-shadow: 0 4px 12px rgba(120, 100, 80, .05);
  font-weight: 800; font-size: 13px; color: #8A7F70;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.pri-chip i { display: block; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #DCD3C7; }
.pri-chip[data-p="1"] i { background: var(--pri-med); border-color: var(--pri-med); }
.pri-chip[data-p="2"] i { background: var(--pri-high); border-color: var(--pri-high); }
.pri-chip[aria-selected="true"] { background: var(--surface-alt, #F1EAE0); color: var(--ink); box-shadow: none; }
.pri-chip[data-p="1"][aria-selected="true"] { background: var(--pri-med-soft); color: #8A6A32; }
.pri-chip[data-p="2"][aria-selected="true"] { background: var(--pri-high-soft); color: #A24E45; }

/* sort action above the backlog */
.backlog-tools { margin-top: 16px; display: flex; justify-content: flex-end; }
.sort-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 800; color: var(--primary-ink);
  background: var(--primary-tint); border-radius: var(--r-pill); padding: 7px 13px;
}
.sort-btn:active { transform: scale(.96); }

/* ---------- backlog ---------- */

.backlog {
  margin-top: 18px;
  display: flex; flex-direction: column; gap: 10px;
  padding-bottom: calc(var(--bar-h) + 46px + var(--safe-b));
}
.backlog-item {
  background: var(--surface); border-radius: 18px; padding: 13px 15px;
  box-shadow: var(--sh-card);
  display: flex; align-items: center; gap: 12px;
  --dot: var(--ink-faint);
  animation: rise .3s ease both;
  touch-action: pan-y;
}
.backlog-item.dragging { opacity: .85; transform: scale(1.02); z-index: 2; position: relative; }
.backlog-body { flex: 1; min-width: 0; text-align: left; }
.backlog-title {
  font-size: 14.5px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.backlog-item.done .backlog-title { font-weight: 600; color: #9E837D; text-decoration: line-through; }
.backlog-meta { margin-top: 3px; font-size: 12px; font-weight: 700; color: var(--ink-faint); }
.backlog-move {
  display: grid; place-items: center; flex-shrink: 0;
  width: 34px; height: 34px; border-radius: 12px;
  background: var(--primary-tint); color: var(--primary-ink);
}
.backlog-move:active { transform: scale(.94); }

.empty-state {
  margin-top: 40px; text-align: center; padding: 0 30px;
  animation: rise .3s ease both;
}
.empty-state .ico { width: 34px; height: 34px; color: #D8CCBC; stroke-width: 1.8; }
.empty-state h3 { margin: 14px 0 0; font-size: 18px; font-weight: 600; }
.empty-state p { margin: 8px 0 0; font-size: 14px; font-weight: 600; color: var(--ink-soft); line-height: 1.5; }

/* ---------- sheet: section switcher ---------- */

.sheet-spaces {
  margin-top: 14px; display: flex; gap: 4px;
  background: #F1EAE0; border-radius: var(--r-pill); padding: 4px;
}
.space-chip {
  flex: 1; height: 32px; border-radius: 16px;
  font-weight: 800; font-size: 13px; color: var(--ink-soft);
  transition: background .18s ease, color .18s ease;
}
.space-chip[aria-selected="true"] { background: var(--surface); color: var(--primary-ink); box-shadow: var(--sh-raised); }

.btn-bar { flex: 1; height: var(--bar-h); border-radius: 16px; font-size: 15px; }
.fab-quiet { background: var(--surface); color: #8A7F70; box-shadow: 0 6px 18px rgba(120, 100, 80, .08); }

/* ---------- templates ---------- */

.tpl-list { margin-top: 16px; display: flex; flex-direction: column; gap: 9px; }
.tpl-row {
  width: 100%; text-align: left;
  background: var(--surface); border-radius: 16px; padding: 13px 15px;
  box-shadow: var(--sh-card);
  display: flex; align-items: center; gap: 12px;
}
.tpl-row:active { transform: scale(.985); }
.tpl-row-body { flex: 1; min-width: 0; }
.tpl-row-name { font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpl-row-meta { margin-top: 2px; font-size: 12px; font-weight: 700; color: var(--ink-faint); }
.tpl-row .ico { color: var(--ink-faint); }

.btn-outline {
  margin-top: 16px; width: 100%; height: 50px;
  border: 1.5px dashed #E0D5C6; border-radius: 16px;
  color: #8A7F70; font-size: 14px; gap: 8px;
}
.btn-outline .ico { color: var(--primary-ink); }

.tpl-note { margin: 14px 0 0; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); }

.tpl-days { margin-top: 16px; display: flex; flex-direction: column; gap: 7px; max-height: 42dvh; overflow-y: auto; }
.tpl-day { display: flex; gap: 11px; align-items: baseline; }
.tpl-day-name {
  flex: none; width: 34px; font-size: 11px; font-weight: 800; letter-spacing: .3px;
  color: var(--ink-faint); text-transform: uppercase; padding-top: 2px;
}
.tpl-day-items { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; }
.tpl-item {
  background: var(--surface); border-radius: 12px; padding: 5px 5px 5px 10px;
  font-size: 12.5px; font-weight: 700; color: #6E655A;
  box-shadow: 0 3px 10px rgba(120, 100, 80, .05);
  display: inline-flex; align-items: center; gap: 6px;
}
.tpl-item .tpl-item-time { color: var(--ink-faint); font-weight: 700; }
/* Removing an entry is deliberate but cheap — it can be added straight back. */
.tpl-item-x {
  display: grid; place-items: center; flex: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: #F1EAE0; color: #A2968A;
}
.tpl-item-x:active { background: #FBE4E4; color: var(--danger); }

.tpl-item-form { margin-top: 14px; }
.tpl-item-form .field { margin-top: 0; }
.btn-quiet-inline {
  flex: none; height: 58px; padding: 0 16px;
  color: #A99E8F; font-size: 14px;
}
.tpl-day-empty { font-size: 12.5px; font-weight: 600; color: #C8BEB1; padding-top: 2px; }

.tpl-preview {
  margin-top: 16px; border-radius: 16px; padding: 13px 15px;
  background: var(--primary-tint); color: var(--primary-ink);
  font-size: 13.5px; font-weight: 700; line-height: 1.5;
  animation: rise .25s ease both;
}
.tpl-preview b { font-weight: 800; }
.tpl-preview.none { background: var(--surface-alt, #F1EAE0); color: #8A7F70; }

/* ---------- flash with an action ---------- */

.flash { display: flex; align-items: center; gap: 12px; }
.flash-action {
  display: inline-flex; align-items: center; gap: 5px;
  color: #FBE7DD; font-weight: 800; font-size: 13px;
  border-left: 1px solid rgba(253, 248, 241, .25); padding-left: 12px;
  flex: none;
}
.flash-action:active { opacity: .7; }

.board-fade {
  position: fixed; left: 0; right: 0; bottom: 0; height: calc(96px + var(--safe-b));
  background: linear-gradient(180deg, rgba(250, 246, 239, 0) 0%, var(--bg) 58%);
  pointer-events: none;
}
.actionbar {
  position: fixed; left: var(--pad); right: var(--pad);
  bottom: calc(22px + var(--safe-b));
  display: flex; align-items: center; gap: 12px;
  max-width: 460px; margin: 0 auto;
}

/* ---------- overlays: sheet, modal, voice ---------- */

.overlay { position: fixed; inset: 0; z-index: 10; display: flex; }
.scrim { position: absolute; inset: 0; background: rgba(64, 59, 52, .28); animation: fade .2s ease both; }
.overlay .modal ~ .scrim, .clone-open .scrim { background: rgba(64, 59, 52, .34); }
@keyframes fade { from { opacity: 0; } }

.sheet {
  position: relative; margin-top: auto; width: 100%;
  background: var(--bg); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  padding: 14px 22px calc(26px + var(--safe-b));
  box-shadow: 0 -12px 40px rgba(64, 59, 52, .18);
  animation: slide-up .28s cubic-bezier(.2, .8, .3, 1) both;
  max-height: 92dvh; overflow-y: auto;
}
@keyframes slide-up { from { transform: translateY(100%); } }
.grabber { width: 44px; height: 5px; border-radius: var(--r-pill); background: #E2D9CC; margin: 2px auto 16px; }

.sheet-head { display: flex; align-items: center; gap: 9px; }
.sheet-head h3 { margin: 0; font-size: 20px; font-weight: 600; flex: 1; }
.sheet-close { width: 34px; height: 34px; }

.field {
  margin-top: 16px; background: var(--surface);
  border: 1.5px solid #F0D9CE; border-radius: var(--r-btn);
  padding: 15px 16px; box-shadow: 0 6px 16px rgba(120, 100, 80, .05);
}
.field input {
  width: 100%; border: 0; outline: none; background: none;
  font-size: 17px; font-weight: 700;
}
.field input::placeholder { color: #C8BEB1; font-weight: 600; }

.chips { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  position: relative; display: flex; align-items: center; gap: 6px;
  background: var(--surface); border-radius: 14px; padding: 9px 14px;
  color: #8A7F70; font-weight: 800; font-size: 13px;
  box-shadow: 0 4px 12px rgba(120, 100, 80, .05);
}
.chip .chip-ico { width: 15px; height: 15px; color: var(--ink-soft); }
.chip.on { background: var(--primary-tint); color: var(--primary-ink); box-shadow: none; }
.chip.on .chip-ico { color: var(--primary-ink); }
/* The native picker sits invisibly on top of the chip so the chip is the control. */
.chip input, .chip select {
  position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%;
  border: 0; padding: 0; -webkit-appearance: none; appearance: none;
}
/* …and the clear affordance sits above the picker, or it could never be tapped. */
.chip-clear {
  position: relative; z-index: 2; display: grid; place-items: center;
  width: 18px; height: 18px; border-radius: 50%; margin-left: 2px;
  background: rgba(217, 126, 95, .16); color: var(--primary-ink); cursor: pointer;
}

.suggest-wrap { margin-top: 20px; }
.suggestions { margin-top: 10px; display: flex; gap: 9px; flex-wrap: wrap; }
.suggestion {
  background: var(--surface); border-radius: var(--r-pill); padding: 9px 15px;
  font-weight: 700; font-size: 13px; color: #6E655A;
  box-shadow: 0 3px 10px rgba(120, 100, 80, .05);
}
.suggestion:active { transform: scale(.96); }

.sheet-actions { margin-top: 26px; display: flex; align-items: center; gap: 12px; }

/* modal */
.modal {
  position: relative; margin: auto; width: min(326px, calc(100% - 32px));
  background: var(--bg); border-radius: 28px; padding: 28px 24px 24px;
  box-shadow: 0 24px 60px rgba(64, 59, 52, .28); text-align: center;
  animation: pop .26s cubic-bezier(.2, .9, .3, 1) both;
}
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
.clone-art { display: flex; align-items: center; justify-content: center; gap: 14px; }
.stack { display: flex; flex-direction: column; gap: 5px; }
.stack span { width: 40px; height: 9px; border-radius: 6px; }
.stack.faded span { opacity: .45; }
.modal-title { margin: 22px 0 0; font-size: 23px; font-weight: 600; line-height: 1.25; }
.modal-body { margin: 12px 0 0; font-size: 14.5px; font-weight: 600; color: var(--ink-soft); line-height: 1.55; }
.modal-body b { color: #6E655A; }

.toggles { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.toggle {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-radius: 15px; padding: 12px 15px;
  box-shadow: 0 4px 12px rgba(120, 100, 80, .05);
  font-weight: 800; font-size: 14px; color: #6E655A; cursor: pointer;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 44px; height: 26px; border-radius: var(--r-pill); background: #E4DCD0;
  position: relative; transition: background .18s ease; flex-shrink: 0;
}
.switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .12); transition: transform .18s ease;
}
.toggle input:checked ~ .switch { background: var(--primary); }
.toggle input:checked ~ .switch::after { transform: translateX(18px); }
.modal .btn-primary { margin-top: 22px; }

/* ---------- 4 · Voice ---------- */

.overlay-full { background: linear-gradient(180deg, #F1E9F3 0%, var(--bg) 60%); }
.voice {
  flex: 1; padding: max(30px, env(safe-area-inset-top)) 26px calc(44px + var(--safe-b));
  display: flex; flex-direction: column; align-items: center;
  animation: fade .2s ease both;
}
.voice-head { width: 100%; display: flex; align-items: center; justify-content: space-between; }
.voice-state { font-size: 18px; font-weight: 600; color: #8A7F70; }

.mic-stage {
  margin-top: clamp(24px, 6vh, 52px);
  position: relative; width: 170px; height: 170px;
  display: grid; place-items: center;
}
.ring { position: absolute; border-radius: 50%; }
.ring-outer { width: 170px; height: 170px; background: #E6D2ED; opacity: .5; }
.ring-inner { width: 128px; height: 128px; background: #DBBEE6; opacity: .6; }
.listening .ring-outer { animation: pulse 2s ease-in-out infinite; }
.listening .ring-inner { animation: pulse 2s ease-in-out .3s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: .5; } 50% { transform: scale(1.1); opacity: .3; } }
.mic-core {
  width: 92px; height: 92px; border-radius: 50%; background: var(--voice); color: #fff;
  display: grid; place-items: center; box-shadow: 0 14px 30px rgba(176, 113, 192, .4);
  position: relative;
}

.waveform { margin-top: clamp(20px, 4vh, 40px); height: 44px; display: flex; align-items: center; gap: 5px; }
.waveform span { width: 6px; border-radius: 6px; background: #C99BD6; height: 14px; transition: height .12s ease; }
.listening .waveform span { animation: bounce 1s ease-in-out infinite; }
@keyframes bounce { 0%, 100% { transform: scaleY(.5); } 50% { transform: scaleY(1); } }

.transcript { margin-top: clamp(18px, 4vh, 34px); text-align: center; }
.said { margin: 10px 0 0; font-size: 24px; font-weight: 500; line-height: 1.35; }
.said.placeholder { color: var(--ink-faint); }

.parsed {
  margin-top: clamp(16px, 3vh, 30px); width: 100%; background: var(--surface);
  border-radius: 20px; padding: 16px 18px; box-shadow: 0 8px 22px rgba(120, 100, 80, .08);
  display: flex; align-items: center; gap: 12px;
  animation: rise .3s ease both;
}
.parsed-check {
  width: 44px; height: 44px; border-radius: 14px; background: var(--success-tint);
  display: grid; place-items: center; flex-shrink: 0;
}
.parsed-body { flex: 1; min-width: 0; }
.parsed-title { margin: 0; font-size: 16px; font-weight: 600; }
.parsed-meta { margin: 2px 0 0; font-size: 13px; font-weight: 700; color: var(--ink-soft); }
.voice-actions { margin-top: auto; padding-top: 24px; width: 100%; display: flex; align-items: center; gap: 12px; }

/* ---------- flash message ---------- */

.flash {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(96px + var(--safe-b)); z-index: 30;
  background: var(--ink); color: #FDF8F1;
  padding: 12px 18px; border-radius: 16px;
  font-size: 13.5px; font-weight: 700; max-width: calc(100% - 40px); text-align: center;
  box-shadow: 0 10px 26px rgba(64, 59, 52, .28);
  animation: rise .25s ease both;
}
.flash.bad { background: #B4685F; }

/* Wider screens: keep the phone proportions centred. */
@media (min-width: 520px) {
  .screen, .sheet, .voice { max-width: 460px; margin-left: auto; margin-right: auto; }
  .sheet { border-radius: var(--r-sheet); margin-bottom: 24px; }
  .overlay { align-items: center; justify-content: center; }
}

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