/*
 * Трекер — стили. Neo-Swiss: плоско, без теней, градиентов и рамок.
 * Один акцент — красный, и значит он только «требует внимания сейчас»:
 * просрочено или задача №1 на сегодня. Красный по другой причине — баг.
 * Графики: текущее — сплошным чернилом, прошлое/будущее — штриховкой.
 *
 * Цвета — только токены из :root (страж валит сборку на сыром hex вне него),
 * скругления — только --r-*.
 */

:root {
  --bg: #DBD8D3;
  --bg-card: #E4DFDC;
  --bg-alt: #BBBAB5;
  --bg-olive: #B8B3AB;
  --bg-olive-card: #D2CDC6;
  --ink: #000000;
  --ink-muted: #918E8B;
  --accent: #E52928;
  --scrim: rgb(0 0 0 / 0.32);
  /* фон вечернего планирования и плашка вкладок: чёрная, под открытой — светлая пилюля */
  --screen-plan: var(--bg-alt);
  --nav-bg: var(--ink);
  --nav-on: var(--bg);
  --nav-on-ink: var(--ink);
  /* всплывающее — меню, тост, панель выбора: как плашка вкладок */
  --pop-bg: var(--nav-bg);
  --pop-ink: var(--bg);

  /* цвета сфер — оформление Colour (Settings → Style). Красного среди них нет:
     он значит «срочно». Текст и знаки на цвете — тёмные в обеих темах */
  --sph-olive: #8E8100;
  --sph-lavender: #958AA9;
  --sph-apricot: #ED9C55;
  --sph-mint: #C7DDC7;
  --sph-slate: #7A96AB;
  --sph-lilac: #D0C7E4;
  --sph-plum: #99728C;
  --sph-khaki: #DFD6A1;
  --on-sphere: #000000;
  /* текст на красном (метка «день полон») */
  --on-accent: #FFFFFF;
  /* зерно бумаги: тёмные крупинки; в тёмной теме — светлые */
  --grain: url('textures/grain.png');

  /* штриховка неактивного: крупная — для графиков, тонкая — для пустых мест дня */
  --hatch: repeating-linear-gradient(-45deg, var(--ink-muted) 0 2px, transparent 2px 7px);
  --hatch-fine: repeating-linear-gradient(-45deg, var(--ink-muted) 0 1px, transparent 1px 6px);
  --screen: var(--bg);
  /* точечное поле под графиками — как у чертежа */
  --dots: radial-gradient(circle, var(--ink-muted) 0.75px, transparent 1.1px) 0 0 / 10px 10px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --spring: cubic-bezier(0.3, 1.4, 0.5, 1);
  /* нажатие: вниз быстро, обратно мягко и с лёгким перелётом — как у iOS */
  --press: 0.95;
  --press-in: 0.1s;
  --release: 0.5s cubic-bezier(0.34, 1.3, 0.64, 1);
  /* шторка: выезд с долгим торможением, уход — с разгоном */
  --sheet-in: 0.5s cubic-bezier(0.32, 0.72, 0, 1);
  --sheet-out: 0.28s cubic-bezier(0.4, 0, 1, 1);

  --r-card: 22px;
  --r-sheet: 24px;
  --r-sm: 14px;
  --r-xs: 10px;
  --r-pill: 999px;

  --font: 'Geist', -apple-system, 'SF Pro Text', 'Helvetica Neue', Arial, sans-serif;
  --pad: 16px;
  --gap: 10px;
  --nav-h: 80px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* тёмная тема (Settings → Theme): те же роли, тёплый почти чёрный фон.
   Красный чуть светлее — на тёмном он иначе тонет. Плашка вкладок остаётся
   тёмной, светлеет только пилюля под открытой вкладкой */
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0E0E0D;
  --bg-card: #1D1C1B;
  --bg-alt: #2F2E2C;
  --bg-olive: #34312D;
  --bg-olive-card: #2B2926;
  --ink: #EEEBE6;
  --ink-muted: #8D8A85;
  --accent: #FF453A;
  --scrim: rgb(0 0 0 / 0.6);
  --screen-plan: #141311;
  --nav-bg: #262523;
  --nav-on: var(--ink);
  --nav-on-ink: var(--bg);
  --pop-ink: var(--ink);
  --on-accent: #000000;
  --grain: url('textures/grain-dark.png');
}

/* ── основа ─────────────────────────────────────────────────────────── */

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

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

/* у экрана свой фон: вечернее планирование — на сером, как второй экран референса */
body[data-screen='plan'] {
  --screen: var(--screen-plan);
}

body {
  position: relative;
  margin: 0;
  min-height: 100dvh;
  background: var(--screen);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  /* текст не выделяется и не зовёт «Скопировать» от случайного долгого
     нажатия — долгое нажатие здесь перетаскивает задачи. Поля ввода — ниже */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* в полях — как обычно: каретка, выделение, вставка */
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* экран не увеличивается ни двойным тапом, ни щипком: быстрые тапы по −/+
   и случайное касание двумя пальцами — это ввод, а не жест. Прокрутка есть */
*,
*::before,
*::after {
  touch-action: pan-x pan-y;
}

/*
 * Бумажное зерно — часть страницы, а не стекло поверх экрана: едет вместе с
 * содержимым при прокрутке. Крупинки полупрозрачные: тёмная делает цвет под
 * собой темнее того же тона. Лежит под плашкой вкладок и шторками — у них
 * своё зерно, оно стоит вместе с ними. Касания проходят насквозь.
 * Наложение обычное: soft-light пробовали — снимок для перехода между
 * экранами готовился в 3–7 раз дольше.
 */
body::after,
.tabs::after,
.sheet::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--grain) 0 0 / 256px 256px;
}

body::after {
  z-index: 9;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  text-align: inherit;
}

a,
.task-main,
.fold-head {
  transition: opacity 0.35s ease;
}

a:active,
.task-main:active,
.fold-head:active {
  opacity: 0.6;
  transition-duration: var(--press-in);
}

.pill,
.chip,
.icon-btn,
.check,
.pick,
.replace,
.glyph-pick,
.compose-chip,
.compose-send,
.quick-pick,
.bump {
  transition: transform var(--release), background-color 0.25s ease, color 0.25s ease;
}

.pill:active,
.icon-btn:active,
.check:active,
.pick:active,
.replace:active,
.glyph-pick:active,
.add .chip:active,
.compose-chip:active,
.compose-send:active,
.quick-pick:active,
.bump:active {
  transform: scale(var(--press));
  transition: transform var(--press-in) var(--ease), background-color 0.25s ease, color 0.25s ease;
}

a {
  color: inherit;
}

/* свои поля без системных отступов: у iPhone они крупнее, чем у Chrome, и
   съедали место под текст там, где ширина поля — по тексту */
input,
textarea {
  padding: 0;
  border: 0;
  background: transparent;
  outline: none;
  min-width: 0;
  border-radius: 0;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-muted);
  opacity: 1;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

input:focus-visible,
textarea:focus-visible {
  outline: none;
}

[hidden] {
  display: none !important;
}

.offscreen {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.icon {
  display: block;
  flex: none;
}

.glyph {
  width: 12px;
  height: 12px;
  flex: none;
}

.main {
  max-width: 560px;
  margin: 0 auto;
  padding:
    calc(var(--safe-top) + 12px)
    max(var(--pad), env(safe-area-inset-right, 0px))
    calc(var(--nav-h) + var(--safe-bottom) + 32px)
    max(var(--pad), env(safe-area-inset-left, 0px));
}

/* ── шапка ──────────────────────────────────────────────────────────── */

.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 22px;
}

/* заголовок в две строки одного кегля: название и приглушённое пояснение */
.title {
  margin: 0;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.02;
}

.title-main,
.title-sub {
  display: block;
}

.title-sub {
  color: var(--ink-muted);
}

.title-sub:empty {
  display: none;
}

.title-glyph {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  line-height: 36px;
}

.title-glyph .glyph {
  width: 24px;
  height: 24px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: -6px;
  margin-right: -10px;
}

/* шапка настроек не уезжает при прокрутке: название и крестик всегда на месте.
   Верхний отступ экрана переезжает в неё — под ней не видно уехавшего текста.
   Над зерном страницы, со своим зерном: иначе оно ехало бы по стоящей шапке */
.screen-settings > .head {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: calc(-1 * (var(--safe-top) + 12px)) calc(-1 * var(--pad)) 12px;
  padding: calc(var(--safe-top) + 22px) var(--pad) 10px;
  background: var(--screen);
}

.screen-settings > .head::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--grain) 0 0 / 256px 256px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 44px;
  margin-left: -8px;
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: var(--r-pill);
  color: var(--ink);
  text-decoration: none;
}

.chip {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--bg-alt);
  color: var(--ink);
}

/* мелкая подпись секции: название чернилами, число приглушённо */
.label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 10px 4px;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
}

