/* =====================================================
   styles.css — Глобальные стили и компоненты
   ВерниВещь v0.2
   Зависит от: tokens.css (который импортирует brand-tokens.css)
   ===================================================== */

/* ── Reset ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
img, svg, video {
  display: block;
  max-width: 100%;
}
a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ── Base ── */
body {
  font-family: var(--font-main);
  font-size: var(--text-md);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  color: var(--color-text);
  background: var(--gradient-page);
  min-height: 100vh;
  background-attachment: fixed;
}

/* ── Layout utilities ── */
.container {
  width: 100%;
  /* Без max-width — сетка во всю ширину экрана */
  padding-inline: var(--section-px);
  box-sizing: border-box;
}
.container--narrow {
  max-width: var(--content-narrow);
  margin-inline: auto;
}
.section {
  padding-block: var(--section-py);
}
.section--sm {
  padding-block: clamp(40px, 5vw, 72px);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-bold);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  color: var(--color-text);
}
h1 { font-size: var(--text-h1); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }

.text-hero    { font-size: var(--text-hero); font-weight: var(--fw-extrabold); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
.text-display { font-size: var(--text-display); font-weight: var(--fw-extrabold); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
.text-h2      { font-size: var(--text-h2); font-weight: var(--fw-bold); }
.text-h3      { font-size: var(--text-h3); font-weight: var(--fw-semibold); }
.text-lg      { font-size: var(--text-lg); }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }
.text-muted   { color: var(--color-text-muted); }
.text-soft    { color: var(--color-text-soft); }
.text-accent  { color: var(--color-accent); }
.text-inverse { color: var(--color-text-inverse); }
.text-center  { text-align: center; }
.fw-medium    { font-weight: var(--fw-medium); }
.fw-semibold  { font-weight: var(--fw-semibold); }
.fw-bold      { font-weight: var(--fw-bold); }

/* ── Header ── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background var(--motion-medium) var(--ease-standard),
              border-color var(--motion-medium) var(--ease-standard),
              box-shadow var(--motion-medium) var(--ease-standard);
}
.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-6);
  width: 100%;
  padding-inline: var(--section-px);
}
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  list-style: none;
}
.header-nav a {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text);
  text-decoration: none;
  padding: var(--sp-1) 0;
  position: relative;
}
.header-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width var(--motion-fast) var(--ease-emphasized);
}
.header-nav a:hover::after { width: 100%; }
.header-nav a:hover { text-decoration: none; color: var(--color-accent); }

.header-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}
.header-logo:hover { text-decoration: none; }

.nav-burger {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  /* visual size stays 22×16, touch area expanded to 44×44 */
  position: relative;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}
.nav-burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transform-origin: center;
  /* only transform + opacity — no width/height changes → zero layout shift */
  transition: transform var(--motion-base) var(--ease-emphasized),
              opacity   var(--motion-fast) var(--ease-standard);
  will-change: transform, opacity;
}

/* Burger → X: top bar rotates down to center, middle fades, bottom rotates up to center.
   Gap 5px + bar 2px = 7px shift to reach the center bar's position. */
.mobile-nav-open .nav-burger span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-nav-open .nav-burger span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.mobile-nav-open .nav-burger span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ── Footer ── */
.site-footer {
  background: var(--brand-sky-soft);
  border-top: 1px solid var(--color-border);
  padding-block: var(--sp-16) var(--sp-10);
}
.footer-inner {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--sp-12);
  align-items: start;
}
.footer-brand p {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--sp-4);
  max-width: 260px;
  line-height: var(--lh-relaxed);
}
.footer-nav-group h4 {
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--sp-4);
}
.footer-nav-group ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.footer-nav-group a {
  font-size: var(--text-sm);
  color: var(--color-text-soft);
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-standard);
}
.footer-nav-group a:hover { color: var(--color-accent); text-decoration: none; }
.footer-bottom {
  margin-top: var(--sp-12);
  padding-top: var(--sp-6);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}
