/* Europe 2026 trip tracker — mobile-first, light/dark theme aware.
   Chart + status colors follow the validated dataviz reference palette. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;        /* series slot 1 */
  --accent-soft: #86b6ef;   /* blue step 250 — budget track (ordinal-safe on light) */
  --accent-wash: rgba(42, 120, 214, 0.10);
  /* Brand — Voyage Navy + Champagne (see BRAND.md). Identity chrome only;
     charts and status colors stay on the dataviz palette above. */
  --brand: #0b1f33;
  --brand-hover: #16324d;
  --on-brand: #f7f1e3;
  --brand-wash: rgba(196, 162, 101, 0.14);
  --gold: #8c6d33;          /* champagne deepened for AA text on ivory */
  --gold-bright: #c4a265;   /* graphic champagne — the mark's stroke */
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-text: #006300;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 8px 24px -12px rgba(11, 11, 11, 0.12);
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --accent: #3987e5;
    --accent-soft: #184f95;  /* blue step 600 — ordinal-safe on dark */
    --accent-wash: rgba(57, 135, 229, 0.12);
    --brand: #c4a265;        /* navy/champagne invert in the dark */
    --brand-hover: #d6bc8a;
    --on-brand: #101d2c;
    --brand-wash: rgba(196, 162, 101, 0.16);
    --gold: #d6bc8a;
    --gold-bright: #c4a265;
    --good-text: #0ca30c;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --accent: #3987e5;
  --accent-soft: #184f95;
  --accent-wash: rgba(57, 135, 229, 0.12);
  --brand: #c4a265;
  --brand-hover: #d6bc8a;
  --on-brand: #101d2c;
  --brand-wash: rgba(196, 162, 101, 0.16);
  --gold: #d6bc8a;
  --gold-bright: #c4a265;
  --good-text: #0ca30c;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px calc(24px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0 10px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(11, 31, 51, 0.12);
  text-decoration: none;
}
.brand-mark img {
  width: 44px; height: 44px;
  display: block;
}
.brand-title {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(20px, 4.5vw, 28px);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-title em { font-style: italic; color: #C4A265; }
.brand-sub { margin: 0; font-size: 13px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.countdown-chip {
  background: var(--brand-wash);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  white-space: nowrap;
}
.theme-toggle {
  width: 40px; height: 40px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 18px;
  cursor: pointer;
}
/* One-click trip switcher (top row, inside the top bar) */
.trip-pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
  padding: 2px 0;
}
@media (max-width: 899px) {
  .trip-pills { order: 3; flex-basis: 100%; justify-content: flex-start; }
}
.trip-pills::-webkit-scrollbar { display: none; }
.pill {
  flex: none;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 9px 16px;
  min-height: 40px;
  font: 600 14px system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
}
.pill.active { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.pill.ghost { padding: 9px 13px; color: var(--muted); }

/* ---------- Section tabs (second row, horizontal scroll on phones) ---------- */
.topbar { flex-wrap: wrap; }
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 10px 0 2px;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 9px 14px;
  min-height: 40px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
}
.tabs a:hover { text-decoration: none; background: var(--brand-wash); }
.tabs a.active { background: var(--brand); color: var(--on-brand); }
.tab-icon { font-size: 14px; }

/* ---------- Sign-in (auth.js) ---------- */
.auth-overlay {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: var(--page);
  padding: 16px;
}
.auth-card {
  width: 100%; max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex; flex-direction: column; gap: 10px;
}
.auth-card h3 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-card h3 img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.auth-card .sub { margin: 0 0 6px; font-size: 14px; color: var(--muted); }
.auth-input {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--page);
  color: var(--ink);
  font: inherit;
}
.auth-btn {
  padding: 11px 16px; min-height: 44px;
  border-radius: 999px; border: none;
  background: var(--brand); color: var(--on-brand);
  font: 600 15px system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
}
.auth-btn:hover { background: var(--brand-hover); }
.auth-btn.ghost { background: var(--brand-wash); color: var(--ink); border: 1px solid var(--border); }
.auth-btn.ghost:hover { background: var(--brand-wash); border-color: var(--gold-bright); }
.tagline { font-family: "Fraunces", Georgia, serif; font-style: italic; color: var(--gold); }
.auth-link {
  background: none; border: none; padding: 6px;
  color: var(--muted); font: 500 13px system-ui, -apple-system, "Segoe UI", sans-serif;
  cursor: pointer;
}
.auth-error { margin: 0; font-size: 13px; color: var(--critical); }
.auth-legal { margin: 4px 0 0; font-size: 12px; color: var(--muted); }
.auth-legal a { color: var(--gold); }
.auth-btn.danger { background: transparent; color: var(--critical); border: 1px solid var(--critical); }
.pk-list { display: flex; flex-direction: column; gap: 6px; }
.pk-row { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }

/* ---------- Account / admin ---------- */
.account-card { max-width: 560px; }
.account-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.avatar {
  width: 48px; height: 48px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--brand); color: var(--on-brand);
  font: 600 20px "Fraunces", Georgia, serif;
}
.account-actions { display: flex; flex-direction: column; gap: 10px; }
.account-actions .auth-btn { text-align: center; }
.field-row { display: flex; gap: 8px; }
.field-row .auth-input { flex: 1; }
.admin-actions a { color: var(--gold); text-decoration: none; }
.admin-actions a.danger { color: var(--critical); }

