/* ─────────────────────────────────────────────────────────────────
   Trips — travel-journal aesthetic, repainted per destination.
   The palette below is the London "Travel Journal" theme; themes.js
   overrides every variable in this first block for other trips.
   ───────────────────────────────────────────────────────────────── */

:root {
  /* Palette (set per trip by themes.js) */
  --bg:           #f6f1e6;
  --bg-rgb:       246, 241, 230;
  --bg-2:         #efe7d4;
  --bg-3:         #e6dcc4;
  --paper:        #fbf7ee;
  --paper-rgb:    251, 247, 238;
  --ink:          #221f1a;
  --ink-rgb:      34, 31, 26;
  --ink-soft:     #4a463d;
  --ink-mute:     #7a7466;

  --primary:      #1d4d3a;
  --primary-rgb:  29, 77, 58;
  --primary-dark: #143829;
  --primary-soft: #d6e2d3;
  --primary-ink:  #1d4d3a;  /* primary, dark enough to read as text */
  --on-primary:   #fbf7ee;  /* text drawn on a primary background */

  --accent:       #b85a26;
  --accent-rgb:   184, 90, 38;
  --accent-dark:  #9a4920;
  --accent-soft:  #efd9c7;
  --accent-ink:   #b85a26;
  --on-accent:    #fbf7ee;

  --gold:         #b78b3a;

  --font-display: 'Plus Jakarta Sans', 'Manrope', system-ui, sans-serif;
  --display-weight: 700;
  --heading-weight: 600;
  --motif-corner: none;
  --motif-opacity: .16;
  --motif-band:   none;
  --band-h:       0px;

  /* Fixed across themes */
  --red:          #a8331f;

  /* Halal chip colors */
  --halal-full-bg:   #d6e2d3;
  --halal-full-fg:   #1d4d3a;
  --halal-safe-bg:   #f0e3c4;
  --halal-safe-fg:   #8a6a1f;
  --halal-part-bg:   #efd9c7;
  --halal-part-fg:   #8b4319;
  --halal-none-bg:   #f2cfc8;
  --halal-none-fg:   #7a2418;

  --radius-lg:    20px;
  --radius:       14px;
  --radius-sm:    10px;
  --shadow-1:     0 1px 2px rgba(var(--ink-rgb),.06), 0 2px 8px rgba(var(--ink-rgb),.04);
  --shadow-2:     0 4px 16px rgba(var(--ink-rgb),.12), 0 1px 3px rgba(var(--ink-rgb),.08);

  --safe-top:     env(safe-area-inset-top, 0);
  --safe-bottom:  env(safe-area-inset-bottom, 0);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Manrope', system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* The page colour sits on the root, which always fills the whole screen.
   An iPhone Home Screen app can lay the page out shorter than the screen
   and fills the rest with this colour, so the page's own bottom edge must
   be plain page colour too. */
body {
  min-height: 100dvh;
  background: transparent;
}
/* The soft colour washes: a fixed layer that overshoots every edge */
body::after {
  content: '';
  position: fixed;
  inset: -120px 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(1200px 800px at 80% 3%, rgba(var(--accent-rgb),.06), transparent 60%),
    radial-gradient(900px 700px at -10% 42%, rgba(var(--primary-rgb),.08), transparent 55%);
}

/* No paper-grain texture: an iPhone Home Screen app fills the strip below
   the page with the plain page colour, and a textured page never quite
   matched it */

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  letter-spacing: -.01em;
  color: var(--ink);
}

button { font-family: inherit; cursor: pointer; }

/* ─── Top bar ──────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0;
  z-index: 100;
  padding-top: var(--safe-top);
  background: linear-gradient(to bottom, var(--bg) 70%, rgba(var(--bg-rgb),.92));
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid rgba(var(--ink-rgb),.08);
}
/* Destination pattern strip along the bottom of the header (none for London) */
.topbar::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: var(--band-h);
  background: var(--motif-band) left center / auto var(--band-h) repeat-x;
  pointer-events: none;
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px 8px;
}

.brand {
  display: flex; align-items: center; gap: 12px;
  min-width: 0;
  background: transparent;
  border: 0;
  padding: 4px 8px 4px 0;
  margin: -4px 0;
  border-radius: 12px;
  text-align: left;
  color: inherit;
  font: inherit;
  transition: background .15s, transform .1s;
}
.brand:active { transform: scale(.98); background: rgba(var(--ink-rgb),.05); }
.brand-text { min-width: 0; }
.brand-title-row { display: flex; align-items: center; gap: 4px; }
.brand-chevron { color: var(--ink-mute); flex-shrink: 0; margin-top: 1px; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: var(--display-weight);
  font-size: 22px;
  line-height: 1;
  box-shadow: var(--shadow-1);
  flex-shrink: 0;
  letter-spacing: -.02em;
}
.brand-mark.two-letter { font-size: 16px; }
.brand-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: var(--display-weight);
  line-height: 1.1;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-title span {
  font-style: normal;
  color: var(--accent-ink);
  font-weight: 400;
}
.brand-sub {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
  letter-spacing: .02em;
}

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid rgba(var(--ink-rgb),.12);
  color: var(--ink);
  border-radius: 10px;
  transition: background .15s, transform .1s;
  padding: 0;
  margin: 0;
  font: inherit;
  line-height: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.icon-btn > svg { display: block; }
.icon-btn:active { transform: scale(.94); background: var(--bg-2); }

/* ─── Day strip ───────────────────────────────────────────── */
.day-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 18px 14px;
  margin-left: 15px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}
.day-strip::-webkit-scrollbar { display: none; }

