/* ============================================================
   Проверка техосмотра — приложение
   Mobile-first, светлая, доверительная тема
   ============================================================ */

:root {
  --bg: #ffffff;
  --surface: #f5f7f6;
  --surface-2: #eef2f0;
  --border: #e3e8e5;
  --border-strong: #d2dbd6;
  --text: #141a17;
  --text-muted: #5b6661;
  --text-faint: #8a948e;

  --accent: #1b9e63;
  --accent-hover: #178a55;
  --accent-strong: #137447;
  --accent-soft: #e7f5ee;

  --warning: #b45309;
  --warning-soft: #fdf1e3;

  --danger: #c0392b;
  --danger-soft: #fbeae8;

  --radius: 16px;
  --radius-sm: 10px;

  --shadow-sm: 0 1px 2px rgba(20, 30, 24, 0.06), 0 1px 3px rgba(20, 30, 24, 0.05);
  --shadow-md: 0 8px 24px rgba(20, 30, 24, 0.08);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

.container {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

.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;
}

.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  letter-spacing: 0.03em;
}

/* ---------- Header ---------- */

.site-header {
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  line-height: 1;
}

.brand-name {
  letter-spacing: -0.01em;
}

/* ---------- Hero ---------- */

.hero {
  padding: 36px 0 24px;
}

.hero-title {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  margin: 0;
  font-size: 17px;
  color: var(--text-muted);
}

/* ---------- Check card ---------- */

.check-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  box-shadow: var(--shadow-md);
}

.check-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ---------- Mode toggle ---------- */

.mode-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.mode-option {
  position: relative;
  cursor: pointer;
}

.mode-option input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.mode-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.mode-option input:checked + span {
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.mode-option input:focus-visible + span {
  outline: 3px solid rgba(27, 158, 99, 0.4);
  outline-offset: 2px;
}

/* ---------- Fields ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.field-input {
  width: 100%;
  height: 52px;
  padding: 0 15px;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field-input::placeholder {
  color: var(--text-faint);
}

.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27, 158, 99, 0.16);
}

.field-input[aria-invalid="true"] {
  border-color: var(--danger);
}

.field-error {
  margin: 0;
  font-size: 14px;
  color: var(--danger);
}

.form-error {
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14px;
}

/* ---------- CTA ---------- */

.cta {
  width: 100%;
  height: 54px;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(27, 158, 99, 0.24);
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}

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

.cta:active {
  transform: translateY(1px);
  box-shadow: 0 4px 14px rgba(27, 158, 99, 0.2);
}

.cta:focus-visible {
  outline: 3px solid rgba(27, 158, 99, 0.4);
  outline-offset: 2px;
}

.cta:disabled {
  opacity: 0.65;
  cursor: default;
}

.form-note {
  margin: 16px 0 0;
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- Benefits ---------- */

.benefits {
  padding: 22px 0 8px;
}

.benefits-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.benefits-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text-muted);
  font-size: 15px;
}

.benefits-list li::before {
  content: "✓";
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 13px;
  line-height: 1;
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 40px;
  padding: 28px 0 36px;
  border-top: 1px solid var(--border);
}

.disclaimer {
  margin: 0 0 8px;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-muted);
}

.footer-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-faint);
}

/* ---------- Processing overlay ---------- */

.processing {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
}

body.is-processing {
  overflow: hidden;
}

.processing-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 30px 26px;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.spinner {
  width: 46px;
  height: 46px;
  margin: 0 auto 18px;
  border: 4px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.processing-title {
  margin: 0 0 20px;
  font-size: 20px;
  font-weight: 700;
}

.processing-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

.processing-step {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 15px;
  color: var(--text-faint);
  opacity: 0.45;
  transform: translateY(2px);
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
}

.step-dot {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-strong);
  transition: background 0.3s ease;
}

.processing.is-active .processing-step:nth-child(1) {
  animation: stepIn 0.5s ease 0.05s forwards;
}
.processing.is-active .processing-step:nth-child(2) {
  animation: stepIn 0.5s ease 0.55s forwards;
}
.processing.is-active .processing-step:nth-child(3) {
  animation: stepIn 0.5s ease 1.05s forwards;
}

@keyframes stepIn {
  to {
    opacity: 1;
    transform: translateY(0);
    color: var(--text);
  }
}

.processing.is-active .processing-step.checked .step-dot {
  background: var(--accent);
}

/* ---------- Result pages ---------- */

.result-header {
  padding: 32px 0 20px;
}

