/* =====================================================================
   Planer — Liquid Glass
   One idea carries the look: frosted, refracting panes floating over a
   sky whose colours follow the time of day (set by app.js as --sky-*).
   ===================================================================== */

:root {
  color-scheme: light dark;

  /* sky (overridden per time of day by app.js) */
  --sky-a: #9cc3ea;
  --sky-b: #f5c7a9;
  --sky-c: #b6a8ec;
  --sky-base: #dfe7f3;

  /* glass */
  --glass: rgba(255, 255, 255, 0.46);
  --glass-strong: rgba(255, 255, 255, 0.72);
  --glass-edge: rgba(255, 255, 255, 0.75);
  --glass-edge-low: rgba(255, 255, 255, 0.22);
  --glass-shade: rgba(28, 40, 70, 0.16);
  --well: rgba(255, 255, 255, 0.38);
  --line: rgba(30, 44, 74, 0.10);
  --line-strong: rgba(30, 44, 74, 0.18);

  /* ink */
  --ink: #17213a;
  --ink-2: rgba(23, 33, 58, 0.66);
  --ink-3: rgba(23, 33, 58, 0.42);

  /* accents */
  --accent: #0f7f88;          /* lagoon: today, primary actions, events */
  --accent-ink: #ffffff;
  --accent-soft: rgba(15, 127, 136, 0.16);
  --event: rgba(15, 127, 136, 0.20);
  --event-edge: #0f7f88;
  --now: #e2405b;
  --p1: #6f8fbf;              /* priority low */
  --p2: #d99a1e;              /* priority medium */
  --p3: #e2405b;              /* priority high */
  --danger: #d23a52;

  --blur: blur(26px) saturate(185%);
  --r-pane: 28px;
  --r-ctl: 999px;
  --r-item: 12px;
  --hour: 52px;
  --gap: 14px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable", "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sky-a: #1c3a78;
    --sky-b: #4a2466;
    --sky-c: #0d4a5a;
    --sky-base: #0c1328;

    --glass: rgba(26, 32, 52, 0.48);
    --glass-strong: rgba(36, 44, 68, 0.80);
    --glass-edge: rgba(255, 255, 255, 0.20);
    --glass-edge-low: rgba(255, 255, 255, 0.05);
    --glass-shade: rgba(0, 0, 0, 0.40);
    --well: rgba(255, 255, 255, 0.06);
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.15);

    --ink: #eef2fa;
    --ink-2: rgba(238, 242, 250, 0.70);
    --ink-3: rgba(238, 242, 250, 0.42);

    --accent: #3cc3c9;
    --accent-ink: #062327;
    --accent-soft: rgba(60, 195, 201, 0.18);
    --event: rgba(60, 195, 201, 0.20);
    --event-edge: #3cc3c9;
    --now: #ff5f78;
    --p1: #8eaee0;
    --p2: #f0b542;
    --p3: #ff5f78;
    --danger: #ff6a80;
  }
}

/* ------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.4 var(--font);
  color: var(--ink);
  background: var(--sky-base);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------- sky */
.sky { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--sky-base); transition: background 2s; }
.sky i {
  position: absolute; border-radius: 50%; filter: blur(70px); opacity: .9;
  transition: background 2s;
}
.sky i:nth-child(1) { width: 62vmax; height: 62vmax; left: -14vmax; top: -18vmax; background: var(--sky-a); }
.sky i:nth-child(2) { width: 54vmax; height: 54vmax; right: -16vmax; top: 8vmax; background: var(--sky-b); }
.sky i:nth-child(3) { width: 58vmax; height: 58vmax; left: 18vmax; bottom: -30vmax; background: var(--sky-c); }
@media (prefers-reduced-motion: no-preference) {
  .sky i:nth-child(1) { animation: drift 46s ease-in-out infinite alternate; }
  .sky i:nth-child(2) { animation: drift 58s ease-in-out infinite alternate-reverse; }
}
@keyframes drift { to { transform: translate(6vmax, 4vmax) scale(1.08); } }

