/* QRMyCar — дизайн-система. Mobile-first, без сборки.
   Токены → база → раскладка → компоненты → страницы → утилиты. */

/* ---------- Шрифты (локально, с кириллицей) ---------- */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-cyrillic-wght.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/manrope-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plate";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/roboto-condensed-cyrillic-wght.woff2") format("woff2");
  unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1;
}
@font-face {
  font-family: "Plate";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/roboto-condensed-latin-wght.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2022, U+2000-206F;
}

/* ---------- Токены ---------- */
:root {
  color-scheme: light;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-plate: "Plate", "Roboto Condensed", "Arial Narrow", sans-serif;

  --bg: #f3f2ee;
  --bg-elev: #ffffff;
  --surface-2: #f7f6f2;
  --surface-3: #eeece6;
  --text: #121418;
  --text-2: #3f444c;
  --muted: #676c75;
  --border: #e4e1d9;
  --border-strong: #cfcbc0;

  --accent: #2f5bff;
  --accent-hover: #2149e6;
  --accent-contrast: #ffffff;
  --accent-soft: #e8edff;
  --accent-text: #1e45e0;

  --warn: #e8590c;
  --warn-soft: #fff0e6;
  --warn-text: #a83a02;
  --danger: #d4271b;
  --danger-soft: #fdebe9;
  --danger-text: #b3190e;
  --success: #117a55;
  --success-soft: #e3f5ec;
  --success-text: #0b6a49;

  --plate-bg: #ffffff;
  --plate-ink: #0c0c0d;

  --shadow-1: 0 1px 2px rgb(17 19 23 / 6%), 0 1px 1px rgb(17 19 23 / 4%);
  --shadow-2: 0 10px 28px -12px rgb(17 19 23 / 22%), 0 2px 6px rgb(17 19 23 / 6%);
  --ring: 0 0 0 3px rgb(47 91 255 / 35%);

  --radius-s: 10px;
  --radius: 14px;
  --radius-l: 20px;
  --radius-pill: 999px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --tap: 48px;
  --tap-l: 56px;
  --dur: 160ms;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  --content: 760px;
  --gutter: 16px;
  --bottom-nav-h: 64px;

  --safe-top: max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px));
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1014;
    --bg-elev: #171a20;
    --surface-2: #1c2027;
    --surface-3: #232830;
    --text: #eef0f4;
    --text-2: #c3c8d1;
    --muted: #9ba2ae;
    --border: #272c35;
    --border-strong: #363c48;
    --accent: #3d63ff;
    --accent-hover: #5577ff;
    --accent-soft: #1b2446;
    --accent-text: #8ea6ff;
    --warn: #ff7a2e;
    --warn-soft: #3a2012;
    --warn-text: #ffb489;
    --danger: #ff5a4e;
    --danger-soft: #3b1614;
    --danger-text: #ff9a92;
    --success: #2fbf8a;
    --success-soft: #0f2d22;
    --success-text: #7fe0b8;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow-2: 0 12px 32px -12px rgb(0 0 0 / 70%);
    --ring: 0 0 0 3px rgb(109 139 255 / 45%);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1014;
  --bg-elev: #171a20;
  --surface-2: #1c2027;
  --surface-3: #232830;
  --text: #eef0f4;
  --text-2: #c3c8d1;
  --muted: #9ba2ae;
  --border: #272c35;
  --border-strong: #363c48;
  --accent: #3d63ff;
  --accent-hover: #5577ff;
  --accent-soft: #1b2446;
  --accent-text: #8ea6ff;
  --warn: #ff7a2e;
  --warn-soft: #3a2012;
  --warn-text: #ffb489;
  --danger: #ff5a4e;
  --danger-soft: #3b1614;
  --danger-text: #ff9a92;
  --success: #2fbf8a;
  --success-soft: #0f2d22;
  --success-text: #7fe0b8;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 40%);
  --shadow-2: 0 12px 32px -12px rgb(0 0 0 / 70%);
  --ring: 0 0 0 3px rgb(109 139 255 / 45%);
}