.label .glyph {
  width: 11px;
  height: 11px;
}

/* крупные числа — обычным весом, хвост приглушённо и мельче */
.hint {
  margin: 14px 4px;
  font-size: 15px;
  color: var(--ink-muted);
}

.hint a {
  color: var(--ink);
  font-weight: 600;
}

.count {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

/* ── поле «добавить» ────────────────────────────────────────────────── */

.add {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 20px 0 12px;
  margin-bottom: 16px;
  background: var(--bg-card);
  border-radius: var(--r-pill);
}

.add-input {
  flex: 1;
  height: 100%;
  font-size: 19px;
  font-weight: 500;
}

.entry {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 16px;
  margin-top: var(--gap);
}

.entry .icon {
  color: var(--ink-muted);
}

.entry-input {
  flex: 1;
  height: 48px;
  font-size: 17px;
  font-weight: 600;
}

/* стрелка «добавить»: видна, когда в поле есть текст — Enter не обязателен */
.entry-send {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  margin-right: -6px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--bg);
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  transition: opacity 0.2s ease, transform var(--release);
}

.entry.has-text .entry-send {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.entry.has-text .entry-send:active {
  transform: scale(var(--press));
  transition: transform var(--press-in) var(--ease);
}

.entry-sm .entry-send {
  width: 30px;
  height: 30px;
  margin-right: 0;
}

.entry-card {
  background: var(--bg-card);
  border-radius: var(--r-card);
  margin: 0 0 12px;
}

.screen-goals > .entry {
  background: var(--bg-card);
  border-radius: var(--r-card);
}

.entry-sm {
  min-height: 40px;
  padding: 0;
  margin-top: 2px;
}

.entry-sm .entry-input {
  height: 40px;
  font-size: 16px;
  font-weight: 500;
}

/* ── задачи ─────────────────────────────────────────────────────────── */

.tasks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--gap);
}

.tasks + .tasks {
  margin-top: var(--gap);
}

.task {
  background: var(--bg-card);
  border-radius: var(--r-card);
  transition: transform 0.16s ease;
}

.task.is-dragging {
  position: relative;
  z-index: 2;
  background: var(--bg-olive-card);
  transition: none;
}

/* строка, которую можно смахнуть: фон — у сдвигаемого слоя, под ним Delete */
.task[data-swipe] {
  background: none;
}

.task[data-swipe] > .swipe-body {
  background: var(--bg-card);
  border-radius: var(--r-card);
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1), background-color 0.25s ease;
}

.task[data-swipe].is-dragging > .swipe-body {
  background: var(--bg-olive-card);
}

/* только что добавленная: проявляется и на миг подсвечивается */
.task.is-new {
  animation: task-new 0.5s var(--ease) both;
}

.task.is-new > .swipe-body {
  animation: task-glow 1.5s ease both;
}

@keyframes task-new {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.97);
  }
}

@keyframes task-glow {
  0%,
  35% {
    background: var(--bg-olive-card);
  }
}

/* долгое нажатие подняло строку: она чуть больше и тянется за пальцем */
.task.is-held {
  transform: scale(1.02);
}

/* в списке дня долгое нажатие — это перетаскивание, а не выделение текста */
.day-list .task-row {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  min-height: 62px;
}

.task-num {
  width: 26px;
  flex: none;
  margin-top: -3px;
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
}

.task-num[data-drag] {
  touch-action: none;
  cursor: grab;
}

.task-num.is-accent {
  color: var(--accent);
}

.check {
  width: 28px;
  height: 28px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--bg-alt);
  color: transparent;
}

.check.is-on {
  background: var(--ink);
  color: var(--bg);
}

.check-sm {
  width: 24px;
  height: 24px;
}

.task-main {
  flex: 1;
  min-width: 0;
  padding-top: 3px;
  display: block;
}

.task-title {
  display: block;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  margin-top: 4px;
  font-size: 14px;
  font-weight: 500;
  /* строки, где значок стоит у подписи, — целой высоты: дробную (1.3 × 14)
     браузер округляет по-разному в разных местах экрана, и подпись съезжает
     на пиксель от значка. У Geist середина заглавных — ровно середина строки */
  line-height: 18px;
  color: var(--ink-muted);
}

.meta-sphere {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--ink);
}

.meta-sphere .glyph {
  width: 10px;
  height: 10px;
}

.is-late {
  color: var(--accent);
  font-weight: 600;
}

.task.is-done .task-title,
.task.is-paused .task-title {
  color: var(--ink-muted);
}

.task.is-done .task-title {
  text-decoration: line-through;
}

.slot-empty {
  display: flex;
  align-items: center;
  height: 62px;
  padding: 0 14px;
  border-radius: var(--r-card);
  background: var(--hatch-fine);
  color: var(--ink-muted);
}

.tasks-compact .task-row {
  min-height: 0;
  padding: 12px 14px;
}

.tasks-compact .task-title {
  font-size: 16px;
}

.done-list {
  margin-top: var(--gap);
}

/* ── карточка задачи ────────────────────────────────────────────────── */

.card-edit {
  display: grid;
  gap: 14px;
  padding: 2px 16px 16px;
}

.edit-title {
  flex: 1;
  min-width: 0;
  resize: none;
  padding: 3px 0 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
}

.task-close {
  margin: -8px -10px -8px 0;
}

.edit-note {
  width: 100%;
  min-height: 48px;
  resize: none;
  padding: 12px 14px;
  font-size: 16px;
  line-height: 1.35;
  background: var(--bg);
  border-radius: var(--r-sm);
}

.field {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.field-label {
  padding-top: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

.field-body {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.field-body > .subs,
.field-body > .entry {
  flex-basis: 100%;
  min-width: 0;
}

/* у полей ввода есть собственная ширина, и flex: 1 её не отменяет —
   без width: 0 строка распирает карточку за край узкого экрана */
.entry-input,
.sub-title,
.step-title,
.add-input,
.edit-title,
.compose-input,
.search-input {
  width: 0;
}

/* колонка сетки не шире экрана, что бы ни лежало внутри */
.tasks,
.picks,
.replace-list,
.goal-list,
.lines,
.subs,
.steps,
.stack,
.card-edit,
.brief-goals {
  grid-template-columns: minmax(0, 1fr);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pills-scroll {
  overflow-x: auto;
  scrollbar-width: none;
  margin-right: -16px;
  padding-right: 16px;
  min-width: 0;
  flex: 1;
}

.pills-scroll::-webkit-scrollbar {
  display: none;
}

.pills-scroll .pills {
  flex-wrap: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  background: var(--bg);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
}

.pill.is-on {
  background: var(--ink);
  color: var(--bg);
}

.pill-action {
  height: 52px;
  padding: 0 22px;
  gap: 10px;
  font-size: 16px;
  background: var(--bg-card);
}

.pill-action.has-chip {
  padding-left: 8px;
}

.pill-action.is-on .chip {
  background: var(--bg);
}

.pill-wide {
  width: 100%;
  justify-content: center;
}

.date-wrap {
  position: relative;
  display: inline-flex;
}

.date-wrap .pill {
  pointer-events: none;
}

.date {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-appearance: none;
  appearance: none;
  color: transparent;
  background: transparent;
  opacity: 0.011;
  font-size: 16px;
  cursor: pointer;
}

.subs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.sub {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.sub-title {
  flex: 1;
  height: 40px;
  font-size: 16px;
}

.sub.is-done .sub-title {
  color: var(--ink-muted);
  text-decoration: line-through;
}

.sub .icon-btn,
.step .icon-btn {
  width: 36px;
  height: 36px;
  color: var(--ink-muted);
}

.card-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.card-foot .pill:not(.is-on) {
  background: var(--bg);
}

/* ── блоки ──────────────────────────────────────────────────────────── */

.block {
  margin-top: 28px;
}

.block-alt {
  padding: 14px 12px 12px;
  background: var(--bg-alt);
  border-radius: var(--r-card);
}

.block-text {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.4;
}

.stack {
  display: grid;
  gap: 8px;
}

.stack .pill:not(.is-on) {
  background: var(--bg-card);
}

.version,
.credit {
  margin: 24px 4px 0;
  font-size: 13px;
  color: var(--ink-muted);
}

.credit {
  margin-top: 6px;
}

.fold {
  margin-top: 16px;
}

.fold-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  padding: 0 4px;
  font-size: 17px;
  font-weight: 700;
}

.fold-head .icon {
  margin-left: auto;
  transition: transform 0.16s ease;
}

.fold.is-open .fold-head .icon {
  transform: rotate(90deg);
}

/* ── планирование ───────────────────────────────────────────────────── */

.plan-group {
  margin-top: 26px;
}

.picks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--gap);
}

.pick {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 14px 16px 14px 14px;
  background: var(--bg-card);
  border-radius: var(--r-card);
}

.pick-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--bg-alt);
  font-size: 15px;
  font-weight: 700;
}