.day-chip {
  flex: 0 0 auto;
  background: var(--paper);
  border: 1px solid rgba(var(--ink-rgb),.1);
  border-radius: 12px;
  padding: 8px 12px;
  display: flex; flex-direction: column;
  align-items: center;
  min-width: 56px;
  scroll-snap-align: start;
  transition: all .15s;
}
.day-chip.done { opacity: .55; }
.day-chip.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  box-shadow: var(--shadow-1);
}
.day-chip-num {
  font-family: var(--font-heading, var(--font-display));
  font-size: 17px;
  font-weight: var(--heading-weight);
  line-height: 1;
}
.day-chip-dow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-top: 4px;
  opacity: .75;
}
.day-chip-date {
  font-size: 9px;
  letter-spacing: .03em;
  margin-top: 2px;
  opacity: .6;
  white-space: nowrap;
}
.day-chip.rest {
  background: #e8e0f0;
  border-color: #c4aee0;
  color: #5a3d7a;
}
.day-chip.rest.active {
  background: #7c4daa;
  border-color: #7c4daa;
  color: #fff;
}
.day-chip.rest .day-chip-dow {
  color: #7c4daa;
  opacity: 1;
  font-weight: 600;
}
.day-chip.rest.active .day-chip-dow { color: #e8e0f0; }
.day-chip.removed {
  background: var(--bg-2);
  border-color: rgba(var(--ink-rgb),.08);
  opacity: .45;
}
.day-chip.removed.active {
  background: var(--ink-mute);
  border-color: var(--ink-mute);
  color: var(--bg);
  opacity: 1;
}

/* ─── Page / main ─────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 2;
  padding: 16px 18px calc(40px + var(--safe-bottom));
  max-width: 720px;
  margin: 0 auto;
}

/* Day header card */
.day-card {
  background: var(--paper);
  border: 1px solid rgba(var(--ink-rgb),.08);
  border-radius: var(--radius-lg);
  padding: 22px 22px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-1);
  position: relative;
  overflow: hidden;
}
.day-card::after {
  content: '';
  position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(var(--accent-rgb),.12), transparent 70%);
  pointer-events: none;
}
/* Other destinations: their illustration as a faint watermark in the corner */
body:not([data-motif="journal"]) .day-card::after {
  right: -14px; top: -14px;
  width: 168px; height: 168px;
  border-radius: 0;
  background: var(--motif-corner) center / contain no-repeat;
  opacity: var(--motif-opacity);
  -webkit-mask-image: radial-gradient(circle at 72% 28%, #000 38%, transparent 72%);
  mask-image: radial-gradient(circle at 72% 28%, #000 38%, transparent 72%);
}
.day-card > * { position: relative; z-index: 1; }
.day-meta {
  display: flex; align-items: baseline; gap: 10px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .14em;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.day-meta-dot {
  width: 4px; height: 4px; background: var(--accent); border-radius: 50%;
}
.day-title {
  font-size: 28px;
  margin: 0 0 6px;
  line-height: 1.1;
  font-weight: var(--display-weight);
}
.day-title em {
  font-style: normal;
  font-weight: inherit;
  color: var(--accent-ink);
}
.day-theme {
  color: var(--ink-soft);
  font-size: 14.5px;
  margin: 4px 0 14px;
}
.day-notes {
  display: flex;
  gap: 10px;
  background: var(--bg-2);
  border-left: 3px solid var(--gold);
  padding: 10px 12px;
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.45;
}
.day-notes::before { content: '✻'; color: var(--gold); flex-shrink: 0; }
.day-stats {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(var(--ink-rgb),.12);
}
.day-stat {
  display: flex; flex-direction: column;
  font-size: 12px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: .08em;
}
.day-stat strong {
  font-family: var(--font-heading, var(--font-display));
  font-size: 18px;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  font-weight: var(--display-weight);
  margin-top: 2px;
}
.day-stat strong small {
  font-family: 'Manrope', sans-serif;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-mute);
  letter-spacing: 0;
  white-space: nowrap;
}

/* ─── Day management row ──────────────────────────────────── */
.day-mgmt-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed rgba(var(--ink-rgb),.12);
}
.day-mgmt-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid rgba(var(--ink-rgb),.15);
  background: transparent;
  color: var(--ink-mute);
  transition: all .15s;
}
.day-mgmt-btn:active { transform: scale(.95); }
.day-mgmt-btn.day-mgmt-danger {
  border-color: rgba(168,51,31,.25);
  color: var(--red);
}
.day-mgmt-btn.day-mgmt-active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark);
}
.day-rest-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ede6f6;
  border-left: 3px solid #7c4daa;
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
  color: #5a3d7a;
  font-weight: 500;
  margin-top: 8px;
}
.day-removed-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-2);
  border-left: 3px solid var(--ink-mute);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 13.5px;
  color: var(--ink-mute);
  margin-top: 8px;
}

/* ─── View toggle ─────────────────────────────────────────── */
.view-toggle {
  display: flex;
  background: var(--bg-2);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 18px;
  width: fit-content;
}
.seg {
  background: transparent;
  border: 0;
  padding: 7px 18px;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .01em;
  color: var(--ink-mute);
  border-radius: 7px;
  transition: all .15s;
}
.seg.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* ─── Views ───────────────────────────────────────────────── */
.view { display: none; }
.view.active { display: block; }

/* ─── Stops list ──────────────────────────────────────────── */
.stops {
  list-style: none;
  padding: 0; margin: 0;
  display: flex; flex-direction: column;
  gap: 10px;
}
.stop {
  background: var(--paper);
  border: 1px solid rgba(var(--ink-rgb),.08);
  border-radius: var(--radius);
  padding: 14px 14px 12px 56px;
  position: relative;
  transition: all .2s;
}
.stop.visited {
  background: var(--primary-soft);
  border-color: rgba(var(--primary-rgb),.25);
}
.stop.visited .stop-name {
  text-decoration: line-through;
  text-decoration-color: rgba(var(--primary-rgb),.5);
  text-decoration-thickness: 1.5px;
}

.stop-num {
  position: absolute;
  left: 14px; top: 14px;
  width: 30px; height: 30px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: var(--heading-weight);
  font-size: 15px;
}
.stop.visited .stop-num {
  background: var(--primary-dark);
}
.stop.visited .stop-num::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  background: var(--primary-dark);
  border-radius: 50%;
  color: var(--on-primary);
  font-size: 14px;
}

.stop-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
}
.stop-name {
  font-family: var(--font-heading, var(--font-display));
  font-size: 17px;
  font-weight: var(--heading-weight);
  letter-spacing: -.005em;
  margin: 0 0 2px;
  line-height: 1.25;
}
.stop-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}
.chip {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--ink-soft);
}
.chip-halal-full { background: var(--halal-full-bg); color: var(--halal-full-fg); }
.chip-halal-safe { background: var(--halal-safe-bg); color: var(--halal-safe-fg); }
.chip-halal-partial { background: var(--halal-part-bg); color: var(--halal-part-fg); }
.chip-halal-none { background: var(--halal-none-bg); color: var(--halal-none-fg); }
.chip-prebook { background: var(--accent); color: var(--on-accent); }

.stop-notes {
  font-size: 13.5px;
  color: var(--ink-soft);
  margin: 2px 0 8px;
  line-height: 1.45;
}

.stop-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.action {
  background: transparent;
  border: 1px solid rgba(var(--ink-rgb),.15);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .15s;
  text-decoration: none;
}
.action:active { transform: scale(.97); }
.action.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.action.danger { color: var(--red); border-color: rgba(168,51,31,.3); }
.action svg { flex-shrink: 0; }

/* Leg / distance between stops */
.leg {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 4px 28px;
  font-size: 12px;
  color: var(--ink-mute);
}
.leg::before {
  content: '';
  display: block;
  width: 2px; height: 14px;
  background: linear-gradient(to bottom, transparent, var(--accent), transparent);
  margin-left: 14px;
}

/* Day footer */
.day-foot {
  margin-top: 18px;
  padding: 16px;
  background: var(--paper);
  border-radius: var(--radius);
  border: 1px dashed rgba(var(--ink-rgb),.15);
  font-size: 13px;
  color: var(--ink-mute);
  text-align: center;
}
.day-foot:empty { display: none; }
.day-foot strong { color: var(--ink); font-family: var(--font-heading, var(--font-display)); font-size: 16px; font-weight: var(--heading-weight); }

.add-btn {
  width: 100%;
  margin-top: 14px;
  padding: 14px;
  background: transparent;
  border: 1.5px dashed rgba(var(--primary-rgb),.35);
  color: var(--primary-ink);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all .15s;
}
.add-btn:hover, .add-btn:active {
  background: var(--primary-soft);
  border-color: var(--primary);
}

/* ─── Map ─────────────────────────────────────────────────── */
.view-map {
  position: relative;
}
#map {
  width: 100%;
  height: calc(100dvh - 280px);
  min-height: 460px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(var(--ink-rgb),.12);
  box-shadow: var(--shadow-1);
}

/* Custom Leaflet marker */
.l2026-marker {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid var(--paper);
  box-shadow: 0 2px 6px rgba(0,0,0,.3);
  font-family: var(--font-display);
  font-weight: var(--heading-weight);
  font-size: 13px;
}
.l2026-marker > span { transform: rotate(45deg); }
.l2026-marker.visited { background: var(--primary); color: var(--on-primary); }

/* User location dot with directional "beam" showing device heading.
   The container is 80x80px so the beam has room to fan out around the dot. */
