/* Cruise Deals. Sizes follow the pwa-standards skill: header (rule 7), tab bar
   (rule 6) and 12px side margins (rule 8) match Aptera Hub's. */
:root {
  color-scheme: light dark;
  --bg: #f3f6fa;
  --card: #ffffff;
  --card-2: #eef2f7;
  --text: #0d1726;
  --text-2: #4a5668;
  --text-3: #6f7c8f;
  --line: #dfe5ee;
  --accent: #0a66e8;
  --accent-ink: #ffffff;
  --accent-soft: rgb(10 102 232 / 0.1);
  --good: #0c8a4d;
  --good-soft: rgb(12 138 77 / 0.12);
  --warn: #b4540a;
  --phone-top: calc(2px + env(safe-area-inset-top));
  --side-l: calc(12px + env(safe-area-inset-left));
  --side-r: calc(12px + env(safe-area-inset-right));
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1119;
    --card: #151d29;
    --card-2: #1c2635;
    --text: #eef3f9;
    --text-2: #b2becd;
    --text-3: #8492a6;
    --line: #243043;
    --accent: #4d9bff;
    --accent-ink: #04122a;
    --accent-soft: rgb(77 155 255 / 0.14);
    --good: #3ccf86;
    --good-soft: rgb(60 207 134 / 0.14);
    --warn: #f0a050;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); }
body { -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h2 { font-size: 15px; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 small { font-weight: 500; margin-left: 4px; }
small { color: var(--text-3); }

/* --- The pinned column: header, what scrolls, tab bar ----------------------- */
.app {
  position: fixed; inset: 0; max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--bg);
}
/* Rule 7: one solid color, the same as the status bar, never inside what scrolls. */
.topbar {
  flex: none; background: var(--bg);
  padding: var(--phone-top) var(--side-r) 10px var(--side-l);
}
.title-row { min-height: 44px; display: flex; align-items: center; gap: 4px; }
.topbar h1 {
  flex: 1; min-width: 0; margin: 0; font-size: 26px; line-height: 1.15; font-weight: 800;
  letter-spacing: -0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
  flex: none; width: 44px; height: 44px; margin: 0; padding: 10px; border: 0; border-radius: 12px;
  background: none; color: var(--accent); display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 24px; height: 24px; fill: currentColor; }
.icon-btn.spacer { visibility: hidden; }
.scroll {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: 0 var(--side-r) 28px var(--side-l);
}

/* Rule 6: icons only, 56px plus the safe area, 28px icons, 16px above them. */
.tabbar {
  flex: none; display: flex; height: calc(56px + env(safe-area-inset-bottom));
  padding: 0 0 env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: var(--bg);
}
.tab {
  position: relative; flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center;
  /* As Aptera Hub's: 16px on top, then the icon centered in what's left, so it sits a little low. */
  padding: 16px 0 0; border: 0; background: none; color: var(--text-3);
}
.tab svg { width: 28px; height: 28px; fill: currentColor; }
.tab.active { color: var(--accent); }
.tab .badge {
  position: absolute; top: 16px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center;
}

/* --- Deals -------------------------------------------------------------------- */
.status { margin: 0 0 10px; color: var(--text-3); font-size: 13px; }
.status b { color: var(--text-2); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }
.chips:empty { display: none; }
.chip {
  padding: 4px 10px; border-radius: 999px; background: var(--card-2); color: var(--text-2);
  font-size: 13px; border: 0;
}
.deals { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.deal {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; width: 100%; text-align: left;
  padding: 12px 14px; border: 0; border-radius: 16px; background: var(--card);
}
.deal .who { grid-column: 1; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal .what { grid-column: 1; font-weight: 650; line-height: 1.25; }
.deal .when { grid-column: 1; font-size: 13px; color: var(--text-3); }
.deal .price { grid-column: 2; grid-row: 1 / span 3; text-align: right; align-self: center; }
.deal .amount { display: block; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.deal .per { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.deal .tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.deal .tags:empty { display: none; }
.rank { color: var(--text-3); font-weight: 600; margin-right: 2px; }
.tag { font-size: 12px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--card-2); color: var(--text-2); }
.tag.low { background: var(--good-soft); color: var(--good); }
.tag.new { background: var(--accent-soft); color: var(--accent); }
.tag.up { color: var(--warn); }
.empty { color: var(--text-3); text-align: center; margin: 32px 0; }

/* --- Filters and alerts ----------------------------------------------------- */
.hint { color: var(--text-3); font-size: 14px; margin: 0 0 14px; }
.group { margin: 0 0 20px; }
.seg { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--card-2); }
.seg button {
  flex: 1; min-height: 38px; padding: 6px 10px; border: 0; border-radius: 9px; background: none;
  color: var(--text-2); font-size: 15px; font-weight: 600;
}
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { background: var(--card); color: var(--accent); box-shadow: 0 1px 3px rgb(0 0 0 / 0.18); }
.seg.wrap { flex-wrap: wrap; }
.seg.wrap button { flex: 1 1 auto; }
.seg.multi button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.toggle {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 6px;
  border-radius: 14px; background: var(--card);
}
.toggle span { flex: 1; }
.toggle b { display: block; font-weight: 600; }
.toggle small { display: block; font-size: 13px; }
.toggle input { flex: none; width: 22px; height: 22px; accent-color: var(--accent); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-3); }
.field select, .field input {
  width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text); font-size: 16px;
}
.field.money { flex-direction: row; align-items: center; gap: 8px; font-size: 18px; color: var(--text-2); }
.btn {
  display: block; width: 100%; min-height: 48px; margin: 10px 0 0; padding: 12px 16px; border: 0; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; text-align: center;
  text-decoration: none;
}
.btn.ghost { background: var(--card-2); color: var(--accent); }
.btn:disabled { opacity: 0.55; }
.card { padding: 14px; border-radius: 16px; background: var(--card); margin: 0 0 12px; }
.card p { margin: 0 0 8px; color: var(--text-2); font-size: 15px; }
.note { font-size: 14px; color: var(--text-3) !important; margin-top: 10px !important; }
.lines { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.lines li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); }
.lines li span:last-child { color: var(--text-3); text-align: right; }
.lines li.bad span:last-child { color: var(--warn); }

/* --- A cruise, full screen: square corners (rule 7) -------------------------- */
.sheet {
  position: fixed; inset: 0; z-index: 50; max-width: 760px; margin: 0 auto;
  display: flex; flex-direction: column; background: var(--bg); border-radius: 0;
}
.sheet .topbar h1 { text-align: center; font-size: 20px; letter-spacing: -0.02em; }
.hero { padding: 4px 0 14px; }
.hero .who { color: var(--text-2); font-size: 14px; }
.hero h2 { font-size: 22px; line-height: 1.2; margin: 2px 0 4px; letter-spacing: -0.02em; }
.hero .when { color: var(--text-3); font-size: 14px; }
.big { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin: 12px 0 0; }
.big small { font-size: 14px; font-weight: 500; letter-spacing: 0; }
.rooms { width: 100%; border-collapse: collapse; font-size: 15px; }
.rooms th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 12px; padding: 0 0 6px; }
.rooms th:not(:first-child), .rooms td:not(:first-child) { text-align: right; }
.rooms td { padding: 9px 0; border-top: 1px solid var(--line); }
.rooms tr.picked td { font-weight: 700; color: var(--accent); }
.rooms .gone { color: var(--text-3); }
.parts { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.parts li { display: flex; justify-content: space-between; padding: 6px 0; }
.parts li.sum { border-top: 1px solid var(--line); font-weight: 700; margin-top: 4px; padding-top: 9px; }
.chart { width: 100%; height: 120px; display: block; }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.chart .area { fill: var(--accent-soft); }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-3); margin-top: 4px; }
.stops { margin: 0; padding-left: 18px; color: var(--text-2); font-size: 15px; }