.pick.is-on .pick-mark {
  background: var(--ink);
  color: var(--bg);
}

.pick-text {
  flex: 1;
  min-width: 0;
  padding-top: 3px;
}

.slot .task-main {
  padding-top: 6px;
}

.slot .icon-btn {
  margin: -8px -10px -8px 0;
}

/* ── цели ───────────────────────────────────────────────────────────── */

.goal-list {
  display: grid;
  gap: 10px;
}

.goal {
  padding: 16px 18px 8px;
  background: var(--bg-olive-card);
  border-radius: var(--r-card);
}

.goal-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.goal-title {
  flex: 1;
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
}

.goal-head .icon-btn {
  margin: -6px -10px 0 0;
}

.goal-progress {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 12px;
}

.fraction {
  font-size: 44px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--ink-muted);
}

.meter {
  flex: 1;
  height: 16px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--hatch);
}

.meter-done {
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--ink);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.step-title {
  flex: 1;
  height: 40px;
  font-size: 16px;
  font-weight: 500;
}

.step.is-done .step-title {
  color: var(--ink-muted);
  text-decoration: line-through;
}

.screen-goals > .entry {
  margin-top: 10px;
}

/* ── бриф ───────────────────────────────────────────────────────────── */

.lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
}

.line .glyph {
  align-self: center;
  width: 11px;
  height: 11px;
}

.line-num {
  width: 18px;
  flex: none;
  font-weight: 600;
}

.line-title {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.line-due {
  flex: none;
  font-size: 14px;
}

.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.week-col {
  display: grid;
  grid-template-rows: 20px 120px auto auto;
  justify-items: center;
  gap: 4px;
}

.week-count {
  font-size: 15px;
  font-weight: 600;
}

.week-track {
  display: flex;
  align-items: flex-end;
  width: 100%;
  height: 120px;
}

/* столбики — пилюли: сегодня сплошным, остальные дни штриховкой */
.week-bar {
  width: 100%;
  height: calc(var(--h) * 100%);
  min-height: 28px;
  border-radius: var(--r-pill);
  background: var(--hatch);
}

.week-bar.is-now {
  background: var(--ink);
}

.week-bar.is-zero {
  min-height: 6px;
  height: 6px;
  background: var(--ink-muted);
}

.week-bar.is-now.is-zero {
  background: var(--ink);
}

.week-day {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
}

.week-date {
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
}

.week-list {
  margin: 16px 0 0;
}

.week-list dt {
  font-size: 14px;
  font-weight: 700;
}

.week-list dd {
  margin: 2px 0 10px;
  font-size: 15px;
  color: var(--ink);
}

.brief-goals {
  display: grid;
  gap: 18px;
}

.brief-goal-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.brief-goal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}

.brief-goal-head .fraction {
  font-size: 30px;
}

.brief-steps {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 15px;
}

.brief-steps .is-done {
  color: var(--ink-muted);
  text-decoration: line-through;
}

/* ── нижняя панель ──────────────────────────────────────────────────── */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 0 12px calc(10px + var(--safe-bottom));
  pointer-events: none;
}

/*
 * Чёрная плавающая плашка: пять вкладок, у каждой иконка и подпись.
 * Светлая пилюля под открытой вкладкой переезжает с пружинкой.
 */
.tabs {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: 340px;
  height: 70px;
  margin: 0 auto;
  padding: 6px;
  background: var(--nav-bg);
  border-radius: var(--r-pill);
  pointer-events: auto;
}

.tabs::after {
  z-index: 2;
  border-radius: inherit;
}

.tab-indicator {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc((100% - 12px) / 3);
  border-radius: var(--r-pill);
  background: var(--nav-on);
  transform: translateX(calc(var(--at, 0) * 100%));
  transition: transform 0.5s var(--spring), opacity 0.2s ease;
}

.tabs.is-idle .tab-indicator {
  opacity: 0;
}

.tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.25s ease;
}

.tab.is-on {
  color: var(--nav-on-ink);
}

.tab-icon {
  position: relative;
  display: grid;
  place-items: center;
  transition: transform var(--release);
}

.tab.is-on .tab-icon {
  animation: tab-pop 0.5s var(--spring);
}

.tab:active .tab-icon {
  transform: scale(0.88);
  transition: transform var(--press-in) var(--ease);
}

.tab-dot {
  position: absolute;
  top: -1px;
  right: -3px;
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--accent);
  /* вырез вокруг точки — цветом плашки, не тенью */
  outline: 2px solid var(--nav-bg);
}

.tab.is-on .tab-dot {
  outline-color: var(--nav-on);
}

.tab-label {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

/* узкий экран (iPhone SE): «Overview» не упирается в край панели */
@media (max-width: 350px) {
  .tab-label {
    font-size: 10px;
    letter-spacing: -0.01em;
  }
}

@keyframes tab-pop {
  0% { transform: scale(0.8) translateY(2px); }
  100% { transform: none; }
}

/* ── шторка и тост ──────────────────────────────────────────────────── */

/* слой — по видимой части экрана: с клавиатурой iOS шторка стоит над ней */
.sheet-layer {
  position: fixed;
  left: 0;
  right: 0;
  top: var(--vv-top, 0px);
  height: var(--vv-h, 100%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.sheet-scrim {
  position: absolute;
  /* с запасом за края: слой держится видимой части экрана и может на миг
     отстать от неё — страница по краям всё равно под затемнением */
  inset: -50vh 0;
  background: var(--scrim);
  touch-action: none;
}

/* под открытой шторкой страница не пружинит */
html:has(.sheet-layer:not([hidden])) {
  overscroll-behavior: none;
}

.sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 560px;
  max-height: min(85dvh, calc(var(--vv-h, 100dvh) - 16px));
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  animation: sheet-in var(--sheet-in) both;
}

/* рамка шторки стоит (и её зерно), прокручивается содержимое */
.sheet-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 22px var(--pad) calc(16px + var(--safe-bottom));
}

.sheet::after {
  z-index: 3;
}

/* выезжает целиком снизу; внутри тапы меняют только содержимое */
@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

/* одна шторка сменила другую (Дата → Календарь): содержимое проявляется */
.sheet.is-swapping > .sheet-body > * {
  animation: rise 0.36s var(--ease) both;
}

.sheet-layer.is-closing {
  pointer-events: none;
}

.sheet-layer.is-closing .sheet {
  animation: sheet-out var(--sheet-out) both;
}

.sheet-layer.is-closing .sheet-scrim {
  animation: fade-out var(--sheet-out) both;
}

@keyframes sheet-out {
  to {
    transform: translateY(100%);
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

.sheet-title {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.sheet-text {
  margin: 0;
  font-size: 16px;
}

.sheet-list {
  list-style: none;
  margin: 12px 0 20px;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 16px;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sheet-head .glyph {
  width: 22px;
  height: 22px;
}

.sheet-input {
  flex: 1;
  width: 100%;
  padding: 6px 0;
  font-size: 28px;
  font-weight: 700;
}

.glyph-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.glyph-pick {
  display: grid;
  place-items: center;
  height: 64px;
  background: var(--bg-card);
  border-radius: var(--r-card);
}

.glyph-pick .glyph {
  width: 22px;
  height: 22px;
}

.glyph-pick.is-on {
  background: var(--ink);
  color: var(--bg);
}

.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.sheet-actions .pill {
  flex: 1;
  justify-content: center;
}

/* удалить сферу — отдельной строкой под Archive/Done: второй тап объясняет, что будет с задачами */
.sphere-delete {
  height: auto;
  min-height: 44px;
  margin-top: 8px;
  padding-block: 10px;
  white-space: normal;
  text-align: center;
}

.sheet-actions .pill:not(.is-on) {
  background: var(--bg-card);
}

.sheet .pill-wide:not(.is-on) {
  background: var(--bg-card);
}

/* день полон: день и красная метка, ниже — чему нужно место */
.full-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.full-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 700;
  line-height: 26px;
  letter-spacing: 0.02em;
}

.full-for {
  display: grid;
  gap: 4px;
  margin: 14px 0 0;
}

.full-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 16px;
  color: var(--ink-muted);
}

.full-task {
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
  overflow-wrap: anywhere;
}

.replace > .icon {
  flex: none;
}

.replace-list {
  list-style: none;
  margin: 16px 0;
  padding: 0;
  display: grid;
  gap: var(--gap);
}

.replace {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--r-card);
}

.replace-num {
  width: 22px;
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
}

.replace-title {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
  line-height: 22px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 18px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: min(420px, calc(100% - 32px));
  min-height: 48px;
  padding: 10px 20px;
  background: var(--pop-bg);
  color: var(--pop-ink);
  border-radius: var(--r-sheet);
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  text-wrap: pretty;
  transform: translate(-50%, 14px) scale(0.94);
  opacity: 0;
  pointer-events: none;
  /* уходит быстро и тихо */
  transition: opacity 0.2s ease, transform 0.25s ease;
}

.toast.is-done {
  padding-left: 10px;
}

/* появляется с пружинкой снизу; галочка в кружке вписывается следом */
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
  transition: opacity 0.2s ease, transform 0.5s cubic-bezier(0.34, 1.45, 0.64, 1);
}

.toast-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  background: var(--pop-ink);
  color: var(--pop-bg);
}