.l2026-user-loc-icon {
  background: transparent !important;
  border: none !important;
}
.user-loc-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  pointer-events: none;
}
.user-loc-beam {
  position: absolute;
  left: 0;
  top: 0;
  width: 80px;
  height: 80px;
  /* Triangle pointing UP (north) from dot center, fading outward */
  background: linear-gradient(
    to top,
    rgba(59, 130, 246, 0.55) 0%,
    rgba(59, 130, 246, 0.18) 60%,
    rgba(59, 130, 246, 0) 100%
  );
  clip-path: polygon(50% 50%, 26% 0%, 74% 0%);
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  opacity: 0; /* hidden until a heading reading arrives */
  transition: transform 0.18s ease-out, opacity 0.3s ease;
}
.user-loc-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  background: #3b82f6;
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25), 0 2px 6px rgba(0, 0, 0, 0.3);
}

.leaflet-popup-content-wrapper {
  background: var(--paper);
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  border: 1px solid rgba(var(--ink-rgb),.08);
}
.leaflet-popup-content {
  font-family: 'Manrope', sans-serif;
  margin: 12px 14px;
  font-size: 13px;
}
.leaflet-popup-content strong {
  font-family: var(--font-heading, var(--font-display));
  font-weight: var(--heading-weight);
  font-size: 15px;
  display: block;
  margin-bottom: 4px;
}
.leaflet-popup-tip { background: var(--paper); }

/* ─── Modals ──────────────────────────────────────────────── */
.modal[hidden] { display: none !important; }
.modal {
  position: fixed; inset: 0;
  /* Past the bottom edge, in case an iPhone Home Screen app leaves room
     there: the backdrop, and the sheet's own colour below it (.modal-card) */
  box-shadow: 0 160px 0 rgba(var(--ink-rgb),.45);
  background: rgba(var(--ink-rgb),.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: end center;
  /* One column exactly as wide as the screen, so wide scrolling rows inside a
     sheet (the look picker) can't stretch it past the edge */
  grid-template-columns: minmax(0, 1fr);
  z-index: 1000;
  padding: 0;
  animation: modal-in .2s ease;
}
@keyframes modal-in { from { opacity: 0; } to { opacity: 1; } }

.modal-card {
  background: var(--paper);
  box-shadow: 0 160px 0 var(--paper);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 540px;
  max-height: 90dvh;
  display: flex; flex-direction: column;
  padding-bottom: var(--safe-bottom);
  animation: card-up .25s cubic-bezier(.2,.8,.2,1);
}
@keyframes card-up { from { transform: translateY(20px); } to { transform: translateY(0); } }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 8px;
  border-bottom: 1px solid rgba(var(--ink-rgb),.08);
}
.modal-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: var(--display-weight);
}
.modal-body {
  padding: 16px 18px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  display: flex; gap: 10px;
  padding: 14px 18px 18px;
  border-top: 1px solid rgba(var(--ink-rgb),.08);
}

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 5px;
}
.field input, .field textarea, .field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid rgba(var(--ink-rgb),.15);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, background .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--primary);
  background: var(--paper);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-row > .field { margin-bottom: 14px; }
@media (max-width: 420px) {
  .field-row { grid-template-columns: 1fr; gap: 0; }
}
.hint { font-size: 12px; color: var(--ink-mute); margin: -8px 0 14px; }

.btn-primary, .btn-secondary {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
  transition: all .15s;
}
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-primary:active { background: var(--primary-dark); }
.btn-secondary { background: transparent; color: var(--ink); border-color: rgba(var(--ink-rgb),.18); }
.btn-secondary:active { background: var(--bg-2); }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(var(--ink-rgb),.08);
}
.setting-row:last-of-type { border-bottom: 0; }
.setting-row strong { font-size: 14px; font-weight: 600; display: block; }
.setting-row p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-mute); }
.setting-row select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(var(--ink-rgb),.15);
  background: var(--bg);
  font-size: 13px;
}
.version { font-size: 11px; color: var(--ink-mute); text-align: center; margin-top: 14px; font-family: monospace; }

/* ─── Empty state ─────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-mute);
}
.empty h3 { font-size: 22px; margin: 0 0 8px; }
.empty p { font-size: 14px; margin: 0; }

/* ─── Day actions (optimise, reset) ───────────────────────── */
.day-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.day-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .01em;
  transition: all .15s;
}
.day-action:active { transform: scale(.97); background: var(--accent-dark); }
.day-action.subtle {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid rgba(var(--ink-rgb),.18);
}
.day-action.subtle:active { background: var(--bg-2); }

/* ─── Reorder arrows ─────────────────────────────────────── */
.stop-reorder {
  position: absolute;
  right: 12px; top: 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reorder-btn {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: var(--bg-2);
  border: 1px solid rgba(var(--ink-rgb),.1);
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 0;
  transition: all .12s;
}
.reorder-btn:active:not(:disabled) {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  transform: scale(.92);
}
.reorder-btn:disabled { opacity: .3; cursor: not-allowed; }

.stop { padding-right: 50px; } /* room for reorder arrows */

/* ─── Map FABs (locate + recenter) ───────────────────────── */
.map-fab {
  position: absolute;
  right: 14px;
  width: 44px; height: 44px;
  background: var(--paper);
  border: 1px solid rgba(var(--ink-rgb),.15);
  color: var(--primary-ink);
  border-radius: 12px;
  display: grid; place-items: center;
  box-shadow: var(--shadow-2);
  z-index: 500;
}
.locate-btn { bottom: 14px; }
.locate-btn.active { background: var(--primary); color: var(--on-primary); }
.recenter-btn { bottom: 68px; background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ─── GPS status banner ──────────────────────────────────── */
.gps-status {
  background: var(--primary);
  color: var(--on-primary);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-1);
}
.gps-status[hidden] { display: none; }
.gps-status strong { font-weight: 700; }
.gps-status .gps-acc {
  margin-left: auto;
  font-size: 11px;
  opacity: .65;
  font-family: monospace;
}

/* ─── Address autocomplete ───────────────────────────────── */
.field-autocomplete { position: relative; }
.field-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--ink-mute);
  font-size: 11px;
}
.suggestions {
  position: absolute;
  top: 100%; left: 0; right: 0;
  background: var(--paper);
  border: 1px solid rgba(var(--ink-rgb),.15);
  border-radius: 10px;
  margin-top: 4px;
  max-height: 250px;
  overflow-y: auto;
  box-shadow: var(--shadow-2);
  z-index: 50;
}
.suggest-item {
  display: block;
  width: 100%;
  background: transparent;
  border: 0;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(var(--ink-rgb),.06);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  transition: background .1s;
}
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover, .suggest-item:focus { background: var(--bg-2); outline: none; }
.suggest-item strong {
  display: block;
  font-family: var(--font-heading, var(--font-display));
  font-weight: var(--heading-weight);
  font-size: 14.5px;
  margin-bottom: 2px;
}
.suggest-item span {
  display: block;
  font-size: 12px;
  color: var(--ink-mute);
  line-height: 1.35;
}
.suggest-loading, .suggest-empty {
  color: var(--ink-mute);
  font-size: 12.5px;
  cursor: default;
}
.suggest-loading:hover, .suggest-empty:hover { background: transparent; }

/* ─── Top-bar actions cluster ─────────────────────────────── */
.topbar-actions { display: flex; gap: 8px; }

/* ─── Picker (bottom-sheet) ───────────────────────────────── */
.modal-card-picker { max-height: 75dvh; }
.picker-body {
  padding: 8px 12px 16px;
}
.picker-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 4px;
  text-align: left;
  cursor: pointer;
  transition: all .12s;
  font-family: inherit;
  color: var(--ink);
  min-height: 60px;
}
.picker-option:hover { background: var(--bg-2); }
.picker-option:active { transform: scale(.99); background: var(--bg-3); }
.picker-option.selected {
  background: var(--primary-soft);
  border-color: rgba(var(--primary-rgb),.25);
}
.picker-option.selected .picker-option-label { color: var(--primary-ink); }
.picker-option-main {
  display: flex; flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}
