/* ---------- Tokens ---------- */

:root {
  color-scheme: light;
  --bg: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f1f1f4;
  --surface-3: #e6e6eb;
  --elevated: #ffffff;
  --text: #17171c;
  --text-2: #5c5c66;
  --text-3: #74747f;
  --placeholder: #9a9aa5;
  --line: #ececf0;
  --border: #e2e2e8;
  --accent: #5b5bd6;
  --accent-hover: #4f4fc8;
  --accent-fg: #4c4cc4;
  --accent-soft: rgba(91, 91, 214, 0.11);
  --done: #1f9d55;
  --danger: #e5484d;
  --danger-fg: #d13438;
  --work: #3e63dd;
  --personal: #f76b15;
  --row-hover: #fafafb;
  --row-selected: #f3f3fc;
  --toast-bg: rgba(23, 23, 28, 0.94);
  --shadow-sm: 0 1px 2px rgba(16, 16, 24, 0.05);
  --shadow-md: 0 1px 2px rgba(16, 16, 24, 0.04), 0 6px 16px -4px rgba(16, 16, 24, 0.08);
  --shadow-lg: 0 2px 6px rgba(16, 16, 24, 0.05), 0 16px 40px -8px rgba(16, 16, 24, 0.2);
  --radius: 14px;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.3, 1.35, 0.5, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e11;
  --surface: #17171b;
  --surface-2: #202026;
  --surface-3: #2b2b32;
  --elevated: #1c1c21;
  --text: #ededf0;
  --text-2: #a3a3ad;
  --text-3: #85858f;
  --placeholder: #66666f;
  --line: #24242a;
  --border: #2a2a31;
  --accent: #5b5bd6;
  --accent-hover: #6a6ae0;
  --accent-fg: #a8a6ff;
  --accent-soft: rgba(124, 122, 240, 0.16);
  --done: #30c06f;
  --danger: #ff6369;
  --danger-fg: #ff6369;
  --work: #7699ff;
  --personal: #ff8b3e;
  --row-hover: #1b1b20;
  --row-selected: #1e1e2b;
  --toast-bg: rgba(44, 44, 52, 0.96);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 16px -4px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 18px 48px -8px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; }

html {
  interpolate-size: allow-keywords;
  -webkit-text-size-adjust: 100%;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input { font: inherit; color: inherit; }
button, summary, input, label { -webkit-tap-highlight-color: transparent; }

.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view {
  max-width: 640px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px calc(104px + env(safe-area-inset-bottom));
}

/* Swipe layers and off-screen rows never cause sideways scroll */
#app-view { overflow-x: clip; }

/* ---------- Buttons and fields ---------- */

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s;
}

.btn-primary {
  border: none;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(16, 16, 24, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover { background: var(--surface-2); }

.btn-primary:active,
.btn-secondary:active { transform: scale(0.98); }

.btn-primary:disabled,
.btn-secondary:disabled { opacity: 0.6; cursor: default; transform: none; }

.btn-sm {
  width: auto;
  min-height: 34px;
  padding: 6px 12px;
  font-size: 13.5px;
  border-radius: 9px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent-fg);
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}

.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

.field {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  font-size: 16px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field::placeholder { color: var(--placeholder); }

.field:focus {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 65%, var(--border));
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.field-sm {
  width: auto;
  min-height: 34px;
  padding: 5px 9px;
  font-size: 14px;
  border-radius: 9px;
}

/* iOS-style switch on a real checkbox */
.switch {
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  flex: none;
  width: 42px;
  height: 26px;
  margin: 0;
  border-radius: 999px;
  background: var(--surface-3);
  cursor: pointer;
  transition: background 0.2s;
}

.switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.28s var(--ease-spring);
}

.switch:checked { background: var(--accent); }
.switch:checked::before { transform: translateX(16px); }

kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-2);
  font: 600 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
}

/* ---------- Login ---------- */

#login-view {
  display: flex;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
}

body:has(#login-view:not(.hidden)) {
  background:
    radial-gradient(900px 500px at 50% -120px, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 36px 28px 26px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow-lg);
  animation: rise-in 0.5s var(--ease-out);
}