/* ---------- База ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-feature-settings: "tnum" 0;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img,
svg {
  display: block;
  max-width: 100%;
}
h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 800;
}
h1 {
  font-size: clamp(28px, 7vw, 40px);
}
h2 {
  font-size: 22px;
}
h3 {
  font-size: 18px;
  letter-spacing: -0.01em;
}
p {
  margin: 0;
}
a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover {
  text-decoration-thickness: 2px;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
legend {
  padding: 0;
}
:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
::selection {
  background: var(--accent-soft);
}
[hidden] {
  display: none !important;
}
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -60px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-s);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 700;
}
.skip-link:focus {
  top: var(--space-3);
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.icon {
  flex: none;
}

/* ---------- Раскладка ---------- */
.container {
  width: 100%;
  max-width: var(--content);
  margin-inline: auto;
  padding-inline: calc(var(--gutter) + var(--safe-left)) calc(var(--gutter) + var(--safe-right));
}
.container--narrow {
  max-width: 560px;
}
.container--wide {
  max-width: 1120px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap, var(--space-4));
}
.stack--s {
  --gap: var(--space-2);
}
.stack--m {
  --gap: var(--space-3);
}
.stack--l {
  --gap: var(--space-5);
}
.stack--xl {
  --gap: var(--space-6);
}
.row {
  display: flex;
  align-items: center;
  gap: var(--gap, var(--space-3));
  flex-wrap: wrap;
}
.row--between {
  justify-content: space-between;
}
.row--nowrap {
  flex-wrap: nowrap;
}
.grid-2 {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}
@media (min-width: 600px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
}
.grow {
  flex: 1 1 auto;
  min-width: 0;
}

/* ---------- Бренд ---------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: 18px;
}
.brand__mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: inset 0 -2px 0 rgb(0 0 0 / 12%);
}
.brand__mark svg {
  width: 20px;
  height: 20px;
}

/* ---------- Кнопки ---------- */
.btn {
  --btn-bg: var(--surface-3);
  --btn-fg: var(--text);
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  transition:
    background-color var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}