/* ------------------------------------------------------------- glass material */
.glass {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge-low);
  box-shadow:
    inset 0 1px 0 var(--glass-edge),          /* top specular rim */
    inset 0 -1px 0 var(--glass-edge-low),
    inset 1px 0 0 var(--glass-edge-low),
    0 18px 50px -18px var(--glass-shade),
    0 2px 6px -2px var(--glass-shade);
}
/* the light "lens" sheen across the upper half of every pane */
.glass::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    radial-gradient(120% 60% at 15% -10%, rgba(255,255,255,.55), transparent 55%),
    linear-gradient(180deg, rgba(255,255,255,.18), transparent 38%);
  mix-blend-mode: soft-light;
}
@media (prefers-color-scheme: dark) {
  .glass::before { background: radial-gradient(120% 60% at 15% -10%, rgba(255,255,255,.16), transparent 55%); mix-blend-mode: normal; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-strong); }
}

/* ------------------------------------------------------------- controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: var(--r-ctl);
  border: 1px solid var(--glass-edge-low);
  background: var(--well);
  box-shadow: inset 0 1px 0 var(--glass-edge);
  font-weight: 560; letter-spacing: -0.01em; white-space: nowrap;
  transition: transform .12s, background .2s;
}
.btn:active { transform: scale(.96); }
.btn svg { font-size: 17px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 6px 16px -6px var(--accent); }
.btn-plain { background: none; border: 0; box-shadow: none; padding: 0 6px; color: var(--accent); font-weight: 500; }
.btn-strong { font-weight: 650; }
.btn-danger { background: none; border: 0; box-shadow: none; color: var(--danger); }
.btn-wide { width: 100%; height: 44px; }

.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  border: 0; background: none; color: var(--ink);
  transition: background .2s, transform .12s;
}
.icon-btn:hover { background: var(--well); }
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { font-size: 20px; }
.icon-btn circle { fill: currentColor; stroke: none; }

/* segmented control with a sliding glass thumb */
.segmented {
  position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 3px; border-radius: var(--r-ctl);
  background: var(--line); box-shadow: inset 0 1px 2px var(--line);
}
.segmented > button, .segmented label > span {
  position: relative; z-index: 1; display: block; min-width: 64px; height: 30px; padding: 0 12px;
  border: 0; background: none; border-radius: var(--r-ctl);
  font-weight: 560; font-size: 14px; color: var(--ink-2); text-align: center; line-height: 30px;
  transition: color .2s;
}
.segmented > button[aria-selected="true"] { color: var(--ink); }
.seg-thumb {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px;
  border-radius: var(--r-ctl); background: var(--glass-strong);
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 3px 10px -3px var(--glass-shade);
  transition: transform .35s cubic-bezier(.3, 1.4, .5, 1), width .35s;
}
.segmented-small label { cursor: pointer; }
.segmented-small input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-small label > span { min-width: 0; font-size: 13px; }
.segmented-small input:checked + span { color: var(--ink); background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--glass-edge), 0 2px 8px -3px var(--glass-shade); }
.segmented-small input:focus-visible + span { outline: 2.5px solid var(--accent); }

/* ------------------------------------------------------------- app layout */
.app {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "bar bar" "cal day";
  gap: var(--gap);
  padding: calc(var(--gap) + env(safe-area-inset-top)) calc(var(--gap) + env(safe-area-inset-right)) calc(var(--gap) + env(safe-area-inset-bottom)) calc(var(--gap) + env(safe-area-inset-left));
}
.toolbar { grid-area: bar; }
.calendar { grid-area: cal; }
.day-pane { grid-area: day; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 10px 8px 8px; border-radius: var(--r-ctl);
  z-index: 5;
}
.nav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.range-title {
  margin: 0 0 0 10px; font: 650 21px/1.1 var(--font-round); letter-spacing: -0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.range-title small { font-weight: 450; color: var(--ink-2); }
.actions { position: relative; display: flex; align-items: center; gap: 8px; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 180px; padding: 6px;
  border-radius: 18px; background: var(--glass-strong); z-index: 20;
}
.menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; border-radius: 12px; }
.menu button:hover { background: var(--well); }

