/* Prepvoy identity.
   Navy ink on cool paper. The bright blue brand ribbon (--brand, as in the logo) is the one loud
   element: it marks the selected tab, trip tickets, map pins and the card header. Everything else stays quiet. */

:root {
  --paper: #eef2f6;
  --surface: #ffffff;
  --ink: #14213d;
  --slate: #56637a;
  --rule: #d6dde7;
  --red: #c8102e;
  --blue: #1d4f9c;
  --ok: #1f7a4d;
  --warn: #a15c00;
  --danger: #b3122b;
  --level-1: #1f7a4d;
  --level-2: #a17c00;
  --level-3: #c25700;
  --level-4: #b3122b;
  --chrome: #14213d;
  --chrome-ink: #eef2f6;

  --font: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.1875rem;
  --step-2: 1.5rem;
  --step-3: 2.25rem;

  --tabbar-h: 64px;
  --appbar-h: 52px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --brand: #0abaff;
  /* An image, not a colour, so it also works in background-image layers (map pins). */
  --stripe: linear-gradient(var(--brand), var(--brand));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0d1424;
    --surface: #151f36;
    --ink: #e7ecf4;
    --slate: #9aa7bc;
    --rule: #26324d;
    --red: #ff4d63;
    --blue: #6f9cf0;
    --ok: #4cc28a;
    --warn: #e0a640;
    --danger: #ff6b7d;
    --level-1: #4cc28a;
    --level-2: #e0c040;
    --level-3: #f08a3c;
    --level-4: #ff6b7d;
    --chrome: #1b2a4f;
    --chrome-ink: #eef2f6;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--step-0);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button, input { font: inherit; color: inherit; }
a { color: var(--blue); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
[hidden] { display: none !important; }

/* App bar */
.appbar {
  position: fixed; inset: 0 0 auto 0; z-index: 500;
  height: calc(var(--appbar-h) + var(--safe-t));
  padding: var(--safe-t) 16px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--chrome); color: var(--chrome-ink);
}
.appbar-title { margin: 0; font-size: var(--step-1); font-weight: 800; letter-spacing: -0.01em; }
.appbar-actions { display: flex; align-items: center; gap: 4px; margin-right: -8px; }
.appbar .icon-btn { color: var(--chrome-ink); }
.appbar-status { font-size: var(--step--1); padding: 2px 10px; border-radius: 999px; background: var(--red); color: #fff; }

main {
  position: fixed; left: 0; right: 0;
  top: calc(var(--appbar-h) + var(--safe-t));
  bottom: calc(var(--tabbar-h) + var(--safe-b));
}
.view { position: absolute; inset: 0; }

/* Tab bar */
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 500;
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface); border-top: 1px solid var(--rule);
}
.tab {
  border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--slate); font-size: var(--step--1); font-weight: 500;
  position: relative;
}
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; }
.tab[aria-selected="true"]::before {
  content: ''; position: absolute; top: 0; left: 30%; right: 30%; height: 3px;
  background: var(--stripe); background-size: 32px 3px;
}

