/* ARVIS Mini App. Цвета фона и текста берутся из темы Telegram пользователя,
   поэтому приложение само становится светлым или тёмным. */

@font-face {
  font-family: "Golos Text";
  src: url("fonts/golos-text-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Golos Text";
  src: url("fonts/golos-text-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --page: var(--tg-theme-secondary-bg-color, #eceef2);
  --surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #ffffff));
  --text: var(--tg-theme-text-color, #13161b);
  --hint: var(--tg-theme-hint-color, #717a89);
  --accent: var(--tg-theme-button-color, #2b6de0);
  --on-accent: var(--tg-theme-button-text-color, #ffffff);
  --line: var(--tg-theme-section-separator-color, rgba(120, 128, 142, .24));
  --danger: var(--tg-theme-destructive-text-color, #d93a3f);
  --high: #dc4046;
  --medium: #e19a24;
  --low: #98a1b0;
  --tomato: #dc4046;
  --rest: #2f9e74;     /* перерыв */
  --fill: color-mix(in srgb, var(--text) 7%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --pad: 16px;
  --tabs-h: 58px;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Menlo, Consolas, monospace;
}
/* Схема задаётся в html[data-scheme] (theme-boot.js): «как в системе» — по системе или по Telegram,
   либо выбор человека в настройках «Оформление». Селекторы :root:where(…) — того же веса, что :root:
   темы Pro (html[data-theme]) их перекрывают, а ручной выбор ниже перекрывает цвета Telegram. */
:root:where([data-scheme="dark"]) {
  --page: var(--tg-theme-secondary-bg-color, #0f1114);
  --surface: var(--tg-theme-section-bg-color, var(--tg-theme-bg-color, #1a1d22));
  --text: var(--tg-theme-text-color, #eef0f3);
  --hint: var(--tg-theme-hint-color, #8d95a3);
  --accent: var(--tg-theme-button-color, #5b93f5);
  --high: #f0646a;
  --medium: #eeb04a;
  --low: #7c8594;
  --tomato: #f0646a;
  --rest: #4cc195;
}
/* Выбрано вручную — цвета Telegram не берём: «светлая» в тёмном Telegram должна быть светлой */
:root:where([data-forced][data-scheme="light"]) {
  --page: #eceef2; --surface: #ffffff; --text: #13161b; --hint: #717a89; --accent: #2b6de0; --on-accent: #ffffff;
  --line: rgba(120, 128, 142, .24); --danger: #d93a3f;
}
:root:where([data-forced][data-scheme="dark"]) {
  --page: #0f1114; --surface: #1a1d22; --text: #eef0f3; --hint: #8d95a3; --accent: #5b93f5; --on-accent: #ffffff;
  --line: rgba(141, 149, 163, .22); --danger: #f0646a;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 16px/1.4 "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
/* Системные части (выпадающий список, календарь в поле даты, полоса прокрутки) рисует браузер.
   Без color-scheme в тёмной теме список «На что» был белым с почти белым текстом (17.11.2026). */
:root { color-scheme: light; }
:root:where([data-scheme="dark"]) { color-scheme: dark; }
select option, select optgroup { background-color: var(--surface); color: var(--text); }
button { cursor: pointer; background: none; border: 0; padding: 0; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Поля ввода: мягкая подсветка внутри поля, а не рамка снаружи — она вылезала за край и под соседние блоки */
input:focus-visible, textarea:focus-visible, select:focus-visible, [contenteditable]:focus-visible { outline: none; }
.input:focus, .field textarea:focus, .field input:not([type="checkbox"]):focus, .search:focus, .raw-area:focus {
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent);
}
button, a, input, select, textarea, [contenteditable] { touch-action: manipulation; }
.btn, .chip, .tool, .quick button, .choice, .tpl-play, .tpl-edit, #fab, .seg button, .day, .quick-send, #plan-badge {
  transition: transform .12s ease, background-color .15s, color .15s;
}
.btn:active:not(:disabled), .chip:active, .tool:active, .quick button:active, .choice:active, .tpl-play:active,
.quick-send:active:not(:disabled), .day:active, #plan-badge:active { transform: scale(.96); }
#fab:active { transform: scale(.92); }
.task .body:active, .note-row:active, .tpl-main:active, .log-row:active:not(:disabled) { background: var(--fill); }
.task .body, .note-row, .tpl-main, .log-row { transition: background-color .15s; }

body > header, body > main, #banner { max-width: 640px; margin-inline: auto; }

/* ---------- шапка ---------- */
#top {
  display: flex; align-items: center; gap: 10px;
  padding: 14px var(--pad) 6px;
}
#title { flex: 1; margin: 0; font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#top.page #title { font-size: 17px; font-weight: 600; letter-spacing: 0; text-align: center; }
#back { color: var(--accent); font-size: 16px; padding: 6px 2px; }
#back::before { content: "‹"; font-size: 24px; line-height: 0; vertical-align: -2px; margin-right: 3px; }
#top.page::after { content: ""; width: 58px; }  /* уравновешивает кнопку «Назад», заголовок по центру */
/* Внутренний экран с кнопкой справа («Сохранить»): три колонки, заголовок строго по центру */
#top.page.has-action { display: grid; grid-template-columns: minmax(64px, 1fr) minmax(0, auto) minmax(64px, 1fr); }
#top.page.has-action::after { content: none; }
#top.page.has-action #back { grid-area: 1 / 1; justify-self: start; }
#top.page.has-action #title { grid-area: 1 / 2; }
#top.page #plan-badge, #top.page #logout { display: none; }
#action { grid-area: 1 / 3; justify-self: end; color: var(--accent); font-size: 16px; font-weight: 600; padding: 6px 2px 6px 10px; }
#action:disabled { opacity: .45; }
#viewas {
  appearance: none; border: 0; border-radius: 99px;
  background: var(--fill); padding: 7px 14px; font-size: 14px; font-weight: 500; max-width: 150px;
}
#lang {
  appearance: none; border: 0; border-radius: 99px; color: var(--hint);
  background: var(--fill); padding: 7px 10px; font-size: 13px; font-weight: 600; letter-spacing: .02em;
}
#top.page #lang-wrap, #top.page #help { display: none; }
#help { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--fill); color: var(--hint); font-size: 15px; font-weight: 700; }   /* на внутренних экранах — только «Назад» и заголовок */
#banner {
  margin-block: 6px 0; padding: 9px var(--pad);
  background: var(--accent-soft); color: var(--text); font-size: 14px;
}

#view { padding: 8px var(--pad) calc(var(--tabs-h) + var(--safe-bottom) + 90px); outline: 0; }
#view.page { padding-bottom: calc(var(--safe-bottom) + 96px); }
/* Смена вкладки: короткое появление вместо резкой подмены */
#view.enter { animation: view-in .18s ease-out; }
#view.enter-fwd { animation: view-fwd .26s cubic-bezier(.2, .8, .2, 1); }
#view.enter-back { animation: view-back .26s cubic-bezier(.2, .8, .2, 1); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } }
@keyframes view-fwd { from { opacity: 0; transform: translateX(28px); } }
@keyframes view-back { from { opacity: 0; transform: translateX(-28px); } }
/* Смена языка: экран не перезагружается, текст мягко проявляется на месте */
#view.relang { animation: relang .22s ease-out; }
@keyframes relang { from { opacity: .35; } }

/* ---------- переключатель режима ---------- */
.seg { display: flex; background: var(--fill); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { flex: 1; padding: 7px 4px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--hint); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.seg button:disabled { opacity: .4; cursor: default; }
.seg.locked button[aria-pressed="true"] { cursor: default; }

/* ---------- лента дней: главный элемент экрана задач ---------- */
.days {
  display: flex; gap: 6px; overflow-x: auto; scroll-snap-type: x proximity; scroll-padding-inline: var(--pad);
  margin: 14px calc(-1 * var(--pad)) 4px; padding: 2px var(--pad) 6px; scrollbar-width: none;
}
.days::-webkit-scrollbar { display: none; }
.day {
  flex: 0 0 auto; width: 50px; padding: 8px 0 7px; border-radius: 14px; scroll-snap-align: start;
  display: grid; justify-items: center; gap: 1px; background: var(--surface);
}
.day .wd { font-size: 12px; color: var(--hint); }
.day .num { font-size: 20px; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }
.day.weekend .wd { color: var(--high); }
.day .load { display: flex; gap: 3px; height: 5px; margin-top: 4px; }
.day .load i { width: 5px; height: 5px; border-radius: 50%; background: var(--low); }
.day .load i.high { background: var(--high); }
.day .load i.medium { background: var(--medium); }
.day[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.day[aria-pressed="true"] .wd { color: inherit; opacity: .8; }
.day[aria-pressed="true"] .load i { background: currentColor; opacity: .85; }
.day.today:not([aria-pressed="true"]) .num { color: var(--accent); }

/* ---------- списки ---------- */
.group-title { display: flex; align-items: baseline; gap: 8px; margin: 20px 4px 8px; font-size: 15px; font-weight: 600; }
.group-title .count { color: var(--hint); font-weight: 400; font-variant-numeric: tabular-nums; }
.group-title.alert { color: var(--high); }
.list { background: var(--surface); border-radius: 14px; overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }

.task { display: flex; align-items: flex-start; }
.task .check { flex: 0 0 auto; padding: 13px 10px 13px 14px; }
.task .check i {
  display: block; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--low);
}
.task.p-high .check i { border-color: var(--high); }
.task.p-medium .check i { border-color: var(--medium); }
.task.is-done .check i { border-color: var(--accent); background: var(--accent) center / 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.3l2.7 2.7L11 4.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.task.is-draft .check i { border-style: dashed; }
.task .body { flex: 1; min-width: 0; text-align: left; padding: 12px 14px 12px 2px; }
.task .name { display: block; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.task.is-done .name { color: var(--hint); text-decoration: line-through; }
.task .meta { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; font-size: 13px; color: var(--hint); }
.task .meta .late { color: var(--high); font-weight: 500; }
.task.leaving { opacity: 0; transition: opacity .25s; }

.search {
  width: 100%; border: 0; border-radius: 11px; background: var(--fill);
  padding: 9px 12px; font-size: 16px; margin-top: 12px;
}
.search::placeholder { color: var(--hint); }

.empty { text-align: center; color: var(--hint); padding: 44px 24px; font-size: 15px; }
.empty strong { display: block; color: var(--text); font-size: 17px; font-weight: 600; margin-bottom: 4px; }

/* ---------- заметки ---------- */
.chips { display: flex; gap: 6px; overflow-x: auto; margin: 12px calc(-1 * var(--pad)) 0; padding: 0 var(--pad) 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; padding: 6px 13px; border-radius: 99px; background: var(--surface); font-size: 14px; white-space: nowrap; }
.chip .n { color: var(--hint); margin-left: 5px; font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: .75; }

.note-row { display: block; width: 100%; text-align: left; padding: 12px 14px; }
.note-row .name { display: block; font-size: 16px; font-weight: 600; line-height: 1.3; }
.note-row .snip { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--hint); font-size: 14px; margin-top: 2px; }
.note-row .meta { display: flex; gap: 10px; font-size: 13px; color: var(--hint); margin-top: 5px; }
.note-row .meta .topic { color: var(--accent); }

.note-head { margin: 4px 2px 14px; }
.note-head h2 { margin: 0 0 4px; font-size: 24px; line-height: 1.2; font-weight: 700; letter-spacing: -.015em; overflow-wrap: anywhere; }
.note-head p { margin: 0; color: var(--hint); font-size: 14px; }
.note-head .topic { color: var(--accent); }
.paper { background: var(--surface); border-radius: 14px; padding: 16px 16px 18px; }

/* Оформленный текст заметки */
.md { font-size: 16px; line-height: 1.55; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { line-height: 1.25; margin: 1.3em 0 .45em; letter-spacing: -.01em; }
.md h1 { font-size: 22px; }
.md h2 { font-size: 19px; }
.md h3 { font-size: 16px; }
.md p { margin: .6em 0; }
.md ul, .md ol { margin: .5em 0; padding-left: 1.35em; }
.md li { margin: .2em 0; }
.md li.lv1 { margin-left: 1.2em; }
.md li.lv2 { margin-left: 2.4em; }
.md li.todo { list-style: none; position: relative; }
.md li.todo::before { content: ""; position: absolute; left: -1.3em; top: .28em; width: 15px; height: 15px; border: 1.5px solid var(--low); border-radius: 4px; }
.md li.todo.done { color: var(--hint); text-decoration: line-through; }
.md li.todo.done::before { border-color: var(--accent); background: var(--accent) center / 11px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.3l2.7 2.7L11 4.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.md code { font-family: var(--mono); font-size: .88em; background: var(--fill); padding: .12em .35em; border-radius: 5px; }
.md pre { position: relative; background: var(--fill); border-radius: 10px; padding: 12px 14px; overflow-x: auto; margin: .8em 0; }
.md pre code { background: none; padding: 0; font-size: 13.5px; line-height: 1.5; white-space: pre; }
.md pre[data-lang]::before { content: attr(data-lang); display: block; font-size: 12px; color: var(--hint); margin-bottom: 6px; }
.md blockquote { margin: .8em 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--accent); color: var(--hint); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1.2em 0; }
.md a { color: var(--tg-theme-link-color, var(--accent)); }
.md .table { overflow-x: auto; margin: .8em 0; }
.md table { border-collapse: collapse; font-size: 14.5px; min-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 9px; text-align: left; vertical-align: top; }
.md th { background: var(--fill); font-weight: 600; }

/* ---------- формы ---------- */
.field { display: block; margin-top: 14px; }
.field > .label { display: block; font-size: 13px; color: var(--hint); margin: 0 4px 5px; }
.input, .field textarea, .field input:not([type="checkbox"]) {
  width: 100%; border: 0; border-radius: 11px; background: var(--fill);
  padding: 10px 12px; font-size: 16px; min-height: 42px;
}
.field textarea { resize: none; display: block; line-height: 1.45; }
.row { display: flex; gap: 8px; }
.row > * { flex: 1; min-width: 0; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.quick button { padding: 5px 11px; border-radius: 99px; background: var(--fill); font-size: 14px; }
.title-input { font-size: 20px !important; font-weight: 600; }
:disabled { opacity: 1; -webkit-text-fill-color: currentColor; }

.btn { display: block; width: 100%; padding: 13px 16px; border-radius: 12px; font-size: 16px; font-weight: 600; text-align: center; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.soft { background: var(--fill); }
.btn.danger { color: var(--danger); background: var(--fill); }
.btn:disabled { opacity: .5; }
.actions { display: grid; gap: 8px; margin-top: 18px; }
.actions.two { grid-template-columns: 1fr 1fr; }
.actions.three { grid-template-columns: repeat(3, 1fr); }
.actions.three .btn { padding-inline: 6px; font-size: 15px; }

/* Редактор заметки: один «лист» — заголовок, папка и текст; кнопки оформления прижаты к низу (к клавиатуре) */
.note-editor { background: var(--surface); border-radius: 16px; padding: 12px 16px 6px; margin-top: 4px; }
.note-title {
  display: block; width: 100%; border: 0; background: transparent; padding: 4px 0; outline: none;
  font-size: 23px; font-weight: 700; line-height: 1.25; letter-spacing: -.015em;
}
.note-title::placeholder, .note-folder input::placeholder { color: var(--hint); opacity: .8; }
.note-folder {
  display: flex; align-items: center; gap: 7px; color: var(--hint);
  padding: 2px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.note-folder input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; padding: 4px 0; font-size: 14.5px; color: var(--accent); }
.rich { position: relative; min-height: max(220px, calc(100vh - 330px)); padding: 10px 0 28px; outline: none; caret-color: var(--accent); -webkit-user-select: text; user-select: text; }
.rich.is-empty::before { content: attr(data-placeholder); position: absolute; top: 10px; left: 0; right: 0; color: var(--hint); pointer-events: none; }
.rich p, .rich > div:not(.table) { margin: 0; min-height: 1.55em; }
.rich h1, .rich h2, .rich h3 { margin: .9em 0 .3em; }
.rich > :first-child { margin-top: 0; }
.rich ul, .rich ol { margin: .25em 0; }
.rich li.todo::before { width: 18px; height: 18px; top: .18em; left: -1.55em; border-radius: 5px; cursor: pointer; }
.rich li.todo { margin-left: .25em; }
.rich blockquote { color: var(--text); opacity: .85; }
.rich [data-src] { cursor: pointer; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); -webkit-user-select: none; user-select: none; }
.rich pre[data-src] { box-shadow: none; }
.rich [data-src]:active { box-shadow: 0 0 0 2px var(--accent); }
.rich hr { margin: 1em 0; }
.editor-area {
  width: 100%; border: 0; background: transparent; padding: 10px 0 24px; line-height: 1.55; resize: none; display: block; overflow: hidden;
  min-height: max(220px, calc(100vh - 330px)); font-family: var(--mono); font-size: 14.5px; outline: none;
}
.note-editor .paper { padding: 10px 0 20px; }
.raw-area { width: 100%; border: 0; border-radius: 11px; background: var(--fill); padding: 10px 12px; font: 14px/1.5 var(--mono); resize: none; min-height: 140px; display: block; }
.editor-stats { margin: 8px 4px 0; color: var(--hint); font-size: 13px; font-variant-numeric: tabular-nums; }

.editbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 6px 0 calc(6px + var(--safe-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
body.typing .editbar { padding-bottom: 6px; }   /* клавиатура открыта — отступ под «полоску» iPhone не нужен */
.editbar-in { display: flex; align-items: center; max-width: 640px; margin-inline: auto; }
.editbar .tool-row { flex: 1; min-width: 0; }
.tool-row { display: flex; gap: 2px; overflow-x: auto; padding: 0 8px; scrollbar-width: none; }
.tool-row::-webkit-scrollbar { display: none; }
.tool { flex: 0 0 auto; display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 8px; border-radius: 10px; font-size: 15px; font-weight: 600; white-space: nowrap; color: var(--text); }
.tool .ic { width: 21px; height: 21px; }
.tool.glyph { font-size: 16px; font-weight: 700; }
.tool.glyph.i { font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.tool.glyph.s { text-decoration: line-through; }
.tool.text { font-size: 14px; font-weight: 500; }
.tool[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
.tool:disabled { opacity: .35; }
.tool.mode { flex: none; margin: 0 8px 0 2px; font-size: 12px; letter-spacing: .04em; color: var(--hint); border: 1px solid var(--line); height: 32px; min-width: 42px; }
.tool.mode[aria-pressed="true"] { border-color: transparent; }
@media (hover: hover) { .tool:hover { background: var(--fill); } }
.chips.templates { align-items: center; margin-top: 4px; margin-bottom: 10px; }
.templates-label { flex: none; color: var(--hint); font-size: 14px; }
.chips.templates .chip { border: 1px solid var(--line); }

/* ---------- фокус ---------- */
.goal { background: var(--surface); border-radius: 14px; padding: 18px 16px; }
.goal .big { font-size: 34px; font-weight: 700; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.goal .big small { font-size: 17px; font-weight: 500; color: var(--hint); letter-spacing: 0; margin-left: 6px; }
.goal .track { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.goal .track i { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); }
.goal .track i.on { background: var(--tomato); border-color: var(--tomato); }
.goal p { margin: 12px 0 0; color: var(--hint); font-size: 14px; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 150px; background: var(--surface); border-radius: 14px; padding: 16px 14px 12px; }
.bars .col { flex: 1; display: grid; grid-template-rows: 1fr auto; justify-items: center; height: 100%; gap: 6px; }
.bars .stack { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; width: 100%; min-height: 0; }
.bars .val { font-size: 11.5px; color: var(--hint); margin-bottom: 3px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bars .bar { width: 100%; max-width: 30px; border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--tomato) 42%, transparent); min-height: 2px; }
.bars .col.today .bar { background: var(--tomato); }
.bars .lab { font-size: 12px; color: var(--hint); }
.bars .col.today .lab { color: var(--text); font-weight: 600; }
.stat-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 11px 14px; font-size: 15px; }
.stat-row .v { color: var(--hint); font-variant-numeric: tabular-nums; }
.stat-row .meter { grid-column: 1 / -1; height: 4px; border-radius: 2px; background: var(--fill); overflow: hidden; }
.stat-row .meter i { display: block; height: 100%; border-radius: 2px; background: var(--tomato); }
.note-line { color: var(--hint); font-size: 14px; margin: 16px 4px 0; }
/* Графики фокуса оживают при появлении; при тихом обновлении раз в минуту — без анимации */
.bars .bar { transform-origin: bottom; animation: bar-grow .55s cubic-bezier(.2, .8, .2, 1) both; }
.bars .col:nth-child(n+8) .bar { animation-delay: .04s; }
.bars .col { transition: opacity .15s; }
.bars:hover .col:not(:hover) { opacity: .55; }
@keyframes bar-grow { from { transform: scaleY(0); } }
.focus-box.live .bar, .focus-box.live .wk-line.this, .focus-box.live .wk-pair i { animation: none; }
/* Сегодня: идущий интервал — кружок наполняется; строка «Неделя» со сравнением */
.goal .track i.running { border-color: var(--tomato); background: conic-gradient(var(--tomato) calc(var(--p, 0) * 1%), transparent 0); }
.goal p.goal-hint { margin-top: 4px; font-size: 12.5px; }
.goal p.week-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; color: var(--text); font-weight: 600; }
.goal p.week-line small { flex-basis: 100%; color: var(--hint); font-weight: 400; font-size: 13px; }
.delta { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--rest); background: color-mix(in srgb, var(--rest) 14%, transparent); }
.delta.down { color: var(--hint); background: var(--fill); }
/* Неделя к неделе */
.week-compare { display: grid; gap: 0; padding: 16px 14px 12px; }
.wk-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wk-head .big { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.wk-head .big small { font-size: 15px; font-weight: 500; color: var(--hint); letter-spacing: 0; margin-left: 6px; white-space: nowrap; }
.wk-head .delta { font-size: 14px; padding: 3px 10px; }
.wk-sub { margin: 6px 0 10px; color: var(--hint); font-size: 13.5px; }
.wk-legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--hint); margin-bottom: 4px; }
.wk-legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: middle; background: var(--tomato); }
.wk-legend .last::before { background: repeating-linear-gradient(90deg, var(--hint) 0 4px, transparent 4px 7px); }
.wk-chart { display: block; width: 100%; height: auto; overflow: visible; touch-action: pan-y; cursor: crosshair; }
.wk-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; }
.wk-area { fill: color-mix(in srgb, var(--tomato) 13%, transparent); animation: fade-in .6s ease-out both; }
.wk-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.wk-line.last { stroke: var(--hint); stroke-width: 2; stroke-dasharray: 5 5; opacity: .75; }
.wk-line.this { stroke: var(--tomato); stroke-width: 3; stroke-dasharray: 1 2; animation: wk-draw .9s cubic-bezier(.3, .7, .2, 1) both; }
@keyframes wk-draw { from { stroke-dashoffset: 1; } }
.wk-cursor { stroke: var(--line); stroke-width: 1.5; }
.wk-dot.this { fill: var(--tomato); stroke: var(--surface); stroke-width: 2.5; }
.wk-dot.last { fill: var(--surface); stroke: var(--hint); stroke-width: 2; }
.wk-axis { display: flex; justify-content: space-between; padding: 4px 0 0; font-size: 12px; color: var(--hint); }
.wk-axis span { width: 0; display: flex; justify-content: center; white-space: nowrap; }
.wk-axis span:first-child { justify-content: flex-start; } .wk-axis span:last-child { justify-content: flex-end; }
.wk-axis .today { color: var(--text); font-weight: 600; }
.wk-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 64px; margin-top: 12px; }
.wk-pair { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; padding: 0 2px; border-radius: 8px; transition: background-color .15s; }
.wk-pair.on { background: var(--fill); }
.wk-pair i { width: 38%; max-width: 12px; border-radius: 4px 4px 1px 1px; transform-origin: bottom; animation: bar-grow .55s cubic-bezier(.2, .8, .2, 1) both; }
.wk-pair i.last { background: color-mix(in srgb, var(--hint) 45%, transparent); }
.wk-pair i.this { background: var(--tomato); }
.wk-pair.future i.this { display: none; }
.wk-readout { display: grid; gap: 2px; margin: 10px 2px 0; font-size: 13.5px; min-height: 3.9em; font-variant-numeric: tabular-nums; }
.wk-readout .this { color: var(--text); }
.wk-readout .last { color: var(--hint); }

/* ---------- кнопка добавления и вкладки ---------- */
#fab {
  position: fixed; right: max(var(--pad), calc(50vw - 320px + var(--pad))); bottom: calc(var(--tabs-h) + var(--safe-bottom) + 16px); z-index: 4;
  width: 54px; height: 54px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  display: grid; place-items: center; box-shadow: 0 3px 10px rgba(0, 0, 0, .18);
}
#fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
#tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; justify-content: center;
  height: calc(var(--tabs-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
#tabs button { flex: 1; max-width: 200px; display: grid; justify-items: center; align-content: center; gap: 2px; color: var(--hint); font-size: 11.5px; font-weight: 500; }
#tabs svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#tabs button[aria-current="page"] { color: var(--accent); }
#tabs button { position: relative; }
#tabs button svg { position: relative; z-index: 1; transition: transform .2s cubic-bezier(.3, 1.4, .5, 1); }
#tabs button::before {
  content: ""; position: absolute; top: 7px; left: 50%; width: 54px; height: 30px; margin-left: -27px; border-radius: 99px;
  background: var(--accent-soft); transform: scale(.4); opacity: 0; transition: transform .22s cubic-bezier(.3, 1.3, .5, 1), opacity .18s;
}
#tabs button[aria-current="page"]::before { transform: none; opacity: 1; }
#tabs button:active svg { transform: scale(.88); }

/* ---------- нижний лист ---------- */
#backdrop {
  position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0, 0, 0, 0); transition: background-color .26s ease;
}
#backdrop.open { background: rgba(0, 0, 0, .42); }
#sheet {
  width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--page); border-radius: 20px 20px 0 0; padding: 8px var(--pad) 0;
  transform: translateY(100%); transition: transform .3s cubic-bezier(.32, .72, 0, 1);
  will-change: transform; box-shadow: 0 -8px 30px rgba(0, 0, 0, .12);
}
#backdrop.open #sheet { transform: translateY(0); }
#sheet.dragging { transition: none; }
#backdrop:not(.open) #sheet { transition-duration: .24s; transition-timing-function: cubic-bezier(.4, 0, 1, 1); }
#sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 10px; }
#sheet > :last-child:not(.sheet-foot) { margin-bottom: calc(18px + var(--safe-bottom)); }
.sheet-foot {
  position: sticky; bottom: 0; margin: 16px calc(-1 * var(--pad)) 0;
  padding: 10px var(--pad) calc(12px + var(--safe-bottom));
  background: var(--page); border-top: 1px solid var(--line);
}
.sheet-foot .actions { margin-top: 0; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.sheet-head button { color: var(--accent); font-size: 16px; padding: 6px 0 6px 12px; }

#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabs-h) + var(--safe-bottom) + 14px); z-index: 20;
  display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
  background: var(--text); color: var(--page); border-radius: 12px; padding: 10px 14px; font-size: 14.5px;
}
#toast:not([hidden]) { animation: toast-in .24s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px) scale(.96); } }
#toast button { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }

.loading { height: 3px; border-radius: 2px; background: var(--fill); overflow: hidden; margin: 24px 0; }
.loading::after { content: ""; display: block; width: 40%; height: 100%; background: var(--accent); animation: slide 1s ease-in-out infinite alternate; }
@keyframes slide { to { transform: translateX(150%); } }

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

/* ---------- заметки: папки, порядок, закрепление ---------- */
.search.flush { margin-top: 0; }
.chips.sub { margin-top: 6px; }
.chips.sub .chip { background: transparent; border: 1px solid var(--line); padding: 5px 12px; }
.chips.sub .chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--text); border-color: transparent; }
.chips.sub .chip[aria-pressed="true"] .n { color: var(--hint); opacity: 1; }
.list.spaced { margin-top: 10px; }
.list-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 14px 4px 0; font-size: 14px; color: var(--hint); }
.list-bar button { color: var(--accent); font-weight: 500; padding: 4px 0; }
.order-row { display: flex; align-items: center; }
.order-row .note-row { flex: 1; min-width: 0; }
.order-row .arrow { flex: 0 0 auto; width: 42px; height: 42px; margin-right: 6px; border-radius: 10px; background: var(--fill); font-size: 18px; }
.order-row .arrow:disabled { opacity: .3; }
.actions.tight { margin-top: 8px; }
.paper.live .md li.todo { cursor: pointer; }

/* ---------- фокус: таймер ---------- */
.focus-box { margin-top: 14px; }
.seg.sub { margin-bottom: 14px; }
.timer-card { background: var(--surface); border-radius: 20px; padding: 22px 18px 18px; text-align: center; }
.ring { position: relative; width: min(244px, 68vw); aspect-ratio: 1; margin: 0 auto 8px; }
.ring svg { display: block; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--fill); stroke-width: 12; }
.ring .arc { fill: none; stroke: var(--tomato); stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.kind-break .arc { stroke: var(--rest); }
.kind-timer .arc { stroke: var(--medium); }
.is-paused .arc { opacity: .4; }
.is-paused .readout .time { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; } }
.readout { position: absolute; inset: 0; display: grid; place-content: center; gap: 4px; }
.readout .time { font-size: clamp(40px, 13vw, 56px); font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.readout .cap { font-size: 14px; color: var(--hint); }
.is-paused .readout .time { color: var(--hint); }
.timer-title { margin: 8px 0 3px; font-size: 20px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.timer-sub { margin: 0; color: var(--hint); font-size: 14.5px; }
.ends { margin: 4px 0 0; min-height: 1.4em; font-size: 14px; color: var(--hint); }
.timer-card .actions { margin-top: 16px; }

.pending { background: color-mix(in srgb, var(--tomato) 9%, var(--surface)); border-radius: 16px; padding: 16px; }
.pending h2 { margin: 0 0 3px; font-size: 18px; font-weight: 700; }
.pending p { margin: 0; color: var(--hint); font-size: 14.5px; overflow-wrap: anywhere; }
.pending .actions { margin-top: 14px; }
.actions.three .btn, .actions.two .btn { padding-inline: 6px; }

.tpl-row { display: flex; align-items: center; }
.tpl-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 11px 12px 11px 14px; text-align: left; }
.tpl-icon { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; background: var(--fill); display: grid; place-items: center; font-size: 19px; }
.tpl-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tpl-body .name { font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.tpl-body .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; font-size: 13px; color: var(--hint); overflow-wrap: anywhere; }
.tpl-play { flex: 0 0 auto; width: 36px; height: 36px; margin-right: 14px; border-radius: 50%; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-size: 12px; }
.tpl-edit { flex: 0 0 auto; width: 36px; height: 36px; margin-right: 6px; border-radius: 50%; color: var(--hint); display: grid; place-items: center; }
.tpl-edit .ic { width: 19px; height: 19px; }
.tpl-edit:active { background: var(--fill); }
.today-card { margin-top: 18px; }

/* поля шаблона */
.field .hint { display: block; margin: 5px 4px 0; font-size: 12.5px; color: var(--hint); }
select.input {
  appearance: none; -webkit-appearance: none; padding-right: 34px;
  background: var(--fill) right 12px center / 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23889' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
}
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 12px; padding: 10px 12px; border-radius: 11px; background: var(--fill); font-size: 15.5px; cursor: pointer; }
.switch-row small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--hint); }
input.switch { appearance: none; -webkit-appearance: none; flex: 0 0 auto; position: relative; width: 46px; height: 28px; margin: 0; border-radius: 99px; background: var(--low); cursor: pointer; transition: background .15s; }
input.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
input.switch:checked { background: var(--accent); }
input.switch:checked::after { transform: translateX(18px); }

/* ---------- фокус: статистика ---------- */
.card { background: var(--surface); border-radius: 14px; padding: 14px; }
.summary .big { font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.summary .big small { display: block; margin-top: 4px; font-size: 14.5px; font-weight: 400; letter-spacing: 0; color: var(--hint); }
.summary .streak { margin: 12px 0 0; font-size: 15px; color: var(--hint); }
.summary .streak.on { color: var(--text); font-weight: 600; }
.summary ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; color: var(--hint); }
.summary li { margin: 3px 0; }

.heat { display: grid; grid-template-columns: 20px repeat(13, 1fr); gap: 3px; align-items: center; }
.heat .mon { height: 14px; font-size: 11px; color: var(--hint); white-space: nowrap; }
.heat .wd { font-size: 10.5px; color: var(--hint); }
.cell { display: block; min-width: 0; aspect-ratio: 1; padding: 0; border-radius: 3px; background: var(--fill); }
.cell.l1 { background: color-mix(in srgb, var(--tomato) 28%, var(--fill)); }
.cell.l2 { background: color-mix(in srgb, var(--tomato) 52%, var(--fill)); }
.cell.l3 { background: color-mix(in srgb, var(--tomato) 76%, var(--fill)); }
.cell.l4 { background: var(--tomato); }
.cell.future { background: transparent; }
.cell.is-today { outline: 2px solid var(--hint); outline-offset: 1px; }
.legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; font-size: 12px; color: var(--hint); }
.legend .cell { width: 11px; height: 11px; }
.legend .cell:first-of-type { margin-left: 4px; }
.legend .cell:last-of-type { margin-right: 4px; }