/* ---------- Layout primitives ---------- */
.view { padding-top: 20px; outline: none; }
.section-title {
  font-family: "Fraunces", Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  margin: 4px 0 14px;
}
/* Champagne horizon stroke — echoes the underline in the mark. */
.section-title::after {
  content: "";
  display: block;
  width: 44px; height: 2px;
  margin-top: 6px;
  border-radius: 2px;
  background: var(--gold-bright);
  opacity: 0.85;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.card + .card { margin-top: 16px; }
.card h3 { margin: 0 0 4px; font-size: 16px; }
.card .sub { margin: 0 0 12px; font-size: 13px; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.grid-tiles { grid-template-columns: repeat(2, 1fr); }
.grid-main { grid-template-columns: 1fr; }

/* iPad and up */
@media (min-width: 700px) {
  .grid-tiles { grid-template-columns: repeat(4, 1fr); }
}
/* Desktop / iPad landscape */
@media (min-width: 1024px) {
  .grid-main { grid-template-columns: 3fr 2fr; align-items: start; }
}

/* ---------- Stat tiles ---------- */
.tile { padding: 14px 16px; }
.tile .label { font-size: 13px; color: var(--ink-2); }
.tile .value { font-size: clamp(24px, 5vw, 32px); font-weight: 600; line-height: 1.15; margin-top: 2px; }
.tile .delta { font-size: 13px; margin-top: 2px; color: var(--muted); }
.tile .delta.good { color: var(--good-text); }
.tile .delta.bad { color: var(--critical); }

/* ---------- Meter ---------- */
.meter { height: 10px; border-radius: 999px; background: var(--accent-wash); overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--accent); }

/* ---------- Chart ---------- */
.chart-wrap { overflow-x: auto; }
.chart-svg { display: block; width: 100%; height: auto; font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 10px; font-size: 13px; color: var(--ink-2); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.tooltip {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 8px 11px;
  font-size: 13px;
  max-width: 260px;
}
.tooltip.show { opacity: 1; }
.tooltip .t-title { font-weight: 600; margin-bottom: 2px; }
.tooltip .t-row { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); }
.tooltip .t-row b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- Timeline (itinerary) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before {
  content: "";
  position: absolute;
  left: 7px; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--grid);
  border-radius: 2px;
}
.timeline li { position: relative; padding: 0 0 18px 30px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .dot {
  position: absolute; left: 0; top: 5px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.timeline .when { font-size: 12.5px; color: var(--muted); }
.timeline .what { font-weight: 600; }
.timeline .where { font-size: 14px; color: var(--ink-2); }

/* ---------- Data tables → cards on phones ---------- */
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--baseline);
}
table.data td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--grid);
  vertical-align: top;
}
table.data tr:last-child td { border-bottom: none; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--muted); }