.app-mark {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(150deg, #8b8bf5 0%, #5b5bd6 55%, #4343b5 100%);
  box-shadow: 0 10px 24px -8px rgba(91, 91, 214, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.app-mark .icon { width: 28px; height: 28px; stroke-width: 2; }

.login-card h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.tagline {
  margin: 0 0 26px;
  color: var(--text-2);
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card .field { text-align: center; }

.code-hint {
  margin: 0 0 4px;
  color: var(--text-2);
  font-size: 14.5px;
  line-height: 1.45;
}

.code-hint strong { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }

/* Six boxes for the code; the real input sits invisibly on top */
.otp { position: relative; }

#code-input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: transparent;
  caret-color: transparent;
  font-size: 16px;
  outline: none;
  cursor: text;
}

#code-input::selection { background: transparent; }

.otp-slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.otp-slots span {
  position: relative;
  display: grid;
  place-items: center;
  height: 54px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.otp-slots span.filled { background: var(--surface); }

.otp-slots span.active {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 65%, var(--border));
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.otp-slots span.active:empty::after {
  content: "";
  width: 2px;
  height: 22px;
  border-radius: 1px;
  background: var(--text);
  animation: blink 1.1s steps(2, start) infinite;
}

.otp.shake { animation: shake 0.4s ease; }

@keyframes blink { to { visibility: hidden; } }

@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.msg {
  min-height: 1.2em;
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--text-2);
}

.msg.error { color: var(--danger-fg); }

/* ---------- Header ---------- */

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 18px;
}

.title-block { flex: 1; min-width: 0; }

.eyebrow {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-fg);
}

#headline {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.progress-track {
  flex: 0 1 180px;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 45%, var(--done)));
  transition: width 0.7s var(--ease-out), background 0.3s;
}

.progress.complete .progress-fill { background: var(--done); }

.progress-label {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
  margin-top: -2px;
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 11px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn .icon { width: 20px; height: 20px; }

.icon-btn:hover,
.icon-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--text); }

#alerts-btn.on::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--done);
  box-shadow: 0 0 0 2px var(--bg);
}

.avatar {
  --hue: 255;
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 34px;
  margin: 3px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: linear-gradient(140deg, hsl(var(--hue) 70% 60%), hsl(calc(var(--hue) + 25) 62% 46%));
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

button.avatar {
  cursor: pointer;
  transition: transform 0.15s var(--ease-spring), box-shadow 0.15s;
}

button.avatar:hover,
button.avatar[aria-expanded="true"] {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 0 3px var(--bg), 0 0 0 5px color-mix(in srgb, hsl(var(--hue) 70% 55%) 45%, transparent);
}

button.avatar:active { transform: scale(0.94); }

.avatar-lg { width: 44px; height: 44px; margin: 0; font-size: 18px; }

/* ---------- Segmented controls ---------- */

.segmented {
  position: relative;
  display: inline-flex;
  padding: 3px;
  border-radius: 11px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 55%, transparent);
}

#filter-bar {
  margin-bottom: 12px;
  view-transition-name: filter-bar;
}

/* The pill animates itself, so skip the view transition's crossfade for this bar */
::view-transition-group(filter-bar),
::view-transition-new(filter-bar) { animation: none; }
::view-transition-old(filter-bar) { display: none; }

.filter-pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: var(--pill-w, 0);
  transform: translateX(var(--pill-x, 0));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgba(16, 16, 24, 0.1), 0 1px 1px rgba(16, 16, 24, 0.04);
}

:root[data-theme="dark"] .filter-pill { background: var(--surface-3); }

#filter-bar.ready .filter-pill {
  transition: transform 0.38s var(--ease-spring), width 0.38s var(--ease-spring);
}

.filter-chip {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 550;
  cursor: pointer;
  transition: color 0.2s, transform 0.12s;
}

.filter-chip:hover:not(.active) { color: var(--text); }
.filter-chip.active { color: var(--text); }
.filter-chip:active { transform: scale(0.97); }

