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

/* ============================================
   ПАЛИТРА «ЛЕС» — зелёная гамма из шести цветов:
   #051F20 · #0B2B26 · #163832 · #235347 · #8EB69B · #DAF1DE
   Светлая тема «Мята» — светло-зелёный фон и тёмно-зелёный текст,
   тёмная «Лес» — глубокий зелёный фон и мятный текст.
   Всё остальное в файле берёт цвета отсюда
   ============================================ */
:root {
  color-scheme: light;

  --bg:         #edf6ef;   /* мятный фон страницы */
  --bg-soft:    #fafdfb;   /* основные карточки */
  --bg-card:    #f2f9f4;   /* вложенные элементы: карточки задач, поля */
  --bg-hover:   #e2efe5;
  --bg-beige:   #daf1de;   /* светло-зелёные плашки */
  --text:       #051f20;   /* самый тёмный зелёный */
  --muted:      #4a6b62;
  --border:     #d3e6d8;

  --border-strong: #b5d2bd;
  --line-soft:     #e6f1e9;
  --row-hover:     #f0f8f2;
  --faint:         #86a597;
  --header-bg:     rgba(237, 246, 239, .72);
  --pill-bg:       #fafdfb;   /* парящая шапка-таблетка */

  --gray:   #86a095;
  --blue:   #5f86b0;
  --amber:  #c9973f;
  --green:  #3e8a64;
  --red:    #c25b44;

  --radius-lg: 26px;   /* крупные блоки: герой, карточки главной */
  --radius:    18px;
  --radius-sm: 12px;
  --font: "Inter", -apple-system, "SF Pro Text", system-ui, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 12px 34px rgba(5, 31, 32, .08);
  --shadow-pill: 0 6px 24px rgba(5, 31, 32, .07);

  /* акцент по умолчанию — «Лес» #235347 */
  --accent:     #235347;
  --accent-2:   #163832;
  --accent-ink: color-mix(in srgb, var(--accent) 82%, var(--text));
  --accent-ring: color-mix(in srgb, var(--accent) 24%, transparent);
  --on-accent:  #ffffff;   /* текст на кнопках цвета акцента */

  /* готовые подложки для крупных карточек */
  --grad-tan:   linear-gradient(155deg, #8eb69b 0%, #235347 100%);
  --grad-beige: linear-gradient(165deg, #eaf6ec 0%, #d2ead7 100%);
  --grad-dark:  linear-gradient(170deg, #163832 0%, #051f20 100%);
  --grad-photo: linear-gradient(135deg, #235347 0%, #0b2b26 55%, #051f20 100%);
}

/* ТЁМНАЯ ТЕМА «ЛЕС» — те же шесть цветов, от тёмного к светлому */
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:         #051f20;
  --bg-soft:    #0b2b26;
  --bg-card:    #0f332d;
  --bg-hover:   #163832;
  --bg-beige:   #123630;
  --text:       #daf1de;
  --muted:      #8eb69b;
  --border:     #1b4239;

  --border-strong: #2b5a4d;
  --line-soft:     #0f332d;
  --row-hover:     #0e302a;
  --faint:         #5e8573;
  --header-bg:     rgba(5, 31, 32, .72);
  --pill-bg:       #0b2b26;

  --gray:   #6f8c80;
  --blue:   #8aa6c4;
  --amber:  #d6a45a;
  --green:  #8eb69b;
  --red:    #e07a62;

  --shadow: 0 12px 34px rgba(0, 0, 0, .4);
  --shadow-pill: 0 6px 24px rgba(0, 0, 0, .35);

  --accent:     #8eb69b;
  --accent-2:   #daf1de;
  --on-accent:  #051f20;

  --grad-tan:   linear-gradient(155deg, #235347 0%, #163832 100%);
  --grad-beige: linear-gradient(165deg, #0f332d 0%, #0b2b26 100%);
  --grad-dark:  linear-gradient(170deg, #163832 0%, #031516 100%);
}

/* ЦВЕТ АКЦЕНТА («Лес» — по умолчанию, остальные на выбор) */
:root[data-accent="bronze"] { --accent: #a38a6d; --accent-2: #bda285; }
:root[data-accent="olive"]  { --accent: #7d8a5a; --accent-2: #9aa876; }
:root[data-accent="clay"]   { --accent: #b86a4b; --accent-2: #d08a6c; }
:root[data-accent="slate"]  { --accent: #5f7a92; --accent-2: #7e98ae; }
:root[data-accent="cocoa"]  { --accent: #6e5242; --accent-2: #8f6f5c; }

/* КОМПАКТНЫЙ РЕЖИМ — плотнее отступы, больше влезает на экран */
: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; }

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; }

/* ---------- ШАПКА: ПАРЯЩАЯ ТАБЛЕТКА ---------- */
/* Сама полоса прозрачная — видна только белая таблетка внутри,
   как навигация в макете. При прокрутке под ней мягко размывается фон */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 14px 20px 6px;
  background: linear-gradient(var(--bg) 55%, transparent);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 8px 8px 18px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: nowrap;
  background: var(--pill-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-pill);
}

/* логотип — кнопка возврата на главную: строчное слово, как «compatto» */
.logo {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -.02em;
  text-decoration: none;
  white-space: nowrap;
}

.logo-mark {
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;              /* скруглённый квадрат — как у иконки приложения */
  background: #1f4a45 url(img/logo.png) center / cover no-repeat;
  box-shadow: 0 1px 3px rgba(5, 31, 32, .25);
  transition: transform .2s ease, box-shadow .2s ease;
}
.logo:hover .logo-mark { transform: rotate(-10deg) scale(1.06); }
.logo.is-active .logo-mark { box-shadow: 0 0 0 3px var(--accent-ring); }

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

/* путь к папке в настройках */
.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;
}

/* ---------- ГЛАВНАЯ ---------- */

/* слово-акцент в заголовках: «Who We Are», «How We Simplify» */
.accent-word { color: var(--accent); }

.section-title {
  font-size: clamp(26px, 3.4vw, 36px);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.15;
  margin-bottom: 22px;
}

/* ГЕРОЙ: большой скруглённый блок с фото и текстом поверх.
   Фото подставляется через --photo; пока его нет — тёплый градиент */
.hero {
  position: relative;
  min-height: clamp(320px, 40vw, 470px);
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  align-items: end;
  gap: 28px;
  padding: clamp(24px, 4.2vw, 56px);
  margin-bottom: 18px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(ellipse 55% 60% at 78% 88%, rgba(5, 31, 32, .55), transparent 70%),
    linear-gradient(180deg, rgba(5, 31, 32, 0) 22%, rgba(5, 31, 32, .66) 100%),
    var(--photo, none) var(--photo-pos, center) / cover no-repeat,
    var(--grad-photo);
}
/* светлые места фото не должны съедать текст */
.hero h1, .hero-side p { text-shadow: 0 1px 14px rgba(3, 20, 21, .45); }

.hero h1 {
  font-size: clamp(30px, 4.4vw, 54px);
  font-weight: 500;
  letter-spacing: -.035em;
  /* сжатие букв съедает и пробелы — на телефоне слова слипались */
  word-spacing: .1em;
  line-height: 1.06;
  text-wrap: balance;
}
.hero .accent-word { color: #dcc6a8; }

.hero-side { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.hero-side p { font-size: 14px; line-height: 1.6; opacity: .92; max-width: 44ch; text-wrap: pretty; }

.btn-light {
  padding: 10px 18px;
  border: none;
  border-radius: 9px;
  background: #fff;
  color: #051f20;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.btn-light:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }

/* ЦИФРЫ + ОПИСАНИЕ — две карточки рядом */
.home-duo {
  display: grid;
  grid-template-columns: minmax(250px, .9fr) 2fr;
  gap: 18px;
  margin-bottom: 64px;
}

.stat-card {
  position: relative;
  min-height: 230px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--grad-tan);
  color: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stat-kicker { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; opacity: .85; line-height: 1.4; }
.stat-card .swirl { position: absolute; top: 18px; right: 20px; }

.stat-nums { display: flex; align-items: flex-end; gap: 28px; }
.stat-nums b { display: block; font-weight: 400; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-nums .big b { font-size: 46px; }
.stat-nums .small b { font-size: 22px; }
.stat-nums span { display: block; margin-top: 6px; font-size: 12px; opacity: .9; }
.stat-nums .small span { font-size: 10px; max-width: 12ch; line-height: 1.3; }

/* декоративный «мраморный завиток» из макета — нарисован CSS */
.swirl {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: repeating-radial-gradient(circle at 18% 120%,
    rgba(255, 255, 255, .92) 0 6px, rgba(255, 255, 255, .12) 6px 13px);
  transform: rotate(-24deg);
  opacity: .9;
}

.about-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 38%;
  min-height: 230px;
  border-radius: var(--radius);
  background: var(--bg-beige);
  overflow: hidden;
}
.about-text { padding: 26px 28px 20px; display: flex; flex-direction: column; min-width: 0; }
.about-text h2 { font-size: 24px; font-weight: 500; letter-spacing: -.02em; margin-bottom: 8px; }

/* фото справа, срезанное большой дугой, как в «Who We Are» */
.about-photo {
  background: var(--photo, none) var(--photo-pos, center) / cover no-repeat, var(--grad-photo);
  clip-path: circle(88% at 100% 50%);
}

/* панель оформления — тихая, внутри бежевой карточки */
.note-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: wrap;
  margin: 0 0 6px -6px;
}
.note-tools button {
  min-width: 28px;
  height: 26px;
  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); }
.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); }

/* РАЗДЕЛЫ — сетка разных карточек, как «Why Choose Compatto» */
.bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-areas:
    "backlog  budget   tracker"
    "calendar kb       tracker"
    "journal  training training";
  gap: 14px;
}

.bento-card {
  position: relative;
  min-height: 190px;
  padding: 24px;
  border: none;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-align: center;
  color: var(--text);
  cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease;
}
.bento-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.bento-card h3 { font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.bento-card p { font-size: 12.5px; line-height: 1.55; color: var(--muted); max-width: 30ch; }
.bento-card .nav-stat {
  margin-top: auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 6%, transparent);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}
/* завиток выглядывает снизу из-под карточки, подпись с цифрами — поверх него */
.bento-card .swirl { position: absolute; bottom: -46px; left: 50%; margin-left: -44px; width: 88px; height: 88px; opacity: .55; }
.bento-card .nav-stat { position: relative; z-index: 1; }
.bento-card.is-beige .nav-stat { background: color-mix(in srgb, var(--bg-soft) 78%, transparent); }

.bento-card.is-beige { background: var(--grad-beige); }
.bento-card.is-beige .swirl {
  background: repeating-radial-gradient(circle at 18% 120%, #8f7358 0 6px, rgba(35, 83, 71, .15) 6px 13px);
}

.bento-card.is-dark {
  background: var(--grad-dark);
  color: #daf1de;
  justify-content: space-between;
  align-items: stretch;
}
.bento-card.is-dark h3 { font-size: 22px; margin-top: 18px; }
.bento-card.is-dark p { color: rgba(218, 241, 222, .7); margin: 0 auto; }
.bento-card.is-dark .bento-foot { text-align: left; }
.bento-card.is-dark .bento-foot b { display: block; font-size: 14px; font-weight: 500; margin-bottom: 4px; }
.bento-card.is-dark .nav-stat { background: rgba(255, 255, 255, .12); color: #8eb69b; }

.bento-card.is-photo {
  justify-content: flex-end;
  color: #fff;
  background:
    linear-gradient(180deg, rgba(5, 31, 32, .05) 10%, rgba(5, 31, 32, .55) 48%, rgba(5, 31, 32, .86) 100%),
    var(--photo, none) var(--photo-pos, center) / cover no-repeat,
    var(--grad-photo);
}
.bento-card.is-photo p { color: rgba(255, 255, 255, .86); }
.bento-card.is-photo h3, .bento-card.is-photo p { text-shadow: 0 1px 10px rgba(3, 20, 21, .55); }
.bento-card.is-photo .nav-stat { background: rgba(255, 255, 255, .16); color: #fff; margin-top: 6px; }

.bento-card[data-go-tab="backlog"]  { grid-area: backlog; }
.bento-card[data-go-tab="budget"]   { grid-area: budget; }
.bento-card[data-go-tab="tracker"]  { grid-area: tracker; }
.bento-card[data-go-tab="calendar"] { grid-area: calendar; }
.bento-card[data-go-tab="kb"]       { grid-area: kb; }
.bento-card[data-go-tab="training"] { grid-area: training; }
.bento-card[data-go-tab="journal"]  { grid-area: journal; }

/* широкая бронзовая карточка «Тренировки» внизу сетки — крупная цифра как «150+» в макете */
.bento-card.is-tan {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 150px;
  padding: 26px 32px;
  text-align: left;
  color: #fff;
  background: var(--grad-tan);
}
.bento-card.is-tan .tan-text { display: flex; flex-direction: column; align-items: flex-start; gap: 7px; }
.bento-card.is-tan h3 { font-size: 22px; }
.bento-card.is-tan p { color: rgba(255, 255, 255, .84); max-width: 52ch; }
.bento-card.is-tan .nav-stat { margin-top: 6px; background: rgba(255, 255, 255, .2); color: #fff; }
.tan-num { display: flex; align-items: baseline; gap: 10px; flex: none; }
.tan-num b { font-size: clamp(64px, 8vw, 104px); font-weight: 300; line-height: .9; letter-spacing: -.05em; color: rgba(255, 255, 255, .92); }
.tan-num span { font-size: 12px; line-height: 1.3; color: rgba(255, 255, 255, .8); max-width: 9ch; }

/* ---------- ВКЛАДКИ ---------- */
/* ссылки в таблетке — мелкие и спокойные, как «Who we are · Our process»;
   выбранная получает мягкую бежевую подложку */
.tabs {
  display: flex;
  gap: 2px;
  /* 0 1 auto + min-width: 0 — вкладки не растягиваются, но умеют сжиматься
     и прокручиваться внутри себя, поэтому шестерёнка не съезжает на вторую строку */
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: 8px 14px;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 13.5px;
  font-weight: 450;
  transition: background .18s ease, color .18s ease;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  background: var(--bg-beige);
  color: var(--text);
  font-weight: 500;
}

/* ---------- НАСТРОЙКИ: кнопка-пилюля справа, как «Contact us» ---------- */
.gear {
  margin-left: auto;          /* прижимает кнопку к правому краю шапки */
  height: 38px;
  padding: 0 16px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.gear:hover { background: color-mix(in srgb, var(--accent) 86%, #000); }
.gear svg { transition: transform .4s ease; }
.gear:hover svg { transform: rotate(60deg); }

/* ---------- ОКНО НАСТРОЕК ---------- */
.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, .55);
  backdrop-filter: blur(3px);
  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);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  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: 18px; letter-spacing: -.01em; }

.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: 600; }
.set-label span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* переключатель из нескольких кнопок */
.seg {
  display: flex;
  gap: 2px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.seg button {
  padding: 6px 13px;
  border: none;
  background: none;
  color: var(--muted);
  border-radius: 7px;
  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(--accent); color: var(--on-accent); font-weight: 500; }

/* кружки с цветами акцента */
.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 {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 20px 72px;
}

.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(28px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.1;
  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: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
}

.btn-ghost {
  padding: 7px 14px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 9px;
  cursor: pointer;
  font-size: 13px;
  transition: all .18s ease;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); background: var(--bg-soft); }
.btn-ghost.danger:hover { color: var(--red); border-color: rgba(239, 68, 68, .5); background: rgba(239, 68, 68, .08); }

/* ---------- ДОСКА ---------- */
.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;
  text-transform: uppercase;
  letter-spacing: .04em;
  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: rgba(239, 68, 68, .4);  background: rgba(239, 68, 68, .1); }
.chip.soon { color: var(--amber); border-color: rgba(245, 158, 11, .4); background: rgba(245, 158, 11, .1); }

/* панель «даты и приоритет» внутри карточки */
/* без этой строки 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: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  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: rgba(239, 68, 68, .15); 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: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  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; }

.btn-primary {
  padding: 6px 14px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s ease;
}
.btn-primary:hover { background: var(--accent-2); }

.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: 15px;
  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: 600; }
.subtab.is-active::after { background: var(--accent); }

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

.summary-item {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  min-width: 150px;
}
.summary-item span {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.summary-item strong {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.pos { color: var(--green); }
.neg { color: var(--red); }

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

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

.grid th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  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: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.grid tfoot .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  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-card); }
.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;
}

.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: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  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: rgba(34, 197, 94, .35); }
.badge.fire { color: var(--amber); border-color: rgba(245, 158, 11, .35); }

/* форма добавления привычки */
.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-card); }
.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: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 16px;
}

/* палитра диаграмм */
.chart-card {
  --ch1: var(--accent);
  --ch2: #7d8a5a;
  --ch3: #c08a3e;
  --ch4: #b86a4b;
  --ch5: #6e5242;
  --ch6: #8aa09a;
  --ch7: #d4b48c;
  --ch8: #5f7a92;
}

/* круговая (бублик) */
.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: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

.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: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  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: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  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: rgba(239, 68, 68, .12); }

.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: 16px;
  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: 20px; height: 20px; font-size: 11px; }

.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: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  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: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  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: #daf1de; }
.tr-phase:last-child .wk { color: #8eb69b; }
.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: 11px; text-transform: uppercase; letter-spacing: .08em; 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: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; 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: 11px; text-transform: uppercase; letter-spacing: .07em; 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: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; 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 { font-size: 26px; line-height: 1; }
.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(--grad-dark);
  color: #daf1de;
  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: linear-gradient(170deg, #9c4636 0%, #6e2c20 100%); }

.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; }
  .home-duo { grid-template-columns: 1fr; }
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "backlog  budget"
      "tracker  calendar"
      "tracker  kb"
      "journal  journal"
      "training training";
  }
  .gear-label { display: none; }
  .gear { width: 38px; padding: 0; justify-content: center; }
}

@media (max-width: 620px) {
  .header { padding: 10px 12px 4px; }
  /* таблетка превращается в карточку: логотип и настройки сверху, вкладки строкой ниже */
  .header-inner { gap: 10px; padding: 10px 10px 8px 14px; flex-wrap: wrap; border-radius: 22px; }
  .gear { order: 1; }
  .tabs { order: 2; width: 100%; margin: 0; }
  :root[data-native="1"] .header { padding-left: 12px; padding-top: 34px; }
  .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; }
  .hero { grid-template-columns: 1fr; min-height: 380px; gap: 18px; }
  .home-duo { margin-bottom: 44px; }
  .about-card { grid-template-columns: 1fr; }
  .about-photo { display: none; }
  .bento {
    grid-template-columns: 1fr;
    grid-template-areas: "backlog" "budget" "tracker" "calendar" "kb" "journal" "training";
  }
  .bento-card.is-tan { flex-direction: column; align-items: flex-start; padding: 24px; }
  .bento-card.is-dark { min-height: 240px; }
  .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 (радиус) проставляет скрипт,
   прозрачность и сдвиги текста — тоже он, покадрово
   ============================================ */
/* пока идёт заставка, полосы прокрутки не видно (класс ставит и снимает splash.js) */
html.splash-on { overflow: hidden; }

#splash {
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow: hidden;
  cursor: pointer;
  color: #daf1de;
  /* тёмно-зелёный фон со светом из левого верхнего угла — как на картинке с палитрой */
  background:
    radial-gradient(55% 45% at 12% 0%, rgba(218, 241, 222, .28) 0%, rgba(142, 182, 155, .08) 45%, transparent 70%),
    radial-gradient(120% 100% at 50% 45%, #163832 0%, #0b2b26 55%, #051f20 100%);
}
.splash-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.splash-brand {
  position: absolute;
  top: 26px;
  left: 30px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  opacity: 0;
}
:root[data-native="1"] .splash-brand { top: 46px; }   /* в приложении сверху кнопки окна */

/* текст слева от кольца: заглавные + курсив, как «START seeing DIFFERENTLY» */
.splash-copy {
  position: absolute;
  top: var(--cy);
  right: calc(100% - var(--cx) + var(--R) * 1.72);   /* левее кончиков лучей */
  transform: translateY(-50%);
  font-size: clamp(16px, 1.9vw, 24px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: .02em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
}
.splash-copy em {
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  color: #8eb69b;
}
.splash-mark {
  position: absolute;
  top: var(--cy);
  left: calc(var(--cx) + var(--R) * 1.8);
  transform: translateY(-50%);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  letter-spacing: .1em;
  opacity: 0;
}

/* узкий экран: текст под кольцом, «( B )» прячем */
#splash.is-narrow .splash-copy {
  right: 0;
  left: 0;
  top: calc(var(--cy) + var(--R) * 1.65);
  transform: none;
  text-align: center;
}
#splash.is-narrow .splash-mark { display: none; }

/* ============================================
   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: 10.5px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  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: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; 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: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.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: 11.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; }
.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: #c2412d; }
.p-high    { --p: #d9674a; }
.p-medium  { --p: #c08a3e; }
.p-low     { --p: #5f86b0; }
.p-lowest  { --p: #8aa6c4; }

@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; }
.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: 22px; height: 22px; 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: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.jn-list-acts { display: flex; gap: 4px; }
.jn-list-acts .btn-ghost { padding: 4px 9px; font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.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 { font-size: 44px; }
.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: 3px; font-size: 10px; font-style: normal; }

.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: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; 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(218, 241, 222, .22) 0%, transparent 70%),
    radial-gradient(120% 100% at 50% 40%, #163832 0%, #0b2b26 55%, #051f20 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: #0b2b26;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  color: #daf1de;
  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 {
  display: grid;
  place-items: center;
  flex: none;
  margin-left: 6px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  transition: box-shadow .15s ease;
}
.me-btn:hover { box-shadow: 0 0 0 3px var(--accent-ring); }

.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-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: #3fbf7f; }

.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: 11px; font-weight: 600; letter-spacing: .05em; text-align: left; text-transform: uppercase; }
.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(--red);
  color: #fff;
  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: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; 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: #3fbf7f; }

/* ---------- переписка ---------- */
.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 { font-size: 22px; }
.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 { font-size: 46px; }
.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: #031516; }
.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 {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  margin-left: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.notify-btn:hover { box-shadow: 0 0 0 3px var(--accent-ring); }
.notify-btn.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.notify-btn + .gear { margin-left: 8px; }
.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(--bg);
  border-radius: 999px;
  background: var(--red);
  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; letter-spacing: .06em; text-transform: uppercase; 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; font-size: 14px; font-style: normal; line-height: 1; }
.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 { margin-bottom: 8px; font-size: 32px; }
.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, #c9973f); 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: #b07a22; }
.jr-assign.is-ok { color: #3f8a5c; }

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