.bars.dense { gap: 2px; padding-inline: 10px; }
.bars.dense .bar { border-radius: 3px 3px 1px 1px; min-height: 0; }
.bars.dense .lab { font-size: 10.5px; white-space: nowrap; overflow: visible; }
.bars .col { min-width: 0; grid-template-columns: minmax(0, 1fr); }   /* подпись не раздвигает столбец */

/* ---------- фокус: журнал ---------- */
.log-row { display: flex; align-items: baseline; gap: 12px; width: 100%; padding: 11px 14px; text-align: left; }
.log-row .at { flex: 0 0 auto; width: 42px; font-size: 14px; color: var(--hint); font-variant-numeric: tabular-nums; }
.log-row:disabled { opacity: 1; cursor: default; }
.badge { padding: 1px 7px; border-radius: 99px; background: var(--fill); font-size: 11.5px; color: var(--hint); }

/* ---------- вход в обычном браузере ---------- */
#logout { color: var(--accent); font-size: 15px; padding: 6px 2px; }
.login { max-width: 400px; margin: 8vh auto 0; background: var(--surface); border-radius: 20px; padding: 24px 20px; }
.login h2 { margin: 0 0 12px; font-size: 22px; font-weight: 700; }
.login ol { margin: 0 0 18px; padding-left: 20px; color: var(--hint); font-size: 15px; line-height: 1.5; }
.login code { font-family: var(--mono); color: var(--text); background: var(--fill); padding: 1px 6px; border-radius: 5px; }
.code-input {
  display: block; width: 100%; border: 0; border-radius: 12px; background: var(--fill); padding: 14px 16px;
  font: 600 30px/1 var(--mono); letter-spacing: .12em; text-align: center; font-variant-numeric: tabular-nums;
}
.login-error { min-height: 1.4em; margin: 8px 2px 10px; color: var(--danger); font-size: 14px; }
.login-note { margin: 14px 2px 0; color: var(--hint); font-size: 13px; }

