/* style.css — Минутки mini-app, vanilla port.
   Шрифт: Nunito (Google Fonts), веса 200 (обычный текст) и 600 (заголовки). */

/* ─────────────────────────────────────────────
   Theme tokens
   ───────────────────────────────────────────── */
:root {
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --surface-2: #F1F0EC;
  --ink: #000000;
  --muted: oklch(0.55 0 0);
  --muted-strong: oklch(0.38 0 0);
  --line: oklch(0.91 0 0);
  --line-strong: oklch(0.78 0 0);

  --acc-l: 0.62; --acc-c: 0.16; --acc-h: 252; /* cobalt default */
  --accent: oklch(var(--acc-l) var(--acc-c) var(--acc-h));
  --accent-soft: oklch(var(--acc-l) var(--acc-c) var(--acc-h) / 0.12);
  --accent-line: oklch(var(--acc-l) var(--acc-c) var(--acc-h) / 0.35);

  --ok: oklch(0.55 0.13 145);
  --ok-soft: oklch(0.55 0.13 145 / 0.1);
  --ok-line: oklch(0.55 0.13 145 / 0.3);
  --warn: oklch(0.62 0.13 70);
  --warn-soft: oklch(0.62 0.13 70 / 0.1);
  --warn-line: oklch(0.62 0.13 70 / 0.3);
  --danger: oklch(0.55 0.18 25);
  --danger-soft: oklch(0.55 0.18 25 / 0.1);
  --danger-line: oklch(0.55 0.18 25 / 0.3);

  --mono: "Nunito", system-ui, sans-serif;
}

html[data-theme="dark"] {
  --bg: #0B0B0D;
  --surface: #141417;
  --surface-2: #1A1A1E;
  --ink: #F2F2F0;
  --muted: oklch(0.62 0 0);
  --muted-strong: oklch(0.78 0 0);
  --line: oklch(0.24 0 0);
  --line-strong: oklch(0.32 0 0);

  --accent: oklch(calc(var(--acc-l) + 0.04) var(--acc-c) var(--acc-h));
  --accent-soft: oklch(var(--acc-l) var(--acc-c) var(--acc-h) / 0.18);
  --accent-line: oklch(var(--acc-l) var(--acc-c) var(--acc-h) / 0.4);

  --ok: oklch(0.78 0.12 145);
  --ok-soft: oklch(0.78 0.12 145 / 0.18);
  --ok-line: oklch(0.78 0.12 145 / 0.4);
  --warn: oklch(0.82 0.13 80);
  --warn-soft: oklch(0.82 0.13 80 / 0.18);
  --warn-line: oklch(0.82 0.13 80 / 0.4);
  --danger: oklch(0.70 0.18 25);
  --danger-soft: oklch(0.70 0.18 25 / 0.2);
  --danger-line: oklch(0.70 0.18 25 / 0.4);
}

/* accent variants */
html[data-accent="lime"]    { --acc-l: 0.72; --acc-c: 0.16; --acc-h: 145; }
html[data-accent="amber"]   { --acc-l: 0.74; --acc-c: 0.16; --acc-h: 70;  }
html[data-accent="magenta"] { --acc-l: 0.62; --acc-c: 0.16; --acc-h: 340; }

/* font scale (размер шрифта из меню стилей) — 5 ступеней как в Telegram */
:root { --fs-scale: 1; --fs-root: 14px; }
html[data-fontscale="xs"] { --fs-scale: 0.79; --fs-root: 11px; }
html[data-fontscale="s"]  { --fs-scale: 0.93; --fs-root: 13px; }
html[data-fontscale="m"]  { --fs-scale: 1.07; --fs-root: 15px; }
html[data-fontscale="l"]  { --fs-scale: 1.21; --fs-root: 17px; }
html[data-fontscale="xl"] { --fs-scale: 1.36; --fs-root: 19px; }

/* ─────────────────────────────────────────────
   Нормированные размеры (адаптивные через clamp).
   Все карточки/фильтры/отступы используют эти переменные →
   одинаковый масштаб на любом экране + подстройка под ширину.
   ───────────────────────────────────────────── */
:root {
  --pad-x:        clamp(12px, 3.8vw, 16px);   /* горизонтальный padding везде */
  --pad-y-card:   clamp(11px, 1.6vh, 13px);   /* вертикальный padding карточек */
  --gap-card:     clamp(8px,  1.1vh, 10px);   /* расстояние между карточками */
  --gap-row:      clamp(6px,  0.9vh, 8px);    /* расстояние между строками внутри */
  --card-radius:  clamp(12px, 3.4vw, 14px);   /* скругление карточек */
  --chip-h:       clamp(28px, 6vh, 32px);     /* высота чипа-фильтра */
  --chip-pad-x:   clamp(10px, 2.8vw, 14px);   /* боковой отступ чипа */
  --chip-radius:  calc(var(--chip-h) / 2);    /* чип — всегда капсула */
  --btn-h:        clamp(42px, 9vh, 48px);     /* высота крупных кнопок */
  --input-h:      clamp(40px, 8vh, 44px);     /* высота инпутов */
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: var(--fs-root);
  font-weight: 200;
  letter-spacing: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  overflow: hidden;
}
button { font-family: inherit; color: inherit; letter-spacing: inherit; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-feature-settings: 'tnum' 1; }

/* Имя-ссылка на чат (внутри карточки): подчёркивание как классическая ссылка */
.link-name { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; cursor: pointer; }

/* Иконки из PNG через CSS mask — наследуют currentColor, работают в обеих темах.
   Размер масштабируется вместе со шрифтом (--fs-scale), как весь текст UI. */
.ic-mask {
  display: inline-block;
  width: calc(18px * var(--fs-scale)); height: calc(18px * var(--fs-scale));
  background: currentColor;
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
  vertical-align: middle;
}
.ic-mask.gear { -webkit-mask-image: url("icons/settings.svg"); mask-image: url("icons/settings.svg"); }
.ic-mask.star { -webkit-mask-image: url("icons/paint.svg"); mask-image: url("icons/paint.svg"); }

.stage {
  position: fixed; inset: 0;
  background: var(--bg);
  overflow: hidden;
}
.phone-scale { width: 100%; height: 100%; }

/* ─────────────────────────────────────────────
   Device frame
   ───────────────────────────────────────────── */
.device {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 0; overflow: hidden;
  background: var(--bg);
  display: flex; flex-direction: column;
}
.island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 126px; height: 37px; border-radius: 24px; background: #000; z-index: 50;
}
.statusbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  height: 56px; padding: 0 30px;
  display: flex; align-items: center; justify-content: space-between;
  color: var(--ink);
}
.sb-time { font-weight: 600; font-size: 15px; padding-top: 4px; }
.sb-icons { display: flex; align-items: center; gap: 6px; padding-top: 4px; }
.sb-icons svg { fill: var(--ink); }
.home-indicator {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 139px; height: 5px; border-radius: 100px;
  background: color-mix(in oklch, var(--ink) 35%, transparent); z-index: 60;
  pointer-events: none;
}

