/* Duckly — calm, Apple-like. Neutral greys (iOS system greys), a user-chosen accent (default graphite),
   and a fixed indigo for dates (the year and today). */
:root {
  --bg: #ffffff;
  --ink: #1d1d1f;
  --ink-soft: #6e6e73;
  --muted: #aeaeb2;
  --line: #ececef;
  /* Accent: set by app.js as --accent-light/-dark (+ --on-accent-*) from the user's choice. */
  --accent: var(--accent-light, #1d1d1f);
  --on-accent: var(--on-accent-light, #ffffff);
  --date: #5856d6;              /* iOS indigo: year + today */
  --accent-soft: color-mix(in srgb, var(--accent) 13%, var(--bg));
  --fill: #f2f2f7;              /* iOS systemGray6 */
  --fill-2: #e5e5ea;            /* iOS systemGray5 */
  --surface: #ffffff;
  --panel: rgba(246, 246, 250, 0.86);
  --overlay: rgba(0, 0, 0, 0.12);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 12px 40px rgba(0, 0, 0, 0.10);
  --danger: #ff3b30;
  --row: 44px;
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, 'Segoe UI', sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', system-ui, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111113;
    --ink: #f5f5f7;
    --ink-soft: #98989d;
    --muted: #636366;
    --line: #232326;
    --accent: var(--accent-dark, #e5e5ea);
    --on-accent: var(--on-accent-dark, #1d1d1f);
    --date: #8e8cf5;
    --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--bg));
    --fill: #1c1c1f;
    --fill-2: #2c2c2e;
    --surface: #1c1c1e;
    --panel: rgba(30, 30, 33, 0.86);
    --overlay: rgba(0, 0, 0, 0.45);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 48px rgba(0, 0, 0, 0.5);
    --danger: #ff453a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.4 var(--font);
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* ---------- auth ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--fill); }
.auth-card {
  width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border-radius: 22px; padding: 32px 28px 24px; box-shadow: var(--shadow);
}
.auth-mascot { align-self: center; width: 56px; height: 56px; }
.auth-title { margin: 0; font: 700 30px/1.1 var(--font-display); letter-spacing: -0.02em; text-align: center; }
.auth-sub { margin: 0 0 8px; color: var(--ink-soft); text-align: center; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.field input {
  font-size: 16px; color: var(--ink); background: var(--fill);
  border: 1px solid transparent; border-radius: 10px; padding: 10px 12px; outline: none;
  transition: border-color 0.15s, background 0.15s;
}
.field input:focus { border-color: var(--accent); background: var(--surface); }
.form-error { color: var(--danger); font-size: 13px; margin: 0; min-height: 1em; }
.btn-primary {
  background: var(--accent); color: var(--on-accent); border-radius: 12px; padding: 12px 20px; font-weight: 600; font-size: 16px;
  transition: filter 0.15s;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-link { color: var(--accent); font-size: 14px; padding: 6px; }
.auth-google { display: flex; flex-direction: column; gap: 12px; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 44px; border-radius: 12px;
  background: var(--surface); color: var(--ink); font-weight: 500; text-decoration: none;
  box-shadow: inset 0 0 0 1px var(--fill-2);
}
.btn-google:hover { background: var(--fill); }
.btn-google .g-logo { width: 18px; height: 18px; flex: none; stroke: none; }
.auth-or { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 1px; background: var(--fill-2); }
.dialog .hint { font-size: 13px; margin: 0 0 10px; }
.btn-link:hover { text-decoration: underline; }

/* ---------- top bar ---------- */
.app { padding: 28px 40px 80px; max-width: 1680px; margin: 0 auto; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.title-wrap { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; min-width: 0; }
.title {
  margin: 0; font: 700 36px/1.15 var(--font-display); letter-spacing: -0.03em; color: var(--ink);
  cursor: pointer; user-select: none;
}
.title .year { color: var(--date); }
.cal-badge { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; }
.top-actions { display: flex; gap: 6px; flex: none; }
.round {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  background: var(--fill); color: var(--ink); transition: background 0.15s, transform 0.1s;
}
.round:hover { background: var(--fill-2); }
.round:active { transform: scale(0.94); }
.round svg { width: 18px; height: 18px; }
.round.avatar { background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14px; }
.round.avatar:hover { background: color-mix(in srgb, var(--accent) 20%, var(--bg)); }

/* ---------- week grid ---------- */
.week { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 28px; margin-top: 44px; }
.col { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.day-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  border-bottom: 1.5px solid var(--ink); padding-bottom: 8px;
  font-size: 18px; white-space: nowrap;
}
.day-head .num { font-weight: 600; }
.day-head .dow { color: var(--muted); font-weight: 400; font-size: 15px; }
.day.today .day-head { border-color: var(--date); }
.day.today .day-head .num { color: var(--date); }
.day.today .day-head .dow { color: var(--date); opacity: 0.7; }
.day.past .line.task:not(.done) .t { color: var(--ink-soft); }

.lines { list-style: none; margin: 0; padding: 0; }
.line {
  height: var(--row); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 6px; padding: 0 10px; cursor: text; position: relative;
}
/* Task highlight is a pill that floats inside the ruled line. */
.line.task { cursor: pointer; }
.line.task::before {
  content: ''; position: absolute; inset: 5px 0; border-radius: 999px;
  background: transparent; transition: background 0.12s; z-index: 0;
}
.line.task > * { position: relative; z-index: 1; }
.line.task:hover::before { background: var(--fill); }
.line .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line .ico { width: 14px; height: 14px; stroke-width: 2; color: var(--ink-soft); }
.line.done .t { text-decoration: line-through; color: var(--muted); }
.line.done .ico { color: var(--muted); }
/* Drag and drop: the lifted task follows the pointer; a soft gap shows where it will land. */
.line.task { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.line.drag-source, .line.drag-hidden { display: none; }
.line.placeholder::before {
  content: ''; position: absolute; inset: 5px 0; border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 40%, transparent);
}
.drag-ghost {
  position: fixed; z-index: 1000; margin: 0; list-style: none; pointer-events: none; border-bottom: 0;
  background: var(--surface); border-radius: 999px; will-change: transform;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);
  transform: translate3d(var(--gx, 0), var(--gy, 0), 0) rotate(-1.2deg) scale(1.03);
  animation: lift 0.14s ease-out;
}
@keyframes lift { from { transform: translate3d(var(--gx, 0), var(--gy, 0), 0); box-shadow: none; } }
.drag-ghost .check { opacity: 0; }
.drag-ghost.landing { transform: translate3d(var(--gx, 0), var(--gy, 0), 0); transition: transform 0.17s cubic-bezier(.2, .8, .2, 1), box-shadow 0.17s; box-shadow: none; }
.line.placeholder::before { animation: gap-in 0.18s ease-out; }
@keyframes gap-in { from { opacity: 0; transform: scaleY(0.4); } }
.line.task.renaming::before { background: var(--fill); }
.line.task .line-input { -webkit-user-select: text; user-select: text; }
@media (prefers-reduced-motion: reduce) { .drag-ghost, .drag-ghost.landing, .line.placeholder::before { animation: none; transition: none; } }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; }
.line-input { flex: 1; border: 0; outline: none; background: transparent; padding: 0; min-width: 0; }

.check {
  width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--muted);
  flex: none; opacity: 0; transition: opacity 0.12s, background 0.12s; display: grid; place-items: center;
}
.check svg { width: 10px; height: 10px; stroke-width: 3; opacity: 0; }
.line:hover .check, .check:focus-visible { opacity: 1; }
.check:hover { border-color: var(--accent); }
.check:hover svg { opacity: 0.6; color: var(--accent); }
.line.done .check { background: var(--muted); border-color: var(--muted); color: var(--bg); }
.line.done .check svg { opacity: 1; color: var(--bg); }
@media (hover: none) { .check { opacity: 0.7; } }

/* Task colors: soft pastel pills (iOS system colors, heavily tinted). */
.line.task[data-color]::before { background: color-mix(in srgb, var(--c) 16%, var(--bg)); }
.line.task[data-color]:hover::before { background: color-mix(in srgb, var(--c) 24%, var(--bg)); }
[data-color="red"] { --c: #ff3b30; }
[data-color="orange"] { --c: #ff9500; }
[data-color="yellow"] { --c: #ffcc00; }
[data-color="green"] { --c: #34c759; }
[data-color="blue"] { --c: #007aff; }
[data-color="purple"] { --c: #af52de; }
[data-color="gray"] { --c: #8e8e93; }

/* ---------- bottom lists ---------- */
.lists { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; margin-top: 56px; }
.inbox-title { text-align: left; cursor: pointer; }
.inbox-title:hover { color: var(--ink); }
.list-title {
  width: 100%; border: 0; outline: none; background: transparent; padding: 0 0 8px;
  font-size: 18px; font-weight: 600; color: var(--ink-soft);
}
.list-title:focus { color: var(--ink); }
.list .lines { border-top: 1px solid var(--line); }

/* ---------- overlay + task card ---------- */
.overlay {
  position: fixed; inset: 0; background: var(--overlay); z-index: 20;
  display: grid; place-items: center; padding: 16px; animation: fade 0.15s ease-out;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(4px) scale(0.985); } }
.card {
  background: var(--surface); border-radius: 20px; padding: 18px 22px 20px;
  width: min(580px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  box-shadow: var(--shadow); animation: pop 0.16s ease-out;
}
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
/* date and time share the first row (the time wraps under the date when there's no room) */
.card-when { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; flex: 1; }
.card-when .card-time { margin: 0; }
/* the title, with the done circle at its end */
.card-title-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 22px; border-bottom: 1px solid var(--line); }
.card-title-row .card-title { margin-top: 0; border-bottom: 0; flex: 1; min-width: 0; }
.card-title-row .icon-btn { flex: none; width: 36px; height: 36px; margin: -1px -6px 0 0; }
.card-title-row .icon-btn svg { width: 24px; height: 24px; }
.card-title-row .icon-btn.on { color: var(--accent); }
/* color button: a drop, filled with the task's color */
.color-btn.has-color svg { fill: var(--c); stroke: var(--c); }
.card-actions .icon-btn { width: 30px; }
/* time chips in the first row are a little more compact */
.card-when .time-chip { padding: 5px 9px; }
.card-when .time-clear { width: 24px; }
/* phones: the icons get their own row above the date and time */
@media (max-width: 520px) {
  .card-top { flex-wrap: wrap; }
  .card-actions { order: -1; width: 100%; justify-content: flex-end; margin: -6px -8px 0 0; }
}
.when {
  display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink-soft);
  position: relative; cursor: pointer; border-radius: 999px; padding: 5px 10px; margin-left: -4px; background: var(--fill);
}
.when:hover { background: var(--fill-2); color: var(--ink); }
.when svg { width: 14px; height: 14px; }

/* Month calendar for picking a task's date */
.dp { width: 276px; padding: 4px 4px 2px; }
.dp-head { display: flex; align-items: center; justify-content: space-between; padding: 0 0 6px; }
.dp-month { font: 600 16px/1 var(--font-display); letter-spacing: -0.01em; }
.dp-year { color: var(--date); }
.dp-dow, .dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.dp-dow span { font-size: 11px; font-weight: 600; color: var(--ink-soft); text-align: center; padding: 2px 0 6px; letter-spacing: 0.03em; }
.dp-day {
  justify-self: center; width: 34px; height: 34px; border-radius: 50%; font-size: 14px;
  font-variant-numeric: tabular-nums; color: var(--ink); transition: background 0.1s;
}
.dp-day:hover { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.dp-day.wkend { color: var(--ink-soft); }
.dp-day.out { color: var(--muted); }
.dp-day.today { color: var(--date); font-weight: 700; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--date) 45%, transparent); }
.dp-day.sel { background: var(--accent); color: var(--on-accent); font-weight: 600; box-shadow: none; }
.dp-quick { display: flex; gap: 6px; margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--fill-2); }
.dp-chip { flex: 1; padding: 7px 0; border-radius: 10px; background: color-mix(in srgb, var(--ink) 7%, transparent); font-size: 13px; font-weight: 500; color: var(--ink); }
.dp-chip:hover, .dp-chip.sel { background: var(--accent); color: var(--on-accent); }

/* "Only this / this and following / all" question for repeating tasks */
.scope-opts { display: flex; flex-direction: column; gap: 8px; }
.scope-opt {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 6%, var(--surface)); color: var(--ink);
}
.scope-opt b { font-weight: 600; font-size: 15px; }
.scope-opt span { font-size: 13px; color: var(--ink-soft); }
.scope-opt:hover { background: var(--accent); color: var(--on-accent); }
.scope-opt:hover span { color: inherit; opacity: 0.8; }
.scope-cancel { display: block; margin: 10px auto 0; }
.card-actions { display: flex; gap: 0; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft);
  transition: background 0.12s, color 0.12s;
}
.icon-btn:hover { background: var(--fill); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn.on { color: var(--accent); }
.icon-btn.faded { color: var(--muted); }
.card-title {
  display: block; width: 100%; margin-top: 22px; resize: none; border: 0; outline: none; background: transparent;
  font: 600 26px/1.25 var(--font-display); letter-spacing: -0.02em; padding: 0 0 10px;
  border-bottom: 1px solid var(--line); overflow: hidden;
}
.card.is-done .card-title { text-decoration: line-through; color: var(--ink-soft); }
.card-notes {
  display: block; width: 100%; resize: none; border: 0; outline: none; background: transparent;
  margin-top: 12px; min-height: 24px; overflow: hidden; line-height: 1.5;
}
.card-notes::placeholder, .sub-input::placeholder { color: var(--muted); }
.subtasks { list-style: none; margin: 8px 0 0; padding: 0; }
.subtask { display: flex; align-items: center; gap: 10px; min-height: 34px; }
.subtask .sub-input { flex: 1; border: 0; outline: none; background: transparent; padding: 5px 0; min-width: 0; }
.subtask.done .sub-input { text-decoration: line-through; color: var(--ink-soft); }
.sub-check {
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none;
  display: grid; place-items: center; transition: background 0.12s;
}
.sub-check svg { width: 10px; height: 10px; stroke-width: 3; opacity: 0; }
.subtask.done .sub-check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.subtask.done .sub-check svg { opacity: 1; }
.sub-del { opacity: 0; color: var(--muted); width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.sub-del:hover { color: var(--ink); background: var(--fill); }
.sub-del svg { width: 14px; height: 14px; }
.subtask:hover .sub-del, .sub-del:focus-visible { opacity: 1; }
.subtask.new .sub-check { border-style: dashed; }
.card-meta { margin-top: 14px; font-size: 13px; color: var(--ink-soft); }

/* ---------- popover menus + side panel ---------- */
.pop {
  position: fixed; z-index: 40; background: var(--panel); border-radius: 14px; padding: 5px; min-width: 190px;
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: var(--shadow), 0 0 0 0.5px var(--fill-2); animation: pop 0.12s ease-out;
}
.pop-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; text-align: left; padding: 7px 10px; border-radius: 8px; font-size: 14px;
}
.pop-item:hover { background: var(--accent); color: var(--on-accent); }
.pop-item.danger { color: var(--danger); }
.pop-item.danger:hover { background: var(--danger); color: #fff; }
.pop-item.checked::after { content: '✓'; font-weight: 600; }
.pop-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); padding: 8px 10px 3px; }
.swatches { display: flex; gap: 8px; padding: 6px 10px 8px; flex-wrap: wrap; }
.swatch { width: 20px; height: 20px; border-radius: 50%; background: var(--c); }
.swatch.none { background: transparent; box-shadow: inset 0 0 0 1.5px var(--muted); position: relative; }
.swatch.none::after { content: ''; position: absolute; left: 50%; top: 3px; bottom: 3px; width: 1.5px; background: var(--muted); transform: rotate(45deg); }
.swatch.selected { outline: 2px solid var(--ink); outline-offset: 2px; }
.accent-swatches { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 6px; }
.accent-swatch { width: 30px; height: 30px; border-radius: 50%; background: var(--sw); transition: transform 0.12s; }
.accent-swatch:hover { transform: scale(1.08); }
.accent-swatch.selected { outline: 2px solid var(--sw); outline-offset: 3px; }
/* "Any color": rainbow ring with the native color picker laid invisibly on top. */
.accent-swatch.custom { position: relative; background: conic-gradient(#e0605a, #e0b35a, #7fc27a, #5aa9e0, #9a7fe0, #e07fb8, #e0605a); }
.accent-swatch.custom.selected { background: var(--sw); box-shadow: inset 0 0 0 3px var(--surface); outline-color: var(--ink-soft); }
.accent-swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; border: 0; padding: 0; }

.panel {
  position: fixed; z-index: 30; top: 76px; right: 40px; width: min(320px, calc(100vw - 32px));
  max-height: calc(100vh - 92px); overflow: auto;
  background: var(--panel); border-radius: 20px; padding: 16px; animation: pop 0.14s ease-out;
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow), 0 0 0 0.5px var(--fill-2);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 2px 12px 4px; }
.panel-name { font: 600 19px/1.2 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile {
  background: var(--surface); border-radius: 14px; padding: 12px 14px; text-align: left;
  display: flex; flex-direction: column; gap: 10px; font-size: 15px; font-weight: 500;
  transition: background 0.12s;
}
.tile svg { color: var(--accent); }
.tile:hover { background: color-mix(in srgb, var(--surface) 88%, var(--ink)); }
.tile.wide { grid-column: 1 / -1; }
.tile.group { padding: 0 14px; gap: 0; cursor: default; }
.tile.group:hover { background: var(--surface); }
.cal-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 0; width: 100%; text-align: left;
  border-bottom: 0.5px solid var(--fill-2);
}
.cal-row:last-child { border-bottom: 0; }
.cal-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-row small { color: var(--ink-soft); font-size: 13px; font-weight: 400; display: block; }

/* ---------- dialogs ---------- */
.dialog { background: var(--surface); border-radius: 20px; padding: 20px 22px 22px; width: min(420px, 100%); animation: pop 0.16s ease-out; max-height: calc(100vh - 32px); overflow: auto; box-shadow: var(--shadow); }
.dialog h2 { margin: 0; font: 600 21px/1.2 var(--font-display); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dialog p { color: var(--ink-soft); margin: 0 0 14px; }
.dialog .field { margin-bottom: 12px; }
.dialog .row { display: flex; gap: 8px; align-items: flex-end; }
.dialog .row .field { flex: 1; margin: 0; }
.btn-small { background: var(--accent); color: var(--on-accent); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 14px; flex: none; }
.btn-small:hover { filter: brightness(1.06); }
.people { list-style: none; padding: 0; margin: 14px 0 0; }
.people li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 0.5px solid var(--fill-2); }
.people li:last-child { border-bottom: 0; }
.people .who { flex: 1; min-width: 0; font-weight: 500; }
.people small { color: var(--ink-soft); display: block; font-size: 13px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
.mini-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.about { display: flex; flex-direction: column; }
.about-bird { display: grid; place-items: center; background: color-mix(in srgb, var(--ink) 5%, var(--surface)); border-radius: 16px; padding: 12px 0; margin-bottom: 16px; }
.about-bird img { width: 120px; height: 120px; display: block; }
.about-name { font: 600 19px/1.2 var(--font-display); letter-spacing: -0.01em; text-align: center; }
.dialog .about-lede { margin: 4px auto 12px; text-align: center; }
.about-lede span { display: block; }
.dialog .about-mascot { margin: 0 auto 18px; text-align: center; max-width: 34ch; text-wrap: balance; color: var(--ink); }
.shortcuts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 6px 0 0; align-items: center; }
.shortcuts dt { display: flex; gap: 4px; }
.shortcuts dd { margin: 0; color: var(--ink-soft); }
kbd {
  display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 7px; border-radius: 7px;
  background: var(--fill); box-shadow: inset 0 -1px 0 var(--fill-2); color: var(--ink);
  font: 500 12px/1 var(--font); font-variant-numeric: tabular-nums;
}
.mascot-choices { display: flex; gap: 10px; margin: 4px 0 6px; }
.mascot-choice {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 16px 8px;
  border-radius: 14px; background: var(--fill); font-size: 13px; color: var(--ink-soft);
}
.mascot-choice img { width: 44px; height: 44px; }
.mascot-choice.selected { outline: 2px solid var(--accent); outline-offset: 2px; color: var(--ink); }
.section-label { font-size: 12px; color: var(--ink-soft); margin: 20px 0 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }

/* ---------- search ---------- */
.search-box {
  background: var(--panel); border-radius: 16px; width: min(560px, 100%); align-self: start; margin-top: 12vh; padding: 6px;
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow), 0 0 0 0.5px var(--fill-2); animation: pop 0.14s ease-out;
}
.search-box input { width: 100%; border: 0; outline: none; background: transparent; font-size: 19px; padding: 11px 12px; }
.results { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow: auto; }
.results:not(:empty) { border-top: 0.5px solid var(--fill-2); padding-top: 4px; }
.results li button { display: flex; width: 100%; text-align: left; gap: 12px; justify-content: space-between; padding: 8px 12px; border-radius: 10px; }
.results li button:hover, .results li button:focus-visible { background: var(--accent); color: var(--on-accent); outline: none; }
.results li button:hover .where, .results li button:focus-visible .where { color: inherit; opacity: 0.8; }
.results .where { color: var(--ink-soft); font-size: 13px; flex: none; }
.results .done .t { text-decoration: line-through; opacity: 0.6; }
.results .empty-state { padding: 10px 12px 12px; color: var(--ink-soft); }

/* ---------- inbox ---------- */
.inbox-btn { position: relative; }
.inbox-count {
  position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}
.inbox-count[hidden] { display: none; }
/* labels: soft tinted text, like the task colors */
.lbl-idea { --lc: #c98a00; } .lbl-task { --lc: #007aff; } .lbl-project { --lc: #8e5bd8; } .lbl-note { --lc: #8e8e93; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lbl-idea { --lc: #f0c04a; } :root:not([data-theme="light"]) .lbl-task { --lc: #4aa3ff; } :root:not([data-theme="light"]) .lbl-project { --lc: #b58cf0; } }
.lbl {
  flex: none; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; color: var(--lc);
  background: color-mix(in srgb, var(--lc) 13%, transparent); border-radius: 6px; padding: 1px 6px; margin-right: 6px;
}
.inbox-box {
  background: var(--panel); border-radius: 20px; width: min(560px, 100%); align-self: start; margin-top: 8vh; padding: 16px;
  max-height: calc(100dvh - 16vh); display: flex; flex-direction: column;
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
  box-shadow: var(--shadow), 0 0 0 0.5px var(--fill-2); animation: pop 0.14s ease-out;
}
.inbox-head { display: flex; align-items: center; gap: 8px; margin: 0 0 12px 4px; }
.inbox-head h2 { margin: 0; font: 600 20px/1.2 var(--font-display); }
.inbox-n { color: var(--ink-soft); font-size: 15px; flex: 1; }
.inbox-add { display: flex; align-items: center; gap: 6px; background: var(--surface); border-radius: 14px; padding: 4px 4px 4px 12px; box-shadow: 0 0 0 0.5px var(--fill-2); }
.inbox-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 17px; padding: 8px 0; }
.inbox-add-btn { padding: 8px 14px; font-size: 15px; border-radius: 10px; }
.inbox-lang { font-size: 11px; font-weight: 700; color: var(--ink-soft); padding: 4px 6px; border-radius: 6px; }
.inbox-lang:hover { background: var(--fill); color: var(--ink); }
.inbox-mic.on { color: #fff; background: #ff3b30; animation: listen 1.2s ease-in-out infinite; }
@keyframes listen { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, #ff3b30 25%, transparent); } }
.inbox-labels { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 8px; }
.chip { font-size: 13px; padding: 5px 11px; border-radius: 999px; background: var(--fill); color: var(--ink-soft); }
.chip:hover { color: var(--ink); }
.chip.on { background: var(--accent); color: var(--on-accent); }
.chip[class*="lbl-"].on { background: color-mix(in srgb, var(--lc) 18%, var(--surface)); color: var(--lc); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lc) 45%, transparent); }
.inbox-items { list-style: none; margin: 0; padding: 0; overflow: auto; min-height: 0; }
.inbox-item { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); min-height: 44px; }
.inbox-item:last-child { border-bottom: 0; }
.inbox-check { color: var(--muted); width: 30px; height: 30px; display: grid; place-items: center; flex: none; }
.inbox-check svg { width: 19px; height: 19px; }
.inbox-item.done .inbox-check { color: var(--accent); }
.inbox-open { flex: 1; min-width: 0; display: flex; align-items: center; text-align: left; padding: 10px 2px; font-size: 15px; }
.inbox-open .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-item.done .t { text-decoration: line-through; color: var(--ink-soft); }
.inbox-more { flex: none; }
.inbox-empty { color: var(--ink-soft); padding: 18px 6px; font-size: 14px; }

