/* Native look: colors come from Telegram's theme variables, fallbacks are the iOS light palette */
:root {
  --bg: var(--tg-theme-secondary-bg-color, #efeff4);
  --section: var(--tg-theme-section-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #000000);
  --hint: var(--tg-theme-hint-color, #8e8e93);
  --link: var(--tg-theme-link-color, #007aff);
  --accent: var(--tg-theme-accent-text-color, #007aff);
  --button: var(--tg-theme-button-color, #007aff);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --section-header: var(--tg-theme-section-header-text-color, #6d6d72);
  --separator: var(--tg-theme-section-separator-color, rgba(60, 60, 67, 0.29));
  --subtitle: var(--tg-theme-subtitle-text-color, #8e8e93);
  --destructive: var(--tg-theme-destructive-text-color, #ff3b30);
  --green: #34c759; --orange: #ff9500; --red: #ff3b30;
  --tint: rgba(0, 122, 255, 0.12);
  --fill: rgba(120, 120, 128, 0.16);
  --safe-bottom: var(--tg-safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
  --content-top: var(--tg-content-safe-area-inset-top, 0px);
}
@supports (color: color-mix(in srgb, red 10%, transparent)) {
  :root { --tint: color-mix(in srgb, var(--button) 12%, transparent); }
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--tg-theme-secondary-bg-color, #000000);
    --section: var(--tg-theme-section-bg-color, #1c1c1e);
    --text: var(--tg-theme-text-color, #ffffff);
    --hint: var(--tg-theme-hint-color, #98989e);
    --link: var(--tg-theme-link-color, #3e88f7);
    --accent: var(--tg-theme-accent-text-color, #3e88f7);
    --button: var(--tg-theme-button-color, #3e88f7);
    --section-header: var(--tg-theme-section-header-text-color, #8d8d93);
    --separator: var(--tg-theme-section-separator-color, rgba(84, 84, 88, 0.65));
    --subtitle: var(--tg-theme-subtitle-text-color, #98989e);
    --fill: rgba(120, 120, 128, 0.24);
    --green: #30d158; --orange: #ff9f0a; --red: #ff453a;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif; -webkit-font-smoothing: antialiased; font-size: 17px; line-height: 1.3; }
body { overscroll-behavior-y: none; }
a { color: var(--link); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: left; }
input, select { font: inherit; color: inherit; }
.app { padding: calc(12px + var(--content-top)) 16px calc(96px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 14px; min-height: 100vh; }
.app.no-main { padding-bottom: calc(24px + var(--safe-bottom)); }

.h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.4px; line-height: 34px; margin: 0; }
.h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.3px; margin: 0; }
.sub { font-size: 15px; color: var(--hint); line-height: 20px; }
.hint { font-size: 13px; color: var(--hint); line-height: 18px; padding: 0 4px; }
.small { font-size: 13px; color: var(--hint); }
.section-title { font-size: 13px; color: var(--section-header); letter-spacing: 0.2px; text-transform: uppercase; padding: 0 4px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.b { font-weight: 600; }
.price { font-size: 20px; font-weight: 700; white-space: nowrap; }
.muted { color: var(--hint); }
.green { color: var(--green); } .orange { color: var(--orange); } .red { color: var(--red); }
.link { color: var(--link); }

.card { background: var(--section); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.card.tap:active { opacity: 0.7; }
.card.selected { box-shadow: inset 0 0 0 2px var(--button); }
.list { background: var(--section); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 8px 16px; width: 100%; }
.row + .row { border-top: 0.5px solid var(--separator); }
.row:active { background: var(--fill); }
.row .label { font-size: 13px; color: var(--hint); }
.row .value { font-size: 17px; font-weight: 500; }
.row .col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row .val-right { color: var(--hint); font-size: 15px; text-align: right; }
.row input { width: 100%; background: none; border: 0; outline: 0; padding: 0; font-size: 17px; }
.row input::placeholder { color: var(--hint); }
.two { display: grid; grid-template-columns: 1fr 1fr; }
.two > .row { border-top: 0; }
.two > .row + .row { border-left: 0.5px solid var(--separator); }
.chev { flex-shrink: 0; color: var(--hint); opacity: 0.6; }
.icon-box { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.seg { height: 32px; border-radius: 9px; background: var(--fill); padding: 2px; display: grid; gap: 2px; }
.seg button { border-radius: 7px; font-size: 13px; font-weight: 500; text-align: center; }
.seg button.on { background: var(--section); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { height: 34px; padding: 0 12px; border-radius: 17px; background: var(--section); font-size: 15px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip.tint { background: var(--tint); color: var(--accent); font-weight: 500; }
.chip.on { background: var(--button); color: var(--button-text); font-weight: 500; }
.chip:active { opacity: 0.7; }
.dot { width: 8px; height: 8px; border-radius: 4px; flex-shrink: 0; display: inline-block; }
.badge { height: 20px; padding: 0 8px; border-radius: 10px; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; white-space: nowrap; }
.badge.blue { background: var(--tint); color: var(--accent); }
.badge.green { background: rgba(52, 199, 89, 0.15); color: #1e9e4a; }
.badge.grey { background: var(--fill); color: var(--hint); }
.bar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--green); }

.strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.strip button { height: 62px; border-radius: 10px; background: var(--section); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.strip .d { font-size: 11px; color: var(--hint); }
.strip .p { font-size: 13px; font-weight: 600; }
.strip button.on { box-shadow: inset 0 0 0 2px var(--button); }
.strip button.on .d, .strip button.on .p { color: var(--accent); }
.strip .p.cheap { color: var(--green); font-weight: 700; }
.strip .p.none { color: var(--hint); font-weight: 400; }

.progress { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding: 24px 4px; }
.progress .line { font-size: 15px; color: var(--hint); display: flex; gap: 10px; align-items: center; }
.progress .line.cur { color: var(--text); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--fill); border-top-color: var(--button); animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: var(--section); border-radius: 12px; height: 110px; position: relative; overflow: hidden; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--fill), transparent); animation: shimmer 1.4s infinite; }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.itin { display: grid; grid-template-columns: 56px 16px minmax(0, 1fr); grid-template-rows: auto auto auto; gap: 0 10px; align-items: center; }
.itin .t { font-size: 17px; font-weight: 600; }
.itin .dot-o { width: 10px; height: 10px; border-radius: 5px; border: 2px solid var(--button); justify-self: center; }
.itin .dot-f { width: 10px; height: 10px; border-radius: 5px; background: var(--button); justify-self: center; }
.itin .ln { width: 2px; height: 28px; background: var(--fill); justify-self: center; }
.itin .city { font-size: 17px; }
.itin .dur { font-size: 13px; color: var(--hint); }
.divider { height: 0.5px; background: var(--separator); }

.cal { display: flex; flex-direction: column; gap: 14px; }
.cal .month { display: flex; flex-direction: column; gap: 6px; }
.cal .mname { font-size: 15px; font-weight: 600; padding: 0 4px; }
.cal .grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal .wd { font-size: 11px; color: var(--hint); text-align: center; }
.cal .day { height: 40px; border-radius: 10px; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.cal .day.past { color: var(--hint); opacity: 0.4; }
.cal .day.sel { background: var(--button); color: var(--button-text); font-weight: 600; }
.cal .day.mid { background: var(--tint); }
.cal .day.today { font-weight: 700; }

.tariffs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tariffs button { background: var(--section); border-radius: 12px; padding: 12px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tariffs button.on { box-shadow: inset 0 0 0 2px var(--button); }
.tariffs .n { font-size: 17px; font-weight: 600; }
.tariffs button.on .n { color: var(--accent); }
.tariffs .p { font-size: 20px; font-weight: 700; }
.tariffs .w { font-size: 12px; color: var(--hint); text-align: center; }
.check { width: 22px; height: 22px; border-radius: 11px; border: 1.5px solid var(--hint); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.check.on { background: var(--button); border-color: var(--button); }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 34px; height: 34px; border-radius: 17px; background: var(--fill); font-size: 20px; display: flex; align-items: center; justify-content: center; }
.stepper button:disabled { opacity: 0.35; }
.search { height: 40px; border-radius: 10px; background: var(--fill); display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.search input { flex: 1; background: none; border: 0; outline: 0; font-size: 17px; }
.pill-btn { height: 32px; padding: 0 12px; border-radius: 16px; background: var(--tint); color: var(--accent); font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pill-btn.solid { background: var(--button); color: var(--button-text); }
.big-btn { height: 50px; border-radius: 12px; background: var(--tint); color: var(--accent); font-size: 17px; font-weight: 600; display: flex; align-items: center; justify-content: center; width: 100%; }
.center { text-align: center; }
.empty { padding: 32px 8px; text-align: center; color: var(--hint); font-size: 15px; line-height: 20px; }

.fake-main { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 0 var(--safe-bottom); background: var(--bg); z-index: 10; }
.fake-main button { width: 100%; height: 50px; background: var(--button); color: var(--button-text); font-size: 17px; font-weight: 600; text-align: center; }
.fake-main button:disabled { opacity: 0.6; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(70px + var(--safe-bottom)); background: rgba(30, 30, 30, 0.92); color: #fff; padding: 12px 14px; border-radius: 12px; font-size: 15px; z-index: 20; text-align: center; }