.toast-mark .icon path {
  stroke-width: 2;
}

.toast.is-on .toast-mark {
  animation: toast-mark 0.5s cubic-bezier(0.34, 1.6, 0.64, 1) 0.08s both;
}

@keyframes toast-mark {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}

/* пока открыта шторка или панель выбора, тост — сверху, чтобы ничего не
   закрывать. Уходящая шторка уже не в счёт: иначе тост после «заменить»
   появлялся сверху и через миг прыгал вниз */
body:has(.sheet-layer:not([hidden]):not(.is-closing)) .toast,
body:has(.select-bar) .toast {
  top: calc(var(--safe-top) + 12px);
  bottom: auto;
}

/* ── поле графика и композиция дня ─────────────────────────────────── */

.plot {
  position: relative;
  margin: 0 0 14px;
  padding: 16px;
  background: var(--dots);
}

/* уголки-метки, как на чертеже */
.mark {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 0 solid var(--ink);
}

.mark-tl { top: 0; left: 0; border-top-width: 1.5px; border-left-width: 1.5px; }
.mark-tr { top: 0; right: 0; border-top-width: 1.5px; border-right-width: 1.5px; }
.mark-bl { bottom: 0; left: 0; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.mark-br { bottom: 0; right: 0; border-bottom-width: 1.5px; border-right-width: 1.5px; }

.day-chart {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: 172px;
}

.shape {
  flex: 1 1 0;
  max-width: 62px;
  height: calc(var(--h) * 100%);
  border-radius: var(--r-pill);
  background: var(--ink);
  transition: height 0.5s var(--ease), max-width 0.5s var(--ease);
}

.day-chart .shape {
  cursor: pointer;
}

/* тап по пилюле дня — её строка в списке на миг подсвечивается */
.task.is-ping > .swipe-body,
.task.is-ping:not([data-swipe]) {
  animation: task-glow 1.2s ease both;
}

.shape.is-first {
  background: var(--accent);
}

.shape.is-done {
  background: var(--hatch);
}

.shape.is-empty {
  flex: 0 1 40px;
  height: auto;
  aspect-ratio: 1;
  background: var(--hatch-fine);
}

.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 4px 18px;
}

.stat-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
}

.stat-value {
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* ── плитки ─────────────────────────────────────────────────────────── */

.tiles,
.bento {
  position: relative; /* плитки меряют себя от сетки — для перетаскивания */
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.bento {
  margin: 4px 0 12px;
}

.tile {
  position: relative;
  min-width: 0;
  padding: 14px 16px 16px;
  background: var(--bg-card);
  border-radius: var(--r-card);
}

.tile-wide {
  grid-column: 1 / -1;
}

.tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
  margin-bottom: 10px;
}

.tile-label {
  font-size: 14px;
  font-weight: 600;
}

.tile-link {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: -6px -8px -6px 0;
  color: var(--ink-muted);
}

.big {
  margin: 0 0 12px;
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.big .muted {
  margin-left: 2px;
  font-size: 17px;
}

.big.is-late {
  color: var(--accent);
}

.tile .hint {
  margin: 0;
}

.lines-sm {
  gap: 6px;
}

.lines-sm .line {
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
}

.lines-sm .line-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill-export {
  margin-top: 4px;
}

/* плитка сферы: глиф и «⋯» сверху, название и число снизу; ссылка — под всей плиткой */
.sphere-tile {
  display: flex;
  flex-direction: column;
  min-height: 152px;
}

.tile-cover {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
}

.sphere-tile > .chip,
.sphere-tile > .tile-name,
.sphere-tile > .tile-count {
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.sphere-tile .chip {
  background: var(--bg);
}

.sphere-tile .chip .glyph {
  width: 14px;
  height: 14px;
}

.sphere-tile .tile-more,
.sphere-tile .drag {
  position: absolute;
  z-index: 2;
}

.sphere-tile .tile-more {
  top: 6px;
  right: 6px;
}

.sphere-tile .drag {
  right: 6px;
  bottom: 8px;
  width: 36px;
  height: 36px;
}

.tile-name {
  margin-top: auto;
  padding-top: 14px;
  padding-right: 32px;
  font-size: 15px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-count {
  font-size: 48px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.tile-count.is-zero {
  color: var(--ink-muted);
}

.sphere-tile.is-dragging {
  z-index: 5;
  background: var(--bg-olive-card);
  transition: none;
}

.sphere-tile.is-archived .tile-name {
  color: var(--ink-muted);
}

.drag {
  display: grid;
  place-items: center;
  color: var(--ink-muted);
  touch-action: none;
  cursor: grab;
}

.fold .tiles {
  margin-bottom: 8px;
}

/* ── поле новой задачи ──────────────────────────────────────────────── */

/* название сверху, под ним чипы — сфера, дата, приоритет — и круглая «добавить» */
.compose {
  position: relative;
  margin-bottom: 16px;
  padding: 6px 8px 8px;
  background: var(--bg-card);
  border-radius: var(--r-card);
}

.compose-input {
  display: block;
  width: 100%;
  height: 50px;
  padding: 0 10px;
  font-size: 19px;
  font-weight: 500;
}

.compose-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* приоритет прямо в поле: четыре уровня, столбики — как сигнал */
.prio-pick {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
}

.prio-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  height: 50px;
  border-radius: var(--r-sm);
  background: var(--bg);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  transition: transform var(--release), background-color 0.25s ease, color 0.25s ease;
}

.prio-opt:active {
  transform: scale(var(--press));
  transition: transform var(--press-in) var(--ease), background-color 0.25s ease, color 0.25s ease;
}

.prio-opt.is-on {
  background: var(--ink);
  color: var(--bg);
}

.compose-chips {
  display: flex;
  gap: 6px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.compose-chips::-webkit-scrollbar {
  display: none;
}

.compose-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 36px;
  padding: 0 12px 0 9px;
  border-radius: var(--r-pill);
  background: var(--bg);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}

/* только иконка (флажок без приоритета) — поля поровну, иначе она уезжает влево */
.compose-chip:has(> svg:only-child) {
  justify-content: center;
  width: 44px;
  padding: 0;
}

.compose-chip .glyph {
  width: 11px;
  height: 11px;
  margin: 0 2px 0 3px;
}

.compose-chip.is-on {
  background: var(--ink);
  color: var(--bg);
}

.compose-send {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--bg-alt);
  color: var(--ink-muted);
}

.compose-send.is-ready {
  background: var(--ink);
  color: var(--bg);
}

/* ── меню ───────────────────────────────────────────────────────────── */

/* как панель вкладок (чёрное; в тёмной теме — её серое): на карточках видно без тени */
.menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 230px;
  max-width: calc(100% - 16px);
  max-height: 52dvh;
  overflow: auto;
  padding: 6px;
  background: var(--pop-bg);
  color: var(--pop-ink);
  border-radius: var(--r-card);
  /* раскрывается из кнопки: растёт от её угла с лёгкой пружиной, пункты —
     лесенкой следом. Над полем (is-up) — растёт вверх */
  transform-origin: 24px 0;
  animation: menu-in 0.34s cubic-bezier(0.2, 0.9, 0.3, 1.08) both;
}

.menu-item {
  animation: menu-item-in 0.32s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 22ms + 40ms);
}

.menu.is-closing {
  pointer-events: none;
  animation: menu-out 0.16s ease-in both;
}

@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.9);
  }
}

@keyframes menu-item-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
}

@keyframes menu-out {
  to {
    opacity: 0;
    transform: scale(0.96);
  }
}

.menu.is-up {
  top: auto;
  bottom: calc(100% + 6px);
  transform-origin: 24px 100%;
}

.menu.is-up .menu-item {
  animation-name: menu-item-up;
}

@keyframes menu-item-up {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* место под глиф есть у каждого пункта — подписи в одну линию */
.menu-mark {
  display: grid;
  place-items: center;
  width: 20px;
  flex: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  padding: 0 14px 0 8px;
  border-radius: var(--r-sm);
  font-size: 17px;
  line-height: 22px;
  font-weight: 600;
}

.menu-item {
  transition: background-color 0.3s ease;
}

.menu-item:active {
  background: var(--ink-muted);
  transition-duration: var(--press-in);
}

.menu-check {
  display: grid;
  place-items: center;
  width: 20px;
  flex: none;
}

.menu-item .glyph {
  width: 12px;
  height: 12px;
}

/* ── шторка даты ────────────────────────────────────────────────────── */

.sheet-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin: -6px 0 18px;
}