.chip-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.filter-chip.active .chip-count { color: var(--accent-fg); }

/* Equal-width choices with a raised selection (appearance, category) */
.seg-fill { display: flex; width: 100%; }

.seg-fill button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 5px 8px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.seg-fill button .icon { width: 15px; height: 15px; }

.seg-fill button:hover { color: var(--text); }

.seg-fill button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 16, 24, 0.1), 0 1px 1px rgba(16, 16, 24, 0.04);
}

:root[data-theme="dark"] .seg-fill button[aria-pressed="true"] { background: var(--surface-3); }

/* ---------- Composer ---------- */

#add-sentinel { height: 1px; margin-bottom: -1px; }

#add-form {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -20px;
  padding: 8px 20px 12px;
  transition: background 0.2s, box-shadow 0.2s;
}

#add-form.stuck {
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: saturate(1.8) blur(16px);
  backdrop-filter: saturate(1.8) blur(16px);
  box-shadow: 0 1px 0 var(--line);
}

.composer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.composer:focus-within {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 4px var(--accent-soft), var(--shadow-md);
}

.composer-icon {
  display: grid;
  color: var(--text-3);
  transition: color 0.15s, transform 0.25s var(--ease-spring);
}

.composer-icon .icon { width: 20px; height: 20px; }

.composer:focus-within .composer-icon { color: var(--accent-fg); transform: rotate(90deg); }

#add-input {
  flex: 1;
  min-width: 0;
  padding: 9px 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
}

#add-input::placeholder { color: var(--placeholder); }

.composer-kbd { display: none; }

@media (hover: hover) and (pointer: fine) {
  .composer-kbd { display: inline-block; margin-right: 4px; }
  .composer:focus-within .composer-kbd,
  #add-form.has-text .composer-kbd { display: none; }
}

.composer-send {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, transform 0.12s, box-shadow 0.2s;
}

.composer-send .icon { width: 18px; height: 18px; stroke-width: 2.2; }

#add-form.has-text .composer-send {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px -2px color-mix(in srgb, var(--accent) 70%, transparent);
}

#add-form.has-text .composer-send:hover { background: var(--accent-hover); }
.composer-send:active { transform: scale(0.92); }

/* What quick add understood, shown live under the box */
.parse-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.parse-chip {
  --chip: var(--accent-fg);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 9px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--chip) 28%, transparent);
  background: color-mix(in srgb, var(--chip) 10%, var(--surface));
  color: var(--chip);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  animation: chip-in 0.25s var(--ease-spring);
  transition: background 0.15s, transform 0.1s;
}

.parse-chip .icon { width: 14px; height: 14px; }
.parse-chip.cat-work { --chip: var(--work); }
.parse-chip.cat-personal { --chip: var(--personal); }
.parse-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.parse-chip:hover { background: color-mix(in srgb, var(--chip) 16%, var(--surface)); }
.parse-chip:active { transform: scale(0.95); }

.parse-x { display: grid; opacity: 0.55; }
.parse-x .icon { width: 13px; height: 13px; stroke-width: 2.2; }
.parse-chip:hover .parse-x { opacity: 1; }

@keyframes chip-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.9); }
}

.add-msg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 4px 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
  font-size: 14.5px;
  line-height: 1.4;
  animation: pop-in 0.2s var(--ease-out);
}

.add-msg span { flex: 1 1 12rem; }
.add-msg .link-btn { padding: 6px 4px; }

/* ---------- Lists ---------- */
/* Rows draw the card themselves (no wrapper box), so the list can animate row by row */

.reminder-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.reminder {
  position: relative;
  border: solid var(--border);
  border-width: 0 1px;
  background: var(--surface);
  overflow: hidden;
  outline: none;
  touch-action: pan-y;
  scroll-margin: 104px 0 96px; /* clear the sticky add box and the toast */
}

.reminder:first-child { border-top-width: 1px; border-radius: var(--radius) var(--radius) 0 0; }
.reminder:last-child { border-bottom-width: 1px; border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-sm); }
.reminder:only-child { border-radius: var(--radius); }

