/* Барышня — owner web cabinet styles. Clean, simple, mobile-first. */

:root {
  /* «Барышня» brand palette: 991516 dark-red · D02827 red · F6FFF7 mint · 353345 navy. */
  --bg: #F6FFF7;
  --surface: #ffffff;
  --text: #353345;
  /* a11y-3/visual-6: navy-gray that clears 4.5:1 on the light surface. */
  --muted: #5f5b6b;
  --border: #e4e2ea;
  --primary: #D02827;
  --primary-dark: #991516;
  /* --danger shares the brand red; destructive buttons use a ghost/outline
     treatment (below) so they never read as the solid-red primary CTA. */
  --danger: #D02827;
  /* visual-2/a11y-7/8: danger as TEXT on its light tint needs a darker shade. */
  --danger-text: #991516;
  /* Dark-bar tokens — navy header/footer echoing the Ozon card. */
  --navy: #353345;
  --navy-text: #F6FFF7;
  --navy-muted: #b9b7c4;
  /* Functional semantic colours kept — brand palette has no green/amber and
     these carry meaning (subscription active/expiring/inactive, alerts). */
  --success: #15803d;
  --success-bg: #ecfdf3;
  --error-bg: #fef2f2;
  /* Amber-700: ~5.9:1 on the light surface — AA for normal text. */
  --warning: #b45309;
  --warning-bg: #fffbeb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 50, 0.08);
  /* Brand fonts (loaded via Google Fonts in base.html). */
  --font-body: "PT Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Cuprum", var(--font-body);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

/* Cuprum on headings, wordmark, slogans and large numeric displays. */
h1, h2, h3,
.brand,
.hero h1,
.hero-slogan,
.sign-number,
.phone-confirm,
.service-number-value { font-family: var(--font-display); }

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

/* a11y-4: inline/prose links are underlined by default for non-colour cueing. */
a { color: var(--primary); text-decoration: underline; }
a:hover { text-decoration: underline; }

/* a11y-4: structural / nav / button-like links stay underline-free; they are
   already visually distinct via weight, background or position. */
.brand,
.nav a,
.button,
.nav-cta,
.link-button,
.footer-links a,
.step-num { text-decoration: none; }

/* visual-1 + a11y: a single, visible keyboard-focus ring for every interactive
   element that would otherwise fall back to the UA outline. Mirrors the input
   focus treatment (3px brand-blue ring with offset). */
.button:focus-visible,
.link-button:focus-visible,
a:focus-visible,
a.nav-cta:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
/* Offset/darker variant so the ring stays visible against the red button. */
.button-danger:focus-visible {
  outline: 3px solid var(--danger-text);
  outline-offset: 3px;
}

/* a11y-6/a11y-11: screen-reader-only text (consent <legend>, hidden labels). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* a11y-9: skip-to-content link — off-screen until focused, then a visible chip. */
.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 1000;
  background: var(--primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 0.15s ease-in-out;
}
.skip-link:focus {
  top: 8px;
  text-decoration: none;
}

/* Header / footer ------------------------------------------------------- */
.site-header {
  background: var(--navy);
  border-bottom: none;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* visual-4: let the nav wrap below the brand on the narrowest phones. */
  flex-wrap: wrap;
  gap: 8px 16px;
  min-height: 60px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.3px;
  color: var(--navy-text);
}
.brand:hover { text-decoration: none; }
.brand-logo {
  height: 44px;
  width: auto;
  display: block;
}
/* Header nav sits on the navy bar: light links, light "Выйти" text button. */
.site-header .nav a,
.site-header .link-button { color: var(--navy-text); }
.site-header .nav a:hover { color: #fff; }
.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.nav-cta {
  background: var(--primary);
  color: #fff;
  padding: 7px 14px;
  border-radius: var(--radius);
}
.nav-cta:hover { background: var(--primary-dark); text-decoration: none; }

.site-footer {
  margin-top: 48px;
  padding: 28px 0;
  border-top: none;
  background: var(--navy);
  color: var(--navy-muted);
  font-size: 0.9rem;
}
/* Footer sits on navy: light links + light muted requisites. */
.site-footer a { color: var(--navy-text); }
.site-footer a:hover { color: #fff; }
.site-footer .muted,
.site-footer .footer-seller { color: var(--navy-muted); }
.site-footer p { margin: 8px 0; }
.footer-tagline { margin-top: 0; }
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 12px 0;
}
.footer-seller { font-size: 0.85rem; }

main.container { padding-top: 28px; padding-bottom: 28px; }

/* Buttons --------------------------------------------------------------- */
.button {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  line-height: 1.2;
}
.button:hover { text-decoration: none; }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary {
  background: transparent;
  color: var(--primary);
  border-color: var(--border);
}
.button-secondary:hover { background: #fdeceb; }
/* Primary is solid red; destructive uses a ghost/outline so a "delete" never
   looks like the main CTA (both share the brand red). */
.button-danger {
  background: #fff;
  color: var(--danger-text);
  border-color: var(--danger);
}
.button-danger:hover { background: var(--danger); color: #fff; }
/* a11y-10/visual-3: keep small buttons comfortably tappable (~44px tall). */
.button-small { padding: 10px 14px; font-size: 0.85rem; min-height: 40px; }

.link-button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  /* a11y-10/visual-3: a bare text button (e.g. "Выйти") still needs a tappable
     hit area; pad it without turning it into a boxed button. */
  padding: 8px 4px;
  min-height: 40px;
}
.link-button:hover { text-decoration: underline; }
.inline-form { display: inline; margin: 0; }

/* Hero / landing -------------------------------------------------------- */
.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  margin-bottom: 28px;
}
.hero-slogan {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
}
.hero h1 { margin-top: 0; font-size: 1.8rem; }
.lead { font-size: 1.1rem; color: var(--muted); }
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.how, .benefits, .cta-block, .ozon-entry, .faq { margin-bottom: 28px; }
.how h2, .benefits h2, .cta-block h2, .ozon-entry h2, .faq h2 { font-size: 1.4rem; }

.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 10px;
  background: var(--surface);
}
.faq summary { font-weight: 600; cursor: pointer; }
.faq details p { margin: 10px 0 0; color: var(--text); }

.steps { list-style: none; padding: 0; margin: 0; }
.steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.steps h3 { margin: 0 0 4px; font-size: 1.05rem; }
.steps p { margin: 0; color: var(--muted); }
.step-num {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.benefit-list { padding-left: 20px; }
.benefit-list li { margin-bottom: 8px; }

.cta-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  text-align: center;
}

/* Auth pages ------------------------------------------------------------ */
.auth {
  max-width: 420px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.auth h1 { margin-top: 0; }
.auth-switch { margin-top: 18px; text-align: center; color: var(--muted); }

/* Phone-confirmation echo (registration §3.3) */
.phone-confirm {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary);
  text-align: center;
  margin: 8px 0;
}

/* Forms ----------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 0.9rem; font-weight: 600; }
.field input {
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  width: 100%;
}
.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(208, 40, 39, 0.15);
}
.field-grow { flex: 1 1 auto; }
.field small.muted { font-size: 0.82rem; line-height: 1.4; }

.code-input { text-transform: uppercase; }

/* Show/hide password toggle (injected by app.js, onboard-8) */
.password-toggle {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  margin-top: 4px;
  font: inherit;
  font-size: 0.85rem;
  color: var(--primary);
  cursor: pointer;
}
.password-toggle:hover { text-decoration: underline; }

.form-inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}
.form-inline .button { white-space: nowrap; }