/* Map */
.map { position: absolute; inset: 0; background: var(--paper); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.map-search {
  position: absolute; z-index: 460; top: 12px; left: 12px; right: 12px; max-width: 560px; margin: 0 auto;
  display: flex; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 4px 14px rgb(20 33 61 / 0.18);
}
.map-search:focus-within { border-color: var(--blue); }
.map-search input {
  flex: 1; min-width: 0; height: 50px; padding: 0 4px 0 16px; border: 0; background: transparent;
  font-size: 1rem; outline: none;
}
.map-search input::-webkit-search-decoration { -webkit-appearance: none; }
.map-search button { width: 52px; border: 0; background: none; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.map-results {
  position: absolute; z-index: 460; top: 70px; left: 12px; right: 12px; max-width: 560px; margin: 0 auto;
  max-height: 55%; overflow-y: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
  box-shadow: 0 8px 20px rgb(20 33 61 / 0.2);
}
.map-results:empty { display: none; }
.map-results p { margin: 0; padding: 14px 16px; color: var(--slate); }
.result {
  width: 100%; display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; text-align: left;
  padding: 12px 16px; border: 0; border-bottom: 1px solid var(--rule); background: none; cursor: pointer;
}
.result:last-child { border-bottom: 0; }
.result:hover, .result:focus-visible { background: var(--paper); }
.result small { display: block; color: var(--slate); }
.search-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--brand); border: 3px solid #fff; box-shadow: 0 0 0 2px #14213d, 0 2px 6px rgb(0 0 0 / 0.35); }
.new-here small { color: var(--slate); }
.map-hint {
  position: absolute; z-index: 450; left: 12px; bottom: 16px; max-width: calc(100% - 76px);
  margin: 0; padding: 8px 14px; border-radius: 999px;
  background: var(--chrome); color: var(--chrome-ink); font-size: var(--step--1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.leaflet-container { font-family: var(--font); }
.pin {
  width: 40px; height: 40px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  background: var(--surface); border: 3px solid transparent;
  background-image: linear-gradient(var(--surface), var(--surface)), var(--stripe);
  background-origin: border-box; background-clip: padding-box, border-box;
  box-shadow: 0 2px 6px rgb(20 33 61 / 0.35);
  display: grid; place-items: center;
}
.pin span { transform: rotate(45deg); font-size: 20px; line-height: 1; }
.pin-label {
  position: absolute; left: 50%; bottom: 54px; transform: translateX(-50%);
  max-width: 220px; padding: 3px 9px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--chrome); color: var(--chrome-ink); font-size: 0.8125rem; font-weight: 600; line-height: 1.3;
  box-shadow: 0 2px 6px rgb(20 33 61 / 0.3); pointer-events: auto;
}
.pin-label.past { opacity: 0.6; }
.home-pin {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: var(--chrome); color: var(--chrome-ink); border: 2px solid var(--surface);
  box-shadow: 0 2px 6px rgb(20 33 61 / 0.35);
}
.home-pin svg { width: 22px; height: 22px; stroke-width: 2; }
.pin-label.home-label { bottom: 42px; background: var(--surface); color: var(--ink); border: 1px solid var(--rule); }
.pin.past { opacity: 0.55; }
.new-here { display: grid; gap: 8px; min-width: 180px; }
.new-here p { margin: 0; font-weight: 600; }

/* List */
.list-wrap { position: absolute; inset: 0; overflow-y: auto; padding: 16px 16px 96px; }
.list-group { max-width: 640px; margin: 0 auto 24px; }
.list-group h2 { font-size: var(--step--1); font-weight: 600; color: var(--slate); margin: 0 0 8px; }
.tickets { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ticket {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 10px auto 1fr auto; align-items: center; gap: 14px;
  padding: 14px 16px 14px 0; border: 1px solid var(--rule); border-radius: 6px;
  background: var(--surface); overflow: hidden;
}
.ticket::before { content: ''; align-self: stretch; margin: -14px 0; background: var(--stripe); background-size: 10px 32px; }
.ticket.past::before { background: var(--rule); }
.ticket-flag { font-size: 28px; line-height: 1; }
.ticket-main { min-width: 0; }
.ticket-city { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: var(--step-1); font-weight: 600; line-height: 1.2; overflow: hidden; overflow-wrap: anywhere; }
.ticket-meta { display: block; color: var(--slate); font-size: var(--step--1); }
.ticket-when { font-size: var(--step--1); font-weight: 600; color: var(--blue); text-align: right; white-space: nowrap; }
.ticket.past .ticket-when { color: var(--slate); }

.empty { max-width: 420px; margin: 18vh auto 0; text-align: center; padding: 0 16px; }
.empty h2 { font-size: var(--step-2); margin: 0 0 8px; letter-spacing: -0.01em; }
.empty p { color: var(--slate); margin: 0 0 20px; }

.fab {
  position: absolute; right: 16px; bottom: 16px; z-index: 10;
  width: 60px; height: 60px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--brand); color: #14213d; display: grid; place-items: center; /* navy: white is too faint on this blue */
  box-shadow: 0 6px 16px rgb(10 186 255 / 0.4);
}
.fab svg { width: 28px; height: 28px; stroke-width: 2.8; }

/* Buttons & fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 6px; border: 1px solid transparent;
  font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--ink); color: var(--paper); width: 100%; }
.btn-primary[disabled] { opacity: 0.6; cursor: progress; }
.btn-quiet { background: transparent; border-color: var(--rule); color: var(--ink); }
.btn-danger { background: transparent; border-color: var(--rule); color: var(--danger); }
.icon-btn { width: 44px; height: 44px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; color: inherit; }

.field { display: grid; gap: 6px; }
.field > span { font-size: var(--step--1); font-weight: 600; color: var(--slate); }
.field input {
  min-height: 48px; padding: 10px 12px; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--surface); width: 100%;
}
.field input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgb(29 79 156 / 0.2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-body { display: grid; gap: 16px; align-content: start; }
.form-error { color: var(--danger); margin: 0; min-height: 1.4em; font-size: var(--step--1); }
.matches { display: grid; gap: 6px; }
.matches:empty { display: none; }
.match {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; text-align: left;
  padding: 10px 12px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); cursor: pointer;
}
.match[aria-pressed="true"] { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.match small { display: block; color: var(--slate); }
.match-note { margin: 0; color: var(--slate); font-size: var(--step--1); }

/* Sheets (dialogs) */
.sheet {
  border: 0; padding: 0; margin: 0; max-width: none; max-height: none;
  width: 100%; height: 100%; background: var(--paper); color: var(--ink);
}
.sheet::backdrop { background: rgb(13 20 36 / 0.5); }
.sheet[open] { animation: sheet-in 0.24s ease-out; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-inner { height: 100%; display: flex; flex-direction: column; }
.sheet-head {
  display: flex; align-items: center; gap: 4px; padding: calc(4px + var(--safe-t)) 8px 4px;
  min-height: calc(56px + var(--safe-t));
}
.sheet-head h2 { margin: 0; font-size: var(--step-1); font-weight: 600; }
.sheet-body { flex: 1; overflow-y: auto; padding: 8px 16px 24px; }
.sheet-foot { padding: 12px 16px calc(12px + var(--safe-b)); border-top: 1px solid var(--rule); background: var(--surface); }
@media (min-width: 720px) {
  .sheet { width: min(640px, 100%); height: min(92vh, 900px); margin: auto; border-radius: 10px; box-shadow: 0 20px 60px rgb(0 0 0 / 0.3); }
}

/* Profile button */
.profile-btn { padding: 0; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid color-mix(in srgb, var(--chrome-ink) 70%, transparent); color: var(--chrome-ink);
  font-size: 0.8125rem; font-weight: 800; letter-spacing: 0.02em; line-height: 1;
}
.avatar svg { width: 20px; height: 20px; }
.avatar.has-initials { background: var(--brand); border-color: var(--brand); color: #14213d; }

/* Welcome */
.top-notes {
  position: absolute; z-index: 480; top: 12px; left: 12px; right: 12px; max-width: 560px; margin: 0 auto;
  display: grid; gap: 8px; pointer-events: none;
}
.top-notes > * { pointer-events: auto; }
.top-notes > [hidden] { display: none; }
.welcome {
  position: relative;
  display: flex; gap: 8px; align-items: flex-start; padding: 16px 8px 16px 18px; border-radius: 8px;
  background: var(--chrome); color: var(--chrome-ink); box-shadow: 0 10px 28px rgb(13 20 36 / 0.35);
  overflow: hidden; animation: welcome-in 0.35s ease-out;
}
.welcome::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--stripe); background-size: 6px 32px; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .welcome { border: 1px solid color-mix(in srgb, var(--chrome-ink) 22%, transparent); }
}
.welcome-text { flex: 1; min-width: 0; }
.welcome-hello { margin: 0; font-size: var(--step-2); font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.welcome-line { margin: 6px 0 0; color: color-mix(in srgb, var(--chrome-ink) 82%, transparent); }
.welcome-setup { margin-top: 12px; min-height: 40px; border-color: color-mix(in srgb, var(--chrome-ink) 40%, transparent); color: var(--chrome-ink); }
.welcome.birthday { background: linear-gradient(135deg, #7a1f5c, #c2410c); color: #fff; }
.welcome.birthday::before { background: repeating-linear-gradient(180deg, #fde047 0 8px, #f472b6 8px 16px, #67e8f9 16px 24px); }
.welcome-bday { font-weight: 600; }
.welcome-close { color: var(--chrome-ink); flex: none; margin-top: -6px; }
@keyframes welcome-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Profile form */
.profile-body { max-width: 560px; }
.profile-body > .muted { margin: 0; }
.field select {
  min-height: 48px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--rule);
  background: var(--surface); color: var(--ink); font: inherit; width: 100%;
}
.field select:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgb(29 79 156 / 0.2); }
.field > label, .field-label { font-size: var(--step--1); font-weight: 600; color: var(--slate); }
.field-inline { display: flex; gap: 8px; }
.field-inline input { flex: 1; min-width: 0; }
.field-inline .btn { flex: none; padding: 0 14px; }
.field-note { display: block; margin: 0; font-size: var(--step--1); }
.field-note:empty { display: none; }
.field-note.ok { color: var(--ok); }
.field-note.warn { color: var(--warn); font-weight: 600; }
.currency { margin: 0; display: grid; gap: 2px; }

/* Trip type: segmented control in the form and on the card */
.segmented-field { border: 0; padding: 0; margin: 0; }
.segmented-field legend { padding: 0; margin-bottom: 6px; font-size: var(--step--1); font-weight: 600; color: var(--slate); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; background: var(--surface); }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: grid; place-items: center; min-height: 44px; font-weight: 600; color: var(--slate); }
.segmented label + label span { border-left: 1px solid var(--rule); }
.segmented input:checked + span { background: var(--ink); color: var(--paper); }
.segmented input:focus-visible + span { outline: 3px solid var(--blue); outline-offset: -3px; }
.trip-type { display: inline-flex; margin: 2px 0 10px; border: 1px solid color-mix(in srgb, var(--chrome-ink) 35%, transparent); border-radius: 999px; overflow: hidden; }
.trip-type button { border: 0; background: none; color: color-mix(in srgb, var(--chrome-ink) 75%, transparent); font: inherit; font-size: var(--step--1); font-weight: 600; padding: 5px 14px; cursor: pointer; }
.trip-type button[aria-pressed="true"] { background: var(--chrome-ink); color: var(--chrome); }

/* Country facts */
.facts { margin: 0; display: grid; gap: 0; }
.fact { display: grid; grid-template-columns: minmax(118px, 38%) 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.fact:last-child { border-bottom: 0; }
.fact dt { color: var(--slate); font-weight: 500; display: flex; gap: 8px; align-items: baseline; }
.fact dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.fact dd small { display: block; margin-top: 2px; font-weight: 400; color: var(--slate); font-size: var(--step--1); }
.warn-text { color: var(--warn); font-weight: 600; }
[data-clock] { font-size: var(--step-1); }

/* Profile: trip counts */
.stats h3 { margin: 4px 0 8px; font-size: var(--step-1); font-weight: 600; }
.stats-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; overflow: hidden; }
.stats-table th, .stats-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--rule); }
.stats-table thead th { font-size: var(--step--1); color: var(--slate); font-weight: 600; }
.stats-table tbody tr:last-child th, .stats-table tbody tr:last-child td { border-bottom: 0; }
.stats-table td { font-size: var(--step-2); font-weight: 800; font-variant-numeric: tabular-nums; width: 28%; }
.stats-table td.zero { color: var(--slate); font-weight: 500; }
.stats + .field-note { margin-top: 6px; }

/* Passport notice on a trip card */
.topic.passport .verdict { margin: 0; }
.topic.passport-expired .verdict { color: var(--danger); }

/* Backup */
.sheet-small .sheet-body { padding-top: 0; }
.backup-body { display: grid; gap: 12px; align-content: start; max-width: 560px; }
.backup-body p { margin: 0; }
.backup-body h3 { margin: 12px 0 0; font-size: var(--step-1); font-weight: 600; }
.backup-status { font-weight: 600; }
@media (min-width: 720px) { .sheet-small { height: auto; max-height: 92vh; } }
.backup-nudge {
  width: 100%; max-width: 640px; margin: 0 auto 16px; display: flex; gap: 10px; align-items: center; text-align: left;
  padding: 12px 14px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, var(--surface)); color: var(--ink); cursor: pointer; font-weight: 500;
}
.backup-nudge svg { flex: none; color: var(--warn); }
.empty .btn-quiet { margin-top: 10px; }

/* Detail */
.sheet-detail .sheet-inner { display: block; overflow-y: auto; overscroll-behavior: contain; }
.detail-bar {
  position: sticky; top: 0; z-index: 5; justify-content: space-between;
  background: var(--chrome); color: var(--chrome-ink);
}
.detail-head { background: var(--chrome); color: var(--chrome-ink); position: relative; padding-bottom: 20px; }
.detail-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; background: var(--stripe); background-size: 32px 8px; }
.detail-title { padding: 0 16px 8px; }
.trip-name { display: flex; align-items: center; gap: 6px; min-height: 36px; margin-bottom: 4px; }
.trip-name-text { font-size: var(--step-1); font-weight: 600; overflow-wrap: anywhere; }
.name-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 8px; border-radius: 999px;
  border: 0; background: none; color: inherit; cursor: pointer; font-weight: 500;
}
.name-btn svg { width: 18px; height: 18px; }
.name-add { padding: 0 12px 0 8px; margin-left: -8px; border: 1px dashed color-mix(in srgb, var(--chrome-ink) 50%, transparent); }
.name-form { display: flex; gap: 8px; width: 100%; max-width: 420px; }
.name-form input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 6px; border: 1px solid transparent;
  background: var(--chrome-ink); color: var(--chrome); font: inherit; font-weight: 600;
}
.name-save { height: 40px; padding: 0 16px; border-radius: 6px; border: 0; background: var(--brand); color: #14213d; font-weight: 600; cursor: pointer; }
.field .optional { font-weight: 400; }
.detail-title h2 { margin: 0; font-size: var(--step-3); font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.detail-country { margin: 6px 0 0; font-size: var(--step-1); }
.detail-dates { margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: baseline; color: color-mix(in srgb, var(--chrome-ink) 78%, transparent); }
.countdown { font-weight: 600; color: var(--chrome-ink); }
.detail-body { padding: 0 16px calc(32px + var(--safe-b)); }
.detail-inner { max-width: 640px; margin: 0 auto; }

.topic { padding: 22px 0; border-bottom: 1px solid var(--rule); }
.topic:last-of-type { border-bottom: 0; }
.topic h3 { margin: 0 0 12px; font-size: var(--step-1); font-weight: 600; display: flex; align-items: baseline; gap: 10px; }
.topic h3 .h-icon { font-size: 1.1em; }
.topic p { margin: 0 0 8px; max-width: 68ch; }
.source { color: var(--slate); font-size: var(--step--1); margin-top: 10px !important; }
.muted { color: var(--slate); }
.error { color: var(--danger); }
.retry { margin-top: 8px; min-height: 40px; }

.skeleton { display: grid; gap: 8px; }
.skeleton i { display: block; height: 14px; border-radius: 4px; background: var(--rule); animation: pulse 1.2s ease-in-out infinite; }
.skeleton i:nth-child(2) { width: 80%; } .skeleton i:nth-child(3) { width: 60%; }
@keyframes pulse { 50% { opacity: 0.45; } }

/* Language */
.lang-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 4px; padding: 0; list-style: none; }
.lang-list li { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--rule); font-weight: 500; }
.lang-list li:first-child { border-color: var(--ink); }