/* v9.2: вход — знак, QR-код и код /web рядом (на телефоне — друг под другом) */
.login-wrap { max-width: 840px; margin: 4vh auto 0; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 18px; font-size: 22px; font-weight: 700; letter-spacing: .02em; }
.brand-mark { display: inline-grid; width: 36px; height: 36px; color: var(--accent); }
.brand-mark svg { width: 100%; height: 100%; }
.login-grid { display: grid; gap: 14px; }
.login-grid .login { margin: 0; max-width: none; }
@media (min-width: 760px) { .login-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.login-wrap > .login-note { text-align: center; }
.qr-login { display: flex; flex-direction: column; }
.qr-hint { margin: -4px 0 14px; }
.qr-img { align-self: center; width: 208px; height: 208px; border-radius: 14px; overflow: hidden; background: #fff; box-shadow: inset 0 0 0 1px var(--line); transition: opacity .2s; }
.qr-img svg { display: block; width: 100%; height: 100%; }
.qr-img.faded { opacity: .2; }
.qr-meta { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 30px; margin-top: 8px; }
.qr-timer { color: var(--hint); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.qr-state { text-align: center; min-height: 1.2em; margin: 0 0 10px; font-size: 14px; color: var(--text); }
.qr-login .btn { margin-top: auto; }
a.btn { color: inherit; text-decoration: none; }

/* v9.2: таблица задач на широком экране */
.table-bar { display: flex; gap: 10px; align-items: center; }
.table-bar > .seg:not(.view-toggle), .table-bar > .search { flex: 1; margin: 0; }
.view-toggle { flex: none; width: 210px; }
.table-box { margin-top: 14px; }
.table-wrap { background: var(--surface); border-radius: 14px; overflow: hidden; }
.task-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 14.5px; }
.task-table th { text-align: left; font-weight: 500; color: var(--hint); font-size: 13px; padding: 0; border-bottom: 1px solid var(--line); }
.task-table th button { width: 100%; text-align: left; padding: 11px 12px; color: inherit; font: inherit; }
.task-table th button:hover { color: var(--text); }
.task-table th[aria-sort="ascending"], .task-table th[aria-sort="descending"] { color: var(--accent); }
.task-table td { padding: 10px 12px; border-top: 1px solid var(--line); vertical-align: middle; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-table tbody tr:first-child td { border-top: 0; }
.task-table tbody tr { cursor: pointer; transition: background-color .12s; }
.task-table tbody tr:hover { background: var(--fill); }
.task-table .c-check { width: 46px; }
.task-table .c-due { width: 150px; }
.task-table .c-prio { width: 120px; }
.task-table .c-tags { width: 130px; }
.task-table .c-repeat { width: 140px; }
.task-table td.late { color: var(--high); font-weight: 500; }
.task-table td.muted { color: var(--hint); }
.task-table tr.draft .tbl-title { color: var(--hint); }
.tbl-title { white-space: normal !important; overflow-wrap: anywhere; }
.tbl-badge { margin-left: 8px; padding: 1px 7px; border-radius: 99px; background: var(--fill); font-size: 12px; color: var(--hint); }
.tbl-check { display: grid; place-items: center; width: 24px; height: 24px; }
.tbl-check i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--low); transition: background-color .15s, border-color .15s; }
.tbl-check:hover i { border-color: var(--accent); }
tr.checking .tbl-check i { background: var(--accent); border-color: var(--accent); }
.prio { display: inline-flex; align-items: center; gap: 6px; }
.prio::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--low); }
.prio.high::before { background: var(--high); }
.prio.medium::before { background: var(--medium); }

/* ---------- широкий экран (браузер на компьютере) ---------- */
@media (min-width: 900px) {
  body > header, body > main, #banner { max-width: 820px; }
  #top { padding-top: 24px; }
  #backdrop { align-items: center; }
  #sheet { max-width: 620px; max-height: 88vh; border-radius: 20px; transform: scale(.96); opacity: 0; transition: transform .22s ease, opacity .22s ease; }
  #backdrop.open #sheet { transform: none; opacity: 1; }
  #sheet::before { display: none; }
  .sheet-foot { border-radius: 0 0 20px 20px; }
  #tabs { top: 0; bottom: auto; height: 54px; padding: 0; border-top: 0; border-bottom: 1px solid var(--line); justify-content: center; }
  #tabs button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; max-width: 170px; font-size: 14.5px; }
  #tabs svg { width: 20px; height: 20px; }
  /* Подсветка активной вкладки — по размеру содержимого (иконка + текст), по центру по вертикали.
     Мобильная «пилюля» 54×30 у верхнего края съезжала на текст и не накрывала иконку. */
  #tabs button { padding: 0 16px; flex: 0 1 auto; min-width: 120px; }
  #tabs button > * { position: relative; z-index: 1; }
  #tabs button::before { top: 9px; bottom: 9px; left: 4px; right: 4px; width: auto; height: auto; margin-left: 0; border-radius: 10px; }
  #tabs button:hover:not([aria-current="page"]) { color: var(--text); }
  #tabs button:hover:not([aria-current="page"])::before { transform: none; opacity: .5; background: var(--fill); }
  body.has-tabs { padding-top: 54px; }
  #view { padding-bottom: 90px; }
  #fab { bottom: 32px; right: max(32px, calc(50vw - 410px + 24px)); }
  #toast { bottom: 32px; }
  .list .task .body, .note-row { cursor: pointer; }
  .timer-card { padding: 30px 24px 24px; }
}