.app {
  position: absolute; inset: 0;
  top: 0; bottom: 0;
  display: flex; flex-direction: column;
  background: var(--bg);
}

/* ─────────────────────────────────────────────
   Header + segments
   ───────────────────────────────────────────── */
.hdr { border-bottom: 0.5px solid var(--line); background: var(--bg); }
.hdr-top { display: flex; align-items: center; gap: 8px; padding: 8px var(--pad-x) 10px; }
.botmark {
  /* Логотип масштабируется вместе со шрифтом (--fs-scale) */
  width: calc(28px * var(--fs-scale)); height: calc(28px * var(--fs-scale)); border-radius: 7px;
  object-fit: contain;
  flex-shrink: 0;
}
.hdr-titles { flex: 1; min-width: 0; }
.hdr-title { font-size: calc(18px * var(--fs-scale)); font-weight: 600; line-height: 1.15; letter-spacing: -0.2px; }
.hdr-sub { font-size: 10px; color: var(--muted); letter-spacing: 0.3px; margin-top: 1px; }
.icon-btn {
  /* Кнопка-иконка (настройки, вид и др.) масштабируется вместе со шрифтом */
  width: calc(32px * var(--fs-scale)); height: calc(32px * var(--fs-scale)); padding: 0; border-radius: 8px;
  background: transparent; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: color-mix(in oklch, var(--ink) 6%, transparent); }
.icon-btn svg { width: calc(18px * var(--fs-scale)); height: calc(18px * var(--fs-scale)); }

/* segmented control — pill (default) */
.segs { padding: 6px var(--pad-x) 10px; }
.segs-track {
  display: flex; gap: 2px;
  background: var(--surface-2); border: 0.5px solid var(--line);
  border-radius: 10px; padding: 2px;
  overflow-x: auto; scrollbar-width: none;
}
.segs-track::-webkit-scrollbar { display: none; }
.seg {
  flex: 1 0 auto; padding: 6px 8px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: calc(13px * var(--fs-scale)); font-weight: 600; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 120ms ease, color 120ms ease;
}
.seg .cnt { font-family: var(--mono); font-size: calc(10px * var(--fs-scale)); opacity: 0.7; font-weight: 200; color: inherit; }
.seg[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,0.06); }

/* underline variant */
html[data-segments="underline"] .segs-track { background: transparent; border: 0; padding: 0; gap: 0; border-bottom: 0.5px solid var(--line); }
html[data-segments="underline"] .seg { border-radius: 0; padding: 12px 4px; border-bottom: 2px solid transparent; margin-bottom: -1px; box-shadow: none; }
html[data-segments="underline"] .seg[aria-selected="true"] { background: transparent; border-bottom-color: var(--ink); }