.footer-bottom p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.footer-social {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
}
.footer-social-link {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  text-decoration: none;
  flex-shrink: 0;
  transition: color var(--motion-fast) var(--ease-standard),
              border-color var(--motion-fast) var(--ease-standard),
              background var(--motion-fast) var(--ease-standard),
              transform var(--motion-fast) var(--ease-spring);
}
.footer-social-link:hover {
  color: var(--brand-navy);
  border-color: var(--color-border-strong);
  background: color-mix(in srgb, var(--brand-navy) 6%, transparent);
  transform: translateY(-2px);
}
.footer-social-link svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
  display: block;
}
.footer-brand .footer-social {
  margin-top: var(--sp-5);
  gap: var(--sp-3);
}
.footer-brand .footer-social-link {
  width: 36px;
  height: 36px;
}
.footer-brand .footer-social-link svg {
  width: 16px;
  height: 16px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  height: var(--btn-h-md);
  padding-inline: var(--sp-6);
  border-radius: var(--radius-pill);
  font-family: var(--font-main);
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  line-height: 1;
  white-space: nowrap;
  border: 1.5px solid transparent;
  text-decoration: none;
  cursor: pointer;
  outline: none;
  user-select: none;
}
.btn:focus-visible {
  outline: 3px solid var(--color-accent-soft);
  outline-offset: 2px;
}
.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  pointer-events: none;
}
.btn--sm {
  height: var(--btn-h-sm);
  padding-inline: var(--sp-4);
  font-size: var(--text-sm);
}
.btn--lg {
  height: var(--btn-h-lg);
  padding-inline: var(--sp-10);
  font-size: var(--text-lg);
}
.btn--hero {
  height: var(--btn-h-hero);
  padding-inline: clamp(24px, 3vw, 40px);
  font-size: clamp(16px, 1.5vw, 18px);
}

.btn--primary {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border-color: var(--color-accent);
  box-shadow: var(--shadow-red);
}
.btn--primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  box-shadow: var(--shadow-red-lg);
  text-decoration: none;
  color: var(--color-text-inverse);
}

.btn--secondary {
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand-navy);
  border-color: var(--color-border-strong);
  backdrop-filter: blur(8px);
}
.btn--secondary:hover {
  background: rgba(255, 255, 255, 0.90);
  border-color: var(--brand-navy-border);
  text-decoration: none;
  color: var(--brand-navy);
}

.btn--ghost {
  background: transparent;
  color: var(--brand-navy);
  border-color: var(--color-border);
}
.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.56);
  text-decoration: none;
  color: var(--brand-navy);
}

.btn--danger {
  background: var(--color-danger-soft);
  color: var(--color-danger);
  border-color: rgba(229, 53, 8, 0.22);
}
.btn--danger:hover {
  background: var(--color-accent);
  color: var(--color-text-inverse);
}

.btn-icon {
  width: var(--btn-h-md);
  height: var(--btn-h-md);
  padding: 0;
  border-radius: var(--radius-md);
}

/* ── Cards & Panels ── */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  padding: var(--sp-8);
}
.card--solid {
  background: var(--color-surface-solid);
  backdrop-filter: none;
}
.card--sm {
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
}
.card--lg {
  border-radius: var(--radius-3xl);
  padding: var(--sp-12);
}
.panel {
  background: var(--color-surface-solid);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
}

/* ── Status badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 4px var(--sp-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  line-height: 1;
}
.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge--active {
  background: var(--color-success-soft);
  color: var(--brand-navy);
}
.badge--active::before { background: var(--brand-aqua); }
.badge--lost {
  background: var(--color-warning-soft);
  color: var(--brand-red);
}
.badge--lost::before { background: var(--brand-red); }
.badge--returned {
  background: var(--color-success-soft);
  color: var(--brand-navy);
}
.badge--returned::before { background: var(--brand-navy); }
.badge--disabled {
  background: rgba(1, 38, 67, 0.06);
  color: var(--color-text-muted);
}
.badge--disabled::before { background: var(--color-text-muted); }
.badge--unactivated {
  background: rgba(0, 200, 216, 0.12);
  color: var(--brand-navy);
}
.badge--unactivated::before { background: var(--brand-aqua); }
.badge--generated,
.badge--printed,
.badge--sold,
.badge--in_stock {
  background: var(--color-success-soft);
  color: var(--brand-navy);
}
.badge--generated::before,
.badge--printed::before,
.badge--sold::before,
.badge--in_stock::before {
  background: var(--brand-aqua);
}
.badge--spam {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}
.badge--spam::before { background: var(--color-danger); }

/* ── Forms ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.form-label {
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
}
.form-input,
.form-textarea,
.form-select {
  width: 100%;
  height: var(--input-h);
  padding-inline: var(--sp-4);
  border: 1.5px solid var(--color-border-strong);
  border-radius: var(--input-radius);
  background: var(--color-surface-solid);
  color: var(--color-text);
  font-size: var(--text-md);
  outline: none;
}
.form-textarea {
  height: auto;
  min-height: 112px;
  padding-block: var(--sp-4);
  resize: vertical;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px var(--color-accent-soft);
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
}
.form-input--locked {
  background: var(--brand-sky-soft);
  color: var(--color-text-muted);
  cursor: default;
}
.form-input--locked:focus {
  border-color: var(--color-border-strong);
  box-shadow: none;
}
.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  font-weight: var(--fw-medium);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

/* ── QR display ── */
.qr-wrapper {
  background: var(--brand-white);
  border-radius: var(--radius-xl);
  padding: var(--sp-5);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-3);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-card);
}
.qr-canvas {
  width: 180px;
  height: 180px;
  border-radius: var(--radius-sm);
  display: block;
}
.qr-id {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--brand-navy);
  letter-spacing: 0.08em;
  text-align: center;
}