/* Hairline between rows, inset past the checkbox */
.reminder + .reminder::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50px;
  right: 0;
  height: 1px;
  background: var(--line);
  z-index: 2;
  pointer-events: none;
}

.row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 50px;
  padding: 13px 10px 13px 14px;
  background: var(--surface);
  transition: background 0.15s, transform 0.25s var(--ease-out), box-shadow 0.15s;
}

@media (hover: hover) {
  .reminder:hover .row { background: var(--row-hover); }
}

.reminder:focus .row { background: var(--row-selected); }
.reminder:focus-visible .row { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.row:has(.edit-input) { background: var(--surface) !important; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }

.reminder.landed .row { animation: landed 1.1s ease; }

@keyframes landed {
  from { background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
}

/* Checkbox: small and quiet, with a 36px (44px on touch) target around it */
.check {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  margin: -7px -6px -7px -8px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: none;
  cursor: pointer;
}

.box {
  position: relative;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.6px solid color-mix(in srgb, var(--text-3) 75%, transparent);
  background: var(--surface);
  transition: background 0.2s, border-color 0.2s, transform 0.3s var(--ease-spring);
}

.box svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #fff;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 22;
  stroke-dashoffset: 22;
  transition: stroke-dashoffset 0.3s cubic-bezier(0.65, 0, 0.35, 1) 0.05s;
}

/* A ring that ripples out when you check something off */
.box::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 9px;
  border: 2px solid var(--done);
  opacity: 0;
  pointer-events: none;
}

@media (hover: hover) {
  .reminder-list:not(.done) .check:hover .box { border-color: var(--done); }
  .reminder-list:not(.done) .reminder:not(.completing) .check:hover .box svg {
    stroke: color-mix(in srgb, var(--done) 65%, transparent);
    stroke-dashoffset: 0;
  }
}

.check:active .box { transform: scale(0.88); }

.reminder.completing .box,
.reminder-list.done .box {
  background: var(--done);
  border-color: var(--done);
}

.reminder.completing .box svg,
.reminder-list.done .box svg { stroke: #fff; stroke-dashoffset: 0; }

.reminder.completing .box { animation: box-pop 0.4s var(--ease-spring); }
.reminder.completing .box::after { animation: check-ring 0.6s ease-out; }

.reminder.uncompleting .box { background: var(--surface); border-color: color-mix(in srgb, var(--text-3) 75%, transparent); }
.reminder.uncompleting .box svg { stroke-dashoffset: 22; }

@keyframes box-pop {
  0% { transform: scale(0.8); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes check-ring {
  from { opacity: 0.7; transform: scale(0.9); }
  to { opacity: 0; transform: scale(1.8); }
}

.reminder-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.text {
  width: 100%;
  font-size: 15.5px;
  line-height: 1.4;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Strike-through that draws itself across every line of the text */
.label {
  background: linear-gradient(currentColor, currentColor) no-repeat 0 58% / 0 1.5px;
  transition: background-size 0.4s var(--ease-out) 0.08s, color 0.3s;
}

.reminder.completing .label,
.reminder-list.done .label {
  color: var(--text-3);
  background-size: 100% 1.5px;
}

.reminder.uncompleting .label { color: var(--text); background-size: 0 1.5px; }

.reminder-list.trash .label { color: var(--text-3); }

@media (hover: hover) and (pointer: fine) {
  .reminder-list:not(.trash) .text { cursor: default; }
}

.edit-input {
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: inherit;
}

.reminder-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  max-width: 100%;
  font-size: 12.5px;
  color: var(--text-2);
}

.sched-btn {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: -2px -4px;
  padding: 2px 4px;
  border: none;
  border-radius: 6px;
  background: none;
  color: inherit;
  font-size: inherit;
  cursor: pointer;
  text-align: left;
}

.sched-btn:hover { background: var(--surface-2); color: var(--text); }

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.meta-item .icon { width: 13px; height: 13px; stroke-width: 2; }
.meta-item.is-today { color: var(--accent-fg); font-weight: 550; }

.cat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -2px -4px;
  padding: 2px 4px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text-2);
  font-size: inherit;
  text-transform: capitalize;
  cursor: pointer;
}

.cat-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat);
}