.sheet-bar .pill-action {
  height: 44px;
  padding: 0 18px;
  justify-self: start;
}

.sheet-bar .pill-action.is-on {
  justify-self: end;
}

.sheet-bar-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 12px;
}

.quick-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 14px 4px 12px;
  background: var(--bg-card);
  border-radius: var(--r-card);
}

.quick-pick .icon {
  margin-bottom: 4px;
}

.quick-label {
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.quick-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-muted);
}

.quick-pick.is-on {
  background: var(--ink);
  color: var(--bg);
}

.quick-pick.is-on .quick-sub {
  color: var(--bg-alt);
}

.rows {
  padding: 4px 0;
  background: var(--bg-card);
  border-radius: var(--r-card);
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 12px 0 16px;
}

.row-label {
  flex: 1;
  font-size: 17px;
  font-weight: 600;
}

.row.is-off .row-label,
.row.is-off > .icon {
  color: var(--ink-muted);
}

.switch {
  position: relative;
  width: 52px;
  height: 32px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--bg-alt);
  transition: background-color 0.25s ease;
}

.switch-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: var(--r-pill);
  background: var(--bg-card);
  transition: transform 0.3s var(--spring);
}

.switch.is-on {
  background: var(--ink);
}

.switch.is-on .switch-knob {
  transform: translateX(20px);
  background: var(--bg);
}

.switch:disabled {
  opacity: 0.4;
}

.sheet-note.is-appearing {
  animation: note-in 0.44s cubic-bezier(0.32, 0.72, 0, 1) 0.08s both;
}

@keyframes note-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.sheet-note {
  margin: 12px 4px 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.sheet-strong {
  margin-top: 4px;
  font-weight: 600;
}

.sheet-setting {
  margin: 18px 0 16px;
}

.sheet-hint {
  margin: 12px 4px 14px;
}

.row .pill:disabled {
  opacity: 0.4;
}

.sheet-options {
  display: grid;
  gap: var(--gap);
  margin: 16px 0;
}

.sheet-options .glyph {
  width: 14px;
  height: 14px;
}

/* ── вложения ───────────────────────────────────────────────────────── */

.files {
  list-style: none;
  flex-basis: 100%;
  min-width: 0;
  margin: 0 0 2px;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}

.file {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 5px 12px 5px 5px;
  background: var(--bg);
  border-radius: var(--r-sm);
}

.file-thumb {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  object-fit: cover;
  border-radius: var(--r-xs);
  background: var(--bg-alt);
}

.file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
}

.file-size {
  flex: none;
  font-size: 13px;
  color: var(--ink-muted);
}

.sheet-file-name {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.preview-img,
.preview-file {
  display: block;
  width: 100%;
  margin: 14px 0 8px;
  border-radius: var(--r-card);
  background: var(--bg-card);
}

.preview-img {
  max-height: 52dvh;
  object-fit: contain;
}

.preview-file {
  display: grid;
  place-items: center;
  height: 150px;
}

.preview-file .icon {
  width: 56px;
  height: 56px;
}

.sheet-actions a.pill {
  justify-content: center;
}

/* ── выбор нескольких ───────────────────────────────────────────────── */

.task.is-selectable .task-row {
  width: 100%;
  text-align: left;
}

.task.is-selected {
  background: var(--bg-olive-card);
}

.select-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: var(--r-pill);
  background: var(--bg-alt);
}

.select-mark.is-on {
  background: var(--ink);
  color: var(--bg);
}

.screen.is-selecting {
  padding-bottom: 150px;
}

/* панель над вкладками: число выбранных и что с ними сделать */
.select-bar {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 88px);
  z-index: 12;
  width: min(440px, calc(100% - 24px));
  padding: 10px 10px 8px;
  background: var(--pop-bg);
  color: var(--pop-ink);
  border-radius: var(--r-card);
  transform: translateX(-50%);
  animation: rise 0.22s var(--ease) both;
}

.select-bar-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  margin-bottom: 6px;
}

.select-count {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
}

.select-bar .pill {
  height: 32px;
  background: transparent;
  color: var(--pop-ink);
}

.select-bar .pill.is-on {
  background: var(--pop-ink);
  color: var(--pop-bg);
}

/* действия — сеткой в две строки: все видны сразу */
.select-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
}

.bar-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  height: 54px;
  border-radius: var(--r-sm);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.bar-btn {
  transition: background-color 0.3s ease;
}

.bar-btn:active {
  background: var(--ink-muted);
  transition-duration: var(--press-in);
}

.bar-btn:disabled {
  opacity: 0.35;
}

/* второй тап «удалить» — светлая пилюля, не красная: красный только для срочного */
.bar-btn.is-on {
  background: var(--pop-ink);
  color: var(--pop-bg);
}

.head-pill {
  height: 36px;
  background: var(--bg-card);
}

/* ── поиск ──────────────────────────────────────────────────────────── */

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 4px 0 16px;
  margin-bottom: 12px;
  background: var(--bg-card);
  border-radius: var(--r-pill);
  color: var(--ink-muted);
}

.search-input {
  flex: 1;
  height: 100%;
  color: var(--ink);
  font-size: 17px;
  font-weight: 500;
  -webkit-appearance: none;
  appearance: none;
}

.search-input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  width: 40px;
  height: 40px;
}

/* «Новая сфера» — плитка во всю ширину в той же сетке: зазор как у соседей */
.tile-new {
  padding: 0;
}

.tile-new .entry {
  margin: 0;
  min-height: 56px;
}

/* ── подписи, планирование, цели, настройки ─────────────────────────── */

.meta-when {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.meta-when .icon {
  width: 14px;
  height: 14px;
}

.meta-when .icon path {
  stroke-width: 2;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.block-head .label {
  margin-bottom: 0;
}

.pill-action.pill-sm {
  height: 34px;
  padding: 0 14px;
  font-size: 13px;
}

.hint-top {
  margin: 18px 4px 0;
  font-size: 14px;
}

.pick-row {
  position: relative;
}

.pick-row .pick {
  padding-right: 52px;
}

.pick-date {
  position: absolute;
  top: 6px;
  right: 4px;
  color: var(--ink-muted);
}

/* смахивание влево: строка уезжает, под ней — чёрная «Delete».
   Вертикаль остаётся странице, горизонталь — строке */
[data-swipe] {
  position: relative;
  touch-action: pan-y;
}

.swipe-body {
  position: relative;
  transition: transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

.swipe-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 82px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-card);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  opacity: var(--reveal, 0);
  transform: scale(calc(0.6 + 0.4 * var(--reveal, 0)));
  transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.32, 0.72, 0, 1);
}

.is-swiping .swipe-body,
.is-swiping .swipe-action {
  transition: none;
}

/* палец ведёт строку — кнопка под ним не проседает */
.is-swiping .pick:active,
.is-swiping .check:active {
  transform: none;
}

[data-swipe].is-removing {
  overflow: hidden;
  margin-bottom: calc(-1 * var(--gap));
  opacity: 0;
  transition: height 0.28s var(--ease), margin 0.28s var(--ease), opacity 0.2s ease;
}

.is-removing .swipe-body {
  transform: translateX(-40%);
  transition: transform 0.28s var(--ease);
}

.goal-progress.is-value {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.goal-progress.is-value .meter {
  flex: none;
}

/* длинное число (4 000/29 999 €) на узком экране — мельче, но в строку */
.goal-progress.is-long .fraction {
  font-size: min(44px, 10.5vw);
  white-space: nowrap;
}

.fraction-unit {
  margin-left: 8px;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink-muted);
}

.goal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
  margin: 6px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.goal-bump {
  display: flex;
  gap: 6px;
  margin: -2px 0 12px;
}

.bump {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 44px;
  min-width: 64px;
  border-radius: var(--r-pill);
  background: var(--bg);
  font-size: 17px;
  font-weight: 600;
}

.bump:disabled {
  opacity: 0.4;
}

.bump-plus {
  flex: 1;
  background: var(--ink);
  color: var(--bg);
}

/* шаг кнопок −/+ меняется в любой момент: тап — шторка с крутилкой */
.bump-step {
  gap: 2px;
  padding: 0 12px;
  font-size: 13px;
  text-transform: uppercase;
}

.bump-step .icon {
  margin-right: -4px;
  color: var(--ink-muted);
}

/* у иконки по бокам свой воздух: рядом с текстом его убираем, иначе пара
   «иконка + число» стоит не по центру кнопки */
.bump-plus .icon {
  margin-left: -3px;
}

/* ── крутилка ─────────────────────────────────────────────────────────
   линейка с делениями: тянется пальцем, докатывается и встаёт на деление */
.dial {
  position: relative;
  height: 48px;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--bg);
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.dial:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.dial.is-active {
  cursor: grabbing;
}

