*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 88% -8%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%),
    radial-gradient(700px 480px at -6% 12%, color-mix(in srgb, #f2a63b 10%, transparent), transparent 70%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
/* Лёгкая зернистость, чтобы фон не был плоским */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Типографика: контраст размера, веса, цвета, трекинга и регистра */
.display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.025em; line-height: 1.05; margin: 0; }
.h1 { font-size: clamp(2.5rem, 6.4vw, 5rem); }
.h2 { font-size: clamp(1.9rem, 4vw, 3rem); }
.h3 { font-family: var(--font-display); font-weight: 600; font-size: 1.35rem; letter-spacing: -0.015em; margin: 0; line-height: 1.2; }
.eyebrow { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--brand); }
.lead { font-size: clamp(1.05rem, 1.6vw, 1.25rem); color: var(--ink-2); max-width: 36em; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
em.accent { font-style: italic; color: var(--brand); }

/* Кнопки */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0 1.4rem; border-radius: 999px; border: 1px solid transparent;
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease);
}
.btn:hover { transform: translateY(-1px) scale(1.02); }
.btn:active { transform: none; }
.btn-primary { background: var(--brand); color: var(--brand-ink); box-shadow: 0 1px 2px rgba(0,0,0,.15), 0 10px 24px color-mix(in srgb, var(--brand) 35%, transparent); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface); }
.btn-sm { min-height: 40px; padding: 0 1rem; font-size: 0.92rem; }

/* Карточки и стекло (только поверх цветного фона) */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow-1); }
.glass {
  background: var(--surface-glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
}

/* Статусы: цвет + значок + текст, а не один цвет */
.chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.7rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.chip svg { width: 14px; height: 14px; }
.chip-paid { background: var(--paid-soft); color: var(--paid); }
.chip-soon { background: var(--soon-soft); color: var(--soon); }
.chip-overdue { background: var(--overdue-soft); color: var(--overdue); }
.chip-neutral { background: var(--bg-2); color: var(--ink-2); }

/* Появление при прокрутке */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  *, *::before, *::after { animation: none !important; }
  .btn:hover { transform: none; }
}

/* Всплывающее сообщение */
.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 0.75rem 1.2rem; border-radius: 999px; font-size: 0.92rem; font-weight: 500;
  box-shadow: var(--shadow-2); transition: opacity 0.25s var(--ease), transform 0.25s var(--ease); z-index: 100; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer;
  display: inline-grid; place-items: center;
}
.theme-toggle:hover { background: var(--surface); }
.theme-toggle svg { width: 18px; height: 18px; }