/* Service-number callout (registration) --------------------------------- */
.service-number {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.service-number-label { font-size: 0.9rem; font-weight: 600; }
.service-number-value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary);
  text-decoration: none;
}
.service-number .muted { font-size: 0.88rem; margin: 0; }

/* Consent checkboxes ---------------------------------------------------- */
.consents {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  border: 0;
}
.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.92rem;
  line-height: 1.4;
}
.checkbox input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--primary);
}
.checkbox .req { color: var(--danger-text); text-decoration: none; font-weight: 700; }

/* Legal pages (stubs) --------------------------------------------------- */
.legal { max-width: 720px; }
.legal h2 { margin-top: 26px; font-size: 1.15rem; }
.legal p { color: var(--text); }
.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

/* Alerts ---------------------------------------------------------------- */
.alert {
  border-radius: var(--radius);
  padding: 11px 14px;
  margin-bottom: 14px;
  font-size: 0.95rem;
}
.alert-error { background: var(--error-bg); color: var(--danger-text); border: 1px solid #fecaca; }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #bbf7d0; }
.alert-info { background: #eef0f5; color: #353345; border: 1px solid #d8d6e0; }

/* Dashboard ------------------------------------------------------------- */
.dashboard-head h1 { margin-bottom: 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 { margin-top: 0; font-size: 1.25rem; }
.card h3 { font-size: 1.05rem; margin-bottom: 10px; }

.status { font-weight: 700; margin: 4px 0; }
.status-active { color: var(--success); }
.status-inactive { color: var(--danger-text); }
.status-warning { color: var(--warning); }

/* Minutes-usage progress bar (dashboard-9) */
.progress {
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 4px;
}
.progress-bar {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.meta { display: flex; flex-wrap: wrap; gap: 24px; margin: 12px 0 0; }
.meta dt { font-size: 0.85rem; color: var(--muted); }
.meta dd { margin: 0; font-weight: 600; }

.vehicle-list { list-style: none; padding: 0; margin: 0 0 18px; }
.vehicle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.vehicle:last-child { border-bottom: none; }
.plate {
  font-family: "Courier New", monospace;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 1px;
}
.plate-region {
  font-size: 0.85rem;
  color: var(--muted);
  margin-left: 6px;
}
.vehicle-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Activations history (§6) */
.activation-list { list-style: none; padding: 0; margin: 0; }
.activation {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activation:last-child { border-bottom: none; }
.activation-code {
  font-family: "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Edit-vehicle action row */
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Printable in-car sign (§6) */
.sign-card { text-align: center; }
.sign-number {
  font-size: 2.6rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--primary);
  margin: 16px 0;
}
.sign-instruction { font-size: 1.1rem; margin: 12px auto; max-width: 480px; }

/* Print: leave only the sign on the page (§6) ---------------------------- */
@media print {
  .site-header,
  .site-footer,
  .nav,
  .sign-print { display: none !important; }
  body { background: #fff; }
  .sign-card {
    border: none;
    box-shadow: none;
    margin: 0;
  }
}

/* Mobile ---------------------------------------------------------------- */
@media (max-width: 560px) {
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 1.5rem; }
  .hero-actions .button { width: 100%; }
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline .button { width: 100%; }
  .nav { gap: 10px; }
}

/* a11y-5: Windows High Contrast / forced-colors — keep focus visible without
   relying on our brand colours (system maps everything to system palette). */
@media (forced-colors: active) {
  .button:focus-visible,
  .link-button:focus-visible,
  .button-danger:focus-visible,
  a:focus-visible,
  a.nav-cta:focus-visible,
  .field input:focus {
    outline: 2px solid CanvasText;
    outline-offset: 2px;
  }
  .skip-link:focus {
    outline: 2px solid CanvasText;
  }
  /* Don't let our coloured progress bar vanish into the system background. */
  .progress-bar { background: Highlight; }
}