.btn:hover {
  text-decoration: none;
  filter: brightness(0.98);
}
.btn:active {
  transform: scale(0.98);
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}
.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-contrast);
  box-shadow: 0 6px 16px -8px var(--accent);
}
.btn--primary:hover {
  --btn-bg: var(--accent-hover);
  filter: none;
}
.btn--secondary {
  --btn-bg: var(--bg-elev);
  --btn-border: var(--border-strong);
}
.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--accent-text);
  padding-inline: var(--space-3);
}
.btn--ghost:hover {
  --btn-bg: var(--accent-soft);
}
.btn--danger {
  --btn-bg: var(--danger-soft);
  --btn-fg: var(--danger-text);
}
.btn--warn {
  --btn-bg: var(--warn);
  --btn-fg: #fff;
}
.btn--block {
  display: flex;
  width: 100%;
}
.btn--lg {
  min-height: var(--tap-l);
  font-size: 17px;
  border-radius: 16px;
}
.btn--sm {
  min-height: 40px;
  padding: 0 var(--space-4);
  font-size: 15px;
  border-radius: 12px;
}
.btn .spinner {
  display: none;
}
.btn.is-loading .spinner,
.htmx-request.btn .spinner,
.htmx-request .btn .spinner {
  display: block;
}
.btn.is-loading .btn__label-idle {
  display: none;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.btn-row > .btn,
.btn-row > form {
  flex: 1 1 auto;
}
.btn-row .btn {
  white-space: nowrap;
}
.btn-row > form > .btn {
  width: 100%;
}

/* ---------- Карточки ---------- */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  padding: var(--space-5) var(--space-4);
  box-shadow: var(--shadow-1);
}
@media (min-width: 600px) {
  .card {
    padding: var(--space-5);
  }
}
.card--flat {
  box-shadow: none;
}
.card--accent {
  background: linear-gradient(160deg, var(--accent) 0%, #4c2bd9 120%);
  color: #fff;
  border-color: transparent;
}
.card--accent a {
  color: #fff;
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.card__title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.card__title .icon {
  color: var(--accent-text);
}
.section-title {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.lead {
  font-size: 17px;
  color: var(--text-2);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 14px;
}
.tiny {
  font-size: 13px;
}
.center {
  text-align: center;
}
.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: var(--space-4) 0;
}

/* ---------- Бейджи и чипы ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  min-height: 28px;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.badge .icon {
  width: 15px;
  height: 15px;
}
.badge--verified {
  background: var(--success-soft);
  color: var(--success-text);
}
.badge--warn {
  background: var(--warn-soft);
  color: var(--warn-text);
}
.badge--accent {
  background: var(--accent-soft);
  color: var(--accent-text);
}
.badge--danger {
  background: var(--danger-soft);
  color: var(--danger-text);
}
.counter {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-pill);
  background: var(--warn);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
  line-height: 1;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
}

/* ---------- Номерной знак (фирменный элемент) ---------- */
.plate {
  --h: 44px;
  display: inline-flex;
  align-items: stretch;
  height: var(--h);
  max-width: 100%;
  background: var(--plate-bg);
  color: var(--plate-ink);
  border: calc(var(--h) * 0.06) solid var(--plate-ink);
  border-radius: calc(var(--h) * 0.14);
  font-family: var(--font-plate);
  font-weight: 700;
  line-height: 1;
  box-shadow:
    0 0 0 calc(var(--h) * 0.03) var(--plate-bg),
    0 calc(var(--h) * 0.08) calc(var(--h) * 0.3) calc(var(--h) * -0.12) rgb(0 0 0 / 35%);
  white-space: nowrap;
  vertical-align: middle;
}
.plate__main {
  display: flex;
  align-items: center;
  gap: 0.07em;
  padding: 0 0.26em 0 0.3em;
  font-size: calc(var(--h) * 0.74);
  letter-spacing: 0.01em;
}
.plate__letter {
  font-size: 0.8em;
  transform: translateY(0.05em);
}
.plate__digits {
  letter-spacing: 0.03em;
}
.plate__digits--masked {
  letter-spacing: 0.08em;
  font-size: 0.8em;
  transform: translateY(-0.04em);
}
.plate__region {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--h) * 0.04);
  min-width: calc(var(--h) * 1.05);
  padding: 0 calc(var(--h) * 0.12);
  border-left: calc(var(--h) * 0.05) solid var(--plate-ink);
}
.plate__region-code {
  font-size: calc(var(--h) * 0.52);
  letter-spacing: 0.01em;
}
.plate__rus {
  display: flex;
  align-items: center;
  gap: calc(var(--h) * 0.05);
  font-family: var(--font);
  font-size: calc(var(--h) * 0.15);
  font-weight: 800;
  letter-spacing: 0.04em;
}
.plate__flag {
  width: calc(var(--h) * 0.24);
  height: calc(var(--h) * 0.16);
  border: 0.5px solid rgb(0 0 0 / 45%);
  background: linear-gradient(#fff 0 33.4%, #1c3faa 33.4% 66.7%, #d52b1e 66.7%);
}
.plate--sm {
  --h: 28px;
}
.plate--md {
  --h: 36px;
}
.plate--lg {
  --h: 60px;
}
.plate--xl {
  --h: clamp(56px, 17vw, 84px);
}

/* ---------- Формы ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field__label {
  font-weight: 700;
  font-size: 15px;
}
.field__hint {
  font-size: 13px;
  color: var(--muted);
}
.field__error {
  font-size: 14px;
  font-weight: 600;
  color: var(--danger-text);
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--bg-elev);
  color: var(--text);
  font-size: 16px;
  line-height: 1.3;
  transition:
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
  appearance: none;
}
.textarea {
  min-height: 96px;
  resize: vertical;
}
.select {
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
}
.input--flag {
  border-color: var(--warn);
  background: var(--warn-soft);
}
.input--plate {
  font-family: var(--font-plate);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.input--code {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}
.char-count {
  font-size: 13px;
  color: var(--muted);
  text-align: right;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-height: var(--tap);
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elev);
  cursor: pointer;
}
.check > input {
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  accent-color: var(--accent);
}
.check:has(> input:not(:checked)) .check__reveal {
  display: none;
}
.check__text {
  font-size: 15px;
  line-height: 1.45;
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--tap);
}
.switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
}
.switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.switch__track {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-pill);
  background: var(--border-strong);
  transition: background-color var(--dur) var(--ease);
}
.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 30%);
  transition: transform var(--dur) var(--ease);
}
.switch input:checked + .switch__track {
  background: var(--accent);
}
.switch input:checked + .switch__track::after {
  transform: translateX(20px);
}
.switch input:focus-visible + .switch__track {
  box-shadow: var(--ring);
}
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: var(--radius);
  background: var(--surface-3);
}
.segmented a,
.segmented label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  border-radius: 11px;
  color: var(--text-2);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.segmented [aria-current="page"],
.segmented input:checked + span {
  background: var(--bg-elev);
  color: var(--text);
  box-shadow: var(--shadow-1);
}
.segmented label {
  position: relative;
}
.segmented label input {
  position: absolute;
  opacity: 0;
}
.segmented label span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  border-radius: 11px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.chip-radio {
  position: relative;
}
.chip-radio input {
  position: absolute;
  opacity: 0;
}
.chip-radio span {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  font-weight: 700;
  cursor: pointer;
}
.chip-radio input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
}
.chip-radio input:focus-visible + span {
  box-shadow: var(--ring);
}
.honeypot {
  position: absolute !important;
  left: -10000px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ---------- Алерты ---------- */
.alert {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--text);
  font-size: 15px;
}
.alert .icon {
  margin-top: 2px;
  color: var(--accent-text);
}
.alert--success {
  background: var(--success-soft);
}
.alert--success .icon {
  color: var(--success-text);
}
.alert--warn {
  background: var(--warn-soft);
}
.alert--warn .icon {
  color: var(--warn-text);
}
.alert--danger {
  background: var(--danger-soft);
}
.alert--danger .icon {
  color: var(--danger-text);
}
.alert strong {
  display: block;
}