.result-title {
  margin: 0 0 14px;
  font-size: 28px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.result-eyebrow {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
}

.status-badge--success {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-badge--warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.status-badge--neutral {
  background: var(--surface-2);
  color: var(--text-muted);
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.result-card-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
}

.result-text {
  margin: 0;
  color: var(--text-muted);
  font-size: 16px;
}

/* ---------- KV list ---------- */

.kv-list {
  margin: 0;
}

.kv {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.kv:last-child {
  border-bottom: none;
}

.kv dt {
  font-size: 13px;
  color: var(--text-faint);
}

.kv dd {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}

/* ---------- Mileage analysis ---------- */

.analysis {
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.analysis--warning {
  background: var(--warning-soft);
  border-color: #f3d9b8;
}

.analysis--neutral {
  background: var(--surface);
}

.analysis-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.analysis--warning .analysis-title {
  color: var(--warning);
}

.analysis-text {
  margin: 0;
  font-size: 15px;
  color: var(--text-muted);
}

/* ---------- Timeline ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border-strong);
}

.timeline-item {
  position: relative;
  padding: 0 0 18px 26px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: 0;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.timeline-date {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 3px;
}

.timeline-meta {
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- Result actions / buttons ---------- */

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

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

.btn-secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 3px solid rgba(27, 158, 99, 0.4);
  outline-offset: 2px;
}

/* ---------- Stacktrace (dev only) ---------- */

.stacktrace {
  margin-top: 16px;
  padding: 14px;
  background: #f6f8f7;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- Query / counts ---------- */

.result-query {
  margin: 0 0 10px;
  font-size: 15px;
  color: var(--text-muted);
}

.result-count {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--text-muted);
}

.result-count strong {
  color: var(--text);
  font-weight: 700;
}

/* ---------- Neutral notice (несколько автомобилей) ---------- */

.notice {
  background: #f4f7f9;
  border: 1px solid var(--border);
  border-left: 4px solid #7c8b98;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.notice-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.notice-text {
  margin: 0;
  font-size: 15px;
  color: var(--text-muted);
}

/* ---------- Vehicle groups (multi-VIN) ---------- */

.vehicle-group .status-badge {
  margin-bottom: 4px;
}

.u-mt {
  margin-top: 16px;
}

.vehicle-group .analysis {
  margin-top: 16px;
}

.subheading {
  margin: 20px 0 14px;
  font-size: 15px;
  font-weight: 700;
}

.record-status {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}

.record-status--success {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.record-status--neutral {
  background: var(--surface-2);
  color: var(--text-muted);
}

/* ---------- Preview / paywall ---------- */

.preview-success {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--accent-soft);
  border: 1px solid #cdeadd;
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.preview-success-icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.preview-success-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  color: var(--accent-strong);
}

.preview-success-sub {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
}

.preview-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.preview-stat {
  flex: 1 1 130px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-stat-value {
  font-size: 24px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.preview-stat-label {
  font-size: 13px;
  color: var(--text-muted);
}

.preview-group {
  padding: 18px 20px;
}

.preview-group .result-card-title {
  margin-bottom: 10px;
}

.preview-identity {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.preview-identity-label {
  font-size: 13px;
  color: var(--text-faint);
}

.preview-identity-value {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
}

.preview-group-count {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-muted);
}

.locked-rows {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: 6px 14px;
}

.locked-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.locked-row:last-child {
  border-bottom: none;
}

.locked-label {
  font-size: 13px;
  color: var(--text-faint);
}

.locked-value {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow-wrap: anywhere;
}

.offer {
  padding: 22px 20px;
  border-color: var(--accent);
}

.offer-title {
  margin: 0 0 14px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.offer-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.offer-list li {
  position: relative;
  padding-left: 26px;
  font-size: 15px;
  color: var(--text-muted);
}

.offer-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent-strong);
  font-weight: 700;
}

.offer .cta {
  margin-top: 4px;
}

.offer-note {
  margin: 12px 0 0;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- Vehicle brief (Автомобиль по запросу) ---------- */

.vehicle-brief {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.vehicle-brief-label {
  margin-bottom: 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

.vehicle-brief-title {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.vehicle-brief-plate {
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-muted);
}

.vehicle-brief-specs {
  font-size: 15px;
  color: var(--text);
}

.vehicle-brief-details {
  margin-top: 6px;
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */

@media (min-width: 768px) {
  .hero {
    padding: 48px 0 30px;
  }

  .hero-title {
    font-size: 40px;
  }

  .hero-subtitle {
    font-size: 19px;
  }

  .check-card {
    padding: 30px;
  }

  .result-card {
    padding: 28px;
  }

  .result-title {
    font-size: 34px;
  }

  .kv {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
  }

  .kv dt {
    flex: 0 0 240px;
    font-size: 14px;
  }

  .kv dd {
    text-align: right;
  }
}

@media (min-width: 1440px) {
  .container {
    max-width: 820px;
  }

  .hero-title {
    font-size: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
