/* ============================================
   PWS — рабочее пространство
   Палитра, шапка с вкладками, канбан-доска
   ============================================ */

/* ============================================
   ДИЗАЙН «PWS» — в духе Apple и Linear:
   серые поверхности, тонкие линии, один синий акцент.
   Всё остальное в файле берёт цвета отсюда
   ============================================ */
:root {
  /* БАЗОВЫЙ СЛОЙ — серые Apple. От темы не зависят.
     В компонентах их не пишем: там только смысловые токены ниже (--bg, --text, --accent…) */
  --gray-0:   #ffffff;
  --gray-50:  #f5f5f7;
  --gray-900: #1d1d1f;
  --ink-800:  #2c2c2e;
  --ink-900:  #1c1c1e;

  /* «в сети» — зелёная точка, одинаковая в обеих темах */
  --online: #34c759;

  color-scheme: light;

  --bg:         var(--gray-50);   /* фон страницы */
  --bg-soft:    var(--gray-0);    /* основные карточки */
  --bg-card:    #fafafb;          /* вложенные элементы: карточки задач, поля */
  --bg-hover:   #f0f0f3;
  --bg-beige:   #ebebef;          /* плашки: выбранная вкладка, метки */
  --text:       var(--gray-900);
  --muted:      #6e6e73;
  --border:     #e4e4e9;

  --border-strong: #d2d2d7;
  --line-soft:     #efeff2;
  --row-hover:     #f8f8fa;
  --faint:         #7b7b80;   /* ≈4:1 на белом — подписи и пустые состояния читаются */
  --header-bg:     rgba(245, 245, 247, .8);
  --pill-bg:       var(--gray-0);
  --side-bg:       #efeff2;   /* боковая панель с разделами */

  --gray:   #8e8e93;
  --blue:   #0066cc;
  --amber:  #c77700;
  --green:  #248a3d;
  --red:    #d70015;

  --radius-lg: 18px;   /* крупные блоки */
  --radius:    12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  /* тень-обводка: карточка отделяется тонкой линией и едва заметной глубиной */
  --shadow: 0 0 0 1px rgba(0, 0, 0, .04), 0 1px 2px rgba(0, 0, 0, .04), 0 10px 28px -14px rgba(0, 0, 0, .12);
  --shadow-pill: 0 0 0 1px rgba(0, 0, 0, .05), 0 6px 20px -10px rgba(0, 0, 0, .12);

  /* акцент по умолчанию — синий Apple */
  --accent:     #0066cc;
  --accent-2:   #0058b0;
  --accent-ink: color-mix(in srgb, var(--accent) 82%, var(--text));
  --accent-ring: color-mix(in srgb, var(--accent) 24%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 9%, transparent);
  --on-accent:  #ffffff;   /* текст на кнопках цвета акцента */

  /* главная кнопка — графитовая, как в макете; акцент — для выделения */
  --btn-bg:     var(--gray-900);
  --btn-hover:  #3a3a3c;
  --on-btn:     #ffffff;

  /* подложки для крупных блоков — без цвета, только глубина */
  --grad-tan:   linear-gradient(160deg, var(--ink-800) 0%, var(--ink-900) 100%);
  --grad-beige: linear-gradient(180deg, var(--gray-0) 0%, var(--gray-0) 100%);
  --grad-dark:  linear-gradient(170deg, var(--ink-800) 0%, var(--ink-900) 100%);
  --grad-photo: linear-gradient(135deg, #3a3a3c 0%, var(--ink-900) 100%);
}

/* ТЁМНАЯ ТЕМА — графит, как тёмный режим macOS */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:         #0c0c0d;
  --bg-soft:    #161618;
  --bg-card:    #1c1c1f;
  --bg-hover:   #232326;
  --bg-beige:   #2a2a2e;
  --text:       #f5f5f7;
  --muted:      #a1a1a6;
  --border:     #29292d;

  --border-strong: #3a3a3f;
  --line-soft:     #202023;
  --row-hover:     #1b1b1e;
  --faint:         #8d8d92;
  --header-bg:     rgba(12, 12, 13, .8);
  --pill-bg:       #161618;
  --side-bg:       #111113;

  --gray:   #8e8e93;
  --blue:   #409cff;
  --amber:  #ffb340;
  --green:  #30d158;
  --red:    #ff6961;

  --shadow: 0 0 0 1px rgba(255, 255, 255, .05), 0 12px 32px -16px rgba(0, 0, 0, .7);
  --shadow-pill: 0 0 0 1px rgba(255, 255, 255, .06), 0 8px 24px -12px rgba(0, 0, 0, .6);

  --accent:     #0a84ff;
  --accent-2:   #409cff;
  --accent-ink: #58a6ff;
  --on-accent:  #ffffff;

  --btn-bg:     #f5f5f7;
  --btn-hover:  #d8d8dc;
  --on-btn:     #0c0c0d;
}