/* ---------- Пустые состояния и скелетоны ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  padding: var(--space-7) var(--space-4);
}
.empty__icon {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.empty__icon svg {
  width: 32px;
  height: 32px;
}
.empty p {
  max-width: 34ch;
  color: var(--muted);
}
.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-3);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 45%), transparent);
  animation: shimmer 1.2s infinite;
}
:root[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 6%), transparent);
}
.sk-plate {
  width: min(260px, 70%);
  height: 72px;
  margin-inline: auto;
  border-radius: 14px;
}
.sk-title {
  width: 55%;
  height: 32px;
}
.sk-card {
  height: 132px;
  border-radius: var(--radius-l);
}
@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}
.spinner {
  width: 20px;
  height: 20px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.htmx-indicator {
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  opacity: 1;
}

/* ---------- Публичные страницы ---------- */
.public-header {
  padding: calc(var(--space-4) + var(--safe-top)) 0 var(--space-3);
}
.public-main {
  padding-bottom: calc(var(--space-7) + var(--safe-bottom));
}
.public-footer {
  padding: var(--space-5) 0 calc(var(--space-6) + var(--safe-bottom));
  color: var(--muted);
  font-size: 13px;
}
.public-footer a {
  color: var(--muted);
}
.car-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
  padding: var(--space-6) var(--space-4) var(--space-5);
  border-radius: 28px;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--accent-soft) 0%, transparent 70%),
    var(--bg-elev);
  border: 1px solid var(--border);
}
.car-hero__title {
  font-size: clamp(26px, 7.5vw, 36px);
}
.car-hero__meta {
  color: var(--text-2);
  font-weight: 600;
  font-size: 17px;
}
.owner-name {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-2);
  font-weight: 600;
}
.question {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.choices {
  display: grid;
  gap: 10px;
}
@media (min-width: 600px) {
  .choices {
    grid-template-columns: 1fr 1fr;
  }
}
.choice {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 64px;
  padding: 10px 14px 10px 10px;
  border-radius: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.25;
  box-shadow: var(--shadow-1);
  transition:
    transform var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}
.choice:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.choice:active {
  transform: scale(0.985);
}
.choice__emoji {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--surface-2);
}
.choice__text {
  flex: 1;
}
.choice__chev {
  color: var(--muted);
}
.choice--critical {
  border-color: color-mix(in srgb, var(--warn) 40%, var(--border));
  background: linear-gradient(90deg, var(--warn-soft), var(--bg-elev) 70%);
}
.choice--critical .choice__emoji {
  background: var(--bg-elev);
}
.choice--critical:hover {
  border-color: var(--warn);
}
.picked {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-l);
  background: var(--bg-elev);
  border: 2px solid var(--accent);
  font-size: 18px;
  font-weight: 800;
}
.picked--critical {
  border-color: var(--warn);
  background: var(--warn-soft);
}
.picked__emoji {
  font-size: 30px;
}
.geo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap-l);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
}
@media (max-width: 419px) {
  .geo {
    flex-wrap: wrap;
    padding-block: var(--space-3);
  }
  .geo > .grow {
    flex: 1 1 0;
  }
  .geo [data-geo-button] {
    width: 100%;
  }
}
.geo.is-set {
  border-style: solid;
  border-color: var(--success);
  background: var(--success-soft);
}