/* ---------- ARVIS Pro: темы, знак, экран Pro, встреча ---------- */
:root { --gold-1: #f7d774; --gold-2: #d4a017; --gold-3: #a8740a; }
html[data-theme="gold"] {
  --accent: #b8860b;
  --on-accent: #fff;
  --accent-soft: color-mix(in srgb, #d4a017 16%, transparent);
}
html[data-theme="midnight"] {
  --page: #0b1020; --surface: #141a2e; --text: #e8ecf8; --hint: #8f9bb8;
  --accent: #8aa4ff; --on-accent: #0b1020; --line: rgba(143, 155, 184, .22);
  color-scheme: dark;
}
html[data-theme="emerald"] { --accent: #13976f; --on-accent: #fff; --accent-soft: color-mix(in srgb, #13976f 16%, transparent); }
html[data-theme="sakura"] { --accent: #d4508a; --on-accent: #fff; --accent-soft: color-mix(in srgb, #d4508a 16%, transparent); }
html[data-scheme="dark"][data-theme="gold"] { --accent: #e3b341; --on-accent: #1a1405; }
html[data-scheme="dark"][data-theme="emerald"] { --accent: #3cc79a; --on-accent: #06140f; }
html[data-scheme="dark"][data-theme="sakura"] { --accent: #f07aaf; --on-accent: #1d0812; }

html[data-theme="ocean"] { --accent: #0f86a8; --on-accent: #fff; --accent-soft: color-mix(in srgb, #0f86a8 15%, transparent); }
html[data-theme="sunset"] { --accent: #d9622b; --on-accent: #fff; --accent-soft: color-mix(in srgb, #d9622b 15%, transparent); }
html[data-theme="lavender"] { --accent: #7a5cc8; --on-accent: #fff; --accent-soft: color-mix(in srgb, #7a5cc8 15%, transparent); }
html[data-theme="graphite"] {
  --page: #f1f1f0; --surface: #ffffff; --text: #1b1b1a; --hint: #75736f;
  --accent: #2b2b29; --on-accent: #fff; --line: rgba(60, 58, 54, .16);
  color-scheme: light;
}
html[data-scheme="dark"][data-theme="ocean"] { --accent: #3fb6d6; --on-accent: #051419; }
html[data-scheme="dark"][data-theme="sunset"] { --accent: #f08a55; --on-accent: #1e0c03; }
html[data-scheme="dark"][data-theme="lavender"] { --accent: #a58cf0; --on-accent: #120a24; }
html[data-scheme="dark"][data-theme="graphite"] {
  --page: #121212; --surface: #1c1c1c; --text: #ececea; --hint: #8f8d89;
  --accent: #ececea; --on-accent: #121212; --line: rgba(236, 236, 234, .12);
  color-scheme: dark;
}

/* ---------- иконки ---------- */
.ic { display: inline-grid; place-items: center; width: 22px; height: 22px; flex: none; }
.ic svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ic.sm { width: 16px; height: 16px; vertical-align: -3px; }
.btn .ic.sm { margin-right: 6px; }
.btn:has(.ic) { display: inline-flex; align-items: center; justify-content: center; }
.tpl-icon .ic { width: 21px; height: 21px; }
.tpl-play .ic { width: 15px; height: 15px; }
.tpl-play .ic svg { fill: currentColor; stroke-width: 1.2; }
.tpl-play { padding-left: 1px; }
.task .meta .repeat .ic, .note-row .pin .ic { color: var(--hint); }
.note-row .pin { margin-right: 4px; }
.lock-line .ic { margin-right: 6px; }

/* ---------- знак тарифа ---------- */
#plan-badge { flex: none; display: inline-flex; align-items: center; gap: 4px; border-radius: 8px; padding: 5px 9px; font-size: 13px; font-weight: 700; letter-spacing: .04em; }
#plan-badge.badge-free { background: var(--fill); color: var(--hint); }
#plan-badge.badge-pro { background: var(--accent-soft); color: var(--accent); }
#plan-badge .ic { width: 14px; height: 14px; }
#plan-badge .ic svg { fill: currentColor; stroke-width: 1.2; }

.btn.gold { background: var(--gold-2); color: #2a1d00; font-weight: 700; }

/* ---------- нижний лист: заголовок не уезжает при прокрутке ---------- */
#sheet .sheet-head {
  position: sticky; top: -8px; z-index: 2; margin: -8px calc(-1 * var(--pad)) 0; padding: 12px var(--pad) 10px;
  background: var(--page); border-bottom: 1px solid transparent;
}

/* ---------- экран Pro ---------- */
.pro-hero { border-radius: 14px; padding: 14px 16px; background: var(--surface); margin: 8px 0 4px; border: 1px solid var(--line); }
.pro-hero.is-pro { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.pro-status { margin: 0 0 8px; color: var(--hint); font-size: 14px; }
.streak { display: flex; align-items: center; gap: 8px; }
.streak b { font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.streak .flame { width: 26px; height: 26px; color: var(--tomato); }
.streak span:last-child { color: var(--hint); font-size: 14px; }
.pro-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 22px 0 10px; font-size: 15px; font-weight: 700; }
.pro-h-count { color: var(--hint); font-weight: 500; font-size: 14px; font-variant-numeric: tabular-nums; }

.next-goal { display: flex; gap: 12px; align-items: center; padding: 12px 14px; margin-bottom: 8px; border-radius: 14px; background: var(--accent-soft); }
.next-body { display: grid; gap: 2px; min-width: 0; flex: 1; font-size: 14px; }
.next-label { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); }
.next-body b { font-size: 16px; }
.next-goal .ach-icon { background: var(--surface); color: var(--accent); }

.achs { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ach { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.ach-icon { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--fill); color: var(--hint); }
.ach-icon .ic { width: 20px; height: 20px; }
.ach-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; font-size: 13px; }
.ach-text b { font-size: 14px; line-height: 1.25; }
.ach-hint { color: var(--hint); }
.ach-foot { margin-top: 6px; font-size: 12px; color: var(--hint); font-variant-numeric: tabular-nums; }
.ach-bar { display: block; width: 100%; height: 4px; border-radius: 2px; background: var(--fill); margin-top: 4px; overflow: hidden; }
.ach-bar i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.ach.done { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.ach.done .ach-icon { background: var(--accent); color: var(--on-accent); }
.ach.done .ach-foot { color: var(--accent); font-weight: 600; }
.ach.locked { opacity: .6; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }
.choice[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.choices.is-locked .choice { color: var(--hint); }

.features { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.features li { display: flex; gap: 10px; align-items: center; }
.features li .ic { color: var(--accent); }
.features.is-locked li, .features.is-locked li .ic { color: var(--hint); }

.invite { margin: 24px 0 4px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.invite-head { display: flex; gap: 12px; align-items: flex-start; }
.invite-head > .ic { width: 26px; height: 26px; color: var(--accent); margin-top: 2px; }
.invite-head b { font-size: 16px; }
.invite-head p { margin: 2px 0 0; color: var(--hint); font-size: 14px; }
.invite .actions { margin-top: 12px; }
.invite .btn { padding: 10px 8px; font-size: 15px; }

.locked-field { text-align: left; width: 100%; }
.lock-line { color: var(--hint); }
.locked-field .lock-line { display: flex; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--fill); }

/* ---------- встреча после оплаты ---------- */
.welcome { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .55); animation: fade-in .25s ease both; }
.welcome.leaving { animation: fade-out .25s ease both; }
.welcome-card { width: min(420px, 100%); background: var(--surface); color: var(--text); border-radius: 18px; padding: 24px 20px 20px; box-shadow: 0 12px 40px rgba(0, 0, 0, .3); animation: pop .32s cubic-bezier(.2, .9, .3, 1.15) both; }
.welcome-card h2 { margin: 10px 0 6px; font-size: 21px; }
.welcome-card p { margin: 0 0 16px; color: var(--hint); }
.welcome-card .features { margin-bottom: 20px; }
.welcome-card .features li { animation: lift .3s ease both; animation-delay: calc(.1s + var(--i) * .04s); }
.welcome-card .btn { width: 100%; }
.welcome-star { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.welcome-star .ic svg { fill: currentColor; stroke-width: 1.2; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes lift { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .welcome, .welcome-card, .welcome-card .features li, #sheet { animation: none !important; opacity: 1 !important; }
  #sheet, #backdrop { transition: none !important; }
}

/* ---------- заглушки загрузки ---------- */
.skel { display: grid; gap: 1px; margin-top: 14px; background: var(--surface); border-radius: 14px; overflow: hidden; }
.paper .skel { margin: 0; background: none; }
.skel-row { display: grid; gap: 8px; padding: 14px; }
.skel-row i { display: block; height: 12px; border-radius: 6px; background: var(--fill); position: relative; overflow: hidden; }
.skel-row i + i { width: 30%; height: 10px; }
.skel-row i::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 7%, transparent), transparent);
  animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }

/* ---------- свайп по задаче ---------- */
.swipe { position: relative; overflow: hidden; }
.swipe > .task { position: relative; z-index: 1; background: var(--surface); touch-action: pan-y; transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.swipe-under { position: absolute; inset: 0; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; font-size: 15px; font-weight: 600; color: #fff; }
.swipe-act { display: inline-flex; align-items: center; gap: 8px; opacity: 0; transform: scale(.85); transition: opacity .15s, transform .2s; }
.swipe-act .ic { width: 22px; height: 22px; }
.swipe.go-done .swipe-under { background: var(--rest); }
.swipe.go-later .swipe-under { background: #3f7ae0; }   /* не цвет темы: в зелёной теме совпал бы с «Готово» */
.swipe.go-done .swipe-act.done, .swipe.go-later .swipe-act.later { opacity: .7; }
.swipe.ready .swipe-act { transform: scale(1.08); }
.swipe.ready.go-done .swipe-act.done, .swipe.ready.go-later .swipe-act.later { opacity: 1; }

/* галочка «прорисовывается» сразу при нажатии */
.task.checking .check i { border-color: var(--accent); background: var(--accent) center / 14px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.3l2.7 2.7L11 4.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); animation: check-pop .3s cubic-bezier(.3, 1.6, .5, 1); }
.task.checking .name { color: var(--hint); text-decoration: line-through; transition: color .2s; }
.task.unchecking .check i { background: none; border-color: var(--low); }
@keyframes check-pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } }
.task .meta .subs { display: inline-flex; align-items: center; gap: 3px; }
.task .meta .subs.all { color: var(--rest); }

/* ---------- быстрый ввод ---------- */
.quick-add { margin-top: 12px; }
.quick-box { display: flex; align-items: center; gap: 6px; background: var(--surface); border-radius: 13px; padding: 4px 4px 4px 14px; }
.quick-input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 9px 0; font-size: 16px; outline: none; }
.quick-input::placeholder { color: var(--hint); }
.quick-box:focus-within { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.quick-send { flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.quick-send:disabled { background: var(--fill); color: var(--hint); }
.quick-send .ic { width: 16px; height: 16px; }
.quick-send .ic svg { fill: currentColor; stroke-width: 1.2; }
.quick-hint { display: flex; flex-wrap: wrap; gap: 6px; max-height: 0; overflow: hidden; opacity: 0; transition: max-height .2s, opacity .2s, margin .2s; }
.quick-hint.on { max-height: 80px; opacity: 1; margin-top: 7px; }
.quick-hint span { padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 500; }

/* ---------- подзадачи ---------- */
.subs-list { display: grid; gap: 2px; }
.sub { display: flex; align-items: center; gap: 8px; }
.field .sub input { background: transparent; padding-left: 4px; min-height: 38px; }
.field .sub input:focus { box-shadow: none; background: var(--fill); }
.sub.done input { color: var(--hint); text-decoration: line-through; }
.sub-check { flex: none; width: 34px; height: 34px; display: grid; place-items: center; }
.sub-check i { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--low); transition: background-color .15s, border-color .15s; }
.sub.done .sub-check i { border-color: var(--accent); background: var(--accent) center / 12px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3 7.3l2.7 2.7L11 4.5' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); animation: check-pop .3s cubic-bezier(.3, 1.6, .5, 1); }
.sub-del { flex: none; width: 34px; height: 34px; color: var(--hint); font-size: 22px; line-height: 1; }
.subs-list + input { margin-top: 4px; }
/* v9.10: прогресс шагов, ручка для перетаскивания, «дальше: …» в строке задачи */
.subs-field .label { display: flex; justify-content: space-between; align-items: baseline; }
.sub-count { color: var(--hint); font-weight: 500; font-variant-numeric: tabular-nums; }
.sub-progress { height: 5px; border-radius: 99px; background: var(--fill); overflow: hidden; margin: 2px 0 6px; }
.sub-progress i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width .3s ease; }
.sub-progress.full i { background: var(--rest); }
.sub-grip { flex: none; width: 16px; margin-right: -6px; color: var(--hint); font-size: 13px; letter-spacing: -2px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; opacity: .55; text-align: center; }
.sub.dragging { background: var(--fill); border-radius: 10px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); }
.sub.dragging .sub-grip { cursor: grabbing; opacity: 1; }
.split-btn { margin-top: 8px; align-self: flex-start; }
/* v9.12: подзадачи — отдельные задачи: строка открывает карточку подзадачи, под названием — когда */
.sub-title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 7px 4px; min-height: 38px; justify-content: center; }
.sub-title span { overflow-wrap: anywhere; }
.sub-title small { color: var(--hint); font-size: 12.5px; }
.sub.done .sub-title span { color: var(--hint); text-decoration: line-through; }
.sub.p-high .sub-title span::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--high, #e5484d); margin-right: 6px; vertical-align: middle; }
.sub-check:disabled { opacity: .45; }
.parent-link { display: flex; align-items: center; gap: 4px; max-width: 100%; margin: -4px 0 10px; color: var(--accent); font-size: 14.5px; font-weight: 500; text-align: left; }
.parent-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task .meta .parent-ref { flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--accent); }
.remind-extra { display: grid; gap: 6px; margin-top: 6px; }
.remind-extra .row { display: flex; gap: 6px; align-items: center; }
.remind-extra .row input { flex: 1; min-width: 0; }
.remind-extra .link-btn { justify-self: start; }
.task .meta .next-step { flex: 1 1 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); opacity: .72; }
.task.is-done .meta .next-step { display: none; }

/* ---------- v9.10: закреплённые теги ---------- */
.tag-bar { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 10px 0 2px; padding-bottom: 2px; }
.tag-bar::-webkit-scrollbar { display: none; }
.tag-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line); font-size: 14px; white-space: nowrap; color: var(--text); background: transparent; }
.tag-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tag-chip.edit { color: var(--hint); }
.tag-chip:disabled { opacity: .4; }
.pin-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 14px; }

/* ---------- автосохранение заметки ---------- */
.save-state { transition: color .2s; }
.save-state.ok { color: var(--rest); }
.save-state.bad { color: var(--danger); }

/* ---------- знакомство и карточка недели ---------- */
.welcome-card.onboard { text-align: center; }
.welcome-card.onboard .welcome-star { margin: 0 auto; }
.welcome-card.onboard .welcome-star .ic svg { fill: none; stroke-width: 1.7; }
.welcome-card.onboard.slide h2, .welcome-card.onboard.slide p, .welcome-card.onboard.slide .welcome-star { animation: lift .3s ease both; }
.welcome-card.onboard p { min-height: 4.4em; }
.dots { display: flex; justify-content: center; gap: 6px; margin: 4px 0 18px; }
.dots i { width: 7px; height: 7px; border-radius: 99px; background: var(--line); transition: width .25s, background-color .25s; }
.dots i.on { width: 20px; background: var(--accent); }
.onboard-skip { display: block; margin: 12px auto 0; color: var(--hint); font-size: 14.5px; padding: 6px 10px; }
.share-btn { margin-top: 10px; }

/* ---------- общий календарь (v9) ---------- */
/* Цвета участников: c0 — создатель, дальше по порядку вступления. */
.c0 { --who: var(--accent); }
.c1 { --who: #d9488f; }
.c2 { --who: #2f9e74; }
.c3 { --who: #e19a24; }
.c4 { --who: #8a63d2; }
.hint { color: var(--hint); font-size: 14px; margin: 10px 4px 0; line-height: 1.4; }
.ic.lg { width: 44px; height: 44px; color: var(--accent); margin-bottom: 10px; }
.cal-empty .btn { margin-top: 18px; }
.cal-hint { text-align: center; margin: 6px 0 0; }
.month-box { background: var(--surface); border-radius: 14px; padding: 10px 8px 8px; margin-top: 12px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 8px; }
.month-nav strong { font-size: 16px; font-weight: 600; }
.month-nav button { width: 36px; height: 32px; border-radius: 10px; font-size: 22px; line-height: 1; color: var(--accent); }
.month-nav button:active { background: var(--fill); }
.month-head, .month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.month-head span { text-align: center; font-size: 12px; color: var(--hint); padding-bottom: 4px; }
.month-head .weekend { color: var(--high); }
.mday { display: grid; justify-items: center; align-content: start; gap: 3px; height: 46px; padding-top: 6px; border-radius: 10px; }
.mday .num { font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.mday.other .num { color: var(--hint); opacity: .55; }
.mday.today .num { color: var(--accent); font-weight: 700; }
.mday[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.mday[aria-pressed="true"] .num { color: inherit; opacity: 1; }
.mday:active { background: var(--fill); }
.mdots { display: flex; gap: 3px; height: 6px; }
.mdots i { width: 6px; height: 6px; border-radius: 50%; background: var(--who); }
.mday[aria-pressed="true"] .mdots i { background: currentColor; opacity: .9; }
.event { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; padding: 12px 14px 12px 12px; border-left: 4px solid var(--who); }
.event:active { background: var(--fill); }
.event .time { flex: 0 0 auto; min-width: 46px; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 1px; }
.event .body { flex: 1; min-width: 0; }
.event .name { display: block; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere; }
.event .meta { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 3px; font-size: 13px; color: var(--hint); }
.event .meta .late { color: var(--high); }
.rsvp-mark.no { color: var(--high); font-weight: 700; }
.members .member { display: flex; align-items: center; gap: 10px; padding: 10px 12px; }
.members .member .name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--who); flex: none; }
.invite-link { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: var(--fill); font-family: var(--mono); font-size: 13px; overflow-wrap: anywhere; user-select: all; }

/* ---------- настройки (v9) ---------- */
#settings-btn { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--fill); color: var(--hint); }
#settings-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
#settings-btn:active { transform: scale(.92); }
#top.page #settings-btn { display: none; }
/* На узком экране язык — в настройках, шапке нужно место под заголовок. */
@media (max-width: 440px) { #lang-wrap { display: none; } }
.settings { padding-bottom: 32px; }
.settings-intro { margin: 4px 4px 0; }
.set-group { background: var(--surface); border-radius: 14px; padding: 2px 12px 12px; }
.set-group > .switch-row { background: none; padding: 10px 0; margin-top: 0; border-radius: 0; }
.set-group > * + * { border-top: 1px solid var(--line); }
.set-group > .btn { margin-top: 12px; border-top: 0; }
.set-group > .hint { border-top: 0; }
.set-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 15.5px; }
.set-line > span { min-width: 0; }
.set-line small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--hint); }
.set-line select.input, .set-line .time-input { width: auto; max-width: 58%; flex: none; padding: 7px 10px; }
.num-row { display: flex; align-items: center; gap: 6px; flex: none; }
.num-row .input { width: 72px; padding: 7px 10px; text-align: center; }
.hint.inline { margin: 0; font-size: 14.5px; }
.switch-row.locked { width: 100%; text-align: left; color: var(--hint); }
.set-line select.input { padding-right: 30px; text-overflow: ellipsis; }

/* ---------- 17.11.2026: шапка, «Спросить ARVIS», настройки, календарь ---------- */

/* Шапка прилипает к верху. Пока список не прокручен — она сливается с фоном; при прокрутке
   появляется тонкий разделитель и лёгкое размытие под ним (раньше границы между шапкой и списком не было). */
#top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: box-shadow .2s ease;
}
#top.scrolled { box-shadow: 0 1px 0 var(--line); }
#title { min-width: 0; }
#top:not(.page) #title { font-size: clamp(24px, 7.2vw, 28px); }
@media (min-width: 900px) { body.has-tabs #top { top: 54px; } }

/* Переключатель режима: легче и чище — светлая подложка, выбранный пункт цветом темы */
#view > .seg:first-child { margin-top: 2px; }
.seg { background: color-mix(in srgb, var(--text) 5%, transparent); border-radius: 12px; padding: 3px; }
.seg button { padding: 8px 4px; border-radius: 9px; font-weight: 500; transition: color .15s, background-color .15s, box-shadow .15s; }
.seg button[aria-pressed="true"] { color: var(--accent); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 0 0 .5px var(--line); }
.quick-box { box-shadow: inset 0 0 0 1px var(--line); }

/* Кнопка AI: слева внизу, «+» — справа, на одной линии */
#ask {
  position: fixed; left: max(var(--pad), calc(50vw - 320px + var(--pad))); bottom: calc(var(--tabs-h) + var(--safe-bottom) + 19px); z-index: 4;
  display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 18px 0 14px; border-radius: 24px;
  background: var(--surface); color: var(--text); font-size: 15px; font-weight: 600;
  box-shadow: 0 3px 12px rgba(0, 0, 0, .14), inset 0 0 0 1px var(--line);
  transition: transform .12s ease;
}
#ask svg { width: 21px; height: 21px; fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.6; stroke-linejoin: round; }
#ask:active { transform: scale(.96); }
@media (min-width: 900px) { #ask { bottom: 35px; left: max(32px, calc(50vw - 410px + 24px)); } }

/* Лист AI: переписка сверху, поле ввода прижато к низу */
#sheet.ai-sheet { display: flex; flex-direction: column; height: 86vh; overflow: hidden; }
#sheet.ai-sheet > :last-child { margin-bottom: 0; }
@media (min-width: 900px) { #sheet.ai-sheet { height: min(720px, 86vh); } }
.ai-log { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding: 12px 2px 10px; }
.ai-log > .skel { margin-top: 0; }
.ai-msg { max-width: 86%; padding: 9px 13px; border-radius: 16px; font-size: 15.5px; line-height: 1.42; overflow-wrap: anywhere; white-space: pre-wrap; }
.ai-msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); border-bottom-right-radius: 5px; }
.ai-msg.bot { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 5px; }
.ai-msg.failed { opacity: .55; }
.ai-msg.limit { background: var(--accent-soft); }
.ai-msg.voice { display: inline-flex; align-items: flex-start; gap: 6px; }
.ai-msg.voice .ic { width: 16px; height: 16px; margin-top: 3px; flex: none; }
.ai-msg code { font-family: var(--mono); font-size: 13.5px; background: var(--fill); padding: 1px 4px; border-radius: 5px; }
.ai-msg pre { white-space: pre-wrap; font-family: var(--mono); font-size: 13px; margin: 4px 0; }
.ai-msg blockquote { margin: 4px 0; padding-left: 10px; border-left: 3px solid var(--line); color: var(--hint); }
.ai-msg .task-ref { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ai-msg.user .task-ref { color: inherit; }
.ai-msg.typing { display: inline-flex; gap: 4px; padding: 13px 15px; }
.ai-msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--hint); animation: ai-dot 1s infinite ease-in-out; }
.ai-msg.typing i:nth-child(2) { animation-delay: .15s; }
.ai-msg.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.ai-empty { margin: auto 0; text-align: center; color: var(--hint); font-size: 14.5px; }
.ai-empty p { margin: 0 12px 12px; }
.ai-empty .quick { justify-content: center; }
.ai-drafts { display: grid; gap: 8px; align-self: stretch; }
.ai-draft { background: var(--surface); border-radius: 14px; padding: 12px; box-shadow: inset 0 0 0 1.5px var(--accent-soft); }
.ai-draft.busy { opacity: .6; pointer-events: none; }
.ai-draft-main strong { display: block; font-weight: 600; }
.ai-draft-main small { display: block; margin-top: 2px; color: var(--hint); font-size: 13px; }
.ai-draft-actions { display: grid; grid-template-columns: 1fr 1fr 44px; gap: 6px; margin-top: 10px; }
.ai-draft-done { color: var(--hint); font-size: 14px; }
.ai-draft-actions.two { grid-template-columns: 1fr 1fr; }
.btn.small { padding: 9px 10px; font-size: 14.5px; border-radius: 10px; }
.ai-quota { margin: 0 4px 6px; font-size: 12.5px; color: var(--hint); text-align: center; }
.ai-compose {
  display: flex; align-items: flex-end; gap: 6px; margin: 0 calc(-1 * var(--pad));
  padding: 8px var(--pad) calc(10px + var(--safe-bottom)); border-top: 1px solid var(--line); background: var(--page);
}
.ai-input {
  flex: 1; min-width: 0; resize: none; border: 0; outline: 0; border-radius: 20px; padding: 10px 14px;
  background: var(--surface); font-size: 16px; line-height: 1.35; max-height: 160px;
}
.ai-input:focus { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent); }
.ai-send, .ai-mic { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; transition: transform .12s ease, background-color .15s; }
.ai-send { background: var(--accent); color: var(--on-accent); }
.ai-send:disabled { background: var(--fill); color: var(--hint); }
.ai-mic { background: var(--fill); color: var(--text); }
.ai-send .ic, .ai-mic .ic { width: 20px; height: 20px; }
.ai-send:active:not(:disabled), .ai-mic:active { transform: scale(.92); }
.ai-compose.recording .ai-mic { background: var(--high); color: #fff; }
/* Картинка к сообщению (Ctrl+V, перетаскивание, кнопка) */
.ai-attach { flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--hint); transition: color .15s, transform .12s ease; }
.ai-attach .ic { width: 22px; height: 22px; }
.ai-attach:hover:not(:disabled) { color: var(--text); }
.ai-attach:active:not(:disabled) { transform: scale(.92); }
.ai-compose.drop { box-shadow: inset 0 0 0 2px var(--accent); }
.ai-photo { display: flex; align-items: center; gap: 10px; margin: 0 0 8px; padding: 6px 8px 6px 6px; border-radius: 12px; background: var(--surface); font-size: 14px; color: var(--hint); animation: fade-in .15s ease-out; }
.ai-photo img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; }
.ai-photo span { flex: 1; min-width: 0; }
.ai-photo .link-btn { font-size: 22px; line-height: 1; padding: 4px 8px; color: var(--hint); }
.ai-msg.photo { display: grid; gap: 6px; padding: 4px; width: fit-content; }
.ai-msg.photo img { display: block; max-width: min(240px, 100%); max-height: 260px; border-radius: 12px; }
.ai-msg.photo span { padding: 2px 8px 4px; }
.stop-square { width: 14px; height: 14px; border-radius: 3px; background: currentColor; }
.ai-rec { flex: 1; min-height: 42px; display: flex; align-items: center; gap: 8px; padding: 0 6px; font-size: 14.5px; }
.ai-rec span { flex: 1; font-variant-numeric: tabular-nums; }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--high); animation: rec-blink 1s infinite; }
@keyframes rec-blink { 50% { opacity: .25; } }
.link-btn { color: var(--accent); font-size: 14.5px; font-weight: 500; padding: 6px 2px; }

/* Настройки: «о себе», кнопка с пояснением, заглушка в форме экрана */
.about-box { padding: 10px 0 12px; }
.about-title { display: block; font-size: 15.5px; margin-bottom: 8px; }
.about-title small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--hint); }
.about-input { width: 100%; resize: none; line-height: 1.45; }
.about-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.about-foot .btn { width: auto; }
.about-count { font-size: 12.5px; color: var(--hint); font-variant-numeric: tabular-nums; }
.set-action { padding-top: 12px; }
.set-action small { display: block; margin: 6px 2px 0; font-size: 12.5px; color: var(--hint); line-height: 1.4; }
.skel-settings i, .skel-settings b { display: block; position: relative; overflow: hidden; background: var(--fill); border-radius: 6px; }
.skel-set-intro { height: 12px; width: 78%; margin: 8px 4px 0; }
.skel-set-title { height: 13px; width: 34%; margin: 24px 4px 10px; }
.skel-set { padding-top: 4px; padding-bottom: 4px; }
.skel-set-row { display: flex; align-items: center; justify-content: space-between; min-height: 46px; }
.skel-set-row i { height: 12px; }
.skel-set-row b { width: 44px; height: 26px; border-radius: 13px; }
.skel-settings i::after, .skel-settings b::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  animation: skel-sweep 1.2s ease-in-out infinite;
}
@keyframes skel-sweep { to { transform: translateX(100%); } }
.skel-settings { animation: skel-in .25s ease-out .12s both; }
@keyframes skel-in { from { opacity: 0; } }

