/* fly-from-sea — 白底紫字 · 简约主题 */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #ffffff;
  --bg-soft: #faf9fc;
  --bg-hover: #f5f2fa;
  --line: #e9e4f2;
  --line-strong: #d8cfe8;
  --purple: #6d28d9;
  --purple-deep: #4c1d95;
  --purple-soft: #8b5cf6;
  --text: #3b3552;
  --text-dim: #6f6890;
  --text-faint: #a39bbd;
  --good: #0f766e;
  --bad: #b91c1c;
  --mono: 'IBM Plex Mono', 'SF Mono', monospace;
  --sans: 'Manrope', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--bg); }

body {
  font-family: var(--sans);
  color: var(--text);
  min-height: 100vh;
  background: var(--bg);
}

.wrap { max-width: 1320px; margin: 0 auto; padding: 0 32px 80px; }

/* ---------- 头部 ---------- */
header {
  padding: 40px 0 24px;
  border-bottom: 2px solid var(--purple-deep);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  flex-wrap: wrap;
}

.brand .route {
  font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.3em;
  color: var(--purple);
  text-transform: uppercase;
  margin-bottom: 8px;
}
.brand .route .dots { color: var(--text-faint); letter-spacing: 0.1em; }

.brand h1 {
  font-weight: 700;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--purple-deep);
}
.brand h1 em { font-style: normal; color: var(--purple-soft); }

.meta {
  text-align: right;
  font-family: var(--mono); font-size: 12px;
  color: var(--text-dim); line-height: 2;
}
.meta a, .link-btn { color: var(--purple); text-decoration: none; border-bottom: 1px solid var(--line-strong); padding-bottom: 1px; }
.meta a:hover, .link-btn:hover { color: var(--purple-deep); border-color: var(--purple); }
.meta .stamp { color: var(--text-faint); }
.link-btn {
  font: inherit;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  cursor: pointer;
  margin-left: 8px;
}

/* ---------- 过滤器 chips ---------- */
.home-filter-panel {
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(430px, 0.95fr);
  grid-template-areas:
    "airlines stops"
    "airlines-body airlines-body"
    "geo-filters geo-filters"
    "legend legend"
    "legend-box legend-box";
  gap: 10px 14px;
  align-items: start;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px 18px 10px;
  box-shadow: 0 18px 52px rgba(76, 29, 149, 0.035);
}
.filter-card {
  min-width: 0;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}
.filter-airlines {
  display: contents;
}
.filter-stops {
  grid-area: stops;
  display: grid;
  grid-template-columns: auto minmax(360px, 1fr);
  align-items: center;
  gap: 12px;
  border-left: 1px solid var(--line);
  padding-left: 16px;
}
.filter-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
}
.filter-airlines .filter-card-head {
  grid-area: airlines;
  justify-content: flex-start;
}
.filter-airlines .filter-card-body {
  grid-area: airlines-body;
  width: 100%;
}
.filter-heading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 13.5px;
  color: var(--purple-deep);
  letter-spacing: 0.04em;
}
.filter-head-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--purple);
  color: #fff;
  font-size: 9.5px;
  font-family: var(--mono);
  box-shadow: 0 6px 14px rgba(109, 40, 217, 0.22);
}
.filter-all {
  min-width: 60px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 12px;
  color: var(--purple);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
  margin-left: 16px;
}
.filter-all:hover,
.filter-all.on {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
  box-shadow: 0 10px 24px rgba(109, 40, 217, 0.2);
}
.filter-card-body { min-width: 0; }
.filter-card-body .chips-label { display: none; }
.filter-stops .filter-card-head { justify-content: flex-start; }
.legend-toggle-row {
  grid-area: legend;
  margin-top: 2px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  display: flex;
  justify-content: flex-end;
}
.legend-toggle {
  border: 1px solid var(--line-strong);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  margin-left: 0;
}
#legend-box {
  grid-area: legend-box;
}
.chips { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.chips-row {
  width: 100%;
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  gap: 0 12px;
  align-items: center;
}
.chips-top-row {
  grid-template-columns: 145px minmax(0, 1fr);
}
.chips-top-row .chip { justify-self: start; }
.group-chip-list {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 5px 6px;
  align-items: center;
}
.chips.compact { gap: 5px; }
.chips .chips-label {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  letter-spacing: 0.18em; text-transform: uppercase; margin-right: 0;
}
.chip {
  font-family: var(--sans); font-size: 12px; font-weight: 700;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: var(--bg); color: var(--text-dim);
  padding: 4px 8px; cursor: pointer; transition: all 0.15s;
  user-select: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  line-height: 1.1;
  min-width: 50px;
}
.chip:hover { border-color: var(--purple-soft); }
.chip.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.chip.all { font-weight: 700; }
.chip-logo {
  width: 14px;
  height: 14px;
  object-fit: contain;
  border-radius: 2px;
  flex: 0 0 auto;
  background: #fff;
}
.chip.on .chip-logo { background: rgba(255,255,255,0.92); }
.alliance-label {
  width: 100%;
  height: 100%;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--purple-deep);
  letter-spacing: 0;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  border-radius: 10px;
  padding: 0 12px 0 2px;
  border-right: 1px solid var(--line);
  transition: background 0.15s, color 0.15s;
}
.alliance-label:hover {
  background: var(--bg-hover);
  color: var(--purple);
}
.alliance-label.on {
  color: var(--purple-deep);
}
.alliance-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 6px;
}
.alliance-label span:last-child {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
}
.alliance-label .alliance-cn {
  font-size: 13.5px;
  font-weight: 650;
}
.alliance-label .alliance-en {
  font-family: var(--mono);
  font-size: 8px;
  color: var(--purple);
  text-transform: uppercase;
}
.alliance-label:not(.on) {
  opacity: 0.52;
}
/* 联盟分组自适应网格：宽屏并排多列、充分利用横向空间，不再全挤在左侧 */
.chips-groups-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  width: 100%;
}
.chips-group-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.64);
  min-height: 82px;
}
.stop-segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(105px, 1fr));
  gap: 0;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  overflow: hidden;
  max-width: none;
  width: 100%;
}
.stop-segmented .chips-label { display: none; }
.stop-segmented .chip {
  justify-content: center;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--purple-deep);
  background: var(--bg);
  box-shadow: none;
}
.stop-segmented .chip + .chip {
  border-left: 1px solid var(--line-strong);
}
.stop-segmented .chip.on {
  background: var(--purple);
  color: #fff;
}
.inline-logo,
.lbl-logo {
  width: 11px;
  height: 11px;
  object-fit: contain;
  border-radius: 2px;
  flex: 0 0 auto;
  background: #fff;
}
.lbl-logo {
  width: 10px;
  height: 10px;
}
.legend-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  border-radius: 3px;
  flex: 0 0 auto;
  background: #fff;
}