/* Weather */
.weather-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 72px; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.wday { scroll-snap-align: start; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 10px 6px; text-align: center; display: grid; gap: 2px; }
.wday b { font-size: var(--step--1); font-weight: 600; }
.wday small { color: var(--slate); font-size: 0.75rem; }
.wday .wicon { font-size: 26px; line-height: 1.2; }
.wday .wmax { font-weight: 600; font-variant-numeric: tabular-nums; }
.wday .wmin { color: var(--slate); font-variant-numeric: tabular-nums; font-size: var(--step--1); }
.weather-summary { margin-bottom: 12px !important; }

/* Plugs */
.plugs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.plug { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; flex: 1 1 260px; background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 10px; }
.plug-art { width: 64px; height: 64px; display: block; }
.plug-art .pa-body { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.plug-art .pa-pin { fill: var(--ink); stroke: none; }
.plug-art .pa-hole { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.plug-fallback { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font-size: var(--step-2); font-weight: 800; }
.plug-note { margin: -4px 0 10px !important; }
.plug small { color: var(--slate); }
.verdict { display: flex; gap: 8px; align-items: flex-start; font-weight: 500; }
.verdict.ok { color: var(--ok); }
.verdict.warn { color: var(--warn); }

/* Safety */
.level { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 10px; font-weight: 600; }
.level-dots { display: inline-flex; gap: 4px; }
.level-dots i { width: 14px; height: 14px; border-radius: 3px; background: var(--rule); }
.level-1 .level-dots i:nth-child(-n+1),
.level-2 .level-dots i:nth-child(-n+2),
.level-3 .level-dots i:nth-child(-n+3),
.level-4 .level-dots i:nth-child(-n+4) { background: currentColor; }
.level-1 { color: var(--level-1); } .level-2 { color: var(--level-2); } .level-3 { color: var(--level-3); } .level-4 { color: var(--level-4); }

.safety-news { margin-top: 14px; }
.safety-news:empty { display: none; }
.safety-news h4 { margin: 0 0 8px; font-size: var(--step-0); font-weight: 600; }

.notes textarea {
  width: 100%; min-height: 140px; padding: 12px; resize: vertical; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font: inherit; line-height: 1.5;
}
.notes textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgb(29 79 156 / 0.2); }
.notes-meta { display: flex; justify-content: space-between; gap: 12px; margin: 6px 0 0 !important; font-size: var(--step--1); color: var(--slate); }
.notes-meta .at-limit { color: var(--warn); font-weight: 600; }

/* Places */
.places { list-style: none; margin: 0; padding: 0; counter-reset: place; }
.places li { counter-increment: place; display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: baseline; padding: 10px 0; border-bottom: 1px dashed var(--rule); }
.places li:last-child { border-bottom: 0; }
.places li::before { content: counter(place); font-weight: 800; color: var(--slate); font-variant-numeric: tabular-nums; }
.places a { font-weight: 600; color: var(--ink); text-decoration: none; }
.places a:hover { text-decoration: underline; }
.places small { display: block; color: var(--slate); }
.places .dist { color: var(--slate); font-size: var(--step--1); font-variant-numeric: tabular-nums; white-space: nowrap; }

.sights li { grid-template-columns: 22px 56px 1fr auto; align-items: center; }
.sight-img { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; background: var(--rule); display: block; }

/* News */
.news { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.news a { color: var(--ink); font-weight: 500; text-decoration: none; }
.news a:hover { text-decoration: underline; }
.news small { display: block; color: var(--slate); }

/* Holidays */
.holidays { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.holidays li { display: grid; grid-template-columns: 56px 1fr; gap: 12px; align-items: center; }
.hdate { text-align: center; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface); padding: 4px 0; line-height: 1.1; }
.hdate b { display: block; font-size: var(--step-1); font-weight: 800; }
.hdate small { color: var(--slate); font-size: 0.75rem; }
.holidays small { color: var(--slate); }

/* Phrases */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--rule); background: var(--surface); cursor: pointer; font-weight: 500; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip[disabled] { opacity: 0.45; cursor: not-allowed; }
.numbers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.numbers li { background: var(--surface); border: 1px solid var(--rule); border-radius: 6px; padding: 8px 4px; text-align: center; min-width: 0; }
.numbers b { display: block; font-size: var(--step--1); color: var(--slate); font-weight: 600; }
.numbers span { display: block; font-weight: 600; overflow-wrap: anywhere; }
.numbers small, .phrases small { display: block; color: var(--slate); font-size: 0.75rem; overflow-wrap: anywhere; }
.phrases { width: 100%; border-collapse: collapse; }
.phrases th, .phrases td { text-align: left; padding: 10px 0; border-bottom: 1px dashed var(--rule); vertical-align: top; }
.phrases th { font-weight: 500; color: var(--slate); width: 40%; padding-right: 12px; }
.phrases td { font-weight: 600; font-size: var(--step-1); }
.phrases tr:last-child th, .phrases tr:last-child td { border-bottom: 0; }
@media (max-width: 380px) { .numbers { grid-template-columns: repeat(2, 1fr); } }

.detail-actions { display: flex; gap: 10px; justify-content: space-between; padding: 24px 0 8px; }

/* Confirm & toast */
.confirm { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: end center; background: rgb(13 20 36 / 0.5); padding: 16px; padding-bottom: calc(16px + var(--safe-b)); }
.confirm-box { width: min(420px, 100%); background: var(--surface); border-radius: 10px; padding: 20px; display: grid; gap: 14px; }
.confirm-box p { margin: 0; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast {
  position: fixed; z-index: 1100; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 64px);
  background: var(--chrome); color: var(--chrome-ink); box-shadow: 0 4px 14px rgb(0 0 0 / 0.25); padding: 10px 16px; border-radius: 6px; font-size: var(--step--1);
  max-width: calc(100% - 32px);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Checklists */
.cl-intro { margin: 0 0 12px; }
.cl-lists { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cl-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 2px;
  padding-right: 6px; border: 1px solid var(--rule); border-radius: 6px; background: var(--surface);
}
.cl-open { border: 0; background: none; text-align: left; cursor: pointer; padding: 14px 8px 14px 16px; min-width: 0; color: inherit; }
.cl-name { display: block; font-size: var(--step-1); font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.cl-row .icon-btn svg { width: 22px; height: 22px; }
.icon-btn.danger { color: var(--danger); }
.cl-edit-items, .cl-checks { list-style: none; margin: 0; padding: 0; display: grid; }
.cl-edit-items li, .cl-checks li { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--rule); }
.cl-edit-items li.cl-none { border: 0; padding: 8px 0; }
.cl-text {
  flex: 1; min-width: 0; min-height: 44px; padding: 8px 6px; border: 1px solid transparent; border-radius: 4px;
  background: transparent; color: var(--ink); font: inherit;
}
.cl-text:focus { outline: none; border-color: var(--blue); background: var(--surface); }
.cl-edit-items .icon-btn, .cl-checks .icon-btn { flex: none; color: var(--slate); width: 40px; height: 40px; }
.cl-add { margin-top: 10px; }
.cl-add input {
  min-height: 48px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); font: inherit;
}
.cl-add input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgb(29 79 156 / 0.2); }
.cl-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cl-actions .btn svg { width: 20px; height: 20px; }
.cl-pick { margin-bottom: 14px; }
.cl-progress { display: grid; gap: 6px; margin-bottom: 6px; font-weight: 600; }
.cl-progress .ok { color: var(--ok); }
.cl-bar { height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.cl-bar i { display: block; height: 100%; width: 0; background: var(--ok); transition: width 0.2s; }
.cl-check { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 48px; cursor: pointer; overflow-wrap: anywhere; }
.cl-check input { flex: none; width: 22px; height: 22px; accent-color: var(--ok); }
.cl-check input:checked + span { color: var(--slate); text-decoration: line-through; }
.ticket-cl { display: inline-block; margin-top: 4px; font-size: var(--step--1); font-weight: 600; color: var(--warn); }
.ticket-cl.done { color: var(--ok); }
.cl-warn {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 6px 12px 14px; border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--warn) 55%, transparent);
  background: color-mix(in srgb, var(--warn) 12%, var(--surface)); color: var(--ink);
  box-shadow: 0 10px 28px rgb(13 20 36 / 0.25); animation: welcome-in 0.35s ease-out;
}
.cl-warn-icon { flex: none; width: 24px; height: 24px; color: var(--warn); margin-top: 2px; }
.cl-warn-text { flex: 1; min-width: 0; }
.cl-warn-text p { margin: 0 0 4px; }
.cl-warn-title { font-weight: 700; }
.cl-warn-open { border: 0; background: none; padding: 0; color: var(--blue); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; }
.cl-warn-close { flex: none; margin-top: -6px; }