/* Phone: rows become stacked cards */
@media (max-width: 599px) {
  table.data, table.data tbody, table.data tr, table.data td { display: block; width: 100%; }
  table.data thead { display: none; }
  table.data tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 10px;
    padding: 6px 2px;
    background: var(--surface);
  }
  table.data td { border-bottom: none; padding: 5px 12px; }
  table.data td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
  }
  table.data .num { text-align: left; }
}

/* ---------- Status chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.chip::before { font-size: 11px; }
.chip.confirmed { color: var(--good-text); }
.chip.confirmed::before { content: "✓"; }
.chip.pending { color: var(--ink-2); }
.chip.pending::before { content: "…"; }
.chip.action { color: var(--critical); }
.chip.action::before { content: "!"; }
.chip.email { color: var(--accent); }
.chip.email::before { content: "✉"; }

/* ---------- City header cards ---------- */
.city-band {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.city-band h3 { font-family: "Fraunces", Georgia, serif; font-size: 19px; }
.city-band .nights { font-size: 13px; color: var(--muted); }

/* ---------- Month calendar ---------- */
.cal-month { margin-top: 14px; }
.cal-month h4 { margin: 0 0 8px; font-family: "Fraunces", Georgia, serif; font-size: 16px; }
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head span { text-align: center; font-size: 11px; color: var(--muted); padding: 2px 0; }
.cal-day {
  min-height: 52px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 2px 4px;
  cursor: pointer;
}
.cal-day:disabled { cursor: default; opacity: 0.55; }
.cal-day.blank { border: none; cursor: default; }
.cal-day.in-trip { color: var(--ink); background: var(--surface); border-color: var(--border); }
.cal-day.stay { background: var(--accent-wash); }
.cal-day.today { border-color: var(--accent); border-width: 2px; }
.cal-num { font-size: 12.5px; font-weight: 600; line-height: 1; }
.cal-icons { font-size: 11px; line-height: 1.2; letter-spacing: -1px; min-height: 13px; }
@media (max-width: 420px) { .cal-day { min-height: 46px; } .cal-icons { font-size: 10px; } }

/* ---------- Seat map ---------- */
.seatrow { display: flex; align-items: flex-end; gap: 5px; margin-top: 12px; flex-wrap: wrap; }
.seat {
  width: 38px; height: 38px;
  border-radius: 10px 10px 5px 5px; /* seat-back silhouette */
  border: 1px solid var(--baseline);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  color: var(--muted);
  background: var(--page);
}
.seat.mine { background: var(--accent); color: #fff; border-color: var(--accent); }
.seat-aisle { width: 18px; text-align: center; color: var(--muted); font-size: 10px; letter-spacing: 0.05em; }
.seat-owners { margin: 8px 0 0; font-size: 13px; color: var(--ink-2); }
.seat-layout-name { font-size: 12px; color: var(--muted); margin-top: 6px; }
.verdict { float: right; }
@media (max-width: 380px) { .seat { width: 32px; height: 32px; } }

.footer { margin-top: 36px; padding: 16px 4px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }

.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* Larger touch targets & no hover-dependence on touch devices */
@media (pointer: coarse) {
  .tabs a { padding: 11px 16px; }
}

/* Company logos in place of emoji icons (favicons, hosted in img/logos/) */
.evlogo {
  width: 18px; height: 18px;
  border-radius: 4px;
  vertical-align: -3px;
  margin-right: 2px;
  object-fit: contain;
  background: #fff; /* favicons with transparency stay legible in dark mode */
}
h3 .evlogo { width: 20px; height: 20px; vertical-align: -3px; }