/* the + button: bottom right on every view; red with a microphone while held long enough to dictate */
.fab {
  position: fixed; z-index: 12; right: max(24px, env(safe-area-inset-right)); bottom: max(24px, calc(env(safe-area-inset-bottom) + 12px));
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18), 0 1px 3px rgba(0, 0, 0, 0.12);
  transition: transform 0.15s, background 0.15s; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.fab svg { width: 26px; height: 26px; grid-area: 1 / 1; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: opacity 0.15s, transform 0.15s; }
.fab-mic { opacity: 0; transform: scale(0.6); }
.fab:active { transform: scale(0.94); }
.fab.rec { background: #ff3b30; color: #fff; transform: scale(1.12); }
.fab.rec .fab-plus { opacity: 0; transform: scale(0.6); }
.fab.rec .fab-mic { opacity: 1; transform: none; }
.fab.rec { animation: listen 1.2s ease-in-out infinite; }
.fab.away { background: var(--ink-soft); animation: none; transform: none; }
/* what you're saying, shown above the + while you hold it */
.ptt {
  position: fixed; z-index: 12; right: max(24px, env(safe-area-inset-right)); bottom: max(92px, calc(env(safe-area-inset-bottom) + 80px));
  max-width: min(420px, calc(100vw - 48px)); padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.35;
  background: var(--panel); color: var(--ink); box-shadow: var(--shadow), 0 0 0 0.5px var(--fill-2); animation: pop 0.14s ease-out;
  -webkit-backdrop-filter: saturate(180%) blur(24px); backdrop-filter: saturate(180%) blur(24px);
}
.ptt[hidden] { display: none; }
.ptt.cancel { color: var(--ink-soft); }
.toast > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50;
  background: color-mix(in srgb, var(--ink) 88%, transparent); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  max-width: calc(100vw - 32px); animation: pop 0.14s ease-out;
  display: flex; align-items: center; gap: 14px;
}
.toast[hidden] { display: none; }
.toast-undo {
  font: inherit; font-weight: 600; color: inherit; background: none; border: 0; padding: 4px 2px; margin: -4px 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .week { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 40px; }
}
@media (max-width: 760px) {
  .app { padding: 16px 16px 64px; }
  .title { font-size: 28px; }
  .top-actions { gap: 4px; }
  .week { grid-template-columns: minmax(0, 1fr); margin-top: 24px; row-gap: 28px; }
  .col { gap: 28px; }
  /* Fewer blank lines per day on phones: at most two. */
  .lines .line.empty ~ .line.empty ~ .line.empty { display: none; }
  .lists { grid-template-columns: minmax(0, 1fr); margin-top: 40px; row-gap: 32px; }
  .panel { top: 64px; right: 16px; }
  .card { padding: 16px 18px; }
}

