/* ==========================================================================
   Trip Companion — design system
   Direction: airport departure board meets paper ticket stub.
   Times and money are always set in mono, like a board. Everything else
   stays quiet so the stubs carry the personality.
   ========================================================================== */

:root {
  --ink:        #0E1116;
  --board:      #161C24;
  --board-2:    #1E2632;
  --line:       #2A3441;
  --text:       #E8EDF3;
  --text-dim:   #93A1B2;
  --amber:      #FFB627;
  --jade:       #2FBF9C;
  --rose:       #FF6B6B;
  --violet:     #A78BFA;
  --bg:         var(--ink);
  --surface:    var(--board);
  --surface-2:  var(--board-2);
  --radius:     14px;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang HK", "PingFang TC",
          "Noto Sans HK", "Noto Sans TC", "Microsoft JhengHei", "Hiragino Sans CNS",
          Roboto, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  /* Single source of truth for the tab bar's content height (excluding the
     safe-area inset). Previously .nav's height was implicit (whatever its
     button padding/font happened to add up to — measured 53px) while body's
     bottom padding hardcoded 72px as an independent guess at the same
     number. Nothing kept them in sync; anything that changed the nav's
     content silently drifted the two further apart. Every place that needs
     "how tall is the bar" now reads this one variable instead of guessing. */
  --nav-h: 56px;
}

[data-theme="light"] {
  --ink:        #F7F5F0;
  --board:      #FFFFFF;
  --board-2:    #F0EEE8;
  --line:       #DDD8CE;
  --text:       #16202B;
  --text-dim:   #6B7787;
  --amber:      #B87A00;
  --jade:       #0E8F72;
  --rose:       #C64545;
  --violet:     #6D4FD0;
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  overscroll-behavior-y: none;
}

body { padding-bottom: calc(var(--nav-h) + var(--safe-b)); }

button, input, select, textarea { font-family: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--jade); }

/* ---------- App bar ------------------------------------------------------ */

.appbar {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: calc(18px + var(--safe-t)) max(16px, var(--safe-r)) 14px max(16px, var(--safe-l));
}
.appbar-row { display: flex; align-items: center; gap: 10px; }
.appbar h1 {
  margin: 0; font-size: 17px; font-weight: 700;
  letter-spacing: -0.01em; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eyebrow {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-dim);
}
.appbar .eyebrow { display: block; margin-bottom: 2px; }

.iconbtn {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-size: 18px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
}
.iconbtn:active { transform: scale(0.94); }

/* ---------- Layout ------------------------------------------------------- */