.dial-track {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  margin-left: -5px;
  display: flex;
  will-change: transform;
}

.dial-tick {
  position: relative;
  width: 10px;
  height: 100%;
  flex: none;
}

.dial-tick::before {
  content: '';
  position: absolute;
  top: 13px;
  left: 50%;
  width: 1px;
  height: 11px;
  margin-left: -0.5px;
  background: var(--ink-muted);
}

.dial-tick.is-major::before {
  top: 9px;
  width: 2px;
  height: 17px;
  margin-left: -1px;
  background: var(--ink);
}

.dial-num {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: var(--ink-muted);
}

.dial-needle {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 50%;
  width: 3px;
  margin-left: -1.5px;
  border-radius: var(--r-pill);
  background: var(--ink);
  pointer-events: none;
}

/* деление прошло под стрелкой — она вздрагивает */
.dial-needle.is-tick {
  animation: needle-tick 0.2s var(--ease);
}

@keyframes needle-tick {
  40% {
    transform: scaleY(1.28) scaleX(1.3);
  }
}

/* прозрачный переключатель ради щелчка на делениях (dial.js): до касания —
   на всю линейку, в жесте — родного размера под пальцем (--sx, --sy) */
.dial-switch {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  touch-action: none;
  cursor: inherit;
}

.dial.is-riding .dial-switch {
  inset: auto;
  top: var(--sy, 0px);
  left: var(--sx, 0px);
  width: auto;
  height: auto;
}

.dial.is-off .dial-switch {
  display: none;
}

.dial.is-off {
  background: var(--hatch-fine);
  opacity: 0.45;
  cursor: default;
}

.dial.is-off .dial-track,
.dial.is-off .dial-needle {
  visibility: hidden;
}

/* шторка шага */
.step-for {
  margin-bottom: 4px;
}

.dial-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
}

/* число шага: поле и его невидимая копия в одной клетке — поле ровно по числу */
.dial-fit {
  display: inline-grid;
  min-width: 0;
  max-width: 80%;
  font-size: 56px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.dial-fit > * {
  grid-area: 1 / 1;
}

.dial-mirror {
  visibility: hidden;
  white-space: pre;
}

.dial-readout {
  /* своя ширина поля («20 символов») не растягивает клетку: ширину задаёт копия */
  width: 0;
  min-width: 100%;
  padding: 0;
  text-align: left;
  text-indent: 0;
  -webkit-appearance: none;
  appearance: none;
}

.dial-unit {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink-muted);
}

.step-auto {
  margin-top: 14px;
}

/* в шторке фон — как у страницы: линейке и пилюле нужен свой */
.sheet .dial,
.step-auto .pill {
  background: var(--bg-card);
}

/* ── новая цель: крутилки над полем ─────────────────────────────────── */

.goal-compose {
  padding: 8px;
}

.goal-compose-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.goal-compose-row .compose-input {
  flex: 1;
  min-width: 0;
}

.gd {
  display: none;
}

.goal-compose.is-open .gd {
  display: grid;
  gap: 6px;
  padding: 2px 2px 8px;
}

/* крутилки проявляются один раз — когда поле открыли, а не на каждый тап */
.goal-compose.is-opening .gd > * {
  animation: rise 0.34s var(--ease) both;
}

.goal-compose.is-opening .gd > :nth-child(2) { animation-delay: 30ms; }

.goal-compose.is-opening .gd > :nth-child(3) { animation-delay: 60ms; }

.goal-compose.is-opening .gd > :nth-child(4) { animation-delay: 90ms; }

.goal-compose.is-opening .gd > :nth-child(n + 5) { animation-delay: 120ms; }

.gd-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 8px;
}

.gd-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  transition: opacity 0.25s ease;
}

.gd-row.is-off {
  opacity: 0.5;
}

.gd-row.is-off .gd-chips {
  pointer-events: none;
}

.gd-label {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding-left: 8px;
}

.gd-name {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.gd-value,
.gd-shown {
  width: 100%;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gd-value::placeholder {
  color: var(--ink-muted);
}

.gd-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.gd-chips::-webkit-scrollbar {
  display: none;
}

.gd-chip {
  flex: none;
  scroll-snap-align: start;
}

.gd-other {
  flex: none;
  width: 84px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--bg);
  font-size: 16px;
  font-weight: 600;
}

.gd-hint {
  margin: 2px 8px 0;
  font-size: 14px;
  color: var(--ink-muted);
}

.goal-form {
  display: grid;
  gap: 12px;
  margin: 16px 0 20px;
}

.num-input {
  width: 160px;
  height: 40px;
  padding: 0 16px;
  background: var(--bg-card);
  border-radius: var(--r-pill);
  font-size: 17px;
  font-weight: 600;
}

.brief-goal-due {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}

.brief-goal-due.is-late {
  color: var(--accent);
}

.screen-settings .label {
  margin-top: 26px;
}

.settings {
  display: grid;
  gap: 18px;
}

.setting {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.setting-label {
  margin-left: 4px;
  font-size: 13px;
  font-weight: 600;
}

.setting-hint {
  margin: 0 4px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink-muted);
}

.stack + .setting-hint {
  margin-top: 12px;
}

.paste {
  width: 100%;
  min-height: 150px;
  margin: 14px 0 10px;
  padding: 12px 14px;
  resize: none;
  background: var(--bg-card);
  border-radius: var(--r-sm);
  font-size: 16px;
  line-height: 1.4;
}

/* ── движение ───────────────────────────────────────────────────────── */

/* вход на экран: всё мягко поднимается, графики вырастают по очереди */
/* настройки въезжают переходом (View Transitions) — подъём им не нужен; к тому
   же на время подъёма экран становится отдельным слоем, и закреплённая шапка
   оказывалась под зерном страницы — зерно в ней двоилось */
.is-entering .screen:not(.screen-settings) {
  animation: rise 0.34s var(--ease) both;
}

.is-entering .shape {
  animation: grow 0.6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 60ms + 80ms);
}

.is-entering .week-bar {
  transform-origin: 50% 100%;
  animation: grow-up 0.6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms + 80ms);
}

.is-entering .meter-done {
  transform-origin: 0 50%;
  animation: fill 0.7s var(--ease) 0.2s both;
}

.is-entering .tile,
.is-entering .task,
.is-entering .pick {
  animation: rise 0.42s var(--ease) both;
}

.is-entering .tiles > :nth-child(2),
.is-entering .tasks > :nth-child(2),
.is-entering .picks > :nth-child(2) { animation-delay: 40ms; }
.is-entering .tiles > :nth-child(3),
.is-entering .tasks > :nth-child(3),
.is-entering .picks > :nth-child(3) { animation-delay: 80ms; }
.is-entering .tiles > :nth-child(4),
.is-entering .tasks > :nth-child(4),
.is-entering .picks > :nth-child(4) { animation-delay: 120ms; }
.is-entering .tiles > :nth-child(n + 5),
.is-entering .tasks > :nth-child(n + 5),
.is-entering .picks > :nth-child(n + 5) { animation-delay: 160ms; }

/* галочка: впрыгивает и прорисовывается; название зачёркивается слева направо */
.check.is-pop {
  animation: pop 0.4s var(--spring);
}

.check.is-pop .icon path {
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  animation: draw 0.3s var(--ease) 0.08s forwards;
}

.task.is-pop .task-title {
  text-decoration: none;
  background: linear-gradient(var(--ink-muted), var(--ink-muted)) 0 55% / 0 1.5px no-repeat;
  animation: strike 0.36s var(--ease) 0.1s forwards;
}

