:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --border: #e3e7ef;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #e8590c;
  --accent-soft: #fff1e8;
  --accent-text: #b8430a;
  --ok: #16a34a;
  --ok-soft: #e8f7ee;
  --star: #f59e0b;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 6px 20px -8px rgba(15, 23, 42, .18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 42, .45);
  --radius: 14px;
  --topbar-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b1220;
  --surface: #141c2e;
  --surface-2: #1c2538;
  --border: #253048;
  --text: #e6ebf5;
  --muted: #94a3b8;
  --accent: #ff7a2f;
  --accent-soft: #3a2314;
  --accent-text: #ffb184;
  --ok: #34d399;
  --ok-soft: #113224;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .6);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: 1400px; margin: 0 auto; padding: 0 16px;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; }
.brand__mark { font-size: 24px; }
.brand__text { display: flex; flex-direction: column; font-weight: 700; font-size: 17px; line-height: 1.1; }
.brand__text small { font-weight: 500; font-size: 11px; color: var(--muted); }

.city-switch { display: flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: 999px; }
.city-switch button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 999px;
  font-weight: 600; font-size: 14px; color: var(--muted); white-space: nowrap;
  transition: background .15s, color .15s;
}
.city-switch button:hover { color: var(--text); }
.city-switch button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.city-switch button small { font-weight: 500; opacity: .7; margin-left: 4px; }