/* Шкала статуса сообщения */
.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.stepper li {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.stepper__bar {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-3);
  overflow: hidden;
}
.stepper li.is-done {
  color: var(--text);
}
.stepper li.is-done .stepper__bar {
  background: var(--accent);
}
.stepper li.is-current .stepper__bar {
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 45%, transparent));
}
.reply-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  border-radius: 24px;
  background: var(--success-soft);
  text-align: center;
}
.reply-big__emoji {
  font-size: 56px;
  line-height: 1;
}
.reply-big__text {
  font-size: clamp(24px, 7vw, 32px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.waiting {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-l);
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
}
.pulse {
  flex: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgb(47 91 255 / 50%);
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  70% {
    box-shadow: 0 0 0 12px rgb(47 91 255 / 0%);
  }
  100% {
    box-shadow: 0 0 0 0 rgb(47 91 255 / 0%);
  }
}
.call-box {
  padding: var(--space-4);
  border-radius: var(--radius-l);
  border: 2px solid var(--warn);
  background: var(--warn-soft);
}
.phone-big {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

/* Лендинг */
.hero {
  display: grid;
  gap: var(--space-6);
  padding: var(--space-5) 0 var(--space-6);
  align-items: center;
}
@media (min-width: 900px) {
  .hero {
    grid-template-columns: 1.1fr 0.9fr;
    padding: var(--space-7) 0;
  }
}
.hero__title {
  font-size: clamp(34px, 9vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.035em;
}
.hero__title em {
  font-style: normal;
  color: var(--accent-text);
}
.sticker-demo {
  position: relative;
  justify-self: center;
  width: min(100%, 340px);
  aspect-ratio: 1;
  padding: 18px;
  border-radius: 28px;
  background: #fff;
  color: #000;
  border: 4px solid #000;
  box-shadow: var(--shadow-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transform: rotate(-3deg);
}
.sticker-demo__band {
  width: 100%;
  padding: 10px 0;
  border-radius: 14px;
  background: #000;
  color: #fff;
  font-weight: 800;
  font-size: clamp(20px, 6vw, 26px);
  text-align: center;
  letter-spacing: -0.02em;
}
.sticker-demo__qr {
  flex: 1;
  min-height: 0;
  aspect-ratio: 1;
}
.sticker-demo__qr svg {
  width: 100%;
  height: 100%;
}
.sticker-demo__code {
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 18px;
}
.steps {
  display: grid;
  gap: var(--space-3);
  counter-reset: step;
}
@media (min-width: 700px) {
  .steps {
    grid-template-columns: repeat(3, 1fr);
  }
}
.step {
  position: relative;
  padding: var(--space-5) var(--space-4) var(--space-4);
}
.step__num {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  margin-bottom: var(--space-3);
}
.feature-list {
  display: grid;
  gap: var(--space-3);
  list-style: none;
  padding: 0;
  margin: 0;
}
.feature-list li {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}
.feature-list .icon {
  color: var(--success-text);
  margin-top: 2px;
}

/* ---------- Кабинет ---------- */
.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: var(--safe-top);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
}
.appbar.is-scrolled {
  border-bottom-color: var(--border);
}
.appbar__inner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 60px;
}
.appbar__back {
  width: 44px;
  height: 44px;
  margin-left: -10px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--text);
}
.appbar__back:hover {
  background: var(--surface-3);
}
.appbar__title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.appbar .brand {
  display: none;
}
.topnav {
  display: none;
}
.in-telegram .appbar__back {
  display: none;
}
.app-main {
  padding-top: var(--space-3);
  padding-bottom: calc(var(--bottom-nav-h) + var(--space-6) + var(--safe-bottom));
}
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 6px calc(8px + var(--safe-right)) calc(6px + var(--safe-bottom)) calc(8px + var(--safe-left));
  background: color-mix(in srgb, var(--bg-elev) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--border);
}
.bottom-nav a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.bottom-nav a[aria-current="page"] {
  color: var(--accent-text);
}
.bottom-nav a[aria-current="page"] .bottom-nav__icon {
  background: var(--accent-soft);
}
.bottom-nav__icon {
  width: 56px;
  height: 30px;
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  transition: background-color var(--dur) var(--ease);
}
.bottom-nav .counter {
  position: absolute;
  top: 2px;
  left: calc(50% + 8px);
}
@media (min-width: 900px) {
  .appbar .brand {
    display: inline-flex;
  }
  .appbar__title {
    display: none;
  }
  .appbar__back {
    display: none;
  }
  .topnav {
    display: flex;
    gap: var(--space-1);
    margin-left: auto;
  }
  .topnav a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-4);
    border-radius: 12px;
    color: var(--text-2);
    font-weight: 700;
    text-decoration: none;
  }
  .topnav a:hover {
    background: var(--surface-3);
  }
  .topnav a[aria-current="page"] {
    background: var(--accent-soft);
    color: var(--accent-text);
  }
  .bottom-nav {
    display: none;
  }
  .app-main {
    padding-top: var(--space-5);
    padding-bottom: var(--space-7);
  }
  .page-heading {
    display: flex !important;
  }
}
.page-heading {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-2);
}
.in-telegram .bottom-nav {
  padding-bottom: calc(6px + var(--safe-bottom));
}
.in-telegram .app-shell {
  min-height: var(--tg-viewport-stable-height, 100vh);
}