.calendar, .day-pane { border-radius: var(--r-pane); overflow: hidden; min-height: 0; }

/* ------------------------------------------------------------- week / day grid */
.cal-week { display: grid; grid-template-rows: auto auto minmax(0, 1fr); height: 100%; }
.cal-cols { display: grid; grid-template-columns: 54px repeat(var(--days), minmax(0, 1fr)); }
.cal-head { padding: 12px 8px 6px 0; border-bottom: 1px solid var(--line); }
.dayhead {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px 8px; margin: 0 3px; border: 0; background: none; border-radius: 18px;
  color: var(--ink-2); transition: background .2s;
}
.dayhead:hover { background: var(--well); }
.dayhead .wd { font-size: 12px; font-weight: 560; letter-spacing: .02em; }
.dayhead .dn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  font: 600 22px/1 var(--font-round); color: var(--ink); letter-spacing: -0.03em;
}
.dayhead .marks { display: flex; gap: 3px; height: 5px; }
.dayhead .marks i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); }
.dayhead.is-today .dn { color: var(--accent); }
.dayhead.is-focus { background: var(--glass-strong); box-shadow: inset 0 1px 0 var(--glass-edge), 0 6px 18px -8px var(--glass-shade); color: var(--ink); }
.dayhead.is-focus.is-today .dn { background: var(--accent); color: var(--accent-ink); }
.dayhead.is-weekend:not(.is-focus) .dn { color: var(--ink-2); }

.cal-allday { padding: 4px 8px 4px 0; border-bottom: 1px solid var(--line); min-height: 8px; }
.cal-allday .gutter { font-size: 10.5px; line-height: 1.15; color: var(--ink-3); text-align: right; padding: 4px 8px 0 4px; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: anywhere; }
.allday-cell { display: flex; flex-direction: column; gap: 3px; padding: 0 3px; }

.cal-scroll { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.cal-body { position: relative; padding-right: 8px; }
.hours { position: relative; }
.hour-label {
  height: var(--hour); position: relative; font-size: 11px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; text-align: right; padding-right: 8px;
}
.hour-label span { position: relative; top: -7px; }
.daycol { position: relative; border-left: 1px solid var(--line); cursor: copy;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--hour) - 1px), var(--line) calc(var(--hour) - 1px), var(--line) var(--hour));
}
.daycol.is-focus { background-color: var(--accent-soft); background-color: color-mix(in srgb, var(--accent) 7%, transparent); }
.now-line { position: absolute; left: -4px; right: 0; height: 2px; background: var(--now); z-index: 3; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -1px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--now); }

