/* Soft and cute: blush ground, rosy accent, pastel day colours (Tue coral, Wed butter, Thu mint, Fri lilac). */
:root {
  --bg: #fff5f2;
  --surface: #ffffff;
  --surface-2: #fdebea;
  --text: #43303a;
  --muted: #9b8590;
  --line: rgba(160, 80, 110, 0.12);
  --accent: #ec6f93;
  --accent-soft: #fde1ea;
  --on-accent: #ffffff;
  --ok: #3f9c78;
  --ok-soft: #dcf3e8;
  --warn: #b7841c;
  --warn-soft: #fdf0cd;
  --danger: #d9534f;
  --denis: #4b86c2;
  --denis-soft: #dcebfa;
  --jele: #d9558f;
  --jele-soft: #fde0ee;
  --d0: #f0806e;
  --d1: #e2a92a;
  --d2: #43b088;
  --d3: #9a76d6;
  --shadow: 0 1px 2px rgba(160, 80, 110, 0.06), 0 6px 18px -10px rgba(160, 80, 110, 0.25);
  --radius: 22px;
  --font: "Nunito", ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Fredoka", ui-rounded, "Nunito", sans-serif;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  --tabbar: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1820; --surface: #2a2129; --surface-2: #362b34; --text: #fbeef3; --muted: #bba4b0;
    --line: rgba(255, 200, 225, 0.1); --accent: #ff8fab; --accent-soft: #4a2a37; --on-accent: #2a1520;
    --ok: #8fd6b4; --ok-soft: #233a31; --warn: #f5c76a; --warn-soft: #3e3222; --danger: #ff8a8a;
    --denis: #9cc6f2; --denis-soft: #283647; --jele: #ff9cc7; --jele-soft: #48283a;
    --d0: #ff9f8f; --d1: #f5cd62; --d2: #7fd7b2; --d3: #c3a6f2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1f1820; --surface: #2a2129; --surface-2: #362b34; --text: #fbeef3; --muted: #bba4b0;
  --line: rgba(255, 200, 225, 0.1); --accent: #ff8fab; --accent-soft: #4a2a37; --on-accent: #2a1520;
  --ok: #8fd6b4; --ok-soft: #233a31; --warn: #f5c76a; --warn-soft: #3e3222; --danger: #ff8a8a;
  --denis: #9cc6f2; --denis-soft: #283647; --jele: #ff9cc7; --jele-soft: #48283a;
  --d0: #ff9f8f; --d1: #f5cd62; --d2: #7fd7b2; --d3: #c3a6f2;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 22px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
  min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.ic { width: 20px; height: 20px; flex: none; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: var(--top);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-left)) 10px max(16px, env(safe-area-inset-right));
  min-height: 56px;
}
/* Title on top (wraps as needed, smaller when long), dates underneath, so nothing gets cut off. */
.brand {
  display: grid; grid-template-columns: minmax(0, auto) auto; column-gap: 6px; align-items: center; justify-content: start;
  flex: 1 1 auto; min-width: 0; text-align: left; padding: 4px 10px; margin-left: -10px; border-radius: 16px;
  transition: background .15s;
}
.brand:hover, .brand:active { background: var(--surface-2); }
.brand h1 {
  grid-column: 1; grid-row: 1; margin: 0; min-width: 0; font: 600 22px/1.15 var(--serif);
  overflow-wrap: anywhere;
}
.brand h1.long { font-size: 18px; }
.top-actions { flex: none; }
.brand .chev { grid-column: 2; grid-row: 1; width: 16px; height: 16px; color: var(--muted); }
.brand .dates { grid-column: 1 / -1; grid-row: 2; font-size: 12.5px; line-height: 1.25; }
.heart { color: var(--accent); font-size: .8em; display: inline-block; animation: beat 2.8s ease-in-out infinite; }
@keyframes beat { 0%, 70%, 100% { transform: scale(1); } 78% { transform: scale(1.25); } 86% { transform: scale(.95); } }
.dates { color: var(--muted); font-size: 14px; white-space: nowrap; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--muted);
  transition: background .15s, color .15s, transform .1s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.on { color: var(--accent); }