/* ---------- 主页低价日历 ---------- */
.home-cal-section { margin-top: 28px; }
.section-title,
.fare-table-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--purple-deep);
  letter-spacing: 0.02em;
}
.section-title {
  margin-bottom: 12px;
}
.title-emoji {
  display: inline-block;
  font-size: 0.9em;
  opacity: 0.82;
  transform: translateY(-1px);
}
.home-cal-bar {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 12px; margin-bottom: 12px;
}
.month-nav { display: flex; align-items: center; gap: 14px; }
.month-nav h2 {
  font-family: var(--mono); font-size: 16px; font-weight: 600;
  color: var(--purple-deep); letter-spacing: 0.15em; min-width: 110px; text-align: center;
}
.month-nav button {
  background: none; border: 1px solid var(--line-strong); border-radius: 6px;
  color: var(--purple); font-size: 15px; width: 32px; height: 32px; cursor: pointer;
  transition: all 0.15s;
}
.month-nav button:hover:not(:disabled) { background: var(--purple); color: #fff; }
.month-nav button:disabled { opacity: 0.3; cursor: default; }

.home-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.home-cal .dow {
  font-family: var(--mono); font-size: 10px; color: var(--text-faint);
  text-align: center; padding-bottom: 6px; letter-spacing: 0.1em;
}
.hday {
  min-height: 124px;
  padding: 8px 10px;
  background: var(--bg-soft);
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  display: flex;
  flex-direction: column;
}
.hday.empty { background: transparent; border-color: transparent; }
.hday.past { opacity: 0.35; }
.hday .d { font-family: var(--mono); font-size: 11px; color: var(--text-faint); margin-bottom: 2px; }
.hday .line {
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--purple);
  margin-top: 2px;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
}
.hday .line.best-award {
  color: var(--good);
}
.hday .line .dst {
  font-weight: 600;
  font-size: 11.5px;
  color: var(--text);
  margin-top: 3px;
}
.hday .line .meta-line {
  margin-top: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.hday .line .flt {
  font-size: 9.5px; color: var(--purple-deep); background: rgba(109, 40, 217, 0.08);
  border-radius: 4px; padding: 2px 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.hday .line .stop {
  font-size: 9.5px; color: var(--text-dim);
}
.hday.click { cursor: pointer; border-color: var(--line-strong); }
.hday.click:hover { border-color: var(--purple); background: rgba(109, 40, 217, 0.03); }

/* 航司代码 Label 徽标 */
.lbl {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  color: var(--purple-deep); background: rgba(109, 40, 217, 0.1);
  border-radius: 3px; padding: 1px 4px; margin-left: 4px;
  vertical-align: 1px; letter-spacing: 0.05em;
}
.fare-logo-badge {
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 5px;
  vertical-align: 2px;
}
.fare-logo-badge .lbl-logo {
  width: 14px;
  height: 14px;
}

/* ---------- 主页表格 ---------- */
.fare-table-title {
  margin-top: 32px;
  margin-bottom: 10px;
}
.fare-table {
  margin-top: 0;
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.fare-table .col-city { width: 13%; }
.fare-table .col-route { width: 11%; }
.fare-table .col-cabin { width: 7%; }
.fare-table .col-date { width: 12%; }
.fare-table .col-details { width: 23%; }
.fare-table .col-award { width: 22%; }
.fare-table .col-book { width: 12%; }

.award-date-val {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--purple-deep);
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 4px 8px;
  display: inline-block;
  white-space: nowrap;
}

.fare-table th {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.18em;
  text-align: left; padding: 12px 14px;
  border-bottom: 1px solid var(--purple-deep);
  white-space: nowrap;
}
.fare-table td {
  padding: 14px; font-size: 13.5px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.fare-table tbody tr { cursor: pointer; transition: background 0.15s; }
.fare-table tbody tr:hover { background: var(--bg-hover); }
tr.country-header-row { cursor: default; background: var(--bg-soft); pointer-events: none; }
tr.country-header-row:hover { background: var(--bg-soft) !important; }
.country-header-cell {
  background: var(--bg-soft) !important;
  color: var(--purple) !important;
  font-family: var(--sans) !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  padding: 10px 14px !important;
  letter-spacing: 0.05em !important;
  border-bottom: 2px solid var(--purple-deep) !important;
  text-transform: uppercase !important;
}

.cell-city .cn { font-weight: 600; font-size: 15px; color: var(--text); }
.cell-city .en { font-size: 11px; color: var(--text-faint); margin-top: 2px; letter-spacing: 0.05em; }
.cell-route { font-family: var(--mono); font-size: 12px; color: var(--purple); font-weight: 600; letter-spacing: 0.04em; white-space: nowrap; }

.cell-price {
  min-width: 0;
}
.price-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cell-price .num { font-family: var(--mono); font-size: 14.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.cell-price.award .num { color: var(--purple); }
.fare-kind {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--text-faint);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 6px;
  white-space: nowrap;
}
.time-badge {
  margin-top: 6px;
  display: inline-flex;
  max-width: 100%;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--purple-deep);
  background: rgba(109, 40, 217, 0.08);
  border: 1px solid rgba(109, 40, 217, 0.16);
  border-radius: 7px;
  padding: 5px 7px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.time-badge.award {
  color: var(--good);
  background: rgba(15, 118, 110, 0.08);
  border-color: rgba(15, 118, 110, 0.16);
}
.cell-price .sub { font-size: 11px; color: var(--text-faint); margin-top: 6px; line-height: 1.45; overflow-wrap: anywhere; }
.cell-price .sub b { color: var(--text-dim); font-weight: 500; }
.cell-none { font-family: var(--mono); font-size: 12px; color: var(--text-faint); }

.cell-cpm { font-family: var(--mono); font-size: 11.5px; color: var(--good); white-space: nowrap; }

.flight-detail {
  min-width: 190px;
  max-width: 280px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.45;
}
.flight-detail div + div { margin-top: 6px; }
.flight-detail b {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--purple);
  font-weight: 600;
}
.flight-detail span {
  display: block;
  color: var(--text-faint);
  margin-top: 1px;
}
.book-link {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--purple);
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  padding: 4px 8px;
  text-decoration: none;
  margin: 0 4px 4px 0;
  white-space: nowrap;
}
.book-link:hover { background: var(--purple); border-color: var(--purple); color: #fff; }



/* ---------- 弹层：日历 ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(59, 53, 82, 0.45);
  backdrop-filter: blur(4px);
  display: none;
  overflow-y: auto;
  padding: 6vh 24px;
}
.overlay.open { display: block; }

.sheet {
  max-width: 1320px; margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 24px 64px rgba(76, 29, 149, 0.16);
  padding: 32px 36px 40px;
}
.sheet-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.sheet-head h2 { font-weight: 700; font-size: 26px; color: var(--purple-deep); }
.sheet-head h2 .mono { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--purple); display: block; letter-spacing: 0.2em; margin-bottom: 6px; }
.controls { display: flex; gap: 8px; }

.toggle { display: flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.toggle button {
  font-family: var(--mono); font-size: 12px;
  background: none; border: none; color: var(--text-dim);
  padding: 8px 16px; cursor: pointer; letter-spacing: 0.08em;
}
.toggle button.on { background: var(--purple); color: #fff; font-weight: 600; }

.close-x {
  background: none; border: 1px solid var(--line-strong); border-radius: 6px;
  color: var(--purple); font-family: var(--mono); font-size: 14px;
  width: 38px; height: 38px; cursor: pointer;
}
.close-x:hover { background: var(--bg-hover); }

.month { margin-bottom: 26px; }
.month h3 {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--text-dim); letter-spacing: 0.25em; text-transform: uppercase;
  margin-bottom: 10px;
}
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow {
  font-family: var(--mono); font-size: 10px; color: var(--text-faint);
  text-align: center; padding-bottom: 6px; letter-spacing: 0.1em;
}
.day {
  min-height: 62px; padding: 7px 8px;
  background: var(--bg-soft);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: default;
}
.day.has { cursor: pointer; border-color: var(--line-strong); }
.day.has:hover { border-color: var(--purple); }
.day.has.selected {
  border-color: var(--purple);
  box-shadow: 0 0 0 2px rgba(109, 40, 217, 0.15);
}
.day.empty { background: transparent; }
.day .d { font-family: var(--mono); font-size: 10px; color: var(--text-faint); }
.day .v { font-family: var(--mono); font-size: 12px; font-weight: 600; margin-top: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .p { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; font-size: 9px; color: var(--text-faint); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .p .lbl-logo { width: 13px; height: 13px; border-radius: 3px; flex: 0 0 auto; }
/* 热力等级：低=绿 中=紫 高=灰 */
.day.t0 .v { color: var(--good); }
.day.t1 .v { color: var(--purple); }
.day.t2 .v { color: var(--text-faint); }
.day.t0 { background: #ecfdf5; }

.day-detail { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 16px; }
.day-detail h4 { font-family: var(--mono); font-size: 12px; color: var(--purple); letter-spacing: 0.18em; margin-bottom: 10px; }
.detail-row {
  display: grid; grid-template-columns: minmax(220px, 1fr) auto;
  gap: 4px 16px;
  font-size: 13px; padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.detail-row .prog { color: var(--text-dim); }
.detail-row .val { font-family: var(--mono); color: var(--purple); font-weight: 600; }
.detail-row .more {
  grid-column: 1 / -1;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
}
.detail-row .flight-with-logo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text-dim);
}
.detail-row .flight-with-logo .lbl-logo { width: 14px; height: 14px; border-radius: 3px; }
.detail-row .more .book-btn { color: var(--purple); text-decoration: none; border-bottom: 1px solid var(--line-strong); }

/* ---------- Admin ---------- */
.admin-section { margin-top: 44px; }
.admin-section > h2 { font-weight: 700; font-size: 20px; color: var(--purple-deep); margin-bottom: 6px; }
.admin-section > p.hint { font-size: 12px; color: var(--text-faint); margin-bottom: 16px; }
.subhead {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--purple);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 18px 0 10px;
}

table { width: 100%; border-collapse: collapse; }
.scraper-table {
  table-layout: fixed;
  width: 100%;
}
.scraper-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
th {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.18em;
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--purple-deep);
  white-space: nowrap;
}
td { padding: 11px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
td.mono, .mono { font-family: var(--mono); }
tr.off td { opacity: 0.4; }

.switch {
  width: 36px; height: 20px; border-radius: 10px;
  background: var(--line); border: 1px solid var(--line-strong);
  cursor: pointer; position: relative; transition: background 0.2s;
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.2); transition: all 0.2s;
}
.switch.on { background: var(--purple); border-color: var(--purple); }
.switch.on::after { left: 18px; }

.btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  background: none; border: 1px solid var(--purple); border-radius: 6px;
  color: var(--purple); padding: 8px 18px; cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { background: var(--purple); color: #fff; }
.btn.full { width: 100%; margin-top: 14px; }
.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: none;
  color: var(--text-faint);
  border-color: var(--line-strong);
}
.btn:disabled:hover { background: none; color: var(--text-faint); }
.btn.danger { color: var(--bad); border-color: #e7c2c2; }
.btn.danger:hover { background: var(--bad); color: #fff; }

input[type="text"], input[type="number"], input[type="password"], input[type="date"], input[type="email"] {
  font-family: var(--mono); font-size: 13px;
  background: var(--bg-soft); border: 1px solid var(--line-strong); border-radius: 6px;
  color: var(--text); padding: 9px 12px;
  outline: none; width: 100%;
}
input:focus { border-color: var(--purple); }

.add-form { display: grid; grid-template-columns: 1fr 1fr 110px auto; gap: 10px; margin-top: 14px; }

.status-ok { color: var(--good); }
.status-error { color: var(--bad); }
.status-running { color: var(--purple); }

code.cmd {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg-hover); color: var(--purple-deep);
  padding: 2px 7px; border-radius: 4px;
  white-space: nowrap;
}

footer {
  margin-top: 64px; padding-top: 20px;
  border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--text-faint);
  display: flex; justify-content: space-between;
}