.ev {
  position: absolute; z-index: 2; overflow: hidden;
  padding: 4px 7px; border-radius: 10px; border: 0; text-align: left;
  /* tinted but nearly opaque, so stacked (overlapping) events stay readable */
  background: linear-gradient(var(--event), var(--event)), var(--glass-strong);
  box-shadow: inset 3px 0 0 var(--event-edge), inset 0 1px 0 var(--glass-edge-low);
  font-size: 12.5px; line-height: 1.25; color: var(--ink); cursor: pointer;
  transition: transform .12s, box-shadow .2s;
}
.ev { outline: 1px solid var(--glass-edge-low); }
.ev:hover { box-shadow: inset 3px 0 0 var(--event-edge), inset 0 1px 0 var(--glass-edge), 0 8px 20px -10px var(--glass-shade); z-index: 4; }
.ev:active { transform: scale(.98); }
.ev b { display: block; font-weight: 620; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev small { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.ev.is-past { opacity: .6; }
.chip {
  display: block; width: 100%; padding: 3px 8px; border: 0; border-radius: 8px; text-align: left;
  background: var(--event); box-shadow: inset 3px 0 0 var(--event-edge);
  font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}

/* ------------------------------------------------------------- month grid */
.cal-month { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; padding: 8px 10px 10px; }
.month-wd { display: grid; grid-template-columns: repeat(7, 1fr); font-size: 12px; font-weight: 560; color: var(--ink-2); text-align: right; padding: 4px 10px 8px; }
.month-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); gap: 4px; }
.mday {
  display: flex; flex-direction: column; gap: 3px; min-height: 0; overflow: hidden;
  padding: 6px; border: 0; border-radius: 14px; background: var(--well); text-align: left;
  transition: background .2s;
}
.mday:hover { background: var(--glass-strong); }
.mday .dn { align-self: flex-end; display: grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; font: 600 15px/1 var(--font-round); }
.mday.is-other { opacity: .45; }
.mday.is-today .dn { color: var(--accent); }
.mday.is-focus { background: var(--glass-strong); box-shadow: inset 0 0 0 2px var(--accent); }
.mday.is-focus.is-today .dn { background: var(--accent); color: var(--accent-ink); }
.mday .mev { font-size: 11.5px; padding: 1px 6px; border-radius: 6px; background: var(--event); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mday .mmore, .mday .mtodo { font-size: 11px; color: var(--ink-2); padding: 0 6px; }

/* ------------------------------------------------------------- day pane (todos) */
.day-pane { display: flex; flex-direction: column; }
.day-head { padding: 20px 22px 10px; }
.day-weekday { margin: 0; font-size: 14px; font-weight: 600; color: var(--accent); }
.day-date { margin: 2px 0 0; font: 700 30px/1.05 var(--font-round); letter-spacing: -0.03em; }
.day-events { display: none; }

.todo-add {
  display: flex; align-items: center; gap: 12px; margin: 6px 14px 4px; padding: 0 14px;
  height: 48px; border-radius: 16px; background: var(--well);
  box-shadow: inset 0 1px 0 var(--glass-edge-low);
}
.todo-add input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; }
.todo-add input::placeholder { color: var(--ink-3); }
.todo-add:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }

.todo-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 18px; }
.group { margin-top: 14px; }
.group-title {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  margin: 0; padding: 4px 14px 6px; border: 0; background: none;
  font-size: 13px; font-weight: 650; color: var(--ink-2); text-align: left;
}
.group-title .count { font-weight: 500; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.group.is-overdue .group-title { color: var(--now); }
.group-title svg { transition: transform .25s; }
.group.is-collapsed .group-title svg { transform: rotate(-90deg); }
.group.is-collapsed ul { display: none; }
.empty { margin: 18px 14px 0; color: var(--ink-3); font-size: 14px; }

.todos { list-style: none; margin: 0; padding: 0; }
.todo {
  display: flex; align-items: flex-start; gap: 12px; padding: 10px 14px; border-radius: 14px;
  transition: background .2s;
}
.todo:hover { background: var(--well); }
.check {
  flex: none; position: relative; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%;
  border: 2px solid var(--ink-3); background: none; padding: 0;
  transition: border-color .2s, background .2s, transform .15s;
}
.check.ghost { border-style: dashed; }
.check[data-prio="1"] { border-color: var(--p1); }
.check[data-prio="2"] { border-color: var(--p2); }
.check[data-prio="3"] { border-color: var(--p3); }
.check:active { transform: scale(.85); }
.check::after {
  content: ""; position: absolute; left: 6px; top: 2.5px; width: 5px; height: 10px;
  border: solid var(--accent-ink); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) scale(0);
  transition: transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.todo.is-done .check { background: var(--accent); border-color: var(--accent); }
.todo.is-done .check::after { transform: rotate(45deg) scale(1); }
.todo-body { flex: 1; min-width: 0; border: 0; background: none; padding: 0; text-align: left; }
.todo-title { display: block; font-size: 15.5px; line-height: 1.3; overflow-wrap: anywhere; }
.todo.is-done .todo-title { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-3); }
.todo-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; font-size: 12.5px; color: var(--ink-2); }
.todo-meta .late { color: var(--now); font-weight: 560; }
.todo-meta .flag { font-weight: 600; }
.todo-meta .flag[data-prio="1"] { color: var(--p1); }
.todo-meta .flag[data-prio="2"] { color: var(--p2); }
.todo-meta .flag[data-prio="3"] { color: var(--p3); }
.todo-notes { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: no-preference) {
  .todo.just-done { animation: settle .45s ease; }
}
@keyframes settle { 40% { transform: translateX(6px); } }