/* Календарь: «Пригласить» — строкой списка участников; ссылка — с копированием по нажатию */
.members .add-member { width: 100%; color: var(--accent); font-weight: 500; text-align: left; }
.members .add-member .plus { width: 10px; text-align: center; font-size: 18px; line-height: 1; }
.cal-actions { margin-top: 22px; }
.cal-actions .btn.danger { margin-top: 6px; }
.invite-link { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; color: var(--text); cursor: pointer; }
.invite-link span { flex: 1; min-width: 0; }
.invite-link .ic { width: 18px; height: 18px; flex: none; color: var(--accent); }
.invite-meta { margin: 6px 4px 0; font-size: 13px; color: var(--hint); }

/* v9.6 — редактор заметок: отмена, AI, оглавление, правки AI */
.tool.hist { min-width: 36px; padding: 0 6px; }
.tool.hist + .tool.hist { margin-right: 2px; }
.tool.ai { flex: none; color: var(--accent); }
.chips.note-tools { margin: 4px calc(-1 * var(--pad)) 10px; }
.chips.note-tools .chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; }
.chip .ic.sm { width: 16px; height: 16px; }
.toc { display: grid; gap: 2px; }
.toc-row { display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px; font-size: 15px; font-weight: 600; }
.toc-row.lv3 { padding-left: 28px; font-weight: 400; color: var(--hint); }
@media (hover: hover) { .toc-row:hover { background: var(--fill); } }
.tidy-list { display: grid; gap: 6px; margin: 4px 0 12px; max-height: 52vh; overflow-y: auto; }
.tidy-edit { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--fill); font-size: 15px; line-height: 1.4; cursor: pointer; }
.tidy-edit input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.tidy-pair { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.tidy-pair del { color: var(--danger); text-decoration: line-through; opacity: .85; }
.tidy-pair ins { text-decoration: none; font-weight: 600; }
.tidy-view { max-height: 50vh; overflow-y: auto; margin: 10px 0 12px; }
/* v9.6 — «Без даты» на «Сегодня»: сворачиваемая группа */
.group-title.fold { width: 100%; text-align: left; color: var(--text); cursor: pointer; }
.group-title.fold .chev { margin-left: auto; color: var(--hint); font-size: 18px; line-height: 1; transition: transform .2s; }
.group-title.fold[aria-expanded="true"] .chev { transform: rotate(90deg); }
/* v9.6.1 — кнопку AI видно: подпись и цветной фон */
.tool.ai { background: var(--accent-soft); color: var(--accent); margin: 0 6px 0 4px; padding: 0 10px; border-radius: 99px; height: 34px; }
.tool.ai .ai-in { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; letter-spacing: .03em; }
.tool.ai .ic { width: 18px; height: 18px; }
.chips.note-tools .chip.ai { border-color: transparent; background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- привычки (v9.7) ---------- */
/* Цвет привычки — --hc. Яркость подобрана под светлую и тёмную схему; темы Pro меняют только акцент. */
.hc0 { --hc: #2f9e74; } .hc1 { --hc: #2b6de0; } .hc2 { --hc: #e0802a; } .hc3 { --hc: #d4508a; }
.hc4 { --hc: #7a5cc8; } .hc5 { --hc: #0f93a8; } .hc6 { --hc: #d9453f; } .hc7 { --hc: #b88a12; }
:root:where([data-scheme="dark"]) .hc0 { --hc: #4cc195; } :root:where([data-scheme="dark"]) .hc1 { --hc: #6b9ef7; }
:root:where([data-scheme="dark"]) .hc2 { --hc: #f29d52; } :root:where([data-scheme="dark"]) .hc3 { --hc: #f07aaf; }
:root:where([data-scheme="dark"]) .hc4 { --hc: #a58cf0; } :root:where([data-scheme="dark"]) .hc5 { --hc: #3fbdd2; }
:root:where([data-scheme="dark"]) .hc6 { --hc: #f0706b; } :root:where([data-scheme="dark"]) .hc7 { --hc: #e3b341; }

.pring { display: block; }
.ring-track { fill: none; stroke: color-mix(in srgb, var(--hc, var(--accent)) 16%, transparent); }
.ring-fill { fill: none; stroke: var(--hc, var(--accent)); stroke-linecap: round; transition: stroke-dasharray .5s cubic-bezier(.3, .9, .3, 1); }
.pring.accent .ring-track { stroke: var(--accent-soft); }
.pring.accent .ring-fill { stroke: var(--accent); }
.ic.lg { width: 44px; height: 44px; }

.hab-hero { display: flex; align-items: center; gap: 18px; margin-top: 8px; padding: 16px 18px; border-radius: 18px;
  background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent) 7%, var(--surface))); }
.hab-hero-ring { position: relative; flex: none; width: 108px; height: 108px; }
.hab-hero-num { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.05; }
.hab-hero-num b { font-size: 32px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hab-hero-num span { font-size: 13px; color: var(--hint); }
.hab-hero-text { display: grid; gap: 4px; min-width: 0; }
.hab-hero-text strong { font-size: 19px; font-weight: 700; }
.hab-hero-text > span { color: var(--hint); font-size: 14.5px; }
.hab-hero-text > .hab-hero-best { display: flex; align-items: flex-start; gap: 5px; margin-top: 4px; font-size: 13px; color: var(--text); }
.hab-hero-best .ic { color: #e8702a; flex: none; }
.hab-hero.complete .ring-fill { stroke: var(--rest); }
.hab-hero.complete .ring-track { stroke: color-mix(in srgb, var(--rest) 16%, transparent); }
.hab-hero.cheer .hab-hero-ring { animation: cheer .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes cheer { 40% { transform: scale(1.08) rotate(-4deg); } 70% { transform: scale(.98) rotate(2deg); } }

.hab-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 12px 0 4px; }
.hab-wday { display: grid; justify-items: center; gap: 4px; padding: 7px 0 8px; border-radius: 14px; transition: transform .12s, background-color .15s; }
.hab-wday .wd { font-size: 12px; color: var(--hint); }
.hab-wday .mini { position: relative; width: 34px; height: 34px; }
.hab-wday .mini b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hab-wday.today .wd { color: var(--accent); font-weight: 600; }
.hab-wday.full .ring-fill { stroke: var(--rest); }
.hab-wday[aria-pressed="true"] { background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .08), 0 0 0 .5px var(--line); }
.hab-wday:active { transform: scale(.95); }

.hab-list { margin-top: 10px; }
.hab-card { display: flex; align-items: center; gap: 4px; padding-right: 10px; }
.hab-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px 6px 12px 12px; text-align: left; }
.hab-main:active { background: var(--fill); }
.hab-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px;
  background: color-mix(in srgb, var(--hc, var(--accent)) 15%, transparent); color: var(--hc, var(--accent)); }
.hab-icon .ic { width: 23px; height: 23px; }
.hab-icon.xl { width: 60px; height: 60px; border-radius: 18px; }
.hab-icon.xl .ic { width: 32px; height: 32px; }
.hab-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.hab-body .name { font-size: 16px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.hab-body .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; font-size: 13px; color: var(--hint); }
.hab-body .meta > span { display: inline-flex; align-items: center; gap: 3px; }
.hab-body .meta .ic.sm { width: 14px; height: 14px; vertical-align: 0; }
.hab-streak { color: #e8702a; font-weight: 600; }
.hab-dots { display: flex; gap: 4px; margin-top: 3px; }
.hab-dots i { width: 9px; height: 9px; border-radius: 3px; background: var(--fill); }
.hab-dots i.s-d { background: var(--hc); }
.hab-dots i.s-p { background: color-mix(in srgb, var(--hc) 45%, transparent); }
.hab-dots i.s-m { background: color-mix(in srgb, var(--danger) 30%, transparent); }
.hab-dots i.s-t { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--hc) 60%, transparent); background: none; }
.hab-dots i.s-o, .hab-dots i.s-b { opacity: .55; }
.hab-dots i.sel { outline: 1.5px solid var(--hint); outline-offset: 1px; }
.hab-next { display: block; height: 4px; margin-top: 4px; border-radius: 4px; background: color-mix(in srgb, var(--hc, var(--accent)) 14%, transparent); overflow: hidden; max-width: 160px; }
.hab-next i { display: block; height: 100%; border-radius: inherit; background: var(--hc, var(--accent)); transition: width .5s ease; }
.hab-next.big { height: 6px; max-width: none; }

.hab-check { position: relative; flex: none; width: 46px; height: 46px; border-radius: 50%; }
.hab-check .pring { position: absolute; inset: 0; }
.hab-check-in { position: absolute; inset: 6px; border-radius: 50%; display: grid; place-items: center; transition: background-color .2s, color .2s; color: var(--hc); }
.hab-check-in small { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hab-check.done .hab-check-in { background: var(--hc); color: #fff; }
.hab-check.done .hab-check-in .ic svg circle { display: none; }
.hab-check.done .hab-check-in .ic svg { stroke-width: 2.4; }
.hab-check.pop { animation: pop .38s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 40% { transform: scale(1.18); } }
.hab-card.is-done .name { color: var(--hint); }
.hab-card.is-off { opacity: .62; }

.hab-note { margin-top: 12px; text-align: center; }
.hab-arch { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; text-align: left; }
.hab-arch .name { flex: 1; min-width: 0; }
.hab-arch .hab-icon { width: 34px; height: 34px; border-radius: 10px; opacity: .7; }

.hab-empty { text-align: center; padding: 20px 8px 0; color: var(--hint); }
.hab-empty-art { position: relative; width: 120px; height: 120px; margin: 4px auto 14px; display: grid; place-items: center; color: var(--accent); }
.hab-empty-art .pring { position: absolute; inset: 0; }
.hab-empty > strong { display: block; color: var(--text); font-size: 20px; margin-bottom: 6px; }
.hab-empty > p { margin: 0 auto 18px; max-width: 420px; font-size: 15px; }
.hab-empty .group-title { justify-content: center; margin-top: 26px; color: var(--text); }
.hab-presets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; text-align: left; }
@media (min-width: 560px) { .hab-presets { grid-template-columns: repeat(3, 1fr); } }
.hab-preset { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: var(--surface); color: var(--text); font-size: 14.5px; font-weight: 500; transition: transform .12s; }
.hab-preset .hab-icon { width: 34px; height: 34px; border-radius: 10px; }
.hab-preset:active { transform: scale(.97); }

/* Экран привычки */
.hab-page { padding-bottom: 20px; }
.hab-head { display: flex; align-items: center; gap: 14px; margin: 6px 2px 14px; }
.hab-head h2 { margin: 0 0 3px; font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.hab-head .hint { margin: 0; }
.hab-streak-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 6px 14px; padding: 16px 18px; border-radius: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--hc) 14%, var(--surface)), var(--surface)); }
.hab-streak-card b { display: block; font-size: 40px; line-height: 1; font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hab-streak-card > div > span { color: var(--hint); font-size: 14px; }
.flame-big { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--fill); color: var(--hint); }
.flame-big .ic { width: 32px; height: 32px; }
.flame-big.lit { background: color-mix(in srgb, #e8702a 16%, transparent); color: #e8702a; }
.flame-big.lit .ic svg { fill: color-mix(in srgb, #e8702a 30%, transparent); animation: flicker 2.4s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes flicker { 50% { transform: scale(1.06, .96); } }
.hab-to-next { grid-column: 1 / -1; display: grid; gap: 6px; margin-top: 6px; font-size: 13.5px; color: var(--hint); }
.hab-today-btn { margin-top: 12px; }
.hab-stepper { display: grid; grid-template-columns: 56px 1fr 56px; align-items: center; justify-items: center; gap: 8px; margin-top: 12px; padding: 14px; border-radius: 18px; background: var(--surface); }
.hab-stepper .step { width: 52px; height: 52px; border-radius: 50%; background: var(--fill); font-size: 26px; line-height: 1; color: var(--hc); transition: transform .12s; }
.hab-stepper .step.plus { background: var(--hc); color: #fff; }
.hab-stepper .step:disabled { opacity: .35; }
.hab-stepper .step:active:not(:disabled) { transform: scale(.92); }
.hab-stepper-val { position: relative; width: 92px; height: 92px; }
.hab-stepper-val > span { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.hab-stepper-val b { font-size: 26px; font-variant-numeric: tabular-nums; }
.hab-stepper-val small { font-size: 12px; color: var(--hint); }
.hab-stepper .link-btn { grid-column: 1 / -1; color: var(--accent); font-weight: 500; padding: 4px; }
.hab-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.hab-tile { display: grid; gap: 2px; padding: 12px; border-radius: 14px; background: var(--surface); }
.hab-tile .ic { color: var(--hc); margin-bottom: 4px; }
.hab-tile b { font-size: 18px; font-variant-numeric: tabular-nums; }
.hab-tile span { font-size: 12.5px; color: var(--hint); }
.hab-goal { display: flex; align-items: center; gap: 14px; margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); }
.hab-goal strong { display: block; }
.hab-goal .hint { margin: 0; }

.medals { display: flex; gap: 10px; overflow-x: auto; margin: 0 calc(-1 * var(--pad)); padding: 2px var(--pad) 8px; scrollbar-width: none; }
.medals::-webkit-scrollbar { display: none; }
.medal-item { flex: none; width: 64px; display: grid; justify-items: center; gap: 5px; text-align: center; font-size: 11.5px; line-height: 1.2; color: var(--hint); }
.medal { position: relative; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--hint); }
.medal .pring { position: absolute; inset: 0; }
.medal b { position: relative; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.medal-item.got .medal { background: linear-gradient(145deg, color-mix(in srgb, var(--hc) 70%, #fff), var(--hc)); color: #fff;
  box-shadow: 0 3px 10px color-mix(in srgb, var(--hc) 35%, transparent), inset 0 0 0 3px color-mix(in srgb, #fff 30%, transparent); }
.medal-item.got span { color: var(--text); font-weight: 500; }
.medal-item.next .medal { background: none; color: var(--hc); }
.medal-item.next span { color: var(--hc); font-weight: 600; }

.hab-heat-box { background: var(--surface); border-radius: 14px; padding: 12px 12px 10px; }
.hab-heat-wrap { display: flex; gap: 6px; }
.hab-heat-days { display: grid; grid-template-rows: 14px repeat(7, 12px); row-gap: 3px; font-size: 9.5px; line-height: 12px; color: var(--hint); }
.hab-heat-days span:first-child { grid-row: 2; }
.hab-heat-scroll { overflow-x: auto; scrollbar-width: none; min-width: 0; }
.hab-heat-scroll::-webkit-scrollbar { display: none; }
.hab-heat-months { display: grid; column-gap: 3px; height: 14px; font-size: 9.5px; color: var(--hint); margin-bottom: 3px; white-space: nowrap; }
.hab-heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; }
.hab-heat i, .hab-heat-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--fill); }
.hab-heat i.s-d, .hab-heat-legend i.s-d { background: var(--hc); }
.hab-heat i.s-p, .hab-heat-legend i.s-p { background: color-mix(in srgb, var(--hc) 40%, transparent); }
.hab-heat i.s-m, .hab-heat-legend i.s-m { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.hab-heat i.s-t { box-shadow: inset 0 0 0 1.5px var(--hc); background: none; }
.hab-heat i.s-x, .hab-heat i.s-f { background: none; }
.hab-heat i.s-b { opacity: .45; }
.hab-heat-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; font-size: 12px; color: var(--hint); }
.hab-heat-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hab-actions { margin-top: 22px; }

/* Лист «Новая привычка» */
.hab-icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.hab-icon-grid .hab-icon { width: 100%; height: 44px; background: var(--surface); color: var(--hint); transition: background-color .15s, color .15s, transform .12s; }
.hab-icon-grid .hab-icon[aria-pressed="true"] { background: var(--hc); color: #fff; }
.hab-icon-grid .hab-icon:active { transform: scale(.92); }
.hab-colors { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; padding: 0 4px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; background: var(--hc); transition: transform .12s; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--page), 0 0 0 5px var(--hc); }
.swatch:active { transform: scale(.9); }
.hab-count-row { margin-top: 8px; }
.hab-count-row input[type="number"] { flex: 0 0 96px; }
.hab-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.hab-days button { padding: 9px 0; border-radius: 10px; background: var(--surface); font-size: 14px; font-weight: 500; color: var(--hint); }
.hab-days button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* Новая веха: медаль и конфетти */
.celebrate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, .45);
  animation: fade-in .2s ease-out; overflow: hidden; }
.celebrate.out { opacity: 0; transition: opacity .25s; }
@keyframes fade-in { from { opacity: 0; } }
.medal-card { position: relative; z-index: 1; width: min(340px, 100%); padding: 26px 22px 20px; border-radius: 24px; background: var(--surface); text-align: center;
  animation: medal-in .5s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes medal-in { from { transform: scale(.7) translateY(20px); opacity: 0; } }
.medal-card strong { display: block; font-size: 20px; margin-top: 14px; }
.medal-card p { margin: 6px 0 0; }
.medal-card .btn { margin-top: 18px; }
.medal.big { width: 96px; height: 96px; margin: 0 auto; display: grid; place-content: center; justify-items: center; line-height: 1; color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--hc) 70%, #fff), var(--hc));
  box-shadow: 0 8px 24px color-mix(in srgb, var(--hc) 45%, transparent), inset 0 0 0 5px color-mix(in srgb, #fff 30%, transparent);
  animation: medal-spin 1s cubic-bezier(.3, 1.2, .5, 1); }
.medal.big b { font-size: 36px; }
.medal.big small { font-size: 12px; opacity: .9; }
@keyframes medal-spin { from { transform: rotateY(180deg) scale(.6); } }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -14px; left: var(--x); width: 8px; height: 13px; border-radius: 2px; opacity: .95;
  background: var(--hc); animation: confetti var(--d) cubic-bezier(.25, .6, .4, 1) forwards; }
.confetti i:nth-child(4n+1) { background: var(--accent); }
.confetti i:nth-child(4n+2) { background: #f2b230; }
.confetti i:nth-child(4n+3) { background: #f07aaf; border-radius: 50%; width: 9px; height: 9px; }
@keyframes confetti { to { transform: translateY(105vh) rotate(var(--r)); opacity: .9; } }
@media (prefers-reduced-motion: reduce) {
  .hab-check.pop, .hab-hero.cheer .hab-hero-ring, .medal-card, .medal.big, .flame-big.lit .ic svg { animation: none; }
}
@media (min-width: 900px) {
  .hab-main, .hab-arch { cursor: pointer; }
  .hab-main:hover, .hab-arch:hover { background: var(--fill); }
}
.ring-fill.empty { opacity: 0; }

/* ---------- общий календарь: новый вид (v9.7) ---------- */
:root:where([data-scheme="dark"]) .c1 { --who: #f07aaf; }
:root:where([data-scheme="dark"]) .c2 { --who: #4cc195; }
:root:where([data-scheme="dark"]) .c3 { --who: #eeb04a; }
:root:where([data-scheme="dark"]) .c4 { --who: #a58cf0; }

.avatar { position: relative; flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--who); color: #fff; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; box-shadow: 0 0 0 2px var(--surface); }
.avatars { display: inline-flex; align-items: center; }
.avatars .avatar + .avatar { margin-left: -8px; }
.avatars.small .avatar { width: 22px; height: 22px; font-size: 9.5px; }
.avatars.small .avatar + .avatar { margin-left: -5px; }
.av-mark { position: absolute; right: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; display: grid; place-items: center;
  font-size: 8px; font-style: normal; line-height: 1; color: #fff; background: var(--rest); box-shadow: 0 0 0 1.5px var(--surface); }
.av-mark.no { background: var(--danger); }

.cal-cards { display: flex; gap: 8px; overflow-x: auto; margin: 6px calc(-1 * var(--pad)) 0; padding: 2px var(--pad) 4px; scrollbar-width: none; }
.cal-cards::-webkit-scrollbar { display: none; }
.cal-card { flex: none; display: flex; align-items: center; gap: 10px; padding: 9px 14px 9px 10px; border-radius: 16px; background: var(--surface); text-align: left; transition: transform .12s; }
.cal-card:active { transform: scale(.97); }
.cal-card-text { display: grid; line-height: 1.2; }
.cal-card-text b { font-size: 15px; font-weight: 600; }
.cal-card-text small { font-size: 12px; color: var(--hint); }
.cal-card.add { color: var(--accent); border: 1.5px dashed color-mix(in srgb, var(--accent) 40%, transparent); background: transparent; }
.cal-card.add .plus { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); font-size: 18px; line-height: 1; }

.month-box { padding: 12px 8px 10px; border-radius: 18px; overflow: hidden; }
.month-nav { display: flex; align-items: center; gap: 4px; padding: 0 6px 10px; }
.month-nav strong { flex: 1; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.month-nav .nav-btn { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; line-height: 1; color: var(--text); background: var(--fill); }
.month-nav .nav-btn:active { transform: scale(.92); }
.today-pill { padding: 6px 12px; margin-right: 4px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.month-head span { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.month-head .weekend { color: color-mix(in srgb, var(--high) 75%, var(--hint)); }
.month { gap: 3px; }
.mday { height: 48px; padding-top: 5px; gap: 4px; border-radius: 12px; transition: background-color .15s, transform .12s; }
.mday .num { display: grid; place-items: center; width: 28px; height: 24px; border-radius: 8px; font-size: 15px; }
.mday.weekend:not(.other) .num { color: color-mix(in srgb, var(--high) 70%, var(--text)); }
.mday.past:not(.today) .num { opacity: .6; }
.mday.today .num { background: var(--accent-soft); color: var(--accent); font-weight: 700; opacity: 1; }
.mday[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent); }
.mday[aria-pressed="true"] .num { background: none; color: inherit; opacity: 1; font-weight: 700; }
.mday[aria-pressed="true"] .mdots i { background: currentColor; }
.mday:active { transform: scale(.94); }
.mdots { align-items: center; }
.mdots small { font-size: 9px; line-height: 1; color: var(--hint); }
.mday[aria-pressed="true"] .mdots small { color: inherit; }
.mpills { display: none; }
.month.slide-next { animation: slide-next .28s cubic-bezier(.2, .8, .2, 1); }
.month.slide-prev { animation: slide-prev .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes slide-next { from { opacity: 0; transform: translateX(36px); } }
@keyframes slide-prev { from { opacity: 0; transform: translateX(-36px); } }

.cal-day-title { flex-wrap: wrap; }
.cal-day-title .count::first-letter { text-transform: uppercase; }
.event-list { display: grid; gap: 8px; }
.event-card { display: flex; align-items: stretch; gap: 12px; width: 100%; padding: 12px 14px 12px 12px; border-radius: 16px; background: var(--surface); text-align: left;
  position: relative; overflow: hidden; transition: transform .12s; }
.event-card::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--who); }
.event-card:active { transform: scale(.985); }
.event-card.past { opacity: .62; }
.event-card.declined .ev-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--hint) 70%, transparent); }
.ev-time, .ev-date { flex: none; width: 48px; display: grid; align-content: start; justify-items: center; padding: 2px 0 0 4px; line-height: 1.15; }
.ev-time b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-time small { font-size: 12.5px; color: var(--hint); font-variant-numeric: tabular-nums; }
.ev-date { padding: 6px 0; border-radius: 12px; background: color-mix(in srgb, var(--who) 12%, transparent); margin-left: 4px; align-self: start; }
.ev-date small { font-size: 11px; color: var(--who); font-weight: 600; text-transform: uppercase; }
.ev-date b { font-size: 19px; font-weight: 700; }
.ev-body { flex: 1; min-width: 0; display: grid; gap: 4px; }
.ev-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.ev-sub { font-size: 13px; color: var(--hint); font-variant-numeric: tabular-nums; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 13px; color: var(--hint); }
.ev-meta .place { display: inline-flex; align-items: center; gap: 3px; }
.ev-meta .ic.sm { width: 14px; height: 14px; vertical-align: 0; }
.ev-people { display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.ev-people > .avatar { width: 20px; height: 20px; font-size: 9px; box-shadow: none; }
.ev-people > small { flex: 1; min-width: 0; font-size: 12.5px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.soon { padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--accent-soft); color: var(--accent); }
.soon.now { background: color-mix(in srgb, var(--rest) 16%, transparent); color: var(--rest); }
.soon.now::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: currentColor; vertical-align: 1px; animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }

.cal-free { display: flex; align-items: center; gap: 10px; width: 100%; padding: 14px 16px; border-radius: 16px; color: var(--hint); font-size: 15px;
  border: 1.5px dashed var(--line); text-align: left; }
.cal-free > span { flex: 1; }
.cal-free b { color: var(--accent); font-weight: 600; }
.cal-free:active { background: var(--fill); }

.cal-empty { text-align: center; padding: 28px 12px 0; color: var(--hint); }
.cal-empty-art { position: relative; width: 112px; height: 104px; margin: 0 auto 16px; display: grid; place-items: center; border-radius: 28px;
  background: var(--accent-soft); color: var(--accent); }
.cal-empty-art .avatar { position: absolute; width: 34px; height: 34px; font-size: 13px; box-shadow: 0 0 0 3px var(--page); }
.cal-empty-art .avatar.c1 { right: -10px; top: -8px; }
.cal-empty-art .avatar.c2 { left: -10px; bottom: -8px; }
.cal-empty > strong { display: block; color: var(--text); font-size: 20px; margin-bottom: 6px; }
.cal-empty > p { margin: 0 auto 20px; max-width: 400px; font-size: 15px; }

@media (min-width: 900px) {
  .mday { height: 92px; justify-items: stretch; padding: 6px 6px 4px; align-content: start; }
  .mday .num { justify-self: start; }
  .mday .mdots { display: none; }
  .mpills { display: grid; gap: 2px; min-width: 0; }
  .mpills i { display: block; font-style: normal; font-size: 11.5px; line-height: 1.35; padding: 1px 6px; border-radius: 5px; text-align: left;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--who) 16%, transparent); color: var(--text); }
  .mpills small { font-size: 11px; color: var(--hint); text-align: left; padding-left: 4px; }
  .mday[aria-pressed="true"] .mpills i { background: color-mix(in srgb, var(--on-accent) 22%, transparent); color: inherit; }
  .mday[aria-pressed="true"] .mpills small { color: inherit; opacity: .85; }
  .mday:hover:not([aria-pressed="true"]) { background: var(--fill); }
  .event-card { cursor: pointer; }
  .event-card:hover { box-shadow: 0 2px 10px rgba(0, 0, 0, .06); }
}
@media (prefers-reduced-motion: reduce) { .month.slide-next, .month.slide-prev, .soon.now::before { animation: none; } }
.mday.weekend[aria-pressed="true"] .num, .mday.today[aria-pressed="true"] .num { color: inherit; background: none; }
.mday.today.weekend:not([aria-pressed="true"]) .num { color: var(--accent); }
.hab-preset { text-align: left; line-height: 1.25; }

/* v9.7.1: клавиатура и лист. Фон листа повторяет видимую часть экрана (keyboardFit в app.js),
   лист не выше неё — поле ввода и кнопка «Сохранить» остаются над клавиатурой. */
#backdrop { bottom: auto; height: 100%; }
#sheet { max-height: min(92vh, calc(100% - 16px)); }
@media (min-width: 900px) { #sheet { max-height: min(88vh, calc(100% - 32px)); } }
#sheet.ai-sheet { height: min(86vh, calc(100% - 16px)); }
/* Подсказка (toast): над клавиатурой; при открытом листе — сверху, чтобы не закрывать его кнопки и поле. */
#toast { bottom: max(calc(var(--tabs-h) + var(--safe-bottom) + 14px), calc(var(--kb, 0px) + 12px)); }
body.sheet-open #toast { bottom: auto; top: calc(var(--vv-top, 0px) + max(env(safe-area-inset-top, 0px), 10px) + 6px); }
body.sheet-open #toast:not([hidden]) { animation: toast-top .24s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes toast-top { from { opacity: 0; transform: translate(-50%, -12px) scale(.96); } }
/* iPhone приближает страницу, если в поле шрифт меньше 16 px. */
@media (pointer: coarse) { .note-folder input, .raw-area { font-size: 16px; } }

/* v9.7.1: фокус — карточка «сегодня» первой на экране, тёплый фон, объёмные «помидоры», цель выполнена — зелёным. */
.goal.today-card { margin-top: 4px; margin-bottom: 4px; padding: 18px 18px 16px; border-radius: 18px;
  background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--tomato) 7%, var(--surface))); }
.goal .track { gap: 8px; }
.goal .track i { width: 28px; height: 28px; border-width: 2px; transition: background-color .3s, border-color .3s, transform .3s; }
.goal .track i.on { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--tomato) 55%, #fff), var(--tomato) 70%);
  box-shadow: 0 2px 6px color-mix(in srgb, var(--tomato) 30%, transparent); }
.goal .track i.running { animation: tomato-pulse 2s ease-in-out infinite; }
@keyframes tomato-pulse { 50% { transform: scale(1.08); } }
.goal.met { background: linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--rest) 10%, var(--surface))); }
.goal.met .big { color: var(--rest); }
.goal.met .track i.on { background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--rest) 55%, #fff), var(--rest) 70%);
  border-color: var(--rest); box-shadow: 0 2px 6px color-mix(in srgb, var(--rest) 30%, transparent); }