/* ── Toast ── */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--brand-navy);
  color: var(--brand-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-deep);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  max-width: 320px;
  pointer-events: all;
}
.toast--success { background: var(--brand-navy); }
.toast--error   { background: var(--brand-red); }
.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.82;
}

/* ── Chat messages ── */
.chat-log {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
.chat-msg {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  max-width: 80%;
}
.chat-msg--finder { align-self: flex-start; }
.chat-msg--owner  { align-self: flex-end; }
.chat-bubble {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-xl);
  font-size: var(--text-md);
  line-height: var(--lh-body);
  word-break: break-word;
}
.chat-msg--finder .chat-bubble {
  background: var(--color-surface-solid);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: var(--radius-xs);
}
.chat-msg--owner .chat-bubble {
  background: var(--brand-navy);
  color: var(--brand-white);
  border-bottom-right-radius: var(--radius-xs);
}
.chat-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}
.chat-msg--owner .chat-meta { text-align: right; }
.chat-location {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-top: var(--sp-1);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ── Section headers ── */
.section-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--sp-4);
}
.section-heading {
  font-size: var(--text-h2);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--ls-tight);
  line-height: var(--lh-heading);
  margin-bottom: var(--sp-4);
}
.section-sub {
  font-size: var(--text-lg);
  color: var(--color-text-soft);
  line-height: var(--lh-relaxed);
  max-width: 560px;
}

/* ── Trust chip ── */
.trust-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text);
  white-space: nowrap;
  backdrop-filter: blur(8px);
}
.trust-chip svg {
  width: 16px;
  height: 16px;
  color: var(--brand-aqua);
  flex-shrink: 0;
}

/* ── FAQ accordion ── */
.faq-item {
  border-bottom: 1px solid var(--color-border);
}
.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: var(--sp-5);
  background: none;
  border: none;
  text-align: left;
  font-size: var(--text-lg);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  cursor: pointer;
}
.faq-chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--color-text-muted);
  transition: transform var(--motion-base) var(--ease-emphasized);
}
.faq-item.is-open .faq-chevron { transform: rotate(180deg); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--motion-medium) var(--ease-emphasized);
}
.faq-answer-inner {
  padding-bottom: var(--sp-5);
  font-size: var(--text-md);
  color: var(--color-text-soft);
  line-height: var(--lh-relaxed);
}
.faq-item.is-open .faq-answer { max-height: 400px; }

/* ── Utility ── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.gap-6 { gap: var(--sp-6); }
.gap-8 { gap: var(--sp-8); }
.mt-2  { margin-top: var(--sp-2); }
.mt-4  { margin-top: var(--sp-4); }
.mt-6  { margin-top: var(--sp-6); }
.mt-8  { margin-top: var(--sp-8); }
.mt-12 { margin-top: var(--sp-12); }
.mb-4  { margin-bottom: var(--sp-4); }
.mb-6  { margin-bottom: var(--sp-6); }
.mb-8  { margin-bottom: var(--sp-8); }
.w-full { width: 100%; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--color-border);
  margin-block: var(--sp-6);
}

/* ── Icon inline SVGs ── */
.icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: middle;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Glow decorative ── */
.glow-aqua {
  box-shadow: 0 0 60px rgba(0, 200, 216, 0.22), var(--shadow-soft);
}
.glow-red {
  box-shadow: var(--shadow-red-lg);
}

