/* Основные цвета приложения. Меняешь здесь — меняется везде.
   light-dark(дневной, ночной): браузер берёт первый цвет в светлой теме и второй — в тёмной.
   Какая тема сейчас — решает color-scheme ниже: выбор в «Настройки → Внешний вид»
   (атрибут data-theme у <html>), а если выбрано «Как в системе» — настройка телефона/компьютера. */
:root {
  color-scheme: light dark;
  --radius: 14px;

  --bg: light-dark(#f4f5f7, #111318);          /* фон страницы */
  --card: light-dark(#ffffff, #1c1f27);        /* карточки, меню */
  --text: light-dark(#1f2330, #e8eaf0);
  --muted: light-dark(#6b7280, #9aa1ae);       /* второстепенный текст */
  --subtle: light-dark(#a0a5b0, #7d8494);      /* мелкие подписи */
  --faint: light-dark(#b0b5c0, #626978);       /* серые значки */
  --accent: light-dark(#4f46e5, #7c7ff7);      /* фирменный фиолетовый */
  --accent-soft: light-dark(#eef2ff, #272a4d);
  --accent-faint: light-dark(#d9dcf7, #3b3f73);
  --accent-strong: light-dark(#3730a3, #c7d2fe);

  --line: light-dark(#eef0f3, #2a2e38);        /* разделители, дорожки полосок */
  --line-strong: light-dark(#e3e6ec, #343945);
  --segment: light-dark(#e7e9ee, #0c0e12);     /* подложка переключателя «День | Неделя» */
  --soft: light-dark(#f1f2f5, #262a34);        /* фон чипов, наведение */
  --cell-off: light-dark(#f6f7f9, #22262f);    /* выходной день в календаре привычки */
  --border: light-dark(#d8dbe2, #3a404d);      /* рамки полей */
  --border-strong: light-dark(#c7cbd4, #4b5261);
  --inverse: light-dark(#1f2330, #2e3340);     /* тёмные плашки и подсказки */

  --good-text: light-dark(#16a34a, #4ade80);
  --good-soft: light-dark(#dcfce7, #183524);
  --good-faint: light-dark(#86efac, #1f6b3e);
  --bad: light-dark(#d93036, #f87171);
  --danger: light-dark(#e5484d, #f05a5f);
  --bad-soft: light-dark(#fdecec, #3a2023);
  --bad-faint: light-dark(#fecaca, #6b2a2d);
  --warn-soft: light-dark(#fff6e5, #3a2f1a);
  --warn-text: light-dark(#8a5300, #fcd9a0);
  --info-soft: light-dark(#e0f2fe, #15304a);
  --info-text: light-dark(#0284c7, #38bdf8);   /* заморозки серии */
  --orange-soft: light-dark(#fff1e6, #3d2a17);
  --orange-text: light-dark(#c2410c, #fb923c);
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Поля ввода — в цвет темы (у отдельных полей свой фон задан ниже и важнее этого правила) */
:where(input, textarea, select) { background-color: var(--card); color: var(--text); }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 72px; /* место под нижнее меню */
}

.topbar {
  background: var(--card);
  padding: 14px 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.logo {
  font-weight: 700;
  font-size: 20px;
  color: var(--accent);
  text-decoration: none;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.stat-label { color: var(--muted); font-size: 14px; }
.stat-value { font-size: 28px; font-weight: 700; }

/* Заголовок раздела и заготовки страниц */
.page-title { margin: 4px 0 12px; font-size: 24px; }

.placeholder p { margin: 0; color: var(--muted); }
.placeholder .placeholder-badge {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

/* Список-строки (например, в настройках) */
.list { margin-top: 12px; padding: 0 16px; }
.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: none; }
.list-row .icon { width: 18px; height: 18px; color: var(--muted); }

/* Задачи: список */
.task-counter { margin: 4px 4px 8px; color: var(--muted); font-size: 14px; }

.task-list { padding: 0 8px; }
.task-items { list-style: none; margin: 0; padding: 0; }
ul.task-list { padding: 0 8px; }

.section-title {
  margin: 20px 4px 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
}

/* Задачи: строка добавления внизу списка */
.task-new {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
}
.task-items + .task-new { border-top: 1px solid var(--line); }

.task-new-icon {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--accent);
  cursor: text;
}
.task-new-icon .icon { width: 20px; height: 20px; }

.task-new input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  padding: 4px 0;
  font: inherit;
  font-size: 16px; /* меньше 16px — телефон увеличивает страницу при вводе */
  background: transparent;
  color: var(--text);
}
.task-new input::placeholder { color: var(--accent); opacity: 0.8; }
.task-new input:focus::placeholder { color: var(--muted); }

.btn-save {
  flex: none;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
/* Пока поле пустое, кнопку не показываем */
.task-new input:placeholder-shown ~ .btn-save { display: none; }

/* Задачи: строка задачи */
.task-item { border-bottom: 1px solid var(--line); }
.task-item:last-child { border-bottom: none; }

.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
}
.task-row form, .subtask-row form { margin: 0; display: flex; }

.task-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.task-title { flex: 1; overflow-wrap: anywhere; }
.task-link { color: inherit; text-decoration: none; }
.task-link:hover { color: var(--accent); }
.task-item.skipped > .task-row .task-title { color: var(--muted); }
.task-item.skipped > .task-row .check { border-style: dashed; }

/* Заметка: одна строка под названием */
.task-note {
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 13px;
}
.task-item.done > .task-row .task-title,
.subtask-row.done .task-title { color: var(--muted); text-decoration: line-through; }

/* Название задачи-списка — кнопка, раскрывающая подпункты */
.task-expand {
  display: flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.task-expand .icon { flex: none; width: 16px; height: 16px; color: var(--muted); transition: transform 0.15s; }
.task-item.expanded .task-expand .icon { transform: rotate(90deg); }

.task-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
}
.chip .icon { width: 12px; height: 12px; }
.chip-overdue { background: var(--bad-soft); color: var(--bad); }
/* Цвет категории задаётся прямо в разметке: style="--cat: #3b82f6" */
.chip-cat { background: color-mix(in srgb, var(--cat) 14%, var(--card)); color: var(--cat); font-weight: 600; }
.cat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat);
}

/* Фильтр по категориям: ряд кнопок, листается пальцем */
.filters {
  display: flex;
  gap: 6px;
  margin: 8px 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.filter.active { background: var(--text); color: var(--card); }

/* Заголовок блока с кнопкой справа («Просрочено · Все на сегодня») */
.section-head { display: flex; align-items: center; justify-content: space-between; }
.section-head form { margin: 12px 4px 0; }
.link-btn {
  text-decoration: none;
  padding: 4px 8px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.link-btn:hover { background: var(--accent-soft); }

/* Задачи: полоска недели */
.week {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 4px;
  margin-bottom: 16px;
}
.week-days { flex: 1; display: flex; justify-content: space-between; }
.week-arrow {
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 44px;
  border-radius: 8px;
  color: var(--muted);
}
.week-arrow:hover { background: var(--bg); color: var(--text); }
.week-arrow .icon { width: 18px; height: 18px; }

.week-day {
  flex: 1;
  max-width: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 0 4px;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
}
.week-day:hover { background: var(--bg); }
.week-wd { font-size: 12px; color: var(--muted); }
.week-num { font-size: 17px; font-weight: 600; }
.week-dot { width: 5px; height: 5px; border-radius: 50%; }
.week-dot.on { background: var(--accent); }

.week-day.is-today .week-num { color: var(--accent); }
.week-day.selected { background: var(--accent); }
.week-day.selected .week-wd,
.week-day.selected .week-num { color: #fff; }
.week-day.selected .week-dot.on { background: #fff; }

/* Задачи: заголовок открытого дня */
.day-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 4px 4px;
}
.day-title { flex: 1; margin: 0; font-size: 18px; }

.pill {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.icon-btn:hover { color: var(--accent); }
.icon-btn .icon { width: 20px; height: 20px; }

/* Поле даты спрятано: календарь открывается кнопкой через app.js */
.day-jump { position: relative; margin: 0; }
.day-jump input {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.section-overdue { color: var(--bad); }

/* Подпункты задачи-списка */
.subtasks { padding: 0 4px 6px 42px; } /* отступ = кружок + промежуток */
.subtask-items { list-style: none; margin: 0; padding: 0; }
.subtask-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
}
.subtask-new { padding: 6px 0; gap: 10px; }
.subtask-new .task-new-icon { width: 20px; height: 20px; }
.subtask-new .task-new-icon .icon { width: 16px; height: 16px; }
.subtask-new input { font-size: 16px; }

.check {
  width: 26px;
  height: 26px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  padding: 0;
  display: grid;
  place-items: center;
  color: #fff;
}
.task-item.done > .task-row .check,
.subtask-row.done .check { background: var(--accent); border-color: var(--accent); }
.check .icon { width: 16px; height: 16px; }
.check-sm { width: 20px; height: 20px; }
.check-sm .icon { width: 12px; height: 12px; }

.btn-delete {
  border: none;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
  padding: 4px;
  display: grid;
}
.btn-delete:hover { color: var(--danger); }
.btn-delete .icon { width: 18px; height: 18px; }

/* Звёздочка важной задачи */
.star {
  display: grid;
  padding: 4px;
  border: none;
  border-radius: 8px;
  background: none;
  color: #f5a524;
  cursor: pointer;
}
.star .icon { width: 20px; height: 20px; fill: currentColor; }
.star:hover { background: var(--warn-soft); }
.task-item.done .star { color: #d6c49a; }

/* Меню «⋯» у задачи */
.menu { position: relative; flex: none; }
.menu summary {
  list-style: none;
  display: grid;
  padding: 4px;
  border-radius: 8px;
  color: var(--faint);
  cursor: pointer;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary:hover,
.menu[open] summary { color: var(--text); background: var(--soft); }
.menu summary .icon { width: 20px; height: 20px; }

.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 10;
  min-width: 230px;
  display: flex;
  flex-direction: column;
  padding: 6px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}
.menu-panel form { margin: 0; }

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: none;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.menu-item:hover { background: var(--bg); }
a.menu-item { text-decoration: none; }
.menu-item .icon { flex: none; width: 18px; height: 18px; color: var(--muted); }
.menu-item.danger,
.menu-item.danger .icon { color: var(--danger); }

/* Блоки меню (дата, время), разделённые линией */
.menu-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.menu-quick { display: flex; gap: 6px; padding: 2px 10px; }
.menu-quick:empty { display: none; }
.quick {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: none;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.quick:hover { border-color: var(--accent); color: var(--accent); }

.menu-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px;
}
.menu-field .icon { flex: none; width: 18px; height: 18px; color: var(--muted); }
.menu-field input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}

.empty { color: var(--muted); text-align: center; margin: 16px 8px 0; font-size: 14px; }

/* Служебные подсказки нельзя выделить и скопировать — это не содержимое, а часть интерфейса */
.empty,
.empty-day,
.quick-tip,
.task-counter,
.progress-percent,
.section-head .hint,
.edit-field .hint {
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
}

/* Задачи: заголовок с поиском и переключатель «День | Неделя» */
.tasks-head { display: flex; align-items: center; justify-content: space-between; }
.tasks-head .page-title { margin-bottom: 8px; }

.segmented {
  display: flex;
  padding: 3px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--segment);
}
.segmented a {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}
.segmented a.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }

/* Прогресс дня */
.progress {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px 8px;
  margin: 4px 4px 10px;
}
.progress .task-counter { margin: 0; }
.progress-percent { color: var(--accent); font-size: 14px; font-weight: 700; }
.progress-bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 999px;
  background: var(--line-strong);
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* Итог дня */
.evening {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  background: var(--inverse);
  color: #fff;
}
.evening-text { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.evening-text .icon { flex: none; width: 20px; height: 20px; color: #fcd34d; }
.evening-actions { display: flex; gap: 8px; }
.evening-actions form { margin: 0; }
.evening .quick { border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.quick-accent,
.evening .quick-accent { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Умный ввод: подсказка под полем */
.quick-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 4px 0 42px;
}
.quick-hint:empty { display: none; }
.chip-title { padding-left: 0; background: none; color: var(--text); }

/* Предупреждение о названии («а», «!!!») — под полем ввода */
.chip-warning,
.title-warning {
  background: var(--warn-soft);
  color: var(--warn-text);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.35;
  user-select: none;
  -webkit-user-select: none;
}
.chip-warning { flex-basis: 100%; padding: 6px 10px; }
.title-warning { margin: 0 4px 10px 42px; padding: 8px 10px; }
.quick-hint { padding-bottom: 10px; }
.quick-tip {
  display: none;
  margin: 0;
  padding: 0 4px 10px 42px;
  color: var(--muted);
  font-size: 12px;
}
.quick-tip b { font-weight: 600; color: var(--text); }
/* Подсказку-пример показываем, пока поле в фокусе и пустое */
.task-list:has(#new-task:focus:placeholder-shown) .quick-tip { display: block; }

/* Режим «Неделя» */
.group-link { color: inherit; text-decoration: none; }
.group-link:hover { color: var(--accent); }
.empty-day { margin: 0 4px 4px; color: var(--subtle); font-size: 14px; }
.section-head .hint { margin: 12px 4px 0; }

/* Поиск */
.search-box { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px; }
.search-box .icon { flex: none; width: 20px; height: 20px; color: var(--muted); }
.search-box input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  font: inherit;
  font-size: 16px;
  color: var(--text);
}
.search-row { color: inherit; text-decoration: none; }
.check-static { cursor: default; flex: none; }
.task-item.done .check-static { background: var(--accent); border-color: var(--accent); }

/* Настройки */
.list-link { color: inherit; text-decoration: none; }
.list-link:hover { color: var(--accent); }
.list-link .hint { margin-left: auto; margin-right: 8px; }
.list-disabled { opacity: 0.55; }
.cat-name { display: inline-flex; align-items: center; gap: 10px; }

.text-field {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  font-size: 16px;
}

.palette { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span {
  display: block;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cat);
  cursor: pointer;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 2px transparent;
}
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--cat); }
.swatch input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 4px; }

.btn-danger {
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: none;
  color: var(--danger);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn-danger:hover { background: var(--bad-soft); }

/* Свайпы: строка едет за пальцем, под ней видна подсказка */
/* z-index только на время свайпа: иначе меню «⋯» пряталось бы под следующими строками */
.task-row { touch-action: pan-y; background: var(--card); }
.task-item { position: relative; }
.task-item.swiping { overflow: hidden; }
.task-item.swiping > .task-row { position: relative; z-index: 1; }
.task-item.swiping::before {
  content: "";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}
.task-item.swipe-right::before { content: "✓ Выполнить"; justify-content: flex-start; background: #22a559; }
.task-item.done.swipe-right::before { content: "↺ Вернуть"; background: #64748b; }
.task-item.swipe-left::before { content: "Пропустить ⏭"; justify-content: flex-end; background: #94a3b8; }
/* английский интерфейс: <html lang="en"> */
:lang(en) .task-item.swipe-right::before { content: "✓ Done"; }
:lang(en) .task-item.done.swipe-right::before { content: "↺ Undo"; }
:lang(en) .task-item.swipe-left::before { content: "Skip ⏭"; }
.task-item.swipe-ready.swipe-right::before,
.task-item.swipe-ready.swipe-left::before { filter: brightness(0.9); }
.task-row.returning { transition: transform 0.2s ease; }

/* Конфетти */
.confetti {
  position: fixed;
  top: -12px;
  z-index: 30;
  width: 8px;
  height: 12px;
  border-radius: 2px;
  pointer-events: none;
  animation: confetti-fall linear forwards;
}
@keyframes confetti-fall {
  to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; }
  .progress-bar span, .task-row.returning { transition: none; }
}

/* ---------- Главная ---------- */
/* Шапка главной: градиент и рисунок по времени суток */
.hero {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  padding: 18px 16px 16px;
  border-radius: 20px;
  overflow: hidden;
  color: #3b2a1a;
}
.hero-morning { background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.hero-day { background: linear-gradient(135deg, #e0f2fe 0%, #a5d8ff 100%); color: #0c3a5b; }
.hero-evening { background: linear-gradient(135deg, #fbc2eb 0%, #a18cd1 100%); color: #3b1f4f; }
.hero-night { background: linear-gradient(135deg, #1e1b4b 0%, #3730a3 100%); color: #eef2ff; }

.hero-text { position: relative; z-index: 1; flex: 1; min-width: 0; }
.hero-title { margin: 0 0 2px; font-size: 26px; }
.hero-date { margin: 0 0 12px; opacity: 0.75; }
.hero-thought {
  display: flex;
  gap: 6px;
  margin: 0;
  max-width: 320px;
  font-size: 14px;
  font-style: italic;
  line-height: 1.4;
  opacity: 0.9;
}
.hero-thought .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; opacity: 0.6; }
.sky { flex: none; width: 120px; height: 80px; margin: -4px -6px 0 0; }

/* Цветные значки у заголовков карточек */
.card-title { display: flex; align-items: center; gap: 8px; }
.title-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.title-icon .icon { width: 16px; height: 16px; }
.title-icon-violet { background: var(--accent-soft); color: var(--accent); }
.title-icon-yellow { background: var(--warn-soft); color: #e8a000; }

/* Плавное появление карточек по очереди: --i — номер карточки */
.reveal { animation: reveal 0.45s ease-out both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes reveal {
  from { opacity: 0; transform: translateY(10px); }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { animation: none; }
}

.today-card { display: flex; align-items: center; gap: 16px; }
.ring { flex: none; width: 84px; height: 84px; }
.ring-bg, .ring-value { fill: none; stroke-width: 3.6; }
.ring-bg { stroke: var(--line-strong); }
.ring-value {
  stroke: url(#ring-gradient); /* градиент задан в home.html */
  stroke-linecap: round;
  /* начинаем сверху и идём по часовой стрелке; длина окружности r=15.9 ≈ 100 */
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dasharray 0.5s ease;
}
.ring-text { fill: var(--text); font-size: 8px; font-weight: 700; text-anchor: middle; }
.today-title { margin: 0 0 4px; font-size: 18px; font-weight: 700; }

.alert-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  background: var(--bad-soft);
  color: var(--bad);
  font-weight: 600;
  text-decoration: none;
}
.alert-card span { flex: 1; }
.alert-card .icon { flex: none; width: 20px; height: 20px; }

.star-static { cursor: default; }
.star-static:hover { background: none; }
.more-link {
  display: block;
  padding: 8px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
  text-decoration: none;
}
.more-link:hover { color: var(--accent); }
.empty-inline { margin: 0; padding: 14px 4px; color: var(--muted); font-size: 14px; user-select: none; }
.home-add { border-top: 1px solid var(--line); text-decoration: none; }
.home-add-text { color: var(--accent); opacity: 0.8; }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.stat-card { display: flex; flex-direction: column; gap: 4px; }
.stat-card .hint b { font-weight: 700; }
.up { color: #22a559; }
.down { color: var(--bad); }

/* Карточка «За неделю» */
.stat-label { display: inline-flex; align-items: center; gap: 6px; }
.mini-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--good-soft);
  color: var(--good-text);
}
.mini-icon .icon { width: 12px; height: 12px; stroke-width: 3; }

.week-body { display: flex; align-items: center; gap: 8px; min-height: 50px; }
.trend {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.trend-up { background: var(--good-soft); color: var(--good-text); }
.trend-down { background: var(--bad-soft); color: var(--bad); }
.trend-same { background: var(--soft); color: var(--muted); }

.week-dots { display: flex; justify-content: space-between; gap: 2px; margin-top: 8px; }
.week-dot-item { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid transparent;
  box-sizing: border-box;
}
.dot-done { background: #22a559; }
.dot-partial { background: linear-gradient(90deg, #22a559 50%, var(--good-soft) 50%); }
.dot-missed { background: var(--bad-faint); }
.dot-empty { background: var(--line); }
.dot-today { border-color: #22a559; }
.dot-future { border: 2px dashed var(--border); }
.dot-frozen { background: #7dd3fc; }
.week-dot-item.is-today .dot { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px #22a559; }
.dot-label { color: var(--subtle); font-size: 10px; user-select: none; }
.week-dot-item.is-today .dot-label { color: var(--good-text); font-weight: 700; }

/* Огонёк серии: цвета по уровням (0 — погас, 5 — «Легенда») */
.streak-body { display: flex; align-items: flex-end; gap: 10px; min-height: 50px; }
.streak-next { color: var(--subtle); }
.flame-name { font-weight: 700; }

.flame { flex: none; overflow: visible; transform-origin: 50% 100%; }
.flame-0 .flame-outer { fill: var(--line-strong); }
.flame-1 { --outer: #fcd34d; --inner: #fff7d6; }
.flame-2 { --outer: #fb923c; --inner: #fde68a; }
.flame-3 { --outer: #f4511e; --inner: #fcd34d; }
.flame-4 { --outer: #e11d48; --inner: #fb923c; filter: drop-shadow(0 0 6px rgba(244, 81, 30, 0.55)); }
.flame-5 { --outer: #7c3aed; --inner: #38bdf8; filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.6)); }
.flame-outer { fill: var(--outer); }
.flame-inner { fill: var(--inner); }

.flame-text-1 { color: #d19a00; }
.flame-text-2 { color: #ea7a1f; }
.flame-text-3 { color: #f4511e; }
.flame-text-4 { color: #e11d48; }
.flame-text-5 { color: #7c3aed; }

/* С уровня «Пламя» огонёк колышется */
.flame-3, .flame-4, .flame-5 { animation: flicker 1.6s ease-in-out infinite alternate; }
.flame-5 { animation-duration: 1.1s; }
@keyframes flicker {
  0%   { transform: scale(1, 1) skewX(0deg); }
  50%  { transform: scale(0.97, 1.04) skewX(-2deg); }
  100% { transform: scale(1.02, 0.98) skewX(2deg); }
}
@media (prefers-reduced-motion: reduce) {
  .flame { animation: none; }
}

.card-title { margin: 0 0 12px; font-size: 16px; }
.bars-card, .insights-card { margin-top: 12px; }
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.bar { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-value { min-height: 14px; color: var(--muted); font-size: 11px; }
.bar-track {
  position: relative;
  width: 100%;
  max-width: 28px;
  height: 90px;
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 55%, var(--card));
}
.bar.is-today .bar-fill { background: linear-gradient(180deg, #c026d3 0%, #6366f1 100%); }
.bar-label { color: var(--muted); font-size: 12px; }
.bar.is-today .bar-label { color: var(--accent); font-weight: 700; }

.insights { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; }
.insights li { line-height: 1.4; }

/* ---------- Статистика ---------- */
.hero-stats { background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%); color: #ffffff; }
.hero-stats .hero-thought { font-style: normal; max-width: 300px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.tile-body { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.mini-violet { background: var(--accent-soft); color: var(--accent); }
.mini-grey { background: var(--line); color: var(--muted); }
.mini-orange { background: var(--orange-soft); color: var(--orange-text); }
/* Кольцо «процент выполнения» в плитке статистики */
.tile-ring { width: 64px; height: 64px; flex: none; }
.tile-ring .ring-bg { stroke-width: 3.6; }
.tile-ring-value {
  fill: none;
  stroke: url(#tile-ring-gradient);
  stroke-width: 3.6;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
}
.tile-ring-text { fill: var(--text); font-size: 9px; font-weight: 700; text-anchor: middle; }
.tile-label { color: var(--muted); font-size: 14px; }
.tile-value { font-size: 30px; font-weight: 700; line-height: 1.1; }

.chart-card, .breakdown-card { margin-top: 12px; }
.title-icon-green { background: var(--good-soft); color: var(--good-text); }
.title-icon-blue { background: var(--info-soft); color: #0284c7; }

/* Легенда — для графика из двух рядов (выполнено / не выполнено) */
.legend { display: flex; gap: 16px; margin: -4px 0 12px; color: var(--muted); font-size: 13px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch-mark { width: 10px; height: 10px; border-radius: 3px; }
.swatch-done { background: var(--accent); }
.swatch-planned { background: var(--accent-faint); }

/* График: сетка позади, столбики поверх. Высота столбика — в % от верха шкалы. */
.chart { position: relative; height: 180px; padding-left: 28px; }
.chart-grid {
  position: absolute;
  inset: 0 0 22px 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.grid-line { position: relative; border-top: 1px solid var(--line); }
.grid-line span {
  position: absolute;
  left: 0;
  top: -8px;
  color: var(--subtle);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chart-cols {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--cols), 1fr);
  gap: 2px;
  height: 100%;
}
.col {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 22px;
  outline: none;
}
.col-stack {
  display: flex;
  flex-direction: column;
  gap: 2px; /* зазор между «выполнено» и «не выполнено» */
  width: 100%;
  max-width: 24px;
  min-height: 0;
}
.seg { display: block; min-height: 2px; }
.seg:first-child { border-radius: 4px 4px 0 0; } /* скругление только сверху, у основания — прямо */
.seg-done { background: var(--accent); }
.seg-planned { background: var(--accent-faint); }
.col-label {
  position: absolute;
  bottom: 0;
  color: var(--subtle);
  font-size: 11px;
  white-space: nowrap;
  user-select: none;
}
.col.is-today .col-label { color: var(--accent); font-weight: 700; }

/* Подсказка при наведении или фокусе с клавиатуры */
.col-tip {
  position: absolute;
  bottom: calc(100% - 16px);
  left: 50%;
  z-index: 5;
  display: none;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--inverse);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
}
.col:hover .col-tip, .col:focus .col-tip { display: block; }
.col:hover .col-stack, .col:focus .col-stack { filter: brightness(0.92); }
/* крайние столбики — подсказка не вылезает за край */
.col:first-child .col-tip, .col:nth-child(2) .col-tip { left: 0; transform: none; }
.col:last-child .col-tip, .col:nth-last-child(2) .col-tip { left: auto; right: 0; transform: none; }

.chart-table { margin-top: 10px; font-size: 14px; }
.chart-table summary { color: var(--accent); font-weight: 600; cursor: pointer; }
.chart-table table { width: 100%; margin-top: 8px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.chart-table th:first-child, .chart-table td:first-child { text-align: left; }
.chart-table th { color: var(--muted); font-weight: 600; }

/* Полоски «процент выполнения» */
.meters { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.meter-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; font-size: 14px; }
.meter-name { display: inline-flex; align-items: center; gap: 8px; }
.meter-value { color: var(--muted); white-space: nowrap; }
.meter-value b { color: var(--text); }
.meter-track { display: block; height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: inherit; background: var(--fill, var(--accent)); }
.meter-fill.meter-muted { background: var(--faint); }

/* Столбики по дням недели */
.week-cols { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 8px; }
.wcol { display: flex; flex-direction: column; align-items: center; gap: 4px; outline: none; }
.wcol-value { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.wcol-track {
  position: relative;
  width: 100%;
  max-width: 24px;
  height: 90px;
  border-radius: 4px 4px 0 0;
  background: var(--line);
}
.wcol-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 4px 4px 0 0;
  background: #93c5fd;
}
.wcol.is-best .wcol-fill { background: #0284c7; }
.wcol.is-best .wcol-label { color: #0284c7; font-weight: 700; }
.wcol-label { color: var(--muted); font-size: 12px; }

/* ---------- Награды ---------- */

/* Значок: шестигранная рамка цвета редкости (--frame), внутри «сердцевина» (--core) с иконкой */
.badge {
  position: relative;
  display: inline-grid;
  flex: none;
  width: 72px;
  height: 80px;
  --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.badge-sm { width: 36px; height: 40px; }
.badge-frame {
  position: relative;
  display: grid;
  place-items: center;
  clip-path: var(--hex);
  background: var(--frame);
  overflow: hidden;
}
.badge-core {
  display: grid;
  place-items: center;
  width: calc(100% - 12px);
  height: calc(100% - 13px);
  clip-path: var(--hex);
  background: var(--core);
  color: #fff;
}
.badge-sm .badge-core { width: calc(100% - 6px); height: calc(100% - 7px); }
.badge-core .icon { width: 44%; height: 44%; stroke-width: 2.4; }

.badge-common    { --frame: linear-gradient(135deg, #f6d2a8, #c07a3c 50%, #8a5424); --core: linear-gradient(160deg, #dea06a, #a8662f); }
.badge-rare      { --frame: linear-gradient(135deg, #bfdbfe, #3b82f6 50%, #1e3a8a); --core: linear-gradient(160deg, #60a5fa, #1d4ed8); }
.badge-epic      { --frame: linear-gradient(135deg, #f3e8ff, #a855f7 50%, #581c87); --core: linear-gradient(160deg, #c084fc, #7e22ce); }
.badge-legendary { --frame: linear-gradient(135deg, #fff7c2, #f5b700 45%, #a16207); --core: linear-gradient(160deg, #fcd34d, #d97706); }

/* Золотая рамка — с бегущим бликом */
.badge-legendary:not(.is-locked) .badge-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.75) 50%, transparent 65%);
  transform: translateX(-100%);
  animation: badge-shine 3.2s ease-in-out infinite;
}
@keyframes badge-shine {
  60%, 100% { transform: translateX(100%); }
}

/* Не полученное: серое, с замочком */
.badge.is-locked .badge-frame { filter: grayscale(1); opacity: 0.45; }
.badge-lock {
  position: absolute;
  right: -2px;
  bottom: 4px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--card);
  color: var(--muted);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.badge-lock .icon { width: 13px; height: 13px; }

/* Шапка наград */
.hero-awards { background: linear-gradient(135deg, #fef3c7 0%, #fbbf24 100%); color: #5b3a06; }
.hero-trophy { flex: none; display: grid; place-items: center; width: 84px; height: 84px; color: #fff; }
.hero-trophy .icon { width: 72px; height: 72px; stroke-width: 1.6; filter: drop-shadow(0 2px 6px rgba(161, 98, 7, 0.4)); }
.hero-progress { height: 8px; max-width: 220px; border-radius: 999px; background: rgba(255, 255, 255, 0.55); overflow: hidden; }
.hero-progress span { display: block; height: 100%; border-radius: inherit; background: #b45309; }

/* Плашки классов наград */
.class-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.class-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 14px 16px;
  color: inherit;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s;
}
.class-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08); }
.class-tile .badge { margin-bottom: 6px; }
.class-name { font-size: 17px; font-weight: 700; }
.class-count { color: var(--muted); font-size: 13px; }
.class-meter { width: 100%; margin-top: 6px; }
/* цвет рамки плашки и полоски — по классу */
.class-common { --fill: #b87333; }
.class-rare { --fill: #2563eb; }
.class-epic { --fill: #9333ea; }
.class-legendary { --fill: #d97706; }
.class-tile[class*="class-"] { border-color: color-mix(in srgb, var(--fill) 28%, var(--card)); }

/* Недавно получено */
.recent-card { margin-top: 12px; }
.recent-list { list-style: none; margin: 0; padding: 0; }
.recent-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
}
.recent-list li:last-child .recent-row { border-bottom: none; }
.recent-text { flex: 1; display: flex; flex-direction: column; }
.recent-row > .icon { width: 18px; height: 18px; color: var(--muted); }
.award-new.award-new-inline { position: static; } /* в строке, а не в углу карточки */

/* Страница класса */
.class-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.class-title { margin: 0; font-size: 24px; }
.class-head .hint { margin: 2px 0 0; }

/* Карточки достижений */
.awards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.award {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
  padding: 18px 12px 14px;
}
.award .badge { margin-bottom: 6px; }
.award-title { margin: 0; font-size: 16px; }
.award-desc { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.35; }
.award.is-locked .award-title { color: var(--muted); }
.award-date { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--good-text); font-size: 12px; font-weight: 600; }
.award-date .icon { width: 13px; height: 13px; stroke-width: 3; }
.award-progress { width: 100%; margin-top: 8px; }
.award-count { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.award-new {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* Плашка «Новое достижение!» сверху */
.award-toast {
  position: fixed;
  top: 60px;
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 16px 10px 12px;
  border-radius: 14px;
  background: var(--inverse);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transform: translateX(-50%);
  animation: award-in 0.4s ease-out;
  transition: opacity 0.35s, transform 0.35s;
}
.award-toast-text { display: flex; flex-direction: column; font-size: 14px; }
.award-toast-text b { color: #fcd34d; }
.award-toast.hide { opacity: 0; transform: translate(-50%, -10px); }
@keyframes award-in {
  from { opacity: 0; transform: translate(-50%, -14px); }
}
@media (prefers-reduced-motion: reduce) {
  .badge-legendary .badge-frame::after, .award-toast { animation: none; }
}

/* ---------- Привычки ---------- */
.hero-habits { background: linear-gradient(135deg, #d1fae5 0%, #6ee7b7 100%); color: #064e3b; }
.hero-habits .hero-trophy .icon { width: 64px; height: 64px; stroke-width: 1.8; filter: drop-shadow(0 2px 6px rgba(6, 95, 70, 0.35)); }

.btn-primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn-primary .icon { width: 20px; height: 20px; }
.btn-new-habit { margin: 0 0 12px; }
.btn-secondary { background: var(--accent-soft); color: var(--accent); }

.habit-cards { display: flex; flex-direction: column; gap: 12px; }
.habit-card { padding: 12px 14px; }
.habit-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; padding-left: 38px; }
.chip-limit { background: var(--orange-soft); color: var(--orange-text); }
.empty-habits { text-align: center; }

/* Строка отметки привычки */
.habit-row { display: flex; flex-direction: column; gap: 8px; }
.habit-top { display: flex; align-items: center; gap: 12px; }
.habit-top form { margin: 0; display: flex; }
.habit-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.check.checked { background: #22a559; border-color: #22a559; }
.habit-row.state-done .task-title { color: var(--good-text); }

.habit-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  color: #fff;
}
.habit-mark .icon { width: 14px; height: 14px; stroke-width: 3; }
.mark-done { background: #22a559; border-color: #22a559; }
.mark-partial { border-color: #22a559; background: linear-gradient(90deg, #22a559 50%, transparent 50%); }
.mark-fail { background: #f87171; border-color: #f87171; }
.mark-off { border-style: dashed; }
/* не отмечено: пунктир — чтобы не путать с кружком задачи, на который можно нажать */
.mark-pending { border-style: dashed; border-color: var(--faint); }

/* Отметка привычки с пунктами */
.habit-items { display: flex; flex-direction: column; gap: 6px; margin: 0; padding-left: 38px; }
.habit-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.habit-item-name { flex: 1; min-width: 0; }
.habit-item input {
  width: 72px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  text-align: right;
}
.habit-item-target { min-width: 92px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.habit-item.is-done .habit-item-name { color: var(--good-text); }
.habit-item.is-done input { border-color: var(--good-faint); background: var(--good-soft); }
.habit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* Уточнения перед планом */
.choice-column { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.setup-number { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setup-number input {
  width: 90px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}
.skip-link { display: block; margin-top: 14px; color: var(--muted); font-size: 14px; text-align: center; }

/* Новая привычка */
.goal-card { display: flex; flex-direction: column; gap: 12px; }
.goal-label { font-weight: 600; }
.goal-examples { display: flex; flex-wrap: wrap; gap: 8px; }

/* Редактор плана */
.plan-intro { margin-bottom: 12px; }
.plan-intro p { margin: 0; }
.plan-intro p + p { margin-top: 6px; }
.plan-goal { color: var(--muted); font-style: italic; }
.plan-error { margin: 12px 0 0; }
/* Редактор пунктов: название, правило роста, превью по неделям */
.item-editor { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.item-name { font-weight: 600; }
.item-rule { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; color: var(--muted); }
.item-rule label { display: inline-flex; align-items: center; gap: 6px; }
.item-rule input {
  width: 64px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
}
.item-rule .unit-input { width: 96px; }
.item-preview { margin: 0; color: var(--accent); font-size: 13px; line-height: 1.4; }
.item-preview:empty { display: none; }
/* «прибавлять» или «убавлять» — по типу привычки */
.verb-limit { display: none; }
.plan-form:has(input[name="kind"][value="limit"]:checked) .verb-good { display: none; }
.plan-form:has(input[name="kind"][value="limit"]:checked) .verb-limit { display: inline; }
/* выше по важности, чем .weekday-picker { display: none } из экрана задачи */
.weekday-picker.weekday-picker-always { display: flex; }
.plan-tip {
  display: flex;
  gap: 8px;
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--warn-soft);
  color: var(--warn-text);
  font-size: 14px;
  line-height: 1.4;
}
.plan-tip .icon { flex: none; width: 18px; height: 18px; }
.health-note {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1.4;
}

/* Страница привычки */
.habit-head .page-title { margin-bottom: 2px; }
.habit-head .hint { margin: 0 0 12px; }
.habit-tiles { margin-top: 12px; }
.plan-card, .calendar-card { margin-top: 12px; }
.plan-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.plan-item { display: flex; flex-direction: column; gap: 5px; }
.plan-item-head { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.plan-item-now { color: var(--muted); font-size: 14px; white-space: nowrap; }
.plan-item.is-reached .meter-fill { background: #22a559; }

/* Календарь как на GitHub: столбцы — недели, строки — дни недели */
.habit-calendar { display: flex; gap: 6px; }
.cal-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; color: var(--subtle); font-size: 10px; }
.cal-days span { line-height: 1; display: flex; align-items: center; }
.cal-grid { flex: 1; display: grid; grid-template-columns: repeat(12, 1fr); gap: 3px; }
.cal-week { display: grid; grid-template-rows: repeat(7, 1fr); gap: 3px; }
.cal-cell { display: block; aspect-ratio: 1; border-radius: 3px; background: var(--line); }
.cal-done { background: #22a559; }
.cal-partial { background: var(--good-faint); }
.cal-fail { background: var(--bad-faint); }
.cal-off { background: var(--cell-off); }
.cal-pending { background: var(--line); }
.cal-future { background: transparent; }
.cal-cell.is-today { outline: 2px solid var(--accent); outline-offset: 1px; }
.cal-legend { margin: 12px 0 0; flex-wrap: wrap; }
.cal-legend .cal-cell { width: 10px; height: 10px; }

.btn-secondary.btn-primary { margin-top: 16px; }

/* Экран задачи (редактирование) */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 12px;
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.back-link .icon { width: 20px; height: 20px; }

.edit-card { display: flex; flex-direction: column; gap: 10px; }
.edit-title,
.edit-note {
  width: 100%;
  border: none;
  outline: none;
  padding: 0;
  background: none;
  color: var(--text);
  font: inherit;
}
.edit-title { font-size: 20px; font-weight: 600; }
.edit-note { font-size: 16px; resize: vertical; min-height: 60px; }
.edit-note::placeholder { color: var(--subtle); }

.edit-field { display: flex; align-items: center; gap: 10px; }
.edit-field .icon { width: 20px; height: 20px; color: var(--muted); }
.edit-field input {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
}

.hint { margin: 0; color: var(--muted); font-size: 13px; }

/* Выбор одного из вариантов «таблетками»; сама радиокнопка спрятана */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  cursor: pointer;
}
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.weekday-picker { display: none; gap: 6px; }
.repeat:has(input[value="custom"]:checked) .weekday-picker { display: flex; }
.choice-day span { justify-content: center; width: 40px; padding: 7px 0; }

.btn-primary {
  width: 100%;
  margin-top: 16px;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

/* Плашка «Задача удалена · Отменить» над нижним меню */
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 10px 10px 16px;
  border-radius: 12px;
  background: var(--inverse);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  transform: translateX(-50%);
  animation: toast-in 0.2s ease-out;
  transition: opacity 0.25s, transform 0.25s;
}
.toast form { margin: 0; }
.toast.hide { opacity: 0; transform: translate(-50%, 8px); }

.toast-action {
  display: inline-block;
  text-decoration: none;
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: #a5b4fc;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.toast-action:hover { background: rgba(255, 255, 255, 0.08); }

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
}

/* Нижнее меню, как в мобильных приложениях */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding: 6px 0 8px;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
}

.bottom-nav .icon { width: 24px; height: 24px; }

.bottom-nav a.active { color: var(--accent); font-weight: 600; }

/* Блок «Привычки» на главной и в задачах: строки через разделитель */
.habits-today { display: flex; flex-direction: column; padding: 4px 14px; margin-bottom: 12px; }
.habits-today .habit-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.habits-today .habit-row:last-child { border-bottom: none; }

/* «Сбросить» — неброская кнопка рядом с отметкой привычки */
.quick-muted { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); border-color: var(--line-strong); }
.quick-muted .icon { width: 14px; height: 14px; }
.quick-muted:hover { color: var(--danger); border-color: #f3b5b7; }
.btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-danger .icon { width: 18px; height: 18px; }

/* Меню «⋯», открытое вверх (у нижних задач, см. app.js) */
.menu.menu-up .menu-panel { top: auto; bottom: calc(100% + 4px); }

/* Элементы управления — не текст для копирования: при двойном или долгом нажатии
   их надписи не выделяются (раньше в меню «⋯» мог выделиться и скопироваться весь текст).
   Названия задач, заметки и поля ввода по-прежнему можно выделять. */
button,
summary,
label.choice,
.menu-panel,
.bottom-nav,
.week,
.segmented,
.filters,
.chip,
.pill,
.quick,
.link-btn,
.btn-primary,
.btn-danger,
.toast,
.award-toast,
.class-tile,
.badge,
.habit-mark,
.week-dots,
.cal-grid,
.legend {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none; /* без меню «Копировать» при долгом нажатии на iPhone */
  -webkit-tap-highlight-color: transparent;
}
/* поля внутри меню (дата, время) — как обычно */
.menu-panel input { user-select: auto; -webkit-user-select: auto; }

/* Привычки в будущем дне: только план, без полей */
.mark-future { border-style: dashed; border-color: var(--border); }
.habit-items-plan { list-style: none; }
.habit-items-plan .habit-item-target { min-width: 0; }
/* Режим «Неделя»: какие привычки в этот день */
.group-habits {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 4px 6px;
  color: var(--good-text);
  font-size: 13px;
}
.group-habits .icon { width: 14px; height: 14px; flex: none; }

/* Компактные привычки в разделе задач: одна строка на привычку */
.habits-compact { padding: 2px 12px; margin-bottom: 12px; }
.habit-compact { border-bottom: 1px solid var(--line); }
.habit-compact:last-child { border-bottom: none; }
.habit-compact-row { display: flex; align-items: center; gap: 10px; min-height: 42px; }
.habit-compact-row form { margin: 0; display: flex; }
.habit-mark-sm { width: 20px; height: 20px; }
.habit-mark-sm .icon { width: 11px; height: 11px; }
.habit-compact-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}
.habit-compact.state-done .habit-compact-title { color: var(--good-text); }
.habit-compact-status { color: var(--muted); font-size: 12px; white-space: nowrap; }
.habit-compact.state-done .habit-compact-status { color: var(--good-text); font-weight: 600; }
.habit-quick,
.habit-expand {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.habit-quick { background: var(--good-soft); color: var(--good-text); }
.habit-quick:hover { background: var(--good-faint); }
.habit-expand:hover { background: var(--bg); color: var(--text); }
.habit-quick .icon, .habit-expand .icon { width: 16px; height: 16px; }
.habit-expand .icon { transition: transform 0.15s; }
.habit-expand[aria-expanded="true"] .icon { transform: rotate(90deg); }
.habit-compact-body { padding: 0 0 10px; }
.habit-compact-body .habit-items { padding-left: 30px; }

/* Облегчённый день */
.light-mark { color: #0d9488; font-weight: 600; }
.light-days .choice-row { margin-top: 4px; }

/* Поле времени у привычек сна и подъёма */
.item-rule .time-input,
.habit-item .time-input { width: 104px; text-align: left; }
.setup-number input[type="time"] { width: 120px; }

/* Редактор пунктов: название с кнопкой ×, кнопка «+ Добавить пункт» */
.item-editor[hidden] { display: none; }
.item-head { display: flex; align-items: center; gap: 6px; }
.item-head .item-name { flex: 1; min-width: 0; }
.item-remove {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--faint);
  cursor: pointer;
}
.item-remove:hover { background: var(--bad-soft); color: var(--danger); }
.item-remove .icon { width: 18px; height: 18px; }
.add-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px dashed var(--border-strong);
  border-radius: 10px;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.add-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.add-item .icon { width: 16px; height: 16px; }
.add-item[hidden] { display: none; }

/* Значок «?» с пояснением (см. templates/_info.html) */
.info {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  margin-left: 4px;
  outline: none;
  cursor: help;
  user-select: none;
  -webkit-user-select: none;
}
.info-icon {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--line-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.info:hover .info-icon,
.info:focus .info-icon { background: var(--accent); color: #fff; }
.info-bubble {
  position: absolute;
  top: calc(100% + 8px);
  left: -8px;
  z-index: 30;
  display: none;
  flex-direction: column;
  gap: 6px;
  width: max-content;
  max-width: min(300px, calc(100vw - 48px));
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--inverse);
  color: #fff;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}
.info:hover .info-bubble,
.info:focus .info-bubble,
.info:focus-within .info-bubble { display: flex; }
/* Карточки появляются с анимацией — из-за неё каждая становится отдельным «слоем», и подсказка
   не может выйти за пределы своей карточки: следующая карточка ложилась поверх. Пока подсказка
   открыта, поднимаем её карточку (и блок, в котором она лежит) над остальными. */
:where(.reveal, .card, .section-head):has(.info:hover, .info:focus, .info:focus-within) {
  position: relative;
  z-index: 40;
}

/* Язык у привычки: метка «EN · Английский» рядом с названием */
.habit-name-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.topic-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  padding: 2px 8px 2px 3px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}
.topic-badge b,
.topic-code {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.page-title .topic-badge { font-size: 14px; }
.topic-code { margin-right: 6px; }
.topic-other { margin-top: 4px; display: none; }
.edit-card:has(input[name="topic"][value="other"]:checked) .topic-other { display: block; }

/* Карандаш «Изменить» у привычки и подчёркивание названия — видно, что на него можно нажать */
.habit-edit {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  color: var(--faint);
}
.habit-edit:hover { background: var(--bg); color: var(--accent); }
.habit-edit .icon { width: 17px; height: 17px; }
.habit-main .task-link:hover,
.habit-main .task-link:focus-visible,
.habit-compact-title:hover { text-decoration: underline; text-underline-offset: 3px; }
/* метка языка — сразу после названия, а не у правого края */
.habit-name-line .task-title { flex: 0 1 auto; }

/* Окно подтверждения (удаление привычки, категории) */
.confirm-dialog {
  width: min(360px, calc(100vw - 32px));
  padding: 22px 20px 18px;
  border: none;
  border-radius: 18px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  text-align: center;
}
.confirm-dialog[open] { animation: confirm-in 0.18s ease-out; }
.confirm-dialog::backdrop { background: rgba(15, 18, 30, 0.45); backdrop-filter: blur(2px); }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.confirm-dialog form { margin: 0; }
.confirm-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 10px;
  border-radius: 50%;
  background: var(--bad-soft);
  color: var(--danger);
}
.confirm-icon .icon { width: 24px; height: 24px; }
.confirm-title { margin: 0 0 8px; font-size: 19px; }
.confirm-text { margin: 0 0 18px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions button {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.confirm-cancel { background: var(--line); color: var(--text); }
.confirm-cancel:hover { background: var(--line-strong); }
.confirm-ok { background: var(--danger); color: #fff; }
.confirm-ok:hover { filter: brightness(0.92); }
@media (prefers-reduced-motion: reduce) { .confirm-dialog[open] { animation: none; } }
.confirm-actions button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Текст интерфейса («Добрый вечер», «100%», «Настройки», заголовки, подсказки) не выделяется
   и не копируется — по умолчанию для всего приложения. Выделять можно только данные
   пользователя: названия задач и привычек, заметки и всё, что вводится в поля. */
body {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none; /* без меню «Копировать» при долгом нажатии на iPhone */
}
input,
textarea,
.task-title,
.task-note,
.habit-compact-title,
.habit-name-line,
.cat-name,
.search-row .task-title {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}
/* кнопки и ссылки-кнопки, даже с классом task-title (название списка раскрывает подпункты), не выделяются */
button.task-title { user-select: none; -webkit-user-select: none; }

/* Настройки → Внешний вид: три варианта темы с маленьким макетом экрана.
   Макет раскрашивают те же переменные: color-scheme у макета решает, какой цвет из light-dark() взять. */
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-option { display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-preview {
  display: flex;
  width: 100%;
  aspect-ratio: 4 / 5;
  max-width: 120px;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 0 0 1px var(--border);
  transition: box-shadow 0.15s;
}
.theme-preview-light, .theme-half-light { color-scheme: light; }
.theme-preview-dark, .theme-half-dark { color-scheme: dark; }
.theme-half { flex: 1; display: flex; overflow: hidden; }
.theme-half-light .theme-screen { width: 200%; }
.theme-half-dark .theme-screen { width: 200%; margin-left: -100%; }
.theme-screen {
  flex: none;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 8px;
  background: var(--bg);
}
.theme-card {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 6px;
  border-radius: 6px;
  background: var(--card);
}
.theme-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.theme-line { flex: 1; height: 5px; border-radius: 3px; background: var(--line-strong); }
.theme-line-short { flex: 0 0 55%; }
.theme-name { font-size: 14px; color: var(--muted); }
.theme-option input:checked + .theme-preview { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent); }
.theme-option input:checked ~ .theme-name { color: var(--accent); font-weight: 600; }
.theme-option input:focus-visible + .theme-preview { outline: 2px solid var(--text); outline-offset: 6px; }
.theme-hint { margin-top: 14px; }

/* ---------- Вход ---------- */
.page-login { padding-bottom: 0; }
.page-login .topbar { display: none; }
.login {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 400px;
  min-height: calc(100vh - 32px);
  min-height: calc(100dvh - 32px);
  margin: 0 auto;
  padding: 8vh 0 24px;
  text-align: center;
}
.login-logo {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin-bottom: 14px;
  border-radius: 22px;
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
  color: #fff;
  box-shadow: 0 10px 30px rgba(129, 140, 248, 0.35);
}
.login-logo .icon { width: 38px; height: 38px; stroke-width: 2.2; }
.login-title { margin: 0; font-size: 32px; color: var(--accent); }
.login-tagline { margin: 6px 0 24px; max-width: 300px; color: var(--muted); line-height: 1.45; }
.login-card { width: 100%; display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.login-card form { margin: 0; }
.login-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.login-btn:hover { border-color: var(--accent); }
.login-main { border: none; background: var(--accent); color: #fff; }
.login-main:hover { border: none; filter: brightness(1.08); }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-link { align-self: center; }
.login-footer { margin: 16px 0 0; color: var(--muted); font-size: 14px; }
.login-footer a { color: var(--accent); font-weight: 600; text-decoration: none; }
.login-footer .link-btn { padding: 4px 6px; }
.login-email { color: var(--text); overflow-wrap: anywhere; }
.code-field { font-size: 26px; font-weight: 700; letter-spacing: 8px; text-align: center; font-variant-numeric: tabular-nums; }
.code-field::placeholder { color: var(--line-strong); }
.dev-code {
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  user-select: text;
  -webkit-user-select: text;
}
.dev-code b { color: var(--text); }
.lang-switch { margin-top: 12px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.lang-switch:hover { color: var(--accent); }
.law-note { max-width: 340px; margin: 20px 0 0; color: var(--subtle); font-size: 12px; line-height: 1.45; }
.login-mark {
  display: inline-grid;
  place-items: center;
  flex: none;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}
.login-mark .icon { width: 18px; height: 18px; }
.login-yandex .login-mark, .login-mark-yandex { background: #fc3f1d; }
.login-vk .login-mark, .login-mark-vk { background: #0077ff; font-size: 11px; }
.login-mark-guest { background: var(--muted); }
.login-or { display: flex; align-items: center; gap: 10px; color: var(--subtle); font-size: 13px; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.login-note { margin-top: 4px; line-height: 1.45; text-align: left; }
.login-error {
  width: 100%;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 14px;
  text-align: left;
}

/* ---------- Профиль ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; }
.avatar { flex: none; width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.avatar-letter {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
}
.profile-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.profile-name { font-size: 18px; overflow-wrap: anywhere; }
.profile-message {
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--good-soft);
  color: var(--good-text);
  font-size: 14px;
}
.guest-warning {
  display: flex;
  gap: 8px;
  margin: 12px 0 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--warn-soft);
  color: var(--warn-text);
  font-size: 13px;
  line-height: 1.45;
}
.guest-warning .icon { flex: none; width: 18px; height: 18px; }
.linked { display: inline-flex; align-items: center; gap: 4px; color: var(--good-text); font-size: 14px; font-weight: 600; }
.linked .icon { width: 16px; height: 16px; stroke-width: 3; }
/* спокойная кнопка — второстепенное действие («Выйти») */
.btn-primary.btn-soft { background: var(--accent-soft); color: var(--accent); }

/* Заморозки серии (карточка «Серия» на главной) */
.freeze-line { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; color: var(--info-text); font-size: 13px; font-weight: 600; }
.freeze-line > .icon { width: 15px; height: 15px; }
.freeze-line.is-empty { color: var(--subtle); }
.freeze-line .info { margin-left: 0; }
.freeze-saved { color: var(--info-text); }

/* Окно «Остались невыполненные задачи» на главной */
.overdue-dialog { text-align: left; }
.overdue-dialog .confirm-title { text-align: center; }
.overdue-icon { display: grid; margin: 0 auto 10px; background: var(--accent-soft); color: var(--accent); }
.overdue-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.overdue-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--soft); }
.overdue-name { min-width: 0; overflow-wrap: anywhere; }
.overdue-list .chip { flex: none; }
.overdue-actions { display: flex; flex-direction: column; gap: 0; }
.overdue-actions form { margin: 0; }
.overdue-actions .btn-primary { margin-top: 10px; }
.overdue-note { margin: 10px 0 4px; line-height: 1.4; }
.overdue-dialog .link-btn { display: block; margin: 0 auto; text-align: center; }

/* Настройки → Внешний вид → «Фон главной»: превью фонов (градиенты — те же, что у шапки) */
.scene-preview { position: relative; aspect-ratio: 4 / 3; }
.scene-preview-auto { background: var(--bg); }
.theme-option.is-locked { cursor: default; }
.theme-option.is-locked .scene-preview { filter: grayscale(0.6) brightness(0.8); }
.scene-lock {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
}
.scene-lock .icon { width: 22px; height: 22px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
.scene-hint { color: var(--subtle); font-size: 11px; line-height: 1.3; text-align: center; }
.scene-reward {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1.45;
}
.scene-reward .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }

/* ---------- Фоны приложения за награды (app/scenes.py): <html data-scene="…"> ----------
   Фон лежит за всеми карточками на всех страницах и подстраивается под тему: у каждого фона
   светлый и тёмный вариант (цвета — переменные --sc-… через light-dark(), как у самой темы).
   Закат днём — тёплое небо, в тёмной теме — сумерки; сияние в тёмной — ночное, в светлой — утреннее. */
:root[data-scene="sunset"], .scene-preview-sunset {
  --sc-sky1: light-dark(#ffe2c4, #1f1433);
  --sc-sky2: light-dark(#ffc3a6, #3b1d4d);
  --sc-sky3: light-dark(#f4a3b4, #73305a);
  --sc-sky4: light-dark(#c79ade, #c0586b);
  --sc-glow: light-dark(rgba(255, 232, 170, 0.75), rgba(255, 160, 110, 0.45));
  --sc-top1: light-dark(rgba(255, 228, 200, 0.92), rgba(31, 20, 51, 0.9));
  --sc-top2: light-dark(rgba(255, 220, 192, 0.6), rgba(40, 24, 62, 0.55));
  --sc-nav1: light-dark(rgba(196, 150, 220, 0.9), rgba(74, 30, 82, 0.9));
  --sc-nav2: light-dark(rgba(214, 164, 214, 0.6), rgba(112, 44, 88, 0.6));
  --sc-nav-border: light-dark(rgba(255, 255, 255, 0.45), rgba(255, 190, 170, 0.18));
  --sc-nav-shadow: light-dark(rgba(110, 50, 120, 0.28), rgba(0, 0, 0, 0.45));
  --sc-nav-text: light-dark(#5f3d6c, #e7c7dc);
  --sc-nav-active: light-dark(#3f1f8c, #ffd2a8);
  --sc-pill: light-dark(rgba(255, 255, 255, 0.5), rgba(255, 200, 170, 0.16));
  --sc-logo: var(--accent);
}
:root[data-scene="aurora"], .scene-preview-aurora {
  --sc-sky1: light-dark(#e3f3f7, #071427);
  --sc-sky2: light-dark(#eceafc, #0d2647);
  --sc-sky3: light-dark(#f6f4ff, #133a5c);
  --sc-band1: light-dark(rgba(45, 212, 191, 0.30), rgba(94, 234, 212, 0.30));
  --sc-band2: light-dark(rgba(139, 92, 246, 0.22), rgba(167, 139, 250, 0.26));
  --sc-star: light-dark(rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.85));  /* днём звёзд не видно */
  --sc-top1: light-dark(rgba(227, 243, 247, 0.92), rgba(7, 20, 39, 0.9));
  --sc-top2: light-dark(rgba(236, 234, 252, 0.55), rgba(9, 26, 50, 0.55));
  --sc-nav1: light-dark(rgba(214, 234, 244, 0.92), rgba(8, 21, 40, 0.92));
  --sc-nav2: light-dark(rgba(236, 234, 252, 0.6), rgba(16, 48, 80, 0.6));
  --sc-nav-border: light-dark(rgba(45, 212, 191, 0.28), rgba(158, 240, 225, 0.14));
  --sc-nav-shadow: light-dark(rgba(40, 70, 110, 0.18), rgba(0, 0, 0, 0.5));
  --sc-nav-text: light-dark(#3d5875, #a9bdd6);
  --sc-nav-active: light-dark(#0f766e, #7ef0dc);
  --sc-pill: light-dark(rgba(45, 212, 191, 0.16), rgba(126, 240, 220, 0.12));
  --sc-logo: light-dark(#0f766e, #9ff5e6);
  --sc-mountain: light-dark(rgba(84, 118, 150, 0.45), rgba(6, 17, 34, 0.95));
}
:root[data-scene] body { background: transparent; }
:root[data-scene] body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
/* закат: небо, мягкое солнце у горизонта, лиловые холмы внизу (днём тёплый, в тёмной теме — сумерки) */
:root[data-scene="sunset"] body::before,
.scene-preview-sunset {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 120' preserveAspectRatio='none'%3E%3Cpath d='M0 70 Q 100 30 200 60 T 400 50 V120 H0Z' fill='%23a46fc4' fill-opacity='0.35'/%3E%3Cpath d='M0 90 Q 120 55 250 82 T 400 78 V120 H0Z' fill='%237d4fa6' fill-opacity='0.45'/%3E%3C/svg%3E") bottom / 100% 22% no-repeat,
    radial-gradient(ellipse 70% 30% at 70% 82%, var(--sc-glow), transparent 70%),
    linear-gradient(180deg, var(--sc-sky1) 0%, var(--sc-sky2) 38%, var(--sc-sky3) 68%, var(--sc-sky4) 100%);
}
/* северное сияние: небо, переливающиеся полосы, горы внизу (в тёмной теме — ночь со звёздами, в светлой — утро) */
:root[data-scene="aurora"] body::before,
.scene-preview-aurora {
  background:
    radial-gradient(1.2px 1.2px at 8% 12%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 22% 30%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 37% 8%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 55% 20%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 68% 6%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 81% 26%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 93% 14%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 15% 45%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 48% 38%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 74% 42%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 88% 52%, var(--sc-star), transparent),
    radial-gradient(1.2px 1.2px at 30% 58%, var(--sc-star), transparent),
    radial-gradient(ellipse 80% 22% at 60% 24%, var(--sc-band1), transparent 72%),
    radial-gradient(ellipse 60% 18% at 30% 34%, var(--sc-band2), transparent 72%),
    linear-gradient(180deg, var(--sc-sky1) 0%, var(--sc-sky2) 55%, var(--sc-sky3) 100%);
}
/* горы у сияния — отдельный слой: форма из рисунка (маска), цвет — из темы
   (утром мягкие серо-голубые, ночью тёмные) */
:root[data-scene="aurora"] body::after {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 18%;
  z-index: -1;
  pointer-events: none;
  background: var(--sc-mountain);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 120' preserveAspectRatio='none'%3E%3Cpath d='M0 120 L60 70 L95 92 L150 45 L205 88 L250 62 L310 100 L360 72 L400 90 V120Z' fill='%2316304f' fill-opacity='0.88'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 120' preserveAspectRatio='none'%3E%3Cpath d='M0 120 L60 70 L95 92 L150 45 L205 88 L250 62 L310 100 L360 72 L400 90 V120Z' fill='%2316304f' fill-opacity='0.88'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}
/* сияние еле заметно «дышит» — медленно, чтобы не отвлекать */
:root[data-scene="aurora"] body::before { animation: aurora-breathe 12s ease-in-out infinite alternate; }
@keyframes aurora-breathe {
  from { filter: brightness(0.92) saturate(0.95); }
  to { filter: brightness(1.06) saturate(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  :root[data-scene="aurora"] body::before { animation: none; }
}
/* Верхняя полоска и нижнее меню — «матовое стекло» в цветах самого фона: сверху в тон неба,
   снизу в тон холмов или гор. Без резких границ и теней — плавно переходят в картинку. */
:root[data-scene] .topbar,
:root[data-scene] .bottom-nav {
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: none;
}
/* нижнее меню — плавающая стеклянная панель: по краям и снизу видно картинку */
:root[data-scene] .bottom-nav {
  left: 12px;
  right: 12px;
  bottom: calc(10px + env(safe-area-inset-bottom));
  max-width: 560px;
  margin: 0 auto;
  padding: 6px;
  border-radius: 22px;
}
:root[data-scene] .bottom-nav a { position: relative; isolation: isolate; border-radius: 16px; }

/* «Таблетка» под активным пунктом нижнего меню. Каждая вкладка — отдельная страница, поэтому
   переезд делает браузер (View Transitions): запоминает «таблетку» на старой странице
   (view-transition-name) и плавно переносит её на место новой. Старые браузеры просто
   показывают её сразу на новом месте. */
.nav-pill { display: none; }
:root[data-scene] .nav-pill {
  display: block;
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 16px;
  view-transition-name: nav-pill;
}
/* меню и верхняя полоска при переходе стоят на месте — движется только «таблетка» */
:root[data-scene] .bottom-nav { view-transition-name: bottom-nav; }
:root[data-scene] .topbar { view-transition-name: topbar; }
::view-transition-group(nav-pill) { animation-duration: 0.38s; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
/* сама страница меняется быстро и мягко, без «мигания» */
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.18s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
:root[data-scene] body { padding-bottom: 96px; }
:root[data-scene] .toast { bottom: 96px; }

:root[data-scene] .topbar { background: linear-gradient(180deg, var(--sc-top1), var(--sc-top2)); }
:root[data-scene] .bottom-nav {
  background: linear-gradient(0deg, var(--sc-nav1), var(--sc-nav2));
  border: 1px solid var(--sc-nav-border);
  box-shadow: 0 10px 28px var(--sc-nav-shadow);
}
:root[data-scene] .bottom-nav a { color: var(--sc-nav-text); }
:root[data-scene] .bottom-nav a.active { color: var(--sc-nav-active); }
:root[data-scene] .nav-pill { background: var(--sc-pill); }
:root[data-scene] .logo { color: var(--sc-logo); }

/* Поле пароля с «глазиком» (templates/_fields.html) */
.password-field { position: relative; display: block; }
.password-field .text-field { padding-right: 46px; }
.password-field input::-ms-reveal, .password-field input::-ms-clear { display: none; } /* свой «глаз» у Edge — убираем, есть наш */
.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.password-toggle:hover { color: var(--accent); background: var(--soft); }
.password-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.password-toggle .icon { width: 20px; height: 20px; }
.password-toggle .when-shown { display: none; }
.password-toggle[aria-pressed="true"] .when-hidden { display: none; }
.password-toggle[aria-pressed="true"] .when-shown { display: grid; }
.password-toggle span { display: grid; }

/* Переключатель «вкл / выкл» (Настройки → Задачи) */
.toggle-row { gap: 12px; cursor: pointer; }
.toggle-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch {
  flex: none;
  position: relative;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  background: var(--line-strong);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: background 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }

/* Настройки → Мои данные */
.data-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.data-stat { display: flex; flex-direction: column; gap: 2px; }
.data-stat b { font-size: 22px; }
.data-stat span { color: var(--muted); font-size: 12px; }
.data-since { grid-column: 1 / -1; margin-top: 4px; }
.list-link > .icon:last-child { flex: none; }

/* Настройки → О приложении */
.about-link { margin-top: 12px; }
.about-head { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 4px 0 8px; text-align: center; }
.about-head .login-logo { margin-bottom: 6px; }
.about-head .login-tagline { margin: 2px 0 8px; }
.about-features { display: flex; flex-direction: column; gap: 14px; }
.about-feature { display: flex; gap: 12px; align-items: flex-start; }
.about-feature .title-icon { flex: none; }  /* значки одной ширины — текст стоит ровно */
.about-feature > span:last-child { display: flex; flex-direction: column; gap: 2px; }
.about-feature .hint { line-height: 1.4; }
.about-tips { padding: 4px 16px; }
.about-tip { border-bottom: 1px solid var(--line); }
.about-tip:last-child { border-bottom: none; }
.about-tip summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 0;
  list-style: none;
  font-weight: 600;
  cursor: pointer;
}
.about-tip summary::-webkit-details-marker { display: none; }
.about-tip summary .icon { flex: none; width: 18px; height: 18px; color: var(--muted); transition: transform 0.15s; }
.about-tip[open] summary .icon { transform: rotate(90deg); }
.about-tip p { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.about-text p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; }
.about-author { margin: 20px 0 8px; color: var(--subtle); font-size: 13px; line-height: 1.5; text-align: center; }

/* Политика конфиденциальности */
.legal { line-height: 1.55; font-size: 15px; }
.legal .page-title { margin-bottom: 4px; }
.legal h2 { margin: 22px 0 8px; font-size: 17px; }
.legal p { margin: 0 0 8px; }
.legal a { color: var(--accent); }
.legal-note { padding: 8px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-strong); font-size: 13px; }
.legal-consent { margin: 2px 0 0; line-height: 1.45; text-align: left; }
.legal-consent a, .law-note a { color: var(--accent); }
.about-text .link-btn { display: inline-block; margin-right: 8px; }
.legal-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.legal-actions .back-link { margin-bottom: 0; }
.print-btn { display: inline-flex; align-items: center; gap: 6px; }
.print-btn .icon { width: 16px; height: 16px; }

/* Печать и «Сохранить как PDF»: только текст документа — без меню, кнопок, фона и теней */
@media print {
  :root { color-scheme: light; }
  body { padding: 0; background: #fff; color: #000; }
  body::before, body::after, .topbar, .bottom-nav, .legal-actions, .award-toast, .toast,
  dialog, [data-overdue-dialog] { display: none !important; }
  .container { max-width: none; padding: 0; }
  .card, .legal { box-shadow: none; border-radius: 0; padding: 0; background: none; color: #000; }
  .legal { font-size: 11pt; line-height: 1.45; }
  .legal h2 { break-after: avoid; }
  .legal p { orphans: 3; widows: 3; }
  .legal a { color: #000; text-decoration: none; }
  .legal .hint { color: #444; }
}

/* Опрос: окно на главной, блок в «Моих данных», полоски в «Статистике приложения» */
.survey-dialog { text-align: left; }
.survey-dialog .confirm-title { text-align: center; }
.survey-intro { margin-bottom: 12px; line-height: 1.4; }
.survey-question { margin: 0 0 12px; padding: 0; border: none; }
.survey-question legend { margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.survey-dialog .btn-primary { margin-top: 10px; }
.survey-note { margin-top: 10px; line-height: 1.4; }
.survey-note a { color: var(--accent); }
.survey-card .survey-question:last-of-type { margin-bottom: 0; }
.survey-delete { margin: 6px 0 0; text-align: center; }
.survey-delete .link-btn { border: none; background: none; font: inherit; cursor: pointer; }
.survey-total { margin: 0 0 8px; }
.survey-stats { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.survey-stats h3 { margin: 0; font-size: 15px; }
.survey-bar { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; font-size: 14px; }
.survey-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.survey-track span { display: block; height: 100%; border-radius: 3px; background: var(--accent); }

/* Прошедший день: только просмотр (app/dates.py: task_day_open) */
.past-day-note { display: flex; gap: 8px; align-items: flex-start; margin: 0 0 12px; padding: 10px 12px;
  border-radius: 12px; background: var(--soft); color: var(--muted); font-size: 13px; line-height: 1.4; }
.past-day-note .icon { flex: none; width: 16px; height: 16px; margin-top: 1px; }
.check.is-locked { cursor: default; opacity: 0.75; }

/* Выбор времени (_time.html): часы : минуты (AM/PM) в формате из настроек */
.time-pick { display: inline-flex; align-items: center; gap: 3px; flex: none; }
.time-pick select {
  padding: 6px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.time-pick select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.time-pick-sep { color: var(--muted); font-weight: 600; }

/* Установка «Ритма»: кнопки видны, пока он не установлен (app.js ставит <html data-install>) */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.install-pill {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.install-pill .icon { width: 16px; height: 16px; }
.install-pill:hover { filter: brightness(0.97); }
.install-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button.install-row { display: none; width: 100%; border: none; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.install-button { display: none; align-items: center; justify-content: center; gap: 8px; margin: 0 0 12px; }
.install-installed { display: none; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; }
.install-installed .icon { width: 18px; height: 18px; }
:root[data-install="manual"] .install-pill, :root[data-install="ready"] .install-pill { display: inline-flex; }
:root[data-install="manual"] .install-row, :root[data-install="ready"] .install-row { display: flex; }
:root[data-install="manual"] .install-button, :root[data-install="ready"] .install-button { display: flex; }
:root[data-install="installed"] .install-installed { display: flex; }
:root[data-install="installed"] .install-howto { display: none; }
.about-install p { margin: 0 0 6px; line-height: 1.45; }
.about-install .install-howto p:last-child { margin-bottom: 0; }

/* Окно с инструкцией */
.install-dialog { text-align: left; }
.install-dialog .confirm-title, .install-dialog .confirm-text { text-align: center; }
.install-icon { display: grid; margin: 0 auto 10px; background: none; }
.install-icon img { width: 48px; height: 48px; border-radius: 12px; }
.install-steps { margin: 0 0 16px; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; line-height: 1.4; font-size: 14px; }

/* Запущен как приложение (с главного экрана): отступ под «чёлку» и полосу жестов */
@media (display-mode: standalone) {
  .topbar { padding-top: max(env(safe-area-inset-top), 0px); }
}
