/* Vag Group PWA — «инженерный тёмный» + красный акцент (зеркало Theme.swift). */
:root {
  --bg: #121417;
  --surface: #1f2126;
  --surface-hi: #2b2e36;
  --accent: #e01c29;
  --text: #ffffff;
  --text-dim: #a6a6a6;
  --success: #4dc778;
  --warning: #fab333;
  --radius: 16px;
  --radius-sm: 12px;
  --tabbar-h: 64px;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }

.app {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 20px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
}

/* ---- Типографика ---- */
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.muted { color: var(--text-dim); }
.small { font-size: 14px; }
.center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---- Хедер экрана ---- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 4px 0 16px;
}
.topbar__title { font-size: 20px; font-weight: 700; }
.back {
  background: var(--surface); color: var(--text);
  border: none; border-radius: 10px; width: 40px; height: 40px;
  font-size: 20px; cursor: pointer; flex: 0 0 auto;
}

/* ---- Карточки ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
}
.card--hi { background: var(--surface-hi); }
.card + .card { margin-top: 0; }

/* ---- Кнопки ---- */
.btn {
  display: block; width: 100%;
  background: var(--accent); color: #fff;
  border: none; border-radius: 14px;
  padding: 16px; font-size: 16px; font-weight: 600;
  cursor: pointer; text-align: center;
  transition: opacity .15s;
}
.btn:active { opacity: .8; }
.btn:disabled { opacity: .5; cursor: default; }
.btn--ghost { background: var(--surface-hi); }
.btn--sm { padding: 11px; font-size: 14px; border-radius: 11px; }
.btn--link { background: none; color: var(--accent); padding: 8px; width: auto; }

/* ---- Формы ---- */
label.field { display: block; }
label.field > span { display: block; font-size: 13px; color: var(--text-dim); margin: 0 0 6px 2px; }
.input, select.input, textarea.input {
  width: 100%;
  background: var(--surface-hi); color: var(--text);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 14px; font-size: 16px; font-family: inherit;
  outline: none;
}
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 90px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--surface-hi); color: var(--text);
  border: 1px solid transparent; border-radius: 999px;
  padding: 9px 14px; font-size: 14px; cursor: pointer;
}
.chip[aria-pressed="true"] { border-color: var(--accent); color: #fff; background: rgba(224,28,41,.18); }

/* ---- Бейджи статуса ---- */
.badge {
  display: inline-block; font-size: 12px; font-weight: 600;
  padding: 5px 10px; border-radius: 999px;
}
.badge--accent  { color: var(--accent);   background: rgba(224,28,41,.15); }
.badge--success { color: var(--success);  background: rgba(77,199,120,.15); }
.badge--warning { color: var(--warning);  background: rgba(250,179,51,.15); }
.badge--dim     { color: var(--text-dim); background: rgba(166,166,166,.15); }

/* ---- Список визитов ---- */
.visit {
  display: block; text-decoration: none; color: inherit;
  background: var(--surface); border-radius: var(--radius); padding: 16px;
}
.visit__car { font-weight: 600; margin-bottom: 6px; }

/* ---- Трекер статусов ---- */
.tracker { display: flex; flex-direction: column; gap: 0; }
.step { display: flex; gap: 14px; align-items: flex-start; }
.step__rail { display: flex; flex-direction: column; align-items: center; }
.step__dot {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-hi); color: transparent;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex: 0 0 auto;
}
.step__line { width: 2px; flex: 1; min-height: 26px; background: var(--surface-hi); }
.step--done .step__dot { background: var(--success); color: #06231a; }
.step--current .step__dot { background: var(--accent); color: #fff; }
.step--done .step__line, .step--current .step__line { background: var(--success); }
.step__label { padding-bottom: 22px; padding-top: 1px; }
.step--current .step__label { font-weight: 600; }
.step--pending .step__label { color: var(--text-dim); }

/* ---- Услуги / буллеты ---- */
.bullet { display: flex; gap: 10px; align-items: flex-start; }
.bullet::before { content: "✓"; color: var(--accent); font-weight: 700; }

/* ---- Hero ---- */
.hero h1 { margin-bottom: 8px; }
.hero__sub { color: var(--text-dim); margin-bottom: 16px; white-space: pre-line; }

/* ---- Таб-бар ---- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: rgba(18,20,23,.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--surface-hi);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; text-decoration: none; color: var(--text-dim); font-size: 11px;
}
.tab__ico { font-size: 20px; line-height: 1; }
.tab.is-active { color: #fff; }
.tab.is-active .tab__ico { filter: drop-shadow(0 0 6px rgba(224,28,41,.6)); }

/* ---- Модалка авторизации ---- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: flex-end; justify-content: center; z-index: 50;
}
.sheet {
  background: var(--bg); width: 100%; max-width: 640px;
  border-radius: 20px 20px 0 0; padding: 24px 20px calc(28px + env(safe-area-inset-bottom));
  animation: slideup .22s ease;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet__grab { width: 40px; height: 4px; background: var(--surface-hi); border-radius: 2px; margin: 0 auto 18px; }

/* ---- Тост ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 20px); transform: translateX(-50%);
  background: var(--surface-hi); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; z-index: 60; max-width: 90%; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

/* ---- Загрузка ---- */
.spinner { text-align: center; color: var(--text-dim); padding: 40px 0; }

.notice { font-size: 13px; color: var(--text-dim); line-height: 1.5; }
.mono { font-variant-numeric: tabular-nums; }

/* ---- Полоска установки ---- */
/* .installbar задаёт display:flex, что перебивало бы атрибут [hidden];
   эта строка возвращает hidden приоритет — иначе плашка видна всегда. */
.installbar[hidden] { display: none; }
.installbar {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex; align-items: center; gap: 12px;
  max-width: 640px; margin: 0 auto; padding: 12px 14px;
  background: var(--surface-hi);
  border-top: 2px solid var(--accent);
  box-shadow: 0 -6px 20px rgba(0,0,0,.35);
}
.installbar__text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.installbar .btn { width: auto; flex: 0 0 auto; }
.installbar__x {
  background: none; border: none; color: var(--text-dim);
  font-size: 16px; cursor: pointer; padding: 6px; flex: 0 0 auto;
}

/* ---- Шаги iOS-установки ---- */
.steps { display: flex; flex-direction: column; gap: 14px; }
.step-line { display: flex; gap: 12px; align-items: center; }
.step-num {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.ios-share { font-size: 20px; }