.search {
  flex: 1; max-width: 440px; margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid transparent; border-radius: 10px; padding: 0 12px; height: 38px;
  transition: border-color .15s, background .15s;
}
.search:focus-within { border-color: var(--accent); background: var(--surface); }
.search svg { color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: 0; height: 100%; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.icon-btn {
  border: 1px solid var(--border); background: var(--surface); width: 38px; height: 38px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.icon-btn:hover { background: var(--surface-2); }
#theme-toggle .moon { display: none; }
:root[data-theme="dark"] #theme-toggle .moon { display: block; }
:root[data-theme="dark"] #theme-toggle .sun { display: none; }

/* ---------- country strip ---------- */
.countries { max-width: 1400px; margin: 14px auto 0; padding: 0 16px; }
.countries__scroll {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin;
  scroll-snap-type: x proximity;
}
.country-card {
  flex: none; scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 2px;
  min-width: 150px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); text-align: left;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.country-card:hover { border-color: var(--accent); }
.country-card[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.country-card__name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.country-card__price { font-size: 13px; color: var(--muted); }
.country-card__price b { color: var(--text); font-weight: 600; }
.country-card--all { justify-content: center; align-items: center; min-width: 90px; }
.country-card:disabled { opacity: .4; cursor: default; }

/* ---------- layout ---------- */
.layout {
  max-width: 1400px; margin: 0 auto; padding: 14px 16px 40px;
  display: grid; grid-template-columns: 272px minmax(0, 1fr); gap: 20px; align-items: start;
}

/* ---------- filters ---------- */
.filters {
  position: sticky; top: calc(var(--topbar-h) + 14px);
  max-height: calc(100vh - var(--topbar-h) - 28px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filters__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--border); }
.filters__head h2 { font-size: 16px; flex: 1; }
.filters__close { display: none; }
.filters__body { overflow-y: auto; padding: 4px 16px 12px; scrollbar-width: thin; }
.filters__foot { display: none; padding: 12px 16px; border-top: 1px solid var(--border); }
.scrim { display: none; }
.link-btn { border: 0; background: none; color: var(--accent-text); font-weight: 600; font-size: 13px; padding: 4px; }
.link-btn:hover { text-decoration: underline; }

.fgroup { padding: 12px 0; border-bottom: 1px solid var(--border); }
.fgroup:last-child { border-bottom: 0; }
.fgroup__title { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 10px; }
.fgroup__title .link-btn { text-transform: none; letter-spacing: 0; font-size: 12px; }

.check { display: flex; align-items: center; gap: 8px; padding: 5px 0; cursor: pointer; font-size: 14px; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.check__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check__count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.check.is-zero { opacity: .45; }
.check img { width: 20px; height: 14px; object-fit: contain; border-radius: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 5px 11px; font-size: 13px; font-weight: 500; line-height: 1.2;
  display: inline-flex; align-items: center; gap: 5px;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip:disabled { opacity: .4; cursor: default; }
.chip .stars { color: var(--star); letter-spacing: -1px; }

.range { display: flex; gap: 8px; align-items: center; }
.range input { width: 100%; min-width: 0; border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 7px 9px; font-variant-numeric: tabular-nums; }
.range input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.range span { color: var(--muted); font-size: 13px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* price calendar */
.cal { display: flex; flex-direction: column; gap: 2px; }
.cal__row {
  display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 8px;
  border: 0; background: none; padding: 3px 4px; border-radius: 6px; font-size: 12px; text-align: left;
}
.cal__row:hover { background: var(--surface-2); }
.cal__row[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.cal__row.is-wknd .cal__date { color: var(--accent-text); }
.cal__date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal__bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.cal__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), var(--accent)); border-radius: 3px; }
.cal__price { font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.cal__row[aria-pressed="true"] .cal__price { color: inherit; }
.cal__row.is-empty { opacity: .35; }

/* ---------- results ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.toolbar__summary { font-size: 14px; color: var(--muted); }
.toolbar__summary b { color: var(--text); }
.toolbar__controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; color: var(--muted); }
.toggle input { accent-color: var(--accent); margin: 0; }
.select { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.select select { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 6px 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.btn.filters-open { display: none; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px; }

.btn { border: 1px solid transparent; border-radius: 10px; padding: 8px 14px; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { filter: brightness(1.05); }
.btn--outline { background: var(--surface); border-color: var(--border); }
.btn--outline:hover { border-color: var(--text); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }

.active-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.active-chips:empty { display: none; }
.active-chips .chip { background: var(--accent-soft); border-color: transparent; color: var(--accent-text); }
.active-chips .chip:hover { text-decoration: line-through; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }

/* ---------- card ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card__media { position: relative; aspect-ratio: 16 / 10; background: var(--surface-2); cursor: pointer; }
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__media .ph { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; opacity: .3; }
.card__disc { position: absolute; left: 10px; top: 10px; background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; padding: 3px 8px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.card__fav { position: absolute; right: 8px; top: 8px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: #0f172a; display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.card__fav svg { width: 18px; height: 18px; }
.card__fav[aria-pressed="true"] { color: #e11d48; }
.card__fav[aria-pressed="true"] svg { fill: currentColor; }
.card__tags { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 5px; flex-wrap: wrap; }
.tag { background: rgba(15,23,42,.72); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 6px; backdrop-filter: blur(4px); }
.card__photos { position: absolute; right: 10px; bottom: 10px; color: #fff; font-size: 11px; font-weight: 600; background: rgba(15,23,42,.6); padding: 3px 7px; border-radius: 6px; }

.card__body { padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.card__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stars { color: var(--star); font-size: 13px; letter-spacing: 1px; }
.rating { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.rating b { background: #1954b8; color: #fff; font-size: 12px; font-weight: 700; padding: 2px 6px; border-radius: 6px 6px 6px 0; }
.rating b.r-hi { background: #0f7b3f; }
.rating b.r-mid { background: #1954b8; }
.rating b.r-lo { background: #6b7280; }
.card__name { font-size: 16px; font-weight: 700; cursor: pointer; line-height: 1.25; }
.card__name:hover { color: var(--accent-text); }
.card__loc { font-size: 13px; color: var(--muted); }
.card__feat { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--muted); }
.card__feat span::before { content: "•"; margin-right: 6px; opacity: .5; }
.card__feat span:first-child::before { content: none; margin: 0; }

.deal { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 8px; border-top: 1px dashed var(--border); }
.deal__info { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; }
.deal__info b { color: var(--text); font-weight: 600; }
.deal__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; }
.deal__old { font-size: 12px; color: var(--muted); }
.deal__cur { font-size: 20px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.deal__per { font-size: 11px; color: var(--muted); margin-left: auto; text-align: right; }
.airline { display: inline-flex; align-items: center; gap: 4px; }
.airline img { height: 14px; width: auto; }

.card__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 14px 12px; }
.more-dates { border: 0; background: none; color: var(--accent-text); font-weight: 600; font-size: 13px; padding: 4px 0; }
.more-dates:hover { text-decoration: underline; }
.card__link { font-size: 13px; }

.dates { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.date-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: 13px; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); text-decoration: none; }
.date-row:hover { outline: 1px solid var(--accent); }
.date-row small { color: var(--muted); display: block; font-size: 12px; }
.date-row b { font-variant-numeric: tabular-nums; }
.date-row .disc { color: var(--ok); font-size: 11px; font-weight: 700; margin-left: 6px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty__icon { font-size: 48px; }
.empty h3 { color: var(--text); }
.load-more { display: flex; justify-content: center; padding: 24px 0; }
.sentinel { height: 1px; }

.footer { max-width: 1400px; margin: 0 auto; padding: 16px 16px 40px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--border); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(2, 6, 23, .55); backdrop-filter: blur(3px); }
.modal__panel {
  position: relative; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
.modal__media { position: relative; aspect-ratio: 16 / 8; background: var(--surface-2); }
.modal__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modal__close { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: #0f172a; font-size: 16px; }
.modal__body { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 12px; }
.modal__body h2 { font-size: 22px; }
.modal__facts { display: flex; flex-wrap: wrap; gap: 6px; }
.modal__facts .chip { cursor: default; }
.modal__section h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 8px 0 6px; }
.tour-list { display: flex; flex-direction: column; gap: 6px; }
.tour-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); text-decoration: none; }
.tour-row:hover { outline: 1px solid var(--accent); }
.tour-row .t-main { font-weight: 600; }
.tour-row .t-sub { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tour-row .t-price { text-align: right; }
.tour-row .t-price b { font-size: 16px; font-variant-numeric: tabular-nums; }
.tour-row .t-price s { display: block; font-size: 12px; color: var(--muted); }
.tour-row .t-go { color: var(--accent-text); font-weight: 700; font-size: 18px; }
.tour-row.is-other { opacity: .8; }
.modal__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .brand__text small { display: none; }
  .search { max-width: 300px; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding-top: 10px; }
  .filters {
    position: fixed; inset: auto 0 0 0; top: auto; max-height: 88vh; z-index: 60;
    border-radius: 18px 18px 0 0; transform: translateY(105%); transition: transform .22s ease;
  }
  .filters.is-open { transform: none; }
  .filters__close, .filters__foot { display: block; }
  .filters__close { display: inline-flex; }
  .scrim { display: block; position: fixed; inset: 0; background: rgba(2, 6, 23, .5); z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .scrim.is-open { opacity: 1; pointer-events: auto; }
  .btn.filters-open { display: inline-flex; }
  .topbar__inner { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px 10px; }
  .brand { order: 0; }
  #theme-toggle { order: 1; margin-left: auto; }
  .search { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .city-switch { order: 2; flex-basis: 100%; overflow-x: auto; justify-content: flex-start; }
  .countries { padding: 0 12px; }
  .layout { padding-left: 12px; padding-right: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
  .toolbar__controls { width: 100%; }
  .btn.filters-open { order: -1; }
  .select { flex: 1; justify-content: flex-end; }
  .select__label { display: none; }
  .modal { padding: 0; align-items: end; }
  .modal__panel { width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; }
  .tour-row { grid-template-columns: 1fr auto; }
  .tour-row .t-go { display: none; }
}
@media (max-width: 480px) {
  .grid { grid-template-columns: 1fr; }
  .city-switch button { padding: 6px 10px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  html { scroll-behavior: auto; }
}
