/* Heebo (SIL OFL 1.1, fonts/HEEBO-LICENSE.txt), self-hosted: no third-party font host. */
@font-face {
  font-family: "Heebo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/heebo-hebrew-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Heebo";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/heebo-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* One accent colour; light and dark follow the system setting. */
:root {
  --bg: #ffffff;
  --surface: #f4f6f8;
  --fg: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #0b6bcb;
  --error: #c62828;
  --nav-h: 64px;
  /* Chart line: the accent, stepped to pass the chart validator on each surface. */
  --chart-line: #0b6bcb;
  font-family: "Heebo", "Rubik", system-ui, sans-serif;
  line-height: 1.5;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --surface: #1e1e1e;
    --fg: #f0f0f0;
    --muted: #a8a8a8;
    --accent: #5aa9f5;
    --error: #ef9a9a;
    --chart-line: #4a99e8;
  }
}

* {
  box-sizing: border-box;
}

/* Elements with display rules must still hide when [hidden]. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
}

/* One column on phones; centred and at most 480 px wide on larger screens. */
.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}

h1 {
  font-size: 1.25rem;
  margin: 0;
}

main {
  padding: 0 16px 16px;
}

button {
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: 6px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex="-1"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.note {
  background: var(--surface);
  border-inline-start: 4px solid var(--accent);
  padding: 8px 12px;
  border-radius: 4px;
}

#health[data-state="ok"] {
  color: var(--accent);
}

#health[data-state="error"] {
  color: var(--error);
}

/* Bottom navigation: 8 screens, fixed, same width as the column. */
nav {
  position: fixed;
  bottom: 0;
  inset-inline: 0;
  margin: 0 auto;
  max-width: 480px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  background: var(--surface);
  border-top: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
}

nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.65rem;
  text-align: center;
  line-height: 1.1;
}

nav a span:first-child {
  font-size: 1.15rem;
}

nav a[aria-current="page"] {
  color: var(--accent);
  font-weight: 700;
}

/* Settings form */
fieldset {
  border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
  border-radius: 6px;
  margin: 0 0 12px;
  padding: 8px 12px 12px;
}

legend {
  font-weight: 700;
  padding: 0 4px;
}

fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

label.num {
  justify-content: space-between;
}

label.num input {
  width: 4.5em;
  font: inherit;
  padding: 4px;
}

#settings-status {
  color: var(--muted);
}

/* Budget meter */
.budget ul {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
}

.budget li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  padding: 6px 0;
}

.budget meter {
  grid-column: 1 / -1;
  width: 100%;
  height: 10px;
}

.budget .flag {
  grid-column: 1 / -1;
  font-size: 0.85rem;
  font-weight: 700;
}

.budget li[data-state="warning"] .flag {
  color: var(--accent);
}

.budget li[data-state="empty"] .flag,
.budget li[data-state="unavailable"] {
  color: var(--error);
}

/* Booking-window bar: late | sweet spot | early, marker at the trip. */
.bw-track {
  position: relative;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  margin: 8px 0 4px;
}

.bw-seg {
  position: absolute;
  top: 0;
  bottom: 0;
}

.bw-late {
  background: color-mix(in srgb, var(--error) 35%, transparent);
}

.bw-sweet {
  background: color-mix(in srgb, var(--accent) 55%, transparent);
}

.bw-early {
  background: color-mix(in srgb, var(--muted) 30%, transparent);
}

.bw-best {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
}

.bw-marker {
  position: absolute;
  top: -2px;
  width: 4px;
  height: 16px;
  margin-inline-start: -2px;
  background: var(--fg);
  border-radius: 2px;
}

.bw-text {
  margin: 0;
  font-size: 0.9rem;
}

.bw-days {
  color: var(--muted);
}