main { padding: 20px max(16px, var(--safe-r)) 24px max(16px, var(--safe-l)); max-width: 720px; margin: 0 auto; }
@media (min-width: 900px) { main { max-width: 860px; } }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 22px 0 10px;
}
.section-head:first-child { margin-top: 4px; }
.section-head h2 { margin: 0; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase;
  font-family: var(--mono); color: var(--text-dim); font-weight: 500; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.muted { color: var(--text-dim); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.row { display: flex; gap: 10px; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stack { display: grid; gap: 10px; }
.grow { flex: 1; min-width: 0; }

/* ---------- Departure board (home hero) ---------------------------------- */

.board {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.board-top {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.board-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.board-dot.live { animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }
.board-rows { padding: 4px 0; }
.board-row {
  display: grid; grid-template-columns: 62px 1fr auto;
  gap: 12px; align-items: center;
  padding: 11px 14px; border-bottom: 1px dashed var(--line);
}
.board-row:last-child { border-bottom: none; }
.board-row .t { font-family: var(--mono); font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.board-row .n { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row.now { background: color-mix(in srgb, var(--amber) 12%, transparent); }
.board-row.now .t { color: var(--amber); }

.countdown {
  padding: 16px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.countdown .big {
  font-family: var(--mono); font-size: 34px; font-weight: 700;
  letter-spacing: -0.03em; line-height: 1;
}

/* ---------- Ticket stub (the signature) ---------------------------------- */

.stub {
  position: relative; display: grid; grid-template-columns: 68px 1fr;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 10px;
}
.stub::before, .stub::after {
  content: ""; position: absolute; left: 68px; width: 12px; height: 12px;
  background: var(--bg); border-radius: 50%; transform: translateX(-50%);
}
.stub::before { top: -6px; }
.stub::after  { bottom: -6px; }

.stub-rail {
  background: var(--surface-2);
  border-right: 1px dashed var(--line);
  padding: 12px 8px; text-align: center;
  display: flex; flex-direction: column; gap: 4px; justify-content: center;
}
.stub-rail .time {
  font-family: var(--mono); font-size: 16px; font-weight: 700; letter-spacing: -0.03em;
}
.stub-rail .end { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }

.stub-body { padding: 12px 14px; min-width: 0; }
.stub-title { font-weight: 600; font-size: 15px; margin: 0 0 4px; }
.stub-meta { font-size: 13px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 8px; }
.stub-note { font-size: 13px; color: var(--text-dim); margin-top: 6px; }

.chip {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 999px;
  border: 1px solid currentColor; opacity: 0.9;
}
.c-flight { color: var(--amber); }
.c-hotel { color: var(--violet); }
.c-food, .c-cafe { color: var(--rose); }
.c-transport { color: var(--text-dim); }
.c-spa, .c-massage { color: var(--jade); }
.c-attraction, .c-hiking { color: var(--jade); }
.c-shopping { color: var(--violet); }
.c-free, .c-other { color: var(--text-dim); }

.daybar {
  display: flex; align-items: baseline; gap: 10px;
  margin: 22px 0 10px; padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
.daybar .d { font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--amber); }
.daybar .w { font-size: 13px; color: var(--text-dim); }
.daybar .sum { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

/* ---------- Day chips scroller ------------------------------------------ */

.dayscroll { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px;
  scrollbar-width: none; }
.dayscroll::-webkit-scrollbar { display: none; }
.daychip {
  flex: 0 0 auto; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
}
.daychip.on { background: var(--amber); color: #0E1116; border-color: var(--amber); font-weight: 700; }

/* ---------- Buttons ------------------------------------------------------ */

.btn {
  padding: 11px 14px; border-radius: 11px; font-size: 14px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--amber); color: #0E1116; border-color: var(--amber); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 45%, var(--line)); }
.btn.full { width: 100%; }
.btn.sm { padding: 7px 10px; font-size: 13px; }

.fab {
  position: fixed; right: max(16px, var(--safe-r));
  bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 45;
  width: 54px; height: 54px; border-radius: 18px;
  background: var(--amber); color: #0E1116; font-size: 26px; font-weight: 500;
  display: grid; place-items: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

/* ---------- Bottom nav --------------------------------------------------- */

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: grid; grid-template-columns: repeat(6, 1fr);
  height: calc(var(--nav-h) + var(--safe-b));
  box-sizing: border-box;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  padding-left: var(--safe-l); padding-right: var(--safe-r);
}
.nav button {
  padding: 9px 0 10px; display: grid; gap: 3px; justify-items: center;
  color: var(--text-dim); font-size: 10px; letter-spacing: 0.06em;
  font-family: var(--mono); text-transform: uppercase;
}
.nav button .ic { font-size: 19px; line-height: 1; }
.nav button.on { color: var(--amber); }

/* ---------- Forms / sheet ------------------------------------------------ */

.sheet-wrap {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.55); display: flex; align-items: flex-end;
}
.sheet {
  width: 100%; max-height: 92vh; overflow-y: auto;
  background: var(--surface); border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--line);
  padding: 0 max(16px, var(--safe-r)) calc(24px + var(--safe-b)) max(16px, var(--safe-l));
  animation: rise .24s cubic-bezier(.2,.8,.2,1);
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.sheet.dragging { animation: none; transition: none !important; }
.sheet.snapback { transition: transform .28s cubic-bezier(.2,.8,.2,1); }
.sheet.dismissing { transition: transform .22s ease-in; }
@media (min-width: 720px) {
  .sheet-wrap { align-items: center; justify-content: center; }
  .sheet { max-width: 560px; max-height: 85vh; border-radius: 18px; }
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .sheet { animation: none; }
  .sheet.snapback, .sheet.dismissing { transition: none; }
}

/* Sticky header carries the drag handle and the one universal way to close
   a sheet — Close is always here, always separate from any type-specific
   Delete button further down in the form itself. */
.sheet-drag-zone {
  position: sticky; top: 0; z-index: 2; margin: 0 -16px;
  padding: 6px 16px 4px; background: var(--surface);
  cursor: grab;
}
.sheet-drag-zone:active { cursor: grabbing; }
.grabber { width: 38px; height: 4px; border-radius: 2px; background: var(--line);
  margin: 0 auto 10px; }
.sheet-topbar { display: flex; align-items: center; justify-content: flex-end; }
.sheet-close {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-dim);
  font-size: 15px; flex: 0 0 auto;
}
.sheet-close:active { transform: scale(0.92); }

label.f { display: block; margin-bottom: 12px; }
label.f > span {
  display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--text-dim); margin-bottom: 5px;
}
.f input, .f select, .f textarea, .inp {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
}
.f textarea { min-height: 74px; resize: vertical; }
.f input:focus, .f select:focus, .f textarea:focus, .inp:focus {
  outline: 2px solid var(--amber); outline-offset: 1px;
}
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  padding: 7px 11px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text-dim);
}
.pill.on { background: var(--jade); border-color: var(--jade); color: #06110D; font-weight: 600; }

/* ---------- Money / expenses -------------------------------------------- */

.amt { font-family: var(--mono); font-weight: 700; letter-spacing: -0.02em; }
.amt.pos { color: var(--jade); }
.amt.neg { color: var(--rose); }

.avatar {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #0E1116; flex: 0 0 auto;
}

.bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; }

.settle {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 12px 0; border-bottom: 1px dashed var(--line);
}
.settle:last-child { border-bottom: none; }
.settle .arrow { font-family: var(--mono); font-size: 12px; color: var(--amber); text-align: center; }

/* ---------- Misc --------------------------------------------------------- */

.empty { text-align: center; padding: 46px 20px; color: var(--text-dim); }
.empty .mark { font-size: 34px; margin-bottom: 10px; opacity: .5; }

.offline-bar {
  background: var(--rose); color: #fff; font-size: 12px; font-family: var(--mono);
  text-align: center; padding: calc(5px + var(--safe-t)) 5px 5px; letter-spacing: 0.08em;
}
.sync-bar {
  background: var(--amber); color: #0E1116; font-size: 12px; font-family: var(--mono);
  text-align: center; padding: 5px; letter-spacing: 0.08em;
}
/* When the offline bar is already showing above it, the sync bar isn't the
   first element anymore, so it must not double up on the safe-area padding. */
.offline-bar + .sync-bar { padding-top: 5px; }
.sync-bar:first-child { padding-top: calc(5px + var(--safe-t)); }

.check { width: 22px; height: 22px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--surface-2); display: grid; place-items: center; flex: 0 0 auto; font-size: 13px; }
.check.on { background: var(--jade); border-color: var(--jade); color: #06110D; }
.done-txt { text-decoration: line-through; color: var(--text-dim); }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + var(--safe-b)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 600; z-index: 200; animation: rise .2s;
}

/* ---------- Conflict flags & expandable cards ---------------------------- */

.flag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.06em;
  padding: 2px 6px; border-radius: 5px;
}
.flag.error { background: color-mix(in srgb, var(--rose) 22%, transparent); color: var(--rose); }
.flag.warn  { background: color-mix(in srgb, var(--amber) 22%, transparent); color: var(--amber); }

.alert {
  border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  border-left: 3px solid var(--line); background: var(--surface-2);
}
.alert.error { border-left-color: var(--rose); }
.alert.warn  { border-left-color: var(--amber); }

.stub.has-error { border-color: color-mix(in srgb, var(--rose) 45%, var(--line)); }
.stub.has-warn  { border-color: color-mix(in srgb, var(--amber) 40%, var(--line)); }
.stub.open      { border-color: var(--amber); }

.stub-more {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--line);
  animation: unfold .18s ease-out;
}
@keyframes unfold { from { opacity: 0; transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .stub-more { animation: none; } }

.kv { display: grid; gap: 10px; }
.kv .eyebrow { display: block; margin-bottom: 2px; }

.install-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 14px;
}

/* ---------- Version history ------------------------------------------- */

.histrow {
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface-2); margin-bottom: 8px; overflow: hidden;
}
.histrow > .spread { padding: 10px 12px; cursor: pointer; }
.histrow.open > .spread { border-bottom: 1px dashed var(--line); }
.histdelta { padding: 8px 12px 10px; }

.diffrow {
  display: grid; grid-template-columns: 1fr 1fr auto 1fr; gap: 6px;
  align-items: baseline; padding: 5px 0; font-size: 12px;
}
.diffield { font-family: var(--mono); color: var(--text-dim); text-transform: uppercase;
  font-size: 10px; letter-spacing: 0.06em; align-self: center; }
.diffval { overflow-wrap: anywhere; }
.diffval.from { color: var(--rose); text-decoration: line-through; opacity: .8; }
.diffval.to { color: var(--jade); }
.diffarrow { color: var(--text-dim); }
.diffrow.changed .diffield { color: var(--amber); }

/* ---------- Sync Center -------------------------------------------------- */

.synctile {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px;
}
.synctile .v { font-family: var(--mono); font-size: 18px; font-weight: 700; }
.synctile .k { font-size: 11px; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: 0.06em; font-family: var(--mono); margin-top: 2px; }
.synctiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.synclogrow {
  display: flex; gap: 8px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px;
}
.synclogrow:last-child { border-bottom: none; }
.synclogrow .t { font-family: var(--mono); font-size: 11px; color: var(--text-dim); flex: 0 0 auto; }
.synclogrow .s { margin-left: auto; font-size: 11px; }

.syncdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.syncdot.ok { background: var(--jade); }
.syncdot.pending { background: var(--amber); }
.syncdot.err { background: var(--rose); }

.stub-sync { font-size: 11px; margin-left: 4px; }

/* ---------- Smart Location Card ------------------------------------------ */

.place-photo {
  width: 100%; height: 140px; border-radius: 10px; object-fit: cover;
  background: var(--surface-2); margin-bottom: 10px; display: block;
}
.place-photo-empty {
  width: 100%; height: 90px; border-radius: 10px; background: var(--surface-2);
  display: grid; place-items: center; color: var(--text-dim); font-size: 24px; margin-bottom: 10px;
}
.place-row { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; font-size: 13px; }
.place-row .ic { flex: 0 0 auto; width: 18px; text-align: center; }
.place-source { font-size: 10px; font-family: var(--mono); color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em; }
.rating-stars { color: var(--amber); letter-spacing: 1px; }

.provider-empty {
  border: 1px dashed var(--line); border-radius: 10px; padding: 12px;
  font-size: 13px; color: var(--text-dim); text-align: center;
}

/* ---------- Sheet sections (collapsible) & sticky save --------------------- */

.sheet-section {
  border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; overflow: hidden;
}
.sheet-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 14px; background: var(--surface-2);
  font-size: 14px; font-weight: 600; min-height: 44px;
}
.sheet-section-head .chev { color: var(--text-dim); font-size: 13px; transition: transform .18s ease; }
.sheet-section.open .sheet-section-head .chev { transform: rotate(90deg); }
.sheet-section-body {
  padding: 14px; display: none;
}
.sheet-section.open .sheet-section-body { display: block; }
.sheet-section-head:focus-visible, .sheet-close:focus-visible, .iconbtn:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 2px;
}

