:root {
  color-scheme: light dark;
  --bg: #f4f7f9;
  --surface: #ffffff;
  --fg: #12262f;
  --muted: #5f7280;
  --border: #dfe7ec;
  --accent: #0e7c86;
  --accent-dark: #0a606a;
  --accent-2: #12262f;
  --soldout-bg: #fbe9e7;
  --soldout-fg: #b3261e;
  --up: #c62828;
  --down: #1e7d47;
  --up-rgb: 198, 40, 40;
  --down-rgb: 30, 125, 71;
  --row-hover: #eaf3f5;
  --shadow: 0 1px 3px rgba(13, 42, 53, 0.08), 0 1px 2px rgba(13, 42, 53, 0.05);
  --header-grad: linear-gradient(150deg, #052632 0%, #0a3d4d 60%, #0e5262 100%);
  --header-trim: #2fbdc9;
}
:root[data-theme="dark"] {
  --bg: #0b1518;
  --surface: #102027;
  --fg: #e4edf0;
  --muted: #8ba3ad;
  --border: #1e3138;
  --accent: #3fc1c9;
  --accent-dark: #2fa9b1;
  --accent-2: #cfe8ec;
  --soldout-bg: #3a1a1a;
  --soldout-fg: #ff8a80;
  --up: #ff8a80;
  --down: #6bdb8e;
  --up-rgb: 255, 138, 128;
  --down-rgb: 107, 219, 142;
  --row-hover: #14262e;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --header-grad: linear-gradient(150deg, #03141b 0%, #072a36 60%, #0a3e44 100%);
  --header-trim: #3fc1c9;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1518;
    --surface: #102027;
    --fg: #e4edf0;
    --muted: #8ba3ad;
    --border: #1e3138;
    --accent: #3fc1c9;
    --accent-dark: #2fa9b1;
    --accent-2: #cfe8ec;
    --soldout-bg: #3a1a1a;
    --soldout-fg: #ff8a80;
    --up: #ff8a80;
    --down: #6bdb8e;
    --up-rgb: 255, 138, 128;
    --down-rgb: 107, 219, 142;
    --row-hover: #14262e;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
    --header-grad: linear-gradient(150deg, #03141b 0%, #072a36 60%, #0a3e44 100%);
    --header-trim: #3fc1c9;
  }
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
}

/* ---------- Header ---------- */
/* Compact single-row header: brand on the left, tabs in the middle, tools on
   the right. The old header was 3.2rem type with 52px of bottom padding, which
   pushed the actual content a long way down the page. */
header.hero {
  background: var(--header-grad);
  color: #e8f1f4;
  padding: 0 20px;
  border-bottom: 3px solid var(--header-trim);
  position: relative;
}
header.hero .hero-inner {
  max-width: 1150px;
  margin: 0 auto;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

/* Brand */
header.hero .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  flex-shrink: 0;
}
header.hero .brand .logo-mark { width: 28px; height: 28px; flex-shrink: 0; }
header.hero .brand-text {
  font-family: "Outfit", -apple-system, "Segoe UI", sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(100deg, #ffffff 30%, #7adde5 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #ffffff;
}

/* Tabs */
header.hero .tabs { display: flex; gap: 2px; flex: 1; }
header.hero .tab {
  display: block;
  padding: 18px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #a9ccd6;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: color 0.15s, border-color 0.15s;
}
header.hero .tab:hover { color: #fff; }
header.hero .tab.active { color: #fff; border-bottom-color: var(--header-trim); }

/* Right-hand tools */
header.hero .hero-tools { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
header.hero .tagline {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 2px;
}
header.hero .meta {
  font-size: 0.82rem;
  opacity: 0.85;
  text-align: right;
  color: #a9ccd6;
}

main { padding: 20px; max-width: 1150px; margin: 0 auto; }

/* ---------- Stat cards ---------- */
/* Collapsible section bars (Overview / Filters accordions) */
.toggle-row {
  display: flex; gap: 12px; flex-wrap: wrap;
  width: calc(100% - 40px); max-width: 1110px; box-sizing: border-box;
  margin: 12px auto 14px;
}
.section-bar {
  display: flex; align-items: center; justify-content: space-between;
  box-sizing: border-box;
  padding: 11px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  color: var(--fg); font-size: 0.9rem; font-weight: 700; font-family: inherit;
  cursor: pointer; text-align: left;
}
.section-bar.half { flex: 1 1 260px; min-width: 0; }
.section-bar:hover { border-color: var(--accent); }
.section-bar-sub { font-weight: 500; font-size: 0.76rem; color: var(--muted); margin-left: 8px; }
@media (max-width: 700px) {
  .section-bar-sub { display: none; }
  .toggle-row { gap: 8px; }
}
.filters-badge {
  background: var(--accent); color: #fff; font-size: 0.7rem; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; margin-left: 6px; vertical-align: 1px;
}
.filters-reset {
  font-size: 0.75rem; font-weight: 600; color: var(--accent-dark);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px;
  margin-right: 8px;
}
.filters-reset:hover { border-color: var(--accent); background: var(--row-hover); }
.section-bar .chev { display: inline-block; transition: transform 0.15s; color: var(--muted); font-size: 1rem; }
.section-bar.collapsed .chev { transform: rotate(-90deg); }
body.overview-collapsed .overview-panel { display: none; }
body.filters-collapsed .controls-top,
body.filters-collapsed #when-mode-toggle,
body.filters-collapsed #when-panel,
body.filters-collapsed .controls-route,
body.filters-collapsed .controls-cabin-price,
body.filters-collapsed .controls-quick { display: none; }

/* Nights range inputs */
#nights-min, #nights-max { width: 62px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--fg); font-size: 0.85rem; }
.range-dash { color: var(--muted); }

/* Deals + stats + pulse: one continuous dark panel (matches header) */
.overview-panel {
  background: var(--header-grad);
  border-bottom: 2px solid var(--header-trim);
  padding: 18px 0;
}

/* Market pulse strip */
.pulse { max-width: 1150px; margin: 0 auto; padding: 0 20px; box-sizing: border-box; }
.pulse-title { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #a9ccd6; margin: 14px 0 8px; }
.pulse-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.pulse-card { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.22); border-radius: 10px; padding: 10px 14px; }
.pulse-card.pulse-down { border-left: 4px solid #6bdb8e; }
.pulse-card.pulse-up { border-left: 4px solid #ff8a80; }
.pulse-line { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: #a9ccd6; margin-bottom: 3px; }
.pulse-main { font-weight: 700; font-size: 0.98rem; color: #ffffff; }
.pulse-main.muted-pulse { color: #a9ccd6; font-weight: 500; font-size: 0.85rem; }
.pulse-sailings { color: #a9ccd6; font-weight: 500; font-size: 0.8rem; margin-left: 4px; }
.pulse-sub { font-size: 0.78rem; color: #a9ccd6; margin-top: 2px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 auto 18px;
  padding: 0 20px;
  max-width: 1150px;
  position: relative;
  z-index: 2;
  box-sizing: border-box;
}
.stat-card {
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.22);
  min-width: 0; /* let the card shrink below its content's natural width, so
                   the sub-small text below can actually truncate with an
                   ellipsis instead of forcing the grid to overflow */
  overflow: hidden;
}
.stat-card.clickable { cursor: default; transition: border-color 0.15s ease, box-shadow 0.15s ease; }
.stat-card.clickable:hover { border-color: var(--header-trim); }
.stat-card.active { border-color: var(--header-trim); box-shadow: 0 0 0 2px var(--header-trim) inset; }
.stat-card .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: #a9ccd6; display: flex; align-items: center; gap: 6px; }
.stat-card .label .pin { color: #7adde5; font-size: 0.85em; text-transform: none; letter-spacing: 0; }
.stat-card .value { font-size: 1.4rem; font-weight: 700; margin-top: 2px; color: #ffffff; }
.stat-card .value.accent { color: #7adde5; }
.stat-card .sub-small { font-size: 0.76rem; color: #a9ccd6; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card .stat-actions { margin-top: 8px; font-size: 0.76rem; color: #a9ccd6; }
.stat-card .link-like { color: #7adde5; cursor: pointer; font-weight: 600; }
.stat-card .link-like:hover { text-decoration: underline; }

/* ---------- Pill/bubble toggle buttons ---------- */
.pill-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.85rem; font-weight: 600; font-family: inherit;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); color: var(--muted);
  border: 1.5px solid var(--border);
  cursor: pointer; transition: all 0.15s ease;
}
.pill:hover { border-color: var(--accent); color: var(--fg); }
.pill.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.pill.active:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.pill .line-logo { width: 18px; height: 18px; }

.line-pill {
  width: 56px; height: 56px; padding: 8px;
  border-radius: 14px; justify-content: center;
}
/* Keep a light background even when active so the logos stay visible */
.line-pill.active {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent) inset;
}
.line-pill.active:hover { background: var(--row-hover); border-color: var(--accent-dark); }
.line-pill:not(.active) { opacity: 0.35; filter: grayscale(0.8); }
.line-pill .line-logo { width: 100%; height: 100%; }
button.tiny { padding: 4px 9px; font-size: 0.76rem; }

.sub-controls { margin-top: -6px; }
.controls-cabin-price { margin-top: 0; }
.controls-quick { margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--border); }

/* Favourites + result count: always visible, sits right above the table
   regardless of whether the Filters section is expanded or collapsed. */
.controls-footer {
  max-width: 1150px; margin: 8px auto 14px; padding: 10px 20px 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border-top: 1px dashed var(--border);
}
.controls-footer #count-meta { margin-left: auto; }
.controls-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Cabin pills: visually distinct (smaller, cooler neutral tone) from the
   line/availability pills, so the two groups read as separate concerns. */
.cabin-pill {
  padding: 5px 11px; font-size: 0.8rem;
  background: transparent; border-color: var(--border); color: var(--muted);
}
.cabin-pill.active {
  background: var(--fg); color: var(--surface); border-color: var(--fg);
}
.cabin-pill.active:hover { background: var(--fg); opacity: 0.85; }

/* ---------- "When" date panel ---------- */
.when-panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 16px; margin: -2px 0 14px; display: flex; flex-direction: column; gap: 12px;
  box-shadow: var(--shadow);
}
.when-panel[hidden] { display: none !important; }
.when-mode-body { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 0.85rem; }
.when-mode-body label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.when-mode-body input[type="date"], .when-mode-body input[type="number"] {
  font-size: 0.85rem; padding: 6px 10px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg);
}
.tiny-pill { padding: 4px 10px; font-size: 0.76rem; }

/* Segmented Total / Per-night toggle */
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { background: var(--surface); color: var(--fg); border: none; border-radius: 0; padding: 6px 12px; font-size: 0.82rem; font-weight: 600; }
.seg-btn:hover { background: var(--row-hover); }
.seg-btn.active { background: var(--accent); color: #fff; }
.seg-btn.active:hover { background: var(--accent); }
.total-sub { color: var(--muted); font-size: 0.82em; }

/* Crossed-out plane = no flights needed (Southampton round trip) */
.no-fly { position: relative; display: inline-block; color: var(--accent-dark); font-size: 0.95em; }
.no-fly::after {
  content: ''; position: absolute; left: -2px; right: -2px; top: 50%;
  height: 2px; background: var(--soldout-fg); transform: rotate(-20deg); border-radius: 2px;
}

/* ---------- Inline-expanding itinerary row ---------- */
.data-row .expand-caret { display: inline-block; width: 12px; color: var(--muted); font-size: 0.8em; }
.data-row.expanded { background: var(--row-hover); font-weight: 600; }
.expand-row > td { padding: 0; background: var(--row-hover); }
.expand-box { padding: 16px; }
.expand-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 18px; align-items: start; }
.expand-map { height: 320px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); z-index: 0; }
.map-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 0.85rem; background: var(--surface); }
.expand-head { font-size: 0.95rem; margin-bottom: 8px; }
.expand-prices { font-size: 0.85rem; margin-bottom: 12px; }
.stops-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 6px; }
.stops-list { list-style: none; margin: 0 0 12px; padding: 0; }
.stops-list .stop { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 0.88rem; position: relative; }
.stops-list .stop-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex-shrink: 0; display: inline-block; }
.stops-list .stop.sea .stop-dot { background: none; width: auto; height: auto; }
.stops-list .stop.sea { color: var(--muted); }
.stops-list .stop-country { color: var(--muted); font-size: 0.82em; }
.detail-link { font-weight: 600; font-size: 0.88rem; }

@media (max-width: 760px) {
  .expand-grid { grid-template-columns: 1fr; }
  .expand-map { height: 240px; }
}

/* Hide cabin columns when their toggle is off */
table.hide-cc-inside .cc-inside,
table.hide-cc-seaview .cc-seaview,
table.hide-cc-balcony .cc-balcony,
table.hide-cc-suite .cc-suite { display: none; }

/* ---------- Hero right / refresh-all ---------- */
.hero-right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
#refresh-all-btn { background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.35); }
#refresh-all-btn:hover { background: rgba(255,255,255,0.28); }
header.hero input.hero-search {
  width: 220px; max-width: 100%; box-sizing: border-box;
  padding: 7px 12px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12); color: #fff; font-size: 0.85rem;
}
header.hero input.hero-search::placeholder { color: rgba(255,255,255,0.65); }
header.hero input.hero-search:focus { outline: none; border-color: var(--header-trim); background: rgba(255,255,255,0.18); }

/* ---------- Refresh progress bar ---------- */
.refresh-progress { background: var(--surface); border-bottom: 1px solid var(--border); }
.refresh-progress-inner { max-width: 1150px; margin: 0 auto; padding: 10px 20px; }
.bar-track { height: 8px; background: var(--border); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.4s ease; }
.refresh-label { font-size: 0.85rem; font-weight: 600; color: var(--fg); margin-top: 6px; }

/* ---------- Controls ---------- */
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.controls-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  max-width: 1150px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
}
.controls-route {
  max-width: 1150px;
  margin-left: auto;
  margin-right: auto;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr auto 1fr;
  gap: 12px 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.controls-cabin-price {
  max-width: 1150px;
  margin-left: auto;
  margin-right: auto;
  padding: 14px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto auto;
  gap: 12px 8px;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
}
.controls-quick {
  max-width: 1150px;
  margin-left: auto;
  margin-right: auto;
  padding: 12px 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
@media (max-width: 900px) {
  .controls-route {
    grid-template-columns: auto 1fr;
  }
  .controls-cabin-price {
    grid-template-columns: auto 1fr;
  }
}
select, input[type="text"] {
  font-size: 0.88rem;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
}
input[type="text"] { flex: 1; min-width: 160px; }
button {
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 0.88rem;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.15s ease;
}
button:hover { background: var(--accent-dark); }
button:disabled { opacity: 0.6; cursor: default; }
button.ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--border);
}
button.ghost:hover { background: var(--row-hover); }

/* ---------- Table ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  -webkit-overflow-scrolling: touch;
}
table { border-collapse: collapse; table-layout: fixed; width: 100%; font-size: 0.87rem; }
th, td { padding: 10px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border); overflow: hidden; }
.price-up { color: #d64541; }   /* dearer = red */
.price-down { color: #2e9e44; } /* cheaper = green */
.chg-arrow { font-size: 0.7em; }

.cell-inner { display: flex; align-items: center; gap: 10px; height: 40px; }
.cell-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
  line-height: 1.25;
}
th {
  position: sticky; top: 0;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
th:hover { color: var(--fg); }
th .arrow { opacity: 0.6; margin-left: 3px; }
tbody tr { cursor: pointer; transition: background 0.1s ease; }
tbody tr:hover { background: var(--row-hover); }
tbody tr:nth-child(even) { background: rgba(127, 127, 127, 0.035); }
tbody tr:nth-child(even):hover { background: var(--row-hover); }

.line-logo { width: 32px; height: 32px; object-fit: contain; flex-shrink: 0; }
.sailing-card .name { display: flex; align-items: center; gap: 9px; }
.sailing-card .name .line-logo { width: 28px; height: 28px; }
.line-check .line-logo { width: 22px; height: 22px; }

.cabin-cell { display: flex; align-items: center; gap: 5px; font-variant-numeric: tabular-nums; }
.cabin-cell .icon { opacity: 0.7; font-size: 0.9em; }
.soldout-pill {
  display: inline-block;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 1px;
  font-weight: 400;
}
.line-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
}
.line-badge.po { background: #0a4d70; }
.line-badge.rc { background: #0e7c66; }
.line-badge.msc { background: #00296b; }
.line-badge.cunard { background: #8b1a1a; }
.line-badge.ncl { background: #0a84bd; }

/* ---------- Mobile card list (replaces the table on small screens) ---------- */
.mobile-cards { display: none; }
.sailing-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 10px;
}
.sailing-card .row1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.sailing-card .name { font-weight: 700; font-size: 0.95rem; }
.sailing-card .sub { font-size: 0.78rem; color: var(--muted); margin-bottom: 8px; }
.sailing-card .cabins { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 12px; }
.sailing-card .cabin-line { display: flex; justify-content: space-between; font-size: 0.85rem; }
.sailing-card .cabin-line .cat { color: var(--muted); }
.sailing-card .checked { font-size: 0.72rem; color: var(--muted); margin-top: 8px; text-align: right; }
.sailing-card.expanded { border-color: var(--accent); }
.card-caret { color: var(--muted); font-size: 0.85em; }
.card-expand { background: var(--surface); border: 1px solid var(--border); border-top: none; border-radius: 0 0 12px 12px; margin: -10px 0 10px; padding: 14px; }

/* Table needs real desktop width for all cabin columns to be visible at once
   without horizontal scrolling — switch to the card layout for iPad portrait
   too (iPad landscape, 1024px+, still gets the full table). */
@media (max-width: 900px) {
  .table-wrap { display: none; }
  .mobile-cards { display: block; }
}

@media (max-width: 760px) {
  main { padding: 16px 14px; }
  .stats { margin: 0 auto 16px; padding: 0 14px; grid-template-columns: repeat(2, 1fr); }
  .deals-banner, .pulse { padding-left: 14px; padding-right: 14px; }
  header.hero { padding: 18px 16px 40px; }
  header.hero h1 { font-size: 2.4rem; }
  header.hero .hero-inner { flex-direction: column; align-items: flex-start; }
  header.hero .meta { text-align: left; }
  .hero-right { align-items: flex-start; width: 100%; margin-top: 10px; }
  #refresh-all-btn { width: 100%; display: flex; align-items: center; justify-content: center; }
  header.hero input.hero-search { width: 100%; }
  .controls { flex-direction: column; align-items: stretch; }
  .controls select, .controls input[type="text"] { width: 100%; }
  .cabin-grid { grid-template-columns: repeat(2, 1fr); margin: -20px 14px 16px; }
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* ---------- Links / misc ---------- */
a { color: var(--accent-dark); text-decoration: none; }
.back { display: inline-flex; align-items: center; gap: 5px; margin-bottom: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.ref-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: rgba(255,255,255,0.18); padding: 1px 7px; border-radius: 5px; font-weight: 600; }

/* ---------- Sailing detail page ---------- */
.detail-hero {
  background: var(--header-grad);
  color: #e8f1f4;
  padding: 18px 20px 24px;
  border-bottom: 3px solid var(--header-trim);
}
.detail-hero .detail-inner { max-width: 1000px; margin: 0 auto; }
.detail-hero a.back { color: #a9ccd6; opacity: 0.95; }
.detail-hero h1 { margin: 10px 0 4px; font-size: 1.4rem; font-family: "Outfit", -apple-system, "Segoe UI", sans-serif; font-weight: 600; color: #ffffff; }
.detail-hero .sub { font-size: 0.85rem; opacity: 0.85; color: #a9ccd6; }
.detail-hero button#refresh-btn {
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.35);
  margin-top: 12px;
}
.detail-hero button#refresh-btn:hover { background: rgba(255,255,255,0.28); }
.detail-hero h1 .fave-btn { color: #a9ccd6; font-size: 1.15rem; vertical-align: middle; }
.detail-hero h1 .fave-btn:hover { color: #ffd76a; }
.detail-hero h1 .fave-btn.starred { color: #ffd76a; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.detail-badges .pill { background: rgba(255,255,255,0.16); border-color: rgba(255,255,255,0.3); color: #e8f1f4; cursor: default; }

/* Sailing detail page sections */
.sailing-sections {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 20px;
}
.sailing-sections section { border-top: 1px solid var(--border); padding-top: 24px; }
.section-header {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.sailing-sections h3 { margin-top: 20px; margin-bottom: 12px; font-size: 1rem; color: var(--fg); }

.cabin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 18px 0;
  max-width: 100%;
}
.cabin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.cabin-card .cat { font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.cabin-card .price { font-size: 1.35rem; font-weight: 700; margin-top: 4px; }
.cabin-card .price .pp { font-size: 0.6em; color: var(--muted); font-weight: 500; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin: 10px 0 14px; font-size: 0.85rem; }
.legend span.swatch { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; }

.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.hist-table { margin-top: 10px; background: var(--surface); border-radius: 12px; overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow); }
.delta-up { color: var(--up); font-weight: 600; }
.delta-down { color: var(--down); font-weight: 600; }

h2 { font-size: 1.05rem; margin: 26px 0 8px; }

/* ---------- Hero nav links ---------- */
.hero-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.hero-nav-link {
  font-size: 0.8rem; font-weight: 600; color: rgba(255,255,255,0.7);
  padding: 4px 12px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.2);
  text-decoration: none; transition: all 0.15s;
}
.hero-nav-link:hover, .hero-nav-link.active {
  background: rgba(255,255,255,0.18); color: #fff;
  border-color: rgba(255,255,255,0.45);
}

/* ---------- Hot deals banner ---------- */
.deals-banner {
  padding: 0 20px 18px;
}
.deals-inner { max-width: 1150px; margin: 0 auto; }
.deals-title { font-size: 0.85rem; font-weight: 700; color: #7adde5; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; }
.deals-list { display: flex; gap: 12px; flex-wrap: wrap; }
.deal-card {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.22);
  border-left: 5px solid rgba(255,255,255,0.22);
  border-radius: 10px; padding: 10px 14px; min-width: 170px; flex: 1;
  text-decoration: none; color: #e8f1f4; transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.deal-card:hover { border-color: var(--accent); background: rgba(255,255,255,0.11); }
.deal-card.po { border-left-color: #2e9bd6; }
.deal-card.rc { border-left-color: #1fbf9f; }
.deal-card.msc { border-left-color: #6ea8ff; }
.deal-card.cunard { border-left-color: #c94f4f; }
.deal-card.ncl { border-left-color: #4ab3e8; }
.deal-name { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.88rem; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-line-logo { width: 16px; height: 16px; flex-shrink: 0; }
.deal-line { font-size: 0.74rem; color: rgba(232,241,244,0.6); margin-bottom: 4px; }
.deal-cabin { font-size: 0.78rem; color: rgba(243,237,224,0.85); font-weight: 600; margin-bottom: 6px; }
.deal-drop { font-size: 1.1rem; font-weight: 800; color: #6bdb8e; }
.deal-pct { font-size: 0.8rem; font-weight: 600; }
.deal-was { font-size: 0.75rem; color: rgba(243,237,224,0.55); margin-top: 2px; }

/* ---------- Deal badge (inline in table row) ---------- */
.deal-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.72rem; font-weight: 700;
  background: rgba(107,219,142,0.15); color: #1e7d47;
  border: 1px solid rgba(30,125,71,0.3);
  padding: 1px 7px; border-radius: 999px; margin-left: 7px;
  white-space: nowrap; vertical-align: middle;
}
:root[data-theme="dark"] .deal-badge,
@media (prefers-color-scheme: dark) {
  .deal-badge { background: rgba(107,219,142,0.18); color: #6bdb8e; border-color: rgba(107,219,142,0.35); }
}
tr.has-deal { background: rgba(107,219,142,0.04); }

/* Drop alert inside expansion panel */
.expand-drop-alert {
  background: rgba(30,125,71,0.1); border: 1px solid rgba(30,125,71,0.25);
  border-radius: 7px; padding: 8px 12px; font-size: 0.83rem; margin-bottom: 10px; color: var(--down);
}
.expand-drop-alert.rise {
  background: rgba(198,40,40,0.1); border-color: rgba(198,40,40,0.25); color: var(--up);
}

/* ---------- Booking link in expand panel ---------- */
.expand-actions { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap; }
.expand-book-btn {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 0.83rem;
  padding: 7px 14px; border-radius: 8px; text-decoration: none;
  transition: background 0.15s;
}
.expand-book-btn:hover { background: var(--accent-dark); color: #fff; }

/* ---------- Stop times in itinerary ---------- */
.stop-time { font-size: 0.75rem; color: var(--muted); margin-left: 6px; }

/* ---------- Favourites button ---------- */
.fave-btn {
  background: none; border: none; padding: 0 4px; font-size: 1rem;
  color: var(--muted); cursor: pointer; line-height: 1;
  transition: color 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.fave-btn:hover { color: var(--accent); transform: scale(1.2); background: none; }
.fave-btn.starred { color: var(--accent); background: none; }
.fave-btn:disabled { opacity: 0.6; }
#faves-toggle-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Ship info card (sailing detail) ---------- */
.ship-info-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 20px; box-shadow: var(--shadow); margin-bottom: 20px;
}
.ship-info-card h3 { font-size: 1rem; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.ship-stats { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 0.85rem; }
.ship-stat { display: flex; flex-direction: column; }
.ship-stat .slabel { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.ship-stat .sval { font-weight: 700; margin-top: 1px; }
.ship-links { margin-top: 12px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.83rem; }
.ship-links a { color: var(--accent-dark); font-weight: 600; }

/* ---------- Planner page ---------- */
.planner-hero {
  background: var(--header-grad);
  color: #e8f1f4; padding: 24px 20px 40px; border-bottom: 3px solid var(--header-trim);
}
.planner-hero .hero-inner { max-width: 1150px; margin: 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.planner-hero h1 { font-size: 1.7rem; margin: 0 0 4px; font-family: "Outfit", -apple-system, "Segoe UI", sans-serif; font-weight: 600; color: #ffffff; }
.planner-hero .tagline { font-size: 0.85rem; opacity: 0.8; }

.planner-main { max-width: 1150px; margin: 0 auto; padding: 24px 20px; }

.planner-controls {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 24px; box-shadow: var(--shadow); margin-bottom: 24px;
  display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end;
}
.planner-field { display: flex; flex-direction: column; gap: 5px; }
.planner-field label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.planner-field input[type="number"], .planner-field select {
  font-size: 0.9rem; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); width: 140px;
}
.planner-field .quick-pills { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.planner-field .quick-pills button { padding: 3px 9px; font-size: 0.76rem; }

#planner-run-btn { padding: 10px 22px; font-size: 0.95rem; align-self: flex-end; }

.planner-results { }
.planner-results-title { font-size: 1rem; font-weight: 700; margin: 0 0 14px; color: var(--fg); }

.combo-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); padding: 16px 20px; margin-bottom: 14px;
}
.combo-card.top-pick { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent) inset, var(--shadow); }
.combo-badge { display: inline-block; background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700; padding: 2px 9px; border-radius: 999px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.combo-total { font-size: 1.35rem; font-weight: 800; color: var(--accent-dark); margin-bottom: 6px; }
.combo-nights { font-size: 0.85rem; color: var(--muted); margin-bottom: 12px; }
.combo-legs { display: flex; flex-direction: column; gap: 8px; }
.combo-leg {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px;
}
.combo-leg-num { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 800; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.combo-leg-info { flex: 1; min-width: 0; }
.combo-leg-name { font-weight: 700; font-size: 0.9rem; }
.combo-leg-sub { font-size: 0.78rem; color: var(--muted); margin-top: 1px; }
.combo-leg-price { font-weight: 700; font-size: 0.9rem; color: var(--accent-dark); white-space: nowrap; }
.combo-leg-link { font-size: 0.8rem; color: var(--accent-dark); font-weight: 600; text-decoration: none; white-space: nowrap; }
.combo-leg-link:hover { text-decoration: underline; }
.combo-gap { text-align: center; font-size: 0.78rem; color: var(--muted); padding: 2px 0; }

.planner-empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.planner-empty .big { font-size: 2.5rem; margin-bottom: 12px; }

@media (max-width: 760px) {
  .planner-controls { flex-direction: column; }
  .planner-field input[type="number"], .planner-field select { width: 100%; }
  .deals-list { flex-direction: column; }
  .deal-card { min-width: unset; }
}

/* =========================================================================
   Homepage (index.html / home.js)
   ========================================================================= */
.home-main { max-width: 1150px; margin: 0 auto; padding: 22px 20px 60px; }


.home-section { margin-bottom: 34px; }
.home-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.home-h2 {
  font-family: "Outfit", -apple-system, "Segoe UI", sans-serif;
  font-size: 1.15rem; font-weight: 700; margin: 0 0 12px;
}
.see-all { font-size: 0.85rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.see-all:hover { text-decoration: underline; }

/* Suggested searches */
.suggest-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.suggest-card {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; transition: border-color 0.15s, transform 0.15s;
}
.suggest-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.suggest-icon { font-size: 1.5rem; flex-shrink: 0; }
.suggest-body { display: flex; flex-direction: column; min-width: 0; }
.suggest-title { font-weight: 700; font-size: 0.9rem; color: var(--fg); }
.suggest-sub { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

/* Sailing cards */
.drop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.scard {
  display: block; text-decoration: none; background: var(--surface);
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 14px 16px; transition: border-color 0.15s, transform 0.15s;
}
.scard:hover { transform: translateY(-2px); }
.scard.po { border-left-color: #2e9bd6; }
.scard.rc { border-left-color: #1fbf9f; }
.scard.msc { border-left-color: #6ea8ff; }
.scard.cunard { border-left-color: #c94f4f; }
.scard.ncl { border-left-color: #0a84bd; }
.scard-line { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.scard-name { font-weight: 700; font-size: 0.95rem; color: var(--fg); margin: 3px 0 4px; }
.scard-meta { font-size: 0.8rem; color: var(--muted); }
.scard-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.scard-price { font-weight: 800; color: var(--accent); font-size: 0.95rem; }
.scard-drop { font-size: 0.8rem; font-weight: 700; color: #17924f; }
.scard-pn { font-size: 0.8rem; font-weight: 700; color: var(--muted); }

/* Market pulse on the homepage. Scoped under .home-main because the sailings
   page reuses .pulse-card / .pulse-line for its dark overview panel. */
.home-main .pulse { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 0; max-width: none; }
.home-main .pulse-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--border);
  border-radius: 10px; padding: 13px 15px;
}
.home-main .pulse-card.net-down { border-left-color: #17924f; }
.home-main .pulse-card.net-up { border-left-color: #c0392b; }
.home-main .pulse-line { font-weight: 700; font-size: 0.88rem; color: var(--fg); text-transform: none; letter-spacing: 0; }
.home-main .pulse-verdict { font-size: 1.05rem; font-weight: 800; color: var(--accent); margin: 2px 0 5px; font-family: "Outfit", sans-serif; }
.home-main .pulse-detail { display: flex; gap: 10px; font-size: 0.8rem; font-weight: 600; }

@media (max-width: 960px) {
  .suggest-grid, .home-main .pulse { grid-template-columns: repeat(2, 1fr); }
  .drop-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
  .suggest-grid, .drop-grid, .home-main .pulse { grid-template-columns: 1fr; }
  header.hero .tabs { order: 3; width: 100%; }
  header.hero .tab { padding: 12px 12px; }
  header.hero .hero-tools { width: 100%; }
  header.hero input.hero-search { flex: 1; }
}

/* Page intro strip (used where a page needs a title under the tabs) */
.page-intro { max-width: 1150px; margin: 0 auto; padding: 18px 20px 0; }
.page-title {
  font-family: "Outfit", -apple-system, "Segoe UI", sans-serif;
  font-size: 1.5rem; font-weight: 800; margin: 0;
}
.page-sub { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }

/* ---------- Homepage front-door panel ---------- */
.cta-panel {
  background: var(--header-grad);
  border-bottom: 3px solid var(--header-trim);
  padding: 40px 20px 44px;
  text-align: center;
}
.cta-inner { max-width: 720px; margin: 0 auto; }
.cta-title {
  font-family: "Outfit", -apple-system, "Segoe UI", sans-serif;
  font-size: 2.1rem; font-weight: 800; line-height: 1.15; margin: 0;
  color: #fff; letter-spacing: -0.5px;
}
.cta-sub { color: #a9ccd6; font-size: 0.95rem; margin: 10px 0 22px; }
.cta-button {
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--header-trim); color: #052632;
  font-family: "Outfit", -apple-system, "Segoe UI", sans-serif;
  font-size: 1.05rem; font-weight: 800;
  padding: 15px 30px; border-radius: 999px; text-decoration: none;
  box-shadow: 0 6px 20px rgba(47, 189, 201, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}
.cta-button:hover { transform: translateY(-2px); box-shadow: 0 9px 26px rgba(47, 189, 201, 0.42); }
.cta-count {
  background: rgba(5, 38, 50, 0.16); border-radius: 999px;
  padding: 3px 11px; font-size: 0.85rem; font-weight: 700;
}

/* Clearer section separation on the homepage */
.home-main .home-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px 22px;
  margin-bottom: 18px;
}
.home-lede { color: var(--muted); font-size: 0.86rem; margin: -6px 0 14px; }
.home-main .home-h2 {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 10px; margin-bottom: 14px;
  border-bottom: 2px solid var(--border);
}
/* Cards sit on the section panel, so lift them off it with a tint */
.home-main .suggest-card, .home-main .scard, .home-main .pulse-card { background: var(--bg); }

@media (max-width: 620px) {
  .cta-title { font-size: 1.6rem; }
  .cta-panel { padding: 30px 18px 34px; }
  .cta-button { width: 100%; justify-content: center; }
}