button:focus:not(:focus-visible) { outline: none; }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.sm .ic { width: 18px; height: 18px; }
.sync {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px; border-radius: 99px;
  font-size: 13px; color: var(--muted);
}
.sync:hover { background: var(--surface-2); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); transition: background .2s; }
.sync.pending .sync-dot { background: var(--warn); animation: pulse 1.4s ease-in-out infinite; }
.sync.offline .sync-dot { background: var(--muted); }
@keyframes pulse { 50% { opacity: .35; } }
.stale {
  display: flex; flex-wrap: wrap; gap: 2px 8px; justify-content: center;
  padding: 7px 16px; font-size: 13.5px; text-align: center;
  background: var(--warn-soft); color: var(--text); border-top: 1px solid var(--line);
}

/* ---------- Tabs ---------- */
.tabs { display: flex; }
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 52px; font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .01em;
  transition: color .15s;
}
.tab .ic { width: 23px; height: 23px; transition: transform .2s; }
.tab.on { color: var(--accent); }
.tab.on .ic { transform: translateY(-1px); }
.tab:active .ic { transform: scale(.9); }
.tabs-bottom {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  padding: 4px max(8px, env(safe-area-inset-left)) calc(var(--bottom) + 4px) max(8px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
}
.tabs-top { display: none; }

/* ---------- Layout ---------- */
main {
  max-width: 760px; margin: 0 auto;
  padding: 16px max(16px, env(safe-area-inset-left)) calc(var(--tabbar) + var(--bottom) + 32px) max(16px, env(safe-area-inset-right));
}
.view { animation: fade .2s ease backwards; }
@keyframes fade { from { opacity: 0; } }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 2px 0 12px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 20px 2px 8px; }
.section-head h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; margin-left: 6px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 12px; letter-spacing: 0; }
.hero { margin: 2px 2px 10px; }
.kicker::after { content: " ✦"; }
.kicker { margin: 0 0 2px; color: var(--accent); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; }
.display { margin: 0; font: 600 27px/1.12 var(--serif); }
.display.sm { font-size: 21px; }
.card {
  display: block; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card.quiet { box-shadow: none; background: transparent; border-style: dashed; color: var(--muted); }
.center { text-align: center; }
.link {
  display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 4px;
  color: var(--accent); font-weight: 600; font-size: 14.5px;
}
.link .ic { width: 17px; height: 17px; }
.empty { list-style: none; color: var(--muted); padding: 14px 4px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: 15px;
  text-decoration: none; white-space: nowrap;
  transition: transform .1s, background .15s, filter .15s;
}
.btn .ic { width: 18px; height: 18px; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { background: transparent; color: var(--danger); padding: 0 10px; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; border-radius: 999px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.grow { flex: 1; }
.edit-only { display: none !important; }
body.can-edit .edit-only { display: inline-flex !important; }
body.can-edit form.edit-only { display: flex !important; }

/* ---------- Segmented controls ---------- */
.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg > button, .seg > label {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 0 14px; border-radius: 999px; font-size: 14.5px; font-weight: 700; color: var(--muted);
  white-space: nowrap; cursor: pointer; flex: 1 0 auto; transition: background .15s, color .15s;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg .on { background: var(--surface); color: var(--accent); box-shadow: 0 1px 4px rgba(160, 80, 110, .15); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }
.seg-sm > button { min-height: 32px; padding: 0 11px; font-size: 13.5px; }

/* ---------- Now / Next ---------- */
.big {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px;
  padding: 13px 16px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.big::before { content: ""; position: absolute; top: -26px; right: -26px; width: 84px; height: 84px; border-radius: 50%; background: color-mix(in srgb, var(--dc) 16%, transparent); }
.big.next { background: color-mix(in srgb, var(--dc) 10%, var(--surface)); border-color: color-mix(in srgb, var(--dc) 25%, transparent); }
.big-kicker { position: relative; display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.big-kicker span:first-child { color: var(--dc); }
.bk-label { display: inline-flex; align-items: center; gap: 6px; }
.bk-label .badge, .bk-label .booked-ic { letter-spacing: 0; }
.big-kicker span:last-child { text-transform: none; letter-spacing: 0; font-weight: 600; }
.big-title { position: relative; display: block; margin: 3px 0 1px; font: 600 21px/1.2 var(--serif); }
.big-meta { color: var(--muted); font-size: 14px; }
.big-notes { margin-top: 4px; font-size: 14px; }
.big-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.big-actions .btn { min-height: 40px; }
.todo-nudge { margin-top: 18px; display: flex; flex-direction: column; gap: 2px; text-align: left; }
.todo-nudge span:first-child { font-weight: 700; color: var(--accent); }
.todo-nudge .muted { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Day picker ---------- */
.day-picker { display: flex; gap: 8px; margin: 0 -16px 12px; padding: 2px 16px 6px; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.day-picker::-webkit-scrollbar { display: none; }
.day-picker .day-chip { flex: 1 0 64px; scroll-snap-align: start; }
.day-chip {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 6px 4px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line);
  transition: background .18s, border-color .18s, transform .1s;
}
.day-chip:active { transform: scale(.96); }
.dc-w { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.dc-d { font: 600 19px/1.15 var(--serif); }
.dc-n { width: 6px; height: 6px; border-radius: 50%; background: var(--dc); font-size: 0; margin-top: 3px; }
.day-chip.on { background: var(--dc); border-color: var(--dc); color: #fff; box-shadow: 0 6px 14px -8px var(--dc); }
.day-chip.on .dc-w { color: inherit; opacity: .85; }
.day-chip.on .dc-n { background: currentColor; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.stop {
  position: relative; display: grid; grid-template-columns: 46px 24px 1fr auto; align-items: start;
  margin-bottom: 6px; transition: transform .18s ease, opacity .2s;
}
.stop-time { padding-top: 9px; font-weight: 800; font-size: 13.5px; font-variant-numeric: tabular-nums; text-align: right; padding-right: 6px; line-height: 1.2; }
.stop-time .tl { font-size: 11.5px; font-weight: 800; color: var(--text); display: block; }
.stop-time small { display: block; color: var(--muted); font-weight: 600; font-size: 11px; }
.stop-rail { position: relative; display: flex; justify-content: center; align-self: stretch; padding-top: 9px; }
.stop-rail::before { content: ""; position: absolute; top: 0; bottom: -6px; left: 50%; transform: translateX(-1px); border-left: 2px dotted color-mix(in srgb, var(--dc) 55%, transparent); }
.stop:first-child .stop-rail::before { top: 14px; }
.stop:last-child .stop-rail::before { bottom: calc(100% - 22px); }
.dot {
  position: relative; z-index: 1; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 2px solid var(--dc); color: transparent;
  transition: background .18s, color .18s, transform .2s cubic-bezier(.3, 1.6, .5, 1);
}
button.dot::after { content: ""; position: absolute; inset: -12px; }
button.dot:active { transform: scale(.8); }
.dot .ic { width: 12px; height: 12px; stroke-width: 3; }
.st-done .dot { background: var(--dc); color: #fff; transform: scale(1.08); }
.st-booked .dot { background: color-mix(in srgb, var(--dc) 30%, var(--surface)); }
.st-skipped .dot { border-style: dashed; opacity: .6; }
.stop-body {
  display: flex; flex-direction: column; gap: 0; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 7px 11px 8px;
  box-shadow: var(--shadow); transition: background .15s, transform .1s;
}
.stop-body:active { transform: scale(.985); }
.stop-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.stop-title { flex: 1; min-width: 0; font-weight: 800; font-size: 15px; line-height: 1.3; }
.stop-meta, .stop-notes { font-size: 13px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-meta { color: var(--muted); }
.stop-notes { color: color-mix(in srgb, var(--text) 80%, var(--muted)); }
.badge {
  flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 800; line-height: 1;
}
.mini { flex: none; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 7px; border-radius: 99px; }
.booked-ic { flex: none; width: 22px; height: 20px; border-radius: 99px; display: inline-grid; place-items: center; background: var(--ok-soft); color: var(--ok); }
.booked-ic .ic { width: 14px; height: 14px; stroke-width: 2.2; }
.mini.st-skipped { background: var(--surface-2); color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 99px;
  font-size: 12.5px; font-weight: 800; background: var(--surface-2); color: var(--muted);
}
.tag .ic { width: 14px; height: 14px; stroke-width: 2.4; }
.who-c0 { background: var(--denis-soft); color: var(--denis); }
.who-c1 { background: var(--jele-soft); color: var(--jele); }
.who-c2 { background: color-mix(in srgb, var(--d2) 18%, var(--surface)); color: var(--d2); }
.who-c3 { background: color-mix(in srgb, var(--d3) 18%, var(--surface)); color: var(--d3); }
.tag.st-booked, .tag.bs-booked { background: var(--ok-soft); color: var(--ok); }
.tag.st-done { background: var(--ok-soft); color: var(--ok); }
.tag.st-skipped { background: var(--surface-2); color: var(--muted); }
.tag.bs-to_book, .tag.bs-to_confirm { background: var(--warn-soft); color: var(--warn); }
.st-done .stop-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text) 35%, transparent); }
.st-done .stop-body, .st-skipped .stop-body { opacity: .6; box-shadow: none; }
.st-skipped .stop-title { text-decoration: line-through; }
.stop.past:not(.st-done) .stop-time { color: var(--muted); }
.handle {
  width: 34px; align-self: stretch; display: grid; place-items: center; color: color-mix(in srgb, var(--muted) 70%, transparent);
  touch-action: none; cursor: grab; margin-left: 2px;
}
.sorting .stop:not(.dragging) { transition: transform .18s ease; }
.stop.dragging { z-index: 5; transition: none; }
.stop.dragging .stop-body { box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .35); transform: scale(1.02); }
.stop.dragging .handle { cursor: grabbing; }
.day-foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-left: 70px; }

.fab {
  position: fixed; z-index: 15; right: max(18px, env(safe-area-inset-right));
  bottom: calc(var(--tabbar) + var(--bottom) + 18px);
  width: 58px; height: 58px; border-radius: 50%; align-items: center; justify-content: center;
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 12px 28px -10px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: transform .12s;
}
.fab .ic { width: 26px; height: 26px; stroke-width: 2.2; }
.fab:active { transform: scale(.93); }

/* ---------- Ideas ---------- */
.group:first-child .section-head { margin-top: 8px; }
.ideas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.idea-body { display: flex; flex-direction: column; gap: 0; width: 100%; padding: 9px 12px 2px; }
.idea-title { font-weight: 800; font-size: 15px; }
.idea-meta { color: var(--muted); font-size: 13px; }
.idea-notes { font-size: 13px; }
.idea-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 4px 8px 8px 12px; min-height: 40px; }
.idea-actions .icon-btn { margin-left: auto; }
.add-to { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-right: 2px; }
.day-mini {
  min-width: 46px; height: 34px; padding: 0 10px; border-radius: 99px; font-size: 13.5px; font-weight: 800;
  color: var(--dc); background: color-mix(in srgb, var(--dc) 12%, transparent);
  transition: background .15s, transform .1s;
}
.day-mini:hover { background: color-mix(in srgb, var(--dc) 20%, transparent); }
.day-mini:active { transform: scale(.94); }
.added-tag { height: 32px; color: var(--dc); background: color-mix(in srgb, var(--dc) 13%, transparent); }
.idea.added .idea-title { color: var(--muted); }

/* ---------- Bookings ---------- */
.bookings { display: grid; gap: 10px; }
.booking {
  display: flex; gap: 14px; align-items: flex-start; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 11px 14px; box-shadow: var(--shadow);
  position: relative;
}
.booking.kind-flight { background-image: radial-gradient(circle at 0 50%, var(--bg) 9px, transparent 10px), radial-gradient(circle at 100% 50%, var(--bg) 9px, transparent 10px); }
.b-icon { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kind-stay .b-icon { background: var(--ok-soft); color: var(--ok); }
.kind-event .b-icon, .kind-other .b-icon { background: var(--warn-soft); color: var(--warn); }
.b-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.b-title { font: 600 17px/1.25 var(--serif); }
.b-when { font-weight: 600; font-size: 14.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.b-details { font-size: 14.5px; margin-top: 3px; }

.todos { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.todos:empty { display: none; }
.todo { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 4px 6px 4px 12px; border-bottom: 1px solid var(--line); }
.todo:last-child { border-bottom: 0; }
.todos .empty { padding: 14px; }
.check {
  position: relative; width: 24px; height: 24px; flex: none; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--muted) 60%, transparent);
  display: grid; place-items: center; color: transparent; transition: background .15s, border-color .15s, transform .1s;
}
button.check::after { content: ""; position: absolute; inset: -10px; }
button.check:active { transform: scale(.88); }
.check .ic { width: 16px; height: 16px; stroke-width: 2.8; }
.todo.done .check { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.todo-title { flex: 1; min-width: 0; }
.todo.done .todo-title { color: var(--muted); text-decoration: line-through; }
.ghosty { color: var(--muted); font-size: 20px; letter-spacing: 1px; }
.todo-add {
  margin-top: 10px; align-items: center; gap: 6px;
  background: var(--surface); border: 1.5px dashed color-mix(in srgb, var(--accent) 35%, transparent); border-radius: 999px; padding: 2px 4px 2px 16px;
}
.todo-add input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; min-height: 44px; font-size: 16px; }
.done-list { margin-top: 14px; }
.done-list summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: 14.5px; padding: 8px 4px; list-style-position: inside; }
.done-list .todos { box-shadow: none; }

/* ---------- Map ---------- */
body[data-tab="map"] main { max-width: none; padding: 0; }
.view-map { position: relative; height: calc(100dvh - var(--head, 64px) - var(--tabbar) - var(--bottom)); min-height: 320px; }
#map-canvas { position: absolute; inset: 0; background: var(--surface-2); }
.map-chips { position: absolute; z-index: 500; top: 12px; left: 12px; right: 12px; display: flex; justify-content: center; pointer-events: none; }
.seg-map { pointer-events: auto; box-shadow: var(--shadow); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); }
.seg-map > button { min-height: 38px; padding: 0 12px; }
.seg-map > button.on[style] { background: var(--dc); color: var(--on-accent); }
.map-foot { position: absolute; z-index: 500; left: 12px; right: 70px; bottom: 16px; display: flex; }
.map-foot .btn { box-shadow: var(--shadow); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pin {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; background: var(--dc); color: #fff; font-weight: 800; font-size: 13px;
  border: 2px solid #fff; box-shadow: 0 4px 10px rgba(0, 0, 0, .3);
}
.pin.st-done, .pin.st-skipped { opacity: .55; }
.idea-pin { width: 16px; height: 16px; background: var(--muted); border-width: 2px; }
.leaflet-container { font: inherit; background: var(--surface-2); }
.leaflet-popup-content-wrapper { border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 14px 16px; }
.popup-sub { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.popup-title { font: 600 17px/1.25 var(--serif); margin: 2px 0; }
.popup-meta { color: var(--muted); font-size: 13.5px; margin-bottom: 10px; }
.popup .btn { color: var(--on-accent); margin-top: 6px; }
.leaflet-bar a { background: var(--surface); color: var(--text); border-color: var(--line); width: 36px; height: 36px; line-height: 36px; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }
:root[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.78) contrast(1.1) saturate(.7); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .leaflet-tile-pane { filter: brightness(.78) contrast(1.1) saturate(.7); } }

/* ---------- Sheet ---------- */
.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 560px; max-height: 92dvh;
  background: var(--surface); color: var(--text); border-radius: 28px 28px 0 0;
  box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .4);
  animation: sheet-in .28s cubic-bezier(.2, .9, .3, 1) both;
}
.sheet::backdrop { background: rgba(25, 15, 8, .38); animation: fade-in .2s ease both; }
.sheet.closing { animation: sheet-out .18s ease-in both; }
.sheet.closing::backdrop { animation: fade-out .18s ease-in both; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.sheet-body { padding: 8px 20px calc(20px + var(--bottom)); overflow-y: auto; max-height: 92dvh; overscroll-behavior: contain; }
.sheet-grab { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sheet-head h2 { margin: 6px 0 2px; font: 600 23px/1.2 var(--serif); }
.sheet-head p { margin: 0; font-size: 14.5px; }
.sheet-head .icon-btn { margin: -4px -10px 0 0; }
.sheet-actions { display: flex; gap: 8px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.detail-meta { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); margin: 4px 0 10px; }
.detail-meta .ic { margin-top: 1px; }
.detail-notes { margin: 0 0 12px; white-space: pre-wrap; }
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--muted); }
.field small { font-weight: 500; opacity: .8; }
.field input, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--bg); font-size: 16px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.field .seg { width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-error { margin: 0; color: var(--danger); font-weight: 600; font-size: 14.5px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; z-index: 100; left: 50%; bottom: calc(var(--tabbar) + var(--bottom) + 16px);
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 18px; min-height: 46px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-size: 14.5px; font-weight: 600;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .4);
  transition: transform .22s cubic-bezier(.2, .9, .3, 1), opacity .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast .link { color: var(--accent-soft); min-height: 32px; }


/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  :root { --tabbar: 0px; }
  .topbar-inner { max-width: 1040px; }
  .tabs-bottom { display: none; }
  .tabs-top { display: flex; gap: 2px; margin: 0 auto; }
  .tabs-top .tab { flex-direction: row; gap: 7px; min-height: 40px; padding: 0 14px; border-radius: 12px; font-size: 14.5px; }
  .tabs-top .tab .ic { width: 19px; height: 19px; }
  .tabs-top .tab.on { background: var(--accent-soft); }
  .top-actions { margin-left: 0; }
  main { padding-top: 28px; padding-bottom: 60px; }
  .view-map { height: calc(100dvh - var(--head, 64px)); }
  .fab { bottom: 28px; right: max(28px, calc(50vw - 380px - 80px)); }
  .toast { bottom: 28px; }
  .sheet { margin: auto; border-radius: 24px; animation-name: pop-in; }
  .sheet.closing { animation-name: pop-out; }
  .sheet-grab { display: none; }
  .sheet-body { padding-top: 18px; }
  .display { font-size: 36px; }
}
@keyframes pop-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(8px) scale(.98); } }

@media (max-width: 600px) {
  .sync-text { display: none; }
  .sync { padding: 0 8px; }
}
@media (max-width: 380px) {
  .stop { grid-template-columns: 44px 22px 1fr auto; }
  .day-foot { padding-left: 66px; }
  .brand h1 { font-size: 20px; }
}

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

/* ---------- Trips sheet ---------- */
.trip-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.trip-row {
  position: relative; display: flex; flex-direction: column; width: 100%; padding: 11px 44px 11px 14px;
  border-radius: 18px; background: var(--bg); border: 1px solid var(--line); transition: background .15s;
}
.trip-row.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.trip-row-name { font: 600 17px/1.25 var(--serif); }
.trip-row-meta { font-size: 13.5px; color: var(--muted); }
.trip-row-check { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--accent); }
.sheet-actions .muted { margin: 0; font-size: 14px; }