/* ── Step number ── */
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--brand-white);
  font-size: var(--text-sm);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

/* ── Admin table ── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.data-table th {
  text-align: left;
  padding: var(--sp-3) var(--sp-4);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.data-table td {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--color-surface-warm); }

/* ── Stat card ── */
.stat-card {
  background: var(--color-surface-solid);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.stat-num {
  font-size: var(--text-h2);
  font-weight: var(--fw-extrabold);
  color: var(--color-text);
  line-height: 1;
}
.stat-label {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ── Print preview card ── */
.print-label {
  background: var(--brand-white);
  border: 1.5px solid var(--color-border-strong);
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  box-shadow: var(--shadow-sm);
}
.print-label .qr-mini {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.print-label .label-text {
  font-size: 7px;
  text-align: center;
  color: var(--brand-navy);
  line-height: 1.3;
  margin-top: 4px;
}
.print-label .label-id {
  font-size: 6px;
  font-weight: 700;
  color: var(--brand-navy);
  letter-spacing: 0.1em;
  margin-top: 2px;
}

/* ── Responsive breakpoints ── */
@media (max-width: 1024px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  :root {
    --header-h: 64px;
    /* Reduce section vertical padding on mobile — prevents "endless column" */
    --section-py: clamp(32px, 7vw, 48px);
  }
  .header-nav { display: none; }
  .nav-burger { display: flex; }
  /* Prevent page scroll + scrollbar shift while overlay is open */
  body.mobile-nav-open { overflow: hidden; }

  /* Solid header background when nav is open — fixes iOS backdrop-filter stacking */
  .mobile-nav-open .site-header {
    background: #ffffff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--color-border);
  }

  .mobile-nav-open .header-nav {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: var(--header-h) 0 0 0;
    background: #ffffff; /* solid — no backdrop-filter to avoid iOS stacking bugs */
    align-items: center;
    justify-content: center;
    gap: var(--sp-8);
    z-index: var(--z-modal);
    animation: mobile-nav-in var(--motion-base) var(--ease-emphasized) both;
  }
  @keyframes mobile-nav-in {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  /* Mobile nav links: large touch targets */
  .mobile-nav-open .header-nav a {
    font-size: var(--text-lg);
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  /* "Админка" hidden from header on mobile — shown in burger nav instead */
  .admin-header-link { display: none !important; }
  .form-row { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: var(--sp-8); }
  .toast-container {
    left: var(--sp-4);
    right: var(--sp-4);
    bottom: var(--sp-4);
  }
  .toast { max-width: 100%; }
  .data-table { display: block; overflow-x: auto; }
}

/* Touch active feedback for all interactive buttons */
@media (hover: none) {
  .btn:active { transform: scale(0.97); opacity: 0.88; }
}

@media (max-width: 480px) {
  .btn--hero { padding-inline: var(--sp-6); }
  .card { padding: var(--sp-5); }
  .card--lg { padding: var(--sp-8); }
}

/* ── Print base ── */
@media print {
  .site-header,
  .site-footer,
  .no-print {
    display: none !important;
  }
  body {
    background: white !important;
    color: black !important;
  }
}

/* =====================================================
   Auth Modal & Header Auth Area
   ===================================================== */

/* ── Overlay ── */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(1, 38, 67, 0.52);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--motion-medium) var(--ease-standard);
}
.auth-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* ── Modal card ── */
.auth-modal {
  width: 100%;
  max-width: 448px;
  background: var(--color-surface-solid);
  border-radius: var(--radius-2xl);
  box-shadow:
    0 40px 100px rgba(1, 38, 67, 0.22),
    0 8px 24px rgba(1, 38, 67, 0.10),
    0 0 0 1px rgba(1, 38, 67, 0.06);
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  transition: transform var(--motion-medium) var(--ease-emphasized);
}
.auth-overlay.is-open .auth-modal {
  transform: translateY(0) scale(1);
}

/* ── Modal header ── */
.auth-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-6) var(--sp-8) 0;
}
.auth-modal-logo { height: 26px; }
.auth-close-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--motion-fast), color var(--motion-fast);
  flex-shrink: 0;
}
.auth-close-btn:hover {
  background: var(--brand-sky-soft);
  color: var(--brand-navy);
}