.picker-option-label {
  font-family: var(--font-heading, var(--font-display));
  font-weight: var(--heading-weight);
  font-size: 16.5px;
  letter-spacing: -.005em;
  line-height: 1.2;
}
.picker-option-desc {
  font-size: 12.5px;
  color: var(--ink-mute);
  line-height: 1.35;
}
.picker-option-icon {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  background: var(--bg-2);
  color: var(--primary-ink);
  border-radius: 10px;
  margin-right: 14px;
  flex-shrink: 0;
  transition: all .15s;
}
.picker-option-icon[data-cat="food"]      { background: var(--accent-soft); color: var(--accent-ink); }
.picker-option-icon[data-cat="dessert"]   { background: #f0e2c8; color: #8a6a1f; }
.picker-option-icon[data-cat="museum"]    { background: #e3dcc8; color: #6e5f30; }
.picker-option-icon[data-cat="landmark"]  { background: var(--primary-soft); color: var(--primary-ink); }
.picker-option-icon[data-cat="shop"]      { background: #e0e4d6; color: #4f5e3a; }
.picker-option-icon[data-cat="park"]      { background: #d6e6d1; color: #2c5a39; }
.picker-option-icon[data-cat="transport"] { background: #d8e0e8; color: #355978; }
.picker-option-icon[data-cat="event"]     { background: #ead7d4; color: #8a3a3a; }
.picker-option-icon[data-cat="custom"]    { background: var(--bg-3); color: var(--ink-soft); }

.picker-option.selected .picker-option-icon {
  background: var(--primary);
  color: var(--on-primary);
}
.picker-option-left {
  display: flex; align-items: center; flex: 1; min-width: 0;
}
.picker-option-check {
  width: 24px; height: 24px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  margin-left: 8px;
}

/* Day-badge for action picker (replaces icon when option is a day) */
.picker-day-badge {
  width: 44px; height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 10px;
  margin-right: 14px;
  flex-shrink: 0;
  line-height: 1;
}
.picker-day-badge .stamp-label {
  font-size: 8px;
  letter-spacing: .14em;
  font-weight: 700;
  opacity: .85;
}
.picker-day-badge .stamp-num {
  font-family: var(--font-heading, var(--font-display));
  font-size: 20px;
  font-weight: var(--heading-weight);
  margin-top: 1px;
}

/* Danger variant for "Remove" option */
.picker-option-danger .picker-option-label { color: var(--red); }
.picker-option-danger .picker-option-icon {
  background: #f2cfc8;
  color: var(--red);
}
.picker-option-danger:hover { background: rgba(168,51,31,.04); }

/* ─── Picker trigger button (replaces select) ─────────────── */
.picker-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--bg);
  border: 1px solid rgba(var(--ink-rgb),.15);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: all .12s;
  text-align: left;
}
.picker-trigger:hover { border-color: var(--primary); background: var(--paper); }
.picker-trigger:active { transform: scale(.99); }
.picker-trigger.compact { padding: 7px 10px; font-size: 13px; min-width: 130px; }
.picker-trigger-label { flex: 1; }
.picker-trigger svg { color: var(--ink-mute); flex-shrink: 0; }

/* ─── Number input (− [num] +) ────────────────────────────── */
.number-input {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg);
  border: 1px solid rgba(var(--ink-rgb),.15);
  border-radius: 10px;
  padding: 2px;
  overflow: hidden;
}
.number-input button {
  width: 32px; height: 32px;
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: background .1s;
}
.number-input button:hover { background: var(--bg-2); }
.number-input button:active { background: var(--primary-soft); }
.number-input input {
  width: 50px;
  background: transparent;
  border: 0;
  text-align: center;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  font-weight: 600;
  outline: none;
  /* hide spinner */
  -moz-appearance: textfield;
}
.number-input input::-webkit-outer-spin-button,
.number-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.number-suffix {
  font-size: 12px;
  color: var(--ink-mute);
  padding: 0 4px;
}

/* ─── Toggle switch ───────────────────────────────────────── */
.field-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 4px 0 14px;
  cursor: pointer;
}
.field-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  position: relative;
  width: 44px;
  height: 26px;
  background: var(--bg-3);
  border-radius: 999px;
  flex-shrink: 0;
  transition: background .2s;
  margin-top: 2px;
}
.toggle-thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: var(--paper);
  border-radius: 50%;
  transition: left .2s, background .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.field-toggle input:checked + .toggle-track { background: var(--primary); }
.field-toggle input:checked + .toggle-track .toggle-thumb { left: 21px; }
.toggle-label strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.toggle-label span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-mute);
  margin-top: 2px;
}

/* ─── Date input ──────────────────────────────────────────── */
.date-input {
  font-family: inherit;
  background: var(--bg);
  border: 1px solid rgba(var(--ink-rgb),.15);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--ink);
}

/* ─── Browse view (full-screen) ───────────────────────────── */
.modal-full {
  padding: 0;
  align-items: stretch;
  /* Override base .modal grid sizing so child can't grow to content width */
  grid-template-columns: 100vw;
}
.modal-card-full {
  border-radius: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  padding-top: 0;
  padding-bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;  /* clip any accidental horizontal overflow */
}

/* Sticky head — never scrolls */
.browse-head {
  flex-shrink: 0;
  background: var(--paper);
  border-bottom: 1px solid rgba(var(--ink-rgb),.08);
  padding-top: var(--safe-top);
}
.modal-card-full .modal-head {
  border-bottom: 0;
  padding: 14px 18px 4px;
}
.modal-head h2 em { font-style: normal; }
.modal-card-full .modal-head h2 em {
  font-weight: 300;
  color: var(--accent-ink);
}

.browse-search {
  position: relative;
  margin: 6px 16px 8px;
}
.browse-search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-mute);
  pointer-events: none;
}
.browse-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid rgba(var(--ink-rgb),.12);
  border-radius: 10px;
  padding: 10px 12px 10px 36px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  outline: none;
  transition: border-color .15s;
}
.browse-search input:focus { border-color: var(--primary); background: var(--paper); }

/* Filter row — proper horizontal scroll with iOS-friendly props */
.browse-filter-wrap {
  position: relative;
  max-width: 100%;
}
.browse-filter {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  padding: 4px 16px 12px;
  scrollbar-width: none;
  white-space: nowrap;
}
.browse-filter::-webkit-scrollbar { display: none; }

/* Right-edge fade to hint there's more to scroll */
.browse-filter-fade {
  position: absolute;
  top: 0; bottom: 12px; right: 0;
  width: 28px;
  background: linear-gradient(to right, transparent, var(--paper) 80%);
  pointer-events: none;
}

.filter-chip {
  flex: 0 0 auto;
  background: var(--paper);
  border: 1px solid rgba(var(--ink-rgb),.14);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
  letter-spacing: .01em;
}
.filter-chip:hover { background: var(--bg-2); }
.filter-chip:active { transform: scale(.97); }
.filter-chip.active {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(var(--primary-rgb),.25);
}

/* Scrollable content */
.browse-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(40px + var(--safe-bottom));
}

/* Section heading with decorative trailing line */
.browse-section {
  margin-bottom: 26px;
}
.browse-section-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.browse-section-icon {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 8px;
  flex-shrink: 0;
}
.browse-section-icon.tag-icon {
  background: var(--accent);
  color: var(--on-accent);
}
.browse-section-title {
  font-family: var(--font-heading, var(--font-display));
  font-size: 19px;
  font-weight: var(--display-weight);
  color: var(--ink);
  letter-spacing: -.005em;
}
.browse-section-count {
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 700;
}
.browse-section-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, rgba(var(--ink-rgb),.15), transparent);
}