/* Calendar */
.cal-form {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.cal-form label {
  display: grid;
  gap: 2px;
}

.cal-form input,
.cal-form select {
  font: inherit;
  padding: 6px;
}

.cal-hint a {
  color: var(--accent);
  font-weight: 700;
}

.cal-title {
  margin: 8px 0 0;
}

.cal-label,
.cal-legend {
  color: var(--muted);
  font-size: 0.85rem;
}

.cal-row {
  display: grid;
  /* minmax(0, …): a long word ("unknown") never widens a column past the screen. */
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  margin-bottom: 3px;
}

.cal-head span {
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.cal-head .midweek {
  color: var(--accent);
  font-weight: 700;
}

.cal-cell {
  display: grid;
}

.cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 0;
  border-radius: 4px;
  background: var(--surface);
  color: var(--fg);
  text-decoration: none;
  min-height: 48px;
  position: relative;
}

.cal-day.midweek {
  outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent);
  outline-offset: -2px;
}

.cal-day .num {
  font-size: 0.75rem;
  color: var(--muted);
}

.cal-day .price {
  font-size: 0.72rem;
  font-weight: 700;
  direction: ltr;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-day.unknown .price {
  font-weight: 400;
  font-size: 0.62rem;
  color: var(--muted);
}

.cal-day .est {
  position: absolute;
  top: 1px;
  inset-inline-end: 3px;
  font-size: 0.7rem;
  color: var(--muted);
}

#cal-status {
  color: var(--muted);
}

/* Search */
.search-form {
  display: grid;
  gap: 4px;
}

.search-form > label,
.search-form fieldset > label:not(.num) {
  display: grid;
  gap: 2px;
}

.search-form input:not([type="radio"]):not([type="checkbox"]),
.search-form select {
  font: inherit;
  padding: 6px;
}

.search-form .choice {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.search-form .choice label {
  display: flex;
  align-items: center;
  gap: 6px;
}

button.primary {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  padding: 10px;
}

#search-status {
  color: var(--error);
}

.search-form label.pax {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px 12px;
}

.search-form label.pax input {
  width: 4.5em;
}