.sheet-savebar {
  position: sticky; bottom: calc(-1 * (24px + var(--safe-b))); z-index: 3;
  margin: 14px -16px calc(-24px - var(--safe-b));
  padding: 12px max(16px, var(--safe-r)) calc(12px + var(--safe-b)) max(16px, var(--safe-l));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}

/* ---------- Swipeable timeline rows ---------------------------------------- */

.swipe-wrap { position: relative; overflow: hidden; border-radius: var(--radius); margin-bottom: 10px; }
.swipe-wrap .stub { margin-bottom: 0; position: relative; z-index: 2; background: var(--surface);
  transition: transform .2s cubic-bezier(.2,.8,.2,1); touch-action: pan-y; }
.swipe-wrap.dragging .stub { transition: none; }

.swipe-actions {
  position: absolute; top: 0; bottom: 0; display: flex; z-index: 1;
}
.swipe-actions.left { right: 0; }
.swipe-actions.right { left: 0; }
.swipe-action {
  width: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: 11px; font-family: var(--mono); color: #fff; border: none;
}
.swipe-action .ic { font-size: 18px; }
.swipe-action.delete { background: var(--rose); }
.swipe-action.duplicate { background: var(--violet); color: #1a1330; }
.swipe-action.edit { background: var(--amber); color: #0E1116; }
.swipe-action.complete { background: var(--jade); color: #06110D; }

.undo-toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(84px + var(--safe-b));
  z-index: 200; max-width: 480px; margin: 0 auto;
  background: var(--text); color: var(--bg); border-radius: 12px;
  padding: 12px 14px; display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); animation: rise .2s;
}
.undo-toast button { color: var(--amber); font-weight: 700; font-size: 13px; flex: 0 0 auto; }
.undo-toast span { flex: 1; font-size: 13px; }

.context-menu {
  position: fixed; z-index: 210; min-width: 180px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0,0,0,.4); overflow: hidden; padding: 6px;
}
.context-menu button {
  display: flex; width: 100%; align-items: center; gap: 10px;
  padding: 10px 10px; border-radius: 8px; font-size: 14px; text-align: left;
}
.context-menu button:active { background: var(--surface); }
.context-menu button.danger { color: var(--rose); }