/* ---------- Auth ---------- */
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 12%, rgba(139, 92, 246, 0.08), transparent 30%),
    radial-gradient(circle at 82% 88%, rgba(109, 40, 217, 0.06), transparent 28%),
    var(--bg);
}
.auth-card {
  position: relative;
  width: min(100%, 460px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 30px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 22px 60px rgba(76, 29, 149, 0.12);
}
.auth-lang-slot {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
}
.auth-card .brand { margin-bottom: 16px; }
.auth-card .brand h1 { font-size: clamp(28px, 7vw, 38px); }
.auth-card form { display: grid; gap: 10px; margin-top: 18px; }
.auth-card label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 8px;
}
.auth-card label.privacy-agree {
  font-family: var(--sans);
  letter-spacing: 0;
  text-transform: none;
  margin-top: 2px;
}
.auth-hint, .auth-foot {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}
.auth-foot { margin-top: 16px; text-align: center; }
.auth-foot a { color: var(--purple); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
.auth-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(250, 249, 252, 0.9), rgba(255, 255, 255, 0.9));
  padding: 14px;
  margin-top: 16px;
}
.auth-steps {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 4px 0 16px;
}
.auth-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.35;
}
.auth-step b {
  display: block;
  color: var(--purple-deep);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  margin-bottom: 2px;
}
.auth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}
.auth-row input,
.auth-row button { margin: 0; }
.auth-row button {
  height: 39px;
  padding: 0 13px;
  white-space: nowrap;
}
.auth-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.auth-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--text-dim);
  background: rgba(250, 249, 252, 0.72);
  font-size: 12px;
  line-height: 1.55;
}
.auth-note .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--purple);
  margin-top: 6px;
  flex: 0 0 auto;
}
.auth-divider {
  border: 0;
  border-top: 1px dashed var(--line-strong);
  margin: 18px 0 14px;
}
.auth-contact {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 10px;
}
.auth-contact a {
  color: var(--purple);
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
}
.auth-copyright {
  font-size: 10px;
  color: var(--text-faint);
  text-align: center;
  font-family: var(--mono);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.auth-error {
  min-height: 20px;
  margin-top: 12px;
  color: var(--bad);
  font-size: 12px;
}
.auth-success {
  color: var(--good);
  font-size: 12px;
  margin-top: 10px;
  line-height: 1.5;
}

@media (max-width: 560px) {
  .auth-wrap { padding: 18px; place-items: start center; }
  .auth-card { padding: 22px; }
  .auth-steps,
  .auth-field-grid,
  .auth-row { grid-template-columns: 1fr; }
  .auth-row button { width: 100%; }
}

/* ---------- Admin Sidebar Layout ---------- */
.admin-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.admin-sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.sidebar-header .back-link {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--purple);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px dashed var(--line-strong);
  width: fit-content;
  padding-bottom: 2px;
}

.sidebar-header .back-link:hover {
  color: var(--purple-deep);
  border-color: var(--purple);
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  transition: all 0.2s;
  cursor: pointer;
  border: 1px solid transparent;
}

.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--purple);
}

.sidebar-item.active {
  background: var(--bg-hover);
  color: var(--purple-deep);
  border-color: var(--line-strong);
  box-shadow: 0 2px 8px rgba(109, 40, 217, 0.05);
}

.sidebar-item .icon {
  font-size: 16px;
}

.admin-content {
  padding: 40px 48px 80px;
  overflow-y: auto;
}

.admin-content .admin-section {
  margin-top: 0;
}