.sheet-scrim {
  animation: fade 0.4s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes grow {
  from {
    opacity: 0;
    transform: scaleY(0.1);
  }
}

@keyframes grow-up {
  from {
    transform: scaleY(0);
  }
}

@keyframes fill {
  from {
    transform: scaleX(0);
  }
}

@keyframes pop {
  0% { transform: scale(0.7); }
  100% { transform: none; }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes strike {
  to {
    background-size: 100% 1.5px;
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }
}

/* ── оформление Colour: у каждой сферы свой цвет ──────────────────────
   Settings → Style. Цвет — ключ сферы (data-sc), сам цвет — токен темы.
   Заливка — у плитки сферы и у метки на задаче; глиф сферы в меню, в
   заголовках и в Overview — в кружке её цвета. В Minimal ничего этого нет */
[data-sc='olive'] { --sc: var(--sph-olive); }
[data-sc='lavender'] { --sc: var(--sph-lavender); }
[data-sc='apricot'] { --sc: var(--sph-apricot); }
[data-sc='mint'] { --sc: var(--sph-mint); }
[data-sc='slate'] { --sc: var(--sph-slate); }
[data-sc='lilac'] { --sc: var(--sph-lilac); }
[data-sc='plum'] { --sc: var(--sph-plum); }
[data-sc='khaki'] { --sc: var(--sph-khaki); }

:root[data-palette='colour'] .sphere-tile[data-sc] {
  background: var(--sc);
  color: var(--on-sphere);
}

/* глиф на цветной плитке — в обведённом кружке, как пилюли референса */
:root[data-palette='colour'] .sphere-tile[data-sc] .chip {
  background: none;
  color: var(--on-sphere);
  box-shadow: inset 0 0 0 1.5px currentColor;
}

:root[data-palette='colour'] .sphere-tile[data-sc] .tile-more,
:root[data-palette='colour'] .sphere-tile[data-sc] .drag,
:root[data-palette='colour'] .sphere-tile[data-sc] .tile-count.is-zero,
:root[data-palette='colour'] .sphere-tile[data-sc].is-archived .tile-name {
  color: var(--on-sphere);
  opacity: 0.5;
}

:root[data-palette='colour'] .meta-sphere[data-sc] {
  /* высота — сама строка: 23px, нечётная, как значок 11px, — оба встают на
     целые пиксели; поля выровнены по чернилам: значок и текст — по 8.5px от края */
  padding: 0 8px 0 7.5px;
  border-radius: var(--r-pill);
  background: var(--sc);
  color: var(--on-sphere);
  font-size: 13px;
  font-weight: 600;
  line-height: 23px;
}

:root[data-palette='colour'] .meta-sphere[data-sc] .glyph {
  width: 11px;
  height: 11px;
}

/* кружки в меню шире обычного значка: столбец под них, Inbox — по той же оси */
:root[data-palette='colour'] .menu-mark {
  width: 24px;
}

:root[data-palette='colour'] .compose-chip[data-sc] {
  background: var(--sc);
  color: var(--on-sphere);
}

/* кружок цвета под глифом; в Minimal обёртки как нет */
.sc-mark {
  display: contents;
}

:root[data-palette='colour'] .sc-mark[data-sc] {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: var(--r-pill);
  background: var(--sc);
  color: var(--on-sphere);
}

/* значок в кружке — 12px: разница с кружком (22, 20, 18) чётная, и центр
   значка ровно в центре кружка, а не на полпикселя в сторону */
:root[data-palette='colour'] .sc-mark[data-sc] > .glyph {
  width: 12px;
  height: 12px;
}

:root[data-palette='colour'] .title-glyph .sc-mark[data-sc] {
  width: 38px;
  height: 38px;
}

:root[data-palette='colour'] .title-glyph .sc-mark[data-sc] .glyph {
  width: 18px;
  height: 18px;
}

:root[data-palette='colour'] .sheet-head .sc-mark[data-sc] {
  width: 36px;
  height: 36px;
}

:root[data-palette='colour'] .sheet-head .sc-mark[data-sc] .glyph {
  width: 16px;
  height: 16px;
}

:root[data-palette='colour'] .line .sc-mark[data-sc] {
  align-self: center;
  width: 20px;
  height: 20px;
}

/* кружок не выше строки: иначе строка растёт от него, а текст остаётся у верха */
:root[data-palette='colour'] .lines-sm .line .sc-mark[data-sc] {
  width: 18px;
  height: 18px;
}

/* цвет сферы в её шторке «⋯»: образцы, выбранный — с галочкой */
.color-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: -8px 0 18px;
}

.color-pick {
  display: grid;
  place-items: center;
  height: 48px;
  background: var(--sc);
  color: var(--on-sphere);
  border-radius: var(--r-card);
  transition: transform var(--release);
}

.color-pick:active {
  transform: scale(var(--press));
  transition: transform var(--press-in) var(--ease);
}

/* ── «сохранено»: крестик в шапке настроек на миг становится галочкой ──
   Крестик с поворотом сжимается и гаснет, галочка прорисовывается линией
   (как ставят рукой), в момент, когда дорисована, кнопка чуть подпрыгивает;
   потом галочка тает, крестик возвращается обратным поворотом. 1.25 с */
.icon-close-check {
  overflow: visible;
}

.icon-close-check .cc-x,
.icon-close-check .cc-v {
  transform-box: view-box;
  transform-origin: 12px 12px;
}

.icon-close-check .cc-v {
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
}

.icon-close-check.is-saved {
  animation: cc-pop 1.25s both;
}

.icon-close-check.is-saved .cc-x {
  animation: cc-x 1.25s both;
}

.icon-close-check.is-saved .cc-v {
  animation: cc-v 1.25s both;
}

/* «меньше движения»: просто галочка вместо крестика */
.icon-close-check.is-saved-still .cc-x {
  opacity: 0;
}

.icon-close-check.is-saved-still .cc-v {
  stroke-dashoffset: 0;
}

@keyframes cc-x {
  0% {
    opacity: 1;
    transform: none;
    animation-timing-function: cubic-bezier(0.4, 0, 1, 1);
  }

  14% {
    opacity: 0;
    transform: rotate(60deg) scale(0.3);
  }

  80% {
    opacity: 0;
    transform: rotate(-60deg) scale(0.3);
    animation-timing-function: cubic-bezier(0.2, 0.9, 0.3, 1.2);
  }

  100% {
    opacity: 1;
    transform: none;
  }
}

@keyframes cc-v {
  0%,
  12% {
    opacity: 1;
    stroke-dashoffset: 1;
    animation-timing-function: cubic-bezier(0.3, 0, 0.1, 1);
  }

  36%,
  76% {
    opacity: 1;
    stroke-dashoffset: 0;
  }

  88%,
  100% {
    opacity: 0;
    stroke-dashoffset: 0;
    transform: scale(0.7);
  }
}

@keyframes cc-pop {
  0%,
  32% {
    transform: none;
  }

  40% {
    transform: scale(1.18);
  }

  52% {
    transform: scale(0.95);
  }

  62%,
  100% {
    transform: none;
  }
}

/* ── второй тап «удалить» ─────────────────────────────────────────────
   Кнопка «взводится»: заливка бежит слева направо, новая подпись
   поднимается на место прежней — видно, что следующий тап удалит */
.is-confirming {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  color: var(--bg);
}

.is-confirming::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--ink);
  transform-origin: 0 50%;
  animation: confirm-fill 0.42s cubic-bezier(0.32, 0.72, 0, 1) both;
}

.confirm-label {
  display: inline-block;
  animation: confirm-label 0.36s cubic-bezier(0.2, 0.8, 0.2, 1) 0.06s both;
}

@keyframes confirm-fill {
  from {
    transform: scaleX(0);
  }
}

@keyframes confirm-label {
  from {
    opacity: 0;
    transform: translateY(80%);
  }
}

/* ── описания ─────────────────────────────────────────────────────────
   Пояснения под кнопками и настройками, подсказки на пустых экранах — один
   кегль и ритм: 14/20, обычный вес, чуть разреженно. Тише заголовков и
   кнопок, ровным серым блоком, без висячих коротких строк (text-wrap) */
.hint,
.hint-top,
.setting-hint {
  font-size: 14px;
  font-weight: 400;
  line-height: 20px;
  letter-spacing: 0.005em;
  color: var(--ink-muted);
  text-wrap: pretty;
}

/* вводный абзац в блоке настроек и текст шторок — на ступень крупнее, тем же ритмом */
.block-text,
.sheet-text {
  font-size: 15px;
  font-weight: 400;
  line-height: 22px;
  text-wrap: pretty;
}

.sheet-text.sheet-strong {
  font-weight: 600;
}

/* ── капс ────────────────────────────────────────────────────────────── */

/* ключевые места набраны капсом — гротеск звучит громче. Названия задач,
   заметки и подписи под задачами — текст пользователя, их регистр не трогаем */
.title,
.label,
.stat-label,
.tile-label,
.tile-name,
.tab-label,
.week-day,
.fold-head > span:first-child,
.field-label,
.pill-action,
.back,
.sheet-title,
.sheet-bar-title,
.full-badge,
.full-label,
.quick-label,
.setting-label,
.select-count,
.bar-btn {
  text-transform: uppercase;
}

/* ── переходы между экранами (View Transitions) ───────────────────────
   настройки въезжают справа и уезжают туда же; экран под ними чуть уходит
   влево и тускнеет — как стопка карточек. Между вкладками — наплыв. */
.corner-btn {
  view-transition-name: corner;
}

.nav {
  view-transition-name: nav;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.22s;
}

:root[data-nav='push']::view-transition-old(root),
:root[data-nav='push']::view-transition-new(root),
:root[data-nav='pop']::view-transition-old(root),
:root[data-nav='pop']::view-transition-new(root) {
  animation-duration: 0.46s;
  animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
  mix-blend-mode: normal;
}

:root[data-nav='push']::view-transition-old(root) {
  animation-name: vt-under-out;
}

:root[data-nav='push']::view-transition-new(root) {
  animation-name: vt-over-in;
}