/* ── Tab switcher ── */
.auth-tabs {
  display: flex;
  margin: var(--sp-5) var(--sp-8) 0;
  background: var(--brand-sky-soft);
  border-radius: var(--radius-lg);
  padding: 3px;
  gap: 3px;
}
.auth-tab-btn {
  flex: 1;
  height: 38px;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-lg) - 2px);
  font-family: var(--font-main);
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: background var(--motion-base), color var(--motion-base),
              box-shadow var(--motion-base), font-weight var(--motion-base);
}
.auth-tab-btn.is-active {
  background: var(--color-surface-solid);
  color: var(--brand-navy);
  font-weight: var(--fw-semibold);
  box-shadow: 0 1px 6px rgba(1, 38, 67, 0.10);
}

/* ── Form panels ── */
.auth-form-panel {
  display: none;
  padding: var(--sp-6) var(--sp-8) var(--sp-8);
}
.auth-form-panel.is-active { display: block; }

.auth-fields {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
}

/* ── Password field wrapper ── */
.auth-pwd-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-pwd-wrap .form-input { padding-right: 44px; width: 100%; }
.auth-pwd-toggle {
  position: absolute;
  right: 12px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0;
  border-radius: var(--radius-xs);
  transition: color var(--motion-fast);
}
.auth-pwd-toggle:hover { color: var(--brand-navy); }

/* ── Error message ── */
.auth-error {
  font-size: var(--text-sm);
  color: var(--color-danger);
  background: var(--color-danger-soft);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-3);
  margin-bottom: var(--sp-3);
}

/* ── Submit button ── */
.auth-submit {
  width: 100%;
  height: 52px;
  font-size: var(--text-md);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-xl);
}

/* ── Switch link ── */
.auth-switch {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-top: var(--sp-4);
}
.auth-link-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: var(--fw-semibold);
  color: var(--color-accent);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color var(--motion-fast);
}
.auth-link-btn:hover { text-decoration-color: currentColor; }

/* ── Divider ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-block: var(--sp-2);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* ── Header auth area ── */
#header-auth-area {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-shrink: 0;
}

@media (max-width: 520px) {
  .header-inner {
    gap: var(--sp-2);
    padding-inline: var(--sp-4);
  }
  #header-auth-area {
    gap: var(--sp-2);
    min-width: 0;
  }
  #header-auth-area .btn {
    height: 36px;
    padding-inline: var(--sp-3);
    font-size: var(--text-xs);
  }
  #header-auth-area .btn--primary {
    display: none;
  }
}

/* ── User pill (logged in) ── */
.auth-user-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--brand-sky-soft);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: 3px var(--sp-3) 3px 3px;
  cursor: default;
  transition: border-color var(--motion-fast);
}
.auth-user-pill:hover { border-color: var(--brand-aqua); }
.auth-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-navy);
  color: var(--brand-white);
  font-size: 11px;
  font-weight: var(--fw-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.04em;
}
.auth-username {
  font-size: var(--text-sm);
  font-weight: var(--fw-medium);
  color: var(--brand-navy);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Protected page blur ── */
.auth-required .owner-main {
  filter: blur(5px);
  pointer-events: none;
  user-select: none;
  transition: filter var(--motion-medium);
}
.auth-required.auth-unlocked .owner-main {
  filter: none;
  pointer-events: all;
}

/* ═══════════════════════════════════════════════════
   Mobile overflow protection (MOBILE_ADAPTATION.md)
   ═══════════════════════════════════════════════════ */

/* Flex children: allow shrinking below content size to prevent overflow */
.flex > * { min-width: 0; }

/* Overflow utilities */
.overflow-wrap-any {
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Badge: prevent text overflow, allow wrap only if truly needed */
.badge {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Trust chip: protected from impossible edge cases */
.trust-chip {
  max-width: min(100%, 320px);
}

/* Reduce heavy blur/shadow effects on low-power devices */
@media (prefers-reduced-motion: reduce) {
  .hero-deco { display: none; }
  .deco-orb { display: none; }
}

/* Performance: skip heavy decorative blur on mobile */
@media (max-width: 768px) {
  .deco-orb { opacity: 0.5; filter: blur(40px); }
  /* Disable expensive backdrop-filter on older mobile browsers */
  .site-header:not(.is-scrolled) { backdrop-filter: none; -webkit-backdrop-filter: none; }
}