/* ─── Place card — new layout ─────────────────────────────── */
.browse-place {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--paper);
  border: 1px solid rgba(var(--ink-rgb),.08);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  font-family: inherit;
  position: relative;
  box-sizing: border-box;
}
.browse-place:hover {
  border-color: rgba(var(--primary-rgb),.25);
  background: var(--paper);
  transform: translateY(-1px);
  box-shadow: var(--shadow-1);
}
.browse-place:active { transform: scale(.99); }

.browse-place-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: var(--bg-2);
  color: var(--primary-ink);
  border-radius: 12px;
  flex-shrink: 0;
  position: relative;
}
/* Subtle category-tinted backgrounds */
.browse-place-icon[data-cat="food"]      { background: var(--accent-soft); color: var(--accent-ink); }
.browse-place-icon[data-cat="dessert"]   { background: #f0e2c8; color: #8a6a1f; }
.browse-place-icon[data-cat="museum"]    { background: #e3dcc8; color: #6e5f30; }
.browse-place-icon[data-cat="landmark"]  { background: var(--primary-soft); color: var(--primary-ink); }
.browse-place-icon[data-cat="shop"]      { background: #e0e4d6; color: #4f5e3a; }
.browse-place-icon[data-cat="park"]      { background: #d6e6d1; color: #2c5a39; }
.browse-place-icon[data-cat="transport"] { background: #d8e0e8; color: #355978; }
.browse-place-icon[data-cat="event"]     { background: #ead7d4; color: #8a3a3a; }
.browse-place-icon[data-cat="custom"]    { background: var(--bg-3); color: var(--ink-soft); }

.browse-place-info {
  flex: 1 1 0;
  min-width: 0;  /* critical: allows shrinking below content size for ellipsis */
}
.browse-place-name {
  font-family: var(--font-heading, var(--font-display));
  font-weight: var(--heading-weight);
  font-size: 16px;
  line-height: 1.22;
  margin: 0 0 3px;
  letter-spacing: -.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.browse-place-sub {
  font-size: 12.5px;
  color: var(--ink-mute);
  line-height: 1.3;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
}
.browse-place-sub .sub-dot { color: var(--ink-mute); opacity: .5; }
.browse-place-sub .sub-halal { color: var(--halal-full-fg); font-weight: 600; }
.browse-place-sub .sub-prebook { color: var(--accent-ink); font-weight: 600; }

/* Day stamp on the right */
.browse-place-stamp {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 10px;
  padding: 5px 11px 6px;
  flex-shrink: 0;
  min-width: 44px;
  line-height: 1;
}
.browse-place-stamp.unassigned {
  background: var(--bg-3);
  color: var(--ink-mute);
}
.browse-place-stamp .stamp-label {
  font-size: 8.5px;
  letter-spacing: .14em;
  font-weight: 700;
  text-transform: uppercase;
  opacity: .85;
}
.browse-place-stamp .stamp-num {
  font-family: var(--font-heading, var(--font-display));
  font-size: 19px;
  font-weight: var(--heading-weight);
  margin-top: 1px;
}
.browse-place-stamp.unassigned .stamp-num {
  font-family: inherit;
  font-size: 18px;
  font-weight: 600;
}

.browse-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--ink-mute);
}
.browse-empty h3 { font-size: 22px; margin: 0 0 8px; font-family: var(--font-display); font-weight: var(--display-weight); }
.browse-empty p { font-size: 14px; margin: 0; }

/* ─── Adjust modal stacking ───────────────────────────────── */
#picker-modal { z-index: 1100; }
#browse-modal { z-index: 1050; }

/* ─── Hide old field hints (now in pickers) ───────────────── */
.hint { display: none; }

/* ─── Day title row + edit pencil ─────────────────────────── */
.day-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.day-title-row .day-title { flex: 1; min-width: 0; }
.title-edit-btn {
  flex-shrink: 0;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--paper);  /* sits cleanly over the destination watermark */
  border: 1px solid rgba(var(--ink-rgb),.12);
  color: var(--ink-mute);
  border-radius: 9px;
  margin-top: 4px;
  transition: all .15s;
  cursor: pointer;
}
.title-edit-btn:hover {
  background: var(--bg-2);
  color: var(--primary-ink);
  border-color: rgba(var(--primary-rgb),.3);
}
.title-edit-btn.has-override {
  background: var(--primary-soft);
  color: var(--primary-ink);
  border-color: rgba(var(--primary-rgb),.25);
}

/* ─── Tertiary button (Reset to default) ──────────────────── */
.btn-tertiary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 0;
  color: var(--ink-mute);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 0;
  cursor: pointer;
  transition: color .15s;
}
.btn-tertiary:hover { color: var(--accent-ink); }

/* ─── Danger button ──────────────────────────────────────── */
.btn-danger {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(168,51,31,.25);
  border-radius: 12px;
  padding: 10px 14px;
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s;
}
.btn-danger:hover { background: rgba(168,51,31,.06); }

/* ─── Manage categories UI ────────────────────────────────── */
.add-category-cta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: var(--on-primary);
  border: 0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
  font-family: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}
.add-category-cta:hover { background: var(--primary-dark); }

.categories-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cat-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1px solid rgba(var(--ink-rgb),.08);
  border-radius: 12px;
  padding: 10px 12px;
  width: 100%;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: all .12s;
}
.cat-row:hover { border-color: rgba(var(--primary-rgb),.25); background: var(--bg-2); }
.cat-row-icon {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: var(--bg-2);
  color: var(--primary-ink);
  border-radius: 10px;
  flex-shrink: 0;
}
.cat-row-icon[data-cat="food"]      { background: var(--accent-soft); color: var(--accent-ink); }
.cat-row-icon[data-cat="dessert"]   { background: #f0e2c8; color: #8a6a1f; }
.cat-row-icon[data-cat="museum"]    { background: #e3dcc8; color: #6e5f30; }
.cat-row-icon[data-cat="landmark"]  { background: var(--primary-soft); color: var(--primary-ink); }
.cat-row-icon[data-cat="shop"]      { background: #e0e4d6; color: #4f5e3a; }
.cat-row-icon[data-cat="park"]      { background: #d6e6d1; color: #2c5a39; }
.cat-row-icon[data-cat="transport"] { background: #d8e0e8; color: #355978; }
.cat-row-icon[data-cat="event"]     { background: #ead7d4; color: #8a3a3a; }
.cat-row-info { flex: 1 1 0; min-width: 0; }
.cat-row-name {
  font-family: var(--font-heading, var(--font-display));
  font-weight: var(--heading-weight);
  font-size: 16px;
  margin: 0;
}
.cat-row-meta {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-mute);
  margin-top: 1px;
  font-weight: 700;
}
.cat-row-meta.builtin { color: var(--ink-mute); opacity: .7; }
.cat-row-meta.custom { color: var(--accent-ink); }
.cat-row-arrow { color: var(--ink-mute); flex-shrink: 0; }
.cat-row.readonly { cursor: default; }
.cat-row.readonly:hover { border-color: rgba(var(--ink-rgb),.08); background: var(--paper); }

/* ─── Move stops modal ────────────────────────────────────── */
.modal-card-tall { max-height: 88dvh; display: flex; flex-direction: column; }

.move-stops-intro {
  padding: 0 18px 12px;
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.45;
  border-bottom: 1px solid rgba(var(--ink-rgb),.06);
}
.move-stops-intro strong {
  color: var(--ink);
  font-family: var(--font-heading, var(--font-display));
  font-weight: var(--heading-weight);
}
.move-stops-intro em {
  color: var(--accent-ink);
  font-weight: 400;
}

.move-stops-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-2);
  border-bottom: 1px solid rgba(var(--ink-rgb),.08);
  flex-wrap: wrap;
}
.ms-toolbar-btn {
  background: transparent;
  border: 1px solid rgba(var(--ink-rgb),.18);
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .12s;
  flex-shrink: 0;
}
.ms-toolbar-btn:hover { background: var(--paper); }
.ms-toolbar-btn:active { transform: scale(.97); }
.ms-count {
  font-size: 12px;
  color: var(--ink-mute);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.ms-target-trigger {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--paper);
  border: 1px solid rgba(var(--ink-rgb),.15);
  border-radius: 10px;
  padding: 7px 12px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all .12s;
  min-width: 130px;
}
.ms-target-trigger:hover { border-color: var(--primary); }
.ms-target-trigger.has-target {
  background: var(--primary);
  color: var(--on-primary);
  border-color: var(--primary);
}
.ms-target-trigger.has-target svg { color: var(--on-primary); }
.ms-target-label { flex: 1; text-align: left; }
.ms-target-trigger svg { color: var(--ink-mute); flex-shrink: 0; }

.move-stops-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px 14px;
}

.ms-stop-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1px solid rgba(var(--ink-rgb),.08);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all .12s;
  width: 100%;
  font-family: inherit;
  text-align: left;
}
.ms-stop-row:hover { border-color: rgba(var(--primary-rgb),.25); }
.ms-stop-row.selected {
  background: var(--primary-soft);
  border-color: var(--primary);
}
.ms-stop-row.assigned {
  background: var(--bg-2);
  border-color: rgba(var(--ink-rgb),.06);
  opacity: .55;
}
.ms-stop-row.assigned .ms-stop-name { text-decoration: line-through; }

.ms-checkbox {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(var(--ink-rgb),.22);
  background: var(--paper);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: all .12s;
}
.ms-stop-row.selected .ms-checkbox {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
}
.ms-checkbox svg {
  opacity: 0;
  transition: opacity .12s;
}
.ms-stop-row.selected .ms-checkbox svg { opacity: 1; }

.ms-stop-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--bg-2);
  color: var(--primary-ink);
  border-radius: 9px;
  flex-shrink: 0;
}
.ms-stop-icon[data-cat="food"]      { background: var(--accent-soft); color: var(--accent-ink); }
.ms-stop-icon[data-cat="dessert"]   { background: #f0e2c8; color: #8a6a1f; }
.ms-stop-icon[data-cat="museum"]    { background: #e3dcc8; color: #6e5f30; }
.ms-stop-icon[data-cat="landmark"]  { background: var(--primary-soft); color: var(--primary-ink); }
.ms-stop-icon[data-cat="shop"]      { background: #e0e4d6; color: #4f5e3a; }
.ms-stop-icon[data-cat="park"]      { background: #d6e6d1; color: #2c5a39; }
.ms-stop-icon[data-cat="transport"] { background: #d8e0e8; color: #355978; }
.ms-stop-icon[data-cat="event"]     { background: #ead7d4; color: #8a3a3a; }

.ms-stop-info { flex: 1 1 0; min-width: 0; }
.ms-stop-name {
  font-family: var(--font-heading, var(--font-display));
  font-weight: var(--heading-weight);
  font-size: 15px;
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ms-stop-sub {
  font-size: 12px;
  color: var(--ink-mute);
  margin-top: 2px;
}
.ms-stop-sub .assigned-to {
  color: var(--primary-ink);
  font-weight: 600;
}

.move-stops-foot {
  border-top: 1px solid rgba(var(--ink-rgb),.08);
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: var(--paper);
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.move-stops-foot .btn-secondary { flex: 0 0 auto; min-width: 90px; }
.move-stops-foot .btn-primary { flex: 1 1 auto; min-width: 140px; }
.move-stops-foot .btn-primary:disabled {
  opacity: .45;
  cursor: not-allowed;
  background: var(--ink-mute);
  border-color: var(--ink-mute);
}

#move-stops-modal { z-index: 1060; }

/* ─── Rest / removed days — hide irrelevant controls ──────── */
body.day-is-rest .view-toggle,
body.day-is-rest .view-list,
body.day-is-rest .view-map,
body.day-is-removed .view-toggle,
body.day-is-removed .view-list,
body.day-is-removed .view-map {
  display: none;
}

/* ─── Sync indicator (topbar dot) ─────────────────────────── */
.sync-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 38px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.sync-indicator[hidden] { display: none; }
.sync-indicator .sync-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink-mute);
  transition: background .2s, transform .2s;
  position: relative;
}
/* Green whatever the look, so a red-themed trip doesn't look broken */
.sync-indicator[data-state="idle"] .sync-dot { background: #2fa36b; }
.sync-indicator[data-state="pushing"] .sync-dot,
.sync-indicator[data-state="pulling"] .sync-dot {
  background: var(--gold);
  animation: sync-pulse 1s ease-in-out infinite;
}
.sync-indicator[data-state="offline"] .sync-dot { background: var(--ink-mute); opacity: .4; }
.sync-indicator[data-state="error"] .sync-dot { background: var(--red); }
.sync-indicator[data-state="unset"] { display: none; }

@keyframes sync-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.4); opacity: 0.6; }
}

/* ─── Sync settings panel + modal ─────────────────────────── */
.sync-block-info strong code,
.sync-block-info strong { white-space: normal; }

.sync-help {
  font-size: 13.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 14px;
  background: var(--bg-2);
  padding: 12px 14px;
  border-radius: 10px;
  border-left: 3px solid var(--gold);
}
.sync-help strong { color: var(--ink); }

.sync-status-line {
  font-size: 13px;
  color: var(--ink-mute);
  margin: 6px 0 0;
}
.sync-status-line strong {
  color: var(--ink);
  font-weight: 600;
  margin-right: 6px;
}

.sync-warn {
  font-size: 12.5px;
  color: var(--accent-ink);
  background: rgba(var(--accent-rgb),.08);
  padding: 10px 12px;
  border-radius: 8px;
  margin-top: 12px;
  line-height: 1.45;
}

@media (min-width: 720px) {
  body { padding-bottom: 30px; }
  .day-title { font-size: 34px; }
  #map { height: 600px; }
}

/* ── AI Reorganise ─────────────────────────────────────────────── */
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 12px;
}
.ai-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--bg-3);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }
.ai-loading p { margin: 0; color: var(--ink); font-size: 15px; }
.ai-loading-sub { color: var(--ink-mute) !important; font-size: 13px !important; }
.ai-error { padding: 32px 20px; text-align: center; color: var(--accent-ink); }

.ai-diff { display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.ai-diff-intro { font-size: 13px; color: var(--ink-mute); margin: 0 0 4px; line-height: 1.5; }
.ai-diff-day {
  border: 1.5px solid var(--bg-3);
  border-radius: 12px;
  overflow: hidden;
}
.ai-diff-day-changed { border-color: var(--primary); }
.ai-diff-day-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--paper);
  border-bottom: 1px solid var(--bg-3);
}
.ai-diff-day-changed .ai-diff-day-head { background: rgba(var(--primary-rgb),.06); }
.ai-diff-day-num { font-weight: 700; font-size: 13px; color: var(--primary-ink); min-width: 40px; }
.ai-diff-day-title { font-size: 13px; color: var(--ink); font-weight: 600; flex: 1; }
.ai-diff-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: var(--primary);
  color: var(--on-primary);
  white-space: nowrap;
}
.ai-diff-badge-ok { background: var(--bg-3); color: var(--ink-mute); }
.ai-diff-events { list-style: none; margin: 0; padding: 8px 14px; display: flex; flex-direction: column; gap: 4px; }
.ai-diff-event { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.ai-diff-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-mute); flex-shrink: 0; }
.ai-diff-moved .ai-diff-dot { background: var(--primary); }
.ai-diff-name { flex: 1; }
.ai-diff-from { font-size: 11px; color: var(--primary-ink); font-weight: 600; white-space: nowrap; }