.cat-badge:hover { background: var(--surface-2); color: var(--text); }
.cat-work { --cat: var(--work); }
.cat-personal { --cat: var(--personal); }

.row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
  margin: -6px 0;
}

.row-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text-3);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.row-btn .icon { width: 17px; height: 17px; }
.row-btn:hover,
.row-btn[aria-expanded="true"] { background: var(--surface-3); color: var(--text); }
.delete-btn:hover { color: var(--danger-fg); background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* With a mouse, row buttons stay tucked away until the row is hovered or selected */
@media (hover: hover) and (pointer: fine) {
  .row-btn { opacity: 0; }
  .reminder:hover .row-btn,
  .reminder:focus-within .row-btn,
  .row-btn[aria-expanded="true"] { opacity: 1; }
}

/* On touch, tapping the row itself opens details */
@media (pointer: coarse) {
  .more-btn,
  .menu-item kbd { display: none; }
  .reminder { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
  .reminder input { -webkit-user-select: text; user-select: text; }
  .check { width: 44px; height: 44px; margin: -11px -10px -11px -12px; }
}

.restore-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--accent-fg);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.restore-btn .icon { width: 15px; height: 15px; }
.restore-btn:hover { background: var(--accent-soft); }

/* Swiping: the row slides over a colored layer that shows the action */
.swipe-hint {
  --p: 0;
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  padding: 0 22px;
  color: #fff;
  pointer-events: none;
  transition: background 0.18s;
}

.swipe-hint.done { justify-content: flex-start; background: color-mix(in srgb, var(--done) 50%, var(--surface)); }
.swipe-hint.trash { justify-content: flex-end; background: color-mix(in srgb, var(--danger) 50%, var(--surface)); }
.swipe-hint.done.armed { background: var(--done); }
.swipe-hint.trash.armed { background: var(--danger); }

.swipe-hint .icon {
  width: 22px;
  height: 22px;
  stroke-width: 2.4;
  opacity: var(--p);
  transform: scale(calc(0.55 + 0.45 * var(--p)));
  transition: opacity 0.2s, transform 0.3s var(--ease-spring);
}

.swipe-hint.armed .icon { transform: scale(1.15); }
.reminder.swiped .row { transition: transform 0.24s var(--ease-out); }

/* Placeholder rows while the list loads */
.reminder.skeleton { pointer-events: none; }
.reminder.skeleton .row { align-items: center; }

.sk-box,
.sk-line {
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--text-3) 12%, transparent) 0%,
    color-mix(in srgb, var(--text-3) 22%, transparent) 50%,
    color-mix(in srgb, var(--text-3) 12%, transparent) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}

.sk-box { flex: none; width: 20px; height: 20px; border-radius: 6px; }
.sk-line { flex: 1; height: 12px; border-radius: 6px; max-width: 60%; }
.skeleton:nth-child(2) .sk-line { max-width: 44%; }
.skeleton:nth-child(3) .sk-line { max-width: 52%; }

@keyframes shimmer {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

/* ---------- Sections ---------- */

.section { margin-top: 28px; }

.section summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 10px 4px 4px;
  margin-left: -4px;
  border-radius: 8px;
  list-style: none;
  color: var(--text-2);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s, background 0.15s;
}

.section summary::-webkit-details-marker { display: none; }
.section summary:hover { color: var(--text); background: var(--surface-2); }

.chev { display: grid; }
.chev .icon { width: 15px; height: 15px; stroke-width: 2.2; transition: transform 0.25s var(--ease-out); }
.section[open] .chev .icon { transform: rotate(90deg); }