/* ------------------------------------------------------------- phone extras (hidden on large screens) */
.fab { display: none; }
.strip, .agenda-list { display: none; }

/* ------------------------------------------------------------- sheets (editors) */
.sheet {
  border: 0; padding: 0; background: none; color: var(--ink);
  width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); overflow: visible;
}
.sheet::backdrop { background: rgba(10, 16, 30, .28); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.sheet[open] { animation: rise .32s cubic-bezier(.2, 1.2, .4, 1); }
@keyframes rise { from { transform: translateY(16px) scale(.97); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sheet[open] { animation: none; } }
.sheet-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 10px 20px 18px; border-radius: 30px;
  background: var(--glass-strong); max-height: calc(100dvh - 40px); overflow-y: auto;
}
.sheet-grabber { display: none; }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin: 0 -8px; }
.sheet-head h3 { margin: 0; font-size: 16px; font-weight: 650; }
.sheet-head .btn:first-child { justify-self: start; }
.sheet-head .btn:last-child { justify-self: end; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin: 0; padding: 0; border: 0; }
.field > span, .field > legend { font-size: 13px; font-weight: 560; color: var(--ink-2); padding: 0; margin-bottom: 5px; }
.field input, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--well); outline: none; font-size: 16px;
  box-shadow: inset 0 1px 2px var(--line);
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 10px; }
.field-row .field.timed[aria-hidden="true"] { visibility: hidden; }
.form-error { margin: 0; min-height: 0; color: var(--danger); font-size: 13.5px; }
.form-error:empty { display: none; }

.switch { display: flex; align-items: center; gap: 12px; font-weight: 560; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.switch-track { position: relative; width: 50px; height: 30px; border-radius: 15px; background: var(--line-strong); transition: background .25s; }
.switch-track span { position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: transform .3s cubic-bezier(.3, 1.4, .5, 1); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track span { transform: translateX(20px); }
.switch input:focus-visible + .switch-track { outline: 2.5px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------- toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  padding: 12px 20px; border-radius: var(--r-ctl); background: var(--glass-strong); font-weight: 560; z-index: 50;
}

/* ------------------------------------------------------------- login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(380px, 100%); padding: 34px 28px 28px; border-radius: 34px;
  display: flex; flex-direction: column; gap: 14px; text-align: center;
}
.login-mark { width: 64px; height: 64px; margin: 0 auto 4px; display: grid; place-items: center; border-radius: 20px; background: var(--accent); color: var(--accent-ink); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 12px 24px -10px var(--accent); }
.login-mark svg { width: 38px; height: 38px; stroke-width: 3; }
.login h1 { margin: 0; font: 700 30px/1 var(--font-round); letter-spacing: -0.03em; }
.login-sub { margin: 0 0 6px; color: var(--ink-2); }
.login .field { text-align: left; }

/* =====================================================================
   iPad (and narrow Mac windows): keep both panes, slimmer todo column
   ===================================================================== */
@media (max-width: 1180px) {
  .app { grid-template-columns: minmax(0, 1fr) 310px; --gap: 12px; }
  .day-date { font-size: 26px; }
}
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr) 280px; }
  .cal-cols { grid-template-columns: 44px repeat(var(--days), minmax(0, 1fr)); }
  .dayhead .dn { width: 34px; height: 34px; font-size: 19px; }
  .dayhead { margin: 0 1px; }
  .ev { padding: 3px 5px; font-size: 11.5px; }
  .cal-allday .gutter { font-size: 0; }
  .segmented > button { min-width: 54px; padding: 0 10px; }
  #new-event span { display: none; }
  #new-event { width: 36px; padding: 0; }
}
/* iPad portrait: calendar on top, the day's todos below */
@media (min-width: 700px) and (max-width: 1023px) and (orientation: portrait) {
  .app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1.25fr) minmax(0, 1fr);
    grid-template-areas: "bar" "cal" "day";
  }
  .day-pane { display: grid; grid-template-columns: 240px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .day-head { grid-row: 1 / 3; padding: 22px; }
  .todo-add { grid-column: 2; margin-top: 14px; }
  .todo-scroll { grid-column: 2; }
}