/* Список авто */
.car-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-l);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-1);
  transition:
    border-color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}
.car-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.car-card:active {
  transform: scale(0.99);
}
.car-card__title {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.car-card__meta {
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}
.car-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}
.add-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 72px;
  border-radius: var(--radius-l);
  border: 2px dashed var(--border-strong);
  color: var(--accent-text);
  font-weight: 800;
  text-decoration: none;
}
.add-tile:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  text-decoration: none;
}

/* Дашборд авто */
.car-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.car-head__title {
  font-size: clamp(26px, 7vw, 34px);
}
.qr-block {
  display: grid;
  gap: var(--space-4);
  align-items: center;
}
@media (min-width: 600px) {
  .qr-block {
    grid-template-columns: 200px 1fr;
  }
}
.qr-frame {
  width: min(100%, 220px);
  aspect-ratio: 1;
  justify-self: center;
  padding: 10px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid var(--border);
}
.qr-frame svg,
.qr-svg {
  width: 100%;
  height: 100%;
}
.short-code {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}
.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}
.stat {
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--surface-2);
  min-width: 0;
}
.stat__value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.3;
}
.chart {
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart .bar-scan {
  fill: color-mix(in srgb, var(--accent) 32%, transparent);
}
.chart .bar-msg {
  fill: var(--accent);
}
.chart .bar-today {
  stroke: var(--accent);
  stroke-width: 1;
}
.chart .baseline {
  stroke: var(--border-strong);
  stroke-width: 1;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}
.legend .l-scan {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
}
.legend .l-msg {
  background: var(--accent);
}
.kv {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2) var(--space-4);
  font-size: 15px;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

/* Сообщения */
.msg-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
  padding: 0;
  margin: 0;
}
.msg-item {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-l);
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.msg-item:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.msg-item.is-unread {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
  box-shadow: inset 4px 0 0 var(--warn);
}
.msg-item__emoji {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  background: var(--surface-2);
}
.msg-item__title {
  font-weight: 800;
}
.msg-item__meta {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.msg-item__text {
  font-size: 15px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.reply-grid {
  display: grid;
  gap: var(--space-2);
}
.quote {
  padding: var(--space-3) var(--space-4);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface-2);
  font-size: 17px;
  overflow-wrap: anywhere;
}

/* Проверка владения */
.code-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5);
  border-radius: 24px;
  background: #fff;
  color: #000;
  border: 3px dashed #000;
}
.code-card__digits {
  font-size: clamp(64px, 22vw, 112px);
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.howto {
  counter-reset: howto;
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--space-3);
}
.howto li {
  counter-increment: howto;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
}
.howto li::before {
  content: counter(howto);
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 800;
  display: grid;
  place-items: center;
  font-size: 14px;
}