.count {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.section .reminder-list { margin-top: 6px; }

/* Expand and collapse smoothly where the browser supports animating <details> */
.section::details-content {
  block-size: 0;
  overflow: clip;
  transition: block-size 0.3s var(--ease-out), content-visibility 0.3s allow-discrete;
}

.section[open]::details-content { block-size: auto; }

.section-note {
  margin: 4px 2px 6px;
  color: var(--text-3);
  font-size: 13px;
}

/* ---------- Empty state ---------- */

.empty-state {
  padding: 36px 16px 8px;
  text-align: center;
}

.empty-art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(150deg, color-mix(in srgb, var(--done) 75%, #fff) 0%, var(--done) 60%);
  box-shadow: 0 12px 28px -10px color-mix(in srgb, var(--done) 80%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: rise-in 0.5s var(--ease-spring);
}

.empty-art .icon { width: 30px; height: 30px; stroke-width: 2.6; }

.empty-title {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.empty-sub {
  margin: 4px 0 0;
  color: var(--text-2);
}

.empty-tip {
  display: inline-block;
  max-width: 26rem;
  margin: 18px auto 0;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.45;
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(10px) scale(0.96); }
}

/* ---------- Footer ---------- */

.app-footer {
  margin-top: 44px;
  text-align: center;
}

.app-footer .link-btn {
  color: var(--text-3);
  font-size: 13.5px;
}

.app-footer .link-btn:hover { color: var(--text); text-decoration: none; }

@media (hover: hover) and (pointer: fine) {
  .app-footer .link-btn::after {
    content: "?";
    display: inline-block;
    margin-left: 8px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-bottom-width: 2px;
    border-radius: 5px;
    font-size: 11.5px;
    font-weight: 600;
  }
}

/* ---------- Toast ---------- */

.undo-bar {
  position: fixed;
  z-index: 35; /* under the sheet backdrop, so it never covers an open sheet */
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: min(460px, calc(100vw - 24px));
  padding: 9px 9px 9px 11px;
  border-radius: 14px;
  background: var(--toast-bg);
  color: #f4f4f6;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 14px 36px -8px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: toast-in 0.4s var(--ease-spring);
}

.toast-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--done);
  color: #fff;
}

.toast-icon .icon { width: 14px; height: 14px; stroke-width: 2.6; }
.toast-icon.toast-trash { background: var(--danger); }
.toast-icon.toast-bell { background: var(--accent); }
.toast-icon.toast-trash .icon,
.toast-icon.toast-bell .icon { stroke-width: 2.2; }

#undo-text {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#undo-btn {
  flex: none;
  padding: 7px 12px;
  border: none;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

#undo-btn:hover { background: rgba(255, 255, 255, 0.22); }

/* Shrinks to show how long Undo stays available */
.toast-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.4);
  transform-origin: left center;
  animation: toast-countdown 8s linear forwards;
}

.undo-bar.paused .toast-progress { animation-play-state: paused; }

@keyframes toast-countdown {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(16px) scale(0.96); }
  to { opacity: 1; transform: translateX(-50%); }
}

/* ---------- Popovers (bottom sheets on phones) ---------- */

.popover {
  position: fixed;
  z-index: 60;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--elevated);
  box-shadow: var(--shadow-lg);
  transform-origin: top left;
  animation: pop-in 0.18s var(--ease-out);
}

.popover[data-align="end"] { transform-origin: top right; }
.popover.above { transform-origin: bottom left; }
.popover.closing { animation: pop-out 0.14s ease-in forwards; pointer-events: none; }

@keyframes pop-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
}

@keyframes pop-out {
  to { opacity: 0; transform: translateY(-4px) scale(0.98); }
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8, 8, 12, 0.42);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.sheet-backdrop.on { opacity: 1; pointer-events: auto; }

/* Grab handle on bottom sheets; only shown on phones */
.sheet-grip { display: none; }

.popover h3 {
  margin: 4px 4px 12px;
  font-size: 16px;
  font-weight: 650;
}

.panel-label,
.menu-label {
  margin: 14px 4px 6px;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}

.menu-hint,
.panel-note {
  margin: 0 4px 10px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--text-2);
}

.menu-hint:empty { display: none; }
.error-note { color: var(--danger-fg); margin-top: 8px; }

