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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #222;
  --border: #2a2a2a;
  --text: #e8e8e8;
  --muted: #888;
  --done: #4ade80;
  --active: #60a5fa;
  --planned: #f59e0b;
  --accent: #7c6af7;
  --sidebar-w: 260px;
  /* Notion-подобные токены компонентов */
  --n-blue: #2383e2;
  --n-blue-hover: #1a75cf;
  --n-ring: rgba(35, 131, 226, 0.35);
  --n-hover: rgba(255, 255, 255, 0.055);
  --n-border: rgba(255, 255, 255, 0.09);
  --n-panel: #252525;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Layout ── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Hamburger ── */
#hamburger {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 18px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ── Sidebar ── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-header {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}

.logo {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ── Navigation ── */
#nav {
  padding: 10px 0 20px;
}

.nav-section {
  margin-bottom: 2px;
}

.nav-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  border-radius: 6px;
  margin: 0 6px;
  transition: background 0.15s;
  user-select: none;
}

.nav-section-header:hover {
  background: rgba(255,255,255,0.05);
}

.nav-section-header.active {
  background: rgba(124,106,247,0.15);
  color: var(--accent);
}

.nav-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.nav-title {
  flex: 1;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
}

.nav-chevron {
  font-size: 10px;
  color: var(--muted);
  transition: transform 0.2s;
}

.nav-section.open > .nav-section-header .nav-chevron {
  transform: rotate(90deg);
}

.nav-children {
  display: none;
  padding: 2px 0 4px;
}

.nav-section.open .nav-children {
  display: block;
}

.nav-child {
  display: block;
  padding: 5px 16px 5px 40px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  border-radius: 5px;
  margin: 0 6px;
  white-space: normal;
  overflow-wrap: break-word;
  line-height: 1.35;
  transition: background 0.12s, color 0.12s;
  user-select: none;
}

.nav-child:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text);
}

.nav-child.active {
  background: rgba(124,106,247,0.12);
  color: var(--accent);
}

/* Документ с собственным паролем, пока не разблокирован */
.nav-child-lock {
  font-size: 10px;
  opacity: 0.55;
  margin-left: 4px;
}

.nav-leaf {
  /* top-level item with no children */
}

/* Хвост сайдбара (Архив) — вне смысловых групп, отбит чертой */
.nav-tail {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.nav-tail .nav-section-header {
  color: var(--muted);
}

/* Заголовок группы разделов — задаёт смысловые блоки сайдбара */
.nav-group-label {
  padding: 0 16px 6px;
  margin-top: 16px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.75;
  user-select: none;
}

#nav > .nav-group-label:first-child,
.space-switcher + .nav-group-label {
  margin-top: 4px;
}

/* Выделенный пункт меню (Kanban) — рабочая доска.
   Залитая кнопка-действие: отличается и от тайлов пространств (обводка),
   и от строк разделов (плоские), поэтому не читается как четвёртое пространство. */
.nav-featured {
  margin: 2px 0 6px;
}

.nav-featured .nav-section-header {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  padding: 9px 14px;
  border-radius: 8px;
  box-shadow: 0 1px 6px rgba(124,106,247,0.35);
}

.nav-featured .nav-section-header:hover {
  background: #8b7bf8;
}

.nav-featured .nav-section-header.active {
  background: #6a56f0;
  color: #fff;
}

/* ── Content ── */
#content {
  flex: 1;
  overflow-y: auto;
  height: 100vh;
}

#page {
  max-width: 860px;
  margin: 0 auto;
  padding: 44px 48px 80px;
}

/* ── Markdown styles ── */
#page h1 { font-size: 26px; font-weight: 700; margin-bottom: 20px; line-height: 1.3; }
#page h2 { font-size: 20px; font-weight: 600; margin: 32px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
#page h3 { font-size: 16px; font-weight: 600; margin: 24px 0 10px; }
#page h4 { font-size: 14px; font-weight: 600; margin: 20px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

#page p { margin-bottom: 14px; font-size: 14.5px; line-height: 1.75; }

#page ul, #page ol {
  margin: 10px 0 16px 20px;
}
#page li { margin-bottom: 5px; font-size: 14.5px; line-height: 1.7; }

#page blockquote {
  border-left: 3px solid var(--accent);
  padding: 10px 16px;
  margin: 16px 0;
  background: rgba(124,106,247,0.07);
  border-radius: 0 6px 6px 0;
  color: #ccc;
  font-size: 14px;
}

#page code {
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: #e0c97a;
}

#page pre {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 16px 0;
}

#page pre code {
  background: none;
  padding: 0;
  font-size: 13px;
  color: var(--text);
}

#page table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 13.5px;
}

#page th {
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

#page td {
  border: 1px solid var(--border);
  padding: 8px 12px;
  vertical-align: top;
}

#page tr:nth-child(even) td { background: rgba(255,255,255,0.02); }

#page hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 28px 0;
}

#page a { color: var(--active); text-decoration: none; }
#page a:hover { text-decoration: underline; }

#page img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
#page img.zoomable { cursor: zoom-in; }
#page img.zoomable:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ── Просмотр картинки в полный размер (initImageZoom в app.js) ── */
.img-zoom {
  position: fixed; inset: 0; z-index: 3000;
  background: rgba(0, 0, 0, 0.88);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 48px 24px 24px;
  cursor: zoom-out;
}
.img-zoom img {
  max-width: 100%; max-height: calc(100vh - 120px);
  object-fit: contain; border-radius: 8px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.img-zoom-caption { color: var(--muted); font-size: 14px; text-align: center; max-width: 900px; }
.img-zoom-close {
  position: absolute; top: 12px; right: 16px;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--n-border); background: var(--surface2); color: var(--text);
  font-size: 24px; line-height: 1; cursor: pointer;
}
.img-zoom-close:hover { background: var(--surface); }
.img-zoom-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── Галерея изображений в markdown-страницах ── */
#page .gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 0 24px;
}
#page .gallery img {
  width: 100%;
  height: 220px;
  object-fit: cover;
  object-position: top;
  margin: 0;
  display: block;
  border: 1px solid var(--border);
  transition: transform 0.15s ease;
}
#page .gallery a:hover img { transform: scale(1.02); }

/* Модификатор для концептов персонажей: фигура показывается целиком,
   без кропа по грудь — иначе по плитке не оценить силуэт и позу. */
#page .gallery--full { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
#page .gallery--full img {
  height: 380px;
  object-fit: contain;
  object-position: center;
  background: #141414;
  border-radius: 8px 8px 0 0;
  border-bottom: 0;
}
/* ── Сравнение интерфейса «было / стало» и ряды экранов ──
   Галерея выше кропает плитки под фиксированную высоту — для скриншотов
   интерфейса это съедает содержимое, поэтому кадр показывается целиком. */
#page .compare,
#page .shots {
  display: grid;
  gap: 14px;
  margin: 14px 0 26px;
}
#page .compare { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
#page .shots { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
#page .compare figure,
#page .shots figure { margin: 0; }
#page .compare img,
#page .shots img {
  width: 100%;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
}
#page .compare figcaption,
#page .shots figcaption {
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  padding: 6px 2px 0;
}

/* Плитка концепта с подписью: по номеру на неё можно сослаться в решении */
#page .ref-item { display: block; }
#page .ref-tile { display: block; }
#page .ref-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--muted);
}
#page .gallery a:hover.ref-tile img { transform: none; }
#page .ref-item:hover .ref-caption { color: var(--text); }

/* ── Фиксация решений на созвоне ── */
#page .decision-pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  padding: 3px 8px;
  border: 1px solid var(--n-border);
  border-radius: 6px;
  font-size: 0.8rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
#page .decision-pick input { accent-color: var(--done); margin: 0; cursor: pointer; }
#page .decision-pick:hover { border-color: var(--done); color: var(--text); }
#page .is-picked { outline: 2px solid var(--done); outline-offset: 0; border-radius: 10px; }
#page .is-picked .decision-pick { border-color: var(--done); color: var(--done); }

/* ── Режим согласования: вердикт по каждой модели ──
   Здесь решение бинарное («Согласовано» / «Не согласовано»), а не выбор
   лучшего варианта из нескольких, поэтому вместо галки — пара кнопок,
   а отказ раскрывает поле причины: без причины подрядчику нечего делать. */
#page .decision-verdict {
  display: flex;
  gap: 6px;
  flex: none;
  width: 100%;
  margin-top: 8px;
}
#page .decision-verdict button {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid var(--n-border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}
#page .decision-verdict button:hover { border-color: var(--muted); color: var(--text); }
#page .verdict-yes[aria-pressed="true"] {
  border-color: var(--done);
  color: #0f2a19;
  background: var(--done);
}
#page .verdict-no[aria-pressed="true"] {
  border-color: #f87171;
  color: #2a1010;
  background: #f87171;
}
#page .decision-note {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  resize: vertical;
}
#page .decision-note:focus { outline: none; border-color: #f87171; box-shadow: 0 0 0 3px rgba(248,113,113,0.25); }
#page .decision-note[hidden] { display: none; }
#page .is-approved { outline: 2px solid var(--done); outline-offset: 0; border-radius: 10px; }
#page .is-rejected { outline: 2px solid #f87171; outline-offset: 0; border-radius: 10px; }
/* Подпись карточки в этом режиме — колонка: название, кнопки, причина */
#page .model-grid[data-decision-mode="approve"] .model-caption { display: block; }

#page .decision-panel { margin: -12px 0 28px; }
#page .decision-comment {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  resize: vertical;
}
#page .decision-comment:focus { outline: none; border-color: var(--n-blue); box-shadow: 0 0 0 3px var(--n-ring); }
#page .decision-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}
#page .decision-none {
  padding: 6px 12px;
  border: 1px solid var(--n-border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
#page .decision-none:hover { border-color: var(--planned); color: var(--text); }
#page .decision-status { font-size: 0.8rem; color: var(--muted); }

/* ── 3D-модели на странице референсов ──
   Карточка = вьюер + подпись. Пока грузится .glb, показывается poster,
   поэтому сетка не прыгает и страница читается сразу. */
#page .model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin: 16px 0 28px;
}
#page .model-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
#page .model-reset {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 6px 12px;
  border: 1px solid var(--n-border);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}