/* ---------- view switch (Week / Schedule) ---------- */
.view-switch { display: flex; gap: 2px; padding: 3px; border-radius: 999px; background: var(--fill); }
.view-switch button { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-soft); transition: background 0.15s, color 0.15s; }
.view-switch button:hover { color: var(--ink); }
.view-switch button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.view-switch svg { width: 17px; height: 17px; }

/* time label in front of a timed task in the Week view */
.line .time { flex: none; font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.line.done .time { color: var(--muted); }

/* ---------- schedule: the week as a time grid ---------- */
.schedule { margin-top: 36px; }
.sched { --gut: 48px; }
.sched-head, .sched-allday, .sched-grid { display: grid; grid-template-columns: var(--gut) repeat(7, minmax(0, 1fr)); }
.sh-day {
  display: flex; align-items: baseline; justify-content: space-between; gap: 6px; margin: 0 6px;
  border-bottom: 1.5px solid var(--ink); padding-bottom: 8px; font-size: 17px; white-space: nowrap; min-width: 0;
}
.sh-day .num { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sh-day .dow { color: var(--muted); font-size: 14px; }
.sh-day.today { border-color: var(--date); }
.sh-day.today .num, .sh-day.today .dow { color: var(--date); }
.sched-allday { border-bottom: 1px solid var(--line); }
.sched-allday .gutter { font-size: 11px; color: var(--ink-soft); text-align: right; padding: 10px 8px 0 0; }
.notime-col { display: flex; flex-direction: column; gap: 3px; padding: 6px 4px; min-height: 40px; min-width: 0; }
/* At most three tasks per day in view; the rest scroll inside the day. */
.notime-col { max-height: calc(3 * 27px + 2 * 3px + 12px); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.notime-pill { flex: none; }
.notime-pill {
  font-size: 13px; padding: 4px 9px; border-radius: 999px; cursor: pointer; user-select: none; -webkit-user-select: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--ink) 6%, var(--bg));
}
.notime-pill:hover { background: color-mix(in srgb, var(--ink) 10%, var(--bg)); }
.notime-pill[data-color] { background: color-mix(in srgb, var(--c) 18%, var(--bg)); }
.notime-pill.done { text-decoration: line-through; color: var(--muted); }
.notime-pill.ghost { pointer-events: none; outline: 1.5px dashed color-mix(in srgb, var(--accent) 50%, transparent); }
.sched-body { position: relative; height: calc(100vh - 170px); min-height: 520px; overflow: auto; overscroll-behavior: contain; }
/* day headers + "No time" stay at the top while the hours scroll under them */
.sched-top { position: sticky; top: 0; z-index: 2; background: var(--bg); }
.sched-grid { position: relative; z-index: 1; }
/* the hours stay at the left, solid, above the tasks that scroll under them */
.sched-hours { position: sticky; left: 0; z-index: 10; background: var(--bg); }
.sched-head .gutter, .sched-allday .gutter { position: sticky; left: 0; z-index: 3; background: var(--bg); }
.sched-hours span { position: absolute; right: 8px; transform: translateY(-50%); font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.sc-col {
  position: relative; border-left: 1px solid var(--line); cursor: crosshair;
  background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); background-size: 100% 48px;
}
.sc-col.today { background-color: color-mix(in srgb, var(--date) 4%, transparent); }
.midnight-line { position: absolute; left: 0; right: 0; border-top: 1px dashed color-mix(in srgb, var(--ink) 25%, transparent); pointer-events: none; z-index: 1; }
.sched-hours span.midnight { font-weight: 600; color: var(--ink); }
.now-line { position: absolute; left: -1px; right: 0; height: 2px; background: var(--date); z-index: 4; pointer-events: none; }
.now-line::before { content: ''; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--date); }
.ev {
  position: absolute; display: flex; flex-direction: column; gap: 1px; overflow: hidden; padding: 3px 7px 3px 9px;
  border-radius: 8px; font-size: 12.5px; line-height: 1.25; color: var(--ink); cursor: pointer; user-select: none; -webkit-user-select: none;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg)); box-shadow: inset 3px 0 0 var(--accent);
}
.ev[data-color] { background: color-mix(in srgb, var(--c) 20%, var(--bg)); box-shadow: inset 3px 0 0 var(--c); }
.ev:hover { filter: brightness(0.98); }
.ev-title { font-weight: 600; overflow: hidden; }
.ev-time { font-size: 11.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev.short { flex-direction: row; align-items: center; gap: 6px; padding-top: 1px; padding-bottom: 1px; }
.ev.short .ev-title { white-space: nowrap; text-overflow: ellipsis; }
.ev.done { opacity: 0.55; }
.ev.done .ev-title { text-decoration: line-through; }
.ev-resize { position: absolute; left: 0; right: 0; bottom: 0; height: 8px; cursor: ns-resize; }
.ev.sched-source, .notime-pill.sched-source { opacity: 0.35; }
.ev.ghost {
  left: 2px; right: 2px; z-index: 5; pointer-events: none;
  box-shadow: inset 3px 0 0 var(--accent), 0 8px 22px rgba(0, 0, 0, 0.14);
}
.ev.ghost[data-color] { box-shadow: inset 3px 0 0 var(--c), 0 8px 22px rgba(0, 0, 0, 0.14); }
.ev.creating { pointer-events: auto; cursor: text; background: color-mix(in srgb, var(--accent) 16%, var(--bg)); }
.ev .ev-input { flex: none; font-weight: 600; font-size: 13px; color: var(--ink); }
body.is-drawing, body.is-drawing * { cursor: crosshair !important; }

/* ---------- time in the task card ---------- */
.card-time { display: flex; align-items: center; gap: 6px; margin: 0 0 4px -4px; }
.card-time:empty { display: none; }
.time-chip {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; font-size: 14px; font-weight: 500;
  color: var(--ink); background: var(--fill); font-variant-numeric: tabular-nums;
}
.time-chip:hover { background: var(--fill-2); }
.time-chip svg { width: 14px; height: 14px; }
.time-chip.add { color: var(--ink-soft); }
.time-dash { color: var(--ink-soft); }
.time-clear svg { width: 14px; height: 14px; }
.pop.time-menu { max-height: 300px; overflow-y: auto; min-width: 150px; }
.pop.time-menu .pop-item { font-variant-numeric: tabular-nums; white-space: pre; }

/* ---------- task's own time zone (card, second time row) ---------- */
.card-zone { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 8px 0 0 -4px; }
.card-zone:empty { display: none; }
.time-chip.zone { font-size: 13px; color: var(--ink-soft); }
.time-chip.small { font-size: 13px; padding: 4px 9px; }
.pop.zone-menu { width: 290px; padding: 6px; }
.zone-search { width: 100%; padding: 8px 10px; margin-bottom: 4px; border: 0; border-radius: 9px; background: var(--fill); color: var(--ink); font: inherit; outline: none; }
.zone-list { max-height: 260px; overflow-y: auto; }
.zone-list .pop-item small { margin-left: auto; padding-left: 10px; font-size: 12px; color: var(--ink-soft); }
.zone-list .pop-item:hover small { color: inherit; }

/* ---------- Schedule on small screens: comfortable columns you can swipe sideways ---------- */
@media (max-width: 1000px) {
  .sched-inner { min-width: 860px; }
  .sched-body { height: calc(100dvh - 190px); min-height: 360px; }
}
@media (max-width: 760px) {
  .top { flex-wrap: wrap; row-gap: 12px; }
  /* phones: the title, views and arrows stay on top while the days scroll under them */
  .top { position: sticky; top: 0; z-index: 15; margin: -16px -16px 0; padding: 12px 16px 10px; background: var(--bg); }
  .top-actions { margin-left: auto; }
  .title { white-space: nowrap; }
  .view-switch button { width: 32px; height: 32px; }
}

/* ---------- Schedule toolbar: show/hide buckets and tasks ---------- */
.sched-bar { display: flex; align-items: center; gap: 6px; margin: 0 0 12px var(--gut); flex-wrap: wrap; }
.sched-toggle {
  display: flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 500;
  color: var(--ink-soft); background: transparent; box-shadow: inset 0 0 0 1px var(--line);
}
.sched-toggle svg { width: 14px; height: 14px; }
.sched-toggle.on { color: var(--ink); background: var(--fill); box-shadow: none; }
.sched-hint { font-size: 12.5px; color: var(--ink-soft); margin-left: 6px; }

/* "No time" row folds to one line of counts */
.sched-allday .notime-toggle { display: flex; align-items: flex-start; justify-content: flex-end; gap: 2px; color: var(--ink-soft); font-size: 11px; }
.notime-toggle svg { width: 12px; height: 12px; flex: none; margin-top: 1px; transition: transform 0.15s; }
.sched-allday.folded .notime-toggle svg { transform: rotate(-90deg); }
.sched-allday.folded .notime-col { min-height: 0; padding-top: 5px; padding-bottom: 5px; }
.sched-allday.folded .gutter { padding-top: 6px; }
.notime-count { align-self: flex-start; font-size: 12px; color: var(--ink-soft); padding: 2px 8px; border-radius: 999px; background: var(--fill); }
.notime-count:hover { color: var(--ink); }

/* ---------- buckets: regular periods drawn softly behind tasks ---------- */
.bucket:not([data-color]) { --c: var(--ink); }
.bucket {
  position: absolute; left: 0; right: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: color-mix(in srgb, var(--c) 7%, transparent); border-top: 1px solid color-mix(in srgb, var(--c) 18%, transparent);
  display: flex; flex-direction: column; padding: 3px 6px; font-size: 11px; line-height: 1.25; color: color-mix(in srgb, var(--c) 55%, var(--ink-soft));
}
.bucket[data-color] { background: color-mix(in srgb, var(--c) 11%, transparent); }
.bucket-name { display: flex; align-items: center; gap: 3px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bucket-time { font-variant-numeric: tabular-nums; white-space: nowrap; opacity: 0.8; }
.sc-col .ev { z-index: 2; }
/* bucket mode: tasks hidden, buckets can be moved, resized and clicked */
.bucket.editable { pointer-events: auto; cursor: grab; left: 3px; right: 3px; border-radius: 6px; border-top: 0; background: color-mix(in srgb, var(--c) 16%, transparent); }
.bucket.editable:hover { background: color-mix(in srgb, var(--c) 22%, transparent); }
.bucket.editable .ev-resize { cursor: ns-resize; }

.bucket-name svg { width: 11px; height: 11px; flex: none; }
@media (max-width: 1000px) { .sched-bar { position: sticky; left: 0; margin-left: 0; width: max-content; max-width: calc(100vw - 32px); } }

/* bucket dialog */
.bucket-form .swatches { padding: 2px 0; }
.day-chips { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.day-chip { width: 34px; height: 30px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink-soft); background: var(--fill); }
.day-chip.on { background: var(--accent); color: var(--on-accent); }
.day-chips .btn-link { font-size: 13px; }
.bucket-form select, .bucket-form .row select {
  padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); background: var(--fill); color: var(--ink); font: inherit; font-size: 14px;
}
.bucket-form .row { align-items: center; }
.row-btns { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.btn-link.danger { color: var(--danger); margin-left: auto; }

/* ---------- reminders ---------- */
.line.task > .ico { flex: none; width: 13px; height: 13px; color: var(--ink-soft); }
.push-settings .hint { margin-bottom: 8px; }

/* ---------- pinned tasks ---------- */
.line.task > .ico.pin { color: var(--ink); }
.pin-btn:not(.on) { color: var(--muted); }
.pin-btn.on svg { fill: currentColor; }
.card-title-row .pin-btn { margin-right: -8px; }
.card-title-row .pin-btn svg { width: 19px; height: 19px; }
.notime-pill .ico, .ev-title .ico { width: 11px; height: 11px; vertical-align: -1px; margin-right: 3px; }

/* ---------- month view: weeks you scroll through ---------- */
.month, .year { margin-top: 36px; }
.mo-head { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-bottom: 1.5px solid var(--ink); padding-bottom: 8px; }
.mo-head span { font-size: 13px; color: var(--ink-soft); padding-left: 8px; }
.mo-bar { margin-left: 0; margin-bottom: 16px; }
.mo-scroll { position: relative; height: calc(100vh - 275px); min-height: 420px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
/* each month is a block with its own title (kept in view while you scroll through it) */
.mo-month { padding-bottom: 22px; }
.mo-mtitle {
  position: sticky; top: 0; z-index: 3; margin: 0; padding: 16px 8px 10px; background: var(--bg);
  font: 600 19px/1.2 var(--font-display); letter-spacing: -0.01em;
}
.mo-mtitle .year { color: var(--date); }
.mo-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 118px; }
/* each day is a background cell under its number, year-bucket bars and contents; days of other months stay empty */
.mo-day { border-top: 1px solid var(--line); border-left: 1px solid var(--line); cursor: pointer; transition: background 0.12s; }
.mo-day.lead { border-left-color: transparent; }
.mo-body { pointer-events: none; display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 3px 5px 7px; }
.mo-task, .mo-bk { pointer-events: auto; }
.mo-day.wkend { background: color-mix(in srgb, var(--ink) 2.5%, transparent); }
.mo-day.today { background: color-mix(in srgb, var(--date) 5%, transparent); }
.mo-day:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.mo-num { pointer-events: none; display: flex; align-items: baseline; gap: 6px; padding: 7px 8px 3px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mo-num.past { color: var(--ink-soft); font-weight: 500; }
.mo-num.today span { display: inline-block; min-width: 24px; padding: 1px 6px; border-radius: 999px; text-align: center; background: var(--date); color: #fff; }
.mo-task {
  display: flex; align-items: baseline; gap: 4px; min-width: 0; padding: 1px 6px; border-radius: 5px;
  font-size: 12px; line-height: 1.4; text-align: left; color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, var(--bg));
}
.mo-task[data-color] { background: color-mix(in srgb, var(--c) 20%, var(--bg)); }
.mo-task:hover { filter: brightness(0.97); }
.mo-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-time { flex: none; font-size: 11px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.mo-task.done .mo-title { text-decoration: line-through; color: var(--muted); }
.mo-more { font-size: 11px; color: var(--ink-soft); padding-left: 6px; }
/* buckets in the month: faint lines with a colored edge */
.mo-bk:not([data-color]) { --c: var(--ink-soft); }
.mo-bk {
  display: flex; align-items: baseline; gap: 5px; min-width: 0; padding: 0 5px 0 6px; border-radius: 4px;
  font-size: 11px; line-height: 1.45; color: var(--ink-soft); border-radius: 0 4px 4px 0;
  background: color-mix(in srgb, var(--c) 9%, transparent); border-left: 2px solid color-mix(in srgb, var(--c) 65%, transparent);
}
.mo-bk[data-color] { background: color-mix(in srgb, var(--c) 12%, transparent); }
.mo-bk-name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mo-bk-time { flex: none; margin-left: auto; font-variant-numeric: tabular-nums; opacity: 0.85; }
.view-hint { font-size: 12.5px; color: var(--ink-soft); margin: 12px 0 0; }

/* ---------- year buckets (bars in the year view) ---------- */
.pbar {
  position: relative; z-index: 1; display: flex; align-items: center; min-width: 0; margin: 1px 2px; padding: 0 6px; border-radius: 5px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; cursor: pointer; user-select: none; -webkit-user-select: none;
  color: var(--ink); background: color-mix(in srgb, var(--ink) 14%, var(--bg));
}
.pbar[data-color] { background: color-mix(in srgb, var(--c) 34%, var(--bg)); }
.pbar:hover { filter: brightness(0.95); }
.pbar span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* in the year's small months: slimmer bars, still named */
.ym-week .pbar { margin: 1px 0; padding: 0 4px; border-radius: 4px; font-size: 9px; line-height: 1; }
.ym-week .pbar.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.ym-week .pbar.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pbar.quiet span { visibility: hidden; }
/* days inside a year bucket: a light band of its color behind the numbers */
.yr-day.in:not([data-color]) { --c: var(--ink); }
.yr-day.in { border-radius: 0; background-image: linear-gradient(color-mix(in srgb, var(--c) 15%, transparent), color-mix(in srgb, var(--c) 15%, transparent)); background-size: 100% 24px; background-position: 0 3px; background-repeat: no-repeat; }
.pbar.cont-l { margin-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.pbar.cont-r { margin-right: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.pb-h { position: absolute; top: -3px; bottom: -3px; width: 7px; cursor: ew-resize; }
.pb-h.l { left: -2px; } .pb-h.r { right: -2px; }
body.yr-drawing .pbar { pointer-events: none; }
body.is-resizing-x, body.is-resizing-x * { cursor: ew-resize !important; }

/* ---------- year view: twelve small months ---------- */
.yr-bar { margin-left: 0; margin-bottom: 14px; }
.yr-scroll { position: relative; height: calc(100vh - 235px); min-height: 420px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.yr-block { padding-bottom: 40px; }
.yr-title {
  position: sticky; top: 0; z-index: 3; margin: 0 0 6px; padding: 4px 0 12px; background: var(--bg);
  font: 700 26px/1.2 var(--font-display); letter-spacing: -0.02em;
}
.yr-title .year { color: var(--date); }
.yr-months { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 30px 36px; }
.ym-title { display: block; margin-bottom: 8px; font: 600 17px/1.2 var(--font-display); color: var(--ink); text-align: left; }
.ym-title:hover { color: var(--date); }
.ym-dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding-bottom: 5px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.ym-dow span { font-size: 10.5px; font-weight: 600; color: var(--ink-soft); text-align: center; }
.ym-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.yr-day { display: flex; justify-content: center; padding-top: 3px; border-radius: 6px; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.yr-day span { display: grid; place-items: center; width: 24px; height: 22px; border-radius: 999px; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink); }
.yr-day.wkend span { color: var(--ink-soft); }
.yr-day.today span { background: var(--date); color: #fff; font-weight: 700; }
.yr-day:hover { background-color: color-mix(in srgb, var(--ink) 6%, transparent); }
.yr-day.sel, .yr-day.sel:hover { background-color: color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 0; }
/* the list of year buckets under the calendar */
.yr-list { min-width: min(440px, 80vw); }
.yr-list .row-btns { margin-top: 14px; }
.yr-list-head { display: flex; align-items: center; justify-content: space-between; }
.yr-item:not([data-color]) { --c: var(--ink-soft); }
.yr-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; color: var(--ink); }
.yr-item:hover { background: var(--fill); }
.yr-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.yr-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.yr-when { margin-left: auto; flex: none; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* bucket dialogs: dates */
.period-dates { flex-wrap: wrap; }
.period-len { font-size: 13px; color: var(--ink-soft); margin-left: 4px; }

@media (max-width: 1100px) { .yr-months { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .yr-months { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 18px; }
  .yr-day span { width: 21px; height: 20px; font-size: 11.5px; }
  .ym-week .pbar { font-size: 8.5px; padding: 0 2px; }
  .mo-week .pbar { font-size: 10px; padding: 0 4px; }
  .mo-scroll { height: calc(100vh - 250px); }
  .yr-scroll { height: calc(100vh - 250px); }
  .yr-bar .sched-hint { display: none; }
  .mo-head span { padding-left: 3px; font-size: 11px; }
  .mo-week { min-height: 84px; }
  .mo-body { padding: 2px 2px 5px; }
  .mo-num { padding: 5px 3px 2px; font-size: 12px; flex-wrap: wrap; gap: 0 4px; }
  .mo-mtitle { font-size: 16px; padding: 12px 4px 8px; }
  .mo-task { font-size: 10.5px; padding: 0 3px; }
  .mo-time, .mo-bk-time { display: none; }
  .mo-bk { font-size: 9.5px; padding: 0 3px 0 4px; }
}

/* year bucket dialog: its days, tap to take one out */
.pd-hint { margin: 0 0 6px; font-size: 12px; }
.pd-months { --c: var(--ink); display: flex; flex-wrap: wrap; gap: 14px; max-height: 260px; overflow-y: auto; }
.pd-month { width: 196px; }
.pd-title { font-size: 12px; font-weight: 600; color: var(--ink-soft); margin: 0 0 4px 2px; }
.pd-grid { display: grid; grid-template-columns: repeat(7, 28px); gap: 0; }
.pd-dow { font-size: 10px; color: var(--ink-soft); text-align: center; line-height: 18px; }
.pd-day { height: 26px; font-size: 12px; text-align: center; line-height: 26px; color: var(--ink-soft); opacity: .45; }
button.pd-day { opacity: 1; color: var(--ink); background: color-mix(in srgb, var(--c) 22%, transparent); border-radius: 0; }
button.pd-day:hover { background: color-mix(in srgb, var(--c) 35%, transparent); }
button.pd-day.removed { background: none; color: var(--ink-soft); text-decoration: line-through; }
button.pd-day.removed:hover { background: var(--fill); }

/* on a phone the toast sits above the + button (kept last so it wins over .toast) */
@media (max-width: 760px) { .toast { bottom: calc(96px + env(safe-area-inset-bottom)); } }

/* ---------- reminders: a moment, not a period ---------- */
/* Schedule: a thin line at the time with a small bell tag; above the blocks, taking no room from them */
.rem { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--c, var(--accent)); z-index: 3; pointer-events: none; }
.rem::before { content: ''; position: absolute; left: -1px; top: -4.5px; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--accent)); }
.rem-tag {
  position: absolute; left: 8px; top: -9px; max-width: calc(100% - 12px); display: flex; align-items: center; gap: 4px;
  padding: 1px 7px 1px 5px; border-radius: 999px; font-size: 11.5px; line-height: 16px; white-space: nowrap; overflow: hidden;
  background: color-mix(in srgb, var(--c, var(--accent)) 16%, var(--bg)); color: var(--ink); cursor: pointer; pointer-events: auto;
  user-select: none; -webkit-user-select: none; box-shadow: 0 0 0 1.5px var(--bg);
}
.rem-tag .ico { width: 11px; height: 11px; flex: none; }
.rem-time { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.rem-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.rem.done .rem-title { text-decoration: line-through; color: var(--muted); }
.rem.done { opacity: .6; }
.rem.sched-source { opacity: .35; }
.ev.ghost.rem-ghost { min-height: 18px; }
/* Week view: a bell in front of the time */
.line .time .rem-bell { width: 11px; height: 11px; margin-right: 3px; vertical-align: -1px; }
.time-chip.rem-chip { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