.menu-sep {
  height: 1px;
  margin: 8px -8px;
  background: var(--line);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--text);
  font-size: 14.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}

.menu-item .icon { width: 17px; height: 17px; color: var(--text-2); }
.menu-item:hover { background: var(--surface-2); }
.menu-item kbd { margin-left: auto; }
.menu-item.danger,
.menu-item.danger .icon { color: var(--danger-fg); }
.menu-item.danger:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); }
.menu-item.subtle { min-height: 32px; margin-top: 4px; color: var(--text-2); font-size: 13.5px; }
.menu-item.subtle .icon { width: 15px; height: 15px; }

/* Reminder details */
.sched-menu {
  width: 340px;
  max-height: min(84vh, 640px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 10px;
}

.sched-menu .menu-label:first-of-type { margin-top: 10px; }

.detail-text {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  outline: none;
  background: var(--surface-2);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.detail-text:hover { background: var(--surface-3); }

.detail-text:focus {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 60%, var(--border));
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.when-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
  padding: 10px 4px 8px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.tile .icon { width: 19px; height: 19px; margin-bottom: 2px; color: var(--text-2); }
.tile span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile small { color: var(--text-3); font-size: 11px; font-weight: 500; }
.tile:hover { background: var(--surface-2); }
.tile:active { transform: scale(0.96); }

.tile.active {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  color: var(--accent-fg);
}

.tile.active .icon,
.tile.active small { color: var(--accent-fg); }

.tile.pick:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The date field covers the tile invisibly so a tap opens the native picker */
.tile.pick input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: none;
  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .tile.pick input { pointer-events: none; }
}

.alert-when {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 2px;
}

.alert-when .field-sm { flex: 1; min-width: 0; }
.alert-when .btn-sm { flex: none; }

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 2px;
}

.preset {
  min-height: 30px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.preset:hover { background: var(--surface-2); color: var(--text); }

.preset.active {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  color: var(--accent-fg);
}

.seg-cat::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cat);
}

/* Alerts and account panels */
.alerts-panel { width: 320px; padding: 14px; }
.alerts-panel .panel-label:first-of-type { margin-top: 0; }
.alerts-panel .btn-secondary,
.alerts-panel #push-test { margin-top: 8px; }

.panel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 4px;
  font-size: 14.5px;
}

.account-panel { width: 280px; }

.account-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 4px;
}

.account-who { min-width: 0; }

.account-label {
  margin: 0;
  font-size: 12px;
  color: var(--text-3);
}

