:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #14171c;
  --muted: #626a76;
  --line: #d7dce3;
  --blue: #1769e0;
  --blue-soft: #eaf2ff;
  --green: #0c7a5a;
  --green-soft: #e7f6f0;
  --orange: #da5b20;
  --orange-soft: #fff0e8;
  --yellow: #f4ce55;
  --radius: 6px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid rgba(23, 105, 224, 0.35);
  outline-offset: 3px;
}

.shell {
  width: min(1240px, calc(100% - 40px));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  font-size: 11px;
  font-weight: 850;
}

.brand strong,
.brand small { display: block; }

.brand strong { font-size: 15px; }

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.update-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.state-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #98a1ad;
}

.update-state[data-state="success"] .state-dot { background: var(--green); }
.update-state[data-state="running"] .state-dot { background: var(--yellow); }
.update-state[data-state="failed"] .state-dot { background: var(--orange); }

.summary-band {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.summary-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(520px, 1.2fr);
  gap: 72px;
  align-items: end;
  padding-block: 54px 48px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 820;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, h3, p { overflow-wrap: anywhere; }

h1 {
  margin: 0;
  font-size: 54px;
  line-height: 1.02;
  letter-spacing: 0;
}

.summary-intro > p:last-child {
  max-width: 520px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border-block: 1px solid var(--ink);
}

.metrics > div {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 20px 18px;
}

.metrics > div:last-child { border-right: 0; }

.metrics dt {
  color: var(--muted);
  font-size: 12px;
}

.metrics dd {
  margin: 9px 0 0;
  font-size: 25px;
  font-weight: 820;
  line-height: 1.1;
}

.workspace { padding-block: 44px 70px; }

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

h2 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-size: 22px;
  transition: color 150ms ease, background 150ms ease, transform 150ms ease;
}

.icon-button:hover {
  color: #fff;
  background: var(--blue);
  transform: rotate(20deg);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-top: 28px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tab {
  flex: 0 0 auto;
  min-height: 44px;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 720;
}

.tab:hover { color: var(--ink); }

.tab.is-active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto auto;
  gap: 10px;
  align-items: stretch;
  padding-block: 22px;
}

.search-field,
.select-field,
.toggle-field {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-inline: 14px;
  color: var(--muted);
  font-size: 20px;
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}

.search-field input::placeholder { color: #9299a3; }

.select-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 9px 0 13px;
  color: var(--muted);
  font-size: 12px;
}

.select-field select {
  min-height: 34px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 9px;
  padding-inline: 13px;
  cursor: pointer;
  color: var(--ink);
  font-size: 13px;
  font-weight: 680;
}

.toggle-field input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle {
  position: relative;
  width: 34px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid #9fa7b2;
  border-radius: 999px;
  background: #e6e9ee;
  transition: background 150ms ease, border 150ms ease;
}

.toggle::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  content: "";
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
  transition: transform 150ms ease;
}

.toggle-field input:checked + .toggle {
  border-color: var(--blue);
  background: var(--blue);
}

.toggle-field input:checked + .toggle::after { transform: translateX(14px); }

.result-meta {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid var(--ink);
  color: var(--muted);
  font-size: 12px;
}

.result-meta p { margin: 0; }

.table-head,
.flight-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) 100px 92px minmax(190px, 1.15fr) minmax(190px, 1.15fr) 46px;
  gap: 16px;
  align-items: center;
}