/* boxed variant */
html[data-segments="boxed"] .segs-track { background: transparent; border: 0; padding: 0; gap: 0; }
html[data-segments="boxed"] .seg { border-radius: 0; border: 0.5px solid var(--line); border-left-width: 0; text-transform: uppercase; font-family: var(--mono); font-size: calc(12px * var(--fs-scale)); box-shadow: none; }
html[data-segments="boxed"] .seg:first-child { border-left-width: 0.5px; }
html[data-segments="boxed"] .seg[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ─────────────────────────────────────────────
   Scroll region
   ───────────────────────────────────────────── */
.scroll { flex: 1; overflow: auto; position: relative; }
.scroll::-webkit-scrollbar { width: 0; }
.scroll { scrollbar-width: none; }

/* filter chips row */
.chips-wrap { position: relative; }
.chips { display: flex; gap: 6px; padding: 4px var(--pad-x) 10px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips-edge {
  position: absolute; top: 0; bottom: 10px; width: 28px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 2; opacity: 0;
  transition: opacity 200ms ease;
}
.chips-edge.left { left: 0; background: linear-gradient(to right, var(--bg) 30%, transparent); }
.chips-edge.right { right: 0; background: linear-gradient(to left, var(--bg) 30%, transparent); }
.chips-edge svg { color: var(--muted); }
.chips-edge.left svg { transform: rotate(180deg); }
.chips-wrap[data-can-left="true"] .chips-edge.left,
.chips-wrap[data-can-right="true"] .chips-edge.right { opacity: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: var(--chip-h); padding: 0 var(--chip-pad-x); border-radius: var(--chip-radius); cursor: pointer;
  font-size: calc(12px * var(--fs-scale)); font-weight: 300; white-space: nowrap; flex-shrink: 0;
  border: 0.5px solid var(--line); background: var(--surface); color: var(--ink);
  transition: all 120ms ease;
}
.chip[data-active="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.chip svg { width: 12px; height: 12px; }

/* group header */
.group-date { padding: 6px var(--pad-x) 8px; font-family: var(--mono); font-size: calc(10px * var(--fs-scale)); color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* ─────────────────────────────────────────────
   Cards
   ───────────────────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: var(--gap-card); padding: 0 var(--pad-x); }
.card-list[data-style="divided"] { gap: 0; padding: 0; }

.mcard {
  text-align: left; width: 100%; display: block; cursor: pointer;
  color: inherit; font: inherit;
  background: var(--surface); border: 0.5px solid var(--line); border-radius: var(--card-radius);
  padding: var(--pad-y-card) var(--pad-x);
}
.card-list[data-style="filled"] .mcard { background: var(--surface-2); border: 0; }
.card-list[data-style="divided"] .mcard { background: var(--bg); border: 0; border-radius: 0; border-bottom: 0.5px solid var(--line); padding: 14px 16px; }

.mcard-top { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.mcard-chat-pill { display: inline-flex; cursor: pointer; }
.mcard-chat-pill:active { opacity: 0.6; }
.mcard-meta { font-family: var(--mono); font-size: calc(10.5px * var(--fs-scale)); color: var(--muted); letter-spacing: 0.3px; }
.mcard-title { font-size: calc(14.5px * var(--fs-scale)); line-height: 1.35; font-weight: 600; letter-spacing: -0.1px; margin-bottom: 6px; text-wrap: balance; }
.mcard-preview { font-size: calc(12.5px * var(--fs-scale)); line-height: 1.45; color: var(--muted-strong); margin-bottom: 10px; text-wrap: pretty; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.mcard-foot { display: flex; align-items: center; gap: 10px; font-size: calc(11px * var(--fs-scale)); color: var(--muted); }
.mcard-stats { font-family: var(--mono); font-size: calc(10.5px * var(--fs-scale)); letter-spacing: 0.2px; }
.spacer { flex: 1; }

.avatars { display: flex; }
.avatars .av { margin-left: -8px; }
.avatars .av:first-child { margin-left: 0; }

.av {
  border-radius: 6px; flex-shrink: 0; border: 0.5px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 200; font-size: calc(9px * var(--fs-scale));
  color: rgba(0,0,0,0.5); letter-spacing: 0.5px; text-transform: uppercase;
}

/* pill / badge */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: calc(10.5px * var(--fs-scale)); line-height: 1.1; font-weight: 200;
  letter-spacing: 0.4px; text-transform: uppercase;
  border-radius: 4px; padding: 2px 6px; white-space: nowrap;
  color: var(--muted); background: var(--surface-2); border: 0.5px solid var(--line);
}
.pill.xs { font-size: calc(10px * var(--fs-scale)); padding: 2px 6px; }
.pill.nocaps { text-transform: none; letter-spacing: 0.05px; }
.pill[data-tone="accent"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.pill[data-tone="ok"]     { color: var(--ok);     background: var(--ok-soft);     border-color: var(--ok-line); }
.pill[data-tone="warn"]   { color: var(--warn);   background: var(--warn-soft);   border-color: var(--warn-line); }
.pill[data-tone="danger"] { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-line); }

.empty { padding: 40px; text-align: center; color: var(--muted); font-size: calc(13px * var(--fs-scale)); }

/* ─────────────────────────────────────────────
   Task rows
   ───────────────────────────────────────────── */
.tgroup { margin-bottom: 18px; }
.tgroup-hd {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 8px;
  padding: 6px var(--pad-x) 8px; background: transparent; border: 0; cursor: pointer;
  font-size: calc(13px * var(--fs-scale)); font-weight: 600; color: var(--ink);
}
.tgroup-hd .chev { display: inline-flex; color: var(--muted); transition: transform 160ms ease; }
.tgroup-hd[data-collapsed="true"] .chev { transform: rotate(-90deg); }

.trow {
  text-align: left; width: 100%; cursor: pointer; color: inherit; font: inherit;
  display: flex; align-items: flex-start; gap: 10px; padding: var(--pad-y-card) var(--pad-x);
  background: var(--surface); border: 0.5px solid var(--line); border-radius: var(--card-radius);
}
.card-list[data-style="filled"] .trow { background: var(--surface-2); border: 0; }
.card-list[data-style="divided"] .trow { background: var(--bg); border: 0; border-radius: 0; border-bottom: 0.5px solid var(--line); }
html[data-density="compact"] .trow { padding: 8px 12px; }
html[data-density="comfy"]   .trow { padding: 14px 14px; }

.tcheck {
  width: 22px; height: 22px; padding: 0; flex-shrink: 0; border-radius: 4px;
  border: 1px solid var(--line-strong); background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
  transition: all 120ms ease;
}
.tcheck[data-status="wip"]  { border-color: var(--accent); }
.tcheck[data-status="done"] { border-color: var(--accent); background: var(--accent); color: #fff; }
.tcheck .dot { width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.tcheck svg { width: 12px; height: 12px; }

.trow-body { flex: 1; min-width: 0; }
.trow-title { font-size: calc(14px * var(--fs-scale)); font-weight: 600; line-height: 1.35; text-wrap: pretty; }
.trow[data-done="true"] .trow-title { text-decoration: line-through; opacity: 0.55; }
.trow-desc { font-size: calc(12px * var(--fs-scale)); color: var(--muted); line-height: 1.4; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.trow-foot { margin-top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
html[data-density="compact"] .trow-foot { margin-top: 4px; }
.trow-foot .m { font-family: var(--mono); font-size: calc(10.5px * var(--fs-scale)); color: var(--muted); letter-spacing: 0.3px; display: flex; align-items: center; gap: 3px; }
.trow-foot .m svg { width: 11px; height: 11px; }
.trow-av { padding-top: 2px; }

/* swipe-to-delete (task rows): свайп вправо открывает кнопку «Удалить».
   Только для touch-устройств (pointer: coarse) — на десктопе свайпнуть
   нельзя, а красная кнопка под карточкой могла выглядывать в углах. */
.swipe-wrap { position: relative; overflow: hidden; border-radius: var(--card-radius); }
.swipe-bg { position: absolute; inset: 0; display: flex; align-items: stretch; justify-content: flex-start; pointer-events: none; border-radius: var(--card-radius); overflow: hidden; }
.swipe-del { pointer-events: auto; width: 84px; background: var(--danger); color: #fff; border: 0; padding: 0 8px; font: inherit; font-size: calc(13px * var(--fs-scale)); font-weight: 200; display: flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; white-space: nowrap; }
.swipe-del svg { width: 15px; height: 15px; }
.swipe-content { position: relative; background: var(--surface); transition: transform .25s ease; will-change: transform; border-radius: var(--card-radius); z-index: 1; }
.card-list[data-style="filled"] .swipe-content { background: var(--surface-2); }
.card-list[data-style="divided"] .swipe-content { background: var(--bg); border-radius: 0; }
.card-list[data-style="divided"] .swipe-wrap { border-radius: 0; }

/* Десктоп (есть hover + точный указатель): убираем swipe-кнопку и саму
   обёртку свайпа — она не используется (нет touch), а красная кнопка
   под карточкой могла выглядывать в subpixel-зазорах скруглённых углов.
   Карточка (.trow) рисуется напрямую, удаление — через detail-экран. */
@media (hover: hover) and (pointer: fine) {
  .swipe-bg { display: none; }
  .swipe-content { transform: none !important; transition: none; }
}

/* Входящие задачи (от других пользователей) — с подчёркивающей обводкой
   акцентным цветом как отличительный маркер «чужой» задачи. Скругление
   и фон — те же, что у личных карточек. Применяется по атрибуту
   data-open-inbox, который есть только у inboxRowHTML. У личных задач
   этого атрибута нет — остаются без подчёркивания. */
.trow[data-open-inbox] {
  border-bottom: 2px solid var(--accent);
}

/* FAB — Material Design: круглый, нижний правый угол, на всех экранах.
   z-index ниже fullsheet (50), чтобы скрываться под детальными экранами. */
.fab {
  position: absolute; right: calc(16px + env(safe-area-inset-right)); bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 40;
  width: 56px; height: 56px; padding: 0; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 28px rgba(0,0,0,0.28);
}
.fab svg { width: 22px; height: 22px; }

/* Счётчик задач в заголовке группы (число справа от pill-статуса) */
.tgroup-cnt { margin-left: auto; font-family: var(--mono); font-size: calc(10.5px * var(--fs-scale)); color: var(--muted); font-weight: 200; opacity: 0.8; }

/* ─────────────────────────────────────────────
   Detail header (shared)
   ───────────────────────────────────────────── */
.dhead {
  display: flex; align-items: center; gap: 4px; padding: 12px var(--pad-x);
  border-bottom: 0.5px solid var(--line); background: var(--bg);
}
.dhead-titles { flex: 1; min-width: 0; }
.dhead-title { font-size: calc(14px * var(--fs-scale)); font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dhead-sub { font-family: var(--mono); font-size: calc(10.5px * var(--fs-scale)); color: var(--muted); letter-spacing: 0.3px; margin-top: 1px; }

/* ─────────────────────────────────────────────
   Full sheet (detail overlays)
   ───────────────────────────────────────────── */
.fullsheet {
  position: absolute; inset: 0; z-index: 50; background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform 320ms cubic-bezier(.22,.9,.26,1);
}
.fullsheet.open { transform: translateY(0); }
.detail-scroll { overflow: auto; flex: 1; padding: 0 var(--pad-x) 30px; scrollbar-width: none; }
.detail-scroll::-webkit-scrollbar { display: none; }

/* bot strip */
.bot-strip { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 0.5px solid var(--line); }
.bot-strip svg { width: 14px; height: 14px; }
.bot-strip .m { font-family: var(--mono); font-size: calc(10.5px * var(--fs-scale)); color: var(--muted); letter-spacing: 0.3px; }

.detail-title { font-size: calc(22px * var(--fs-scale)); line-height: 1.2; font-weight: 600; letter-spacing: -0.3px; text-wrap: balance; margin: 14px 0 12px; }

/* meta block */
.meta-block { border: 0.5px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; margin-bottom: 22px; }
.meta-line { display: flex; align-items: center; min-height: 36px; padding: 8px var(--pad-x); border-bottom: 0.5px solid var(--line); gap: 12px; }
.meta-line:last-child { border-bottom: 0; }
.meta-line.top { align-items: flex-start; }
.meta-key { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: 0.6px; text-transform: uppercase; min-width: 84px; }
.meta-line.top .meta-key { padding-top: 3px; }
.meta-val { flex: 1; display: flex; justify-content: flex-end; text-align: right; gap: 4px; flex-wrap: wrap; }

.link-btn { background: transparent; border: 0; padding: 0; color: var(--accent); font: inherit; font-size: calc(13px * var(--fs-scale)); cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.link-btn:hover { text-decoration: underline; }
.link-btn svg { width: 11px; height: 11px; }
.link-chip { background: var(--accent-soft); color: var(--accent); border: 0; font-family: var(--mono); font-size: calc(11px * var(--fs-scale)); letter-spacing: 0.2px; padding: 2px 5px; border-radius: 4px; cursor: pointer; }
.link-chip.muted { background: var(--surface-2); color: var(--muted); }

/* themes */
.theme { margin-bottom: 22px; }
.theme-hd, .sub-hd {
  width: 100%; text-align: left; display: flex; align-items: baseline; gap: 8px;
  background: transparent; border: 0; cursor: pointer; color: inherit; font: inherit;
}
.theme-hd { padding: 6px 0; border-bottom: 0.5px solid var(--line); }
.theme-hd.static, .sub-hd.static { cursor: default; }
.theme-hd .chev, .sub-hd .chev { display: inline-flex; align-self: center; color: var(--muted); transition: transform 160ms ease; }
.theme-hd[data-collapsed="true"] .chev, .sub-hd[data-collapsed="true"] .chev { transform: rotate(-90deg); }
.theme-num { font-size: calc(17px * var(--fs-scale)); font-weight: 600; letter-spacing: -0.2px; color: var(--muted-strong); }
.theme-name { font-size: calc(17px * var(--fs-scale)); font-weight: 600; letter-spacing: -0.2px; line-height: 1.25; flex: 1; text-wrap: balance; }
.theme-body { padding-left: 26px; padding-top: 12px; }
.sub { margin-bottom: 16px; }
.sub-hd { padding: 4px 0 6px; }
.sub-hd .chev { width: 14px; }
.sub-num, .sub-name { font-size: calc(14px * var(--fs-scale)); font-weight: 600; letter-spacing: -0.1px; }
.sub-num { color: var(--muted-strong); }
.sub-name { color: var(--ink); flex: 1; text-wrap: balance; }
.sub-body { padding-top: 4px; }
.sub-body.indent { padding-left: 22px; }

.section { margin-bottom: 14px; }
.section-label { font-family: var(--mono); font-size: 9.5px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.section-dot { width: 6px; height: 6px; border-radius: 2px; background: var(--ink); }
.section-dot[data-tone="warn"]   { background: var(--warn); }
.section-dot[data-tone="accent"] { background: var(--accent); }

.bullet { display: flex; align-items: flex-start; gap: 8px; padding: 5px 0; }
.bullet .dash { width: 12px; flex-shrink: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.bullet .txt { flex: 1; font-size: calc(13.5px * var(--fs-scale)); line-height: 1.5; text-wrap: pretty; }
.bullet .add { opacity: 0; transition: opacity 120ms ease; border: 0.5px solid var(--line); background: var(--surface); color: var(--muted); width: 22px; height: 22px; border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; margin-top: -1px; }
.bullet:hover .add, .bullet:focus-within .add { opacity: 1; }
@media (hover: none) { .bullet .add { opacity: 1; } }
.bullet .add svg { width: 11px; height: 11px; }

/* next-step row */
.nstep {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px;
  border: 0.5px solid var(--line); border-radius: 10px; background: var(--surface);
  margin-bottom: 6px; transition: background 160ms ease, border-color 160ms ease;
}
.nstep[data-in="true"] { border-color: var(--accent-line); background: var(--accent-soft); }
.nstep[data-done="true"] { background: var(--surface-2); }
.nstep .ndot { margin-top: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); flex-shrink: 0; }
.nstep[data-in="true"] .ndot { background: var(--accent); }
.nstep[data-done="true"] .ndot { background: var(--ok); }
.nstep-body { flex: 1; min-width: 0; }
.nstep-task { font-size: calc(13.5px * var(--fs-scale)); line-height: 1.4; color: var(--muted-strong); text-wrap: pretty; margin-bottom: 5px; }
.nstep[data-in="true"] .nstep-task { color: var(--ink); }
.nstep[data-done="true"] .nstep-task { text-decoration: line-through; opacity: 0.7; }
.nstep-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.nstep-foot .m { font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: 0.3px; display: inline-flex; align-items: center; gap: 3px; background: transparent; border: 0; cursor: pointer; padding: 0; }
.nstep-foot .m svg { width: 11px; height: 11px; }
.nstep-actions { display: flex; gap: 4px; flex-shrink: 0; }
.mini-btn { width: 26px; height: 26px; border-radius: 7px; border: 0.5px solid var(--line); background: var(--bg); color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mini-btn svg { width: 13px; height: 13px; }
.mini-btn.danger { background: var(--surface); color: var(--danger); }
.mini-btn.muted { color: var(--muted); }

/* dock at bottom of detail */
.dock { padding: 10px var(--pad-x) calc(14px + env(safe-area-inset-bottom)); border-top: 0.5px solid var(--line); background: var(--surface); display: flex; gap: 8px; }

/* sticky action bar inside minute detail — закреплён вверху, всегда виден
   (не прячется за закруглённым низом экрана / home-indicator) */
.detail-actions {
  position: sticky; top: 0; z-index: 6;
  display: flex; gap: 8px;
  padding: 10px 0 12px;
  margin: 0 0 6px;
  background: var(--bg);
  border-bottom: 0.5px solid var(--line);
}
.btn-primary { flex: 1; min-height: var(--btn-h); padding: 12px 14px; background: var(--ink); color: var(--bg); border: 0; border-radius: 10px; font: inherit; font-weight: 200; font-size: calc(14px * var(--fs-scale)); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary svg { width: 14px; height: 14px; }
/* Кнопка «Повторно отправить задачу» (П.8) — мягкий «успешный» стиль */
.send-again { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.btn-secondary { min-height: var(--btn-h); padding: 12px 14px; background: var(--surface); color: var(--ink); border: 0.5px solid var(--line-strong); border-radius: 10px; font: inherit; font-weight: 200; font-size: calc(14px * var(--fs-scale)); cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; }
.btn-secondary svg { width: 14px; height: 14px; }
.btn-wide { margin-top: 8px; width: 100%; min-height: var(--btn-h); padding: 12px 14px; border-radius: 10px; border: 0.5px solid var(--line); background: var(--surface); color: var(--ink); display: flex; align-items: center; justify-content: space-between; cursor: pointer; font: inherit; }
.btn-wide .l { display: flex; align-items: center; gap: 8px; font-size: calc(13px * var(--fs-scale)); }
.btn-wide svg { width: 14px; height: 14px; }
.btn-danger { justify-content: center; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }

/* task detail specifics */
.status-seg { display: flex; gap: 4px; padding: 12px 0 16px; }
.status-seg button { flex: 1; padding: 8px 6px; border: 0.5px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 8px; font: inherit; cursor: pointer; font-size: calc(11.5px * var(--fs-scale)); font-weight: 200; font-family: var(--mono); white-space: nowrap; }
.status-seg button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.props { border: 0.5px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.prop { display: flex; align-items: center; padding: 11px var(--pad-x); border-bottom: 0.5px solid var(--line); gap: 10px; }
.prop:last-child { border-bottom: 0; }
.prop[data-clickable="true"] { cursor: pointer; }
.prop .pi { color: var(--muted); display: flex; }
.prop .pi svg { width: 16px; height: 16px; }
.prop .pl { font-size: calc(13px * var(--fs-scale)); color: var(--muted); min-width: 90px; }
.prop .pv { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: 6px; font-size: calc(13px * var(--fs-scale)); }
.prop .pc { color: var(--muted); display: flex; }
.prop .pc svg { width: 12px; height: 12px; }
.task-title { font-size: calc(22px * var(--fs-scale)); line-height: 1.25; font-weight: 600; letter-spacing: -0.3px; text-wrap: balance; margin-bottom: 6px; }
.label-line { font-family: var(--mono); font-size: calc(9.5px * var(--fs-scale)); color: var(--muted); letter-spacing: 1px; margin: 22px 0 8px; display: flex; align-items: center; gap: 6px; }
.label-line svg { width: 11px; height: 11px; }
.notes-area { width: 100%; padding: 10px var(--pad-x); background: var(--surface); color: var(--ink); border: 0.5px solid var(--line); border-radius: 10px; font: inherit; font-size: calc(13.5px * var(--fs-scale)); line-height: 1.5; resize: none; outline: none; min-height: 220px; flex: 1; }
.notes-area.grow { min-height: 40vh; }
.source-card { width: 100%; text-align: left; padding: var(--pad-y-card) var(--pad-x); border: 0.5px solid var(--line); border-radius: var(--card-radius); background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.source-top { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.source-top .m { font-family: var(--mono); font-size: calc(10.5px * var(--fs-scale)); color: var(--muted); }
.source-quote { padding-left: 10px; border-left: 2px solid var(--accent); font-size: calc(13px * var(--fs-scale)); line-height: 1.4; text-wrap: pretty; }
.full-report { margin: 14px 0 4px; border: 0.5px solid var(--line); border-radius: 12px; overflow: hidden; }
.full-report-hd { width: 100%; display: flex; align-items: center; gap: 6px; padding: 12px var(--pad-x); background: var(--surface); border: 0; cursor: pointer; font: inherit; color: var(--ink); }
.full-report-hd .chev { transition: transform 0.18s; }
.full-report-body { padding: 4px var(--pad-x) 14px; font-size: calc(13.5px * var(--fs-scale)); line-height: 1.55; color: var(--ink); border-top: 0.5px solid var(--line); }
.full-report-body h3 { font-size: calc(14.5px * var(--fs-scale)); font-weight: 600; margin: 12px 0 6px; }
.full-report-body h4 { font-size: calc(13.5px * var(--fs-scale)); font-weight: 600; margin: 10px 0 4px; }
.full-report-body p { margin: 6px 0; }
.full-report-body ul { margin: 6px 0; padding-left: 18px; }
.full-report-body li { margin: 3px 0; }
.full-report-body strong { font-weight: 600; }
.full-report-body code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.src-row { padding: 10px 0; border-bottom: 0.5px solid var(--line); }
.src-row:last-child { border-bottom: 0; }
.src-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.src-text { font-size: 13px; line-height: 1.45; color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.tags-field { min-height: 36px; }

/* ─────────────────────────────────────────────
   Bottom sheet
   ───────────────────────────────────────────── */
.backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.32); z-index: 100; opacity: 0; transition: opacity 220ms ease; }
.backdrop.open { opacity: 1; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 101;
  background: var(--surface);
  border-top-left-radius: 18px; border-top-right-radius: 18px;
  border-top: 0.5px solid var(--line);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.18);
  max-height: 88%; display: flex; flex-direction: column;
  padding-bottom: calc(28px + env(safe-area-inset-bottom)); overflow: hidden;
  transform: translateY(100%); transition: transform 280ms cubic-bezier(.22,.9,.26,1);
}
.sheet.tall { max-height: 92%; }
.sheet.open { transform: translateY(0); }
.sheet-grab { display: flex; justify-content: center; padding: 8px 0 6px; }
.sheet-grab span { width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); }
.sheet-hd { display: flex; align-items: center; justify-content: space-between; padding: 4px var(--pad-x) 12px; border-bottom: 0.5px solid var(--line); }
.sheet-title { font-size: calc(14px * var(--fs-scale)); font-weight: 600; letter-spacing: -0.1px; }
.sheet-body { overflow: auto; flex: 1; scrollbar-width: none; }
.sheet-body::-webkit-scrollbar { display: none; }

.picker-row { width: 100%; text-align: left; padding: var(--pad-y-card) var(--pad-x); display: flex; align-items: center; gap: 10px; background: transparent; border: 0; cursor: pointer; color: var(--ink); font: inherit; border-bottom: 0.5px solid var(--line); }
.picker-row .pr-main { flex: 1; }
.picker-row .pr-label { font-size: calc(14px * var(--fs-scale)); color: var(--ink); font-weight: 400; }
.picker-row .pr-sub { font-family: var(--mono); font-size: calc(10.5px * var(--fs-scale)); color: var(--muted); margin-top: 2px; }
.picker-row .pr-check svg { width: 16px; height: 16px; }
.picker-row .pr-count { margin-left: auto; font-family: var(--mono); font-size: calc(11px * var(--fs-scale)); color: var(--muted); font-weight: 600; padding-right: 4px; }

/* form fields */
.field { padding: 0; }
.field-label { font-family: var(--mono); font-size: calc(9.5px * var(--fs-scale)); color: var(--ink); font-weight: 400; letter-spacing: 1px; margin-bottom: 6px; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.field > .field-label { color: var(--ink); font-weight: 600; }
.field-label svg { width: 11px; height: 11px; }
.info-btn { background: none; border: 0; color: var(--muted); padding: 0 0 0 2px; display: inline-flex; align-items: center; cursor: pointer; opacity: 0.6; -webkit-tap-highlight-color: transparent; }
.info-btn:active { opacity: 1; }
.input, textarea.input { width: 100%; min-height: var(--input-h); padding: 10px 12px; background: var(--surface); color: var(--ink); border: 0.5px solid var(--line); border-radius: 8px; font: inherit; font-size: calc(14px * var(--fs-scale)); line-height: 1.4; outline: none; resize: vertical; }
.form { padding: 14px var(--pad-x) 16px; display: flex; flex-direction: column; gap: 12px; }
.row2 { display: flex; gap: 12px; }
.row2 > * { flex: 1; }
.choice { display: flex; gap: 4px; }
  .choice button { flex: 1; padding: 8px 4px; background: var(--surface); color: var(--ink); border: 0.5px solid var(--line); border-radius: 8px; cursor: pointer; font: inherit; font-size: calc(11px * var(--fs-scale)); font-weight: 200; letter-spacing: 0.4px; font-variant-numeric: tabular-nums; }
.choice button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.people-wrap { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.person-chip { padding: 6px 8px 6px 6px; border-radius: 999px; border: 0.5px solid var(--line); background: transparent; color: var(--ink); font: inherit; cursor: pointer; font-size: calc(12px * var(--fs-scale)); display: inline-flex; align-items: center; gap: 6px; }
.person-chip[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.person-chip.dashed { border-style: dashed; border-color: var(--line-strong); color: var(--muted); }
.person-chip.hide { display: none; }

.search-wrap { position: relative; }
.search-wrap .si { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: flex; }
.search-wrap .si svg { width: 13px; height: 13px; }
.search-wrap input { padding-left: 30px; padding-right: 32px; font-size: calc(13px * var(--fs-scale)); }
.search-wrap .sx { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; padding: 0; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.search-wrap .sx svg { width: 11px; height: 11px; }

/* tags input */
.tags-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; background: var(--surface); border: 0.5px solid var(--line); border-radius: 8px; min-height: 38px; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 4px; padding: 2px 4px 2px 7px; font-size: calc(11.5px * var(--fs-scale)); font-family: var(--mono); color: var(--muted-strong); }
.tag button { background: transparent; border: 0; color: var(--muted); cursor: pointer; width: 16px; height: 16px; padding: 0; border-radius: 3px; display: inline-flex; align-items: center; justify-content: center; }
.tag button svg { width: 10px; height: 10px; }
.tags-input input { flex: 1; min-width: 80px; padding: 2px 4px; border: 0; background: transparent; outline: none; font: inherit; font-size: 13px; color: var(--ink); }

/* due grid */
.due-grid { padding: 12px var(--pad-x); display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.due-cell { padding: 8px 4px; border-radius: 8px; border: 0.5px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.due-cell[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.due-cell .wd { font-family: var(--mono); font-size: calc(9px * var(--fs-scale)); opacity: 0.6; letter-spacing: 0.5px; }
.due-cell .dd { font-family: var(--mono); font-size: calc(14px * var(--fs-scale)); font-weight: 200; }
.due-cell .lbl { font-size: calc(9px * var(--fs-scale)); opacity: 0.7; }
.due-manual { padding: 10px var(--pad-x) 14px; border-top: 0.5px solid var(--line); margin-top: 6px; display: flex; align-items: center; gap: 12px; }
.due-manual input[type="date"] { flex: 1; font: inherit; font-family: var(--mono); font-size: calc(13px * var(--fs-scale)); padding: 8px 10px; border-radius: 8px; border: 0.5px solid var(--line); background: var(--surface); color: var(--ink); }

/* settings */
.set-card { border: 0.5px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.set-row { display: flex; align-items: center; gap: 10px; padding: 11px var(--pad-x); border-bottom: 0.5px solid var(--line); cursor: pointer; }
.set-row:last-child { border-bottom: 0; }
.set-row .sr-main { flex: 1; font-size: calc(14px * var(--fs-scale)); color: var(--ink); font-weight: 400; }
.set-row .sr-cnt { font-family: var(--mono); font-size: calc(10px * var(--fs-scale)); color: var(--muted); }
.set-more { width: 100%; padding: 10px var(--pad-x); background: transparent; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: calc(12.5px * var(--fs-scale)); display: flex; align-items: center; justify-content: center; gap: 6px; }
.set-more .chev { display: inline-flex; transition: transform 160ms ease; }
.set-more[data-expanded="true"] .chev { transform: rotate(180deg); }

/* «Чаты для регулярного статуса» — стилизация под field-label (как «СОЗДАНИЕ ЗАДАЧ»):
   капс, bold, чёрный, по левому краю. Подзаголовок «все чаты» — мелкий серый рядом. */
.set-more.set-more-label {
  justify-content: space-between;
  padding: 10px var(--pad-x) 6px var(--pad-x);
  color: var(--ink);
  font-family: var(--mono);
  font-size: calc(9.5px * var(--fs-scale));
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.set-more-label .sm-label { flex: 1; text-align: left; }
.set-more-label .sm-sub {
  color: var(--muted);
  font-family: inherit;
  font-weight: 300;
  font-size: calc(11px * var(--fs-scale));
  letter-spacing: 0;
  text-transform: none;
  margin-left: 4px;
}

.toggle { width: 32px; height: 18px; border-radius: 999px; background: var(--surface-2); border: 0.5px solid var(--line); position: relative; transition: all 160ms ease; flex-shrink: 0; }
.toggle[data-on="true"] { background: var(--accent); border-color: var(--accent-line); }
.toggle .knob { position: absolute; top: 1px; left: 1px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,0.18); transition: left 160ms ease; }
.toggle[data-on="true"] .knob { left: 15px; }

.custom-sched { margin-top: 8px; padding: var(--pad-y-card) var(--pad-x); border: 0.5px solid var(--line); border-radius: 10px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.days { display: flex; gap: 4px; }
.days button { flex: 1; padding: 8px 0; background: var(--surface); color: var(--ink); border: 0.5px solid var(--line); border-radius: 6px; cursor: pointer; font: inherit; font-family: var(--mono); font-size: calc(11px * var(--fs-scale)); font-weight: 200; letter-spacing: 0.4px; }
.days button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.time-row { display: flex; align-items: center; gap: 10px; }
.time-row input { width: 110px; padding: 8px 10px; background: var(--bg); color: var(--ink); border: 0.5px solid var(--line); border-radius: 6px; font: inherit; font-family: var(--mono); font-size: calc(13px * var(--fs-scale)); outline: none; }

/* list editor (statuses/priorities) */
.le-row { display: flex; align-items: center; gap: 10px; padding: 10px var(--pad-x); border-bottom: 0.5px solid var(--line); }
.le-badge-lock { font-family: var(--mono); font-size: 9px; color: var(--muted); letter-spacing: 0.5px; padding: 1px 4px; border: 0.5px solid var(--line); border-radius: 3px; text-transform: uppercase; }
.le-del { width: 24px; height: 24px; padding: 0; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.le-del svg { width: 12px; height: 12px; }
.le-edit { width: 24px; height: 24px; padding: 0; border-radius: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.le-edit svg { width: 12px; height: 12px; }
.le-edit:hover, .le-del:hover { background: var(--surface-2); color: var(--ink); }
.le-add { width: 100%; padding: 11px var(--pad-x); background: transparent; border: 0; color: var(--muted); cursor: pointer; font: inherit; font-size: calc(13px * var(--fs-scale)); display: flex; align-items: center; gap: 8px; }
.le-add svg { width: 14px; height: 14px; }
.le-form { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; }
.le-tones { display: flex; gap: 6px; }
.le-tone { width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1.5px solid transparent; cursor: pointer; }
.le-tone[aria-selected="true"] { border-color: var(--ink); }
.le-actions { display: flex; align-items: center; gap: 8px; }

/* message preview */
.msg-person { display: flex; align-items: center; gap: 10px; padding: 10px var(--pad-x); border: 0.5px solid var(--line); border-radius: 10px; background: var(--surface); }
.msg-person .mp-main { flex: 1; min-width: 0; }
.msg-person .mp-name { font-size: calc(14px * var(--fs-scale)); font-weight: 600; }
.msg-person .mp-handle { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.msg-preview { padding: var(--pad-y-card) var(--pad-x); border: 0.5px solid var(--line); border-radius: var(--card-radius); background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; font-size: calc(13.5px * var(--fs-scale)); line-height: 1.5; text-wrap: pretty; }
.msg-preview .head { font-weight: 600; margin-bottom: 4px; }
.msg-preview .notes-head { margin-top: 8px; padding-top: 8px; border-top: 0.5px dashed var(--line); font-weight: 600; }
.msg-preview .notes-body { white-space: pre-wrap; }

/* ─────────────────────────────────────────────
   Tweaks panel
   ───────────────────────────────────────────── */
.tweaks {
  position: absolute; right: 12px; top: 104px; z-index: 71; width: min(260px, calc(100vw - 24px));
  background: var(--surface); border: 0.5px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.22); padding: 12px var(--pad-x) 14px;
  display: none; flex-direction: column; gap: 10px;
}
.tweaks.open { display: flex; }
.tweaks-sec { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); margin-top: 4px; }
.tweaks-sec:first-child { margin-top: 0; }
.tweaks-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: calc(12px * var(--fs-scale)); }
.tweaks-row .tl { color: var(--ink); font-weight: 600; }
.seg-mini { display: flex; gap: 4px; }
.seg-mini button { padding: 4px 8px; border-radius: 6px; border: 0.5px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; font: inherit; font-size: calc(11px * var(--fs-scale)); }
.seg-mini button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.acc-swatches { display: flex; gap: 6px; }
.acc-swatch { width: 26px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,0.12); cursor: pointer; }
.acc-swatch[aria-selected="true"] { box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 1.5px var(--ink); }

/* font scale — ползунок (range slider) как в Telegram: буквы А/А по краям + число */
.font-scale { display: flex; align-items: center; gap: 10px; padding: 4px 0 2px; }
.font-scale .fs-A { color: var(--ink); font-weight: 600; line-height: 1; user-select: none; }
.font-scale .fs-small { font-size: 15px; }
.font-scale .fs-big { font-size: 22px; }
.font-scale .fs-val { font-family: var(--mono); font-size: 12px; color: var(--ink); font-weight: 600; min-width: 18px; text-align: center; }

/* Сам range-ползунок — кросс-платформенный стиль */
.fs-range {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 4px; border-radius: 2px; outline: none; cursor: pointer;
  background: var(--surface-2); border: 0.5px solid var(--line);
}
.fs-range::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18); cursor: pointer;
}
.fs-range::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--bg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.18); cursor: pointer;
}

/* toast */
.toast {
  position: absolute; top: 64px; left: 50%; transform: translateX(-50%) translateY(-60px);
  z-index: 999; background: var(--ink); color: var(--bg);
  padding: 8px 14px; border-radius: 10px; font-size: calc(12.5px * var(--fs-scale)); font-weight: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18); max-width: 88%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; pointer-events: none; transition: all 220ms ease;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* ─────────────────────────────────────────────
   Числа / моно-метадата: вес 600 + чёрный цвет.
   Nunito@200 на мелких размерах читается слабо —
   поэтому все даты/счётчики/статусы делаем жирными
   и контрастными.
   ───────────────────────────────────────────── */
.mcard-meta, .mcard-stats,
.trow-foot .m, .dhead-sub, .bot-strip .m,
.nstep-foot .m, .source-top .m,
.av, .tag,
.full-report-body code {
  font-weight: 600;
  color: var(--ink);
}

/* Описания/подписи — серый, лёгкий вес (ниже заголовков и row-текста).
   .set-more-label намеренно исключён — он стилизован под field-label. */
.picker-row .pr-sub,
.set-row .sr-cnt,
.set-more:not(.set-more-label) {
  font-weight: 300;
  color: var(--muted);
}

/* Только толщина (цвет управляется состоянием selected/unselected,
   чтобы не сломать инверсию на активной кнопке) */
.due-cell .wd, .due-cell .dd,
.status-seg button,
.days button,
.due-manual input[type="date"],
.time-row input {
  font-weight: 600;
}

/* ─────────────────────────────────────────────
   Adaptive / no-overflow safety
   Глобальные правила: мини-апп никогда не должен
   вылезать за пределы экрана, кнопки подстраиваются
   под любой размер (iPhone SE 320px → desktop).
   ───────────────────────────────────────────── */
html, body { width: 100%; max-width: 100vw; overflow-x: hidden; }
body { overflow-wrap: anywhere; word-break: break-word; }
img, svg, video { max-width: 100%; height: auto; }

/* flex-дети могут сжиматься (по умолчанию min-width: auto не даёт) */
.scroll > *, .scroll > * > *,
.fullsheet *, .sheet *, .sheet-body *,
.dhead *, .hdr-top *, .detail-actions *, .row2 *,
.status-seg *, .choice *, .segs-track *, .chips *,
.trow *, .nstep *, .meta-line *, .prop *, .set-row *,
.tgroup-hd *, .msg-person *, .form *, .picker-row *,
.bot-strip *, .theme-hd *, .sub-hd *, .bullet *, .tweaks-row * {
  min-width: 0; max-width: 100%;
}

/* Кнопки-переключатели: текст переносится, а не обрезается/вылезает */
.status-seg { flex-wrap: wrap; gap: 4px; }
.status-seg button { white-space: normal; padding: 8px 4px; line-height: 1.15; font-size: calc(11px * var(--fs-scale)); }
.choice { flex-wrap: wrap; }
.choice button { white-space: normal; padding: 8px 4px; line-height: 1.15; min-width: 0; }

/* Tweak-панель: адаптивная ширина (не вылезает на узких экранах) */
.tweaks { width: min(240px, calc(100vw - 24px)); max-width: calc(100vw - 24px); }

/* Кнопки в dock / detail-actions переносятся на следующую строку */
.detail-actions, .dock, .msg-preview, .le-actions { flex-wrap: wrap; }
.detail-actions > button, .dock > button, .le-actions > button { flex: 1 1 140px; min-width: 0; }

/* Сегменты вкладок: текст переносится, кнопки не вылезают */
.seg { white-space: normal; word-break: break-word; line-height: 1.15; }

/* Заголовок детали — переносить длинные названия, а не обрезать по горизонтали */
.dhead-title { white-space: normal; overflow: visible; text-overflow: clip; }

/* Две колонки в форме — на узком экране переходят в столбец */
@media (max-width: 360px) {
  .row2 { flex-direction: column; }
  .row2 > * { width: 100%; }
  .due-grid { gap: 3px; }
  .due-cell { padding: 6px 2px; }
  .days button { padding: 6px 0; font-size: calc(10px * var(--fs-scale)); letter-spacing: 0.2px; }
}

/* inputs / textareas никогда не вылезают */
.input, textarea.input, .notes-area,
input[type="text"], input[type="date"], input[type="time"], input[type="search"] {
  max-width: 100%; min-width: 0;
}

/* Аватарки-чипы не вылезают за родителя */
.avatars { max-width: 100%; overflow: hidden; }

/* Люди-чипы в форме — wrap, чтобы не выталкивать форму */
.people-wrap { max-width: 100%; }

/* Тост не шире экрана */
.toast { max-width: calc(100vw - 24px); white-space: normal; }

/* Вертикальная защита — на low-height экранах sheet не вылезает */
.sheet { max-height: 88vh; }
.sheet.tall { max-height: 92vh; }

/* ─────────────────────────────────────────────
   Active-состояния: на чёрном фоне все внутренние
   элементы (включая цифры/счётчики) становятся белыми.
   Перебивает жёсткий color:var(--ink) из блока выше.

   ВНИМАНИЕ: только для элементов, у которых при active
   background = var(--ink). pill-сегменты (.seg) при active имеют светлый
   фон → их НЕ трогаем (там текст остаётся тёмным).
   ───────────────────────────────────────────── */
.chip[data-active="true"],
.due-cell[aria-selected="true"],
.days button[aria-selected="true"],
.status-seg button[aria-selected="true"],
.choice button[aria-selected="true"] {
  color: var(--bg);
}

/* Дети с жёстко заданным var(--ink) — тоже белые внутри активного */
.chip[data-active="true"] .cnt,
.chip[data-active="true"] svg,
.due-cell[aria-selected="true"] .wd,
.due-cell[aria-selected="true"] .dd {
  color: var(--bg);
}

/* info sheet (регулярный статус) — единая сетка отступов var(--pad-x),
   как у остальных экранов: весь контент в одинаковых боковых инсетах */
.sched-info { padding: 12px var(--pad-x) 4px; }
.sched-info p { margin: 0 0 12px; font-size: calc(13px * var(--fs-scale)); line-height: 1.55; color: var(--ink); }
.sched-info .info-title { font-family: var(--mono); font-size: calc(10px * var(--fs-scale)); color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.sched-info ul { margin: 0 0 12px; padding-left: 18px; font-size: calc(13px * var(--fs-scale)); line-height: 1.55; color: var(--ink); }
.sched-info li { margin-bottom: 8px; }
.sched-info li:last-child { margin-bottom: 0; }
.sched-info .info-example { background: var(--surface-2); border: 0.5px solid var(--line); border-radius: 10px; padding: var(--pad-y-card) var(--pad-x); font-family: var(--mono); font-size: calc(12px * var(--fs-scale)); line-height: 1.7; color: var(--muted-strong); margin-bottom: 12px; }
.sched-info .info-note { font-size: calc(12px * var(--fs-scale)); color: var(--muted); line-height: 1.5; }

/* ─────────────────────────────────────────────
   Тарифные локи: функция недоступна на тарифе.
   Контрол приглушён и не кликается (data-locked),
   рядом — золотая корона + подпись с тарифом.
   ───────────────────────────────────────────── */
.cap-lock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: calc(9.5px * var(--fs-scale));
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #B8890B;
  white-space: normal;
}
.cap-lock svg { width: 12px; height: 12px; color: #D4A62A; flex-shrink: 0; }

/* Залоченные контролы — клик гасится в JS, визуально приглушены */
[data-locked="1"] { cursor: default; }
.picker-row[data-locked="1"] .pr-label,
.picker-row[data-locked="1"] .pr-sub,
.picker-row[data-locked="1"] .pr-av,
.picker-row[data-locked="1"] .pc,
.set-row[data-locked="1"] > .sr-main,
.set-row[data-locked="1"] > .toggle,
button[data-locked="1"].icon-btn {
  opacity: 0.55;
}
.picker-row[data-locked="1"] .cap-lock,
.set-row[data-locked="1"] .cap-lock { opacity: 1; }
.toggle[data-locked="1"] { opacity: 0.5; }