/* Drag to reorder */
.drag-handle {
  flex: none; width: 36px; height: 44px; margin-left: -8px; border: 0; background: none; cursor: grab;
  display: grid; place-items: center; color: var(--slate); touch-action: none;
}
.drag-handle svg { width: 22px; height: 22px; stroke-width: 3.2; }
.drag-handle:focus-visible { outline: 2px solid var(--blue); outline-offset: -4px; border-radius: 6px; }
.sorting li { transition: transform 0.15s ease; }
.sorting { user-select: none; -webkit-user-select: none; }
li.dragging {
  position: relative; z-index: 2; transition: none; background: var(--surface);
  box-shadow: 0 8px 20px rgb(13 20 36 / 0.22); border-radius: 6px;
}
li.dragging .drag-handle { cursor: grabbing; color: var(--ink); }

/* Opening animation */
.splash {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center;
  background: #14213D; color: #fff;
  animation: splash-out 0.4s ease-in 1.7s forwards;
}
.splash::before, .splash::after {
  content: ''; position: absolute; left: 0; right: 0; height: 6px;
  background: #0abaff;
}
.splash::before { top: env(safe-area-inset-top, 0px); }
.splash::after { bottom: env(safe-area-inset-bottom, 0px); }
.splash-inner { display: grid; justify-items: center; }
.splash-mark { width: 104px; height: 136px; overflow: visible; }
.splash-pin { fill: #fff; stroke: none; transform-origin: 80px 188px; animation: splash-drop 0.6s cubic-bezier(.3, 1.5, .5, 1) both; }
.splash-check {
  fill: none; stroke: #0abaff; stroke-width: 15; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 100; stroke-dashoffset: 100; animation: splash-draw 0.4s ease-out 0.55s forwards;
}
.splash-shadow { stroke: none; fill: rgb(0 0 0 / 0.35); transform-origin: 80px 200px; animation: splash-shadow 0.6s ease-out both; }
.splash-word {
  margin: 18px 0 0; font-family: var(--font); font-size: 44px; font-weight: 800; letter-spacing: -0.02em; line-height: 1;
  animation: splash-rise 0.45s ease-out 0.75s both;
}
.splash-word span { color: #0abaff; }
.splash-stripe {
  display: block; width: 150px; height: 6px; margin-top: 14px; border-radius: 3px; transform-origin: left;
  background: #0abaff;
  animation: splash-grow 0.45s ease-out 1s both;
}
@keyframes splash-drop { from { transform: translateY(-90px) scale(0.9); opacity: 0; } 60% { opacity: 1; } to { transform: none; opacity: 1; } }
@keyframes splash-shadow { from { transform: scale(0.2); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes splash-draw { to { stroke-dashoffset: 0; } }
@keyframes splash-rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes splash-grow { from { transform: scaleX(0); } to { transform: none; } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  .splash-check { stroke-dashoffset: 0; } /* animations are off: show the finished logo */
}

.plug-older-title { margin: 14px 0 6px; font-weight: 600; color: var(--slate); font-size: var(--step--1); }
.plugs-older .plug { opacity: 0.85; }

/* Past trips: "Show on map" switch under the ticket */
.has-map-toggle .ticket { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.ticket-map {
  display: flex; align-items: center; justify-content: flex-end; gap: 10px; min-height: 44px;
  padding: 4px 16px; margin-top: -1px; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 0 0 6px 6px; background: var(--surface);
  font-size: var(--step--1); font-weight: 600; color: var(--slate);
}
.ticket-map input {
  appearance: none; -webkit-appearance: none; margin: 0; order: 2; flex: none; cursor: pointer;
  width: 40px; height: 24px; border-radius: 12px; background: var(--rule); position: relative; transition: background 0.15s;
}
.ticket-map input::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform 0.15s;
}
.ticket-map input:checked { background: var(--brand); }
.ticket-map input:checked::after { transform: translateX(16px); }
.ticket-map input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.ticket-map:has(input:checked) { color: var(--ink); }

.cl-order { margin: 10px 0 4px; }
.cl-order .segmented span { min-height: 40px; font-size: var(--step--1); padding: 0 8px; text-align: center; }

/* Prepvoy logo, centred in every top bar (same mark and wordmark as the opening animation) */
.appbar, .sheet-head { position: relative; }
.brand {
  position: absolute; left: 50%; bottom: 0; height: 52px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px; line-height: 1; pointer-events: none;
}
.sheet-head .brand { height: 56px; color: var(--ink); }
.brand-mark { width: 22px; height: 30px; display: block; }
.brand-word { font-weight: 800; font-size: 24px; letter-spacing: -0.02em; }
.brand-word span { color: var(--brand); }
/* On the navy bars (main bar and trip card) the logo is white, as on the splash screen. */
.appbar .brand, .sheet-head.detail-bar .brand { color: #fff; }
/* The main bar shows the help button and the logo; the page title is for screen readers (the tabs show the page). */
/* Page headers: close button and logo on the bar, the page title on its own line below. */
.sheet-head:not(.detail-bar) { flex-wrap: wrap; padding-bottom: 8px; }
.sheet-head:not(.detail-bar) h2 { order: 3; flex-basis: 100%; padding: 2px 8px 0; font-size: var(--step-2); font-weight: 800; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.sheet-head .brand { top: var(--safe-t); bottom: auto; }
@media (max-width: 360px) { .brand-word { font-size: 20px; } }

/* ---------- Built-in help: "?" button, rings and speech bubbles ---------- */
.help-btn[aria-pressed="true"] { background: var(--brand); color: #14213d; border-radius: 50%; }
.appbar .help-btn { margin-left: -8px; }
.appbar { justify-content: flex-start; }
.appbar-actions { margin-left: auto; }
.help-layer { position: fixed; inset: 0; z-index: 3000; pointer-events: none; }
.help-ring {
  position: fixed; border: 2px solid var(--brand); border-radius: 8px; pointer-events: none;
  box-shadow: 0 0 0 3px rgb(10 186 255 / 0.25);
}
.help-bubble {
  position: fixed; max-width: min(230px, calc(100vw - 16px)); padding: 9px 12px; border-radius: 10px;
  background: var(--brand); color: #14213d; font-size: 14px; font-weight: 500; line-height: 1.35;
  box-shadow: 0 6px 18px rgb(13 20 36 / 0.3); animation: help-in 0.18s ease-out;
}
.help-bubble.up::before, .help-bubble.down::before {
  content: ''; position: absolute; left: calc(var(--ax) - 8px); width: 0; height: 0;
  border: 8px solid transparent;
}
.help-bubble.up::before { top: -16px; border-bottom-color: var(--brand); }
.help-bubble.left::before, .help-bubble.right::before {
  content: ''; position: absolute; top: calc(var(--ay) - 8px); width: 0; height: 0; border: 8px solid transparent;
}
.help-bubble.left::before { right: -16px; border-left-color: var(--brand); }
.help-bubble.right::before { left: -16px; border-right-color: var(--brand); }
.help-leader { position: fixed; width: 2px; background: var(--brand); pointer-events: none; }
body.help-open .map-hint { visibility: hidden; }
.help-bubble.down::before { bottom: -16px; border-top-color: var(--brand); }
.help-close {
  position: fixed; left: 12px; bottom: calc(16px + var(--safe-b)); pointer-events: auto;
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px; cursor: pointer;
  background: #14213d; color: #fff; font: inherit; font-weight: 600; box-shadow: 0 6px 18px rgb(13 20 36 / 0.35);
}
.help-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; }
@keyframes help-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.detail-bar { justify-content: flex-start; }
.detail-bar [data-refresh] { margin-left: auto; }

.help-badge {
  position: fixed; width: 24px; height: 24px; padding: 0; border-radius: 50%; border: 2px solid #fff; pointer-events: auto; cursor: pointer;
  background: var(--brand); color: #14213d; font: 800 14px/20px var(--font); text-align: center; box-shadow: 0 2px 6px rgb(13 20 36 / 0.35);
}
.help-badge::after { content: ''; position: absolute; inset: -10px; } /* bigger tap area */
.help-bubble.focused { box-shadow: 0 0 0 3px #fff, 0 6px 18px rgb(13 20 36 / 0.35); }