/* Загрузка фото */
.upload {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 220px;
  padding: var(--space-5);
  border-radius: 24px;
  border: 2px dashed var(--border-strong);
  background: var(--surface-2);
  text-align: center;
  overflow: hidden;
}
.upload__icon {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
}
.upload__icon svg {
  width: 30px;
  height: 30px;
}
.upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.preview {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: var(--surface-3);
  aspect-ratio: 4 / 3;
}
.preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.preview__overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: var(--space-2);
  background: rgb(10 12 16 / 55%);
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: var(--space-4);
}
.preview__overlay .spinner {
  width: 36px;
  height: 36px;
}
.progress {
  width: min(240px, 80%);
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgb(255 255 255 / 30%);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: #fff;
  transition: width 200ms linear;
}
.confirm-plate {
  display: flex;
  justify-content: center;
  padding: var(--space-5) var(--space-3);
  border-radius: 24px;
  background: var(--surface-2);
}

/* Юридические страницы */
.prose {
  font-size: 16px;
  line-height: 1.65;
}
.prose h2 {
  margin: var(--space-6) 0 var(--space-3);
  font-size: 20px;
}
.prose p,
.prose ul,
.prose ol {
  margin: 0 0 var(--space-3);
}
.prose li {
  margin-bottom: var(--space-1);
}
.draft-banner {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--warn-text);
  font-weight: 800;
  border: 1px dashed var(--warn);
}
.placeholder {
  background: var(--warn-soft);
  color: var(--warn-text);
  padding: 0 4px;
  border-radius: 4px;
  font-weight: 700;
}

/* Печать */
.print-options {
  display: grid;
  gap: var(--space-2);
}
.print-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
}
.print-option > .grow {
  flex: 1 1 180px;
}
.print-option > .btn-row {
  flex: 1 1 220px;
}
.sticker-demo--flat {
  width: min(100%, 300px);
  transform: none;
}
.plate-fields {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: var(--space-3);
}
.chips--even {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.chips--even .chip-radio span {
  justify-content: center;
  width: 100%;
  padding: 0 8px;
}

/* ---------- Анимации появления ---------- */
.fade-in {
  animation: fade-in 180ms var(--ease) both;
}
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Утилиты ---------- */
.mt-2 {
  margin-top: var(--space-2);
}
.mt-3 {
  margin-top: var(--space-3);
}
.mt-4 {
  margin-top: var(--space-4);
}
.mt-5 {
  margin-top: var(--space-5);
}
.nowrap {
  white-space: nowrap;
}
[data-center] {
  justify-content: center;
  margin-inline: auto;
}
.only-telegram {
  display: none;
}
.in-telegram .only-telegram {
  display: revert;
}
.in-telegram .not-telegram {
  display: none;
}
.error-page {
  min-height: 60vh;
  display: grid;
  place-items: center;
  text-align: center;
}
.error-page__code {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--accent-text);
  line-height: 1;
}