/* Trip detail */
.trip-route {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.trip-dates,
.trip-pax {
  margin: 0;
  color: var(--muted);
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 1px 6px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.badge.live {
  background: var(--accent);
  color: var(--bg);
}

.cheapest strong {
  font-size: 1.4rem;
}

.label {
  color: var(--muted);
  font-size: 0.85rem;
}

.options,
.sellers,
.fallback-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.option,
.seller {
  border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  display: grid;
  gap: 4px;
}

.tp-flight {
  display: grid;
  gap: 2px;
}

/* Airline logo before the name (#102); white behind it so it reads in dark mode */
.airline-logo {
  width: 18px;
  height: 18px;
  object-fit: contain;
  vertical-align: -4px;
  margin-inline-end: 4px;
  border-radius: 3px;
  background: #fff;
}

.airline-code {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1.4;
  padding: 0 3px;
  margin-inline-end: 4px;
  border: 1px solid currentColor;
  border-radius: 3px;
}

.tp-airline {
  font-weight: 700;
}

.tp-meta {
  color: var(--muted);
  font-size: 0.85rem;
}

.tp-price strong {
  font-size: 1.1rem;
}

.returns,
.sellers {
  margin-top: 6px;
}

.seller-head {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.seller-price {
  margin-inline-start: auto;
  font-weight: 700;
}

.fare-name,
.bags {
  margin: 0;
  font-size: 0.85rem;
}

.warning {
  color: var(--error);
  font-weight: 700;
  margin: 0;
}

.linkout button {
  width: 100%;
}

#trip-status {
  color: var(--muted);
}

/* Price badges */
.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge.good_price {
  background: var(--accent);
  color: var(--bg);
}

.badge.error_fare {
  border-color: var(--error);
  color: var(--error);
  font-weight: 700;
}

.badges .advice {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.85rem;
  color: var(--error);
}

/* Price history chart (one series, no legend; the title names it). */
.price-chart {
  margin: 12px 0;
}

.pc-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.pc-wrap {
  position: relative;
}

.pc-svg {
  /* Time runs left to right in both languages; text anchors follow. */
  direction: ltr;
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

.pc-svg:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.pc-grid {
  stroke: color-mix(in srgb, var(--fg) 12%, transparent);
  stroke-width: 1;
}

.pc-axis,
.pc-band-label {
  fill: var(--muted);
  font-size: 9px;
  font-family: inherit;
}

.pc-band {
  fill: var(--chart-line);
  fill-opacity: 0.1;
}

.pc-line {
  fill: none;
  stroke: var(--chart-line);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.pc-dot {
  fill: var(--chart-line);
  stroke: var(--bg);
  stroke-width: 2;
}

.pc-cross {
  stroke: var(--muted);
  stroke-width: 1;
}

.pc-tip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.8rem;
  white-space: nowrap;
  pointer-events: none;
}

.pc-summary {
  font-size: 0.85rem;
  color: var(--muted);
}

.pc-table table {
  border-collapse: collapse;
  font-size: 0.85rem;
}

.pc-table td,
.pc-table th {
  padding: 2px 8px;
  text-align: start;
}

/* Sort toggle and price breakdown */
.sort-toggle {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  margin: 8px 0;
  font-size: 0.85rem;
}

.sort-toggle button[aria-checked="true"] {
  background: var(--accent);
  color: var(--bg);
}

.tp-breakdown {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.tag {
  font-size: 0.72rem;
  border: 1px solid currentColor;
  border-radius: 8px;
  padding: 0 5px;
}

/* Destination image with its credit */
.dest-image {
  margin: 0;
}

.dest-image img {
  display: block;
  width: 100%;
  aspect-ratio: 7 / 2;
  object-fit: cover;
  border-radius: 6px 6px 0 0;
  background: var(--surface);
}

.dest-image figcaption {
  font-size: 0.7rem;
  color: var(--muted);
  padding: 2px 4px;
  overflow-wrap: anywhere;
}

.dest-image figcaption a {
  color: inherit;
}

/* Explore */
.explore-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.explore-form label {
  display: grid;
  gap: 2px;
  font-size: 0.85rem;
}

.explore-form select,
.explore-form input {
  font: inherit;
  padding: 6px;
  min-width: 0;
}

.explore-form button {
  grid-column: 1 / -1;
}

/* Interest tags (#100): one row of radio chips with small icons */
.interest-chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 0;
  padding: 0;
  margin: 0;
}

.interest-chips[hidden] {
  display: none;
}

.interest-chips legend {
  font-size: 0.85rem;
  padding: 0;
  margin-bottom: 4px;
}

.explore-form .chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border: 1px solid var(--muted);
  border-radius: 999px;
  font-size: 0.85rem;
  cursor: pointer;
}

.chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.chip-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.chip:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--bg);
}

.chip:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dest-cards {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.dest-card {
  border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
  border-radius: 6px;
  overflow: hidden;
}

.dest-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.dest-placeholder {
  aspect-ratio: 7 / 2;
  display: grid;
  place-items: center;
  font-size: 2rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface);
}

.dest-body {
  padding: 6px 10px 10px;
  display: grid;
  gap: 2px;
}

.dest-name {
  margin: 0;
  font-size: 1.05rem;
}

.dest-country,
.dest-dates,
.dest-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.dest-price {
  margin: 4px 0 0;
}

.dest-price strong {
  font-size: 1.15rem;
}

/* Alternatives panel */
.alternatives {
  margin: 12px 0;
  border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
  border-radius: 6px;
  padding: 8px 10px;
}

.alternatives summary {
  font-weight: 700;
  cursor: pointer;
}

.alt-cost,
.alt-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.alt-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 8px;
}

.alt-option {
  border-top: 1px solid color-mix(in srgb, var(--fg) 10%, transparent);
  padding-top: 6px;
}

.alt-option h4 {
  margin: 0;
}

.alt-price,
.alt-legs,
.alt-conn,
.alt-saving {
  margin: 2px 0;
}

.alt-legs,
.alt-conn {
  font-size: 0.85rem;
  color: var(--muted);
}