:root[data-nav='pop']::view-transition-old(root) {
  z-index: 2;
  animation-name: vt-over-out;
}

:root[data-nav='pop']::view-transition-new(root) {
  animation-name: vt-under-in;
}

/* шестерёнка поворачивается и становится крестиком — и обратно; только при
   входе в настройки и выходе. Смена оформления крестик не крутит: он сам
   становится галочкой (flashCheck в ui.js) */
:root:is([data-nav='push'], [data-nav='pop'])::view-transition-old(corner),
:root:is([data-nav='push'], [data-nav='pop'])::view-transition-new(corner) {
  animation-duration: 0.46s;
  animation-timing-function: cubic-bezier(0.32, 0.72, 0, 1);
}

:root:is([data-nav='push'], [data-nav='pop'])::view-transition-old(corner) {
  animation-name: vt-corner-out;
}

:root:is([data-nav='push'], [data-nav='pop'])::view-transition-new(corner) {
  animation-name: vt-corner-in;
}

@keyframes vt-over-in {
  from {
    transform: translateX(100%);
  }
}

@keyframes vt-over-out {
  to {
    transform: translateX(100%);
  }
}

@keyframes vt-under-out {
  to {
    transform: translateX(-24%);
    opacity: 0.5;
  }
}

@keyframes vt-under-in {
  from {
    transform: translateX(-24%);
    opacity: 0.5;
  }
}

@keyframes vt-corner-out {
  to {
    transform: rotate(90deg) scale(0.6);
    opacity: 0;
  }
}

@keyframes vt-corner-in {
  from {
    transform: rotate(-90deg) scale(0.6);
    opacity: 0;
  }
}

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

/* то же по настройке приложения (Settings → Motion → Reduced) */
:root[data-motion='reduced'] *,
:root[data-motion='reduced'] *::before,
:root[data-motion='reduced'] *::after {
  animation: none !important;
  transition: none !important;
}

/* ── щелчок на нажатие (withTick в src/ui.js) ─────────────────────────
   Прозрачный label на всю кнопку со скрытым переключателем внутри: палец
   нажимает label, iPhone щёлкает, click всплывает к кнопке. Опора для
   label — relative, только если у кнопки нет своей позиции (:where — ноль
   специфичности, любое правило с position главнее) */
:where(.has-tick) {
  position: relative;
}

.tick {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  -webkit-tap-highlight-color: transparent;
}

.tick-switch {
  display: none;
}

/* неактивная кнопка — без щелчка */
:disabled > .tick {
  display: none;
}

/* ── лаборатория вибрации (эксперимент, src/views/lab.js) ─────────────
   Дорожка степпера: заливка и риска — значение, пунктир — где начинать
   жест (режим C). Переключатель — настоящий, по умолчанию
   прозрачный; не display: none и не pointer-events: none — палец должен
   попадать именно в него */
.lab-controls {
  display: grid;
  gap: 12px;
  margin: 0 0 12px;
}

.lab-guide {
  margin: 0 4px 12px;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-muted);
  text-wrap: pretty;
}

.lab-stage {
  margin: 0 0 20px;
}

.lab-track {
  --k: 0.5;
  position: relative;
  overflow: hidden;
  background: var(--bg-alt);
  border-radius: var(--r-card);
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.lab-track.is-v {
  height: 340px;
}

.lab-track.is-h {
  height: 150px;
}

.lab-fill,
.lab-handle,
.lab-value,
.lab-dot {
  position: absolute;
  pointer-events: none;
}

.lab-fill {
  left: 0;
  bottom: 0;
  background: var(--ink);
  opacity: 0.1;
}

.is-v .lab-fill {
  right: 0;
  height: calc(var(--k) * 100%);
}

.is-h .lab-fill {
  top: 0;
  width: calc(var(--k) * 100%);
}

.lab-handle {
  background: var(--ink);
  border-radius: var(--r-pill);
}

.is-v .lab-handle {
  left: 16px;
  right: 16px;
  bottom: calc(var(--k) * (100% - 4px));
  height: 4px;
}

.is-h .lab-handle {
  top: 16px;
  bottom: 16px;
  left: calc(var(--k) * (100% - 4px));
  width: 4px;
}

.lab-value {
  top: 12px;
  left: 16px;
  font-size: 44px;
  font-weight: 600;
  line-height: 48px;
  font-variant-numeric: tabular-nums;
}

/* C: пунктир обводит переключатель, размер — из lab.js (--dw, --dh) */
.lab-dot {
  top: 50%;
  left: 50%;
  width: var(--dw, 80px);
  height: var(--dh, 40px);
  transform: translate(-50%, -50%);
  border: 2px dashed var(--ink-muted);
  border-radius: var(--r-pill);
}

.lab-switch {
  position: absolute;
  margin: 0;
  opacity: 0;
  touch-action: none;
}

.lab-track.is-shown .lab-switch {
  opacity: 1;
}

/* B, а до первого движения и A, E: вся дорожка — один прозрачный
   переключатель, палец точно начинает на нём */
.is-a .lab-switch,
.is-b .lab-switch,
.is-e .lab-switch {
  inset: 0;
  width: 100%;
  height: 100%;
}

/* A, E в жесте: родного размера под пальцем; место — из lab.js (--sx, --sy),
   через left/top, без transform */
.lab-track.is-riding .lab-switch {
  inset: auto;
  top: var(--sy, 0px);
  left: var(--sx, 0px);
  width: auto;
  height: auto;
}

/* C: родного размера в центре */
.is-c .lab-switch {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.lab-panel {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
}

.lab-row {
  display: grid;
  grid-template-columns: 9.5em minmax(0, 1fr);
  gap: 8px;
  font-size: 13px;
  line-height: 18px;
}

.lab-row dt {
  color: var(--ink-muted);
}

.lab-row dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.lab-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 12px;
}

.lab-log {
  max-height: 60vh;
  margin: 0;
  padding: 12px;
  overflow: auto;
  background: var(--bg-alt);
  border-radius: var(--r-sm);
  font: 11px/16px ui-monospace, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── воздух ───────────────────────────────────────────────────────────
   Секции настроек разделены воздухом, пояснение не липнет к кнопке над
   ним (было: подпись под «Ask AI about my plans» сидела вплотную). */
.screen-settings .label {
  margin-top: 36px;
}

.screen-settings .head + .label {
  margin-top: 8px;
}

.pill-action + .setting-hint,
.stack + .setting-hint {
  margin-top: 14px;
}

.goal-empty {
  margin: 12px 0;
  font-size: 14px;
  line-height: 20px;
  color: var(--ink-muted);
}

/* ── стрик ────────────────────────────────────────────────────────────
   Строка над композицией дня: слева число дней подряд, справа неделя
   точками. Закрытый день — сплошная точка, пустой — контур, сегодня —
   с кольцом. Никакого цвета: красный в приложении значит «срочно». */
.streak {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 4px 22px;
}

.streak-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.streak-label {
  font-size: 13px;
  font-weight: 600;
  line-height: 16px;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.streak-value {
  font-size: 32px;
  font-weight: 500;
  line-height: 36px;
  font-variant-numeric: tabular-nums;
}

.streak-value .muted {
  font-size: 16px;
}

.streak-note {
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-muted);
}

.streak-week {
  display: flex;
  gap: 8px;
  flex: none;
}

.streak-day {
  display: grid;
  justify-items: center;
  gap: 6px;
}

.streak-dot {
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  border: 1.5px solid var(--ink-muted);
  border-radius: 50%;
  opacity: 0.45;
}

.streak-day.is-hit .streak-dot {
  border-color: var(--ink);
  background: var(--ink);
  opacity: 1;
}

.streak-day.is-today .streak-dot {
  opacity: 1;
  outline: 1.5px solid var(--ink-muted);
  outline-offset: 3px;
}

.streak-wd {
  font-size: 11px;
  font-weight: 600;
  line-height: 12px;
  color: var(--ink-muted);
}

.streak-day.is-today .streak-wd {
  color: var(--ink);
}

/* ── тихие ссылки ─────────────────────────────────────────────────────
   Второстепенные входы (планирование завтра, обзор недели): строка текста
   со стрелкой, без заливки — чтобы не спорить с главным действием экрана. */
.quiet-links {
  display: grid;
  margin-top: 20px;
}

.quiet-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  margin: 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  border-top: 1px solid color-mix(in srgb, var(--ink-muted) 28%, transparent);
}

.today-body > .quiet-link {
  margin-top: 28px;
}

/* свёрнутые разделы настроек: содержимое — с отступом от заголовка */
.screen-settings .fold {
  margin-top: 28px;
}

.fold-body {
  margin-top: 10px;
}

/* поле «New goal» стояло вплотную под последней карточкой цели: тот же
   зазор, что между карточками, и сами карточки — свободнее */
.goal-list {
  gap: 16px;
}

.goal-list + .goal-compose {
  margin-top: 16px;
}