/* ---------- Wishlist (Must-do) — flat, calm, one row per idea ------------- */
/* Deliberately not .card-based: a bordered box per item is the "task
   management" weight this redesign is undoing. A hairline divider between
   rows (the Reminders/Notes pattern) reads as one continuous list instead
   of 30 separate boxes stacked on top of each other. */

.wish-row {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
}
.wish-row:last-child { border-bottom: none; }
.wish-row:active { background: var(--surface-2); }

.wish-sched { flex: 0 0 auto; width: 18px; text-align: center; font-size: 13px; }

.wish-main { flex: 1; min-width: 0; }
.wish-title {
  font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: block;
}

.wish-star { flex: 0 0 auto; font-size: 14px; }

.wish-vote {
  flex: 0 0 auto; font-family: var(--mono); font-size: 13px; color: var(--text-dim);
  padding: 4px 2px; min-width: 40px; text-align: right;
}
.wish-vote.on { color: var(--rose); font-weight: 600; }

/* Compact segmented control, replacing a row of separately-outlined pills
   for the same three options — one joined bar reads as a single control
   instead of three competing buttons. */
.segmented {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 9px; padding: 2px; margin-bottom: 10px; width: 100%;
}
.segmented button {
  flex: 1; padding: 6px 4px; font-size: 12px; border-radius: 7px; color: var(--text-dim);
}
.segmented button.on { background: var(--surface); color: var(--text); font-weight: 600; }
/* iOS WebKit standalone-mode viewport-shrink fix */
@media (display-mode: standalone) {
  body::after {
    content: "";
    position: absolute;
    top: 100vh;
    left: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
    visibility: hidden;
  }
}

/* v0.9.3 reorder grip: visual feedback only; pointer logic is in app.js. */
.stub.dragging-row {
  box-shadow: 0 8px 22px rgba(0,0,0,.20);
}


/* v0.9.8 native-feeling lifted reorder. */
.stub.drag-ghost {
  box-shadow: 0 18px 38px rgba(0,0,0,.32), 0 4px 12px rgba(0,0,0,.18);
  border-color: var(--amber);
  background: var(--surface);
  transition: none !important;
  will-change: transform;
}
.swipe-wrap.drag-placeholder > .stub { visibility: hidden; }
.swipe-wrap.drag-placeholder {
  border-radius: 16px; background: var(--surface-2);
  outline: 1px dashed var(--line);
}

.drag-handle-active {
  opacity: 1 !important;
}
.stub.drag-ghost {
  filter: saturate(1.03);
}


/* v0.9.9 drag source stays mounted so iOS pointer capture cannot be lost. */
.swipe-wrap.drag-source > .stub {
  opacity: .18;
}
.drag-insertion-marker {
  height: 4px;
  border-radius: 999px;
  background: var(--amber);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--amber) 22%, transparent);
  transform: translateY(-2px);
}