/* Tab visibility fallback using hidden attribute */
.admin-section[hidden] {
  display: none !important;
}



/* ---------- Dropdown Multi-Select ---------- */
.dropdown {
  position: relative;
  display: inline-block;
  width: 240px;
}
.dropdown-btn {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.15s ease;
}
.dropdown-btn:hover {
  border-color: var(--purple);
  background: var(--bg-hover);
}
.dropdown-btn::after {
  content: "▾";
  font-size: 12px;
  color: var(--text-faint);
  transition: transform 0.15s ease;
}
.dropdown.open .dropdown-btn::after {
  transform: rotate(180deg);
}
.dropdown-content {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(76, 29, 149, 0.08);
  z-index: 1000;
  overflow: hidden;
  flex-direction: column;
}
.dropdown.open .dropdown-content {
  display: flex;
}
.dropdown-search-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.dropdown-search {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: none;
  font-family: var(--sans);
}
.dropdown-search:focus {
  border-color: var(--purple);
}
.dropdown-options {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.dropdown-item:hover {
  background: var(--bg-hover);
}
.dropdown-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--text-faint);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  accent-color: var(--purple);
}

/* ---------- Reset & Selected Labels Style ---------- */
.reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.reset-btn:hover {
  border-color: var(--purple);
  color: var(--purple);
  background: var(--bg-hover);
}

.filter-labels-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
  margin-top: 4px;
}

.geo-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--purple-deep);
  box-shadow: 0 2px 4px rgba(76, 29, 149, 0.02);
  transition: all 0.15s ease;
  user-select: none;
}

.geo-label:hover {
  border-color: var(--purple-soft);
  background: var(--bg-hover);
  transform: translateY(-1px);
}

.geo-label .close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  font-size: 10px;
  color: var(--text-faint);
  cursor: pointer;
  transition: all 0.1s ease;
  margin-left: 2px;
}

.geo-label .close:hover {
  background: var(--purple-soft);
  color: #fff;
}

/* ---------- Table Header Slider Style ---------- */
.table-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 32px;
  margin-bottom: 16px;
  gap: 20px;
  flex-wrap: wrap;
}

.table-title-bar .fare-table-title {
  margin: 0;
}

.month-slider-container {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 8px 16px;
  box-shadow: 0 4px 12px rgba(76, 29, 149, 0.02);
  flex-wrap: wrap;
}

.slider-title-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 150px;
}

.slider-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.slider-value {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--purple-deep);
  font-family: var(--mono);
}

.slider-wrapper {
  position: relative;
  width: 200px;
  height: 24px;
  display: flex;
  align-items: center;
}

.slider-track {
  position: absolute;
  height: 5px;
  background: var(--line-strong);
  border-radius: 999px;
  width: 100%;
  z-index: 1;
}

.slider-wrapper input[type="range"] {
  position: absolute;
  width: 100%;
  height: 5px;
  -webkit-appearance: none;
  background: none;
  pointer-events: none;
  z-index: 3;
  margin: 0;
  left: 0;
}

/* Chrome/Safari/Edge thumbs */
.slider-wrapper input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  height: 16px;
  width: 16px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--purple);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.2);
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.slider-wrapper input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  border-color: var(--purple-soft);
}

/* Firefox thumbs */
.slider-wrapper input[type="range"]::-moz-range-thumb {
  height: 16px;
  width: 16px;
  border: 2px solid var(--purple);
  border-radius: 50%;
  background: var(--bg);
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 6px rgba(109, 40, 217, 0.2);
  transition: transform 0.1s ease, border-color 0.1s ease;
}

.slider-wrapper input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.15);
  border-color: var(--purple-soft);
}



/* ========================================= */
/* ---------- RESPONSIVE MEDIA QUERIES ------ */
/* ========================================= */

/* ---------- max-width: 960px (Admin) ---------- */
@media (max-width: 960px) {
  .admin-layout {
    grid-template-columns: 220px 1fr;
  }
  .admin-content {
    padding: 30px 24px 60px;
  }
}

/* ---------- max-width: 920px (Home Filters Panel) ---------- */
@media (max-width: 920px) {
  .home-filter-panel {
    grid-template-columns: 1fr;
    grid-template-areas:
      "airlines"
      "stops"
      "geo-filters"
      "legend"
      "legend-box";
    gap: 10px;
  }
  .filter-airlines {
    grid-area: airlines;
    display: block;
  }
  .filter-airlines .filter-card-head,
  .filter-airlines .filter-card-body {
    grid-area: auto;
  }
  .filter-stops {
    grid-area: stops;
    grid-template-columns: 1fr;
    border-left: 0;
    padding-left: 0;
  }
  .chips-groups-grid {
    grid-template-columns: 1fr;
  }
  .legend-toggle-row { justify-content: flex-start; }
}