.table-head {
  min-height: 42px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.flight-list { background: var(--surface); }

.flight-row {
  min-height: 122px;
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
}

.flight-row:hover { background: #fbfcfe; }

.route-main,
.price-block,
.trip-block,
.leg-block { min-width: 0; }

.route-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.route-title strong {
  min-width: 0;
  font-size: 18px;
  line-height: 1.25;
}

.source-badge {
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 3px 6px;
  color: var(--blue);
  font-size: 9px;
  font-weight: 800;
}

.source-badge.exact { color: var(--green); }
.source-badge.international { color: var(--orange); }

.route-period,
.route-country,
.leg-flight,
.trip-detail,
.price-note {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.price-value {
  color: var(--orange);
  font-size: 21px;
  font-weight: 850;
}

.trip-days {
  font-size: 14px;
  font-weight: 760;
}

.leg-date {
  color: var(--muted);
  font-size: 11px;
}

.leg-time {
  margin-top: 3px;
  font-size: 15px;
  font-weight: 780;
}

.leg-flight {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.booking-link {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  justify-self: end;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
  font-size: 18px;
  transition: color 150ms ease, background 150ms ease;
}

.booking-link:hover {
  color: #fff;
  background: var(--blue);
}

.booking-link.is-disabled {
  pointer-events: none;
  opacity: 0.3;
}

.empty-state {
  border-bottom: 1px solid var(--line);
  padding: 54px 20px;
  text-align: center;
}

.empty-state strong { font-size: 17px; }

.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.load-more {
  display: block;
  min-width: 160px;
  min-height: 44px;
  margin: 24px auto 0;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.load-more:hover { color: #fff; background: var(--ink); }

.status-panel {
  border-top: 1px solid var(--ink);
  padding-top: 28px;
}

.status-overview {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(420px, 1.25fr);
  gap: 50px;
}

.status-overview h3 {
  margin: 0;
  font-size: 28px;
}

.status-overview dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
}

.status-overview dl > div {
  border-bottom: 1px solid var(--line);
  padding: 13px 4px;
}

.status-overview dt { color: var(--muted); font-size: 11px; }
.status-overview dd { margin: 5px 0 0; font-size: 14px; font-weight: 720; }

.issue-list { margin-top: 34px; border-top: 1px solid var(--ink); }

.issue-row {
  display: grid;
  grid-template-columns: 150px 130px 110px 1fr;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 15px 4px;
  font-size: 12px;
  line-height: 1.55;
}

.issue-row strong { color: var(--orange); }
.issue-row span:last-child { color: var(--muted); }

.footer { border-top: 1px solid var(--line); background: var(--surface); }

.footer-inner {
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: var(--muted);
  font-size: 12px;
}

.footer a { color: var(--blue); font-weight: 720; }

@media (max-width: 980px) {
  .summary-grid { grid-template-columns: 1fr; gap: 34px; }
  .filters { grid-template-columns: minmax(240px, 1fr) auto auto; }
  .toggle-field { grid-column: 1 / -1; width: fit-content; }
  .table-head,
  .flight-row { grid-template-columns: minmax(150px, 1.15fr) 90px 80px minmax(160px, 1fr) minmax(160px, 1fr) 42px; gap: 12px; }
}

@media (max-width: 760px) {
  .shell { width: min(100% - 28px, 1240px); }
  .topbar-inner { min-height: 62px; }
  .update-state { max-width: 48%; justify-content: flex-end; text-align: right; }
  .summary-grid { padding-block: 34px 30px; }
  h1 { font-size: 40px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics > div { border-bottom: 1px solid var(--line); }
  .metrics > div:nth-child(2) { border-right: 0; }
  .metrics > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .workspace { padding-block: 34px 54px; }
  h2 { font-size: 28px; }
  .tabs { margin-inline: -14px; padding-inline: 14px; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-field { grid-column: 1 / -1; }
  .select-field { min-width: 0; justify-content: space-between; }
  .toggle-field { grid-column: 1 / -1; }
  .result-meta { align-items: flex-start; flex-direction: column; gap: 5px; padding-block: 11px; }
  .table-head { display: none; }
  .flight-list { display: grid; gap: 10px; background: transparent; }
  .flight-row {
    display: grid;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 15px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 17px 15px;
    background: var(--surface);
  }
  .route-main { grid-column: 1; grid-row: 1; }
  .price-block { grid-column: 2; grid-row: 1; text-align: right; }
  .trip-block {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    gap: 8px;
    align-items: center;
    border-block: 1px solid var(--line);
    padding-block: 10px;
  }
  .trip-detail { margin: 0; }
  .leg-block {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 66px 1fr;
    gap: 10px;
    align-items: start;
  }
  .leg-block.outbound { grid-row: 3; }
  .leg-block.return { grid-row: 4; }
  .leg-time { margin: 0; }
  .leg-flight { grid-column: 2; margin-top: -5px; }
  .booking-link { grid-column: 2; grid-row: 5; align-self: end; }
  .status-overview { grid-template-columns: 1fr; gap: 24px; }
  .issue-row { grid-template-columns: 1fr 1fr; gap: 5px 12px; }
  .issue-row span:last-child { grid-column: 1 / -1; }
  .footer-inner { min-height: 92px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 8px; }
}

@media (max-width: 420px) {
  .brand small { display: none; }
  .update-state { font-size: 11px; }
  h1 { font-size: 36px; }
  .metrics > div { padding: 16px 12px; }
  .metrics dd { font-size: 22px; }
  .filters { grid-template-columns: 1fr; }
  .search-field,
  .select-field,
  .toggle-field { grid-column: 1; }
  .route-title { align-items: flex-start; flex-direction: column; gap: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
