:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #222222);
  --hint: var(--tg-theme-hint-color, #999999);
  --link: var(--tg-theme-link-color, #2481cc);
  --btn: var(--tg-theme-button-color, #2481cc);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --card: var(--tg-theme-secondary-bg-color, #f4f4f5);
  --danger: #e53935;
  --ok: #43a047;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 90px; }

.loading { text-align: center; color: var(--hint); padding: 60px 0; }

h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
h2 { font-size: 17px; font-weight: 600; margin: 20px 0 10px; }
.subtitle { color: var(--hint); font-size: 14px; margin-bottom: 16px; }

.card {
  background: var(--card);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}

.route-head { font-weight: 700; font-size: 16px; margin-bottom: 6px; }
.route-meta { color: var(--hint); font-size: 13px; margin-bottom: 10px; }
.deal-discount { color: var(--ok); font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.deal-discount .muted { color: var(--hint); font-weight: 400; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

button {
  font: inherit;
  border: none;
  border-radius: 10px;
  padding: 11px 16px;
  background: var(--btn);
  color: var(--btn-text);
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s;
}
button:active { opacity: 0.75; }
button:disabled { opacity: 0.45; cursor: default; }
button.ghost {
  background: transparent;
  color: var(--link);
  border: 1px solid var(--link);
}
button.plain {
  background: transparent;
  color: var(--link);
  padding: 6px 4px;
  font-weight: 500;
}
button.danger { background: var(--danger); }
button.small { padding: 7px 12px; font-size: 14px; border-radius: 8px; }

input, select {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--hint);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  margin-bottom: 10px;
}
input:focus, select:focus { outline: 2px solid var(--link); outline-offset: -1px; }
input::placeholder { color: var(--hint); }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.chip {
  background: var(--card);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  user-select: none;
}
.chip.selected { border-color: var(--btn); background: var(--btn); color: var(--btn-text); }
.chip small { opacity: 0.7; margin-left: 5px; }

.airport-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 12px;
  border-radius: 10px;
  background: var(--card);
  margin-bottom: 6px;
  cursor: pointer;
}
.airport-item .iata { font-weight: 700; margin-right: 8px; }
.airport-item .muted { color: var(--hint); font-size: 13px; }
.airport-item.added { outline: 2px solid var(--ok); }

.tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--card);
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  z-index: 10;
}
.tabs button {
  flex: 1;
  background: transparent;
  color: var(--hint);
  padding: 8px 4px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
}
.tabs button.active { color: var(--link); background: var(--card); }

.steps { display: flex; gap: 6px; margin-bottom: 16px; }
.step-dot { flex: 1; height: 4px; border-radius: 2px; background: var(--card); }
.step-dot.done { background: var(--btn); }

.wizard-actions { display: flex; gap: 10px; margin-top: 18px; }
.wizard-actions button { flex: 1; }

.hint-text { color: var(--hint); font-size: 13px; margin: 6px 0 12px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--card);
  color: var(--hint);
}
.badge.ok { background: rgba(67, 160, 71, 0.15); color: var(--ok); }
.badge.warn { background: rgba(229, 57, 53, 0.12); color: var(--danger); }

.tariff-price { font-size: 20px; font-weight: 800; margin: 4px 0 8px; }
ul.features { list-style: none; margin: 8px 0 14px; }
ul.features li { padding: 3px 0 3px 22px; position: relative; font-size: 14px; }
ul.features li::before { content: "✓"; position: absolute; left: 4px; color: var(--ok); font-weight: 700; }

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 84px;
  background: var(--text);
  color: var(--bg);
  padding: 11px 18px;
  border-radius: 12px;
  font-size: 14px;
  max-width: 86%;
  text-align: center;
  z-index: 100;
  opacity: 1;
  transition: opacity 0.25s;
}
.toast.hidden { opacity: 0; pointer-events: none; }

.empty { text-align: center; color: var(--hint); padding: 40px 12px; }
.empty .big { font-size: 42px; margin-bottom: 10px; }

.status-line { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--card); font-size: 14px; }
.status-line:last-child { border-bottom: none; }
.status-line .k { color: var(--hint); }
.status-line .v { font-weight: 600; text-align: right; }

.hidden { display: none !important; }
