*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  color: inherit;
  text-decoration: none;
}

.logo-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--btn-text, #fff);
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-text {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: var(--btn-text, #fff);
  border: none;
  border-radius: var(--btn-radius, var(--radius-sm));
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

/* Кнопка отправленной формы на страницах входа — спиннер цветом текста кнопки (static/js/auth-busy.js) */
.is-busy-btn {
  cursor: progress;
}
/* Кнопки со своим display (block у «Выйти» / «К выбору способа») — кольцо строчным блоком, не flex */
.is-busy-btn::before,
.busy-spinner {
  content: "";
  display: inline-block;
  vertical-align: middle;
  box-sizing: border-box;
  flex: none;
  width: 1em;
  height: 1em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: busy-spinner-rotate 0.8s linear infinite;
}
.is-busy-btn::before {
  margin-right: 0.5em;
}
@keyframes busy-spinner-rotate {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .is-busy-btn::before,
  .busy-spinner {
    animation-duration: 2.4s;
  }
}

.field-input {
  width: 100%;
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.hidden {
  display: none !important;
}

.cookie-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  padding: 1rem 1.25rem max(1rem, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 3px solid var(--accent);
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.18);
}

.cookie-banner[hidden] {
  display: none !important;
}

.cookie-banner__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.cookie-banner__text {
  margin: 0;
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--text);
}

.cookie-banner__ok {
  flex-shrink: 0;
  padding: 0.55rem 1.2rem;
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .cookie-banner__inner {
    flex-direction: column;
    align-items: stretch;
  }

  .cookie-banner__ok {
    width: 100%;
  }
}

@media print {
  .cookie-banner {
    display: none !important;
  }
}

/* Окно «Сессия завершена» после простоя */
.idle-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, 0.55);
}
.idle-modal[hidden] { display: none; }
.idle-modal__box {
    max-width: 420px;
    width: 100%;
    padding: 24px;
    border-radius: 12px;
    background: var(--surface, #fff);
    color: var(--text, #111);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.idle-modal__title { margin: 0 0 12px; font-size: 20px; }
.idle-modal__text { margin: 0 0 20px; line-height: 1.5; }
.idle-modal__actions { display: flex; justify-content: flex-end; }
.idle-modal__actions .btn-primary { text-decoration: none; }

/* Багаж по типам пассажиров (Портбилет) — partials/avia_luggage.html */
.luggage-table-wrap {
  overflow-x: auto;
  /* В колонке (раскрытый тариф на телефоне) — не шире карточки, иначе прокрутка не включится. */
  max-width: 100%;
}
.luggage-table {
  border-collapse: collapse;
  font-size: inherit;
}
.luggage-table th,
.luggage-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.1rem 1rem 0.1rem 0;
}
.luggage-table thead th {
  font-weight: 600;
}
.luggage-table tbody th {
  font-weight: 400;
  white-space: nowrap;
}

/* «Не показывается покупателю» — перечёркнутый глаз у комиссии покупателя (Софья 21.10, #410504) */
.hidden-from-buyer {
  display: inline-flex;
  margin-left: 0.3rem;
  vertical-align: -2px;
  color: var(--muted);
  cursor: help;
}
.hidden-from-buyer[hidden] {
  display: none;
}

/* Телефон с кодом страны (замечание №23): код страны справа в поле, ошибка — под полем (static/js/app.js) */
.phone-intl {
  position: relative;
  display: block;
}
.phone-intl > input {
  width: 100%;
  padding-right: 2.6rem;
}
/* Сильнее общего form input[type="text"]:not(…) — иначе рамка остаётся серой */
form .phone-intl > input[data-phone-intl].is-invalid {
  border-color: var(--danger);
  outline-color: var(--danger);
}
.phone-intl__country {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}
.phone-intl__error {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--danger, #dc2626);
}
.phone-intl__error[hidden] {
  display: none;
}

/* Подсказка в стиле сайта вместо системной (title) — static/js/hint.js; вид как у окна (i) в гостиницах */
.app-hint {
  position: fixed;
  z-index: 1000;
  max-width: min(22rem, calc(100vw - 1rem));
  padding: 0.4rem 0.6rem;
  border-radius: 8px;
  background: #1f2937;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  text-align: left;
  white-space: pre-line;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  pointer-events: none;
}

.app-hint[hidden] { display: none; }