@media (min-width: 761px) {
  .app, .sheet { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* --- Verdict, other dates, graph, watch star ------------------------------- */
.verdict { border-left: 4px solid var(--line); }
.verdict.good { border-left-color: var(--good); }
.verdict.good h2 { color: var(--good); }
.verdict.wait { border-left-color: var(--warn); }
.verdict.wait h2 { color: var(--warn); }
.dates { list-style: none; margin: 0; padding: 0; }
.date-row {
  display: flex; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 10px 0;
  border: 0; border-top: 1px solid var(--line); background: none; color: var(--text); font-size: 15px; text-align: left;
}
.dates li:first-child .date-row { border-top: 0; }
.date-row b { color: var(--accent); }
.chart .low { stroke: var(--good); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.chart .dot { fill: var(--good); }
#btn-watch { color: var(--text-3); }
#btn-watch.on { color: #f5b301; }

/* Cheapest each month: a strip that scrolls sideways inside the page margins. */
.months {
  display: flex; gap: 6px; overflow-x: auto; margin: 0 calc(-1 * var(--side-r)) 10px calc(-1 * var(--side-l));
  padding: 0 var(--side-r) 2px var(--side-l); scrollbar-width: none; overscroll-behavior-x: contain;
}
.months::-webkit-scrollbar { display: none; }
.months:empty { display: none; }
.month {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 64px; min-height: 44px;
  padding: 6px 10px; border: 0; border-radius: 12px; background: var(--card); color: var(--text-2); font-size: 12px;
}
.month b { font-size: 14px; color: var(--text); }
.month.best b { color: var(--good); }
.month[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.month[aria-pressed="true"] b { color: var(--accent-ink); }