/* =====================================================================
   Smartphone: week strip + the focused day's events and todos, stacked
   ===================================================================== */
@media (max-width: 699px) {
  body { overflow: auto; }
  .app {
    display: flex; flex-direction: column; height: auto; min-height: 100dvh;
    --gap: 10px; padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }
  .toolbar {
    position: sticky; top: calc(8px + env(safe-area-inset-top)); flex-wrap: wrap; row-gap: 8px;
    border-radius: 26px; padding: 8px;
  }
  .nav { flex: 1; }
  .range-title { font-size: 19px; margin-left: 6px; }
  #prev, #next { display: none; }
  #new-event { display: none; }
  .segmented { order: 3; width: 100%; }
  .segmented > button[data-view="day"] { display: none; }
  .segmented > button { min-width: 0; }

  .calendar { flex: none; overflow: visible; }
  .cal-week, .cal-head, .cal-allday, .cal-scroll { display: none; }
  .strip {
    display: grid; grid-template-columns: 34px repeat(7, minmax(0, 1fr)) 34px; align-items: center;
    padding: 8px 4px; touch-action: pan-y;
  }
  .strip .icon-btn { width: 34px; height: 34px; }
  .strip .dayhead { margin: 0; padding: 6px 0 8px; border-radius: 16px; }
  .strip .dayhead .dn { width: 34px; height: 34px; font-size: 19px; }

  .cal-month { height: auto; padding: 6px 6px 8px; }
  .month-wd { padding: 2px 0 6px; text-align: center; font-size: 11px; }
  .month-grid { grid-auto-rows: 48px; gap: 2px; }
  .mday { align-items: center; padding: 4px 2px; border-radius: 12px; background: none; }
  .mday .dn { align-self: center; font-size: 15px; }
  .mday .mev, .mday .mmore, .mday .mtodo { display: none; }
  .mday .mdots { display: flex; gap: 3px; }
  .mday .mdots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
  .mday .mdots i.t { background: var(--ink-3); }

  .day-pane { flex: none; overflow: visible; }
  .day-head { padding: 18px 18px 6px; }
  .day-date { font-size: 26px; }
  .day-events { display: block; padding: 4px 10px 6px; }
  .agenda-list { display: flex; flex-direction: column; gap: 6px; }
  .agenda-item {
    display: grid; grid-template-columns: 54px 1fr; gap: 10px; align-items: start; width: 100%;
    padding: 10px 12px; border: 0; border-radius: 14px; text-align: left;
    background: var(--event); box-shadow: inset 3px 0 0 var(--event-edge);
  }
  .agenda-item time { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-2); line-height: 1.3; }
  .agenda-item b { display: block; font-weight: 620; }
  .agenda-item small { color: var(--ink-2); }
  .todo-add { margin: 10px 10px 2px; }
  .todo-scroll { overflow: visible; padding: 0 2px 12px; }
  .todo { padding: 12px; }
  .check { width: 24px; height: 24px; }
  .check::after { left: 7px; top: 3px; }

  .fab {
    display: grid; place-items: center; position: fixed; z-index: 10;
    right: calc(20px + env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom));
    width: 60px; height: 60px; border-radius: 50%; border: 1px solid rgba(255,255,255,.35);
    background: var(--accent); color: var(--accent-ink);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 14px 30px -10px var(--accent), 0 4px 10px -4px rgba(0,0,0,.25);
  }
  .fab svg { font-size: 26px; stroke-width: 2.4; }
  .fab:active { transform: scale(.94); }

  /* editors become bottom sheets */
  .sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; max-height: 92dvh; }
  .sheet[open] { animation-name: slideup; }
  @keyframes slideup { from { transform: translateY(100%); } }
  .sheet-card { border-radius: 30px 30px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom)); max-height: 92dvh; }
  .sheet-grabber { display: block; width: 38px; height: 5px; margin: 0 auto -4px; border-radius: 3px; background: var(--line-strong); }
  .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }
}