/* ---------- max-width: 768px (Admin) ---------- */
@media (max-width: 768px) {
  .admin-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  
  .admin-sidebar {
    height: auto;
    position: relative;
    padding: 24px 20px 16px;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  
  .sidebar-header {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
  }
  
  .sidebar-header .brand h1 {
    font-size: 24px;
  }
  
  .sidebar-header .back-link {
    margin-top: 0;
  }
  
  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
    gap: 6px;
    scrollbar-width: none; /* Firefox */
  }
  
  .sidebar-menu::-webkit-scrollbar {
    display: none; /* Safari/Chrome */
  }
  
  .sidebar-item {
    padding: 8px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
  
  .admin-content {
    padding: 24px 16px 60px;
  }
}

/* ---------- max-width: 640px (Mobile Main Page & Modals) ---------- */
@media (max-width: 640px) {
  html { -webkit-text-size-adjust: 100%; }

  .wrap {
    width: 100%;
    padding: 0 14px 48px;
    overflow-x: hidden;
  }

  header {
    padding: 22px 0 16px;
    gap: 12px;
    align-items: flex-start;
  }

  .brand .route {
    font-size: 9px;
    letter-spacing: 0.22em;
    margin-bottom: 6px;
  }

  .brand h1 {
    font-size: 27px;
    line-height: 1.08;
    max-width: 360px;
  }

  .brand h1 em {
    display: block;
    margin-top: 4px;
  }

  .desktop-dot { display: none; }

  .meta {
    width: 100%;
    text-align: left;
    font-size: 10.5px;
    line-height: 1.75;
  }

  .home-filter-panel {
    margin-top: 14px;
    grid-template-columns: 1fr;
    grid-template-areas:
      "airlines"
      "stops"
      "geo-filters"
      "legend"
      "legend-box";
    gap: 10px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
  }

  .filter-card,
  .filter-stops {
    min-height: 0;
    display: block;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.72);
    padding: 10px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(76, 29, 149, 0.03);
  }

  .filter-card-head {
    margin-bottom: 8px;
    gap: 10px;
  }

  .filter-heading {
    font-size: 13px;
    gap: 7px;
  }

  .filter-head-icon {
    width: 18px;
    height: 18px;
  }

  .filter-all {
    min-width: 62px;
    padding: 5px 13px;
    font-size: 12.5px;
    margin-left: 0;
  }

  .chips-row,
  .chips-top-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .chips-group-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 8px;
  }

  .chips-group-row + .chips-group-row { margin-top: 6px; }

  .alliance-label {
    width: 92px;
    flex: 0 0 92px;
    padding: 0;
    border-right: 0;
    gap: 6px;
  }

  .alliance-logo {
    width: 22px;
    height: 22px;
  }

  .alliance-label .alliance-cn { font-size: 11.5px; }
  .alliance-label .alliance-en { font-size: 7.5px; }

  .group-chip-list {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 1px;
    scrollbar-width: none;
  }

  .group-chip-list::-webkit-scrollbar {
    display: none;
  }

  .chip {
    flex: 0 0 66px;
    min-height: 34px;
    justify-content: center;
    gap: 4px;
    padding: 5px 6px;
    font-size: 12.5px;
    border-radius: 8px;
  }

  .chip-logo {
    width: 17px;
    height: 17px;
  }

  .stop-segmented {
    max-width: none !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    border-radius: 8px !important;
    gap: 1px !important;
    background: var(--line-strong) !important;
    border: 1px solid var(--line-strong) !important;
    overflow: hidden !important;
  }

  .stop-segmented .chip {
    padding: 10px 6px !important;
    font-size: 12.5px !important;
    border: none !important;
    margin: 0 !important;
  }

  .legend-toggle-row {
    margin-top: 10px;
    justify-content: stretch;
  }

  .legend-toggle {
    width: 100%;
    text-align: center;
    padding: 8px 10px;
  }

  #legend-box {
    padding: 12px !important;
  }

  #legend-box > div:first-child {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  #legend-search {
    max-width: none !important;
  }

  .home-cal-section { margin-top: 24px; }

  .section-title,
  .fare-table-title {
    font-size: 16px;
    line-height: 1.25;
  }

  .home-cal-bar {
    align-items: stretch;
    gap: 10px;
  }

  .month-nav {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .month-nav h2 {
    min-width: 0;
    flex: 1;
    font-size: 14px;
  }

  .month-nav button {
    width: 38px;
    height: 34px;
  }

  .toggle {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-radius: 8px;
  }

  .toggle button {
    min-height: 38px;
    padding: 8px 6px;
    font-size: 10px;
    letter-spacing: 0.04em;
  }

  .home-cal {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    gap: 3px !important;
    overflow-x: hidden !important;
    padding-bottom: 0 !important;
    margin-inline: 0 !important;
  }

  .home-cal::-webkit-scrollbar { display: none; }

  .home-cal .dow {
    min-width: 0 !important;
    font-size: 9px;
    padding-bottom: 4px;
  }

  .hday {
    min-width: 0 !important;
    min-height: 90px !important;
    padding: 4px 2px !important;
    box-sizing: border-box !important;
  }

  .hday .line {
    font-size: 10.5px !important;
    margin-top: 4px;
    padding: 0;
  }

  .hday .line .dst {
    margin-top: 2px;
    font-size: 9px !important;
  }

  .hday .line .flt {
    font-size: 8px !important;
  }

  .hday .line .stop {
    display: none !important;
  }

  .fare-table-title {
    margin-top: 26px;
    margin-bottom: 8px;
  }

  .fare-table {
    display: block;
  }

  .fare-table thead {
    display: none;
  }

  .fare-table tbody {
    display: grid;
    gap: 10px;
  }

  .fare-table tr:not(.country-header-row) {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 7px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    padding: 11px 10px;
    background: var(--bg);
  }

  .fare-table tr:not(.country-header-row)::before {
    content: attr(data-city) "\A" attr(data-city-en);
    white-space: pre;
    grid-column: 1;
    font-weight: 650;
    font-size: 16px;
    line-height: 1.15;
    color: var(--text);
  }

  .fare-table tr:not(.country-header-row)::after {
    content: attr(data-route);
    grid-column: 2;
    justify-self: end;
    align-self: start;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--purple);
    font-weight: 600;
    letter-spacing: 0.04em;
    white-space: nowrap;
  }

  .fare-table td {
    display: block;
    border: 0;
    padding: 0;
    font-size: 12.5px;
  }

  .fare-table td[rowspan] {
    grid-row: auto;
  }

  .fare-table .city-cell,
  .fare-table .route-cell {
    display: none;
  }

  .fare-table .cabin-cell {
    grid-column: 1 / -1;
    width: fit-content;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(109, 40, 217, 0.08);
  }

  .fare-table .date-cell { grid-column: 1 / -1; }

  .fare-table .details-cell { grid-column: 1 / -1; }

  .fare-table .award-cell {
    grid-column: 1 / -1;
    min-width: 0;
    padding: 7px 8px;
    border-top: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg-soft);
  }

  .fare-table .booking-cell {
    grid-column: 1 / -1;
  }

  .cell-city .cn { font-size: 16px; }
  .cell-city .en { font-size: 10px; }
  .cell-route { font-size: 11px; }
  .cell-price .num { font-size: 13px; }
  .cell-price .sub { font-size: 10px; line-height: 1.35; }
  .cell-price {
    min-width: 0;
  }
  .price-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
  .time-badge {
    display: flex;
    width: 100%;
    font-size: 9.5px;
    padding: 5px 6px;
  }
  .cell-none {
    display: block;
    min-height: 18px;
  }
  .flight-detail {
    min-width: 0;
    max-width: none;
    font-size: 10.5px;
    line-height: 1.4;
  }

  .book-link {
    width: 100%;
    text-align: center;
    padding: 7px 10px;
    margin: 0 0 5px;
  }

  footer {
    margin-top: 40px;
    gap: 8px;
    flex-direction: column;
    font-size: 9.5px;
  }

  .overlay {
    padding: 0;
  }

  .sheet {
    min-height: 100vh;
    max-width: none;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 18px 14px 28px;
  }

  .sheet-head {
    margin-bottom: 16px;
    gap: 12px;
  }

  .sheet-head h2 {
    font-size: 22px;
    width: 100%;
  }

  .sheet-head h2 .mono {
    font-size: 10px;
    letter-spacing: 0.14em;
  }

  .controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .close-x {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    background: var(--bg);
  }

  .cal {
    grid-template-columns: repeat(7, minmax(0, 1fr)) !important;
    gap: 3px !important;
  }

  .day {
    min-height: 52px !important;
    min-width: 0 !important;
    padding: 4px 2px !important;
    box-sizing: border-box !important;
  }

  .day .d {
    font-size: 8.5px !important;
  }

  .day .v {
    font-size: 9px !important;
    margin-top: 5px !important;
  }

  .day .p {
    font-size: 7.5px !important;
    margin-top: 1px !important;
    gap: 2px !important;
  }

  .day .p .lbl-logo {
    width: 11px !important;
    height: 11px !important;
    border-radius: 2px !important;
  }

  .detail-row {
    grid-template-columns: 1fr !important;
    font-size: 12px !important;
    padding: 10px 0 !important;
  }

  .detail-row .prog {
    font-weight: 600 !important;
    color: var(--text) !important;
    font-size: 13px !important;
  }

  .detail-row .val {
    justify-self: start !important;
    font-size: 14px !important;
    margin-top: 2px !important;
    margin-bottom: 4px !important;
    color: var(--purple-deep) !important;
    font-weight: 700 !important;
  }

  .detail-row .more .book-btn {
    display: block !important;
    text-align: center !important;
    margin-top: 8px !important;
    padding: 8px 16px !important;
    background: var(--purple) !important;
    color: #fff !important;
    border-radius: 8px !important;
    text-decoration: none !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(109, 40, 217, 0.15) !important;
  }

  .detail-row .more .book-btn-sep {
    display: none !important;
  }

  /* Responsive Calendar Price Labels Hiding */
  .v-lbl,
  .v-tax,
  .hday .dst .city-en {
    display: none !important;
  }

  /* Country Header Separator Rules */
  .fare-table tr.country-header-row {
    display: block !important;
    background: transparent !important;
    border: none !important;
    padding: 14px 4px 6px !important;
    margin-top: 12px !important;
    box-shadow: none !important;
    cursor: default !important;
  }
  
  .fare-table tr.country-header-row td.country-header-cell {
    display: block !important;
    background: transparent !important;
    color: var(--purple-deep) !important;
    font-family: var(--sans) !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    padding: 0 !important;
    letter-spacing: 0.05em !important;
    border-bottom: none !important;
    text-transform: uppercase !important;
  }

  /* Geo Multi-Select Filters Mobile Stack Layout */
  .geo-filter-row {
    display: flex !important;
    flex-direction: column !important;
    gap: 12px !important;
    align-items: stretch !important;
    width: 100% !important;
  }

  .geo-filter-item {
    width: 100% !important;
  }

  .geo-filter-item .dropdown {
    width: 100% !important;
  }

  .geo-filter-item .dropdown-btn {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .dropdown-content {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .geo-filter-item:last-child {
    margin-left: 0 !important;
    width: 100% !important;
  }

  .geo-filter-item .reset-btn {
    width: 100% !important;
    justify-content: center !important;
    box-sizing: border-box !important;
  }

  /* Table Header and Month Slider Layout on Mobile */
  .table-title-bar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    margin-top: 24px !important;
    margin-bottom: 12px !important;
  }

  .month-slider-container {
    width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
    padding: 10px 14px !important;
  }

  .slider-title-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .slider-wrapper {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Slider Thumbs touch target optimizations on Mobile */
  .slider-wrapper input[type="range"]::-webkit-slider-thumb {
    height: 22px !important;
    width: 22px !important;
  }

  .slider-wrapper input[type="range"]::-moz-range-thumb {
    height: 22px !important;
    width: 22px !important;
  }
}

/* ===== 语言切换按钮 (i18n) ===== */
.lang-toggle-btn {
  font-family: var(--mono, monospace);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 5px 10px;
  border: 1px solid var(--line-strong, #d8d4cd);
  border-radius: 8px;
  background: var(--bg-soft, #f7f5f0);
  color: var(--purple-deep, #2b145f);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.lang-toggle-btn:hover {
  border-color: var(--purple, #6b46c1);
  background: rgba(107, 70, 193, .06);
}
.lang-toggle-floating {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

/* ===== 方向切换 Tabs（西雅图出发 / 到达）===== */
.direction-tabs {
  display: flex;
  gap: 8px;
  margin: 4px 0 18px;
  border-bottom: 1px solid var(--line-strong, #d8d4cd);
}
.direction-tab {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 10px 18px;
  border: 0;
  background: transparent;
  color: var(--text-dim, #777);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.direction-tab:hover { color: var(--purple, #6b46c1); }
.direction-tab.on {
  color: var(--purple-deep, #2b145f);
  border-bottom-color: var(--purple, #6b46c1);
}

/* ===== 票价提醒弹层 ===== */
.alert-list { display: flex; flex-direction: column; gap: 10px; margin: 16px 0; }
.alert-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line-strong, #d8d4cd); border-radius: 8px;
  padding: 12px 14px; background: var(--bg-soft, #faf8f4); flex-wrap: wrap;
}
.alert-card.off { opacity: .55; }
.alert-card .ac-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.alert-card .ac-route { font-family: var(--mono); font-weight: 600; color: var(--purple-deep, #2b145f); letter-spacing: .04em; }
.alert-card .ac-meta { font-size: 12px; color: var(--text-dim, #777); }
.alert-card .ac-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
/* Enabled：iOS 风格开关 */
.alert-card .ac-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 12px; color: var(--text-dim); user-select: none; }
.alert-card .ac-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.alert-card .ac-switch-track { position: relative; width: 34px; height: 18px; border-radius: 999px; background: var(--line-strong, #d8d4cd); transition: background .15s; flex-shrink: 0; }
.alert-card .ac-switch-thumb { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.alert-card .ac-switch input:checked + .ac-switch-track { background: var(--purple, #6b46c1); }
.alert-card .ac-switch input:checked + .ac-switch-track .ac-switch-thumb { transform: translateX(16px); }
.alert-card .ac-switch input:focus-visible + .ac-switch-track { box-shadow: 0 0 0 2px rgba(107,70,193,.35); }
.alert-card .ac-switch-text { white-space: nowrap; }
/* Edit / Delete：小号 pill 按钮 */
.alert-card .ac-btn {
  font-family: var(--sans); font-size: 12px; font-weight: 500; line-height: 1;
  padding: 6px 13px; border-radius: 7px; border: 1px solid var(--line-strong, #d8d4cd);
  background: #fff; color: var(--text, #333); cursor: pointer; white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.alert-card .ac-btn:hover { border-color: var(--purple, #6b46c1); color: var(--purple, #6b46c1); }
.alert-card .ac-del:hover { border-color: var(--bad, #c0392b); color: var(--bad, #c0392b); background: rgba(192,57,43,.05); }

.alert-form-title { font-family: var(--sans); font-size: 14px; color: var(--purple-deep); font-weight: 600; margin: 18px 0 12px; }
.alert-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.alert-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-dim, #777); }
.alert-form select, .alert-form input { width: 100%; box-sizing: border-box; }
.alert-form-actions { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.alert-form-actions .btn { width: auto; padding: 8px 22px; }
@media (max-width: 640px) { .alert-form { grid-template-columns: 1fr; } }

/* 内嵌「提醒」视图：表单区做成卡片，和弹窗时观感一致但常驻页面 */
.alerts-view { margin-top: 6px; }
.alerts-view #alert-form-wrap {
  margin-top: 18px;
  padding: 18px 20px 20px;
  background: var(--bg-soft, #f7f5f0);
  border: 1px solid var(--line-strong, #d8d4cd);
  border-radius: 12px;
}
.alerts-view .alert-form-title { margin-top: 0; }

/* 内嵌提醒表单：纵向排布，方向/目的地/舱位各占一行，里程+日期同一行 */
.alerts-view .alert-form { display: flex; flex-direction: column; gap: 14px; }
.alerts-view .af-field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-dim, #777); }
.alerts-view .af-num-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 16px; }
.alerts-view .af-toggle { width: fit-content; max-width: 100%; }
.alerts-view .af-toggle button { white-space: nowrap; }
@media (max-width: 640px) {
  .alerts-view .af-num-row { grid-template-columns: 1fr; }
  .alerts-view .af-toggle { width: 100%; }
}

/* 目的地 smart-select（可搜索下拉） */
.smart-select { position: relative; }
.smart-select > input[type="text"] { width: 100%; box-sizing: border-box; }
.smart-select-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  max-height: 260px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line-strong, #d8d4cd);
  border-radius: 8px; box-shadow: 0 10px 28px rgba(0, 0, 0, .12);
}
.smart-select-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 8px 12px; font-size: 13px; cursor: pointer;
}
.smart-select-item:hover, .smart-select-item.active { background: rgba(107, 70, 193, .08); }
.smart-select-item .ss-iata { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.smart-select-empty { padding: 10px 12px; font-size: 12px; color: var(--text-faint, #888); }

/* ===== 轻量提示条 toast ===== */
#toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(12px);
  background: var(--purple-deep, #2b145f); color: #fff; padding: 11px 20px;
  border-radius: 8px; font-size: 13px; font-family: var(--sans); box-shadow: 0 6px 24px rgba(0,0,0,.18);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 9999; max-width: 80vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