#page .model-reset:hover { background: rgba(0, 0, 0, 0.9); border-color: var(--active); }
#page .model-card model-viewer,
#page .model-card .model-fallback {
  display: block;
  width: 100%;
  height: 520px;
  background: #141414;
  --poster-color: #141414;
  --progress-bar-color: var(--accent);
}
#page .model-card .model-caption {
  /* margin-top: auto прижимает подпись к низу, чтобы карточки в ряду
     не разъезжались из-за разной длины текста */
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
}
#page .model-card .model-caption strong { color: var(--text); font-weight: 600; }
#page .model-fallback {
  position: relative;
  display: grid;
  place-items: center;
}
#page .model-fallback img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  margin: 0;
  border-radius: 0;
}
#page .model-fallback span {
  position: relative;
  align-self: end;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.65);
  font-size: 0.8rem;
  color: var(--muted);
}
@media (max-width: 600px) {
  #page .model-card model-viewer,
  #page .model-card .model-fallback { height: 320px; }
}

/* task list checkboxes */
#page input[type="checkbox"] {
  accent-color: var(--accent);
  margin-right: 6px;
}

/* ── Loading / Error states ── */
.page-loading {
  padding: 40px;
  color: var(--muted);
  font-size: 14px;
}

.page-error {
  padding: 40px;
  color: #f87171;
  font-size: 14px;
}

/* ── Gantt Chart ── */
.gantt-wrapper {
  font-size: 13px;
}

.gantt-wrapper h1 {
  margin-bottom: 8px;
  font-size: 24px;
}

.gantt-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 28px;
}

.gantt-legend {
  display: flex;
  gap: 18px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.gantt-legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--muted);
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-dot.completed  { background: var(--done); }
.legend-dot.in-progress { background: var(--active); }
.legend-dot.not-started { background: #444; }

.gantt-category-block {
  margin-bottom: 32px;
}

.gantt-category-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 6px 0;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.gantt-timeline-header {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  margin-bottom: 4px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 6px 0;
}

.gantt-header-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  padding-left: 2px;
}

.gantt-months {
  display: flex;
  overflow: hidden;
  border-left: 1px solid var(--border);
}

.gantt-month {
  font-size: 10px;
  color: var(--muted);
  padding: 0 4px;
  border-right: 1px solid var(--border);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gantt-row {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 0;
  margin-bottom: 4px;
  min-height: 38px;
  align-items: center;
}

.gantt-row:hover .gantt-task-info {
  background: rgba(255,255,255,0.04);
}

.gantt-task-info {
  padding: 6px 10px 6px 0;
  border-radius: 4px 0 0 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gantt-task-name {
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.3;
}

.gantt-task-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.gantt-assignee {
  font-size: 10px;
  color: var(--muted);
}

.status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.status-badge.completed  { background: rgba(74,222,128,.15);  color: var(--done); }
.status-badge.in-progress { background: rgba(96,165,250,.15); color: var(--active); }
.status-badge.not-started { background: rgba(255,255,255,.07); color: var(--muted); }

.gantt-bar-track {
  border-left: 1px solid var(--border);
  height: 38px;
  position: relative;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent calc(var(--month-w, 60px) - 1px),
    var(--border) calc(var(--month-w, 60px) - 1px),
    var(--border) var(--month-w, 60px)
  );
}

.gantt-bar {
  position: absolute;
  height: 18px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 4px;
  min-width: 4px;
  display: flex;
  align-items: center;
  overflow: hidden;
  transition: opacity 0.15s;
}

.gantt-bar:hover { opacity: 0.85; }

.gantt-bar.completed  { background: var(--done); }
.gantt-bar.in-progress { background: var(--active); }
.gantt-bar.not-started { background: #444; }

.gantt-bar-progress {
  height: 100%;
  background: rgba(255,255,255,0.25);
  border-radius: 4px 0 0 4px;
}

.gantt-bar-label {
  position: absolute;
  left: 6px;
  font-size: 9px;
  font-weight: 700;
  color: rgba(0,0,0,0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 8px);
}

.gantt-empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ── Mobile ── */
@media (max-width: 768px) {
  #hamburger {
    display: flex;
  }

  #sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    z-index: 150;
    transition: left 0.25s ease;
    height: 100vh;
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }

  #sidebar.open {
    left: 0;
  }

  #content {
    padding-top: 60px;
  }

  #page {
    padding: 24px 20px 60px;
  }

  .gantt-row {
    grid-template-columns: 140px 1fr;
  }

  .gantt-timeline-header {
    grid-template-columns: 140px 1fr;
  }

  .gantt-task-name {
    font-size: 11px;
  }
}

/* ── Private section nav highlight ── */
.nav-section-header.private-section .nav-icon,
.nav-section-header.private-section .nav-title {
  color: var(--planned);
}