.goal .delta.up { color: var(--rest); }
.goal .delta.down { color: var(--high); }
@media (prefers-reduced-motion: reduce) { .goal .track i.running { animation: none; } }

/* v9.7.2: клавиатура на iPhone — лист и его фон меняют размер плавно, вместе с клавиатурой, а не рывком. */
#backdrop { transition: background-color .26s ease; }   /* v9.7.3: размер фона не анимируем — его больше не меняем под клавиатуру */
#sheet { transition: transform .3s cubic-bezier(.32, .72, 0, 1), max-height .25s ease, height .25s ease; }
#sheet.dragging { transition: none; }
#backdrop:not(.open) #sheet { transition: transform .24s cubic-bezier(.4, 0, 1, 1); }
@media (min-width: 900px) { #sheet { transition: transform .22s ease, opacity .22s ease, max-height .25s ease; } }
@media (prefers-reduced-motion: reduce) { #backdrop, #sheet { transition: none !important; } }

/* ---------- v9.8: follow-up, следующий повтор, широкий экран задач, «Привести в порядок» ---------- */
.task .meta .fresh, .tbl-badge.fresh { color: var(--accent); font-weight: 600; }
.tbl-badge.fresh { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.task .meta .fu { color: color-mix(in srgb, var(--accent) 75%, var(--hint)); }
.tbl-badge.fu { background: color-mix(in srgb, var(--accent) 10%, transparent); color: color-mix(in srgb, var(--accent) 80%, var(--hint)); }
.task-table tr.fresh td { background: color-mix(in srgb, var(--accent) 7%, transparent); animation: fresh-in 1.2s ease-out; }
@keyframes fresh-in { from { background: color-mix(in srgb, var(--accent) 24%, transparent); } }
.task-table tr.checking .tbl-title { text-decoration: line-through; color: var(--hint); }
.fu-intro { margin: 4px 2px 10px; }
.fu-switch { margin: 2px 0 12px; padding: 10px 12px; border-radius: 12px; background: var(--fill); }
.tidy-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; }
.table-bar > .tidy-btn { width: auto; padding: 8px 14px; font-size: 14.5px; }
.side-card .tidy-btn { width: 100%; justify-content: center; padding: 10px 14px; font-size: 15px; }
#sheet .tidy-btn { width: auto; padding: 9px 14px; font-size: 14.5px; }
.table-bar > .kind-seg { flex: none; }
#sheet .tidy-btn { margin: 2px 0 12px; }
@media (min-width: 1180px) { .table-bar:not(.tasks-wide) > .tidy-btn { display: none; } }
.link-btn { margin-top: 6px; padding: 4px 0; color: var(--accent); font-weight: 600; font-size: 14px; background: none; }

.tasks-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; align-items: start; }
.tasks-main { min-width: 0; }
.tasks-side { position: sticky; top: 110px; display: grid; gap: 14px; padding-bottom: 76px; }
.side-card { background: var(--surface); border-radius: 16px; padding: 14px 16px 12px; }
.side-card h3 { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--hint); }
.side-card .hint { margin: 0 0 10px; font-size: 13.5px; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stats-grid .stat { display: grid; gap: 1px; padding: 9px 11px; border-radius: 12px; background: var(--fill); }
.stats-grid .stat b { font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats-grid .stat span { font-size: 12.5px; color: var(--hint); }
.stats-grid .stat.alert b { color: var(--high); }
.stats-grid .stat.good b { color: var(--rest); }
.mini-task { display: grid; gap: 1px; width: 100%; padding: 7px 8px; margin: 0 -8px; border-radius: 10px; text-align: left; background: none; }
.mini-task:hover { background: var(--fill); }
.mini-task .name { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-task .meta { font-size: 12.5px; color: var(--hint); }

@media (min-width: 1180px) {
  body:has(.tasks-wide) > header, body:has(.tasks-wide) > main, body:has(.tasks-wide) #banner { max-width: 1180px; }
  .task-table td.tbl-title { min-width: 320px; }
}
@media (hover: hover) {
  .task:hover { background: color-mix(in srgb, var(--fill) 70%, var(--surface)); }
  .task-table tbody tr:hover td { background: var(--fill); }
}
.fu-upd .btn { width: auto; flex: none; padding: 10px 16px; }

/* ---------- v9.9: фокус у задач, итоги по задачам ---------- */
.task .meta .focus-meta { display: inline-flex; align-items: center; gap: 3px; color: color-mix(in srgb, var(--tomato) 80%, var(--hint)); font-variant-numeric: tabular-nums; }
.task .meta .focus-meta.full { color: var(--rest); }
.focus-block { padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--tomato) 7%, var(--fill)); }
.focus-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.focus-row .est { display: flex; align-items: center; gap: 10px; }
.est-label { font-size: 14px; color: var(--hint); }
.est-ctl { display: inline-flex; align-items: center; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.est-btn { width: 34px; height: 32px; font-size: 19px; line-height: 1; color: var(--accent); }
.est-num { min-width: 26px; text-align: center; font-variant-numeric: tabular-nums; }
.focus-go { width: auto; display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px; background: var(--tomato); }
.focus-block .hint { display: block; margin-top: 8px; }
.chips-label { display: block; margin: 4px 2px 6px; }
.task-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; }
.task-chips::-webkit-scrollbar { display: none; }
.task-chip { flex: 0 0 auto; max-width: 220px; display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-align: left;
  border-left: 3px solid var(--low); transition: background-color .15s, border-color .15s; }
.task-chip.p-high { border-left-color: var(--high); }
.task-chip.p-medium { border-left-color: var(--medium); }
.task-chip .name { font-size: 14.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-chip small { font-size: 12px; color: var(--hint); font-variant-numeric: tabular-nums; }
.task-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.picked-info { margin: -4px 2px 10px; }
.task-done-link { display: inline-flex; align-items: center; gap: 5px; margin: 10px auto 0; color: var(--rest); }
.timer-card .task-done-link { display: flex; justify-content: center; }

.report-grid { display: grid; gap: 12px; }
@media (min-width: 900px) { .report-grid { grid-template-columns: 1fr 1fr; align-items: start; }
  .report-grid > .report-tiles, .report-grid > .review-card { grid-column: 1 / -1; } }
.report-tiles { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .report-tiles { grid-template-columns: repeat(4, 1fr); } }
.report-tiles .stat { background: var(--surface); }
.report-tiles .stat small { display: block; margin-top: 2px; font-size: 12px; color: var(--hint); }
.report-card { margin: 0; }
.done-chart { display: flex; align-items: flex-end; gap: 3px; height: 96px; padding: 6px 0 2px; }
.done-chart .bar-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.done-chart .bar-col i { display: block; width: 100%; max-width: 26px; min-height: 2px; border-radius: 5px 5px 2px 2px;
  background: color-mix(in srgb, var(--accent) 55%, var(--fill)); transition: height .4s ease; }
.done-chart .bar-col.best i { background: var(--rest); }
.done-chart .bar-col small { font-size: 11px; color: var(--hint); margin-top: 3px; font-variant-numeric: tabular-nums; min-height: 13px; }
.mini-task.p-high .name::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--high); margin: 0 7px 2px 0; vertical-align: middle; }
.review-card h3 { display: flex; align-items: center; gap: 6px; }
.review-body .btn { width: auto; display: inline-flex; align-items: center; gap: 6px; padding: 10px 16px; }
.review-head { font-weight: 600; font-size: 16px; margin: 2px 0 10px; }
.review-sect { margin-top: 10px; padding-left: 12px; border-left: 3px solid var(--line); }
.review-sect h4 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--hint); }
.review-sect ul { margin: 0; padding-left: 18px; }
.review-sect li { margin: 3px 0; line-height: 1.4; }
.review-sect.good { border-left-color: var(--rest); }
.review-sect.warn { border-left-color: var(--medium); }
.review-sect.next { border-left-color: var(--accent); }
.focus-share { padding: 6px 0; }
.focus-share .fs-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14.5px; }
.focus-share .fs-top .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.focus-share .fs-top b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fs-bar { height: 6px; border-radius: 99px; background: var(--fill); margin: 5px 0 2px; overflow: hidden; }
.fs-bar i { display: block; height: 100%; border-radius: inherit; background: var(--tomato); }
.focus-share small { font-size: 12px; color: var(--hint); }
.focus-share small.over { color: var(--medium); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-cloud .chip { border: 1px solid var(--line); font-size: 13.5px; }