/* ─── Map popups ──────────────────────────────────────────── */
.popup-addr { color: var(--ink-mute); font-size: 12px; margin-bottom: 6px; }
.popup-links { margin-top: 8px; display: flex; gap: 10px; flex-wrap: wrap; }
.popup-links a { font-size: 12px; color: var(--primary-ink); text-decoration: underline; }

/* ─── Small buttons in setting rows ───────────────────────── */
.btn-secondary.compact, .btn-danger.compact {
  flex: 0 0 auto;
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 10px;
}

/* ─── Trip cards (poster in the trip's own colours) ────────── */
.trips-content { padding-top: 16px; }
.trips-content > * { max-width: 760px; margin-left: auto; margin-right: auto; }
.trips-group-label {
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 700;
  margin: 4px 2px 10px;
}
.trips-list {
  display: grid;
  gap: 12px;
  margin-bottom: 22px;
}
@media (min-width: 640px) {
  .trips-list { grid-template-columns: 1fr 1fr; }
}

.trip-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 156px;
  padding: 16px 18px 14px;
  border-radius: 20px;
  background: var(--tc-bg);
  color: var(--tc-on);
  overflow: hidden;
  isolation: isolate;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 6px 20px rgba(var(--ink-rgb),.14), 0 1px 3px rgba(var(--ink-rgb),.1);
  transition: transform .15s, box-shadow .15s;
  -webkit-user-select: none;
  user-select: none;
}
.trip-card:active { transform: scale(.985); }
.trip-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.trip-card::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(100deg, var(--tc-bg) 38%, transparent 78%);
  z-index: -1;
  pointer-events: none;
}
.trip-card::after {
  content: '';
  position: absolute;
  right: -18px; bottom: -24px;
  width: 184px; height: 184px;
  background: var(--tc-art) center / contain no-repeat;
  z-index: -2;
  pointer-events: none;
}
.trip-card.active {
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 5.5px var(--tc-bg), 0 10px 24px rgba(var(--ink-rgb),.18);
}
.trip-card.static { cursor: default; }
.trip-card.static:active { transform: none; }

