/* ==========================================================================
   База: сброс, типографика, каркас экрана
   ========================================================================== */

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

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--c-line);
  color: var(--c-ink);
  font-family: var(--font-body);
  font-size: var(--fs-14);
  line-height: normal; /* как в макете; многострочным текстам line-height задан явно */
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p { margin: 0; }
img, svg { display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
[hidden] { display: none !important; }

a { color: var(--c-accent-ink); text-decoration: none; }
a:hover { color: var(--c-accent-hover); }
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible { outline: 3px solid var(--c-accent-ink); outline-offset: 2px; }

input::placeholder,
textarea::placeholder { color: var(--c-placeholder); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.num { font-variant-numeric: tabular-nums; }

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

/* ---------- Каркас экрана ----------
   .screen — один экран приложения на всю высоту окна.
   Шапка и подвал не прокручиваются, прокручивается только .screen__body.
   На широком экране приложение центрируется и ограничено --w-max. */

.screen {
  position: relative;
  width: 100%;
  max-width: var(--w-max);
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--c-bg);
}
.screen--white { background: var(--c-surface); }

.screen__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: var(--sp-14);
  display: flex;
  flex-direction: column;
  gap: var(--sp-10);
}
/* Экраны настроек и онбординга — белые, с полями 17px и крупными промежутками */
.screen__body--form { padding: var(--sp-17) var(--sp-17) var(--sp-24); gap: var(--sp-24); }
.screen__body--onb  { padding: var(--sp-17) var(--sp-17) var(--sp-24); gap: var(--sp-20); }
/* Место под плавающую кнопку «+ Запись» */
.screen__body--fab  { padding-bottom: 82px; }

/* ---------- Утилиты раскладки ---------- */
.stack { display: flex; flex-direction: column; }
.row   { display: flex; align-items: center; }
.row--top { align-items: flex-start; }
.row--between { justify-content: space-between; }
.grow  { flex: 1; min-width: 0; }
.shrink-0 { flex-shrink: 0; }
.gap-2 { gap: var(--sp-2); }  .gap-3 { gap: var(--sp-3); }  .gap-5 { gap: var(--sp-5); }
.gap-7 { gap: var(--sp-7); }  .gap-8 { gap: var(--sp-8); }  .gap-10 { gap: var(--sp-10); }
.gap-12 { gap: var(--sp-12); } .gap-14 { gap: var(--sp-14); } .gap-17 { gap: var(--sp-17); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-7); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-7); }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-5); }
.grid-7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--sp-5); }
.center { text-align: center; align-items: center; }

/* ---------- Текст ---------- */
.t-11 { font-size: var(--fs-11); }
.t-12 { font-size: var(--fs-12); }
.t-13 { font-size: var(--fs-13); }
.t-14 { font-size: var(--fs-14); }
.t-15 { font-size: var(--fs-15); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.muted  { color: var(--c-muted); }
.subtle { color: var(--c-subtle); }
.ink    { color: var(--c-ink); }
.accent { color: var(--c-accent-ink); }
.danger { color: var(--c-danger); }
.ok     { color: var(--c-ok); }
.warn-text { color: var(--c-warn-text); }
.lh-tight { line-height: 1.35; }
.lh-loose { line-height: var(--lh-loose); }
.strike { text-decoration: line-through; }
.pre-line { white-space: pre-line; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Заголовки шрифтом Unbounded */
.display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--ls-display);
  line-height: var(--lh-tight);
}
.display--24 { font-size: var(--fs-24); line-height: 1.12; letter-spacing: -0.03em; }
.display--20 { font-size: var(--fs-20); }
.display--19 { font-size: var(--fs-19); }
.display--17 { font-size: var(--fs-17); }
.display--16 { font-size: var(--fs-16); }
.display--15 { font-size: var(--fs-15); }
.display--14 { font-size: var(--fs-14); line-height: 1.25; }

/* Заголовок секции внутри экрана (14px полужирный) */
.section-title { font-size: var(--fs-14); font-weight: 600; }
.section-hint  { font-size: var(--fs-12); line-height: var(--lh-text); color: var(--c-muted); }
.caption { font-size: var(--fs-11); line-height: var(--lh-text); color: var(--c-muted); }
.overline {
  font-size: var(--fs-11); font-weight: 600; color: var(--c-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
}