.account-email {
  margin: 1px 0 0;
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-panel .seg-fill { margin: 0 2px; width: calc(100% - 4px); }

/* ---------- Tips & shortcuts ---------- */

.help-dialog {
  width: min(460px, calc(100vw - 24px));
  max-width: none;
  max-height: min(86dvh, 720px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--elevated);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overscroll-behavior: contain;
}

.help-dialog[open] { animation: pop-in 0.22s var(--ease-out); }

.help-dialog::backdrop {
  background: rgba(8, 8, 12, 0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  animation: fade-in 0.2s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
}

.help-inner { padding: 20px 20px 16px; }
.help-inner h3 { margin: 0 0 6px; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.help-inner h3:focus { outline: none; }
.help-inner .panel-label { margin-top: 18px; }

.help-examples {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.help-examples li {
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 14.5px;
}

.help-examples mark {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-fg);
  font-weight: 600;
}

.help-keys { margin: 0; display: grid; }

.help-keys div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}

.help-keys div:last-child { border-bottom: none; }
.help-keys dt { color: var(--text-2); }
.help-keys dd { margin: 0; text-align: right; }

/* Show gestures to touch screens and keys to keyboards */
.help-touch,
.help-keyboard { display: none; }

@media (pointer: coarse) { .help-touch { display: block; } }
@media (hover: hover) and (pointer: fine) { .help-keyboard { display: block; } }

.help-dialog form { margin-top: 18px; }

/* ---------- Confetti and transitions ---------- */

.confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 90;
  pointer-events: none;
}

::view-transition-group(*) {
  animation-duration: 0.38s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}

::view-transition-old(*),
::view-transition-new(*) {
  animation-duration: 0.3s;
}

/* Switching themes cross-fades the page as one picture */
.theme-fade #filter-bar,
.theme-fade .reminder { view-transition-name: none !important; }

/* ---------- Phone ---------- */

@media (max-width: 699px) {
  .view { padding-left: 16px; padding-right: 16px; }

  #login-view { align-items: flex-start; padding-top: max(40px, env(safe-area-inset-top)); }
  .login-card { padding: 30px 20px 22px; }
  .otp-slots { gap: 6px; }

  #headline { font-size: 26px; }
  .app-header { margin-top: 6px; }

  #filter-bar { display: flex; width: 100%; }
  .filter-chip { flex: 1; min-height: 36px; padding: 6px; }

  #add-form { margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
  .composer-send { width: 40px; height: 40px; }

  .text { font-size: 16px; }
  .row { padding: 14px 8px 14px 14px; min-height: 54px; }
  .reminder + .reminder::before { left: 48px; }

  .section summary { min-height: 40px; }

  .popover,
  .sched-menu {
    top: auto !important;
    left: 0 !important;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    max-height: min(88dvh, 680px);
    overflow: auto;
    padding: 6px 16px calc(16px + env(safe-area-inset-bottom));
    border: none;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
    animation: sheet-in 0.32s var(--ease-out);
  }

  .popover.closing { animation: sheet-out 0.2s ease-in forwards; }

  /* A real element (not ::before) so it can take touches and be dragged */
  .sheet-grip {
    display: block;
    flex: none;
    height: 24px;
    margin: -6px -16px 2px;
    touch-action: none;
    cursor: grab;
  }

  .sheet-grip::before {
    content: "";
    display: block;
    width: 38px;
    height: 5px;
    margin: 9px auto 0;
    border-radius: 999px;
    background: var(--surface-3);
  }

  .help-inner .sheet-grip { margin: -14px -20px 4px; }

  .when-grid { gap: 8px; }
  .tile { padding: 12px 4px 10px; font-size: 13px; }
  .preset { min-height: 36px; padding: 7px 13px; font-size: 14px; }
  .alert-when .field-sm { min-height: 40px; font-size: 16px; }
  .alert-when .btn-sm { min-height: 40px; padding: 8px 16px; }
  .menu-item { min-height: 46px; font-size: 15.5px; }
  .seg-fill button { min-height: 38px; font-size: 14.5px; }

  .help-dialog {
    width: 100%;
    max-height: min(88dvh, 720px);
    margin: auto 0 0;
    border: none;
    border-radius: 22px 22px 0 0;
  }

  .help-dialog[open] { animation: sheet-in 0.32s var(--ease-out); }
  .help-inner { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

  .undo-bar { bottom: calc(14px + env(safe-area-inset-bottom)); }
}

@keyframes sheet-in {
  from { transform: translateY(100%); }
}

@keyframes sheet-out {
  to { transform: translateY(100%); }
}

/* ---------- Desktop ---------- */

@media (min-width: 900px) {
  .view {
    max-width: 680px;
    padding-top: 56px;
  }

  #headline { font-size: 34px; }

  /* One line per reminder: details sit on the right */
  .reminder-body {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
  }

  .text { width: auto; flex: 1; min-width: 0; }
  .reminder-meta { flex: none; justify-content: flex-end; max-width: 55%; }
  .row { align-items: center; padding-top: 11px; padding-bottom: 11px; }
  .check { margin-top: -8px; margin-bottom: -8px; }

  .help-dialog { width: min(560px, calc(100vw - 48px)); }
  .help-examples { grid-template-columns: 1fr 1fr; }
  .help-keyboard .help-keys {
    grid-template-columns: 1fr 1fr;
    column-gap: 24px;
  }
  .help-keyboard .help-keys div:nth-last-child(2) { border-bottom: none; }

  /* No dimming behind popovers on a big screen */
  .sheet-backdrop.on { opacity: 0; pointer-events: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