.trip-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 40px;
}
.trip-card-flag { font-size: 22px; line-height: 1; }
.trip-card-status,
.trip-card-tag {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(var(--tc-on-rgb),.16);
  white-space: nowrap;
}
.trip-card-status.now {
  background: var(--tc-on);
  color: var(--tc-bg);
}
.trip-card-name {
  font-family: var(--tc-font);
  font-size: 30px;
  font-weight: var(--tc-weight, 700);
  line-height: 1.05;
  letter-spacing: -.01em;
  margin: 14px 0 4px;
  max-width: 72%;
  overflow-wrap: anywhere;
}
.trip-card-name span {
  font-style: normal;
  font-weight: 400;
  opacity: .72;
}
.trip-card-dates { font-size: 13px; font-weight: 600; opacity: .88; }
.trip-card-foot {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.trip-card-tag { text-transform: none; letter-spacing: .01em; font-size: 11.5px; }
.trip-card-more {
  position: absolute;
  top: 10px; right: 10px;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 0;
  background: rgba(var(--tc-on-rgb),.16);
  color: var(--tc-on);
  display: grid; place-items: center;
  padding: 0;
  z-index: 1;
}
.trip-card-more:active { transform: scale(.92); }

.new-trip-cta {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  border: 1.5px dashed rgba(var(--primary-rgb),.4);
  background: transparent;
  color: var(--primary-ink);
  font-weight: 700;
  font-size: 15px;
  transition: background .15s;
}
.new-trip-cta:active { background: var(--primary-soft); }
.join-trip-btn { display: flex; margin: 10px auto 0; }

/* ─── Trip editor (new / edit trip) ───────────────────────── */
.trip-preview { margin: 2px 0 18px; }
.trip-preview .trip-card { min-height: 140px; }
.trip-preview-empty {
  display: grid;
  place-items: center;
  min-height: 140px;
  border-radius: 20px;
  border: 1.5px dashed rgba(var(--ink-rgb),.18);
  color: var(--ink-mute);
  font-size: 13.5px;
  text-align: center;
  padding: 18px;
}
.trip-preview-empty strong {
  display: block;
  font-family: var(--font-heading, var(--font-display));
  font-size: 20px;
  font-weight: var(--display-weight);
  color: var(--ink);
  margin-bottom: 4px;
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 8px;
}
.dest-popular {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.dest-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 7px;
  border-radius: 999px;
  border: 1px solid rgba(var(--ink-rgb),.13);
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  transition: all .12s;
}
.dest-chip:active { transform: scale(.96); }
.dest-chip.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.dest-dot {
  width: 20px; height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(var(--dc-accent) 0 28%, var(--dc-primary) 0);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.suggest-item.with-flag {
  display: flex;
  align-items: center;
  gap: 10px;
}
.suggest-item .suggest-flag { font-size: 20px; line-height: 1; flex-shrink: 0; font-style: normal; }
.suggest-text { min-width: 0; }
.setting-row[hidden] { display: none; }
.suggest-item .suggest-kind {
  display: inline;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.suggest-section {
  padding: 8px 12px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.trip-details[hidden] { display: none; }
.trip-end-hint { font-size: 12.5px; color: var(--ink-mute); margin: -6px 0 14px; }

.theme-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  margin: 0 -2px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.theme-row::-webkit-scrollbar { display: none; }
.theme-swatch {
  flex: 0 0 auto;
  width: 108px;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: var(--ink);
}
.theme-swatch-art {
  position: relative;
  display: block;
  height: 74px;
  border-radius: 14px;
  background: var(--tc-bg);
  overflow: hidden;
  isolation: isolate;
  transition: box-shadow .15s, transform .12s;
}
.theme-swatch-art::after {
  content: '';
  position: absolute;
  right: -20px; bottom: -26px;
  width: 104px; height: 104px;
  background: var(--tc-art) center / contain no-repeat;
  z-index: -1;
}
.theme-swatch-art b {
  position: absolute;
  left: 10px; bottom: 7px;
  font-family: var(--tc-font);
  font-weight: var(--display-weight);
  font-size: 21px;
  color: var(--tc-on);
  line-height: 1;
}
.theme-swatch:active .theme-swatch-art { transform: scale(.96); }
.theme-swatch.selected .theme-swatch-art {
  box-shadow: 0 0 0 2.5px var(--paper), 0 0 0 4.5px var(--ink);
}
.theme-swatch-name {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  margin-top: 7px;
  line-height: 1.2;
}
.theme-swatch-sub {
  display: block;
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 1px;
}

/* ─── Trip row in settings ────────────────────────────────── */
.trip-setting-row strong { display: flex; align-items: center; gap: 8px; }
.trip-setting-flag { font-size: 18px; line-height: 1; }

/* ─── Destination regions (trip editor) ───────────────────── */
.region-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 0 -18px 12px;
  padding: 2px 18px 6px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.region-tabs::-webkit-scrollbar { display: none; }
.region-tab {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-mute);
  white-space: nowrap;
}
.region-tab.active { background: var(--ink); color: var(--paper); }
.dest-popular { max-height: 280px; overflow-y: auto; }
.dest-chip.country { font-weight: 800; }
.dest-flag { font-size: 16px; line-height: 1; }

/* ─── Home Screen icon (settings row + sheet) ─────────────── */
.home-icon-row { justify-content: flex-start; }
.home-icon-row .home-icon-text { flex: 1; min-width: 0; }
.home-icon-preview {
  width: 46px; height: 46px;
  border-radius: 11px;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(var(--ink-rgb),.25);
  background: var(--bg-2);
}
.hs-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.hs-icon {
  width: 84px; height: 84px;
  border-radius: 19px;
  box-shadow: 0 4px 14px rgba(var(--ink-rgb),.25);
  flex-shrink: 0;
}
.hs-hero strong {
  display: block;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: var(--display-weight);
  line-height: 1.15;
}
.hs-hero span { display: block; font-size: 13px; color: var(--ink-mute); margin-top: 3px; }
.hs-steps {
  margin: 0 0 12px;
  padding-left: 22px;
  font-size: 14.5px;
  line-height: 1.6;
}
.hs-steps b { font-weight: 700; }
.hs-share {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--bg-2);
  font-size: 12px;
  vertical-align: -2px;
}
.hs-note {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-soft);
  background: var(--bg-2);
  border-left: 3px solid var(--gold);
  border-radius: 0 10px 10px 0;
  padding: 10px 12px;
  margin: 0 0 10px;
}
#hs-foot a.btn-primary {
  display: grid;
  place-items: center;
  text-decoration: none;
}
#homescreen-modal { z-index: 1070; }
/* This trip's icon or the general one */
.hs-choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  border-radius: 12px;
  background: var(--bg-2);
}
.hs-choice button {
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13.5px;
  font-weight: 700;
}
.hs-choice button.selected {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* ─── Toast ───────────────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  transform: translateX(-50%);
  z-index: 2000;
  max-width: min(92vw, 460px);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  box-shadow: var(--shadow-2);
}
.toast[hidden] { display: none; }
/* ─── Intro (a phone with no trips yet) ───────────────────── */
/* Its own night palette: no trip is open, so no look applies yet */
body.intro-open { overflow: hidden; }
html.intro-open { background: #0f1d26; }
.intro {
  position: fixed;
  inset: 0;
  box-shadow: 0 160px 0 #0f1d26; /* past the bottom edge, as for .modal */
  z-index: 900; /* under sheets, so the trip editor and code sheet open on top */
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  background: #0f1d26;
  color: #fbf7ee;
  animation: intro-in .5s ease both;
}
.intro[hidden] { display: none; }
.intro.leaving { animation: intro-out .42s ease forwards; pointer-events: none; }
@keyframes intro-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes intro-out { to { opacity: 0; transform: scale(1.04); } }

/* A drifting wall of destination icons */
.intro-wall {
  position: absolute;
  top: -6%;
  left: -40%;
  right: -40%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: rotate(-9deg);
}
.intro-track {
  display: flex;
  gap: 16px;
  padding-right: 16px; /* each half is then exactly as wide as a loop */
  width: max-content;
  animation: intro-drift 72s linear infinite;
}
.intro-row:nth-child(even) .intro-track { animation-direction: reverse; animation-duration: 88s; }
.intro-row:nth-child(3) .intro-track { animation-duration: 60s; }
.intro-track img {
  width: 80px;
  height: 80px;
  flex-shrink: 0;
  border-radius: 20px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .45);
}
@keyframes intro-drift { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.intro::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(15, 29, 38, .05) 0%,
    rgba(15, 29, 38, .4) 30%,
    rgba(15, 29, 38, .93) 54%,
    #0f1d26 68%);
}