/* ── Password gate ── */
.password-gate {
  max-width: 380px;
  margin: 80px auto;
  text-align: center;
  padding: 48px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.password-gate-icon {
  font-size: 36px;
  margin-bottom: 18px;
}

.password-gate h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.password-gate p {
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.password-gate-form {
  display: flex;
  gap: 8px;
}

.password-gate-form input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.password-gate-form input:focus {
  border-color: var(--accent);
}

.password-gate-form button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.password-gate-form button:hover {
  opacity: 0.85;
}

.password-gate-error {
  margin-top: 14px;
  color: #f87171;
  font-size: 13px;
}

/* ── Space switcher (sidebar top) ── */
.space-switcher {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 8px 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.space-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.space-btn:hover {
  background: var(--surface2);
  color: var(--text);
}

.space-btn.active {
  background: var(--surface2);
  color: var(--text);
  border-color: var(--accent);
}

.space-btn-icon { font-size: 16px; }
.space-btn-title { flex: 1; }
.space-btn-lock { font-size: 12px; opacity: 0.7; }

/* ── Space picker (landing) ── */
.space-picker {
  max-width: 760px;
  margin: 60px auto;
  text-align: center;
}

.space-picker h1 {
  font-size: 26px;
  margin-bottom: 6px;
}

.space-picker > p {
  color: var(--muted);
  margin-bottom: 36px;
}

.space-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.space-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 24px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.space-tile:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.space-tile-icon { font-size: 34px; }
.space-tile-title { font-size: 18px; font-weight: 600; }
.space-tile-sub { font-size: 13px; color: var(--muted); }

.space-tile-status {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.space-tile-status.unlocked { color: var(--done); }

/* ── Kanban Board ── */
#page.kanban-page {
  max-width: none;
  padding: 32px 32px 80px;
}

.kanban-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.kanban-header h1 { margin: 0; }

.kanban-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-sync-btn {
  background: transparent;
  color: var(--text-dim, #9aa0a6);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.kanban-sync-btn:hover { background: var(--surface); color: var(--text, #e8eaed); }

.kanban-add-btn {
  background: var(--n-blue);
  color: #fff;
  border: none;
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.kanban-add-btn:hover { background: var(--n-blue-hover); }

/* ── Фильтр доски по исполнителям ── */
.kanban-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0 0 14px;
}

.kanban-filter-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 4px;
}

.kanban-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  border: 1px solid var(--n-border);
  background: var(--surface2);
  color: var(--text);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
}

.kanban-filter-chip:hover { background: #2b2b2b; }

.kanban-filter-chip.active {
  background: rgba(124,106,247,0.18);
  border-color: rgba(124,106,247,0.6);
}

.kanban-filter-chip.empty { opacity: 0.45; }

.kanban-filter-count {
  font-size: 10.5px;
  color: var(--muted);
  background: rgba(0,0,0,0.3);
  border-radius: 999px;
  padding: 0 5px;
  min-width: 17px;
  text-align: center;
}

.kanban-filter-chip.active .kanban-filter-count { color: var(--text); }

.kanban-avatar--none {
  background: transparent;
  border: 1px dashed var(--n-border);
  color: var(--muted);
}

.kanban-filter-reset {
  margin-left: 4px;
  background: none;
  border: none;
  color: var(--n-blue);
  font-size: 11.5px;
  font-family: inherit;
  cursor: pointer;
  padding: 4px 2px;
}

.kanban-filter-reset:hover { text-decoration: underline; }

/* Колонки тянутся по высоте самой длинной: иначе зона приёма короткой колонки
   обрывается там, где кончаются её карточки, и перетащить нижнюю карточку длинной
   колонки становится некуда */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
  padding-bottom: 20px;
}

.kanban-column {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  border-top-width: 3px;
}

.kanban-column[data-col="backlog"]    { border-top-color: #6b7280; }
.kanban-column[data-col="todo"]       { border-top-color: #3b82f6; }
.kanban-column[data-col="inprogress"] { border-top-color: #f59e0b; }
.kanban-column[data-col="review"]     { border-top-color: #8b5cf6; }
.kanban-column[data-col="done"]       { border-top-color: #22c55e; }

.kanban-column[data-col="backlog"]    .kanban-col-title { color: #d1d5db; background: rgba(107, 114, 128, 0.22); }
.kanban-column[data-col="todo"]       .kanban-col-title { color: #93c5fd; background: rgba(59, 130, 246, 0.18); }
.kanban-column[data-col="inprogress"] .kanban-col-title { color: #fcd34d; background: rgba(245, 158, 11, 0.16); }
.kanban-column[data-col="review"]     .kanban-col-title { color: #c4b5fd; background: rgba(139, 92, 246, 0.18); }
.kanban-column[data-col="done"]       .kanban-col-title { color: #86efac; background: rgba(34, 197, 94, 0.16); }

.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 10px;
  border-bottom: 1px solid var(--border);
}

.kanban-col-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-col-count {
  font-size: 11px;
  color: var(--muted);
  background: var(--surface2);
  padding: 1px 8px;
  border-radius: 10px;
}

.kanban-cards {
  padding: 10px 10px 12px;
  min-height: 80px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Цель приёма — вся колонка целиком, включая шапку и пустое место под карточками */
.kanban-column {
  transition: background 0.15s, border-color 0.15s;
}

.kanban-column.drag-over {
  background: rgba(124,106,247,0.09);
  border-color: rgba(124,106,247,0.55);
  box-shadow: inset 0 0 0 1px rgba(124,106,247,0.35);
}

.kanban-column.drag-over .kanban-cards {
  outline: 2px dashed rgba(124,106,247,0.35);
  outline-offset: -4px;
  border-radius: 8px;
}

.kanban-card {
  background: var(--surface2);
  border: 1px solid var(--n-border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  transition: background 0.15s, box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
  position: relative;
}

.kanban-card:hover {
  background: #262626;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.kanban-card[draggable]:active { cursor: grabbing; }

.kanban-card.dragging {
  opacity: 0.35;
  cursor: grabbing;
}

.kanban-card-top {
  margin-bottom: 7px;
  padding-right: 18px;
}

.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  padding-right: 18px;
}

/* ── Приоритет: пилюля с точкой, цвет задаёт шкалу ── */
.kanban-prio {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
}

.kanban-prio-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.kanban-prio[data-prio="highest"] { color: #f87171; background: rgba(239, 68, 68, 0.16); }
.kanban-prio[data-prio="high"]    { color: #fbbf5b; background: rgba(245, 158, 11, 0.16); }
.kanban-prio[data-prio="medium"]  { color: #fde68a; background: rgba(234, 200, 90, 0.14); }
.kanban-prio[data-prio="low"]     { color: #93c5fd; background: rgba(59, 130, 246, 0.16); }
.kanban-prio[data-prio="lowest"]  { color: #b0b0b0; background: rgba(150, 150, 150, 0.16); }

/* Левая кромка карточки повторяет приоритет — видно, не читая пилюлю */
.kanban-card[data-prio] { border-left-width: 3px; }
.kanban-card[data-prio="highest"] { border-left-color: #ef4444; }
.kanban-card[data-prio="high"]    { border-left-color: #f59e0b; }
.kanban-card[data-prio="medium"]  { border-left-color: #eac85a; }
.kanban-card[data-prio="low"]     { border-left-color: #3b82f6; }
.kanban-card[data-prio="lowest"]  { border-left-color: #6b7280; }

.kanban-card-desc {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.kanban-card-actions {
  position: absolute;
  top: 7px;
  right: 8px;
}

.kanban-card-delete {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.1s, color 0.1s;
}

.kanban-card:hover .kanban-card-delete { opacity: 1; }
.kanban-card-delete:hover { color: #f87171; }

/* Modal */
.kanban-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.kanban-modal {
  background: var(--n-panel);
  border: 1px solid var(--n-border);
  border-radius: 10px;
  width: 460px;
  max-width: 90vw;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.2);
}

.kanban-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 10px;
  border-bottom: none;
}

.kanban-modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.kanban-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  transition: color 0.1s;
}
.kanban-modal-close:hover { color: var(--text); }

.kanban-modal-body {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.kanban-modal-body label {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--muted);
  margin-bottom: -4px;
}

.kanban-required { color: #f87171; margin-left: 2px; }

.kanban-modal-body input,
.kanban-modal-body textarea,
.kanban-modal-body select {
  color-scheme: dark;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--n-border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
}

.kanban-modal-body input:focus,
.kanban-modal-body textarea:focus,
.kanban-modal-body select:focus {
  border-color: var(--n-blue);
  box-shadow: 0 0 0 2px var(--n-ring);
}

.kanban-modal-body select option { background: var(--n-panel); }

/* ── Карточка задачи в стиле Notion: крупный заголовок без рамки,
      свойства строками «подпись — значение», описание отдельным блоком ── */
.kanban-modal--task { width: 620px; }

.kanban-modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 0;
}

.kanban-modal-kicker {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.kanban-modal--task .kanban-modal-body {
  padding: 6px 20px 18px;
  gap: 0;
}

.kanban-modal--task .kanban-title-input {
  background: transparent;
  border: none;
  padding: 6px 0 12px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.3;
}

.kanban-modal--task .kanban-title-input:focus {
  border: none;
  box-shadow: none;
}

.kanban-modal--task .kanban-title-input::placeholder { color: #5a5a5a; }

.kanban-props {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.kanban-prop {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.kanban-prop--top { align-items: flex-start; padding-top: 4px; }

.kanban-prop-label {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 132px;
  flex-shrink: 0;
  font-size: 12.5px;
  color: var(--muted);
  padding: 4px 6px;
  border-radius: 4px;
}

.kanban-prop-icon { font-size: 12px; opacity: 0.8; }

.kanban-prop-value { flex: 1; min-width: 0; }

.kanban-prop-divider {
  height: 1px;
  background: var(--n-border);
  margin: 14px 0 6px;
}

.kanban-modal--task .kanban-desc-input {
  background: transparent;
  border: none;
  padding: 4px 0;
  font-size: 13.5px;
  line-height: 1.65;
  color: #cfcfcf;
  min-height: 120px;
}

.kanban-modal--task .kanban-desc-input:focus {
  border: none;
  box-shadow: none;
}

.kanban-modal--task .kanban-desc-input::placeholder { color: #5a5a5a; }

/* Поля-свойства внутри карточки — плоские, подсвечиваются по наведению */
.kanban-modal--task .n-select-btn,
.kanban-modal--task .kanban-assignee-field {
  background: transparent;
  border-color: transparent;
}

.kanban-modal--task .n-select-btn:hover,
.kanban-modal--task .kanban-assignee-field:hover {
  background: var(--n-hover);
}

.kanban-modal--task .n-menu .n-option { padding: 5px 8px; }

.kanban-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: none;
}

.kanban-btn-cancel {
  background: transparent;
  border: 1px solid var(--n-border);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}
.kanban-btn-cancel:hover { background: var(--n-hover); }

.kanban-btn-save {
  background: var(--n-blue);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}
.kanban-btn-save:hover { background: var(--n-blue-hover); }

/* ── Kanban: assignees (чипы + multiselect) ── */

.kanban-card-assignees {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

/* Чип исполнителя (стиль Notion): аватар-кружок + имя */
.kanban-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  line-height: 1;
  padding: 3px 8px 3px 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.kanban-avatar {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.kanban-chip-name {
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.kanban-assignee-select { position: relative; }

/* Поле как в Notion: выбранные чипы живут внутри инпута */
.kanban-assignee-field {
  min-height: 38px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 5px 8px;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.kanban-assignee-field:focus {
  border-color: var(--n-blue);
  box-shadow: 0 0 0 2px var(--n-ring);
  outline: none;
}

.kanban-assignee-placeholder {
  color: var(--muted);
  font-size: 13.5px;
  padding-left: 4px;
}

.kanban-chip--field { font-size: 12px; padding: 3px 6px 3px 3px; }

.kanban-chip-remove {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
  padding: 1px 2px;
  cursor: pointer;
}
.kanban-chip-remove:hover { color: #f87171; }

.kanban-assignee-hint {
  font-size: 10.5px;
  color: var(--muted);
  padding: 6px 10px 4px;
}

.kanban-assignee-empty {
  font-size: 12.5px;
  color: var(--muted);
  padding: 8px 10px;
}

.kanban-assignee-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--n-panel);
  border: 1px solid var(--n-border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}

.kanban-assignee-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.kanban-assignee-option:hover { background: var(--n-hover); }
.kanban-assignee-option .kanban-avatar { width: 20px; height: 20px; font-size: 10.5px; }

/* ── Gantt: On Hold + линия «сегодня» ── */

.legend-dot.on-hold {
  background: repeating-linear-gradient(45deg, #7a5a1e, #7a5a1e 3px, #4a3a14 3px, #4a3a14 6px);
}
.legend-dot.today { background: #f8717199; border: 1px solid #f87171; }

.status-badge.on-hold { background: rgba(250,204,21,.10); color: #d4b04a; }

.gantt-bar.on-hold {
  background: repeating-linear-gradient(45deg, #7a5a1e, #7a5a1e 4px, #4a3a14 4px, #4a3a14 8px);
}

.gantt-today-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1.5px dashed #f87171;
  opacity: 0.75;
  z-index: 3;
  pointer-events: none;
}

.gantt-today-line--header {
  border-left-color: #f87171;
  opacity: 1;
  bottom: 14px; /* линия только по строке месяцев */
}

.gantt-months-wrap {
  position: relative;
  padding-bottom: 14px; /* отдельная строка под подпись «сегодня» */
}

.gantt-today-label {
  position: absolute;
  bottom: 0;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  color: #f87171;
  white-space: nowrap;
}

/* ── Kanban: корзина ── */

.kanban-trash-fab {
  position: fixed;
  right: 28px;
  bottom: 28px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  z-index: 90;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
}
.kanban-trash-fab:hover { border-color: var(--muted); transform: scale(1.06); }
.kanban-trash-fab.drag-over {
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.15);
  transform: scale(1.15);
}

.kanban-trash-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #f87171;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.kanban-trash-body {
  max-height: 50vh;
  overflow-y: auto;
  gap: 6px;
}

.kanban-trash-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg);
}

.kanban-trash-item-info { min-width: 0; }

.kanban-trash-item-title {
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kanban-trash-item-meta {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

.kanban-trash-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.kanban-trash-restore {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.kanban-trash-restore:hover { background: var(--n-hover); border-color: var(--n-blue); color: var(--n-blue); }

.kanban-trash-purge {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.kanban-trash-purge:hover { border-color: #f87171; color: #f87171; }

.kanban-trash-empty-note {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 18px 0;
}

/* ── Группы-дивайдеры внутри секций навигации ── */
.nav-divider {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 10px 0 3px;
  padding: 5px 12px 3px;
  border-top: 1px solid var(--border);
}
.nav-children .nav-divider:first-child { border-top: none; margin-top: 2px; }
.nav-children .nav-group:first-child .nav-divider--toggle { border-top: none; margin-top: 2px; }

/* Раскрывающаяся группа внутри секции (спринты) */
.nav-divider--toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.nav-divider--toggle:hover { color: var(--text); }
.nav-divider--toggle .nav-chevron { font-size: 9px; }
.nav-group.open .nav-divider--toggle .nav-chevron { transform: rotate(90deg); }

.nav-group-body { display: none; padding-bottom: 2px; }
.nav-group.open .nav-group-body { display: block; }

/* Переключатель периода на ганте */
.gantt-ranges {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 4px;
  flex-wrap: wrap;
}
.gantt-range-btn {
  padding: 5px 12px;
  font-size: 12.5px;
  font-family: inherit;
  color: var(--muted);
  background: var(--n-bg-soft, rgba(255,255,255,0.04));
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.gantt-range-btn:hover { color: var(--text); border-color: var(--muted); }
.gantt-range-btn.active {
  color: #fff;
  background: var(--accent, #6c5ce7);
  border-color: var(--accent, #6c5ce7);
}
.gantt-range-note { font-size: 11.5px; color: var(--muted); margin-left: 4px; }

/* Задача вне выбранного окна: строка остаётся на месте, полосы нет */
.gantt-bar-outside {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding-left: 10px;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.75;
  font-style: italic;
}

/* Обоснование процента всплывает по наведению на поле задачи.
   Постоянный вывод раздувал строки втрое, поэтому только подсказка. */
.gantt-task-info[data-rationale] { position: relative; cursor: help; }
.gantt-task-info[data-rationale]::after {
  content: attr(data-rationale);
  position: absolute;
  left: 100%;
  top: 0;
  margin-left: 10px;
  z-index: 80;
  width: 330px;
  padding: 10px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text);
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s;
}
.gantt-task-info[data-rationale]:hover::after { opacity: 1; visibility: visible; }


/* Примечание в модалке правки задачи ганта */
.gantt-edit-note {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.55;
  margin-top: 2px;
}

/* ── Гант: свёрнутая группа «Готово» ── */
.gantt-done-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  margin: 2px 0 4px;
  border-radius: 5px;
  cursor: pointer;
  user-select: none;
  width: fit-content;
  transition: background 0.15s;
}
.gantt-done-toggle:hover { background: var(--n-hover); }

.gantt-done-chevron {
  font-size: 9px;
  color: var(--muted);
  transition: transform 0.15s;
}
.gantt-done-toggle.open .gantt-done-chevron { transform: rotate(90deg); }

.gantt-done-count {
  font-size: 11px;
  color: var(--muted);
}

/* ── Гант: шапка с кнопкой добавления, возврат скрытых, удаление ── */
.gantt-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.gantt-page-header h1 { margin-bottom: 8px; }

.gantt-unhide {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  padding: 0;
}
.gantt-unhide:hover { color: var(--text); }

.gantt-btn-danger { margin-right: auto; }
.gantt-btn-danger:hover { background: rgba(248, 113, 113, 0.12); border-color: #f87171; color: #f87171; }

/* ── Notion-дропдауны (общие) ── */
.n-select { position: relative; }

.n-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--n-border);
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.n-select-btn:focus {
  border-color: var(--n-blue);
  box-shadow: 0 0 0 2px var(--n-ring);
  outline: none;
}

.n-caret { color: var(--muted); font-size: 10px; flex-shrink: 0; }

.n-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 30;
  background: var(--n-panel);
  border: 1px solid var(--n-border);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  max-height: 220px;
  overflow-y: auto;
  padding: 4px;
}

.n-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 5px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.n-option:hover { background: var(--n-hover); }

/* Пилюля колонки (в кнопке и меню) — те же цвета, что у заголовков колонок */
.kanban-colpill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  color: var(--muted);
}
.kanban-colpill[data-col="backlog"]    { color: #d1d5db; background: rgba(107, 114, 128, 0.22); }
.kanban-colpill[data-col="todo"]       { color: #93c5fd; background: rgba(59, 130, 246, 0.18); }
.kanban-colpill[data-col="inprogress"] { color: #fcd34d; background: rgba(245, 158, 11, 0.16); }
.kanban-colpill[data-col="review"]     { color: #c4b5fd; background: rgba(139, 92, 246, 0.18); }
.kanban-colpill[data-col="done"]       { color: #86efac; background: rgba(34, 197, 94, 0.16); }

/* ── Полоса освоения бюджета (страницы смет, напр. #tech-specs/avatars-cost) ── */
.budget-progress {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 22px 0 28px;
}
.budget-progress-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 12px;
}
.budget-progress-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.budget-progress-value {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.budget-bar {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface2);
  border: 1px solid var(--border);
}
.budget-seg { height: 100%; }
.budget-seg--done   { background: var(--done); }
.budget-seg--rework { background: var(--planned); }

.budget-legend {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  font-size: 13px;
  color: var(--muted);
}
.budget-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.budget-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}
.budget-dot--done   { background: var(--done); }
.budget-dot--rework { background: var(--planned); }
.budget-dot--rest   { background: var(--surface2); border: 1px solid var(--border); }

@media (max-width: 640px) {
  .budget-progress { padding: 14px 16px; }
  .budget-legend { flex-direction: column; gap: 8px; }
}

/* ── Таймлайн этапов без дат (#onboarding/roadmap) ──
   Разметка — сырой HTML в markdown: .tl > .tl-track[style="--tl-n: N"] > .tl-step.is-<статус>.
   Внутри блока не должно быть пустых строк, иначе marked закончит HTML-блок.
   Статусы: is-done (готово), is-block (блокер), is-plan (предложение), is-goal (итог). */
#page .tl { margin: 18px 0 6px; overflow-x: auto; padding-bottom: 6px; }
#page .tl-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(var(--tl-n, 6), minmax(90px, 1fr));
  min-width: calc(var(--tl-n, 6) * 90px);
}
#page .tl-track::before {
  content: '';
  position: absolute;
  top: 37px;
  left: calc(100% / var(--tl-n, 6) / 2);
  right: calc(100% / var(--tl-n, 6) / 2);
  height: 1px;
  background: #3a3a3a;
}
#page .tl-step { position: relative; text-align: center; padding: 0 5px; }
#page .tl-when { height: 26px; line-height: 26px; font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--text); }
#page .tl-dot {
  position: relative; z-index: 1;
  width: 11px; height: 11px; margin: 6px auto 9px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 3px var(--bg);
}
#page .tl-chip {
  display: inline-block; margin-bottom: 8px; padding: 4px 8px;
  border-radius: 999px; font-size: 10.5px; line-height: 1; white-space: nowrap;
  background: rgba(255,255,255,0.06); color: var(--muted);
}
#page .tl-title { font-size: 12px; font-weight: 600; line-height: 1.4; color: var(--text); }
#page .tl-who { margin-top: 4px; font-size: 11px; line-height: 1.4; color: var(--muted); }
#page .tl-step.is-done .tl-dot { background: var(--done); }
#page .tl-step.is-done .tl-chip { background: rgba(74,222,128,0.14); color: var(--done); }
#page .tl-step.is-block .tl-dot { background: #f87171; }
#page .tl-step.is-block .tl-chip { background: rgba(248,113,113,0.14); color: #f87171; }
#page .tl-step.is-plan .tl-dot { background: var(--planned); }
#page .tl-step.is-plan .tl-chip { background: rgba(245,158,11,0.14); color: var(--planned); }
#page .tl-step.is-goal .tl-dot { background: var(--accent); }
#page .tl-step.is-goal .tl-chip { background: rgba(124,106,247,0.18); color: #a99cf9; }
@media (max-width: 600px) {
  #page .tl-track { grid-template-columns: repeat(var(--tl-n, 6), 108px); min-width: calc(var(--tl-n, 6) * 108px); }
}

/* ── План работ (#plan) ───────────────────────────────────────
   Страница строится из JSON (app.js, renderPlan). Цвета статусов совпадают
   с колонками Kanban, чтобы «В работе» читалось одинаково на обеих страницах. */
#page.plan-page { max-width: 1280px; padding: 36px 36px 96px; }
#page .plan h2 { margin-top: 40px; scroll-margin-top: 110px; }
#page .plan section { scroll-margin-top: 110px; }
#page .plan h4 { margin: 14px 0 6px; font-size: 11.5px; }
#page .plan ul { margin: 0 0 6px; padding-left: 18px; }
#page .plan li { font-size: 13.5px; line-height: 1.55; margin-bottom: 3px; }
#page .plan .plan-empty { color: var(--muted); font-size: 13px; margin: 0; }

#page .plan-head h1 { margin-bottom: 8px; }
#page .plan-lead { color: #bdbdbd; margin-bottom: 14px; max-width: 860px; }
#page .plan-facts { display: flex; flex-wrap: wrap; gap: 10px 28px; font-size: 13.5px; }
#page .plan-facts span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }

/* Липкая панель: кто правит, фильтр, состояние сохранения, переходы по разделам */
#page .plan-bar {
  position: sticky; top: 0; z-index: 20;
  margin: 20px -12px 0; padding: 10px 12px 8px;
  background: rgba(15,15,15,.94); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
}
#page .plan-bar-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; }
#page .plan-bar-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
#page .plan-me { width: 230px; }
#page .plan-me .n-select-btn { padding: 6px 10px; }
#page .plan-me.is-empty .n-select-btn { border-color: rgba(245,158,11,.6); color: #fcd34d; }
#page .plan-me.is-attention .n-select-btn { box-shadow: 0 0 0 3px rgba(245,158,11,.45); }
#page .plan-mine { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #cfcfcf; cursor: pointer; }
#page .plan-sync { font-size: 12.5px; color: var(--muted); margin-left: auto; }
#page .plan-sync[data-state="ok"] { color: #86efac; }
#page .plan-sync[data-state="offline"] { color: #fcd34d; }
#page .plan-tabs { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; font-size: 13px; }

#page .plan-mini { margin: 16px 0 0; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; background: var(--surface); }
#page .plan-mini > summary { cursor: pointer; font-size: 13px; color: #cfcfcf; }
#page .plan-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px; }
#page .plan-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 28px; }
#page .plan-legend li { list-style: none; margin-left: -18px; color: var(--muted); font-size: 12.5px; }

/* Приоритеты */
#page .plan-prio-list { display: flex; flex-direction: column; gap: 8px; }
#page .plan-prio-row {
  display: grid; grid-template-columns: 96px minmax(220px, 1.3fr) 1.4fr 120px;
  gap: 14px; align-items: start; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
#page .plan-prio-title { font-weight: 600; font-size: 14.5px; line-height: 1.4; }
#page .plan-prio-why { color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.45; }
#page .plan-prio-tz { display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
#page .plan-prio-count { font-size: 12.5px; color: #cfcfcf; text-align: right; line-height: 1.5; }
#page .plan-prio {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 4px; white-space: nowrap;
  color: #d1d5db; background: rgba(107,114,128,.22);
}
#page .plan-prio[data-p="P1"] { color: #fca5a5; background: rgba(239,68,68,.18); }
#page .plan-prio[data-p="P2"] { color: #fdba74; background: rgba(249,115,22,.18); }
#page .plan-prio[data-p="P3"] { color: #fcd34d; background: rgba(245,158,11,.16); }
#page .plan-prio[data-p="P4"] { color: #93c5fd; background: rgba(59,130,246,.18); }
#page .plan-prio[data-p="PD"] { color: #c4b5fd; background: rgba(139,92,246,.18); }

/* Таблицы задач */
#page .plan-table-wrap { overflow: visible; }
#page .plan-table { margin: 10px 0 18px; font-size: 13px; min-width: 900px; }
#page .plan-table td { padding: 7px 10px; vertical-align: top; }
#page .plan-table th { padding: 7px 10px; }
#page .plan-table tr:nth-child(even) td { background: transparent; }
#page .plan-group td { background: var(--surface2) !important; font-weight: 600; font-size: 13px; padding: 9px 10px; }
#page .plan-code { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; width: 44px; }
#page .plan-title { min-width: 240px; line-height: 1.45; }
#page .plan-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; }
#page .plan-hint { color: var(--muted); font-size: 12px; }
#page .plan-kb { font-size: 11.5px; color: #c4b5fd; }
#page .plan-tzref { white-space: nowrap; }
#page .plan-who { min-width: 150px; }
#page .plan-chip {
  display: inline-block; margin: 0 4px 3px 0; padding: 1px 7px; border-radius: 10px;
  font-size: 12px; white-space: nowrap; background: rgba(255,255,255,.07); color: #ddd;
}
#page .plan-ready { font-size: 12px; white-space: nowrap; }
#page .plan-ready[data-r="solution"] { color: #86efac; }
#page .plan-ready[data-r="research"] { color: #fcd34d; }
#page .plan-ready[data-r="none"] { color: var(--muted); }
#page .plan-row[data-st="done"] .plan-title { color: var(--muted); text-decoration: line-through; }
#page .plan-row[data-st="blocked"] td:first-child { box-shadow: inset 3px 0 0 #ef4444; }

/* Статус: компактный дропдаун на n-select */
#page .plan-dd { width: 148px; }
#page .plan-dd .n-select-btn { padding: 4px 8px; background: transparent; }
#page .plan-dd .n-menu { width: 300px; right: auto; max-height: none; }
#page .plan .n-menu.n-menu--up { top: auto; bottom: calc(100% + 4px); }
#page .plan-opt-hint { color: var(--muted); font-size: 11.5px; }
#page .plan-st {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .03em;
  padding: 2px 8px; border-radius: 4px; white-space: nowrap;
  color: #d1d5db; background: rgba(107,114,128,.22);
}
#page .plan-st[data-st="research"]   { color: #fcd34d; background: rgba(245,158,11,.14); }
#page .plan-st[data-st="estimate"]   { color: #fdba74; background: rgba(249,115,22,.16); }
#page .plan-st[data-st="todo"]       { color: #93c5fd; background: rgba(59,130,246,.18); }
#page .plan-st[data-st="inprogress"] { color: #fde68a; background: rgba(234,179,8,.2); }
#page .plan-st[data-st="qa"]         { color: #67e8f9; background: rgba(6,182,212,.16); }
#page .plan-st[data-st="review"]     { color: #c4b5fd; background: rgba(139,92,246,.18); }
#page .plan-st[data-st="blocked"]    { color: #fca5a5; background: rgba(239,68,68,.18); }
#page .plan-st[data-st="done"]       { color: #86efac; background: rgba(34,197,94,.16); }

/* Карточки ТЗ */
#page .plan-tz-tools { display: flex; gap: 8px; margin: 4px 0 12px; }
#page .plan-btn {
  font: inherit; font-size: 12.5px; color: #cfcfcf; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 10px;
}
#page .plan-btn:hover { background: var(--surface2); }
#page .plan-tz { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin-bottom: 10px; scroll-margin-top: 110px; }
#page .plan-tz[open] { border-color: #3a3a3a; }
#page .plan-tz > summary {
  display: grid; grid-template-columns: 48px 120px minmax(0, 1fr) 156px;
  gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; list-style: none;
}
#page .plan-tz > summary::-webkit-details-marker { display: none; }
#page .plan-tz-code { font-weight: 700; font-size: 13px; color: #cfcfcf; }
#page .plan-tz-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#page .plan-tz-title { font-weight: 600; font-size: 14.5px; }
#page .plan-tz-sub { font-size: 12.5px; color: var(--muted); }
#page .plan-tz > summary .plan-prio { justify-self: start; }
#page .plan-tz-body { padding: 0 16px 14px; border-top: 1px solid var(--border); }
#page .plan-goal { font-size: 14.5px; margin: 12px 0 4px; }
#page .plan-out li { color: var(--muted); }
#page .plan-blockers li::marker { color: #ef4444; }
#page .plan-team { list-style: none; padding-left: 0; }
#page .plan-role { color: var(--muted); font-size: 12.5px; }
#page .plan-span, #page .plan-refs { font-size: 13.5px; margin: 0 0 6px; }
#page .plan-warn { color: #fcd34d; font-weight: 600; }

#page .plan-note { font-size: 13px; color: var(--muted); margin: 0 0 6px; }
#page .plan-count { color: var(--muted); font-size: 13px; font-weight: 400; }
#page .plan-codes { color: var(--muted); font-size: 12.5px; }
#page .plan-who-table { min-width: 640px; }
#page .plan-now-table { table-layout: fixed; }
#page .plan-now-table th:nth-child(2) { width: 38%; }
#page .plan-now-table th:nth-child(3) { width: 130px; }
#page .plan-now-table td:nth-child(3) { white-space: nowrap; }

@media (max-width: 1100px) {
  #page .plan-table-wrap { overflow-x: auto; padding-bottom: 160px; margin-bottom: -160px; }
}
@media (max-width: 900px) {
  #page.plan-page { padding: 24px 16px 80px; }
  #page .plan-bar { position: static; margin: 16px 0 0; padding: 10px 0 8px; background: none; backdrop-filter: none; }
  #page .plan-grid2, #page .plan-grid3 { grid-template-columns: 1fr; }
  #page .plan-prio-row { grid-template-columns: 1fr; }
  #page .plan-prio-count { text-align: left; }
  #page .plan-tz > summary { display: flex; flex-wrap: wrap; gap: 6px 10px; }
  #page .plan-tz-main { flex-basis: 100%; order: 3; }
  #page .plan-tz-st { order: 4; }
}

/* План: вспомогательный серый светлее общего --muted (#888 даёт 4.5–4.9:1, на 14″ мелкий
   шрифт читается плохо) — здесь около 7:1. Метки статусов и приоритетов на полпикселя крупнее. */
#page .plan { --plan-muted: #a6a6a6; }
#page .plan .plan-table th,
#page .plan .plan-code, #page .plan .plan-hint, #page .plan .plan-role, #page .plan .plan-tz-sub,
#page .plan .plan-out li, #page .plan .plan-prio-why, #page .plan .plan-legend li,
#page .plan .plan-facts span, #page .plan .plan-bar-label, #page .plan .plan-note,
#page .plan .plan-stamp, #page .plan .plan-count, #page .plan .plan-opt-hint,
#page .plan .plan-ready[data-r="none"], #page .plan .plan-empty, #page .plan .plan-dash { color: var(--plan-muted); }
#page .plan .plan-stamp.is-missing { color: #fcd34d; }
#page .plan .plan-st, #page .plan .plan-prio { font-size: 11.5px; }
#page .plan .plan-stamp { font-size: 12px; }

/* ── План: дизайн-слой ────────────────────────────────────────
   Таблицы без вертикальной сетки, кнопка-диапазон вместо голых полей дат,
   показатели и полосы распределения по статусам. */

/* Показатели плана */
#page .plan-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin: 22px 0 10px; }
#page .plan-kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; display: flex; flex-direction: column; gap: 2px;
}
#page .plan-kpi b { font-size: 24px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
#page .plan-kpi span { font-size: 12px; color: var(--plan-muted); }
#page .plan-kpi[data-tone="ok"] b { color: #86efac; }
#page .plan-kpi[data-tone="warn"] b { color: #fcd34d; }
#page .plan-kpi[data-tone="bad"] b { color: #fca5a5; }

/* Полоса распределения по статусам — цвета как у меток статусов */
#page .plan-stbar { display: flex; gap: 2px; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 8px; background: rgba(255,255,255,.04); }
#page .plan-stbar--wide { height: 8px; margin: 0 0 4px; }
#page .plan-stbar--thin { height: 4px; margin-top: 6px; max-width: 360px; }
#page .plan-seg { display: block; min-width: 4px; }
#page .plan-seg[data-st="done"]       { background: #22c55e; }
#page .plan-seg[data-st="qa"]         { background: #06b6d4; }
#page .plan-seg[data-st="inprogress"] { background: #eab308; }
#page .plan-seg[data-st="todo"]       { background: #3b82f6; }
#page .plan-seg[data-st="estimate"]   { background: #f97316; opacity: .75; }
#page .plan-seg[data-st="research"]   { background: #f59e0b; opacity: .55; }
#page .plan-seg[data-st="review"]     { background: #8b5cf6; }
#page .plan-seg[data-st="blocked"]    { background: #ef4444; }
#page .plan-seg[data-st="backlog"]    { background: #6b7280; opacity: .6; }

/* Вкладки разделов — сегменты, текущий раздел подсвечен */
#page .plan-tabs { gap: 4px; }
#page .plan-tabs a { padding: 4px 10px; border-radius: 6px; color: #c8c8c8; }
#page .plan-tabs a:hover { background: var(--n-hover); text-decoration: none; }
#page .plan-tabs a.is-active { background: rgba(124,106,247,.18); color: #c9bfff; }

/* Таблицы: только горизонтальные разделители, подсветка строки */
#page .plan-table { border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 10px; }
#page .plan-table th, #page .plan-table td { border: none; border-bottom: 1px solid var(--border); }
#page .plan-table tr:last-child td { border-bottom: none; }
#page .plan-table th { background: transparent; padding: 9px 12px; }
#page .plan-table td { padding: 10px 12px; }
#page .plan-row:hover td { background: rgba(255,255,255,.025); }
#page .plan-group td { background: rgba(255,255,255,.03) !important; padding: 10px 12px; }
#page .plan-row[data-st="blocked"] td:first-child { box-shadow: inset 3px 0 0 #ef4444; }

/* Готовность — цветная точка и текст */
#page .plan-ready { color: #d4d4d4; display: inline-flex; align-items: center; gap: 6px; }
#page .plan-ready::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
#page .plan-ready[data-r="solution"]::before { background: #22c55e; }
#page .plan-ready[data-r="research"]::before { background: #f59e0b; }
#page .plan-ready[data-r="none"]::before { display: none; }

/* Кнопка статуса без рамки, рамка — при наведении */
#page .plan-dd .n-select-btn { border-color: transparent; background: transparent; padding: 3px 6px; }
#page .plan-dd .n-select-btn:hover { border-color: var(--n-border); background: rgba(255,255,255,.03); }
#page .plan-dd .n-caret { opacity: .55; }

/* Срок: кнопка-диапазон и панель */
#page .plan-datecell { white-space: nowrap; width: 150px; }
#page .plan-range-wrap { position: relative; display: inline-block; }
#page .plan-range {
  font: inherit; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer;
  padding: 4px 10px; border-radius: 6px; color: var(--text);
  background: rgba(255,255,255,.04); border: 1px solid var(--n-border);
}
#page .plan-range:hover { border-color: rgba(255,255,255,.22); }
#page .plan-range.is-missing { background: transparent; border: 1px dashed rgba(245,158,11,.55); color: #fcd34d; }
#page .plan-range.is-empty { background: transparent; border-color: transparent; color: var(--plan-muted); }
#page .plan-pop {
  position: absolute; z-index: 40; top: calc(100% + 6px); right: 0; width: 210px;
  flex-direction: column; gap: 8px; padding: 12px;
  background: var(--n-panel); border: 1px solid var(--n-border); border-radius: 10px; box-shadow: 0 12px 32px rgba(0,0,0,.55);
}
#page .plan-pop.is-up { top: auto; bottom: calc(100% + 6px); }
#page .plan-pop label { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; color: var(--plan-muted); }
#page .plan-pop input {
  width: 100%; padding: 5px 8px; font: inherit; font-size: 13px; color: var(--text); color-scheme: dark;
  background: rgba(0,0,0,.3); border: 1px solid var(--n-border); border-radius: 6px;
}
#page .plan-pop input:focus { outline: none; border-color: var(--n-blue); box-shadow: 0 0 0 2px var(--n-ring); }
#page .plan-pop-clear {
  align-self: flex-start; font: inherit; font-size: 12px; color: var(--plan-muted); cursor: pointer;
  background: none; border: none; padding: 2px 0;
}
#page .plan-pop-clear:hover { color: var(--text); }
#page .plan-stamp { margin-top: 4px; min-height: 0; }

@media (max-width: 900px) {
  #page .plan-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Кнопка статуса по ширине содержимого: стрелка рядом с меткой, а не на краю ячейки */
#page .plan-dd { width: auto; display: inline-block; }
#page .plan-dd .n-select-btn { width: auto; justify-content: flex-start; gap: 6px; }
#page .plan-tz-st { justify-self: end; }

/* Телефон: строки задач — карточками в одну колонку, без горизонтальной прокрутки */
@media (max-width: 700px) {
  #page .plan-table-wrap:has(.plan-tasks) { overflow: visible; padding-bottom: 0; margin-bottom: 0; }
  #page .plan-tasks { min-width: 0; border: none; }
  #page .plan-tasks thead { display: none; }
  #page .plan-tasks, #page .plan-tasks tbody, #page .plan-tasks tr, #page .plan-tasks td { display: block; width: auto; }
  #page .plan-tasks .plan-group td { border: none; border-radius: 8px; margin: 14px 0 6px; }
  #page .plan-tasks .plan-row {
    display: grid; grid-template-columns: 34px 1fr; gap: 6px 8px; padding: 10px 12px; margin-bottom: 8px;
    border: 1px solid var(--border); border-radius: 10px; background: var(--surface);
  }
  #page .plan-tasks .plan-row td { border: none; padding: 0; background: none !important; min-width: 0; }
  #page .plan-tasks .plan-row .plan-code { grid-row: 1 / span 6; }
  #page .plan-tasks .plan-row .plan-tzref { font-size: 12px; }
  #page .plan-tasks .plan-row .plan-datecell { width: auto; }
}

/* ── Вход, учётная запись, «Нет доступа», уведомления (перенос с Netlify, 12.2026) ── */

/* Атрибут hidden сильнее любых правил display: иначе .login { display: flex } показывал скрытый экран входа */
[hidden] { display: none !important; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-logo { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.login-main { display: block; width: 100%; padding: 14px 16px; border: 0; border-radius: 8px; background: var(--n-blue); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
.login-main:hover { background: var(--n-blue-hover); }
.login-main:disabled { opacity: .6; cursor: default; }
.login-link { background: none; border: 0; color: var(--muted); font-size: 14px; cursor: pointer; text-decoration: underline; padding: 4px; }
.login-link:hover { color: var(--text); }
.login-step { font-size: 17px; color: var(--text); margin: 0; }
.login-hint, .login-note, .login-status { font-size: 14px; color: var(--muted); margin: 0; }
.login-note { color: var(--text); }
.login-error { font-size: 14px; color: #f87171; margin: 0; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-form input { padding: 11px 12px; border-radius: 8px; border: 1px solid var(--n-border); background: var(--surface2); color: var(--text); font-size: 15px; }
.login-form input:focus { outline: none; border-color: var(--n-blue); box-shadow: 0 0 0 3px var(--n-ring); }
.login-qr { background: #fff; border-radius: 8px; padding: 10px; width: 200px; height: 200px; margin: 4px auto 0; }
.login-qr svg { width: 100%; height: 100%; display: block; }

.pw-overlay { position: fixed; inset: 0; background: var(--bg); z-index: 999; display: flex; align-items: center; justify-content: center; }

.user-panel { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 12px; margin: 0 8px 8px; border-bottom: 1px solid var(--border); font-size: 13px; }
.user-panel-name { color: var(--text); text-decoration: none; font-weight: 600; flex: 1 1 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-panel-link { color: var(--muted); text-decoration: none; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.user-panel-name:hover, .user-panel-link:hover, .user-panel .active { color: var(--n-blue); }

.no-access { max-width: 460px; margin: 60px auto; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.no-access-icon { font-size: 40px; }
.no-access h2 { margin: 0; }
.no-access p { color: var(--muted); margin: 0; }
.no-access .n-input, .admin-page .n-input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--n-border); background: var(--surface2); color: var(--text); font: inherit; resize: vertical; box-sizing: border-box; }
.no-access-status { color: var(--text) !important; }
.n-btn { padding: 8px 14px; border-radius: 6px; border: 1px solid var(--n-border); background: var(--surface2); color: var(--text); font: inherit; font-size: 14px; cursor: pointer; }
.n-btn:hover { background: var(--n-hover); }
.n-btn:disabled { opacity: .5; cursor: default; }
.n-btn--primary { background: var(--n-blue); border-color: var(--n-blue); color: #fff; }
.n-btn--primary:hover { background: var(--n-blue-hover); }
.n-btn--danger { border-color: #7f1d1d; color: #fca5a5; }

.portal-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--n-panel); color: var(--text); border: 1px solid var(--n-border); border-radius: 8px; padding: 10px 16px; font-size: 14px; z-index: 1000; box-shadow: 0 6px 24px rgba(0,0,0,.4); }
.private-index { line-height: 2; }
.plan-me-static { font-weight: 600; color: var(--text); }

/* ── Админка (#admin, app/admin.js; переделка 02.12.2026) ──
   Классы с префиксом adm-. Правила внутри страницы привязаны к #page.admin-page:
   иначе их перебивают общие правила markdown (#page a, #page table, #page h3).
   Окна, уведомления и выпадающие списки живут и на странице, и в <body>, поэтому
   их правила без привязки к #page. */
.n-btn--sm { padding: 4px 10px; font-size: 12.5px; border-radius: 5px; }
.n-btn--danger:hover { background: rgba(248, 113, 113, .1); border-color: #f87171; }
.n-btn--dangerfill { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.n-btn--dangerfill:hover { background: #991b1b; }
.n-btn:focus-visible, .adm-icon-btn:focus-visible, .adm-seg button:focus-visible, .adm-seg a:focus-visible, .adm-tab:focus-visible { outline: 2px solid var(--n-blue); outline-offset: 1px; }

#page.admin-page { max-width: 1240px; padding-top: 32px; }
#page.admin-page h1 { margin: 0; }
#page.admin-page h3 { margin: 0; font-size: 15px; }
#page.admin-page p { margin: 0; font-size: 14px; line-height: 1.55; }
#page.admin-page code { font-size: 12.5px; }

.adm-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 16px; }
.adm-stepup { font-size: 12.5px; color: var(--muted); }

.adm-tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.adm-tabs::-webkit-scrollbar { display: none; }
#page .adm-tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; margin-bottom: -1px; color: var(--muted); font-size: 14px; white-space: nowrap; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; }
#page .adm-tab:hover { color: var(--text); text-decoration: none; background: var(--n-hover); }
#page .adm-tab.is-active { color: var(--text); font-weight: 600; border-bottom-color: var(--n-blue); }
.adm-tabs-sep { flex: 0 0 1px; height: 18px; background: var(--border); margin: 0 10px; }
.adm-badge { min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px; background: var(--planned); color: #1a1205; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }

.adm-body { display: flex; flex-direction: column; gap: 16px; }
.adm-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; }
.adm-toolbar--sub { margin-bottom: 10px; }
.adm-spacer { flex: 1 1 auto; }
#page .adm-lead, .adm-lead { color: var(--muted); font-size: 13.5px; max-width: 820px; }
.adm-lead--flat { flex: 1 1 420px; }
#page .adm-footnote { color: var(--muted); font-size: 12.5px; }
.adm-muted { color: var(--muted); }
.adm-warn { color: #fbbf24 !important; }
.adm-sub { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.adm-count { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 5px; border-radius: 8px; background: rgba(255,255,255,.07); color: var(--muted); font-size: 11.5px; font-weight: 500; text-align: center; line-height: 17px; }
.adm-nowrap { white-space: nowrap; }

/* Поля ввода */
.adm-input { width: 100%; height: 34px; padding: 6px 10px; border-radius: 6px; border: 1px solid var(--n-border); background: rgba(0,0,0,.25); color: var(--text); font: inherit; font-size: 13.5px; color-scheme: dark; transition: border-color .15s, box-shadow .15s; }
.adm-input:focus { outline: none; border-color: var(--n-blue); box-shadow: 0 0 0 2px var(--n-ring); }
.adm-input::placeholder { color: #666; }
.adm-input--date { width: auto; min-width: 150px; }
.adm-search { width: 280px; max-width: 100%; }

/* Сегменты: фильтры-ссылки и выбор варианта */
.adm-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 8px; background: rgba(255,255,255,.04); border: 1px solid var(--n-border); }
.adm-seg button, #page .adm-seg a { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 6px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
.adm-seg button:hover, #page .adm-seg a:hover { color: var(--text); background: var(--n-hover); text-decoration: none; }
.adm-seg .is-on, #page .adm-seg a.is-on { background: var(--surface2); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 0 0 1px var(--n-border); }
#page .adm-seg a.is-attn .adm-count { background: var(--planned); color: #1a1205; font-weight: 700; }

/* Выпадающий список с поиском */
.adm-select { min-width: 200px; }
.adm-select .n-select-btn { height: 34px; padding: 6px 10px; }
.adm-select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-select-label.is-empty { color: #777; }
.adm-select .n-menu { min-width: 100%; width: max-content; max-width: min(460px, 90vw); max-height: 320px; padding: 4px; display: flex; flex-direction: column; }
.adm-select .n-menu[hidden] { display: none !important; }
.adm-select .n-menu.is-up { top: auto; bottom: calc(100% + 4px); }
.adm-menu-list { overflow-y: auto; }
.adm-menu-search { margin: 2px 2px 6px; padding: 6px 9px; border-radius: 5px; border: 1px solid var(--n-border); background: rgba(0,0,0,.3); color: var(--text); font: inherit; font-size: 13px; }
.adm-menu-search:focus { outline: none; border-color: var(--n-blue); }
.adm-menu-group { padding: 8px 10px 3px; font-size: 10.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.adm-menu-empty { padding: 8px 10px; font-size: 13px; color: var(--muted); }
.adm-select .n-option { justify-content: space-between; gap: 16px; }
.adm-select .n-option.is-selected { background: rgba(35,131,226,.16); }
.adm-option-hint { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* Таблицы в рамке */
.adm-panel { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow-x: auto; }
#page.admin-page .adm-table { width: 100%; margin: 0; border-collapse: collapse; font-size: 13.5px; }
#page.admin-page .adm-table th { padding: 9px 12px; background: rgba(255,255,255,.02); border: 0; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: 0; white-space: nowrap; }
#page.admin-page .adm-table td { padding: 10px 12px; border: 0; border-bottom: 1px solid var(--border); vertical-align: middle; background: none; }
#page.admin-page .adm-table tbody tr:last-child td { border-bottom: 0; }
#page.admin-page .adm-table tr:nth-child(even) td { background: none; }
#page.admin-page .adm-table tr.adm-click { cursor: pointer; }
#page.admin-page .adm-table tr.adm-click:hover td, #page.admin-page .adm-table tr.adm-click:focus-visible td { background: var(--n-hover); }
#page.admin-page .adm-table tr.adm-click:focus-visible { outline: none; }
#page.admin-page .adm-table tr.is-fail td:first-child { box-shadow: inset 3px 0 0 #f87171; }
#page.admin-page .adm-table tr.is-current td { background: rgba(35,131,226,.06); }
#page.admin-page .adm-table--muted td { color: var(--muted); font-size: 13px; }
#page.admin-page .adm-table--audit td { vertical-align: top; }
.adm-cell-act { text-align: right; white-space: nowrap; width: 1%; }
.adm-cell-act .n-btn + .n-btn { margin-left: 6px; }
.adm-chev { color: #555; font-size: 20px; line-height: 1; }
.adm-ev { font-weight: 500; }
.adm-code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11px; color: #666; }

/* Люди, метки, пилюли */
.adm-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.adm-who-text { min-width: 0; }
.adm-name { font-weight: 600; }
#page.admin-page .adm-table--users td:first-child { min-width: 230px; }
#page.admin-page .adm-table--users td[data-label="Активность"], #page.admin-page .adm-table--users td[data-label="Группы"] { white-space: nowrap; }
.adm-avatar { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; }
.adm-tag { display: inline-block; padding: 0 7px; border-radius: 9px; border: 1px solid var(--n-border); color: var(--muted); font-size: 11px; font-weight: 500; line-height: 17px; vertical-align: 1px; white-space: nowrap; }
.adm-tag--accent { border-color: rgba(35,131,226,.5); color: #7db8f0; }
.adm-pill { display: inline-block; margin: 1px 4px 1px 0; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 500; white-space: nowrap; background: rgba(255,255,255,.06); color: var(--text); }
.adm-pill[data-v="active"] { background: rgba(74,222,128,.12); color: #86efac; }
.adm-pill[data-v="pending"] { background: rgba(245,158,11,.15); color: #fcd34d; }
.adm-pill[data-v="blocked"] { background: rgba(248,113,113,.13); color: #fca5a5; }
.adm-pill[data-v="admin"] { background: rgba(124,106,247,.18); color: #b4a9ff; }
.adm-pill[data-v="doc"] { background: rgba(96,165,250,.13); color: #93c5fd; }
.adm-chip { display: inline-flex; align-items: center; gap: 4px; margin: 2px 4px 2px 0; padding: 1px 8px; border-radius: 5px; background: rgba(255,255,255,.06); font-size: 12.5px; white-space: nowrap; }
.adm-chip--tg { background: rgba(56,189,248,.12); color: #7dd3fc; }
.adm-chip--wait { background: rgba(245,158,11,.12); color: #fcd34d; }
.adm-chip--warn { background: rgba(248,113,113,.12); color: #fca5a5; }
.adm-chip--person { padding-right: 3px; }
.adm-chip button, .adm-gchip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 11px; padding: 1px 4px; border-radius: 4px; line-height: 1.2; }
.adm-chip button:hover, .adm-gchip button:hover { color: #fca5a5; background: rgba(248,113,113,.12); }
.adm-chips { display: flex; flex-wrap: wrap; gap: 2px 0; align-items: center; }
.adm-perm { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11.5px; background: rgba(255,255,255,.07); color: var(--muted); white-space: nowrap; }
.adm-perm[data-perm="edit"] { background: rgba(124,106,247,.18); color: #c4b5fd; }
.adm-space { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11px; background: rgba(255,255,255,.06); color: var(--muted); }
.adm-space[data-space="private"] { color: #fca5a5; }
.adm-icon-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 4px 7px; border-radius: 5px; line-height: 1; }
.adm-icon-btn:hover { background: var(--n-hover); color: var(--text); }
.adm-icon-btn--danger:hover { background: rgba(248,113,113,.12); color: #fca5a5; }
.adm-text-btn { border: 0; background: none; color: var(--muted); font: inherit; font-size: 12.5px; cursor: pointer; padding: 3px 7px; border-radius: 5px; }
.adm-text-btn:hover { color: var(--text); background: var(--n-hover); }
.adm-text-btn--danger:hover { color: #fca5a5; background: rgba(248,113,113,.12); }

/* Карточки и пустые состояния */
.adm-card { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.adm-card-head { display: flex; align-items: center; gap: 8px; }
.adm-card--note { flex-direction: row; display: block; color: var(--muted); font-size: 13.5px; }
.adm-card--note b { color: var(--text); }
.adm-card--danger { border-color: rgba(248,113,113,.3); }
.adm-empty { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 40px 20px; border: 1px dashed var(--border); border-radius: 10px; text-align: center; color: var(--muted); font-size: 13.5px; }
.adm-empty b { color: var(--text); font-size: 14.5px; }
.adm-empty--inline { border: 0; border-radius: 0; padding: 26px 20px; }
.adm-label { font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.adm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; align-items: start; }
.adm-add .adm-select { width: 260px; max-width: 100%; }
.adm-add .n-select-btn { border-style: dashed; background: none; color: var(--muted); }
.adm-details > summary { cursor: pointer; color: var(--muted); font-size: 13.5px; padding: 6px 0; }
.adm-details > summary:hover { color: var(--text); }
.adm-details .adm-panel { margin-top: 8px; }
.adm-more { display: flex; justify-content: center; padding: 4px 0; font-size: 13px; }
.adm-btnrow { display: flex; flex-wrap: wrap; gap: 8px; }
.adm-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; justify-content: space-between; min-height: 30px; }

/* Списки строк: доступы, сессии, права группы */
.adm-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border); border-radius: 8px; }
.adm-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto 30px; align-items: center; gap: 10px; padding: 7px 6px 7px 12px; border-bottom: 1px solid var(--border); font-size: 13.5px; margin: 0; }
.adm-list li:last-child { border-bottom: 0; }
.adm-list li.is-expired { opacity: .55; }
.adm-list li .adm-muted { font-size: 12.5px; }
.adm-list--sess li { grid-template-columns: minmax(0, 1fr) auto auto; }
.adm-list--compact li { padding-top: 5px; padding-bottom: 5px; }
.adm-list-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#page.admin-page .adm-list { margin: 0; }
#page.admin-page .adm-list li { margin: 0; font-size: 13.5px; line-height: 1.45; }

/* Заявки */
.adm-reqs { display: flex; flex-direction: column; gap: 12px; }
.adm-req-head { display: flex; align-items: center; gap: 10px; }
.adm-req-what { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; line-height: 1.5; }
.adm-req-what .adm-pill { flex: 0 0 auto; }
.adm-quote { margin: 0; padding: 8px 12px; border-left: 3px solid var(--n-border); background: rgba(255,255,255,.03); border-radius: 0 6px 6px 0; color: #cfcfcf; font-size: 13.5px; white-space: pre-wrap; }
#page.admin-page .adm-quote { margin: 0; }
.adm-req-actions, .adm-req-deny { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 4px; }
.adm-req-deny .adm-input { flex: 1 1 260px; }
.adm-mini { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }

/* Доступы: документы */
.adm-doc-group-title { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; padding: 8px 14px; background: #1f1f1f; border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; letter-spacing: .03em; color: var(--muted); }
.adm-doc { display: grid; grid-template-columns: minmax(220px, 1.1fr) minmax(0, 1.6fr) auto; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.adm-doc:hover { background: rgba(255,255,255,.02); }
.adm-doc-group:last-of-type .adm-doc:last-child { border-bottom: 0; }
#page .adm-doc-title { color: var(--text); font-weight: 500; margin-right: 6px; }
#page .adm-doc-title:hover { color: var(--active); }
.adm-doc-main .adm-tag { margin-right: 4px; }
.adm-doc-grants { display: flex; flex-wrap: wrap; gap: 4px; font-size: 13px; }
.adm-gchip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 3px 2px 9px; border-radius: 6px; background: rgba(255,255,255,.05); border: 1px solid var(--n-border); font-size: 12.5px; white-space: nowrap; }
.adm-gchip.is-expired { opacity: .5; text-decoration: line-through; }

/* Фильтры журнала */
.adm-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.adm-filters label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.adm-filters .adm-select { min-width: 220px; }

/* Настройки */
.adm-settings { gap: 0; padding-bottom: 6px; }
.adm-settings h3 { margin-bottom: 4px !important; }
.adm-set { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.adm-set:last-child { border-bottom: 0; }
.adm-set-text { max-width: 640px; }
.adm-set-text b { font-weight: 600; font-size: 14px; }
#page.admin-page .adm-set-text p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.adm-set-ctl { flex: 0 0 auto; padding-top: 2px; }
.adm-set-ctl .adm-select { min-width: 220px; }
.adm-toggle { position: relative; display: inline-block; width: 40px; height: 22px; cursor: pointer; }
.adm-toggle input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.adm-toggle-ui { position: absolute; inset: 0; border-radius: 11px; background: #3a3a3a; transition: background .15s; pointer-events: none; }
.adm-toggle-ui::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.adm-toggle input:checked + .adm-toggle-ui { background: var(--n-blue); }
.adm-toggle input:checked + .adm-toggle-ui::after { transform: translateX(18px); }
.adm-toggle input:focus-visible + .adm-toggle-ui { box-shadow: 0 0 0 2px var(--n-ring); }
.adm-toggle input:disabled + .adm-toggle-ui { opacity: .5; }

/* Подсказки и секреты */
.adm-hint { margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.adm-hint--box { margin: 4px 0 0; padding: 9px 12px; border-radius: 7px; background: rgba(35,131,226,.08); border: 1px solid rgba(35,131,226,.25); color: #b9d6f2; font-size: 12.5px; }
.adm-hint--warn { margin-top: 8px; padding: 8px 11px; border-radius: 7px; background: rgba(245,158,11,.08); border: 1px solid rgba(245,158,11,.3); color: #fcd34d; }
.adm-secret { margin-top: 10px; padding: 10px 12px; border-radius: 8px; border: 1px dashed rgba(35,131,226,.45); background: rgba(35,131,226,.06); }
.adm-secret-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 13px; }
.adm-secret code { display: block; padding: 0; background: none; color: #e8e8e8; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12.5px; word-break: break-all; user-select: all; }
.adm-p { margin: 0; font-size: 13.5px; line-height: 1.55; }

/* Окна */
.adm-overlay { position: fixed; inset: 0; z-index: 400; display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px 40px; overflow-y: auto; background: rgba(0,0,0,.6); animation: adm-fade .12s ease-out; }
.adm-modal { width: 580px; max-width: 100%; background: var(--n-panel); border: 1px solid var(--n-border); border-radius: 12px; box-shadow: 0 24px 70px rgba(0,0,0,.6); color: var(--text); font-size: 14px; line-height: 1.5; animation: adm-rise .14s ease-out; }
.adm-modal--wide { width: 780px; }
.adm-modal--small { width: 460px; }
.adm-modal-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 0 22px; }
.adm-kicker { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.adm-x { border: 0; background: none; color: var(--muted); font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 5px; line-height: 1; }
.adm-x:hover { color: var(--text); background: var(--n-hover); }
.adm-modal-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 2px 22px 0; font-size: 21px; font-weight: 600; line-height: 1.3; }
.adm-modal-title .adm-pill { font-size: 12px; }
.adm-modal-body { padding: 14px 22px 20px; display: flex; flex-direction: column; gap: 12px; }
.adm-sec { padding: 14px 0 4px; border-top: 1px solid var(--n-border); display: flex; flex-direction: column; gap: 8px; }
.adm-sec:first-child { border-top: 0; padding-top: 2px; }
.adm-sec h3 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; }
.adm-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.adm-sec--danger .adm-danger-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 12px; border: 1px solid rgba(248,113,113,.22); border-radius: 8px; }
.adm-sec--danger .adm-danger-row:empty { display: none; }
.adm-danger-row > div:first-child { display: flex; flex-direction: column; font-size: 13.5px; }
.adm-danger-row > div:first-child span { color: var(--muted); font-size: 12.5px; }
.adm-props { display: flex; flex-direction: column; gap: 4px; }
.adm-prop { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; align-items: start; padding: 3px 0; }
.adm-prop-label { padding-top: 7px; font-size: 13px; color: var(--muted); }
.adm-prop-value { min-width: 0; padding-top: 2px; }
.adm-prop-value > span:first-child:not(.adm-select-label) { display: inline-block; padding-top: 4px; }
.adm-checks { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.adm-checks--col { flex-direction: column; gap: 4px; }
.adm-check { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 8px; border-radius: 6px; border: 1px solid var(--n-border); font-size: 13px; cursor: pointer; user-select: none; }
.adm-check:hover { background: var(--n-hover); }
.adm-check:has(input:checked) { border-color: rgba(35,131,226,.6); background: rgba(35,131,226,.1); }
.adm-check input { accent-color: var(--n-blue); margin: 0; }
.adm-check--plain, .adm-check--plain:has(input:checked) { border: 0; background: none; padding: 0; color: var(--muted); }
.adm-check--plain:hover { background: none; color: var(--text); }
.adm-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 10px; }
.adm-foot--left { justify-content: flex-start; margin-top: 8px; }
.adm-foot--left .adm-muted { font-size: 12.5px; }
@keyframes adm-fade { from { opacity: 0; } }
@keyframes adm-rise { from { opacity: 0; transform: translateY(8px); } }

/* Уведомления */
.adm-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none; }
.adm-toast { max-width: 420px; padding: 10px 14px 10px 12px; border-radius: 8px; background: var(--n-panel); border: 1px solid var(--n-border); border-left: 3px solid var(--done); box-shadow: 0 8px 28px rgba(0,0,0,.45); color: var(--text); font-size: 13.5px; line-height: 1.45; animation: adm-rise .16s ease-out; transition: opacity .3s, transform .3s; }
.adm-toast--err { border-left-color: #f87171; }
.adm-toast.is-out { opacity: 0; transform: translateY(6px); }

/* Узкий экран: строки таблиц — карточками, свойства — в столбик */
@media (max-width: 860px) {
  .adm-doc { grid-template-columns: minmax(0, 1fr) auto; }
  .adm-doc-grants { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 760px) {
  #page.admin-page { padding-top: 20px; }
  .adm-search { width: 100%; }
  .adm-grid { grid-template-columns: minmax(0, 1fr); }
  #page.admin-page .adm-table thead { display: none; }
  #page.admin-page .adm-table, #page.admin-page .adm-table tbody, #page.admin-page .adm-table tr, #page.admin-page .adm-table td { display: block; width: auto; }
  #page.admin-page .adm-table tr { position: relative; padding: 10px 14px; border-bottom: 1px solid var(--border); }
  #page.admin-page .adm-table tbody tr:last-child { border-bottom: 0; }
  #page.admin-page .adm-table td { padding: 2px 0; border: 0; }
  #page.admin-page .adm-table td[data-label]::before { content: attr(data-label) ': '; color: var(--muted); font-size: 12px; }
  .adm-cell-act { text-align: left; width: auto; padding-top: 8px !important; }
  .adm-chev { position: absolute; right: 14px; top: 14px; }
  .adm-prop { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .adm-prop-label { padding-top: 0; }
  .adm-set { flex-direction: column; gap: 10px; }
  .adm-list li { grid-template-columns: minmax(0, 1fr) auto 30px; }
  .adm-list li > .adm-muted { grid-column: 1 / -1; grid-row: 2; }
  .adm-list--sess li { grid-template-columns: minmax(0, 1fr) auto; }
  .adm-danger-row { flex-direction: column; align-items: flex-start !important; }
  .adm-overlay { padding: 0; }
  .adm-modal { border-radius: 0; min-height: 100%; }
  .adm-toasts { left: 12px; right: 12px; align-items: stretch; }
  .adm-req-actions .adm-spacer { display: none; }
  .adm-req-actions > .n-btn { flex: 1 1 40%; }
}

/* ── План: карточки ТЗ раскрываются явно, готовность и исполнители выбираются, комментарии (12.2026) ── */
#page .plan-tz > summary { grid-template-columns: 26px 48px 120px minmax(0, 1fr) 156px; border-radius: 10px; transition: background .12s; }
#page .plan-tz--mgmt > summary { grid-template-columns: 26px 48px minmax(0, 1fr); }
#page .plan-tz > summary:hover { background: var(--surface2); }
#page .plan-tz[open] > summary { border-bottom: 1px solid var(--border); border-radius: 10px 10px 0 0; }
#page .plan-tz-chev {
  width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center; background: rgba(255,255,255,.03);
}
#page .plan-tz-chev::before {
  content: ''; width: 7px; height: 7px; margin-left: -3px;
  border-right: 2px solid #bdbdbd; border-bottom: 2px solid #bdbdbd; transform: rotate(-45deg); transition: transform .15s;
}
#page .plan-tz > summary:hover .plan-tz-chev { border-color: #5a5a5a; }
#page .plan-tz[open] > summary .plan-tz-chev::before { transform: rotate(45deg); margin: -4px 0 0 0; }
#page .plan-tz-hint { align-self: center; color: var(--muted); font-size: 12px; margin-left: 4px; }
#page .plan-cmt-count { color: #c4b5fd; }

/* Готовность: точка и цвет по значению */
#page .plan-ready::before { content: '●'; margin-right: 5px; font-size: 9px; vertical-align: 1px; }
#page .plan-ready[data-r="none"]::before { content: none; }
#page .plan-ready[data-r="unclear"]  { color: #cbd5e1; }
#page .plan-ready[data-r="research"] { color: #fcd34d; }
#page .plan-ready[data-r="solution"] { color: #93c5fd; }
#page .plan-ready[data-r="ready"]    { color: #86efac; }
#page .plan-readycell .plan-dd { width: 156px; }

/* Исполнители: чипы в кнопке, меню с отметками */
#page .plan-whodd { width: auto; min-width: 150px; }
#page .plan-whodd .plan-who-btn {
  width: 100%; display: flex; flex-wrap: wrap; justify-content: flex-start; align-items: center;
  text-align: left; white-space: normal; min-height: 28px;
}
#page .plan-whodd .plan-chip { margin: 1px 4px 1px 0; }
#page .plan-who-empty { color: var(--muted); font-size: 12.5px; border-bottom: 1px dashed #555; }
#page .plan-whodd .n-menu { width: 250px; max-height: 320px; overflow-y: auto; }
#page .plan-who-opt { display: flex; align-items: center; gap: 8px; }
#page .plan-check {
  width: 14px; height: 14px; border-radius: 4px; border: 1px solid #5a5a5a; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; line-height: 1;
}
#page .plan-who-opt.is-on .plan-check { background: #7c6af7; border-color: #7c6af7; color: #fff; }
#page .plan-who-opt.is-on .plan-check::before { content: '✓'; }

/* Комментарии к ТЗ */
#page .plan-cmts { margin-top: 18px; }
#page .plan-cmt-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
#page .plan-cmt { border-left: 2px solid #3a3a3a; padding: 4px 0 4px 12px; }
#page .plan-cmt-head { display: flex; gap: 10px; align-items: baseline; font-size: 12.5px; color: var(--muted); }
#page .plan-cmt-head b { color: #e5e5e5; font-weight: 600; }
#page .plan-cmt-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; margin-top: 2px; }
#page .plan-cmt-del { font: inherit; font-size: 12px; color: var(--muted); background: none; border: none; cursor: pointer; padding: 0; margin-left: auto; }
#page .plan-cmt-del:hover { color: #fca5a5; }
#page .plan-cmt-empty { color: var(--muted); font-size: 13px; margin: 0 0 10px; }
#page .plan-cmt-form { display: flex; gap: 8px; align-items: flex-end; }
#page .plan-cmt-form textarea {
  flex: 1; font: inherit; font-size: 14px; color: #e5e5e5; resize: vertical; min-height: 40px;
  background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
#page .plan-cmt-form textarea:focus { outline: none; border-color: #7c6af7; }

@media (max-width: 900px) {
  #page .plan-tz > summary, #page .plan-tz--mgmt > summary { display: flex; flex-wrap: wrap; gap: 6px 10px; }
  #page .plan-tz-hint { display: none; }
  #page .plan-cmt-form { flex-direction: column; align-items: stretch; }
}