.alt-saving.good {
  color: var(--accent);
  font-weight: 700;
}

/* Watches */
.watch-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.watch {
  border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
  border-radius: 6px;
  padding: 8px 10px;
}

.watch.paused {
  opacity: 0.7;
}

.watch-route {
  margin: 0;
  font-size: 1.05rem;
}

.watch-dates,
.watch-meta,
.watch-target-now {
  margin: 2px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.watch-target {
  display: flex;
  gap: 8px;
  align-items: end;
  margin: 6px 0;
}

.watch-target label {
  display: grid;
  gap: 2px;
  font-size: 0.8rem;
  flex: 1;
}

.watch-target input {
  font: inherit;
  padding: 4px;
}

.watch-actions {
  display: flex;
  gap: 8px;
}

button.danger {
  border-color: var(--error);
  color: var(--error);
}

.watch-add {
  margin: 10px 0;
}

.watch-add-status {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Alert inbox and the unread badge */
.inbox {
  margin-bottom: 16px;
}

.inbox-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.alert-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.alert {
  display: grid;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface);
}

.alert.unread {
  border-inline-start: 4px solid var(--accent);
  font-weight: 700;
}

.alert-text {
  color: var(--fg);
  margin: 0;
}

.alert-time {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 400;
}

nav a[data-nav="watches"] {
  position: relative;
}

.nav-badge {
  position: absolute;
  top: 4px;
  inset-inline-end: 8px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--error);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

/* Web Push on this device (Settings). */
.push-device {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-block: 0.25rem 0.5rem;
  padding-inline-start: 1.75rem;
}
.push-device p {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.9em;
  color: var(--muted, inherit);
}

/* Bookings (#42). */
.booking-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.booking {
  border: 1px solid color-mix(in srgb, var(--fg) 15%, transparent);
  border-radius: 6px;
  padding: 8px 10px;
}

.booking[data-status="closed"],
.booking[data-status="not_eligible"] {
  opacity: 0.8;
}

.booking .route {
  margin: 0;
  font-size: 1.05rem;
}

.booking .dates,
.booking .flights,
.booking .paid,
.booking .latest {
  margin: 2px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.cancel-status {
  margin: 6px 0;
  font-size: 0.9rem;
}

.cancel-status.open {
  font-weight: 600;
}

.booking-price,
.booked-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 6px 0;
}

.booking-price label,
.booked-form label {
  display: grid;
  gap: 2px;
  font-size: 0.8rem;
  flex: 1 1 10rem;
}

.booking-price input,
.booked-form input {
  font: inherit;
  padding: 4px;
}

.booked {
  margin-top: 6px;
}

.booked-status {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

/* Rebooking countdown (#44). */
.countdown {
  margin: 6px 0 2px;
  font-size: 1.05rem;
}

.countdown.urgent {
  color: var(--error);
}

.cancel-status .until,
.cancel-status .reason {
  margin: 2px 0;
  font-size: 0.85rem;
}

.saving {
  margin: 2px 0;
  font-size: 0.9rem;
}

.saving.worth {
  font-weight: 600;
}

.manage-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 6px 0;
}

.manage-form label {
  display: grid;
  gap: 2px;
  font-size: 0.8rem;
  flex: 1 1 14rem;
}

.manage-form input {
  font: inherit;
  padding: 4px;
}

details.rule {
  margin: 0 0 10px;
  font-size: 0.9rem;
}

/* Info screen (#45). */
.table-wrap {
  overflow-x: auto;
}

#carrier-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

#carrier-table th,
#carrier-table td {
  padding: 6px 4px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid color-mix(in srgb, var(--fg) 12%, transparent);
}

#carrier-table code {
  color: var(--muted);
}

.badge.flies {
  color: var(--accent);
}

.badge.not-flying {
  color: var(--error);
  font-weight: 600;
}

.myth {
  margin: 6px 0;
}

.myth summary {
  cursor: pointer;
  font-weight: 600;
}

/* Retry after an error (#46). */
button.retry {
  margin-block: 4px 8px;
}