/* ЦВЕТ АКЦЕНТА — системные цвета Apple («Синий» по умолчанию) */
:root[data-accent="indigo"]   { --accent: #5856d6; --accent-2: #4b49c0; }
:root[data-accent="graphite"] { --accent: #636366; --accent-2: #48484a; }
:root[data-accent="green"]    { --accent: #248a3d; --accent-2: #1d7433; }
:root[data-accent="orange"]   { --accent: #c45c00; --accent-2: #a84f00; }
:root[data-accent="pink"]     { --accent: #d6245a; --accent-2: #b91e4d; }
:root[data-theme="dark"][data-accent="indigo"]   { --accent: #5e5ce6; --accent-2: #7d7aff; --accent-ink: #9d9bff; }
:root[data-theme="dark"][data-accent="graphite"] { --accent: #8e8e93; --accent-2: #aeaeb2; --accent-ink: #c7c7cc; }
:root[data-theme="dark"][data-accent="green"]    { --accent: #248a3d; --accent-2: #30d158; --accent-ink: #30d158; }
:root[data-theme="dark"][data-accent="orange"]   { --accent: #c45c00; --accent-2: #ff9f0a; --accent-ink: #ffb340; }
:root[data-theme="dark"][data-accent="pink"]     { --accent: #d6245a; --accent-2: #ff375f; --accent-ink: #ff6482; }

/* КОМПАКТНЫЙ РЕЖИМ — плотнее отступы, больше влезает на экран */
:root[data-density="compact"] .main { padding: 18px 16px 40px; }
:root[data-density="compact"] .column { padding: 10px; gap: 9px; }
:root[data-density="compact"] .card { padding: 8px 10px; }
:root[data-density="compact"] .panel-head { margin-bottom: 16px; }
:root[data-density="compact"] .cal-day { min-height: 78px; }
:root[data-density="compact"] .kb-card { min-height: 104px; padding: 11px; }
:root[data-density="compact"] .side-box { padding: 12px; }
:root[data-density="compact"] .grid td { padding: 1px 6px; }
:root[data-density="compact"] .block { margin-bottom: 22px; }

/* АНИМАЦИИ ВЫКЛЮЧЕНЫ — уважаем и системную настройку «меньше движения» */
:root[data-motion="off"] *,
:root[data-motion="off"] *::before,
:root[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* кольцо фокуса с клавиатуры (Tab) — в цвет акцента; мышью не появляется.
   Поля ввода подсвечивают рамку сами, им кольцо не нужно */
:where(button, a, summary, [role="tab"], [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.logo:focus-visible { border-radius: 12px; outline-offset: 4px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }

/* линейные значки интерфейса (ico() в index.html) — размер как у текста рядом */
.ico { display: inline-block; width: 1.1em; height: 1.1em; flex: none; vertical-align: -.2em; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .ico { width: 15px; height: 15px; vertical-align: 0; }
.ico.is-fill { fill: currentColor; }

/* ---------- БОКОВАЯ ПАНЕЛЬ С РАЗДЕЛАМИ ---------- */
/* На компьютере .header — колонка слева во всю высоту, как в Linear и Finder:
   логотип, разделы по группам, внизу — человек, колокольчик и настройки.
   На узком экране (до 900 px) — полоса сверху, разделы строкой (см. ниже) */
:root { --side-w: 236px; }

.header {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  width: var(--side-w);
  padding: 14px 10px 10px;
  background: var(--side-bg);
  border-right: 1px solid var(--border);
}

.header-inner {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  grid-template-rows: auto minmax(0, 1fr) auto;
  column-gap: 2px;
  align-items: center;
}

/* логотип — кнопка возврата на главную */
.logo {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  margin-bottom: 14px;
  padding: 0 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease;
}
.logo:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }

.logo-mark {
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 6px;              /* скруглённый квадрат — как у иконки приложения */
  background: var(--ink-900) url(img/logo.png?v=3) center / cover no-repeat;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}

/* в окне приложения кнопки закрытия/сворачивания сидят в левом верхнем углу —
   прямо над боковой панелью, как у приложений macOS */
:root[data-native="1"] .header { padding-top: 44px; }

/* путь к папке в настройках */
.path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  user-select: all;
  overflow-wrap: anywhere;
}

/* ---------- ГЛАВНАЯ: ДАШБОРД ДНЯ ---------- */
/* Всё содержимое рисует renderHome() в script.js. Карточки — белые,
   с тенью-обводкой; цифры — одной ширины, чтобы суммы стояли ровно */

/* слово-акцент в заголовках разделов — в новом дизайне заголовок одного цвета */
.accent-word { color: inherit; }

.dash-hello { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 32px; }
.dash-hello h1 { font-size: clamp(28px, 3.2vw, 36px); font-weight: 600; letter-spacing: -.028em; line-height: 1.1; }
.dash-hello .muted { margin-top: 8px; font-size: 15px; }
.dash-actions { display: flex; gap: 8px; }
.btn-i { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* четыре главные цифры — одна полоса, разделённая линиями */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-soft);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dash-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 18px 22px 20px;
  border: none;
  border-left: 1px solid var(--line-soft);
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.dash-stat:first-child { border-left: none; }
.dash-stat:hover { background: var(--row-hover); }
.dash-stat span { font-size: 12.5px; color: var(--muted); }
.dash-stat b { max-width: 100%; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 24px; font-weight: 600; letter-spacing: -.025em; font-variant-numeric: tabular-nums; }
.dash-stat small { font-size: 12px; color: var(--faint); }
.dash-meter { width: 100%; height: 4px; margin-top: 10px; border-radius: 2px; background: var(--bg-beige); overflow: hidden; }
.dash-meter i { display: block; height: 100%; border-radius: 2px; background: var(--text); transition: width .4s ease; }

/* колонки: задачи слева, бюджет и привычки справа */
.dash-cols { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; align-items: start; }
.dash-cols-2 { grid-template-columns: 1fr 1fr; align-items: stretch; }
.dash-side { display: flex; flex-direction: column; gap: 20px; }
.dash-full { margin-bottom: 20px; }

.dash-card { border-radius: var(--radius-lg); background: var(--bg-soft); box-shadow: var(--shadow); overflow: hidden; }
.dash-head { display: flex; align-items: center; gap: 8px; height: 50px; padding: 0 20px; border-bottom: 1px solid var(--line-soft); }
.dash-head h2 { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.dash-head > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--faint); }
.dash-link {
  display: inline-flex; align-items: center; gap: 2px;
  margin-left: auto; padding: 4px 4px 4px 8px;
  border: none; border-radius: 6px; background: none;
  color: var(--muted); font-size: 13px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.dash-link:hover { background: var(--bg-hover); color: var(--text); }
.dash-link svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dash-body { padding: 16px 20px 20px; }
.dash-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 34px 20px; color: var(--faint); font-size: 13.5px; text-align: center; }

/* задачи строками, как в Linear */
.dash-group { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 20px; background: var(--bg); border-bottom: 1px solid var(--line-soft); font-size: 12.5px; font-weight: 500; color: var(--muted); }
.dash-group em { font-style: normal; font-weight: 400; color: var(--faint); }
.dash-row {
  display: grid;
  grid-template-columns: 16px 16px 64px minmax(0, 1fr) auto 62px;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 44px;
  padding: 0 20px;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  background: none;
  color: var(--text);
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background .12s ease;
}
.dash-row:last-child { border-bottom: none; }
.dash-row:hover { background: var(--row-hover); }
.dash-key { font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.dash-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-row.is-done .dash-title { color: var(--faint); }
.dash-label { max-width: 120px; height: 22px; padding: 0 9px; overflow: hidden; border-radius: 11px; box-shadow: inset 0 0 0 1px var(--border); font-size: 12px; line-height: 22px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.dash-due { font-size: 12.5px; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.dash-due.is-today { color: var(--text); font-weight: 500; }
.dash-due.is-late { color: var(--red); font-weight: 500; }

/* значки статуса и приоритета */
.st, .pr { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.st-fill { fill: currentColor; stroke: none; }
.st-tick { stroke: var(--bg-soft); stroke-width: 1.6; }
.st-todo { color: var(--faint); }
.st-progress { color: var(--amber); }
.st-review { color: var(--blue); }
.st-done { color: var(--accent); }
.pr { color: var(--faint); stroke-width: 2; }
.pr.is-high { color: var(--text); }
.pr .pr-off { opacity: .28; }

/* бюджет */
.dash-big { font-size: 30px; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.dash-big small { margin-left: 3px; font-size: 16px; font-weight: 500; color: var(--faint); }
.dash-cap { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.dash-bars { display: flex; align-items: flex-end; gap: 6px; height: 84px; margin: 20px 0 6px; }
.dash-bars i { flex: 1; border-radius: 4px 4px 2px 2px; background: var(--bg-beige); transition: background .15s ease; }
.dash-bars i:hover { background: var(--border-strong); }
.dash-bars i.is-now { background: var(--accent); }
.dash-bars-x { display: flex; gap: 6px; margin-bottom: 8px; font-size: 11px; color: var(--faint); }
.dash-bars-x span { flex: 1; text-align: center; }
.dash-kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 13px; }
.dash-kv span { color: var(--muted); font-variant-numeric: tabular-nums; }
.dash-kv span.is-text { color: var(--text); }
.dash-kv b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* привычки: квадратики последних семи дней */
.dash-habit { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.dash-habit-head { padding: 0 0 6px; border-top: none; }
.dash-habit > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-habit small { display: block; font-size: 12px; color: var(--faint); }
.dash-dots { display: flex; gap: 4px; }
.dash-dots i { width: 14px; height: 14px; border-radius: 4px; background: var(--bg-beige); }
.dash-dots i.is-on { background: var(--text); }
.dash-dots i.is-today:not(.is-on) { background: transparent; box-shadow: inset 0 0 0 1.5px var(--accent); }
.dash-habit-head .dash-dots i { height: auto; background: none; font-size: 10px; font-style: normal; text-align: center; color: var(--faint); }

/* неделя */
.dash-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dash-day {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  min-width: 0; min-height: 124px; padding: 12px;
  border: none; border-left: 1px solid var(--line-soft); background: none;
  color: var(--text); text-align: left; cursor: pointer;
  transition: background .12s ease;
}
.dash-day:first-child { border-left: none; }
.dash-day:hover { background: var(--row-hover); }
.dash-day-h { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 12px; color: var(--faint); }
.dash-day-h b { font-size: 15px; font-weight: 600; color: var(--text); }
.dash-day.is-today .dash-day-h b { display: grid; place-items: center; width: 24px; height: 24px; margin: -3px 0; border-radius: 50%; background: var(--accent); color: var(--on-accent); font-size: 13px; }
.dash-ev { overflow: hidden; padding: 4px 8px; border-radius: 6px; background: var(--bg-hover); font-size: 12px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.dash-ev.is-done { color: var(--faint); text-decoration: line-through; }
.dash-ev.is-late { background: color-mix(in srgb, var(--red) 10%, transparent); color: var(--red); }
.dash-ev.is-note { background: var(--accent-soft); color: var(--accent-ink); }
.dash-more { padding: 0 8px; font-size: 11.5px; color: var(--faint); }

/* тренировка и ежедневник */
.dash-wk { font-size: 19px; font-weight: 600; letter-spacing: -.02em; }
.dash-wk + .dash-cap { margin-bottom: 12px; }
.dash-wk + .dash-kv { margin-top: 12px; }
.dash-more-ex { padding-top: 8px; border-top: 1px solid var(--line-soft); }
.dash-quote { margin: 10px 0 16px; font-size: 14.5px; line-height: 1.6; color: var(--muted); }

/* заметка «О пространстве» */
.about-card .note-state { margin-left: auto; font-size: 12.5px; }

/* панель оформления заметки «О пространстве» */
.note-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  margin: 0 0 8px -6px;
}
.note-tools button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.note-tools button:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.note-tools svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tools-sep { width: 1px; height: 16px; background: var(--border-strong); margin: 0 4px; }

/* само поле описания */
.home-note {
  flex: 1;
  min-height: 110px;
  padding: 4px 0;
  outline: none;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}
.home-note:focus { color: var(--text); }

/* подсказка в пустом поле: :empty не годится — браузер оставляет там <br>,
   поэтому пустоту проверяет JS и вешает класс */
.home-note.is-empty::before {
  content: attr(data-placeholder);
  color: var(--faint);
  pointer-events: none;
}
.home-note.drag-over { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: 8px; }

.home-note h3 { font-size: 15px; color: var(--text); margin: 14px 0 4px; font-weight: 500; }
.home-note h3:first-child { margin-top: 0; }
.home-note p { margin-bottom: 6px; }
.home-note ul, .home-note ol { margin: 0 0 8px 18px; }
.home-note li { margin-bottom: 2px; }
.home-note a { color: var(--accent-ink); }
.home-note img { max-width: 100%; border-radius: var(--radius-sm); margin: 8px 0; }

.note-hint { margin-top: 8px; font-size: 11px; color: var(--faint); }

@media (max-width: 1100px) {
  .dash-cols, .dash-cols-2 { grid-template-columns: 1fr; }
  .dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-stat:nth-child(3) { border-left: none; }
  .dash-stat:nth-child(n+3) { border-top: 1px solid var(--line-soft); }
}
@media (max-width: 620px) {
  .dash-row { grid-template-columns: 16px minmax(0, 1fr) auto; padding: 0 16px; }
  .dash-row .pr, .dash-key, .dash-label { display: none; }
  .dash-group, .dash-head { padding: 0 16px; }
  .dash-body { padding: 14px 16px 18px; }
  .dash-week { grid-template-columns: repeat(7, 128px); overflow-x: auto; }
  .dash-stat { padding: 14px 16px 16px; }
  .dash-stat b { font-size: 20px; }
}

/* ---------- РАЗДЕЛЫ ---------- */
.tabs {
  grid-column: 1 / -1;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
/* вкладки не влезли в строку (телефон) — край, за которым есть ещё, плавно тает (класс ставит script.js) */
.tabs.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.tabs.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.tabs.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }

.tabs-group { display: flex; flex-direction: column; gap: 1px; }
.tabs-group[hidden] { display: none; }
.tabs-label { padding: 0 8px 5px; font-size: 11.5px; font-weight: 500; color: var(--faint); }

.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  font-size: 13.5px;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}
.tab-i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.tab.is-active { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); font-weight: 500; }
.tab.is-active .tab-i { color: var(--accent); }
.tab .tab-badge { margin-left: auto; }

/* ---------- НИЗ ПАНЕЛИ: настройки ---------- */
.gear {
  grid-row: 3;
  grid-column: 3;
  width: 32px;
  height: 32px;
  flex: none;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.gear svg { width: 17px; height: 17px; stroke-width: 1.6; }
.gear:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.gear-label { display: none; }

/* ---------- УЗКИЙ ЭКРАН: полоса сверху, разделы строкой ---------- */
@media (max-width: 900px) {
  .header {
    position: sticky;
    bottom: auto;
    width: auto;
    padding: 8px 12px 0;
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(1.8) blur(20px);
            backdrop-filter: saturate(1.8) blur(20px);
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .header-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
  .logo { margin: 0 auto 0 -8px; }
  .tabs { order: 5; width: 100%; flex-direction: row; gap: 2px; margin: 4px 0 0; padding-bottom: 8px; overflow-x: auto; overflow-y: hidden; }
  .tabs-group { display: contents; }
  .tabs-label { display: none; }
  .tab { width: auto; flex: none; height: 32px; padding: 0 10px; gap: 7px; }
  .me-name { display: none; }
  :root[data-native="1"] .header { padding-top: 32px; }
}

/* ---------- ОКНО НАСТРОЕК ---------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }

.modal-back {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .32);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  animation: fade .2s ease both;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

.modal-box {
  position: relative;
  width: min(620px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .06), 0 30px 80px -20px rgba(0, 0, 0, .35);
  animation: popIn .22s ease both;
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(12px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -.015em; }

.modal-body { padding: 6px 18px 18px; }

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
.set-row:last-child { border-bottom: none; }

.set-label b { display: block; font-size: 14px; font-weight: 500; }
.set-label span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* переключатель из нескольких кнопок */
/* переключатель — как сегменты macOS: серая дорожка, выбранное — белая плашка */
.seg {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
  border: none;
  border-radius: var(--radius-sm);
}
.seg button {
  padding: 5px 13px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.seg button:hover { color: var(--text); }
.seg button.is-on { background: var(--bg-soft); color: var(--text); font-weight: 500; box-shadow: 0 0 0 .5px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .12); }

/* кружки с цветами акцента */
.swatches { display: flex; gap: 8px; }
.swatches button {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid transparent;
  outline: 1px solid var(--border);
  cursor: pointer;
  transition: transform .15s ease;
}
.swatches button:hover { transform: scale(1.12); }
.swatches button.is-on { border-color: var(--bg-soft); outline: 2px solid var(--text); }

.set-actions { display: flex; gap: 8px; flex-wrap: wrap; }
#setStartTab { width: 210px; background: var(--bg); border-color: var(--border); }

/* ---------- ПАНЕЛИ ВКЛАДОК ---------- */
.main {
  margin-left: var(--side-w);   /* справа от боковой панели */
  padding: 40px 40px 72px;
}
.main > .panel { max-width: 1280px; margin: 0 auto; }
@media (max-width: 900px) {
  .main { margin-left: 0; padding: 24px 20px 56px; }
}

.panel { display: none; }

.panel.is-active {
  display: block;
  animation: fadeUp .3s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.panel-head h1 {
  font-size: clamp(26px, 3vw, 32px);
  font-weight: 600;
  letter-spacing: -.026em;
  line-height: 1.15;
  margin-bottom: 6px;
}

.muted { color: var(--muted); font-size: 14px; }

.panel-actions { display: flex; align-items: center; gap: 10px; }

.stat {
  font-size: 13px;
  color: var(--muted);
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  font-variant-numeric: tabular-nums;
}

.btn-ghost {
  min-height: 32px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-ghost:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.btn-ghost.danger:hover { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); background: color-mix(in srgb, var(--red) 8%, transparent); }

/* ---------- ДОСКА ---------- */
.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.column {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 200px;
}

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.column-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot-gray  { background: var(--gray); }
.dot-blue  { background: var(--blue); }
.dot-amber { background: var(--amber); }
.dot-green { background: var(--green); }

.count {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg-card);
  border-radius: 999px;
  padding: 2px 9px;
  min-width: 26px;
  text-align: center;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 60px;
  border-radius: var(--radius-sm);
  transition: background .15s ease, outline-color .15s ease;
  outline: 2px dashed transparent;
  outline-offset: 2px;
}

.cards.drag-over {
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  outline-color: var(--accent);
}

.cards:empty::after {
  content: "Пусто";
  display: grid;
  place-items: center;
  height: 60px;
  font-size: 13px;
  color: var(--faint);
}

/* ---------- КАРТОЧКА ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gray);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  cursor: grab;
  animation: cardIn .22s ease both;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

@keyframes cardIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: none; }
}

.card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card.dragging { opacity: .4; cursor: grabbing; }

.card[data-priority="low"]    { border-left-color: var(--gray); }
.card[data-priority="normal"] { border-left-color: var(--blue); }
.card[data-priority="high"]   { border-left-color: var(--red); }

.card-text {
  font-size: 14px;
  outline: none;
  word-break: break-word;
  white-space: pre-wrap;
}

.card-text:focus {
  background: var(--bg-hover);
  border-radius: 6px;
  padding: 2px 4px;
  margin: -2px -4px;
}

.card.flash {
  animation: flash 1.4s ease;
}
@keyframes flash {
  0%, 100% { box-shadow: none; }
  20%, 60% { box-shadow: 0 0 0 2px var(--accent), 0 8px 24px color-mix(in srgb, var(--accent) 40%, transparent); }
}

/* плашка с датами на карточке */
.card-meta:not(:empty) { margin-top: 8px; }

.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chip.late { color: var(--red);   border-color: color-mix(in srgb, var(--red) 40%, transparent);  background: color-mix(in srgb, var(--red) 10%, transparent); }
.chip.soon { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 40%, transparent); background: color-mix(in srgb, var(--amber) 10%, transparent); }

/* панель «даты и приоритет» внутри карточки */
/* без этой строки display:flex ниже перебил бы атрибут hidden
   и панель была бы раскрыта у всех карточек сразу */
.card-edit[hidden] { display: none; }

.card-edit {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}
.card-edit label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  min-width: 118px;
}
.card-edit .cell {
  background: var(--bg-soft);
  border-color: var(--border);
  padding: 5px 7px;
  font-size: 12px;
}
.card-edit .prio { padding-bottom: 4px; }

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
}

.card-date { font-size: 11px; color: var(--faint); }

.card-tools { display: flex; gap: 2px; opacity: 0; transition: opacity .18s ease; }
.card:hover .card-tools,
.card:focus-within .card-tools { opacity: 1; }

.icon-btn {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.danger:hover { background: color-mix(in srgb, var(--red) 15%, transparent); color: var(--red); }
.icon-btn:disabled { opacity: .25; cursor: default; }
.icon-btn:disabled:hover { background: transparent; color: var(--muted); }

/* ---------- ДОБАВЛЕНИЕ ---------- */
.add-btn {
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 9px;
  cursor: pointer;
  font-size: 13px;
  transition: all .18s ease;
}
.add-btn:hover { color: var(--accent-ink); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }

.composer {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.composer textarea {
  width: 100%;
  resize: vertical;
  min-height: 62px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}
.composer textarea:focus { border-color: var(--accent); }
.composer textarea::placeholder { color: var(--faint); }

.composer-dates { display: flex; gap: 8px; }
.composer-dates label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  color: var(--muted);
}
.composer-dates .cell {
  background: var(--bg-soft);
  border-color: var(--border);
  padding: 5px 7px;
  font-size: 12px;
}

.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.prio { display: flex; gap: 4px; }

.prio button {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform .15s ease;
}
.prio button:hover { transform: scale(1.15); }
.prio button.is-on { border-color: var(--text); }
.prio button[data-p="low"]    { background: var(--gray); }
.prio button[data-p="normal"] { background: var(--blue); }
.prio button[data-p="high"]   { background: var(--red); }

.composer-actions { display: flex; gap: 6px; }

/* главная кнопка — графитовая (в тёмной теме светлая), как в Linear;
   акцентный цвет остаётся для выделения, а не для каждой кнопки */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--btn-bg);
  color: var(--on-btn);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease;
}
.btn-primary:hover { background: var(--btn-hover); }

.btn-cancel {
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.btn-cancel:hover { color: var(--text); background: var(--bg-hover); }

/* ---------- ПОДВКЛАДКИ (Бюджет) ---------- */
.subtabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  overflow-x: auto;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }

.subtab {
  position: relative;
  padding: 0 0 11px;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: color .18s ease;
}
.subtab::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background .18s ease;
}
.subtab:hover { color: var(--text); }
.subtab.is-active { color: var(--text); font-weight: 500; }
.subtab.is-active::after { background: var(--text); }

/* ---------- ПОЛОСА ИТОГОВ ---------- */
.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.summary-item {
  background: var(--bg-soft);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding: 12px 18px 14px;
  min-width: 150px;
}
.summary-item span {
  display: block;
  margin-bottom: 2px;
  font-size: 12.5px;
  color: var(--muted);
}
.summary-item strong {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.pos { color: var(--green); }
.neg { color: var(--red); }

/* ---------- ТАБЛИЦА ---------- */
.table-wrap {
  background: var(--bg-soft);
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;   /* ширины колонок берём из шапки, а не из содержимого */
  font-size: 14px;
}

.grid th {
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.grid td {
  padding: 3px 6px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

.grid tbody tr { transition: background .15s ease; }
.grid tbody tr:hover { background: var(--row-hover); }
.grid tbody tr:last-child td { border-bottom: none; }

.grid .num { text-align: right; font-variant-numeric: tabular-nums; }

.grid tfoot td {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.grid tfoot .label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

/* поля ввода внутри таблицы */
.cell {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 7px 8px;
  outline: none;
  transition: border-color .15s ease, background .15s ease;
}
.cell:hover { border-color: var(--border-strong); }
.cell:focus { border-color: var(--accent); background: var(--bg-soft); box-shadow: 0 0 0 3px var(--accent-ring); }
.cell::placeholder { color: var(--faint); }
.cell.num { text-align: right; font-variant-numeric: tabular-nums; }

select.cell { cursor: pointer; appearance: none; padding-right: 22px; }
select.cell option { background: var(--bg-card); color: var(--text); }

input[type="number"].cell::-webkit-outer-spin-button,
input[type="number"].cell::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"].cell { -moz-appearance: textfield; }

.calc { display: block; padding: 7px 8px; font-variant-numeric: tabular-nums; }
.row-del { text-align: center; width: 40px; }

/* кнопка-действие в строке таблицы — «✓ Платёж выполнен» у долгов */
.row-act { text-align: center; }
.pay-btn {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--green) 45%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--green) 10%, transparent);
  color: color-mix(in srgb, var(--green) 72%, var(--text));
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.pay-btn:hover { background: var(--green); border-color: var(--green); color: var(--on-accent); }

/* архив под таблицей: погашенные долги, история платежей по кредитам */
.sheet-archive { margin-top: 34px; }
.sheet-archive-head { margin-bottom: 12px; }
.sheet-archive-head h2 { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; }
.sheet-archive-head p { margin-top: 2px; font-size: 13px; }
.sheet-archive-count {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--bg-beige);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.sheet-archive-count:empty { display: none; }
.sheet-archive-table tbody td { padding: 9px 10px; color: var(--muted); }
.sheet-archive-table tbody td:first-child { color: var(--text); }
.arch-acts { text-align: right; white-space: nowrap; }
.arch-acts .btn-ghost { padding: 5px 12px; font-size: 12.5px; }

.grid .empty-row td {
  padding: 34px 10px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}
/* в широкой таблице (привычки на телефоне) подсказка не уезжает вправо за край:
   прилипает к левому краю видимой области */
.grid .empty-row .empty-pin { position: sticky; left: 16px; display: inline-block; max-width: calc(100vw - 80px); }
@media (max-width: 620px) { .grid .empty-row td { text-align: left; } }

.table-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}
.table-actions .add-btn { flex: 1; }

/* ---------- БЛОКИ И ДВУХКОЛОНОЧНАЯ РАСКЛАДКА ---------- */
.block { margin-bottom: 34px; }

.block-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.block-head h2 { font-size: 22px; font-weight: 500; letter-spacing: -.02em; }

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.side-box {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.side-box h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 14px;
}

/* ---------- СЕТКА ПРИВЫЧЕК ---------- */
.habits th.day-th {
  width: 34px;
  padding: 8px 0;
  text-align: center;
  line-height: 1.25;
}
.habits th.day-th em {
  display: block;
  font-style: normal;
  font-size: 9px;
  color: var(--faint);
}
.habits th.is-today, .habits td.is-today { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.habits th.is-today em { color: var(--accent-ink); }

.habits td { padding: 4px 6px; }
.habits td.day-td { padding: 4px 0; text-align: center; }

/* первая колонка «прилипает» к левому краю: при прокрутке сетки
   вбок названия привычек остаются на виду */
.habits th:first-child,
.habits td.habit-name {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--bg-soft);
}
.habits tbody tr:hover td.habit-name { background: var(--row-hover); }

.habit-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  padding-left: 10px !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 1px 0 0 var(--border);
}
.habit-emoji { font-size: 17px; flex: none; }

.tick {
  width: 25px;
  height: 25px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: transparent;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, border-color .15s ease;
}
.tick:hover { border-color: var(--accent); transform: scale(1.12); }
.tick.is-on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: var(--on-accent);
  font-weight: 700;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.badge.ok   { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.badge.fire { color: var(--amber); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }

/* форма добавления привычки */
.habit-form {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.habit-form .cell {
  background: var(--bg-soft);
  border-color: var(--border);
}
.habit-form .cell:focus { border-color: var(--accent); background: var(--bg-soft); box-shadow: 0 0 0 3px var(--accent-ring); }
.habit-form .emoji { width: 54px; text-align: center; flex: none; font-size: 16px; }
.habit-form #habitGoal { width: 170px; flex: none; cursor: pointer; }
.habit-form .btn-primary { flex: none; padding: 8px 18px; }

/* ---------- ДИАГРАММЫ ---------- */
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}

.chart-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.chart-card h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 16px;
}

/* палитра диаграмм */
.chart-card {
  /* системные цвета Apple, приглушённые под светлый фон */
  --ch1: var(--accent);
  --ch2: #5856d6;
  --ch3: var(--amber);
  --ch4: #0e8f9e;
  --ch5: #af52de;
  --ch6: #d6245a;
  --ch7: #a2845e;
  --ch8: #8e8e93;
}

/* круговая (бублик) */
.donut-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.donut { width: 132px; height: 132px; flex: none; transform: rotate(-90deg); }
.donut circle { transition: stroke-dasharray .4s ease; }
.donut-hole { fill: none; stroke: var(--line-soft); stroke-width: 5.5; }

.donut-box { position: relative; flex: none; }
.donut-center {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  line-height: 1.2;
}
/* текст должен помещаться в отверстие бублика — оно около 86px */
.donut-center { max-width: 88px; margin: 0 auto; }
.donut-center b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.donut-center span { font-size: 12px; color: var(--muted); }

.legend { flex: 1; min-width: 130px; display: flex; flex-direction: column; gap: 6px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.legend-row i { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-row span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend-row b { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend-row em { font-style: normal; color: var(--muted); font-size: 11px; min-width: 32px; text-align: right; }

/* столбиковая */
.bars-v {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 148px;
  padding-top: 18px;
}

.bar-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 5px;
  position: relative;
}
.bar-col > small {
  font-size: 9px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar-v {
  width: 100%;
  max-width: 26px;
  border-radius: 5px 5px 3px 3px;
  background: linear-gradient(180deg, var(--accent-2), var(--accent));
  animation: rise .45s ease both;
  min-height: 2px;
}
.bar-v.zero { background: var(--line-soft); height: 2px !important; }
.bar-v.full { background: linear-gradient(180deg, color-mix(in srgb, var(--green) 70%, #fff), var(--green)); }
.bar-v.half { background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.bar-v.low  { background: linear-gradient(180deg, var(--border-strong), var(--gray)); }

.bar-col.is-today > small { color: var(--accent-ink); font-weight: 700; }
.bar-col.is-today::before {
  content: "";
  position: absolute;
  inset: -18px -1px -14px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}

@keyframes rise { from { height: 0 !important; } }

.chart-empty { color: var(--faint); font-size: 13px; padding: 26px 0; text-align: center; }

/* ---------- ГОРИЗОНТАЛЬНЫЕ ПОЛОСЫ ---------- */
.bar-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  font-size: 13px;
}
.bar-label { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--bg-card); border-radius: 999px; overflow: hidden; }
.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  animation: grow .5s ease both;
}
@keyframes grow { from { width: 0 !important; } }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }

/* ---------- ЦВЕТА ПРИОРИТЕТОВ (общие) ---------- */
.p-low    { --p: var(--gray); }
.p-normal { --p: var(--blue); }
.p-high   { --p: var(--red); }

.dot-p {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--p, var(--gray));
  flex: none;
}

/* ---------- ДИАГРАММА ГАНТА ---------- */
.gantt-wrap {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.gantt {
  display: grid;
  align-items: stretch;
  font-size: 13px;
  position: relative;
}

.g-corner, .g-name {
  position: sticky;
  left: 0;
  z-index: 4;
  background: var(--bg-soft);
  grid-column: 1;
  box-shadow: 1px 0 0 var(--border);
}

.g-corner {
  grid-row: 1;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.g-name {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  min-height: 38px;
}
.g-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.g-head {
  grid-row: 1;
  padding: 8px 0;
  text-align: center;
  line-height: 1.25;
  font-size: 11px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--line-soft);
}
.g-head em {
  display: block;
  font-style: normal;
  font-size: 9px;
  color: var(--faint);
}
.g-head.is-today { background: color-mix(in srgb, var(--accent) 22%, transparent); }
.g-head.is-today em { color: var(--accent-ink); }

.g-rowbg {
  z-index: 0;
  border-bottom: 1px solid var(--line-soft);
}
.gantt:hover .g-rowbg:hover { background: var(--row-hover); }

.g-bar {
  position: relative;
  z-index: 2;
  align-self: center;
  height: 26px;
  margin: 0 2px;
  padding: 0 9px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--p) 26%, var(--bg-card));
  border: 1px solid var(--p);
  border-left: 3px solid var(--p);
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}
.g-bar:hover { transform: translateY(-1px); filter: brightness(1.25); }
.g-bar span {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.g-bar.is-done { opacity: .55; }
.g-bar.is-done span { text-decoration: line-through; }
.g-bar.is-late { box-shadow: 0 0 0 1px var(--red); }

.g-today {
  z-index: 3;
  background: color-mix(in srgb, var(--accent) 17%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-right: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  pointer-events: none;
}

.gantt-note { margin-top: 12px; line-height: 1.7; }
.gantt-note .dot-p { margin: 0 2px 0 6px; }

/* ---------- КАЛЕНДАРЬ ---------- */
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.cal-week span {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

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

.cal-day {
  min-height: 104px;
  padding: 7px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color .15s ease, background .15s ease;
}
.cal-day:hover { border-color: var(--border-strong); background: var(--bg-card); }
.cal-day.other { opacity: .4; }
.cal-day.is-today { background: color-mix(in srgb, var(--accent) 14%, transparent); }
.cal-day.is-sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.cal-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.cal-day.is-today .cal-num { color: var(--accent-ink); }

.cal-chip {
  display: block;
  padding: 2px 6px;
  border-radius: 5px;
  border-left: 3px solid var(--p, var(--gray));
  background: var(--bg-card);
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-chip.is-done { opacity: .5; text-decoration: line-through; }
.cal-chip.is-late { background: color-mix(in srgb, var(--red) 12%, transparent); }

.cal-more { font-size: 10px; color: var(--faint); padding-left: 4px; }

/* список задач выбранного дня */
#daySide h3 { margin-bottom: 12px; }

.day-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--p, var(--gray));
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
.day-item:hover { border-color: var(--accent); transform: translateX(2px); }
.day-item-text { display: block; font-size: 13px; margin-bottom: 3px; }
.day-item-text.is-done { text-decoration: line-through; opacity: .6; }
.day-item-meta { display: block; font-size: 11px; color: var(--muted); }

/* ---------- БАЗА ЗНАНИЙ ---------- */
.kb {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.kb-search { width: 220px; background: var(--bg-soft); border-color: var(--border); }
.kb-search:focus { border-color: var(--accent); }

/* дерево */
.kb-tree {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kb-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.kb-row:hover { background: var(--bg-hover); }
.kb-row.is-active { background: var(--bg-beige); color: var(--text); font-weight: 500; }
.kb-row.is-root { margin-bottom: 4px; }

.kb-caret {
  width: 20px;
  height: 24px;
  border-radius: 6px;
  flex: none;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  padding: 0;
}
.kb-caret.empty { visibility: hidden; }

.kb-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kb-name input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 2px 6px;
  font: inherit;
  outline: none;
}

/* кнопки действий лежат поверх строки, а не в потоке —
   иначе они съедали бы место у названия папки даже невидимыми */
.kb-acts {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 1px;
  padding: 1px 2px;
  border-radius: 7px;
  background: var(--bg-card);
  box-shadow: -6px 0 8px var(--bg-card);
  opacity: 0;
  pointer-events: none;
}
.kb-row:hover .kb-acts { opacity: 1; pointer-events: auto; }
.kb-acts .icon-btn { width: 24px; height: 24px; font-size: 11px; }   /* 24 px — меньше по пальцу и мышью не попасть */

.kb-tree .count { font-size: 11px; padding: 1px 7px; min-width: 22px; }
.kb-tree .add-btn { margin-top: 8px; padding: 7px; font-size: 12px; }

/* карточки записей */
.kb-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.kb-path { font-size: 13px; color: var(--muted); }
.kb-path b { color: var(--text); font-weight: 600; }

.kb-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 12px;
}

.kb-card {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 128px;
  animation: cardIn .22s ease both;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.kb-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }

.kb-card h4 { font-size: 15px; line-height: 1.35; }
.kb-card p {
  flex: 1;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-card .kb-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.kb-card footer { font-size: 11px; color: var(--faint); display: flex; justify-content: space-between; gap: 8px; }

.tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 21%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  color: var(--accent-ink);
}

.kb-empty {
  grid-column: 1 / -1;
  padding: 50px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* открытая запись */
.kb-note {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.kb-note-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kb-note-head .btn-ghost { flex: none; white-space: nowrap; }
.kb-note .title {
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid transparent;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.01em;
  padding: 4px 0;
  outline: none;
}
.kb-note .title:focus { border-bottom-color: var(--accent); }
.kb-note textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.65;
  outline: none;
}
.kb-note textarea:focus { border-color: var(--accent); }
.kb-note-row { display: flex; gap: 10px; flex-wrap: wrap; }
.kb-note-row label {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.kb-note-row .cell { background: var(--bg-card); border-color: var(--border); }
.kb-note-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ---------- ВЫБОР ЭМОДЗИ ---------- */
/* без этой строки display:grid ниже перебивал атрибут hidden,
   и кнопка висела на странице всегда, даже без активного поля */
#emojiBtn[hidden], #emojiPop[hidden] { display: none !important; }

#emojiBtn {
  position: fixed;
  z-index: 200;
  width: 22px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-card);
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: .5;
  transition: opacity .15s ease, border-color .15s ease, transform .15s ease;
}
#emojiBtn:hover { opacity: 1; border-color: var(--accent); transform: scale(1.1); }
#emojiBtn.is-open { opacity: 1; border-color: var(--accent); }

#emojiPop {
  position: fixed;
  z-index: 201;
  width: 296px;
  padding: 8px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
}

.emoji-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.emoji-tabs::-webkit-scrollbar { display: none; }

.emoji-tabs button {
  flex: none;
  padding: 4px 9px;
  border: none;
  border-radius: 7px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}
.emoji-tabs button:hover { background: var(--bg-hover); color: var(--text); }
.emoji-tabs button.is-on { background: var(--accent); color: var(--on-accent); }

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
  max-height: 216px;
  overflow-y: auto;
}
.emoji-grid button {
  aspect-ratio: 1;
  border: none;
  border-radius: 7px;
  background: none;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s ease, transform .12s ease;
}
.emoji-grid button:hover { background: var(--bg-hover); transform: scale(1.18); }
.emoji-grid .empty-hint {
  grid-column: 1 / -1;
  padding: 22px 8px;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

/* ---------- ТРЕНИРОВКИ ---------- */
.tr-view[hidden] { display: none; }
.tr-facts { margin-bottom: 24px; }

.tr-dek { font-size: 16px; line-height: 1.6; color: var(--muted); max-width: 64ch; margin-bottom: 30px; }
.tr-h {
  font-size: clamp(22px, 2.6vw, 28px);
  font-weight: 500;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin: 38px 0 6px;
}
.tr-dek + .tr-h { margin-top: 0; }
.tr-h3 { font-size: 16px; font-weight: 600; margin: 26px 0 10px; }
.tr-sub { font-size: 14px; line-height: 1.55; color: var(--muted); max-width: 66ch; margin-bottom: 18px; }
.tr-text { max-width: 70ch; line-height: 1.65; margin-bottom: 16px; }
.tr-note { font-size: 13px; line-height: 1.55; color: var(--muted); max-width: 70ch; margin-top: 12px; }

/* выноски: полоска слева и лёгкая заливка того же цвета */
.tr-call {
  --c: var(--accent);
  max-width: 78ch;
  margin: 0 0 18px;
  padding: 14px 18px;
  border-left: 3px solid var(--c);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: color-mix(in srgb, var(--c) 10%, var(--bg-soft));
}
.tr-call.red   { --c: var(--red); }
.tr-call.green { --c: var(--green); }
.tr-call.amber { --c: var(--amber); }
.tr-call > b {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--c);
}
.tr-call p { font-size: 14px; line-height: 1.6; }

/* четыре фазы блока; последняя, разгрузка, — тёмная */
.tr-phases { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.tr-phase { display: flex; flex-direction: column; gap: 4px; padding: 18px; background: var(--grad-beige); border-radius: var(--radius); }
.tr-phase .wk { font-size: 12px; font-weight: 600; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.tr-phase .nm { font-size: 18px; font-weight: 500; letter-spacing: -.01em; }
.tr-phase p { font-size: 13px; line-height: 1.5; color: var(--muted); }
.tr-phase:last-child { background: var(--grad-dark); color: #f5f5f7; }
.tr-phase:last-child .wk { color: #a1a1a6; }
.tr-phase:last-child p { color: rgba(218, 241, 222, .72); }

/* неделя */
.tr-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.tr-day {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 112px;
  padding: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.tr-day.is-off { background: transparent; border-style: dashed; }
.tr-bar { width: 30px; height: 3px; border-radius: 2px; background: var(--accent); }
.tr-day.is-lower .tr-bar { background: var(--red); }
.tr-day.is-extra .tr-bar { background: var(--amber); }
.tr-day.is-off .tr-bar   { background: var(--border-strong); }
.tr-dw { font-size: 12px; color: var(--muted); }
.tr-dn { font-size: 15px; font-weight: 500; line-height: 1.2; }
.tr-dt { margin-top: auto; font-size: 12px; line-height: 1.35; color: var(--muted); }
.tr-day.is-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tr-day.is-today .tr-dw { color: var(--accent-ink); font-weight: 600; }

/* тренировка: шапка и строки упражнений */
.tr-workout {
  margin-bottom: 14px;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tr-workout.is-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.tr-workout header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  padding: 14px 20px;
  background: var(--grad-beige);
  border-bottom: 1px solid var(--border);
}
.tr-tag { font-size: 19px; font-weight: 500; letter-spacing: -.01em; }
.tr-foc { font-size: 13px; color: var(--muted); }
.tr-badge { padding: 2px 9px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; }
.tr-dur { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tr-ex {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 3px 12px;
  align-items: baseline;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.tr-ex:last-child { border-bottom: 0; }
.tr-i { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tr-n { font-size: 15px; font-weight: 500; line-height: 1.35; }
.tr-l { font-size: 14px; font-weight: 600; color: var(--accent-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tr-c { grid-column: 2 / -1; font-size: 13px; line-height: 1.5; color: var(--muted); }
.tr-rest { white-space: nowrap; color: var(--text); opacity: .75; font-variant-numeric: tabular-nums; }

/* списки с маркерами; «чего не делать» — красные крестики */
.tr-list { display: grid; gap: 9px; margin: 0 0 18px; padding: 0; list-style: none; }
.tr-list li { position: relative; max-width: 72ch; padding-left: 22px; font-size: 14.5px; line-height: 1.55; color: var(--muted); }
.tr-list li::before { content: ""; position: absolute; left: 0; top: .72em; width: 10px; height: 2px; border-radius: 2px; background: var(--accent); }
.tr-list li b { color: var(--text); font-weight: 600; }
.tr-list.no li::before {
  top: .45em;
  width: 9px;
  height: 9px;
  border-radius: 0;
  background: var(--red);
  clip-path: polygon(20% 0, 100% 80%, 80% 100%, 0 20%);
}

/* калькулятор КБЖУ */
.tr-calc {
  max-width: 940px;
  padding: 24px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
/* числам хватает узких полей, спискам с длинными словами («Рекомпозиция») — нужно шире */
.tr-inputs { display: grid; grid-template-columns: 1fr .85fr .85fr .85fr 1.2fr 1.45fr; gap: 14px; margin-bottom: 20px; }
.tr-field { display: flex; flex-direction: column; gap: 6px; }
.tr-field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.tr-field input,
.tr-field select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.tr-field input:focus,
.tr-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.tr-field input:invalid { border-color: var(--red); }

/* системный вид списков и стрелки у чисел выбиваются из дизайна —
   список рисуем как обычное поле со своей галочкой */
.tr-field select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 34px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238eb69b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
}
.tr-field input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.tr-field input[type="number"]::-webkit-inner-spin-button,
.tr-field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

.tr-out { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 10px; }
.tr-tile { padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.tr-tile .k { display: block; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.tr-tile .v { display: block; font-size: 27px; font-weight: 600; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tr-tile .u { font-size: 12px; color: var(--muted); }
.tr-tile.hl { background: var(--grad-tan); border-color: transparent; color: #fff; }
.tr-tile.hl .k,
.tr-tile.hl .u { color: rgba(255, 255, 255, .84); }

/* строки «время — описание»: меню на день и хронология результатов */
.tr-rows { max-width: 940px; overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.tr-row { display: grid; grid-template-columns: 96px 1fr; gap: 14px; align-items: baseline; padding: 13px 18px; border-bottom: 1px solid var(--line-soft); }
.tr-row:last-child { border-bottom: 0; }
.tr-row .t { font-size: 13px; font-weight: 600; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.tr-row .b { font-size: 14px; line-height: 1.55; }
.tr-row .b em { display: block; margin-top: 2px; font-style: normal; font-size: 12.5px; color: var(--muted); }

/* добавки */
.tr-supp { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tr-sc { padding: 16px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.tr-sc .nm { font-size: 15px; font-weight: 600; }
.tr-sc .ds { margin: 2px 0 6px; font-size: 13px; font-weight: 600; color: var(--green); }
/* у видов протеина подпись — характеристика, а не «одобрено», поэтому не зелёная */
.tr-supp.is-neutral .ds { color: var(--accent-ink); }
/* шесть видов протеина и восемь вердиктов — шире колонки, чтобы ряды были ровными
   (3 + 3 и 4 + 4), а не с одной карточкой, оставшейся внизу */
.tr-supp.is-neutral { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.tr-view[data-view="food"] .tr-swap { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
/* раздел открывается пояснением — первый заголовок после него не отрываем большим отступом */
.tr-view > .tr-sub:first-child + .tr-h { margin-top: 18px; }
.tr-sc .wy { font-size: 13px; line-height: 1.5; color: var(--muted); }

.tr-footnote { max-width: 78ch; margin-top: 38px; padding-top: 18px; border-top: 1px solid var(--border); font-size: 12.5px; line-height: 1.6; color: var(--faint); }

@media (max-width: 1000px) {
  .tr-week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tr-inputs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .tr-week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tr-ex { grid-template-columns: 20px 1fr; }
  .tr-l { grid-column: 2; }
  .tr-dur { width: 100%; margin-left: 0; }
  .tr-row { grid-template-columns: 1fr; gap: 4px; }
  .tr-calc { padding: 18px; }
  .tr-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}


/* пара больших ссылок рядом: справочник и «Дом» */
.tr-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin: 0 0 16px; }
.tr-links .tr-kb-link { margin-bottom: 0; }
.tr-view[data-view="home"] > .tr-links { margin-top: 34px; }

/* «что могут 15 кг»: цвет полоски — насколько полноценна замена */
.tr-swap { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tr-swap-card {
  --c: var(--accent-ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px 18px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-top: 3px solid var(--c);
  border-radius: var(--radius);
}
.tr-swap-card.is-ok  { --c: var(--green); }
.tr-swap-card.is-mid { --c: var(--amber); }
.tr-swap-card.is-no  { --c: var(--red); }
.tr-swap-card .from { font-size: 12px; font-weight: 600; color: var(--c); }
.tr-swap-card .to { font-size: 18px; font-weight: 500; letter-spacing: -.01em; }
.tr-swap-card p { font-size: 13px; line-height: 1.5; color: var(--muted); }

/* лестница прогрессии: пронумерованные ступени */
.tr-ladder {
  counter-reset: step;
  max-width: 940px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tr-ladder li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 2px 14px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
}
.tr-ladder li:last-child { border-bottom: 0; }
.tr-ladder li::before {
  content: counter(step);
  grid-row: span 2;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--grad-tan);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
.tr-ladder b { font-size: 15px; font-weight: 600; }
.tr-ladder span { font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ссылка на справочник упражнений в начале «Тренировок» */
.tr-kb-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 20px;
  text-align: left;
  color: var(--text);
  background: var(--grad-beige);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
/* display:flex выше перебил бы атрибут hidden — ссылка должна прятаться, если папку удалили */
.tr-kb-link[hidden] { display: none; }
.tr-kb-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
.tr-kb-ico { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 10px; background: var(--bg-hover); color: var(--text); }
.tr-kb-ico .ico { width: 20px; height: 20px; }
.tr-kb-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.tr-kb-text b { font-size: 16px; font-weight: 600; }
.tr-kb-text em { font-style: normal; font-size: 13px; color: var(--muted); }
.tr-kb-arrow { font-size: 20px; color: var(--accent-ink); }

/* маленькая ссылка «Техника →» у каждого упражнения */
.tr-kb {
  margin-left: 6px;
  padding: 1px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, var(--border));
  border-radius: 999px;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tr-kb:hover { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* уведомление снизу: например, «Claude: обновил тренировку» */
#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 300;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--ink-900);
  color: #f5f5f7;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .3);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
}
#toast.is-on { opacity: 1; transform: translate(-50%, 0); }
#toast.is-error { background: #b3261e; }

.claude-last { margin-top: 4px; font-size: 12px; color: var(--accent-ink); }

/* ---------- ЗАГЛУШКА ДЛЯ ПУСТЫХ ВКЛАДОК ---------- */
.placeholder {
  display: grid;
  place-items: center;
  gap: 12px;
  padding: 80px 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.placeholder-icon { font-size: 40px; color: var(--faint); }

/* ---------- АДАПТИВ ---------- */
@media (max-width: 1000px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .two-col { grid-template-columns: 1fr; }
  .kb { grid-template-columns: 1fr; }
}


@media (max-width: 620px) {
  .main { padding: 20px 16px 48px; }
  .board { grid-template-columns: 1fr; }
  .card-tools { opacity: 1; }
  .panel-head { align-items: flex-start; }
  .subtabs { gap: 16px; }
  .summary-item { flex: 1; min-width: 140px; }
  .table-actions { flex-direction: column-reverse; align-items: stretch; }
  .kb-search { width: 100%; }
  .kb-acts { position: static; transform: none; opacity: 1; pointer-events: auto; box-shadow: none; background: none; }
  .kb-cards { grid-template-columns: 1fr; }
  .cal-grid, .cal-week { gap: 4px; }
  .cal-day { min-height: 74px; padding: 5px; }
  .cal-chip { font-size: 0; padding: 0; height: 5px; border-radius: 3px; border-left-width: 0; background: var(--p, var(--gray)); }
  .cal-more { display: none; }
  .modal { padding: 0; place-items: end stretch; }
  .modal-box { max-height: 92vh; border-radius: var(--radius) var(--radius) 0 0; }
  .set-row { align-items: flex-start; }
  .seg, .set-actions { width: 100%; }
  .seg button { flex: 1; }
  #setStartTab { width: 100%; }
  .habit-form { flex-wrap: wrap; }
  .habit-form #habitName { min-width: 60%; }
  .habit-form #habitGoal { width: auto; flex: 1; }
  .habit-form .btn-primary { flex: 1; }
}

/* ============================================
   ЗАСТАВКА ПРИ ЗАПУСКЕ (splash.js)
   Всегда на тёмном фоне, от темы не зависит; частицы и кольцо рисует скрипт на холсте.
   --cx, --cy (центр кольца), --R (радиус) и --grain (зерно) проставляет скрипт,
   прозрачность, размытие и сдвиги текста — тоже он, покадрово
   ============================================ */
/* пока идёт заставка, полосы прокрутки не видно (класс ставит и снимает splash.js) */
html.splash-on { overflow: hidden; }

#splash {
  --sp-text: var(--gray-50);
  --sp-muted: color-mix(in srgb, var(--gray-50) 52%, transparent);
  --sp-deep: color-mix(in srgb, var(--ink-900) 55%, black);
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow: hidden;
  cursor: pointer;
  color: var(--sp-text);
  font-family: var(--font);
  /* почти чёрный графит, чуть светлее за кольцом */
  background:
    radial-gradient(60% 55% at 50% 47%, color-mix(in srgb, var(--ink-800) 70%, transparent) 0%, transparent 70%),
    radial-gradient(130% 110% at 50% 47%, var(--ink-900) 0%, var(--sp-deep) 60%, black 100%);
}
/* зерно — чтобы тёмный градиент не шёл полосами */
#splash::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--grain);
  opacity: .045;
  mix-blend-mode: overlay;
  pointer-events: none;
}
.splash-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

/* «PWS» в центре кольца: металлический градиент, по которому скользит блик */
.splash-word {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  transform: translate(-50%, -50%);
  padding-left: .12em;   /* разрядка добавляет место справа — уравниваем */
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", var(--font);
  font-size: calc(var(--R) * .38);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: transparent;
  background: linear-gradient(105deg,
    color-mix(in srgb, var(--gray-50) 80%, transparent) 0%,
    color-mix(in srgb, var(--gray-50) 80%, transparent) 38%,
    var(--gray-0) 50%,
    color-mix(in srgb, var(--gray-50) 80%, transparent) 62%,
    color-mix(in srgb, var(--gray-50) 80%, transparent) 100%) 100% 0 / 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  opacity: 0;
}
.splash-tag {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--cy) + var(--R) * 1.62);
  padding-left: .28em;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .28em;
  text-transform: uppercase;
  color: var(--sp-muted);
  opacity: 0;
}

/* ============================================
   BACKLOG ПО МОТИВАМ JIRA
   Значки типов и приоритетов, бэклог со спринтами,
   доска, карточка задачи, сводка, таймлайн
   ============================================ */

.jr-project { margin-bottom: 4px; font-size: 12px; letter-spacing: .02em; color: var(--muted); }
.jr-project b { font-weight: 600; color: var(--text); }
.jr-create { padding: 8px 16px; }

/* ---------- значки и плашки ---------- */
.it { display: inline-grid; place-items: center; flex: none; width: 16px; height: 16px; border-radius: 4px; background: var(--it); }
.it svg { display: block; width: 14px; height: 14px; }
.pi { display: block; flex: none; width: 16px; height: 16px; }

.lz {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.lz-progress { background: color-mix(in srgb, var(--blue) 18%, transparent);  color: color-mix(in srgb, var(--blue) 78%, var(--text)); }
.lz-review   { background: color-mix(in srgb, var(--amber) 20%, transparent); color: color-mix(in srgb, var(--amber) 72%, var(--text)); }
.lz-done     { background: color-mix(in srgb, var(--green) 20%, transparent); color: color-mix(in srgb, var(--green) 72%, var(--text)); }

.ep {
  display: inline-block;
  max-width: 170px;
  padding: 1px 7px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--ep) 18%, transparent);
  color: color-mix(in srgb, var(--ep) 78%, var(--text));
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lbl { display: inline-block; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.sp {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-hover);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.sp.is-empty { background: transparent; color: var(--faint); }
.av { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--av); color: #fff; font-size: 9.5px; font-weight: 700; }
.av.is-empty { background: transparent; border: 1px dashed var(--border-strong); }
.jr-key { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-meter { font-size: 11px; color: var(--muted); white-space: nowrap; }

.jr-bar { display: block; height: 6px; border-radius: 999px; background: var(--bg-hover); overflow: hidden; }
.jr-bar i { display: block; height: 100%; border-radius: inherit; background: var(--ep, var(--green)); transition: width .3s ease; }

/* выпадающие списки со стрелкой (у .cell системная стрелка скрыта) */
.jr-toolbar select.cell,
.jr-form select.cell,
.jr-side select.cell,
.jr-quick-form select.cell {
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238eb69b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 10px;
}

/* ---------- фильтры ---------- */
.jr-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.jr-toolbar[hidden] { display: none; }
.jr-toolbar .cell { width: auto; padding: 7px 10px; background-color: var(--bg-soft); border-color: var(--border); font-size: 13px; }
.jr-search { flex: 1 1 220px; min-width: 200px; max-width: 320px; }
.jr-group { display: flex; align-items: center; gap: 6px; margin-left: auto; font-size: 12px; color: var(--muted); }
.jr-group[hidden] { display: none; }

/* ---------- бэклог: эпики ---------- */
.jr-epics { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.jr-epics-title { margin-right: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.jr-epic { display: flex; align-items: stretch; overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border); border-left: 3px solid var(--ep); border-radius: 10px; }
.jr-epic.is-on { box-shadow: 0 0 0 2px color-mix(in srgb, var(--ep) 45%, transparent); }
.jr-epic-main {
  display: grid;
  grid-template-columns: minmax(90px, auto) auto;
  align-items: center;
  gap: 4px 10px;
  padding: 6px 10px;
  border: none;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.jr-epic-name { max-width: 180px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-epic-main .jr-bar { grid-column: 1; height: 4px; }
.jr-epic-num { grid-column: 2; grid-row: 1 / 3; font-size: 11px; color: var(--muted); }
.jr-epic-open { padding: 0 9px; border: none; border-left: 1px solid var(--line-soft); background: none; color: var(--muted); cursor: pointer; }
.jr-epic-main:hover, .jr-epic-open:hover { background: var(--bg-hover); }
.jr-epic-add { padding: 8px 12px; border: 1px dashed var(--border-strong); border-radius: 10px; background: none; color: var(--muted); font-size: 13px; cursor: pointer; }
.jr-epic-add:hover { color: var(--accent-ink); border-color: var(--accent); }

/* ---------- бэклог: спринты и список ---------- */
.jr-sec { margin-bottom: 14px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.jr-sec-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; }
.jr-sec-head b { font-size: 14px; }
.jr-sec-head .muted { font-size: 12px; }
.jr-fold { width: 20px; border: none; background: none; color: var(--muted); font-size: 12px; cursor: pointer; transition: transform .2s ease; }
.jr-sec.is-folded .jr-fold { transform: rotate(-90deg); }
.jr-sec.is-folded .jr-sec-body { display: none; }
.jr-pts { display: flex; gap: 3px; margin-left: auto; }
.pt { min-width: 22px; padding: 1px 6px; border-radius: 999px; font-size: 11px; font-style: normal; font-weight: 700; text-align: center; }
.pt-todo     { background: var(--bg-hover); color: var(--muted); }
.pt-progress { background: color-mix(in srgb, var(--blue) 20%, transparent);  color: color-mix(in srgb, var(--blue) 78%, var(--text)); }
.pt-done     { background: color-mix(in srgb, var(--green) 22%, transparent); color: color-mix(in srgb, var(--green) 72%, var(--text)); }
.jr-sec-actions { display: flex; align-items: center; gap: 4px; }
.jr-sec-actions .btn-ghost { padding: 5px 11px; font-size: 12.5px; }
.jr-sec-actions .btn-ghost:disabled { opacity: .45; cursor: default; }
.jr-sec-body { padding: 0 10px 10px; }
.jr-goal { padding: 0 6px 8px; font-size: 13px; color: var(--muted); }

.jr-list {
  min-height: 44px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  outline: 2px dashed transparent;
  outline-offset: 2px;
  transition: background .15s ease, outline-color .15s ease;
}
.jr-list.drag-over,
.jr-drop.drag-over { background: color-mix(in srgb, var(--accent) 10%, transparent); outline-color: var(--accent); }
.jr-empty { padding: 14px; font-size: 13px; text-align: center; color: var(--faint); }

.jr-row { display: flex; align-items: center; gap: 9px; padding: 7px 10px; background: var(--bg-card); border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.jr-row:last-child { border-bottom: none; }
.jr-row:hover { background: var(--bg-hover); }
.jr-row.dragging { opacity: .4; }
.jr-row .jr-sum { flex: 1; min-width: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-row.is-done .jr-sum { text-decoration: line-through; color: var(--muted); }
.jr-row-meta { display: flex; flex: none; align-items: center; gap: 7px; }

.jr-quick { display: block; width: 100%; margin-top: 6px; padding: 7px 10px; border: none; border-radius: 8px; background: none; color: var(--muted); font-size: 13px; text-align: left; cursor: pointer; }
.jr-quick:hover { background: var(--bg-hover); color: var(--text); }
.jr-quick[hidden] { display: none; }
.jr-quick-form { display: flex; gap: 6px; margin-top: 6px; }
.jr-quick-form .cell { background-color: var(--bg-card); border-color: var(--accent); }
.jr-quick-form select.cell { width: auto; }
.jr-quick-form input.cell { flex: 1; min-width: 0; }

/* ---------- доска ---------- */
.jr-board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin-bottom: 14px;
  padding: 12px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.jr-board-head.is-note { justify-content: space-between; font-size: 13px; color: var(--muted); }
.jr-board-title { flex: 1 1 260px; }
.jr-board-title b { margin-right: 8px; font-size: 15px; }
.jr-board-title .jr-goal { padding: 4px 0 0; }
.jr-board-progress { display: flex; flex: 0 1 300px; align-items: center; gap: 10px; font-size: 12px; }
.jr-board-progress .jr-bar { flex: 1; min-width: 100px; }

.jr-board { overflow-x: auto; padding-bottom: 4px; }
.jr-cols { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; min-width: 920px; }
.jr-cols-head { margin-bottom: 8px; }
.jr-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-beige);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.jr-col-head .count { margin-left: auto; background: var(--bg-soft); }
.jr-lane-head { display: flex; align-items: center; gap: 8px; min-width: 920px; margin: 14px 0 8px; padding-left: 10px; border-left: 3px solid var(--ep); font-size: 13px; }
.jr-lane-head .muted { font-size: 12px; }

.jr-drop {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 90px;
  padding: 8px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--bg-beige) 55%, transparent);
  outline: 2px dashed transparent;
  outline-offset: 2px;
  transition: background .15s ease, outline-color .15s ease;
}
.jr-drop .jr-quick { margin-top: 0; }

.jr-card {
  padding: 10px 11px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(5, 31, 32, .06);
  cursor: grab;
  transition: box-shadow .15s ease, transform .15s ease, border-color .15s ease;
}
.jr-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }
.jr-card.dragging { opacity: .4; }
.jr-card-sum { font-size: 14px; line-height: 1.35; word-break: break-word; }
.jr-card-sum.is-done { text-decoration: line-through; color: var(--muted); }
.jr-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.jr-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.jr-card-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

/* ---------- окна: формы ---------- */
.jr-modal .modal-box { width: min(560px, 100%); }
.jr-issue .modal-box { width: min(1040px, 100%); max-height: 90vh; }

.jr-form { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; }
.jr-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.jr-form .cell { background-color: var(--bg-card); border-color: var(--border); color: var(--text); font-size: 14px; }
.jr-form textarea.cell { resize: vertical; font: inherit; font-size: 14px; }
.jr-form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.jr-form-row[hidden] { display: none; }
.jr-form-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding-top: 6px; }
.jr-form .jr-more { flex-direction: row; align-items: center; gap: 6px; margin-right: auto; font-weight: 500; }
.jr-req { font-style: normal; color: var(--red); }
.cell.is-invalid { border-color: var(--red) !important; }

.jr-complete { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.jr-complete div { padding: 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.jr-complete b { display: block; font-size: 28px; font-weight: 500; }
.jr-complete span { font-size: 12px; color: var(--muted); }

/* ---------- карточка задачи ---------- */
.jr-issue-head { padding: 12px 18px; }
.jr-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; }
.jr-crumb { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px; border: none; border-radius: 6px; background: none; color: var(--muted); font-size: 13px; cursor: pointer; }
.jr-crumb:hover { background: var(--bg-hover); color: var(--text); }
.jr-crumb.is-here { color: var(--text); cursor: default; }
.jr-crumb.is-here:hover { background: none; }
.jr-head-actions { display: flex; gap: 2px; }

.jr-issue-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; padding: 16px 22px 24px; }
.jr-main h4, .jr-panel h4 { margin: 22px 0 8px; font-size: 13px; font-weight: 700; }
.jr-main h4 .muted { font-weight: 500; }

.jr-title {
  width: calc(100% + 16px);
  margin-left: -8px;
  padding: 4px 8px;
  resize: none;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
  outline: none;
}
.jr-title:hover { background: var(--bg-hover); }
.jr-title:focus { border-color: var(--accent); background: var(--bg-card); }
.jr-desc { min-height: 110px; resize: none; overflow: hidden; background: var(--bg-card); border-color: var(--border); font: inherit; font-size: 14px; line-height: 1.5; }

.jr-kids-bar { margin-bottom: 8px; }
.jr-kids { overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.jr-kids:empty { display: none; }
.jr-kid { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg-card); border-bottom: 1px solid var(--line-soft); }
.jr-kid:last-child { border-bottom: none; }
.jr-check { flex: none; width: 18px; height: 18px; padding: 0; border: 1.5px solid var(--border-strong); border-radius: 5px; background: none; color: transparent; font-size: 11px; line-height: 1; cursor: pointer; }
.jr-check:hover { border-color: var(--green); }
.jr-check.is-on { background: var(--green); border-color: var(--green); color: var(--on-accent); }
.jr-kid-sum { flex: 1; min-width: 0; border: none; background: none; color: var(--text); font-size: 14px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.jr-kid-sum:hover { text-decoration: underline; }
.jr-kid-sum.is-done { text-decoration: line-through; color: var(--muted); }
.jr-kid-add { margin-top: 8px; background: var(--bg-card); border-color: var(--border); border-style: dashed; }

.jr-comment-new { display: flex; align-items: flex-start; gap: 8px; }
.jr-comment-new textarea { flex: 1; resize: vertical; background: var(--bg-card); border-color: var(--border); font: inherit; font-size: 14px; }
.jr-comment { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.jr-comment-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.jr-comment-meta .icon-btn { margin-left: auto; opacity: 0; }
.jr-comment:hover .icon-btn { opacity: 1; }
.jr-comment-text { margin-top: 4px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }

.jr-history { margin-top: 22px; font-size: 12.5px; }
.jr-history summary { font-weight: 600; color: var(--muted); cursor: pointer; }
.jr-history div { padding: 5px 0; border-bottom: 1px solid var(--line-soft); }

.jr-side {
  position: sticky;
  top: 70px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.jr-field { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 8px; }
.jr-field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.jr-side .cell { padding: 6px 8px; background-color: var(--bg-soft); border-color: var(--border); color: var(--text); font-size: 13px; }
.jr-side select.jr-status { font-size: 12px; font-weight: 600; }
.jr-side select.lz-progress, .jr-side select.lz-review, .jr-side select.lz-done { border-color: transparent; }
.jr-side select.lz-progress { background-color: color-mix(in srgb, var(--blue) 18%, transparent); }
.jr-side select.lz-review   { background-color: color-mix(in srgb, var(--amber) 20%, transparent); }
.jr-side select.lz-done     { background-color: color-mix(in srgb, var(--green) 20%, transparent); }
.jr-with-icon { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* длинное название эпика в списке не должно раздвигать колонку */
.jr-field > *, .jr-with-icon .cell { min-width: 0; }
.jr-colors { display: flex; flex-wrap: wrap; gap: 5px; }
.jr-colors button { width: 20px; height: 20px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: var(--c); cursor: pointer; }
.jr-colors button.is-on { border-color: var(--text); }
.jr-stamp { margin-top: 4px; font-size: 11.5px; }

/* ---------- сводка ---------- */
.jr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 14px; }
.jr-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 12px;
  padding: 14px 16px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.jr-stat i { grid-row: 1 / 3; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px; background: var(--bg-beige); color: var(--accent-ink); font-size: 16px; font-style: normal; }
.jr-stat b { font-size: 24px; font-weight: 500; line-height: 1.1; }
.jr-stat span { font-size: 12px; color: var(--muted); }

.jr-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.jr-panel { padding: 16px 18px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.jr-panel h3 { margin-bottom: 12px; font-size: 14px; font-weight: 700; }
.jr-panel > p { margin-bottom: 6px; font-size: 13px; }
.jr-panel > .jr-bar { margin: 10px 0 8px; }

.jr-donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.jr-donut { display: grid; place-items: center; flex: none; width: 132px; height: 132px; border-radius: 50%; }
.jr-donut span { display: grid; place-items: center; align-content: center; width: 88px; height: 88px; border-radius: 50%; background: var(--bg-soft); color: var(--muted); font-size: 11px; }
.jr-donut b { font-size: 24px; font-weight: 500; line-height: 1; color: var(--text); }
.jr-legend { display: flex; flex: 1; flex-direction: column; gap: 8px; font-size: 13px; }
.jr-legend div { display: flex; align-items: center; gap: 8px; }
.jr-legend b { margin-left: auto; }

.jr-sbar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 30px; align-items: center; gap: 10px; padding: 5px 0; font-size: 13px; }
.jr-sbar-label { display: flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; }
.jr-sbar-track { height: 8px; overflow: hidden; border-radius: 999px; background: var(--bg-hover); }
.jr-sbar-track i { display: block; height: 100%; border-radius: inherit; }
.jr-sbar b { text-align: right; font-variant-numeric: tabular-nums; }

.jr-epic-row, .jr-feed { display: grid; width: 100%; border: none; border-radius: 8px; background: none; color: var(--text); text-align: left; cursor: pointer; }
.jr-epic-row { grid-template-columns: minmax(0, 1fr) 110px 86px; align-items: center; gap: 10px; padding: 7px 6px; font-size: 13px; }
.jr-epic-row-name { display: flex; align-items: center; gap: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-epic-row .muted { font-size: 12px; text-align: right; }
.jr-feed { grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 6px; font-size: 13px; }
.jr-feed-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jr-feed .muted { font-size: 11.5px; }
.jr-epic-row:hover, .jr-feed:hover { background: var(--bg-hover); }

.jr-blank { display: grid; justify-items: center; gap: 8px; padding: 60px 20px; text-align: center; background: var(--bg-soft); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.jr-blank .btn-primary { margin-top: 8px; padding: 9px 18px; }

/* ---------- таймлайн ---------- */
.g-name { cursor: pointer; }
.g-name:hover span:last-child { text-decoration: underline; }
.g-name .jr-key { font-size: 11px; }
.g-name.is-epic span:last-child { font-weight: 600; }
.g-bar.is-epic { background: color-mix(in srgb, var(--p) 45%, var(--bg-card)); font-weight: 600; }
.gantt-note .pi { display: inline-block; vertical-align: -3px; }

/* пять приоритетов в календаре и на диаграмме */
.p-highest { --p: var(--red); }
.p-high    { --p: #e35d0b; }
.p-medium  { --p: var(--amber); }
.p-low     { --p: #5e97d6; }
.p-lowest  { --p: var(--gray); }

@media (max-width: 720px) {
  .jr-issue-body { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 12px 14px 20px; }
  .jr-side { position: static; order: -1; }
  .jr-title { font-size: 20px; }
  .jr-row-meta .lbl, .jr-row-meta .ep, .jr-row-meta .st-meter, .jr-row-meta .chip, .jr-row-meta .lz { display: none; }
  .jr-search { max-width: none; }
  .jr-group { margin-left: 0; }
  .jr-sbar { grid-template-columns: 112px minmax(0, 1fr) 26px; }
  .jr-summary { grid-template-columns: 1fr; }
  .jr-epic-row { grid-template-columns: minmax(0, 1fr) 70px; }
  .jr-epic-row .muted { display: none; }
}

/* ============================================
   ЕЖЕДНЕВНИК
   Слева папки и записи, справа редактор.
   Связь с календарём: значок записи в ячейке дня и блок под задачами дня
   ============================================ */

.jn { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
#jnCreate { white-space: nowrap; }

.jn-side {
  position: sticky;
  top: 90px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
}
.jn-side .add-btn { padding: 7px; font-size: 12px; }

/* папки */
.jn-folders { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.jn-folder { position: relative; display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 8px; font-size: 14px; cursor: pointer; transition: background .15s ease; }
.jn-folder:hover { background: var(--bg-hover); }
.jn-folder.is-active { background: var(--bg-beige); font-weight: 500; }
.jn-folder-icon { flex: none; width: 20px; text-align: center; color: var(--muted); }
.jn-folder-icon .ico { width: 15px; height: 15px; }
.jn-folder-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jn-folder .count { font-size: 11px; padding: 1px 7px; min-width: 22px; }
.jn-rename { flex: 1; min-width: 0; padding: 2px 6px; background: var(--bg-card); border-color: var(--accent); font-size: 14px; }
.jn-acts {
  position: absolute;
  top: 50%;
  right: 4px;
  display: flex;
  gap: 1px;
  padding: 1px 2px;
  border-radius: 7px;
  background: var(--bg-card);
  box-shadow: -6px 0 8px var(--bg-card);
  transform: translateY(-50%);
  opacity: 0;
  pointer-events: none;
}
.jn-folder:hover .jn-acts { opacity: 1; pointer-events: auto; }
.jn-acts .icon-btn { width: 24px; height: 24px; font-size: 12px; }

/* записи папки */
.jn-list { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.jn-list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 8px; font-size: 12px; font-weight: 600; color: var(--muted); }
.jn-list-head { flex-wrap: wrap; row-gap: 6px; }   /* узкая колонка — кнопки уходят строкой ниже, а не ломают подпись */
.jn-list-head > span:first-child { white-space: nowrap; }
.jn-list-acts { display: flex; gap: 4px; flex: none; }
.jn-list-acts .btn-ghost { padding: 4px 9px; font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.jn-item { display: block; width: 100%; padding: 9px 10px; border: none; border-radius: 10px; background: none; color: var(--text); text-align: left; cursor: pointer; transition: background .15s ease; }
.jn-item:hover { background: var(--bg-hover); }
.jn-item.is-active { background: var(--bg-beige); }
.jn-item b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jn-item small { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted); }
.jn-item p {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--muted);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.jn-empty { padding: 18px 10px; font-size: 13px; line-height: 1.5; text-align: center; color: var(--faint); }

/* редактор */
.jn-editor { min-height: 560px; padding: 18px 28px 24px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.jn-doc-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12.5px; color: var(--muted); }
.jn-saved { margin-left: auto; font-size: 12px; color: var(--faint); }
.jn-cal-link { padding: 2px 8px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card); color: var(--muted); font-size: 12px; cursor: pointer; }
.jn-cal-link:hover { color: var(--text); border-color: var(--accent); }
.jn-move {
  width: auto;
  padding: 4px 24px 4px 8px;
  background: var(--bg-card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238eb69b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center / 9px;
  border-color: var(--border);
  font-size: 12.5px;
}

.jn-title {
  width: 100%;
  padding: 4px 0;
  border: none;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -.02em;
  outline: none;
}
.jn-title::placeholder { color: var(--faint); }

.jn-tasks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 6px 0 4px; font-size: 12.5px; color: var(--muted); }
.jn-task { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 10px 3px 6px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card); color: var(--text); font-size: 12.5px; cursor: pointer; }
.jn-task:hover { border-color: var(--accent); }
.jn-task.is-done { color: var(--muted); text-decoration: line-through; }

/* панель форматирования — прилипает сверху, пока пишешь длинный текст */
.jn-toolbar {
  position: sticky;
  top: 84px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  margin: 12px 0 14px;
  padding: 5px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 6px 16px rgba(5, 31, 32, .06);
}
.jn-tb { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border: none; border-radius: 7px; background: none; color: var(--muted); font-size: 14px; cursor: pointer; transition: background .15s ease, color .15s ease; }
.jn-tb:hover { background: var(--bg-hover); color: var(--text); }
.jn-tb.is-on { background: var(--bg-beige); color: var(--text); }
.jn-sep { width: 1px; height: 18px; margin: 0 4px; background: var(--border); }
.jn-block {
  width: auto;
  padding: 5px 24px 5px 8px;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238eb69b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 8px center / 9px;
  font-size: 13px;
}
.jn-link[hidden] { display: none; }
.jn-link { flex: 1 1 200px; }
.jn-link .cell { padding: 5px 8px; background: var(--bg-card); border-color: var(--accent); font-size: 13px; }

/* текст записи */
.jn-body { min-height: 380px; padding: 2px 0 40px; outline: none; color: var(--text); font-size: 15.5px; line-height: 1.65; word-break: break-word; }
.jn-body:empty::before { content: attr(data-placeholder); color: var(--faint); }
.jn-body > * + * { margin-top: 6px; }
.jn-body h1 { margin-top: 18px; font-size: 26px; font-weight: 600; line-height: 1.25; letter-spacing: -.02em; }
.jn-body h2 { margin-top: 16px; font-size: 21px; font-weight: 600; line-height: 1.3; }
.jn-body h3 { margin-top: 14px; font-size: 17px; font-weight: 600; line-height: 1.35; }
.jn-body > :first-child { margin-top: 0; }
.jn-body ul, .jn-body ol { padding-left: 24px; }
.jn-body li + li { margin-top: 2px; }
.jn-body blockquote { padding: 4px 14px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--bg-card); color: var(--muted); }
.jn-body pre { padding: 10px 12px; border-radius: 8px; background: var(--bg-beige); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: pre-wrap; }
.jn-body a { color: var(--accent-ink); text-decoration: underline; cursor: text; }
.jn-body hr { margin: 16px 0; border: none; border-top: 1px solid var(--border); }
.jn-body b, .jn-body strong { font-weight: 650; }

/* чек-лист: квадратик рисуем сами, клик по нему ставит галочку */
.jn-body ul.jn-todo { padding-left: 2px; list-style: none; }
.jn-todo > li { position: relative; padding-left: 28px; }
.jn-todo > li::before {
  content: "";
  position: absolute;
  top: .28em;
  left: 2px;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--bg-soft);
  cursor: pointer;
}
.jn-todo > li.is-done { color: var(--muted); text-decoration: line-through; }
.jn-todo > li.is-done::before {
  border-color: var(--green);
  background: var(--green) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1.5 5.2l3 3 6-6.4' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 10px;
}

.jn-foot { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }

.jn-blank { display: grid; place-items: center; align-content: center; gap: 10px; min-height: 500px; padding: 20px; text-align: center; }
.jn-blank-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; background: var(--bg-hover); color: var(--muted); }
.jn-blank-icon .ico { width: 26px; height: 26px; stroke-width: 1.3; }
.jn-blank b { font-size: 17px; }
.jn-blank p { max-width: 380px; font-size: 13.5px; line-height: 1.5; }
.jn-blank-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.jn-blank-actions .btn-primary, .jn-blank-actions .btn-ghost { padding: 8px 16px; }

/* ---------- в календаре ---------- */
.cal-jn { margin-left: 4px; font-style: normal; color: var(--accent); }
.cal-jn .ico { width: 11px; height: 11px; vertical-align: -1px; }

.day-jn {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, transform .15s ease;
}
button.day-jn:hover { border-color: var(--accent); transform: translateX(2px); }
.day-jn-head { font-size: 12px; font-weight: 600; color: var(--muted); }
.day-jn b { font-size: 14px; }
.day-jn-text {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}
.day-jn-open { font-size: 12px; font-weight: 600; color: var(--accent-ink); }
.day-jn.is-empty { align-items: flex-start; gap: 10px; border-left-color: var(--border-strong); cursor: default; font-size: 13px; color: var(--muted); }

/* ---------- ежедневник на узком экране ---------- */
@media (max-width: 900px) {
  .jn { grid-template-columns: minmax(0, 1fr); }
  .jn-side { position: static; max-height: none; }
  .jn-list { max-height: 360px; overflow-y: auto; }
  .jn-editor { min-height: 0; padding: 14px 16px 18px; }
  .jn-title { font-size: 24px; }
  .jn-toolbar { top: 70px; }
  .jn-acts { opacity: 1; pointer-events: auto; }
}

/* ============================================
   ВХОД, ПРОФИЛЬ И ЛЮДИ (auth.js)
   ============================================ */

/* пока никто не вошёл — вместо страницы только экран входа */
html.auth-locked .header,
html.auth-locked main,
html.auth-locked #emojiBtn { visibility: hidden; }

#auth {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow-y: auto;
  background:
    radial-gradient(60% 50% at 10% 0%, rgba(255, 255, 255, .1) 0%, transparent 70%),
    radial-gradient(120% 100% at 50% 40%, #2c2c2e 0%, #1c1c1e 55%, #0c0c0d 100%);
}
.auth-card {
  width: min(420px, 100%);
  padding: 30px 30px 22px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-size: 18px; }
.auth-card h1 { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.auth-lead { margin: 6px 0 18px; font-size: 14px; line-height: 1.5; color: var(--muted); }
.auth-form { display: flex; flex-direction: column; gap: 12px; }

.auth-form label,
.au-body label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.auth-form .cell,
.au-body .cell { padding: 9px 11px; background: var(--bg-card); border-color: var(--border); color: var(--text); font-size: 15px; }

.auth-pass { position: relative; display: block; }
.auth-pass .cell { padding-right: 40px; }
.auth-pass .icon-btn { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); }
.auth-form .auth-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }

.auth-error,
.au-error { padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--red) 12%, transparent); color: var(--red); font-size: 13px; line-height: 1.4; }
.auth-error[hidden],
.au-error[hidden] { display: none; }
.auth-submit { padding: 11px 16px; border-radius: 12px; font-size: 15px; }
.auth-submit:disabled { opacity: .6; cursor: progress; }
.auth-note { margin-top: 16px; font-size: 11.5px; line-height: 1.5; text-align: center; color: var(--faint); }
.auth-hint { font-size: 11.5px; font-weight: 400; line-height: 1.45; color: var(--faint); }
.auth-hint code { padding: 1px 5px; border-radius: 6px; background: var(--bg-hover); color: var(--text); font-size: 11px; word-break: break-all; user-select: all; }

/* с сервером: нет связи — полоска внизу поверх всего, включая экран входа */
#brizzOffline {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 2000;
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  transform: translateX(-50%);
  border-radius: 12px;
  background: var(--ink-900);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  color: #f5f5f7;
  font-size: 13.5px;
  line-height: 1.4;
  text-align: center;
}

/* ---------- аватар ---------- */
.uav {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--s, 32px);
  height: var(--s, 32px);
  overflow: hidden;
  border-radius: 50%;
  background: var(--c, var(--accent));
  color: #fff;
  font-size: calc(var(--s, 32px) * .4);
  font-weight: 700;
  line-height: 1;
  user-select: none;
}
.uav img { width: 100%; height: 100%; object-fit: cover; }
.uav.is-gone { background: var(--bg-hover); color: var(--muted); }

/* ---------- кнопка человека в шапке и её меню ---------- */
.me-btn {
  grid-row: 3;
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  height: 42px;
  padding: 0 8px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}
.me-btn:hover { background: color-mix(in srgb, var(--text) 5%, transparent); }
.me-name { min-width: 0; line-height: 1.25; }
.me-name b, .me-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-name b { font-size: 13px; font-weight: 500; }
.me-name small { font-size: 11.5px; color: var(--faint); }

.me-menu {
  position: fixed;
  z-index: 150;
  width: min(240px, calc(100vw - 24px));
  padding: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.me-menu[hidden] { display: none; }
.me-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; padding: 8px 8px 10px; border-bottom: 1px solid var(--line-soft); }
.me-head b { display: block; font-size: 14px; }
.me-head > div > span { display: block; font-size: 12px; }
.me-menu button { display: block; width: 100%; padding: 8px 10px; border: none; border-radius: 9px; background: none; color: var(--text); font-size: 14px; text-align: left; cursor: pointer; }
.me-menu button:hover { background: var(--bg-hover); }
.me-menu .is-danger { color: var(--red); }

/* ---------- окна «Профиль» и «Люди» ---------- */
.au-modal .modal-box { width: min(560px, 100%); }
.au-body { display: flex; flex-direction: column; gap: 12px; padding-top: 14px; }
.au-body h3 { margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 15px; }
.au-pass-form { display: flex; flex-direction: column; gap: 12px; }
.au-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.au-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; }
.au-notice { padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--amber) 16%, transparent); font-size: 13.5px; line-height: 1.45; }

.au-avatar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.au-avatar-tools { display: flex; flex: 1; flex-direction: column; gap: 10px; min-width: 220px; }
.au-colors { display: flex; flex-wrap: wrap; gap: 6px; }
.au-colors button { width: 24px; height: 24px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: var(--c); cursor: pointer; }
.au-colors button:hover { border-color: var(--text); }
.au-photo { display: flex; flex-wrap: wrap; gap: 6px; }
.au-photo .btn-ghost { padding: 6px 11px; font-size: 12.5px; }

.au-people { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.au-person { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--bg-card); border-bottom: 1px solid var(--line-soft); }
.au-person:last-child { border-bottom: none; }
.au-person-text { flex: 1; min-width: 0; }
.au-person-text b { display: block; font-size: 14px; }
.au-person-text span { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.au-person .btn-ghost { padding: 5px 10px; font-size: 12px; white-space: nowrap; }

.au-created { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--green) 14%, transparent); font-size: 13.5px; }
.au-created code { padding: 8px 10px; border-radius: 8px; background: var(--bg-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; white-space: pre; user-select: all; }

/* ============================================
   АДМИН-ПАНЕЛЬ (admin.js)
   ============================================ */

.au-modal.is-wide .modal-box { display: flex; flex-direction: column; width: min(1100px, 100%); height: min(760px, 90vh); max-height: 90vh; overflow: hidden; }
.ad-who { margin-right: auto; margin-left: 4px; font-size: 12.5px; }

.ad { display: grid; flex: 1; grid-template-columns: 210px minmax(0, 1fr); min-height: 0; }
.ad-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px; overflow-y: auto; background: var(--bg-card); border-right: 1px solid var(--border); }
.ad-nav button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: none; border-radius: 10px; background: none; color: var(--text); font-size: 14px; text-align: left; cursor: pointer; }
.ad-nav button:hover { background: var(--bg-hover); }
.ad-nav button.is-on { background: var(--bg-beige); font-weight: 600; }
.ad-main { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px 26px; overflow-y: auto; }

.ad-main label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ad-main .cell { padding: 8px 10px; background-color: var(--bg-card); border-color: var(--border); color: var(--text); font-size: 14px; }
.ad-main select.cell {
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238eb69b' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 10px;
}
.ad-main .cell:disabled { opacity: .6; }
.ad-main .ad-check { flex-direction: row; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--text); }
.ad-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.ad-note { font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.ad-pad { padding: 14px; }

.ad-card { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: 14px; }
.ad-card h4 { font-size: 14px; }
.ad-card h5 { margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.ad-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ad-card-head .btn-ghost, .ad-card-head .btn-primary { padding: 6px 12px; font-size: 12.5px; }
.ad-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-actions .btn-ghost:disabled { opacity: .45; cursor: default; }

.ad-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ad-tile { padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px; }
.ad-tile b { display: block; font-size: 26px; font-weight: 500; line-height: 1.15; letter-spacing: -.02em; }
.ad-tile span { font-size: 12px; color: var(--muted); }

.ad-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ad-bar .cell { flex: 1 1 220px; width: auto; }
.ad-bar select.cell { flex: 0 1 240px; }

.ad-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ad-user > div > b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-user > div > span { display: block; font-size: 12px; color: var(--muted); }   /* только подпись, не кружок аватара */

.ad-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--bg-hover); color: var(--muted); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.ad-badge.is-ok    { background: color-mix(in srgb, var(--green) 18%, transparent); color: color-mix(in srgb, var(--green) 72%, var(--text)); }
.ad-badge.is-warn  { background: color-mix(in srgb, var(--amber) 20%, transparent); color: color-mix(in srgb, var(--amber) 70%, var(--text)); }
.ad-badge.is-bad   { background: color-mix(in srgb, var(--red) 14%, transparent);   color: var(--red); }
.ad-badge.is-owner { background: var(--accent); color: var(--on-accent); }
.ad-badge.is-admin { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-ink); }
.ad-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--border-strong); vertical-align: 1px; }
.ad-dot.is-on { background: var(--online); }

.ad-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; }
.ad-table { width: 100%; min-width: 780px; border-collapse: collapse; font-size: 13.5px; }
.ad-table th { padding: 10px 12px; background: var(--bg-card); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 600; text-align: left; }
.ad-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.ad-table tr:last-child td { border-bottom: none; }
.ad-table tr[data-person] { cursor: pointer; }
.ad-table tr[data-person]:hover td { background: var(--row-hover); }
.ad-arrow { color: var(--faint); font-size: 18px; text-align: right; }

.ad-people-mini { display: flex; flex-wrap: wrap; gap: 8px; }
.ad-mini { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card); color: var(--text); font-size: 13px; cursor: pointer; }
.ad-mini:hover { border-color: var(--accent); }
.ad-mini .ad-dot { margin: 0; }

.ad-back { align-self: flex-start; padding-left: 0; }
.ad-person-head { display: flex; align-items: center; gap: 16px; }
.ad-person-head h3 { font-size: 21px; font-weight: 600; }
.ad-person-head > div > span { font-size: 13px; color: var(--muted); }
.ad-person-head p { margin-top: 4px; font-size: 13px; }
.ad-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }

.ad-rows { display: flex; flex-direction: column; gap: 8px; }
.ad-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 160px) 90px; align-items: center; gap: 12px; font-size: 13.5px; }
.ad-row.is-bar { grid-template-columns: minmax(0, 220px) minmax(0, 1fr) 90px; }
.ad-row b { text-align: right; font-variant-numeric: tabular-nums; }
.ad-usage { display: block; height: 10px; overflow: hidden; border-radius: 999px; background: var(--bg-hover); }
.ad-usage i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }

.ad-log { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; }
.ad-log-row { display: grid; grid-template-columns: 130px 180px 170px minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg-card); border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.ad-log-row:last-child { border-bottom: none; }
.ad-log-row .ad-user b { font-size: 13px; }
.ad-card .ad-log-row { padding-left: 0; padding-right: 0; background: none; }

@media (max-width: 760px) {
  .au-modal.is-wide .modal-box { height: 92vh; }
  .ad { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .ad-nav { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .ad-nav button { white-space: nowrap; }
  .ad-main { padding: 14px; }
  .ad-log-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ad-row.is-bar { grid-template-columns: minmax(0, 1fr) 80px; }
  .ad-row.is-bar .ad-usage { display: none; }
}

/* ============================================
   СООБЩЕНИЯ (chat.js)
   Слева чаты и люди, справа переписка
   ============================================ */

.tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 10.5px;
  font-style: normal;
  font-weight: 700;
  vertical-align: 1px;
}
.tab-badge[hidden] { display: none; }

.ch { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; height: calc(100vh - 230px); min-height: 480px; }

/* ---------- список ---------- */
.ch-side { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 10px; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.ch-search { background: var(--bg-card); border-color: var(--border); }
.ch-list { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; }
.ch-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: none; border-radius: 12px; background: none; color: var(--text); text-align: left; cursor: pointer; transition: background .12s ease; }
.ch-item:hover { background: var(--bg-hover); }
.ch-item.is-active { background: var(--bg-beige); }
.ch-item-text { flex: 1; min-width: 0; }
.ch-item-text b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-item-text > span { display: block; margin-top: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-item.has-unread .ch-item-text > span { color: var(--text); font-weight: 500; }
.ch-item-meta { display: flex; flex: none; flex-direction: column; align-items: flex-end; gap: 4px; }
.ch-item-meta small { font-size: 11px; color: var(--faint); }
.ch-unread { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 11px; font-style: normal; font-weight: 700; }
.ch-sep { margin: 10px 8px 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.ch-empty { padding: 14px 10px; font-size: 13px; line-height: 1.45; text-align: center; color: var(--faint); }

.ch-av { position: relative; display: inline-grid; flex: none; }
.ch-online { position: absolute; right: 0; bottom: 0; width: 11px; height: 11px; border: 2px solid var(--bg-soft); border-radius: 50%; background: var(--online); }

/* ---------- переписка ---------- */
.ch-room { display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); }
.ch-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); }
.ch-head-text { flex: 1; min-width: 0; }
.ch-head-text b { display: block; font-size: 15px; }
.ch-head-text span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-find { width: 200px; padding: 6px 10px; background: var(--bg-card); border-color: var(--border); }
.ch-find[hidden] { display: none; }
.ch-back { display: none; }

.ch-msgs {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
  padding: 14px 18px;
  overflow-y: auto;
  background: radial-gradient(90% 60% at 100% 0%, color-mix(in srgb, var(--accent) 6%, transparent), transparent 70%);
}
.ch-day { display: flex; justify-content: center; margin: 12px 0 8px; }
.ch-day span { padding: 3px 10px; border-radius: 999px; background: var(--bg-hover); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.ch-sys { align-self: center; margin: 6px 0; font-size: 12px; color: var(--muted); }
.ch-empty-room { margin: auto; font-size: 14px; color: var(--faint); }

.ch-msg { position: relative; display: flex; align-items: flex-end; gap: 8px; max-width: 76%; }
.ch-msg.is-first { margin-top: 8px; }
.ch-msg.is-mine { align-self: flex-end; flex-direction: row-reverse; }
.ch-msg-av { flex: none; width: 30px; }

.ch-bubble {
  position: relative;
  min-width: 64px;
  padding: 7px 11px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.45;
  word-break: break-word;
}
.ch-msg.is-mine .ch-bubble { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.ch-bubble.is-deleted,
.ch-msg.is-mine .ch-bubble.is-deleted { background: transparent; border: 1px dashed var(--border-strong); color: var(--muted); }
.ch-msg.is-flash .ch-bubble { box-shadow: 0 0 0 3px var(--accent-ring); }
.ch-author { display: block; margin-bottom: 2px; font-size: 12.5px; color: var(--accent-ink); }
.ch-text { white-space: pre-wrap; }
.ch-text a { color: inherit; text-decoration: underline; }
.ch-meta { float: right; margin: 6px 0 -2px 10px; font-size: 10.5px; white-space: nowrap; opacity: .7; }
.ch-ticks { margin-left: 4px; font-style: normal; letter-spacing: -2px; }
.ch-ticks.is-read { font-weight: 700; }

.ch-quote { display: block; width: 100%; margin-bottom: 5px; padding: 4px 8px; border: none; border-left: 3px solid currentColor; border-radius: 6px; background: color-mix(in srgb, currentColor 10%, transparent); color: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.ch-quote b { display: block; font-size: 12px; }
.ch-quote span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .8; }

.ch-image { display: block; margin: 2px 0 4px; padding: 0; overflow: hidden; border: none; border-radius: 10px; background: none; cursor: zoom-in; }
.ch-image img { display: block; max-width: min(320px, 100%); max-height: 320px; object-fit: cover; }
.ch-file { display: flex; align-items: center; gap: 10px; margin: 2px 0 4px; padding: 8px 10px; border: none; border-radius: 10px; background: color-mix(in srgb, currentColor 8%, transparent); color: inherit; text-align: left; cursor: pointer; }
.ch-file b { display: block; font-size: 13.5px; }
.ch-file small { font-size: 11.5px; opacity: .75; }
.ch-file-icon { color: var(--muted); }
.ch-file-icon .ico { width: 22px; height: 22px; stroke-width: 1.3; }
.ch-file.is-gone { font-size: 12.5px; cursor: default; opacity: .7; }

.ch-share { display: flex; flex-direction: column; gap: 4px; margin: 2px 0 4px; padding: 9px 11px; border-radius: 10px; background: color-mix(in srgb, currentColor 8%, transparent); }
.ch-share-kind { font-size: 11.5px; opacity: .75; }
.ch-share b { font-size: 14px; }
.ch-share-text { font-size: 12.5px; white-space: pre-wrap; opacity: .85; }
.ch-share .btn-ghost { align-self: flex-start; margin-top: 4px; padding: 5px 10px; font-size: 12.5px; }

/* действия с сообщением — сбоку от пузыря при наведении */
.ch-actions {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  gap: 1px;
  padding: 2px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
  transition: opacity .12s ease;
}
.ch-msg:not(.is-mine) .ch-actions { left: 100%; margin-left: 6px; }
.ch-msg.is-mine .ch-actions { right: 100%; margin-right: 6px; }
.ch-msg:hover .ch-actions { opacity: 1; pointer-events: auto; }
.ch-actions button { width: 28px; height: 26px; border: none; border-radius: 7px; background: none; color: var(--text); font-size: 13px; cursor: pointer; }
.ch-actions button:hover { background: var(--bg-hover); }

/* ---------- поле ввода ---------- */
.ch-compose { padding: 8px 12px 10px; border-top: 1px solid var(--border); }
.ch-bar { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.ch-bar[hidden] { display: none; }
.ch-bar-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-left: 3px solid var(--accent); border-radius: 8px; background: var(--bg-card); color: var(--muted); font-size: 13px; }
.ch-bar-row span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-pending { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; }
.ch-input { display: flex; align-items: flex-end; gap: 8px; }
.ch-input textarea { flex: 1; min-height: 40px; max-height: 180px; padding: 9px 12px; resize: none; background: var(--bg-card); border-color: var(--border); border-radius: 12px; font: inherit; font-size: 14.5px; line-height: 1.4; }
.ch-input .icon-btn { width: 40px; height: 40px; font-size: 18px; }
.ch-send { width: 44px; height: 40px; padding: 0; border-radius: 12px; font-size: 16px; }

.ch-blank { display: grid; place-items: center; align-content: center; gap: 10px; height: 100%; padding: 20px; text-align: center; }
.ch-blank-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto; border-radius: 16px; background: var(--bg-hover); color: var(--muted); }
.ch-blank-icon .ico { width: 26px; height: 26px; stroke-width: 1.3; }
.ch-blank b { font-size: 17px; }
.ch-blank p { max-width: 360px; font-size: 13.5px; }

/* ---------- окна: выбор людей, группа, фото ---------- */
.ch-pick { display: flex; flex-direction: column; max-height: 50vh; overflow-y: auto; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); }
.ch-pick:empty { display: none; }
.ch-pick-row,
.au-body .ch-pick-row { display: flex; flex-direction: row; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: none; border-bottom: 1px solid var(--line-soft); background: var(--bg-card); color: var(--text); font-size: 14px; font-weight: 400; text-align: left; cursor: pointer; }
.ch-pick-row:last-child { border-bottom: none; }
.ch-pick-row:hover { background: var(--bg-hover); }
.ch-pick-row[hidden] { display: none; }
.ch-pick-row > span:not(.ch-av) { flex: 1; min-width: 0; }
.ch-pick-row b { display: block; font-size: 14px; }
.ch-pick-row small { display: block; font-size: 12px; color: var(--muted); }
.ch-add-member { display: flex; gap: 8px; }
.ch-add-member select { flex: 1; }
.ch-viewer { display: grid; flex: 1; place-items: center; min-height: 0; padding: 14px; overflow: auto; background: #0c0c0d; }
.ch-viewer img { max-width: 100%; max-height: 70vh; border-radius: 8px; }
.ch-viewer-foot { padding: 10px 16px; }

@media (max-width: 760px) {
  .ch { grid-template-columns: minmax(0, 1fr); height: calc(100vh - 250px); }
  .ch.is-room .ch-side { display: none; }
  .ch:not(.is-room) .ch-room { display: none; }
  .ch-back { display: grid; }
  .ch-msg { max-width: 88%; }
  .ch-msg:not(.is-mine) .ch-actions,
  .ch-msg.is-mine .ch-actions { top: -30px; right: 0; left: auto; margin: 0; transform: none; }
  .ch-find { width: 120px; }
}


/* ============================================
   УВЕДОМЛЕНИЯ И НАЗНАЧЕНИЕ ЗАДАЧ (notify.js)
   ============================================ */

/* колокольчик внизу боковой панели — рядом с настройками */
.notify-btn {
  grid-row: 3;
  grid-column: 2;
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.notify-btn svg { width: 17px; height: 17px; stroke-width: 1.6; }
.notify-btn:hover { background: color-mix(in srgb, var(--text) 6%, transparent); color: var(--text); }
.notify-btn.is-active { background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--accent); }
.notify-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border: 2px solid var(--side-bg);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-style: normal;
  font-weight: 700;
  line-height: 1;
}
.notify-badge[hidden] { display: none; }

/* фильтры */
.nt-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.nt-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.nt-chip i { min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--bg-hover); font-size: 11px; font-style: normal; font-weight: 700; text-align: center; }
.nt-chip.is-on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.nt-chip.is-on i { background: rgba(255, 255, 255, .22); }

.nt-list { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.nt-h { margin: 14px 0 4px; font-size: 12px; font-weight: 600; color: var(--faint); }
.nt-h:first-child { margin-top: 0; }

/* задача, которую нужно принять */
.nt-tasks { display: flex; flex-direction: column; gap: 12px; }
.nt-task {
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  border-radius: 18px;
  background: var(--bg-soft);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 8%, transparent);
}
.nt-task-head { display: flex; align-items: center; gap: 10px; }
.nt-task-head b { display: block; font-size: 14px; }
.nt-task-head span { font-size: 12px; }
.nt-task-body { margin: 14px 0 16px; padding: 14px 16px; border-radius: 12px; background: var(--bg-card); }
.nt-key { font-size: 12px; font-weight: 600; color: var(--faint); }
.nt-task-body h3 { margin: 2px 0 6px; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.nt-task-body p { margin-bottom: 8px; font-size: 14px; line-height: 1.5; color: var(--muted); white-space: pre-line; }
.nt-meta { font-size: 12.5px; color: var(--muted); }
.nt-task-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.nt-task-actions button:disabled { opacity: .6; cursor: progress; }

/* строки ленты и сообщений */
.nt-rows { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-soft); }
.nt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--line-soft);
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.nt-row:last-child { border-bottom: none; }
.nt-row:hover { background: var(--bg-hover); }
.nt-row.is-new { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.nt-row-av { position: relative; flex: none; display: inline-grid; }
.nt-row-av i { position: absolute; right: -6px; bottom: -4px; display: grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--bg-soft); border-radius: 50%; background: var(--text); color: var(--bg-soft); font-style: normal; }
.nt-row-av i .ico { width: 11px; height: 11px; stroke-width: 1.8; }
.nt-row-av:empty::before { content: ""; width: 36px; height: 36px; }
.nt-row-text { flex: 1; min-width: 0; }
.nt-row-text b { display: block; font-size: 14px; font-weight: 600; }
.nt-row-text span { display: block; overflow: hidden; font-size: 13px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.nt-row-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.nt-row-meta small { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.nt-row-meta em { padding: 1px 8px; border-radius: 999px; background: var(--bg-hover); font-size: 11px; font-style: normal; color: var(--muted); }
.nt-row-meta .tab-badge { margin-left: 0; }

.nt-empty { padding: 48px 20px; border: 1px dashed var(--border); border-radius: 18px; text-align: center; }
.nt-empty div { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 14px; background: var(--bg-hover); color: var(--muted); }
.nt-empty div .ico { width: 22px; height: 22px; }
.nt-empty b { display: block; margin-bottom: 4px; font-size: 16px; }

/* исполнитель в карточке задачи */
.av-user { display: inline-grid; flex: none; border-radius: 50%; }
.av-user.is-pending { outline: 2px dashed var(--amber); outline-offset: 1px; }
.jr-assignee { min-width: 0; }
.jr-assign { margin-top: 6px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.jr-assign.is-wait { color: var(--amber); }
.jr-assign.is-ok { color: var(--green); }

@media (max-width: 600px) {
  .nt-task { padding: 14px; }
  .nt-task-actions button { flex: 1; }
  .nt-row { padding: 10px 12px; }
}

/* ============================================
   ПОЛЬЗОВАТЕЛИ: список, профиль и стена (people.js)
   ============================================ */

.pp-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 18px; }
.pp-bar .cell { flex: 1; min-width: 220px; max-width: 420px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-soft); }
.pp-bar .muted { font-size: 13px; }

.pp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.pp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 16px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-soft);
  text-align: center;
  cursor: pointer;
  transition: box-shadow .15s ease, transform .15s ease;
}
.pp-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.pp-card[hidden] { display: none; }
.pp-av { position: relative; display: inline-grid; flex: none; margin-bottom: 6px; }
.pp-online { position: absolute; right: 4px; bottom: 4px; width: 16px; height: 16px; border: 3px solid var(--bg-soft); border-radius: 50%; background: var(--online); }
.pp-name { font-size: 16px; font-weight: 600; }
.pp-login { font-size: 12.5px; color: var(--muted); }
.pp-role { display: inline-block; margin-top: 4px; padding: 2px 10px; border-radius: 999px; background: var(--bg-hover); color: var(--muted); font-size: 11.5px; font-weight: 600; }
.pp-role.is-owner { background: var(--accent); color: var(--on-accent); }
.pp-role.is-admin { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--text); }
.pp-role.is-bad { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.pp-status { min-height: 36px; margin: 6px 0 10px; overflow: hidden; font-size: 13px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.pp-card-actions { display: flex; gap: 8px; width: 100%; margin-top: auto; }
.pp-card-actions button { flex: 1; padding: 7px 10px; font-size: 13px; }
.pp-empty { padding: 30px; text-align: center; color: var(--faint); }
.pp-empty[hidden] { display: none; }

/* профиль */
.pp-back { margin-bottom: 14px; }
.pp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px 28px;
  padding: 26px 28px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background:
    radial-gradient(80% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent) 0%, transparent 60%),
    var(--bg-soft);
}
.pp-head .pp-av { margin: 0; }
.pp-head .pp-online { width: 22px; height: 22px; right: 8px; bottom: 8px; }
.pp-head-text { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.pp-head-text h2 { font-size: clamp(26px, 3.4vw, 36px); font-weight: 600; letter-spacing: -.02em; }
.pp-head-text p { font-size: 13.5px; }
.pp-head-status { font-size: 15px !important; line-height: 1.45; }
.pp-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.pp-columns { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; margin-top: 18px; align-items: start; }
.pp-wall, .pp-box { padding: 20px 22px; border: 1px solid var(--border); border-radius: 20px; background: var(--bg-soft); }
.pp-wall h3, .pp-box h3 { margin-bottom: 12px; font-size: 16px; font-weight: 600; }
.pp-side { display: flex; flex-direction: column; gap: 18px; }
.pp-note { font-size: 13px; }

.pp-compose { display: flex; align-items: flex-start; gap: 12px; }
.pp-compose textarea { flex: 1; min-height: 64px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); resize: vertical; font-size: 14px; line-height: 1.45; }
.pp-hint { margin: 6px 0 14px 52px; font-size: 12px; }

.pp-posts { display: flex; flex-direction: column; gap: 12px; }
.pp-post { padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: 16px; background: var(--bg-card); }
.pp-post header { display: flex; align-items: center; gap: 10px; }
.pp-post header > div { flex: 1; display: flex; flex-direction: column; }
.pp-post header .muted { font-size: 12px; }
.pp-post-av, .pp-post-name { padding: 0; border: none; background: none; color: inherit; cursor: pointer; text-align: left; }
.pp-post-av { display: inline-grid; border-radius: 50%; }
.pp-post-name { font-size: 14px; font-weight: 600; }
.pp-post-name:hover { text-decoration: underline; }
.pp-post-text { margin: 10px 0 8px; font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.pp-post footer { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.pp-like { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-soft); color: var(--text); font-size: 13px; cursor: pointer; }
.pp-like.is-on { border-color: color-mix(in srgb, var(--red) 40%, var(--border)); background: color-mix(in srgb, var(--red) 8%, var(--bg-soft)); color: var(--red); }
.pp-like.is-on span { color: var(--text); }
.pp-wall-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 28px 12px; border: 1px dashed var(--border); border-radius: 16px; text-align: center; color: var(--muted); }
.pp-wall-empty > .ico { width: 24px; height: 24px; margin-bottom: 4px; }
.pp-wall-empty b { font-size: 15px; color: var(--text); }
.pp-wall-empty span { font-size: 13px; }

.pp-rows { display: flex; flex-direction: column; }
.pp-rows div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.pp-rows div:last-child { border-bottom: none; }
.pp-rows span { color: var(--muted); }
.pp-rows b { font-weight: 600; text-align: right; }

.pp-tasks { display: flex; flex-direction: column; gap: 8px; }
.pp-task { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--bg-card); color: var(--text); text-align: left; cursor: pointer; }
.pp-task:disabled { cursor: default; opacity: .75; }
.pp-task-text { display: flex; flex-direction: column; min-width: 0; }
.pp-task-text b { font-size: 13.5px; font-weight: 600; }
.pp-task-text small { font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .pp-columns { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .pp-head { padding: 20px; }
  .pp-actions button { flex: 1; }
  .pp-compose > .uav { display: none; }
  .pp-compose { flex-direction: column; align-items: stretch; }
  .pp-hint { margin-left: 0; }
}

/* ---------- BACKLOG: повторы, быстрый ввод, время, зависимости, сгорание, фокус дня ---------- */

.jr-form label[hidden] { display: none; }

/* что распознано в строке быстрого ввода */
.jr-parse { display: flex; flex-wrap: wrap; gap: 5px; }
.jr-parse:empty { display: none; }
.jr-quick-form { flex-wrap: wrap; }
.jr-quick-form .jr-parse { flex-basis: 100%; }
.jr-parse span { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-ink); font-size: 12px; font-weight: 500; }
.jr-parse .ico, .jr-parse .pi { width: 13px; height: 13px; }
.jr-parse .it { transform: scale(.8); }

/* значки на строке и карточке */
.jr-badge { display: inline-flex; align-items: center; gap: 3px; color: var(--faint); font-size: 11.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.jr-badge .ico { width: 13px; height: 13px; }
.jr-badge.is-focus { color: var(--amber); }
.chip.is-blocked { display: inline-flex; align-items: center; gap: 3px; color: var(--muted); background: var(--bg-hover); }
.chip.is-blocked .ico { width: 11px; height: 11px; }

/* шаблоны в окне «Создать» */
.jr-tpl-row { display: flex; align-items: flex-end; gap: 8px; }
.jr-tpl-row label { flex: 1; }
.jr-tpl-row .icon-btn { margin-bottom: 4px; }
.jr-tpl-subs { margin-top: -4px; font-size: 12.5px; line-height: 1.5; }
.jr-tpl-subs[hidden] { display: none; }

/* кнопки в шапке карточки */
.jr-head-actions .icon-btn.is-focus { color: var(--amber); }

/* зависимости */
.jr-dep-cap { margin: 4px 0 6px; font-size: 12px; color: var(--muted); }
.jr-dep-lock { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--amber); }
.jr-dep-lock .ico { width: 12px; height: 12px; }
.jr-kid .icon-btn { margin-left: 2px; }
select.jr-kid-add { color: var(--muted); }

/* учёт времени и Pomodoro */
.jr-time { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.jr-time .btn-ghost { display: inline-flex; align-items: center; gap: 6px; }
.jr-time .btn-ghost .ico { width: 13px; height: 13px; }
.jr-time .is-running { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); font-variant-numeric: tabular-nums; }
.jr-time input.cell { width: 90px; background: var(--bg-card); border-color: var(--border); }
.jr-worklog { margin-top: 8px; font-size: 12.5px; }
.jr-worklog div { display: grid; grid-template-columns: 130px 1fr auto 24px; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line-soft); }
.jr-worklog b { font-weight: 600; font-variant-numeric: tabular-nums; }
.jr-worklog .icon-btn { opacity: 0; }
.jr-worklog div:hover .icon-btn { opacity: 1; }

.pomo-pill {
  position: fixed; right: 20px; bottom: 20px; z-index: 900;
  display: flex; align-items: center; gap: 8px; max-width: min(360px, calc(100vw - 32px));
  height: 40px; padding: 0 6px 0 14px;
  border-radius: 20px; background: var(--btn-bg); color: var(--on-btn);
  box-shadow: var(--shadow-pill); font-size: 13px; cursor: pointer;
}
.pomo-pill.is-break { background: var(--green); color: var(--on-accent); }
.pomo-pill .ico { flex: none; width: 15px; height: 15px; }
.pomo-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .8; }
.pomo-pill b { font-variant-numeric: tabular-nums; font-weight: 600; }
.pomo-stop { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: none; border-radius: 50%; background: color-mix(in srgb, var(--on-btn) 16%, transparent); color: inherit; cursor: pointer; }
.pomo-stop .ico { width: 12px; height: 12px; }

/* отчёт по времени за неделю */
.jr-panel-wide { grid-column: 1 / -1; }
.jr-time-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-bottom: 12px; }
.jr-time-head h3 { margin-bottom: 0; }
.jr-time-head > .muted { font-size: 13px; }
.jr-week-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.jr-time-grid { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 24px; align-items: start; }
.jr-time-epic summary { list-style: none; cursor: pointer; grid-template-columns: 180px minmax(0, 1fr) 54px; }
.jr-time-epic summary::-webkit-details-marker { display: none; }
.jr-time-epic[open] summary { font-weight: 600; }
.jr-time-epic .jr-feed { padding-left: 20px; }
.jr-time-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; height: 110px; }
.jr-time-days div { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; min-height: 0; }
.jr-time-days i { width: 100%; max-width: 22px; border-radius: 4px 4px 2px 2px; background: var(--accent); }
.jr-time-days span { font-size: 11px; color: var(--faint); }

/* диаграмма сгорания */
.jr-burn { display: block; width: 100%; height: auto; }
.jr-burn-grid { stroke: var(--line-soft); stroke-width: 1; }
.jr-burn-ax { fill: var(--faint); font-size: 10px; }
.jr-burn-ideal { stroke: var(--border-strong); stroke-width: 1.5; stroke-dasharray: 4 4; }
.jr-burn-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.jr-burn-dot { fill: var(--accent); }
.jr-burn-cap { margin-top: 6px; font-size: 12.5px; line-height: 1.5; }
.jr-burn-key { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 11.5px; }
.jr-burn-key i { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--accent); }
.jr-burn-key i.is-ideal { border-top: 2px dashed var(--border-strong); }
.jr-burn-key i + i, .jr-burn-key i:not(:first-child) { margin-left: 6px; }

/* стрелки зависимостей на Ганте */
.g-links { position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; overflow: visible; }
.g-link { fill: none; stroke: var(--muted); stroke-width: 1.4; }
.g-link.is-bad { stroke: var(--red); stroke-dasharray: 3 3; }
.g-link-head { fill: var(--muted); }
.g-link-head.is-bad { fill: var(--red); }

/* фокус на сегодня (главная) */
.dash-focus { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-focus-row, .dash-focus-slot { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 14px 0 20px; border-right: 1px solid var(--line-soft); }
.dash-focus > :nth-child(3) { border-right: none; }
.dash-focus-main { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; flex: 1; min-width: 0; padding: 8px 0; border: none; background: none; color: var(--text); font-size: 13.5px; text-align: left; cursor: pointer; }
.dash-focus-main .dash-title { max-width: 100%; font-weight: 500; }
.dash-focus-main .dash-due, .dash-focus-main .dash-label { display: none; }
.dash-focus-main .dash-due:not(:empty) { display: block; text-align: left; }
.dash-focus-row.is-done .dash-title { color: var(--faint); text-decoration: line-through; }
.dash-focus-row .icon-btn { opacity: 0; }
.dash-focus-row:hover .icon-btn { opacity: 1; }
.dash-focus-slot { border-top: none; border-bottom: none; border-left: none; background: none; color: var(--faint); font-size: 13px; cursor: pointer; }
.dash-focus-slot:hover { background: var(--row-hover); color: var(--text); }
.dash-focus-slot .ico { width: 15px; height: 15px; }
.dash-focus-win { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; padding: 10px 20px; border-top: 1px solid var(--line-soft); font-size: 13px; color: var(--green); }
.jr-focus-list { display: flex; flex-direction: column; max-height: 55vh; overflow-y: auto; }
.jr-focus-list .jr-feed[hidden] { display: none; }

@media (max-width: 900px) {
  .jr-time-grid { grid-template-columns: 1fr; }
  .dash-focus { grid-template-columns: 1fr; }
  .dash-focus-row, .dash-focus-slot { border-right: none; border-bottom: 1px solid var(--line-soft); }
  .jr-worklog div { grid-template-columns: 110px 1fr auto 24px; }
}
.jr-focus-list .jr-feed { grid-template-columns: auto auto minmax(0, 1fr) auto auto; }
.jr-parse-form { margin-top: -6px; }

/* ============================================
   ТРЕНИРОВКИ (fitness.js): журнал, сила, тело, питание, фото,
   таймер отдыха и «Вода и сон» на главной
   ============================================ */
.fz-summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.fz-summary .summary-item { padding: 12px 14px 14px; }
.fz-summary .summary-item strong { font-size: 19px; white-space: nowrap; }
.fz-summary .summary-item { min-width: 0; }
.fz-summary .fz-sum { text-align: left; font: inherit; color: var(--text); cursor: pointer; transition: background .15s ease; }
.fz-sum:hover { background: var(--row-hover); }
.fz-sum small, .fz-macro b small { font-size: 13px; font-weight: 400; color: var(--faint); }
.fz-live-dot { display: inline-block; width: 7px; height: 7px; margin-left: 4px; border-radius: 50%; background: var(--green); vertical-align: 1px; }

.fz-card { margin-bottom: 16px; padding: 18px 20px; background: var(--bg-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.fz-card-title { margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.fz-card-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 14px; }
.fz-grow { flex: 1 1 200px; }
.fz-kpi { display: flex; flex-direction: column; gap: 2px; padding: 0 4px 4px; }
.fz-kpi span { font-size: 12px; color: var(--muted); }
.fz-kpi b { font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fz-h { display: flex; align-items: baseline; gap: 10px; margin: 26px 0 12px; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.fz-h .muted { font-size: 13px; font-weight: 400; }
.fz-note { margin-top: 12px; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.fz-empty { padding: 26px 16px; color: var(--faint); font-size: 13.5px; text-align: center; }
.fz-link { padding: 2px 4px; border: none; background: none; color: var(--accent-ink); font-size: 13px; cursor: pointer; }
.fz-link:hover { text-decoration: underline; }
.fz-warn { color: var(--amber); font-weight: 500; }
.fz-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 12px; align-items: end; }
.fz-form .btn-primary { min-height: 42px; }
.fz-form-food { grid-template-columns: minmax(180px, 2.2fr) repeat(4, minmax(78px, 1fr)) auto; }
.fz-form-calc { margin-top: 14px; }

/* начало тренировки */
.fz-start { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-end; justify-content: space-between; }
.fz-start-text { flex: 1 1 260px; max-width: 520px; }
.fz-start-text h3 { margin-bottom: 6px; font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.fz-start-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.fz-start-form .tr-field:first-child { min-width: 240px; }
.fz-start-form .btn-primary { min-height: 42px; }

/* идущая тренировка */
.fz-session { padding: 0; overflow: hidden; }
.fz-session-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.fz-session-head h3 { font-size: 18px; font-weight: 600; letter-spacing: -.015em; }
.fz-session-head .muted { font-size: 13px; }
.fz-session-actions { display: flex; align-items: center; gap: 8px; }
.fz-session-actions .ico { width: 14px; height: 14px; }
.fz-ex { padding: 14px 20px 12px; border-bottom: 1px solid var(--line-soft); }
.fz-ex-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fz-ex-head b { font-size: 15px; font-weight: 600; }
.fz-ex-head .icon-btn { margin-left: auto; }
.fz-ex-i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--bg-beige); font-size: 12px; font-weight: 600; color: var(--muted); }
.fz-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-card); color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.fz-chip .ico { width: 13px; height: 13px; }
.fz-chip.is-btn { cursor: pointer; transition: border-color .15s ease, color .15s ease; }
.fz-chip.is-btn:hover { border-color: var(--border-strong); color: var(--text); }
.fz-chip.is-on { border-color: var(--text); background: var(--text); color: var(--bg-soft); }
.fz-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.fz-prev { margin: 6px 0 0 30px; font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.fz-sets { display: grid; gap: 6px; margin: 10px 0 4px 30px; }
.fz-set { display: flex; align-items: center; gap: 6px; }
.fz-set-n { width: 18px; font-size: 12.5px; color: var(--faint); text-align: right; font-variant-numeric: tabular-nums; }
.fz-set input {
  width: 72px; padding: 7px 9px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text);
  font: inherit; font-size: 15px; font-variant-numeric: tabular-nums; text-align: right;
  outline: none; -moz-appearance: textfield; appearance: textfield;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.fz-set input::-webkit-inner-spin-button, .fz-set input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.fz-set input::placeholder { color: var(--faint); opacity: .7; }
.fz-set input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.fz-unit { font-size: 12px; color: var(--faint); }
.fz-x { margin: 0 2px; color: var(--faint); }
.fz-tick {
  display: grid; place-items: center; width: 34px; height: 34px; margin-left: 6px;
  border: 1px solid var(--border-strong); border-radius: 50%;
  background: var(--bg-card); color: var(--faint); cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.fz-tick .ico { width: 16px; height: 16px; }
.fz-tick:hover { border-color: var(--green); color: var(--green); }
.fz-set.is-done .fz-tick { border-color: var(--green); background: var(--green); color: var(--on-accent); }
.fz-set.is-done input { border-color: color-mix(in srgb, var(--green) 45%, transparent); background: color-mix(in srgb, var(--green) 7%, transparent); }
.fz-add-set { margin: 4px 0 0 30px; padding: 4px 6px; border: none; background: none; color: var(--muted); font-size: 13px; cursor: pointer; border-radius: 6px; }
.fz-add-set:hover { background: var(--bg-hover); color: var(--text); }
.fz-add-ex { display: flex; gap: 8px; padding: 14px 20px; background: var(--bg); }
.fz-add-ex input {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-soft); color: var(--text); font: inherit; font-size: 14px; outline: none;
}
.fz-add-ex input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* история */
.fz-list { overflow: hidden; background: var(--bg-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.fz-hist { border-bottom: 1px solid var(--line-soft); }
.fz-hist:last-child { border-bottom: none; }
.fz-hist summary { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 20px; list-style: none; cursor: pointer; font-size: 14px; }
.fz-hist summary::-webkit-details-marker { display: none; }
.fz-hist summary:hover { background: var(--row-hover); }
.fz-hist summary .muted { font-size: 13px; font-variant-numeric: tabular-nums; }
.fz-hist-d { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fz-hist-body { padding: 4px 20px 16px 102px; }
.fz-hist-row { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px; }
.fz-hist-row span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.fz-hist-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* таблицы: рекорды и замеры */
.fz-table { overflow-x: auto; background: var(--bg-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.fz-tr {
  display: grid; grid-template-columns: minmax(180px, 2fr) repeat(4, minmax(90px, 1fr));
  gap: 12px; align-items: center; width: 100%; min-width: 560px; padding: 11px 20px;
  border: none; border-bottom: 1px solid var(--line-soft); background: none;
  color: var(--text); font: inherit; font-size: 13.5px; text-align: left; font-variant-numeric: tabular-nums;
}
button.fz-tr { cursor: pointer; }
button.fz-tr:hover { background: var(--row-hover); }
.fz-tr.is-on { background: var(--accent-soft); }
.fz-tr:last-child { border-bottom: none; }
.fz-th { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--bg); }
.fz-table-body .fz-tr { grid-template-columns: 110px repeat(6, minmax(64px, 1fr)) 32px; min-width: 680px; }

/* график */
.fz-chart { display: block; width: 100%; height: auto; overflow: visible; }
.fz-chart .g { stroke: var(--line-soft); stroke-width: 1; }
.fz-chart text { fill: var(--faint); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.fz-chart .yl { text-anchor: end; }
.fz-chart .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.fz-chart .area { fill: var(--accent-soft); stroke: none; }
.fz-chart circle { fill: var(--bg-soft); stroke: var(--accent); stroke-width: 2; }
.fz-chart .goal { stroke: var(--green); stroke-width: 1.5; stroke-dasharray: 5 5; }
.fz-chart .goal-t { fill: var(--green); font-weight: 600; }
.fz-chart-empty { padding: 40px 16px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--faint); font-size: 13.5px; text-align: center; }

/* тело */
.fz-cmps { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.fz-cmp { padding: 16px 20px 18px; background: var(--bg-soft); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.fz-cmp-k { font-size: 13px; font-weight: 600; }
.fz-cmp-v { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.fz-cmp-v small { display: block; margin-bottom: 2px; font-size: 12px; color: var(--muted); }
.fz-cmp-v b { font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fz-cmp-v em { margin-left: 6px; font-style: normal; font-size: 12.5px; color: var(--muted); }
.fz-cmp-v em.neg-good { color: var(--green); }
.fz-cmp-v input {
  width: 100%; max-width: 110px; padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-card); color: var(--text); font: inherit; font-size: 20px; font-weight: 600; outline: none;
  -moz-appearance: textfield; appearance: textfield;
}
.fz-cmp-v input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.fz-cmp > small { display: block; margin-top: 6px; font-size: 12px; color: var(--faint); }
.fz-verdict { margin-bottom: 16px; padding: 14px 18px; border-radius: var(--radius); background: var(--bg-beige); font-size: 14px; line-height: 1.55; }
.fz-verdict.is-good { background: color-mix(in srgb, var(--green) 10%, transparent); }
.fz-verdict.is-warn { background: color-mix(in srgb, var(--amber) 12%, transparent); }

/* питание */
.fz-daynav { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.fz-daynav b { min-width: 130px; font-size: 15px; font-weight: 600; text-align: center; }
.fz-macros { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.fz-macro { padding: 14px 18px 16px; background: var(--bg-soft); border-radius: var(--radius); box-shadow: var(--shadow); }
.fz-macro span { font-size: 12.5px; color: var(--muted); }
.fz-macro b { display: block; margin-top: 2px; font-size: 22px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fz-macro > small { display: block; margin-top: 6px; font-size: 12px; color: var(--faint); }
.fz-macro.is-ok .dash-meter i { background: var(--green); }
.fz-macro.is-over .dash-meter i { background: var(--amber); }
.fz-macro.is-over > small { color: var(--amber); }
.fz-food { margin-top: 16px; border-top: 1px solid var(--line-soft); }
.fz-food-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px minmax(150px, auto) 32px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 14px; font-variant-numeric: tabular-nums; }
.fz-food-row b { font-weight: 600; text-align: right; }
.fz-food-row .muted { font-size: 12.5px; }
.fz-week { position: relative; display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; height: 150px; padding-bottom: 20px; }
.fz-week-aim { position: absolute; left: 0; right: 0; border-top: 1.5px dashed var(--green); pointer-events: none; }
.fz-week-col { position: relative; display: flex; align-items: flex-end; justify-content: center; border: none; background: none; cursor: pointer; }
.fz-week-col i { width: 100%; max-width: 38px; border-radius: 6px 6px 2px 2px; background: var(--bg-beige); transition: background .15s ease; }
.fz-week-col:hover i { background: var(--border-strong); }
.fz-week-col.is-on i { background: var(--accent); }
.fz-week-col i.is-over { background: color-mix(in srgb, var(--amber) 55%, transparent); }
.fz-week-col span { position: absolute; bottom: -20px; font-size: 11.5px; color: var(--faint); }
.fz-calc summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; list-style: none; cursor: pointer; font-size: 14px; }
.fz-calc summary::-webkit-details-marker { display: none; }
.fz-calc summary .muted { font-size: 13px; }
.fz-calc .fz-link { margin-top: 10px; }

/* фото */
.fz-photo-top { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.fz-photo-top .fz-card-title { margin-bottom: 4px; }
.fz-photo-add { display: flex; gap: 12px; align-items: flex-end; }
.fz-photo-add .btn-primary { min-height: 42px; }
.fz-photo-add .ico { width: 15px; height: 15px; }
.fz-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fz-side { position: relative; margin: 0; overflow: hidden; border-radius: var(--radius); background: var(--bg-card); }
.fz-side img { display: block; width: 100%; height: min(62vh, 520px); object-fit: contain; }
.fz-side-l { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px; background: var(--bg-soft); box-shadow: var(--shadow-pill); font-size: 12.5px; font-weight: 600; }
.fz-side figcaption { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px; font-size: 13px; }
.fz-side figcaption span { color: var(--muted); font-variant-numeric: tabular-nums; }
.fz-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.fz-thumb { position: relative; margin: 0; overflow: hidden; border-radius: var(--radius); background: var(--bg-soft); box-shadow: var(--shadow); }
.fz-thumb.is-on { box-shadow: 0 0 0 2px var(--accent); }
.fz-thumb img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--bg-card); }
.fz-thumb figcaption { padding: 7px 10px; font-size: 12.5px; color: var(--muted); }
.fz-thumb-actions { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; opacity: 0; transition: opacity .15s ease; }
.fz-thumb:hover .fz-thumb-actions, .fz-thumb:focus-within .fz-thumb-actions { opacity: 1; }
.fz-thumb-actions button { display: grid; place-items: center; min-width: 28px; height: 26px; padding: 0 7px; border: none; border-radius: 7px; background: var(--bg-soft); box-shadow: var(--shadow-pill); color: var(--text); font-size: 12px; cursor: pointer; }
.fz-thumb-actions button:hover { background: var(--bg-hover); }
.fz-thumb-actions .ico { width: 13px; height: 13px; }
@media (hover: none) { .fz-thumb-actions { opacity: 1; } }

/* таймер отдыха — плашка внизу экрана, видна на любой вкладке */
.fz-timer {
  position: fixed; left: 50%; bottom: 22px; z-index: 900;
  width: min(460px, calc(100vw - 32px)); transform: translateX(-50%);
  overflow: hidden; border-radius: 16px;
  background: var(--grad-dark); color: var(--gray-0);
  box-shadow: var(--shadow-pill), 0 18px 40px -18px var(--ink-900);
  animation: fadeUp .25s ease both;
}
.fz-timer-bar { height: 3px; background: color-mix(in srgb, var(--gray-0) 12%, transparent); }
.fz-timer-bar i { display: block; height: 100%; background: var(--accent); transition: width .25s linear; }
.fz-timer.is-over .fz-timer-bar i { background: var(--green); }
.fz-timer-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px 12px 16px; }
.fz-timer-l { display: flex; flex-direction: column; flex: 1; min-width: 0; font-size: 12.5px; color: color-mix(in srgb, var(--gray-0) 70%, transparent); }
.fz-timer-l small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--gray-0); }
.fz-timer b { min-width: 64px; font-size: 26px; font-weight: 600; letter-spacing: -.02em; text-align: right; font-variant-numeric: tabular-nums; }
.fz-timer.is-over b { color: var(--green); }
.fz-timer button {
  display: grid; place-items: center; min-width: 38px; height: 32px; padding: 0 8px;
  border: none; border-radius: 9px; background: color-mix(in srgb, var(--gray-0) 12%, transparent);
  color: var(--gray-0); font: inherit; font-size: 13px; cursor: pointer;
}
.fz-timer button:hover { background: color-mix(in srgb, var(--gray-0) 22%, transparent); }
.fz-timer .ico { width: 14px; height: 14px; }

/* главная: вода и сон, кнопка «Начать тренировку» */
.fz-counter { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fz-counter + .fz-glasses, .fz-counter + .fz-sleep { margin-top: 10px; }
.fz-glasses + .fz-counter { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.fz-counter-t span { font-size: 12.5px; color: var(--muted); }
.fz-counter-t b { display: block; font-size: 20px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fz-counter-t small { font-size: 12.5px; font-weight: 400; color: var(--faint); }
.fz-step { display: flex; gap: 6px; }
.fz-step .icon-btn { width: 32px; height: 32px; border: 1px solid var(--border); font-size: 17px; }
.fz-glasses { display: flex; gap: 5px; }
.fz-glasses i { flex: 1; height: 20px; border-radius: 4px 4px 6px 6px; background: var(--bg-beige); cursor: pointer; transition: background .15s ease; }
.fz-glasses i.is-on { background: var(--accent); }
.fz-sleep { display: flex; align-items: flex-end; gap: 5px; height: 34px; }
.fz-sleep i { flex: 1; border-radius: 3px; background: var(--border-strong); }
.fz-sleep i.is-today { background: var(--accent); }
.fz-sleep i.is-empty { background: var(--bg-beige); }
.fz-sleep i.is-low { background: color-mix(in srgb, var(--amber) 60%, transparent); }
.fz-home-go { margin-top: 14px; }
.fz-home-done { display: flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--green); }
.fz-home-done .ico { width: 14px; height: 14px; }

@media (max-width: 700px) {
  .fz-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fz-macros { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fz-form-food { grid-template-columns: 1fr 1fr; }
  .fz-form-food .fz-grow { grid-column: 1 / -1; }
  .fz-sets, .fz-prev, .fz-add-set { margin-left: 0; }
  .fz-set input { width: 60px; }
  .fz-unit { display: none; }
  .fz-hist-body { padding-left: 20px; }
  .fz-compare { grid-template-columns: 1fr 1fr; gap: 8px; }
  .fz-side img { height: 44vh; }
  .fz-food-row { grid-template-columns: minmax(0, 1fr) auto 32px; }
  .fz-food-row .muted { grid-column: 1 / 2; }
  .fz-timer { bottom: 12px; }
}
.jr-tpl-row .icon-btn[hidden] { display: none; }

/* ============================================
   БЮДЖЕТ: ЛИМИТЫ, ПОДПИСКИ, ЦЕЛИ, КАПИТАЛ, ЧЕКИ, ИМПОРТ
   ============================================ */

/* предупреждения над таблицей и на главной: лимит почти исчерпан, скоро списание */
.budget-alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.budget-alerts[hidden] { display: none; }
.b-alert {
  --c: var(--amber);
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--c) 9%, transparent);
  color: color-mix(in srgb, var(--c) 70%, var(--text));
  font-size: 13.5px; font-weight: 500;
}
.b-alert .ico { flex: none; width: 16px; height: 16px; }
.b-alert.is-over { --c: var(--red); }
.b-alert.is-info { --c: var(--accent); }
.dash-card .b-alert { margin-top: 8px; padding: 8px 12px; font-size: 12.5px; }

/* полоса в ячейке: «использовано» у лимитов, прогресс у целей */
.meter-cell { display: flex; align-items: center; gap: 10px; }
.meter-cell .meter { flex: 1; height: 6px; border-radius: 999px; background: var(--bg-beige); overflow: hidden; }
.meter-cell .meter i { display: block; height: 100%; border-radius: inherit; background: var(--text); transition: width .3s ease; }
.meter-cell b { min-width: 40px; font-size: 12.5px; font-weight: 600; text-align: right; }
.meter-cell.is-goal .meter i { background: var(--accent); }
.meter-cell.is-done .meter i, .meter-cell.is-done b { background: var(--green); color: var(--green); }
.meter-cell.is-done b { background: none; }
.meter-cell.is-warn .meter i { background: var(--amber); }
.meter-cell.is-warn b { color: var(--amber); }
.meter-cell.is-over .meter i { background: var(--red); }
.meter-cell.is-over b { color: var(--red); }

/* колонка «Чек» */
.grid td.rcpt { text-align: center; }
.rcpt-btn {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px;
  border: 1px solid transparent; border-radius: 8px;
  background: none; color: var(--faint); cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.rcpt-btn:hover { background: var(--bg-hover); color: var(--text); }
.rcpt-btn.has { color: var(--accent); background: var(--accent-soft); }
.rcpt-btn .ico { width: 16px; height: 16px; }
.rcpt-view img { display: block; max-width: 100%; max-height: 62vh; margin: 12px auto; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.rcpt-view .jr-form-foot { justify-content: space-between; }
.rcpt-view .btn-ghost { display: inline-flex; align-items: center; gap: 6px; }
.goal-hint { font-size: 12px; margin-top: -4px; }

/* график «Чистый капитал» */
.nw-card { margin-bottom: 18px; padding: 18px 20px 14px; border-radius: var(--radius-lg); background: var(--bg-soft); box-shadow: var(--shadow); }
.nw-card[hidden] { display: none; }
.nw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.nw-head h2 { font-size: 17px; font-weight: 600; }
.nw-head p { font-size: 12.5px; margin-top: 2px; }
.nw-now { font-size: 24px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nw-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 12px 0 4px; font-size: 12px; color: var(--muted); }
.nw-legend span { display: inline-flex; align-items: center; gap: 6px; }
.nw-sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.nw-sw.nw-a { background: color-mix(in srgb, var(--green) 70%, transparent); }
.nw-sw.nw-d { background: color-mix(in srgb, var(--red) 65%, transparent); }
.nw-sw.nw-l { height: 2px; border-radius: 1px; background: var(--text); }
.nw-scroll { overflow-x: auto; }
.nw-svg { display: block; width: 100%; min-width: 520px; height: auto; }
.nw-svg text { font-size: 11px; fill: var(--faint); font-family: var(--font); }
.nw-y { text-anchor: end; }
.nw-x { text-anchor: middle; }
.nw-x.is-now { fill: var(--text); font-weight: 600; }
.nw-grid { stroke: var(--line-soft); stroke-width: 1; }
.nw-grid.is-zero { stroke: var(--border-strong); }
.nw-hit { fill: transparent; }
g:hover > .nw-hit { fill: var(--row-hover); }
rect.nw-a { fill: color-mix(in srgb, var(--green) 70%, transparent); }
rect.nw-d { fill: color-mix(in srgb, var(--red) 65%, transparent); }
.is-est rect.nw-a, .is-est rect.nw-d { opacity: .38; }
.nw-line { fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; }
.nw-dot { fill: var(--bg-soft); stroke: var(--text); stroke-width: 2; }
.nw-dot.is-est { stroke: var(--faint); }
.nw-parts { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-top: 12px; margin-top: 6px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--muted); }
.nw-part { display: inline-flex; align-items: center; gap: 6px; }
.nw-part b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.nw-empty { font-size: 13px; padding-top: 8px; }

/* окно импорта выписки */
.csv-modal .modal-box { width: min(920px, 100%); }
.csv-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.csv-map .cell { background-color: var(--bg-card); border-color: var(--border); }
.csv-check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }
.csv-check[hidden] { display: none !important; }
.csv-stat { font-size: 13px; color: var(--text); }
.csv-list { max-height: 46vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.csv-list:empty { display: none; }
.csv-table { min-width: 620px; font-size: 13px; }
.csv-table th { position: sticky; top: 0; z-index: 1; background: var(--bg-soft); }
.csv-table td { padding: 4px 8px; }
.csv-table tr.is-off td { opacity: .45; }
.csv-note { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.csv-dup { margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--bg-beige); color: var(--muted); font-size: 11px; }
.csv-table select.cell { padding: 5px 8px; }
.btn-primary:disabled { opacity: .45; cursor: default; }
