:root {
  --ink: #10223f;
  --muted: #6a7890;
  --line: #dfe6ef;
  --panel: #ffffff;
  --surface: #f3f6fa;
  --blue: #133f91;
  --blue-dark: #082761;
  --cyan: #12a8c6;
  --yellow: #f4ce24;
  --pink: #c01878;
  --purple: #69269a;
  --green: #11966f;
  --shadow: 0 10px 28px rgba(24, 45, 78, .09);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--surface); font-size: 12px; }
button, input, select { font: inherit; }
button { color: inherit; }

.topbar {
  height: 58px;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  align-items: center;
  padding: 0 28px;
  color: white;
  background: linear-gradient(105deg, #061a43 0%, #113c84 62%, #0c2d67 100%);
  box-shadow: 0 4px 18px rgba(3, 18, 50, .25);
  position: sticky;
  z-index: 1000;
  top: 0;
}

.brand { display: flex; align-items: center; gap: 9px; color: white; text-decoration: none; font-size: 15px; font-weight: 900; letter-spacing: .4px; }
.brand-name .brand-bts, .brand-name .brand-scaner { color: var(--yellow); }
.brand-name .brand-flight { color: white; }
.brand-mark { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; background: var(--yellow); color: var(--blue-dark); font-size: 17px; transform: rotate(-14deg); }
.route-title { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.airport-code { padding: 5px 8px; border: 1px solid rgba(255,255,255,.25); border-radius: 6px; font-weight: 900; letter-spacing: .7px; background: rgba(255,255,255,.08); }
.route-arrow { color: var(--yellow); font-size: 17px; }
.period-label { margin-left: 4px; color: #b8cae8; }
.scan-status { justify-self: end; display: flex; align-items: center; gap: 7px; color: #bdcbe2; font-size: 10px; }
.scan-status i { width: 7px; height: 7px; border-radius: 50%; background: #45dda7; box-shadow: 0 0 0 4px rgba(69, 221, 167, .12); }
#scan-time { display: flex; gap: 3px; }

main { max-width: 1540px; margin: 0 auto; padding: 18px 22px 36px; }
.collapsible-content[hidden] { display: none !important; }
.heading-with-toggle { display: flex; align-items: center; gap: 9px; min-width: 0; }
.section-toggle { display: grid; width: 24px; height: 24px; flex: 0 0 auto; place-items: center; padding: 0; cursor: pointer; color: var(--blue); border: 1px solid #d7e1ee; border-radius: 6px; background: #f7f9fc; }
.section-toggle:hover { border-color: #9eb1cb; background: #edf3fb; }
.section-toggle:focus-visible { outline: 3px solid rgba(38, 93, 178, .18); outline-offset: 2px; }
.section-chevron { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .18s ease; }
.collapsible-section.collapsed .section-chevron { transform: translateX(-2px) rotate(-45deg); }
.overview-section { position: relative; }
.overview-toggle { position: absolute; z-index: 2; top: 12px; left: 10px; color: white; border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.1); }
.overview-toggle:hover { border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.18); }
.overview-toggle .section-toggle-label { display: none; }
.overview-section:not(.collapsed) .stat-card:first-child { padding-left: 44px; }
.overview-section.collapsed { min-height: 48px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.overview-section.collapsed .overview-toggle { position: static; display: flex; width: 100%; height: 46px; justify-content: flex-start; gap: 10px; padding: 0 16px; color: var(--blue); border: 0; background: transparent; }
.overview-section.collapsed .overview-toggle .section-toggle-label { display: inline; color: var(--ink); font-weight: 850; }
.overview-grid { display: grid; grid-template-columns: minmax(340px, .8fr) minmax(520px, 1.2fr); gap: 10px; }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(140px, 1fr)); gap: 10px; height: 100%; }
.stat-card { min-height: 88px; padding: 13px 15px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 5px 16px rgba(26, 49, 82, .045); }
.stat-card strong { display: block; margin: 4px 0 1px; font-size: 23px; line-height: 1.05; letter-spacing: -.7px; }
.stat-card small { display: block; overflow: hidden; color: var(--muted); font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.stat-label { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; }
.stat-primary { color: white; border-color: var(--blue); background: linear-gradient(135deg, #174a9d, #0c2b68); }
.stat-primary .stat-label, .stat-primary small { color: #c3d4ef; }

.airline-summary { display: grid; grid-template-columns: 1fr; gap: 10px; }
.overview-grid .airline-card { min-height: 44px; padding-block: 6px; }
.airline-card { display: grid; grid-template-columns: 115px 1fr auto; align-items: center; gap: 15px; min-height: 60px; padding: 10px 15px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: 0 5px 16px rgba(26, 49, 82, .04); }
.airline-card img { width: 100px; max-height: 32px; object-fit: contain; }
.airline-card .logo-fallback { font-size: 15px; font-weight: 950; }
.airline-meta { display: flex; gap: 18px; }
.airline-meta span { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.airline-meta strong { display: block; margin-top: 2px; color: var(--ink); font-size: 13px; text-transform: none; }
.airline-best { text-align: right; }
.airline-best span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; }
.airline-best strong { font-size: 17px; }

.filter-panel, .map-card, .results-card { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); }
.filter-panel { padding: 15px 17px 12px; }
.filter-heading, .section-header { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
h1, h2 { margin: 1px 0 0; color: var(--ink); font-size: 16px; line-height: 1.2; }
.eyebrow { color: var(--blue); font-size: 8px; font-weight: 900; letter-spacing: 1.15px; text-transform: uppercase; }
.button { min-height: 30px; padding: 5px 10px; cursor: pointer; border: 0; border-radius: 7px; font-weight: 750; }
.button-ghost { border: 1px solid var(--line); background: white; }
.button-ghost:hover { border-color: #a7b8d0; background: #f7f9fc; }

.filter-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)) repeat(2, minmax(160px, 1.15fr)); gap: 14px; margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .25px; }
.field > span:first-child { display: flex; justify-content: space-between; }
.field output { color: var(--blue); font-weight: 900; }
.field select { width: 100%; height: 34px; padding: 0 10px; color: var(--ink); border: 1px solid #d7e0ec; border-radius: 7px; outline: none; background: #fbfcfe; }
.field input:focus, .field select:focus { border-color: #5b83c8; box-shadow: 0 0 0 3px rgba(38, 93, 178, .1); }
.range-field input { width: 100%; height: 18px; margin: 5px 0 0; accent-color: var(--blue); cursor: pointer; }
.weekday-filter { display: flex; align-items: center; gap: 10px; margin-top: 11px; padding-top: 10px; border-top: 1px solid #edf1f6; }
.weekday-filter > span { color: var(--muted); font-size: 9px; font-weight: 800; }
.weekday-buttons { display: flex; gap: 5px; }
.weekday-buttons button { min-width: 34px; height: 25px; padding: 0 8px; cursor: pointer; color: #52627b; border: 1px solid #dae2ed; border-radius: 6px; background: #f7f9fc; font-size: 9px; font-weight: 850; }
.weekday-buttons button.active { color: white; border-color: var(--blue); background: var(--blue); }

.map-card { overflow: hidden; }
.map-card .section-header, .results-card .section-header { min-height: 55px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.collapsible-section.collapsed > .section-header { border-bottom: 0; }
.map-actions { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 9px; }
.map-actions > span { display: inline-flex; align-items: center; gap: 5px; }
.legend-line { display: inline-block; width: 20px; height: 3px; border-radius: 4px; }
.legend-line.ryanair { background: var(--blue); }
.legend-line.wizz { background: var(--pink); }
#map { height: 430px; background: #dce5ed; }
.map-fallback { display: grid; place-items: center; height: 180px; padding: 20px; color: var(--muted); text-align: center; background: #edf2f7; }
.map-fallback[hidden] { display: none; }
.leaflet-container { font-family: inherit; }
.leaflet-popup-content { margin: 10px 12px; min-width: 180px; font-size: 10px; }
.map-popup strong { font-size: 12px; }
.map-popup .popup-route { margin: 3px 0 7px; color: var(--muted); }
.map-popup .popup-line { display: flex; justify-content: space-between; gap: 20px; margin-top: 4px; }
.map-popup button { width: 100%; margin-top: 8px; padding: 6px; cursor: pointer; color: white; border: 0; border-radius: 5px; background: var(--blue); font-weight: 800; }

.results-heading p { margin: 0; color: var(--muted); font-size: 9px; }
.results-help { display: grid; min-width: 0; max-width: 410px; gap: 4px; text-align: right; }
.results-help .table-note { font-size: 7px; line-height: 1.25; }
.results-range { display: flex; width: min(340px, 35vw); flex-direction: column; gap: 5px; color: var(--muted); font-size: 9px; font-weight: 800; }
.range-dates { display: flex; justify-content: space-between; gap: 12px; }
.range-dates label { display: flex; gap: 4px; }
.results-range output { color: var(--blue); font-weight: 900; }
.dual-range { --range-from: 0%; --range-to: 45%; position: relative; height: 18px; background: linear-gradient(to right, #d5dde9 var(--range-from), var(--blue) var(--range-from), var(--blue) var(--range-to), #d5dde9 var(--range-to)); background-position: center; background-repeat: no-repeat; background-size: 100% 4px; }
.dual-range input { position: absolute; inset: 0; width: 100%; height: 18px; margin: 0; pointer-events: none; appearance: none; background: transparent; }
.dual-range input::-webkit-slider-thumb { width: 14px; height: 14px; pointer-events: auto; appearance: none; cursor: grab; border: 2px solid white; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.dual-range input::-moz-range-thumb { width: 11px; height: 11px; pointer-events: auto; cursor: grab; border: 2px solid white; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.dual-range input::-moz-range-track { background: transparent; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 900px; border-collapse: collapse; table-layout: fixed; }
th { height: 31px; padding: 0 9px; color: #65758e; border-bottom: 1px solid var(--line); background: #f7f9fc; font-size: 8px; text-align: left; text-transform: uppercase; }
th.column-airline { width: 112px; }
th.column-destination { width: 230px; }
th.column-flight { width: 75px; }
th.column-departure { width: 205px; }
th.column-duration { width: 86px; }
th.column-distance { width: 96px; }
th.column-price { width: 95px; }
th.column-detail { width: 35px; }
th button { display: flex; align-items: center; gap: 4px; width: 100%; height: 100%; padding: 0; cursor: pointer; color: inherit; border: 0; background: none; font-size: inherit; font-weight: 850; text-align: left; text-transform: inherit; }
th button i::after { content: "↕"; opacity: .35; font-style: normal; }
th button.active i::after { content: "↑"; color: var(--blue); opacity: 1; }
th button.active.desc i::after { content: "↓"; }
tbody tr { cursor: pointer; transition: background .12s ease; }
tbody tr:hover { background: #f1f6fc; }
tbody tr.selected { background: #eaf2ff; box-shadow: inset 3px 0 var(--blue); }
td { height: 46px; padding: 6px 9px; overflow: hidden; border-bottom: 1px solid #e9eef4; color: #263c5d; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
td strong { color: var(--ink); }
.airline-cell { display: flex; align-items: center; gap: 7px; }
.airline-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--blue); }
.airline-dot.wizz { background: var(--pink); }
.airline-code { font-size: 9px; font-weight: 900; }
.destination-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.destination-copy { min-width: 0; }
.destination-cell strong { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.destination-cell small { color: var(--muted); font-size: 8px; }
.flag { width: 20px; height: 15px; flex: 0 0 auto; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgba(12, 43, 104, .12); }
.flag-fallback { width: 20px; text-align: center; }
.date-cell strong, .date-cell small { display: block; }
.date-cell small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.price-cell { color: var(--blue-dark); font-size: 13px; font-weight: 950; text-align: right; }
.price-cell small { display: block; color: var(--muted); font-size: 7px; font-weight: 650; }
.detail-chevron { font-size: 17px; color: #8b99ad; }
.empty-state { padding: 45px; color: var(--muted); text-align: center; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { margin-bottom: 5px; color: var(--ink); font-size: 14px; }

.flight-dialog { width: min(700px, calc(100vw - 28px)); max-height: calc(100vh - 40px); padding: 0; overflow: auto; color: var(--ink); border: 0; border-radius: 17px; box-shadow: 0 24px 80px rgba(1, 15, 43, .35); }
.flight-dialog::backdrop { background: rgba(5, 17, 40, .66); backdrop-filter: blur(3px); }
.dialog-close { position: absolute; z-index: 2; top: 10px; right: 12px; width: 30px; height: 30px; cursor: pointer; color: white; border: 1px solid rgba(255,255,255,.3); border-radius: 50%; background: rgba(0,0,0,.15); font-size: 21px; line-height: 24px; }
.detail-hero { padding: 24px 26px 20px; color: white; background: linear-gradient(115deg, #09275e, #174c9e); }
.detail-hero.wizz { background: linear-gradient(115deg, #5a1b83, #c01878); }
.detail-airline { display: flex; align-items: center; width: 115px; height: 34px; margin-bottom: 15px; padding: 5px 8px; border-radius: 6px; background: white; }
.detail-airline img { width: 100%; max-height: 24px; object-fit: contain; }
.detail-airline strong { color: var(--ink); }
.detail-route { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.detail-route > div:last-child { text-align: right; }
.detail-route b { display: block; font-size: 31px; line-height: 1; }
.detail-route small { color: #c8d7ef; }
.detail-flight { display: flex; align-items: center; flex-direction: column; gap: 2px; }
.detail-flight strong { color: white; font-size: 11px; line-height: 1; }
.detail-flight small { font-size: 9px; white-space: nowrap; }
.detail-plane { color: var(--yellow); font-size: 23px; line-height: 1; }
.detail-body { padding: 18px 26px 24px; }
.detail-price { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.detail-price span { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.detail-price strong { display: block; color: var(--blue); font-size: 28px; }
.detail-price small { color: var(--muted); }
.detail-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.detail-item { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.detail-item span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.detail-item strong { font-size: 11px; }
.schedule-title { margin: 17px 0 7px; font-size: 11px; }
.schedule-list { display: flex; flex-wrap: wrap; gap: 5px; }
.schedule-chip { padding: 5px 7px; color: #244b84; border: 1px solid #cddbf0; border-radius: 5px; background: #edf4ff; font-size: 9px; font-weight: 800; }
.return-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.return-heading { display: flex; align-items: end; justify-content: space-between; gap: 15px; margin-bottom: 8px; }
.return-heading h3 { margin: 2px 0 0; font-size: 14px; }
.return-heading small { color: var(--muted); font-size: 9px; text-align: right; }
.return-list { display: grid; gap: 6px; }
.return-option { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(105px, .9fr) minmax(82px, .7fr) minmax(110px, .9fr); align-items: center; gap: 10px; min-height: 53px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.return-option.cheapest { border-color: #84c9b4; background: #f0fbf7; box-shadow: inset 3px 0 var(--green); }
.return-when strong, .return-when span, .return-price span, .return-price strong, .return-total span, .return-total strong { display: block; }
.return-when strong { font-size: 11px; }
.return-when span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.return-badge { color: var(--green); font-size: 8px; font-weight: 900; text-transform: uppercase; }
.return-price, .return-total { text-align: right; }
.return-price span, .return-total span { color: var(--muted); font-size: 8px; }
.return-price strong { margin-top: 2px; font-size: 12px; }
.return-total strong { margin-top: 2px; color: var(--blue); font-size: 14px; }
.return-empty { padding: 14px; color: var(--muted); border: 1px dashed #cbd6e4; border-radius: 8px; background: #f8fafc; text-align: center; }
.booking-link { display: block; margin-top: 17px; padding: 10px; color: white; border-radius: 7px; background: var(--blue); font-weight: 850; text-align: center; text-decoration: none; }
.booking-link.wizz { background: var(--pink); }

footer { display: flex; justify-content: space-between; gap: 20px; max-width: 1540px; margin: 0 auto; padding: 0 22px 24px; color: #77869a; font-size: 9px; }
footer a { color: inherit; }

@media (max-width: 1000px) {
  .topbar { grid-template-columns: 1fr auto; }
  .route-title { display: none; }
  .overview-grid { grid-template-columns: 1fr; }
  .airline-summary { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: repeat(2, 1fr); }
  .return-option { grid-template-columns: minmax(140px, 1fr) auto auto; }
  .return-badge { display: none; }
  table { min-width: 760px; }
  table .column-flight { display: none; }
}

@media (max-width: 900px) {
  table { min-width: 650px; }
  table .column-distance { display: none; }
}

@media (max-width: 800px) {
  table { min-width: 540px; }
  table .column-airline { display: none; }
}

@media (max-width: 680px) {
  .topbar { height: 52px; padding: 0 14px; }
  .scan-status { max-width: 115px; gap: 6px; font-size: 8px; line-height: 1.15; text-align: right; }
  .scan-status i { flex: 0 0 auto; }
  #scan-time { align-items: flex-end; flex-direction: column; gap: 1px; }
  main { padding: 10px 9px 25px; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .airline-summary { grid-template-columns: 1fr; }
  .airline-card { grid-template-columns: 90px 1fr; }
  .airline-card img { width: 80px; }
  .airline-best { display: none; }
  .filter-heading { align-items: end; }
  .filter-grid { grid-template-columns: 1fr; }
  .weekday-filter { align-items: flex-start; flex-direction: column; }
  .weekday-buttons { width: 100%; }
  .weekday-buttons button { flex: 1; padding: 0; }
  .map-card .section-header { align-items: flex-start; flex-direction: column; }
  .map-actions { width: 100%; flex-wrap: wrap; }
  .map-actions .button { margin-left: auto; }
  .map-card.collapsed .section-header { align-items: center; flex-direction: row; }
  .map-card.collapsed .heading-with-toggle { flex: 1 1 auto; }
  .map-card.collapsed .map-actions { width: auto; flex: 0 0 auto; align-items: flex-start; flex-direction: column; gap: 3px; }
  #map { height: 350px; }
  .results-heading p { display: none; }
  .results-heading { align-items: flex-start; flex-direction: column; }
  .results-help { max-width: none; text-align: left; }
  .results-help .table-note { display: block; }
  .results-range { width: 100%; }
  table { min-width: 0; }
  table .column-duration, table .column-detail { display: none; }
  table .column-destination { width: 40%; }
  table .column-departure { width: 38%; }
  table .column-price { width: 22%; }
  th, td { padding-left: 6px; padding-right: 6px; }
  .detail-route b { font-size: 25px; }
  .detail-body, .detail-hero { padding-left: 17px; padding-right: 17px; }
  .return-heading { align-items: flex-start; flex-direction: column; gap: 4px; }
  .return-heading small { text-align: left; }
  .return-option { grid-template-columns: 1fr 1fr; gap: 7px 12px; }
  .return-when { grid-column: 1 / -1; }
  .return-price { text-align: left; }
  footer { flex-direction: column; padding: 0 11px 18px; }
}
