/* «Шаги» — стиль «как iPhone» (образец — Mini App Tibaru). Один набор деталей на все экраны. */
:root {
  --bg: #F2F2F7; --group: #FFFFFF; --group-press: #E5E5EA; --sheet: #F2F2F7;
  --label: #000000; --label-2: #6C6C70; --sep: rgba(60, 60, 67, 0.18); --fill: rgba(118, 118, 128, 0.12);
  --accent: #0064D2; --accent-text: #0064D2; --pom: #D33A2E; --pom-text: #C4251B;
  --ok-text: #1F7A35; --warn-text: #A04F00; --bad-text: #C4251B;
  --t-blue: #007AFF; --t-green: #34C759; --t-orange: #FF9500; --t-red: #FF3B30; --t-purple: #AF52DE;
  --t-indigo: #5856D6; --t-pink: #FF2D55; --t-gray: #8E8E93; --t-teal: #30B0C7;
  --work: #5856D6; --life: #FF2D55;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif;
  --r: 12px; --shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #000000; --group: #1C1C1E; --group-press: #2C2C2E; --sheet: #1C1C1E;
  --label: #FFFFFF; --label-2: #AEAEB2; --sep: rgba(84, 84, 88, 0.65); --fill: rgba(118, 118, 128, 0.24);
  --accent: #0A6FE0; --accent-text: #5AA9FF; --pom: #D33A2E; --pom-text: #FF6961;
  --ok-text: #4CD964; --warn-text: #FFB340; --bad-text: #FF6961;
  --t-blue: #0A84FF; --t-green: #30D158; --t-orange: #FF9F0A; --t-red: #FF453A; --t-purple: #BF5AF2;
  --t-indigo: #5E5CE6; --t-pink: #FF375F; --t-gray: #8E8E93; --t-teal: #40C8E0;
  --work: #7D7AFF; --life: #FF6482; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #000000; --group: #1C1C1E; --group-press: #2C2C2E; --sheet: #1C1C1E;
  --label: #FFFFFF; --label-2: #AEAEB2; --sep: rgba(84, 84, 88, 0.65); --fill: rgba(118, 118, 128, 0.24);
  --accent: #0A6FE0; --accent-text: #5AA9FF; --pom: #D33A2E; --pom-text: #FF6961;
  --ok-text: #4CD964; --warn-text: #FFB340; --bad-text: #FF6961;
  --t-blue: #0A84FF; --t-green: #30D158; --t-orange: #FF9F0A; --t-red: #FF453A; --t-purple: #BF5AF2;
  --t-indigo: #5E5CE6; --t-pink: #FF375F; --t-gray: #8E8E93; --t-teal: #40C8E0;
  --work: #7D7AFF; --life: #FF6482; --shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--label); font: 17px/1.35 var(--font);
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; }
::selection { background: color-mix(in srgb, var(--t-blue) 30%, transparent); }
input, select, textarea { caret-color: var(--accent-text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; border-radius: 8px; }
a { color: var(--accent-text); text-decoration: none; }
.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

main { max-width: 600px; margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(96px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.screen { display: flex; flex-direction: column; gap: 14px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
.screen[hidden] { display: none; }

/* Шапка: строка с мелким и «+», под ней крупный заголовок */
.nav-row { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.nav-meta { font-size: 15px; color: var(--label-2); }
.nav-btn, .icon-btn { width: 44px; height: 44px; margin-right: -10px; border: 0; background: none; color: var(--accent-text);
  display: grid; place-items: center; border-radius: 22px; }
.nav-btn .i { width: 26px; height: 26px; stroke-width: 2.2; }
.nav-btn:active, .icon-btn:active { background: var(--fill); }
.large-title { font-size: 34px; line-height: 1.1; font-weight: 700; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.demo-banner { position: sticky; top: 0; z-index: 6; margin: 0 -16px; padding: calc(6px + env(safe-area-inset-top, 0px)) 16px 6px;
  background: var(--t-orange); color: #1C1200; font-size: 13px; font-weight: 600; text-align: center; }
.demo-banner + .screen { padding-top: 8px; }

/* 28.11: на главной прилипает только строка с датой, микрофоном и «+» (заголовка «Сейчас» нет) — прокручиваются дела */
#home { padding-top: 0; }
#home > .nav { position: sticky; top: 0; z-index: 4; margin: 0 -16px; padding: calc(8px + env(safe-area-inset-top, 0px)) 16px 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-bottom: .5px solid var(--sep); }
.demo-banner:not([hidden]) ~ #home > .nav { top: calc(29px + env(safe-area-inset-top, 0px)); padding-top: 8px; }

/* Главная карточка «Сейчас» */
.now { background: var(--group); border-radius: 16px; padding: 18px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.now-title { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.now-open { display: flex; flex-direction: column; gap: 6px; cursor: pointer; border-radius: 10px; }
.now-meta { margin: 0 0 6px; font-size: 15px; color: var(--label-2); display: flex; gap: 6px; align-items: flex-start; }
.now-meta .i { width: 18px; height: 18px; margin-top: 1px; color: var(--t-orange); }
.now-alt { display: flex; justify-content: space-between; gap: 4px; }
.now-empty { padding-bottom: 16px; } .now-empty .now-title { font-size: 22px; } .now-empty .now-meta { display: block; }

/* Кнопки */
.btn { min-height: 50px; border: 0; border-radius: var(--r); padding: 0 18px; font-weight: 600; font-size: 17px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .12s ease-out, filter .12s; }
.btn:active { transform: scale(.98); filter: brightness(.94); }
.btn:disabled { opacity: .45; }
.btn-wide { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-plain { background: var(--group); color: var(--accent-text); }
.btn-text { min-height: 44px; border: 0; background: none; color: var(--accent-text); font-size: 17px; padding: 0 8px; border-radius: 10px; }
.btn-text.strong { font-weight: 600; }
.btn-text:active { background: var(--fill); }
.link { text-align: center; font-size: 15px; padding: 10px; }

/* Сегмент */
.seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; }
.seg button { flex: 1; min-width: 0; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 32px; border: 0; background: transparent; border-radius: 7px; font-size: 14px; font-weight: 600; color: var(--label); }
.seg button.on { background: var(--group); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 .5px rgba(0, 0, 0, 0.04); }
:root[data-theme="dark"] .seg button.on { background: #636366; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on { background: #636366; } }

/* Группы и строки, как «Настройки» iPhone */
.group-title { margin: 8px 16px -8px; font-size: 13px; font-weight: 400; text-transform: uppercase; letter-spacing: .04em; color: var(--label-2); }
.group-note, .footnote { margin: -6px 16px 0; font-size: 13px; color: var(--label-2); line-height: 1.4; }
.footnote { margin-top: 4px; text-align: center; } .footnote:empty, .group-note:empty { display: none; }
.group { background: var(--group); border-radius: var(--r); overflow: hidden; }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 16px; width: 100%;
  background: none; border: 0; text-align: left; color: var(--label); }
.row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: 56px; border-top: .5px solid var(--sep); }
.row-btn:active, .task:active { background: var(--group-press); }
.ico { flex: none; width: 30px; height: 30px; border-radius: 8px; background: var(--c); color: #fff; display: grid; place-items: center; }
.ico .i { width: 18px; height: 18px; stroke-width: 2.2; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-label { flex: 1; min-width: 0; }
.row-main .row-label { flex: none; overflow-wrap: anywhere; }
.row-sub { font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-value { color: var(--label-2); font-size: 16px; white-space: nowrap; }
.chev { width: 16px; height: 16px; color: var(--label-2); opacity: .7; stroke-width: 2.6; }
.row select { appearance: none; -webkit-appearance: none; border: 0; background: none; color: var(--label-2); text-align: right; text-align-last: right;
  font-size: 16px; max-width: 58%; padding: 8px 0; min-width: 0; text-overflow: ellipsis; }
.row input:not(.num, .switch) { flex: 1; min-width: 0; border: 0; background: none; font-size: 17px; padding: 8px 0; }
.row input::placeholder, textarea::placeholder { color: var(--label-2); opacity: 1; }
.row .num { width: 64px; border: 0; border-radius: 8px; background: var(--fill); text-align: center; padding: 6px; font-variant-numeric: tabular-nums; }
.unit { color: var(--label-2); font-size: 15px; }
.row textarea, textarea.field { width: 100%; border: 0; background: none; resize: vertical; min-height: 88px; padding: 10px 0; line-height: 1.4; font-size: 16px; }

/* Списки дел */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 4px -6px; }
.section-head h2, .section-head h4 { margin: 0; font-size: 20px; line-height: 1.15; font-weight: 700; letter-spacing: -0.01em; }
.section-head span { font-size: 15px; color: var(--label-2); }
.task { cursor: pointer; }
.task .mark { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--work); margin: 0 10px 0 10px; }
.task.life .mark { background: var(--life); }
.task + .task::before { left: 46px; }
.task.snoozed .row-label { color: var(--label-2); }
.badge { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; color: var(--label-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.badge .i { width: 14px; height: 14px; }
.badge.due { color: var(--bad-text); font-weight: 600; }
.pom-btn { flex: none; width: 40px; height: 40px; border: 0; border-radius: 20px; background: color-mix(in srgb, var(--pom) 12%, transparent); color: var(--pom-text); display: grid; place-items: center; }
.pom-btn .i { width: 20px; height: 20px; }
.pom-btn.skill-btn { background: color-mix(in srgb, var(--t-purple) 14%, transparent); color: var(--t-purple); }
.empty { padding: 28px 16px; text-align: center; color: var(--label-2); }

/* «Давно откладывается» */
.stale-card .row-label { font-weight: 600; }
.stale-actions { display: flex; gap: 8px; padding: 0 16px 14px 58px; flex-wrap: wrap; }
.chip { min-height: 34px; border: 0; border-radius: 17px; padding: 0 14px; background: var(--fill); color: var(--label); font-size: 15px; font-weight: 500; }
.chip:active { background: var(--group-press); }

/* Навыки */
.skill-head { padding: 14px 16px 6px; display: flex; flex-direction: column; gap: 6px; }
.skill-head h3 { margin: 0; font-size: 20px; letter-spacing: -0.01em; }
.hours { display: flex; justify-content: space-between; font-size: 15px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.hours b { color: var(--label); font-weight: 600; }
.track { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; }
.track i { display: block; height: 100%; border-radius: 3px; background: var(--t-purple); transition: width .3s ease-out; }
.skill .seg { margin: 8px 12px 12px; }
.skill .seg button { font-size: 13px; }

/* Статистики */
.stat-head { padding: 14px 16px 4px; display: flex; flex-direction: column; gap: 4px; }
.stat-head b { font-size: 17px; }
.stat-head .row-sub { white-space: normal; }
.cond { align-self: flex-start; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  color: var(--cc); background: color-mix(in srgb, var(--cc) 14%, transparent); }
.bars { display: grid; grid-template-columns: repeat(8, 1fr); align-items: end; gap: 6px; height: 72px; padding: 8px 16px 0; }
.bars i { display: block; border-radius: 4px 4px 1px 1px; background: var(--fill); min-height: 3px; }
.bars i.v { background: color-mix(in srgb, var(--t-blue) 45%, transparent); }
.bars i.last { background: var(--t-blue); }
.bars-axis { display: flex; justify-content: space-between; padding: 4px 16px 8px; font-size: 12px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.stat-value { display: flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.stat-value strong { font-size: 28px; font-weight: 700; letter-spacing: -0.01em; }
.stat-hint { padding: 0 16px 12px; font-size: 15px; color: var(--label-2); }
.stat-form { justify-content: space-between; }
.stat-form .row-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; color: var(--label-2); }
.stat-form .num { width: 92px; margin-left: auto; }

/* Таймер */
.timer { min-height: calc(100vh - 40px); justify-content: center; text-align: center; gap: 18px; padding-bottom: 24px; }
.timer-kind { font-size: 17px; font-weight: 600; color: var(--pom-text); }
.timer-task { font-size: 22px; font-weight: 600; margin: 0; text-wrap: balance; }
.clock { font-size: clamp(72px, 24vw, 112px); font-weight: 300; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.timer .track { height: 4px; } .timer .track i { background: var(--pom); }
.timer.brk .timer-kind { color: var(--ok-text); } .timer.brk .track i { background: var(--t-green); }
.timer.skl .timer-kind { color: var(--t-purple); } .timer.skl .track i { background: var(--t-purple); }
.timer-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; text-align: left; }

/* Нижняя панель */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: space-around;
  padding: 6px max(8px, env(safe-area-inset-right, 0px), calc((100% - 600px) / 2)) calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px), calc((100% - 600px) / 2));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep); }
.tabbar[hidden] { display: none; }
.tabbar button { flex: 1; min-width: 0; max-width: 120px; border: 0; background: none; color: var(--label-2); display: flex; flex-direction: column; align-items: center; gap: 2px;
  font-size: 11px; font-weight: 500; padding: 4px 0; min-height: 48px; }
.tabbar button .i { width: 26px; height: 26px; stroke-width: 1.8; }
.tabbar button.on { color: var(--accent-text); }
.tabbar button.on .i { stroke-width: 2.4; fill: currentColor; fill-opacity: .22; }

/* Шторки */
.sheet { position: fixed; inset: 0; z-index: 8; background: rgba(0, 0, 0, 0.4); display: flex; align-items: flex-end; }
.sheet[hidden] { display: none; }
.sheet-body { width: 100%; max-width: 600px; max-height: min(92vh, 96%); overflow-y: auto; margin: 0 auto; background: var(--sheet);
  border-radius: 14px 14px 0 0; display: flex; flex-direction: column; gap: 14px;
  padding: 6px max(16px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  animation: rise .28s cubic-bezier(.16, 1, .3, 1); }
.sheet-body > * { flex-shrink: 0; } /* блоки не сжимаются — шторка прокручивается */
:root[data-theme="dark"] .sheet-body .group { background: #2C2C2E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sheet-body .group { background: #2C2C2E; } }
@keyframes rise { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.grabber { width: 36px; height: 5px; border-radius: 3px; background: var(--label-2); opacity: .4; margin: 0 auto 2px; flex: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 -8px; }
.sheet-head b { font-size: 17px; }
.sheet-title { margin: 4px 0 0; font-size: 22px; line-height: 1.25; font-weight: 700; text-wrap: balance; overflow-wrap: anywhere; }
.sheet-meta { margin: -8px 0 0; font-size: 15px; color: var(--label-2); } .sheet-meta:empty { display: none; }

/* Вход */
.login { display: flex; flex-direction: column; gap: 16px; align-items: stretch; padding-top: 16vh; }
.login .large-title, .login .sub { text-align: center; }
.login .sub { margin: -8px 0 8px; color: var(--label-2); }

/* Сообщение */
#toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 9;
  max-width: calc(100% - 32px); background: color-mix(in srgb, var(--label) 88%, transparent); color: var(--bg); font-size: 15px; font-weight: 500;
  padding: 10px 16px; border-radius: 22px; box-shadow: var(--shadow); text-align: center; }

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

/* Итоги */
.day-nav { display: flex; align-items: center; justify-content: space-between; margin: -4px -10px -6px; }
.day-nav b { font-size: 17px; font-weight: 600; text-transform: none; }
.day-nav .icon-btn { margin: 0; } .day-nav .icon-btn:disabled { color: var(--label-2); opacity: .35; }
.sum-hero { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.sum-top { display: flex; align-items: center; gap: 16px; }
.sum-big { display: flex; align-items: baseline; gap: 6px; flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sum-big strong { font-size: 48px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; }
.sum-big span { font-size: 17px; color: var(--label-2); }
.sum-side { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sum-side b { font-size: 17px; } .sum-side span { font-size: 13px; color: var(--label-2); }
.sum-track i { background: var(--t-green); }
.sum-time { display: flex; flex-wrap: wrap; gap: 8px; }
.sum-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; background: var(--fill); font-size: 14px; font-variant-numeric: tabular-nums; }
.sum-chip .i { width: 16px; height: 16px; color: var(--pom-text); }
.sum-chip:nth-child(2) .i { color: var(--t-purple); }
.sum-extra { margin: -4px 0 0; white-space: normal; }
.check { flex: none; width: 24px; height: 24px; margin: 0 2px; color: var(--label-2); display: grid; place-items: center; }
.check .i { width: 24px; height: 24px; stroke-width: 1.6; }
.check.done { color: var(--t-green); } .check.done .i { fill: currentColor; fill-opacity: .14; stroke-width: 2; }
.task.is-done .row-label { color: var(--label-2); }
.badge.imp { color: var(--t-orange); } .badge.imp .i { fill: currentColor; width: 15px; height: 15px; }
.week-bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; height: 110px; align-items: end; }
.wb { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.wb i { display: block; width: 100%; max-width: 32px; border-radius: 6px 6px 2px 2px; background: var(--fill); min-height: 4px; }
.wb i.v { background: var(--t-green); }
.wb em { font-style: normal; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; min-height: 16px; }
.wb span { font-size: 12px; color: var(--label-2); }
.week-bars.dense { gap: 2px; }
.week-bars.dense .wb span { font-size: 10px; white-space: nowrap; overflow: visible; }
#sum-view button { padding: 0 1px; font-size: 12px; letter-spacing: -0.2px; text-overflow: clip; }
.toast-undo { margin-left: 12px; border: 0; background: none; color: var(--t-orange); font: inherit; font-weight: 700; padding: 0; cursor: pointer; }
.track.mini { height: 4px; margin-top: 6px; } .track.mini i { background: var(--t-indigo); }
/* Свитч iOS */
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 51px; height: 31px; border-radius: 16px; background: var(--fill); position: relative; margin: 0; cursor: pointer; transition: background .2s ease-out; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s ease-out; }
.switch:checked { background: var(--t-green); } .switch:checked::after { transform: translateX(20px); }

/* Голос: выгрузка из головы */
.nav-actions { display: flex; gap: 4px; }
.nav-actions .nav-btn { margin-right: 0; } .nav-actions .nav-btn:last-child { margin-right: -10px; }
.say-mic { align-self: center; width: 120px; height: 120px; border-radius: 60px; border: 0; background: var(--accent); color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; margin: 6px 0; }
.say-mic .i { width: 40px; height: 40px; stroke-width: 2; }
.say-mic[aria-pressed="true"] { background: var(--pom); animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--pom) 45%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }
.say-text { min-height: 140px; }

/* Чат с ассистентом.
   28.11: экран — оболочка ровно по видимой области (--vv-top/--vvh — из visualViewport, см. app.js; без них — всё окно).
   Сверху шапка, снизу строка ввода — обычные блоки, прокручивается только лента .chat-scroll между ними.
   Страница сама не прокручивается, поэтому ни шапка, ни строка ввода не уезжают — и при открытой клавиатуре. */
html:has(> body[data-screen="chat"]), body[data-screen="chat"] { overflow: hidden; overscroll-behavior: none; }
body[data-screen="chat"] main, body[data-screen="timer"] main { padding-bottom: 0; }
.chat.screen { position: fixed; left: 0; right: 0; top: var(--vv-top, 0px); height: var(--vvh, 100%); z-index: 1; gap: 0; padding: 0; }
.chat > .nav { flex: none; position: relative; z-index: 2; background: var(--bg);
  padding: calc(8px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px), calc((100% - 600px) / 2)) 0 max(16px, env(safe-area-inset-left, 0px), calc((100% - 600px) / 2)); }
.demo-banner:not([hidden]) ~ .chat > .nav { padding-top: calc(37px + env(safe-area-inset-top, 0px)); } /* плашка «Демо» лежит поверх */
.chat-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 14px;
  padding: 14px max(16px, env(safe-area-inset-right, 0px), calc((100% - 600px) / 2)) 12px max(16px, env(safe-area-inset-left, 0px), calc((100% - 600px) / 2)); }
/* На списке веток под оболочкой — нижнее меню: оставляем ему место */
.chat:not(.in-thread) { padding-bottom: var(--tabbar-h, calc(64px + env(safe-area-inset-bottom, 0px))); }
.chat:not(.in-thread) .chat-bar { padding-bottom: 8px; }
/* Клавиатура открыта: нижнее меню прячем, строка ввода — прямо над клавиатурой (низ оболочки = верх клавиатуры) */
body.kb-open .tabbar { display: none !important; }
body.kb-open .chat .chat-bar { padding-bottom: 8px; }
body.kb-open .chat:not(.in-thread) { padding-bottom: 0; }
body[data-screen="chat"] .tabbar { border-top: 0; } /* одна линия — над строкой ввода, а не между ней и меню */
/* В ветке шапка компактная, с «‹ Диалоги» — назад можно из любого места длинной переписки */
.chat.in-thread > .nav { padding-top: calc(4px + env(safe-area-inset-top, 0px)); padding-bottom: 8px; border-bottom: .5px solid var(--sep); }
.demo-banner:not([hidden]) ~ .chat.in-thread > .nav { padding-top: calc(33px + env(safe-area-inset-top, 0px)); }
.chat.in-thread .large-title { font-size: 22px; line-height: 1.2; overflow-wrap: anywhere; }
.chat.in-thread #chat-meta { display: none; }
.back { display: inline-flex; align-items: center; gap: 2px; margin-left: -10px; padding: 0 6px; }
.back .i { width: 22px; height: 22px; }
.chat-list { display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; }
.msg { max-width: 82%; padding: 9px 13px; border-radius: 18px; font-size: 16px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 6px; }
.msg.bot { align-self: flex-start; background: var(--group); border-bottom-left-radius: 6px; }
.msg.err { color: var(--bad-text); }
.msg-time { font-size: 11px; color: var(--label-2); align-self: center; margin: 6px 0 0; }
.typing { align-self: flex-start; color: var(--label-2); font-size: 14px; padding: 4px 13px; }
/* «Думает…» под перепиской: место занято всегда, показ — только видимостью, поэтому ничего не сдвигается */
.chat-typing { height: 26px; box-sizing: border-box; margin-top: -10px; visibility: hidden; }
.chat-typing.on { visibility: visible; }
.msg-body[hidden] { display: none; }
/* Ветки не загрузились — сообщение и «Повторить» вместо пустого экрана */
.chat-err { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chat-err p { margin: 0; } .chat-err .footnote { margin: 0; overflow-wrap: anywhere; }
/* Строка ввода — нижний блок оболочки чата, т. е. всегда у нижнего края видимой области (над меню или клавиатурой) */
.chat-bar { flex: none; position: relative; z-index: 2; display: flex; align-items: flex-end; gap: 6px;
  padding: 8px max(10px, env(safe-area-inset-right, 0px), calc((100% - 600px) / 2)) calc(8px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px), calc((100% - 600px) / 2));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-top: .5px solid var(--sep); }
.chat-bar textarea { flex: 1; min-width: 0; max-height: 140px; overflow-y: auto; overscroll-behavior: contain; resize: none; border: .5px solid var(--sep); border-radius: 20px; background: var(--group); padding: 9px 14px; font-size: 16px; line-height: 1.35; }
.chat-bar .icon-btn { margin: 0; width: 40px; height: 40px; }
.chat-bar .icon-btn[aria-pressed="true"] { color: var(--pom-text); }
.chat-send { flex: none; width: 40px; height: 40px; border: 0; border-radius: 20px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.chat-send .i { width: 20px; height: 20px; }

/* Ветки диалогов */
.thread .row-sub { white-space: nowrap; }
.thread .when { font-size: 13px; color: var(--label-2); white-space: nowrap; align-self: flex-start; margin-top: 2px; }
.thread .unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; }
.thread .ico { font-weight: 700; font-size: 14px; }
/* «→ ветка» над ответом из другой ветки в «Общем»: нажатие — переход в ветку */
.msg-thread { display: block; margin: -4px 0 2px; padding: 4px 0; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600;
  color: var(--accent); text-align: left; white-space: normal; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* Вложения в «Диалогах» */
.chat-bar { flex-wrap: wrap; }
.att-row { flex-basis: 100%; display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
.att { position: relative; flex: none; width: 64px; height: 64px; border-radius: 10px; background: var(--group); overflow: hidden; display: grid; place-items: center; font-size: 11px; color: var(--label-2); text-align: center; padding: 4px; }
.att img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.att button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 11px; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 14px; line-height: 1; padding: 0; }
.msg .att-img { display: block; max-width: 100%; max-height: 260px; border-radius: 12px; margin: 4px 0; }
.msg .att-link { display: block; color: inherit; text-decoration: underline; font-size: 14px; margin-top: 4px; }
/* 28.11: дорожка переключателя видна на тёмной шторке; значение выбора не наезжает на подпись */
.switch { background: rgba(120, 120, 128, 0.32); }
.row:has(select) > .row-label { flex: none; }
.row select { flex: 1 1 0; max-width: none; overflow: hidden; white-space: nowrap; }

/* Спринт недели: карточка на «Сейчас», полоса прогресса, отметка у дела */
.sprint-card { cursor: pointer; }
.sprint-card.on { box-shadow: inset 0 0 0 2px var(--t-red); }
.sprint-bar { height: 4px; margin: 0 16px 12px 60px; border-radius: 2px; background: rgba(120, 120, 128, 0.2); overflow: hidden; }
.sprint-bar i { display: block; height: 100%; background: var(--t-red); border-radius: 2px; }
.badge.sprint { color: var(--red-text, #C4000F); font-weight: 600; font-size: 12px; }

/* Срок дела: день и время в одной строке шторки */
.due-row .row-label { flex: 1; }
.row input.due-in { flex: none; width: auto; min-width: 0; padding: 4px 0; color: var(--t-blue); text-align: right; }
.row input.due-in + input.due-in { margin-left: 10px; }

/* Группы по типу дела: заголовок сворачивает/разворачивает */
.section-head.fold { cursor: pointer; user-select: none; min-height: 32px; align-items: center; } /* палец попадает: не меньше 24px (Lighthouse target-size) */

/* Критичное и главное дня */
.fail-card { box-shadow: inset 0 0 0 2px var(--t-red); }
.fail-card .row-label { color: var(--bad-text); font-weight: 600; }
.main-pick .chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.crit { font-size: 13px; }

/* Фильтры по признакам дела: строка чипов прокручивается вбок, поиск над ней */
.search-row input { width: 100%; min-height: 36px; border: 0; border-radius: 10px; padding: 0 12px; background: var(--fill); color: var(--label); font-size: 16px; }
.chips-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips-row::-webkit-scrollbar { display: none; }
.chips-row .chip { flex: none; white-space: nowrap; font-size: 14px; min-height: 32px; padding: 0 12px; }
.chips-row .chip.on { background: var(--t-blue); color: #fff; }
.chips-row select.chip { appearance: none; -webkit-appearance: none; max-width: 180px; text-overflow: ellipsis; }
.chips-row .chip.clear { background: transparent; color: var(--t-blue); }

/* Этапы (28.11.2026): под родителем с отступом; ждущий этап — бледнее; счётчик «1/3 ▸» у родителя. */
.task.stage { padding-left: 22px; }
.task.stage .mark { width: 7px; height: 7px; border-radius: 2px; }
.task.waiting .row-label { color: var(--label-2); }
.badge.stages { border: 0; font: inherit; font-size: 12px; cursor: pointer; background: var(--fill-2, rgba(120,120,128,.16)); color: var(--label); }
#sheet-stages .row.stage .row-label { font-size: 15px; }

/* Модули (29.11.2026): матрица, канбан, привычки, колесо баланса, «в планах» */
.matrix { display: grid; gap: 4px 16px; grid-template-columns: minmax(0, 1fr); }
.quad, .kcol { min-width: 0; } /* длинные названия не раздвигают колонку (реальные данные, 29.11) */
/* Один столбец: колонка приложения узкая даже на компьютере (два столбца вылезали вправо — аудит на реальных данных 29.11) */
.quad-hint { margin: 8px 4px 6px; font-size: 13px; color: var(--label-2); }
.quad.q1 h2 { color: var(--t-red, #FF3B30); }
.kanban { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.kcol { flex: 0 0 min(86vw, 340px); scroll-snap-align: start; }
.kmoves { display: flex; gap: 8px; padding: 0 16px 10px 40px; flex-wrap: wrap; }
.kmoves .chip { min-height: 30px; font-size: 13px; }
.habit .row-main { min-width: 0; }
.hgrid { display: flex; gap: 3px; margin-top: 6px; }
.hgrid i { width: 14px; height: 14px; border-radius: 4px; background: var(--fill); flex: 0 0 auto; }
.hgrid i.on { background: var(--t-green, #34C759); }
.hgrid i.today { outline: 1.5px solid var(--label-2); outline-offset: 1px; }
.wheel { width: 100%; max-width: 360px; display: block; margin: 0 auto 8px; }
.wheel .ring { fill: none; stroke: var(--sep); stroke-width: 1; }
.wheel .axis { stroke: var(--sep); stroke-width: 1; }
.wheel text { font-size: 11px; fill: var(--label-2); }
.wheel .cur { fill: color-mix(in srgb, var(--t-pink, #FF2D55) 22%, transparent); stroke: var(--t-pink, #FF2D55); stroke-width: 2; }
.wheel .prev { fill: none; stroke: var(--label-2); stroke-width: 1.5; stroke-dasharray: 4 4; }
.wheel-row { gap: 10px; }
.wheel-row .row-label { flex: 0 0 9.5em; font-size: 15px; }
.wheel-row input[type=range] { flex: 1; min-width: 0; accent-color: var(--t-pink, #FF2D55); }
.wheel-row .wv { width: 1.6em; text-align: right; font-variant-numeric: tabular-nums; }
.check-box { width: 22px; height: 22px; flex: 0 0 auto; accent-color: var(--t-green, #34C759); }
.row-label.planned { color: var(--label-2); font-size: 15px; }

/* Аудит 29.11.2026 (Lighthouse/DevTools MCP): контраст красной пометки, сдвиг при загрузке */
:root { --red-text: #C4000F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --red-text: #FF6961; } }
#home.booting #filter, #home.booting #view, #home.booting #groupby, #home.booting .search-row, #home.booting #chips { display: none; }
/* Галочки и кружки выбора в строках (недельный обзор, «Кто вы?»): не растягивать; подпись — целиком */
.row input.check-box { flex: 0 0 22px; width: 22px; min-width: 22px; height: 22px; margin: 0; padding: 0; }
.row:has(> input.check-box) .row-sub { white-space: normal; overflow: visible; text-overflow: clip; }
.done-row .row-label { color: var(--label-2); text-decoration: line-through; text-decoration-color: var(--sep); }

.voice-said { font-size: 17px !important; font-weight: 600 !important; }

/* 29.11.2026, по скрину владельца: пометки — строкой под названием, название на всю ширину (раньше переносилось по слову) */
.task .row-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin-top: 3px; min-width: 0; }
.task .row-meta .row-sub { flex: 1 1 8em; min-width: 0; }
.task .row-label { overflow-wrap: anywhere; }