.intro-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 24px calc(26px + var(--safe-bottom));
}
.intro-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #f2c14e;
}
.intro-brand img { border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.intro-title {
  margin: 14px 0 12px;
  font-family: 'Plus Jakarta Sans', 'Manrope', system-ui, sans-serif;
  font-size: clamp(38px, 11vw, 58px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.035em;
  color: #fbf7ee;
}
.intro-title em { font-style: normal; color: #f2c14e; }
.intro-sub {
  max-width: 36ch;
  margin: 0 0 24px;
  font-size: 15.5px;
  line-height: 1.5;
  color: rgba(251, 247, 238, .78);
}
.intro-actions { display: grid; gap: 10px; }
.intro-cta,
.intro-code {
  font-family: inherit;
  font-weight: 800;
  border-radius: 16px;
  padding: 16px 18px;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}
.intro-cta {
  border: 0;
  background: #f2c14e;
  color: #0f1d26;
  font-size: 16.5px;
  box-shadow: 0 10px 30px rgba(242, 193, 78, .25);
}
.intro-code {
  border: 1px solid rgba(251, 247, 238, .24);
  background: rgba(251, 247, 238, .07);
  color: #fbf7ee;
  font-size: 15.5px;
}
.intro-cta:active, .intro-code:active { transform: scale(.98); }
.intro-fine {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 18px 2px 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: rgba(251, 247, 238, .58);
}
.intro-fine svg { flex-shrink: 0; margin-top: 1px; }
.intro-panel > * { animation: intro-rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.intro-panel > :nth-child(2) { animation-delay: .08s; }
.intro-panel > :nth-child(3) { animation-delay: .16s; }
.intro-panel > :nth-child(4) { animation-delay: .24s; }
.intro-panel > :nth-child(5) { animation-delay: .32s; }
@keyframes intro-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@media (min-height: 760px) {
  .intro-panel { padding-bottom: calc(48px + var(--safe-bottom)); }
}
/* Short screens (phones on their side, small windows): the icon wall would
   run behind the headline, so the backdrop darkens sooner */
@media (max-height: 640px) {
  .intro::after {
    background: linear-gradient(180deg, rgba(15, 29, 38, .55) 0%, rgba(15, 29, 38, .94) 30%, #0f1d26 48%);
  }
}
@media (prefers-reduced-motion: reduce) {
  .intro, .intro.leaving, .intro-panel > *, .intro-track { animation: none; }
}

/* ─── Codes: entering, sharing, the personal code ──────────── */
.field input.code-input {
  padding: 14px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  letter-spacing: .1em;
  text-align: center;
  text-transform: uppercase;
}
.field input.code-input::placeholder { color: rgba(var(--ink-rgb), .28); }

.share-link input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid rgba(var(--ink-rgb), .15);
  border-radius: 10px;
  background: var(--bg);
  color: var(--ink-soft);
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-overflow: ellipsis;
}
.share-actions { display: flex; gap: 10px; margin: 10px 0 14px; }
.share-code {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg-2);
}
.share-code span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--ink-mute);
}
.share-code strong {
  font: 600 16px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .06em;
  color: var(--ink);
  -webkit-user-select: all;
  user-select: all;
}
.share-note { margin: 0 0 12px; font-size: 13px; line-height: 1.5; color: var(--ink-soft); }
.share-note.warn { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); }
.block-btn { display: block; width: 100%; margin-top: 4px; }
.btn-primary:disabled { opacity: .45; cursor: default; }

.account-kicker {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.code-display {
  margin: 4px 0 12px;
  padding: 18px 12px;
  border-radius: 14px;
  background: var(--primary);
  color: var(--on-primary);
  text-align: center;
  font: 700 clamp(17px, 5.4vw, 22px)/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .08em;
  word-break: break-all;
  -webkit-user-select: all;
  user-select: all;
}
#account-modal { z-index: 1080; }
.sync-indicator[data-state="gone"] .sync-dot { background: var(--red); opacity: .55; }

/* ─── The app's new address (shown only at the old one) ───── */
.move-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 18px;
  border: 0;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
}
.move-banner[hidden] { display: none; }
.move-banner b { font-weight: 700; }
.move-banner-go { flex-shrink: 0; font-weight: 800; color: var(--gold); }
