:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --border: #e3e6ea;
  --text: #1a1d21;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --danger: #dc2626;
  --status-todo: #6b7280;
  --status-in_progress: #2563eb;
  --status-review: #d97706;
  --status-done: #16a34a;
  --prio-low: #6b7280;
  --prio-normal: #2563eb;
  --prio-high: #dc2626;
  --vacation: #0d9488;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

main { max-width: 1600px; margin: 24px auto 48px; padding: 0 16px; }
h1 { font-size: 24px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 24px 0; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  /* Контекст для absolute-панели #topbar-menu (десктоп и мобильный) */
  position: relative;
}
.brand { font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.brand-logo { height: 24px; width: auto; }
.topbar nav { display: flex; gap: 2px; }
.topbar nav a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--muted); text-decoration: none;
  padding: 6px 12px; border-radius: 8px; font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.topbar nav a:hover { background: #f0f2f5; color: var(--text); }
.topbar nav a.active { background: var(--accent); color: #fff; }
.topbar nav a.active:hover { background: var(--accent-hover); color: #fff; }
/* Бургер: на ≤768px открывает полноширинное меню, на ≥769px — компактную
   панель с переносимыми пунктами (показ/скрытие пунктов — CSS в медиа-блоках) */
.burger {
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  border: none; border-radius: 8px; background: transparent;
  color: var(--text); cursor: pointer;
}
.burger:hover { background: #f0f2f5; }
.burger svg { display: block; }
.burger .burger-x { display: none; }
.burger.open .burger-x { display: block; }
.burger.open .burger-bars { display: none; }
/* Пункты, которые на ≥769px уходят из ряда шапки в бургер-панель (в ряду скрыты).
   Специфичность должна бить `.topbar nav a { display: inline-flex }` (см. ниже).
   На ≤768px показываются в полноширинной панели — см. мобильный блок ниже. */
.topbar nav .topbar-overflow { display: none; }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  flex: 1 1 220px; max-width: 340px;
  /* min-width: 0 — иначе авт. минимум flex-элемента = min-content, а input
     (type=search) имеет внутреннюю ширину ~20 символов → форма не сжимается
     ниже ~220px и топбар переполняется на 769–900px. Внутри input уже
     min-width: 0, так что форма деградирует до «иконка + ужатый инпут». */
  min-width: 0;
  background: #fafbfc; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 12px; color: var(--muted);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.topbar-search:focus-within {
  border-color: var(--accent); background: #fff; color: var(--text);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.topbar-search input {
  border: none; background: transparent; outline: none; flex: 1; min-width: 0;
  font: inherit; font-size: 14px; color: var(--text); padding: 0;
}
.topbar-search input::placeholder { color: var(--muted); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user-link {
  display: inline-flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--text); font-size: 14px;
}
.topbar-user-link:hover { color: var(--accent); }
.topbar-user-link:hover .avatar-fallback { opacity: 0.85; }

/* Колокольчик уведомлений в шапке: только иконка + счётчик непрочитанных,
   без текстовой подписи (подпись — в title/aria-label).
   Поллинг фрагмента и OOB-замены из действий чтения — см. partial. */
.notifications-bell {
  position: relative;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: 14px;
  white-space: nowrap;
}
.notifications-bell:hover { background: #f0f2f5; color: var(--text); }
.bell-badge {
  position: absolute; top: -5px; right: -5px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--card);
}
/* Пункт «Уведомления» навигации: виден только в мобильном бургер-меню
   (на десктопе единственная точка входа — колокольчик). Специфичность
   должна бить `.topbar nav a { display: inline-flex }`. */
.topbar nav .nav-notifications { display: none; }

/* Table */
.table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.table th, .table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #fafbfc; font-weight: 600; color: var(--muted); font-size: 13px; }
.table tr:last-child td { border-bottom: none; }
.table a { color: var(--accent); text-decoration: none; }
.table a:hover { text-decoration: underline; }

/* Badges */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  color: #fff;
}
.status-todo { background: var(--status-todo); }
.status-in_progress { background: var(--status-in_progress); }
.status-review { background: var(--status-review); }
.status-done { background: var(--status-done); }
.status-archived { background: var(--muted); }
.badge-archived { background: var(--muted); }
.badge-version { background: var(--muted); }
.badge-vacation { background: var(--vacation); }
.prio-low { background: var(--prio-low); }
.prio-normal { background: var(--prio-normal); }
.prio-high { background: var(--prio-high); }

/* Непрочитанные комментарии: бейдж «💬 N» на карточке доски и в строке
   списка (сколько ЧУЖИХ комментариев пользователь ещё не видел). */
.unread-comments {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 11.5px; font-weight: 600; line-height: 1.7;
  white-space: nowrap;
}
.tasks-table .col-title .unread-comments { margin-left: 6px; vertical-align: 1px; }

/* Совещания: бейджи статусов в списке и карточке */
.badge-meeting-scheduled { background: var(--accent); }
.badge-meeting-cancelled { background: var(--danger); }
.badge-meeting-finished { background: var(--muted); }
.meeting-title-cell .badge { margin-left: 8px; vertical-align: 2px; }
.meeting-date-cell { white-space: nowrap; }
/* Аватарки участников в списке: стопка с белой окантовкой */
.meeting-participants { display: inline-flex; align-items: center; }
.meeting-participants .avatar { margin-left: -7px; box-shadow: 0 0 0 2px #fff; }
.meeting-participants .avatar:first-child { margin-left: 0; }
.meeting-participant-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.meeting-card-actions { margin-top: 18px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); font: inherit; cursor: pointer; text-decoration: none;
}
.btn svg { display: block; flex-shrink: 0; }
.btn:hover { border-color: #c9cfd6; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--accent); padding: 4px 8px; }
.btn-sm { font-size: 13px; }

/* Заблокированная кнопка (.btn:disabled): полупрозрачность + курсор not-allowed +
   приглушённая рамка — кнопка читается «погашенной». hover/active не меняют вид:
   .btn:hover (border-color), .btn-primary:hover / .btn-danger:hover (фон) перекрыты
   явно, иначе заблокированная кнопка «подсвечивается» при наведении (браузеры
   применяют :hover и к disabled-кнопкам). У ghost рамка остаётся прозрачной. */
.btn:disabled,
.btn:disabled:hover,
.btn:disabled:active {
  opacity: 0.55;
  cursor: not-allowed;
  border-color: #d6dade;
}
.btn-primary:disabled:hover,
.btn-primary:disabled:active { background: var(--accent); }
.btn-danger:disabled:hover,
.btn-danger:disabled:active { background: var(--danger); }
.btn-ghost:disabled,
.btn-ghost:disabled:hover,
.btn-ghost:disabled:active { border-color: transparent; background: transparent; }

/* Прогресс загрузки файлов (XHR-отправка форм с вложениями): индикатор
   «Загрузка… N%» с прогресс-баром рядом с кнопкой отправки. Живёт своей
   строкой после ряда кнопок (app.js, uploadIndicator) — не flex-элемент
   ряда, чтобы не разъезжались кнопки. На узких экранах не переполняет:
   бар фиксированный 90px, текст переносится. */
.upload-progress {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted);
  margin-top: 6px; max-width: 100%;
}
.upload-progress-bar {
  display: block; width: 90px; height: 6px; flex-shrink: 0;
  background: #eef0f3; border-radius: 999px; overflow: hidden;
}
.upload-progress-fill {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: 999px;
  transition: width 0.15s ease;
}
.upload-progress-fill.indeterminate {
  width: 40% !important;
  background: linear-gradient(90deg, #d8e2f3 25%, var(--accent) 50%, #d8e2f3 75%);
  background-size: 200% 100%;
  animation: upload-stripes 1.1s linear infinite;
}
@keyframes upload-stripes {
  from { background-position: 100% 0; }
  to { background-position: 0 0; }
}
/* Ошибка отправки (обрыв сети / ошибка сервера) — на месте индикатора. */
.upload-error { margin: 4px 0 0; font-size: 13px; }
.comment-form .upload-progress,
.comment-form .upload-error { align-self: flex-end; }

/* Блокировка формы на время XHR-загрузки файлов (app.js, uploadSetBusy):
   затенённые поля + курсор «ожидание» — видно, что форма занята и
   править её нельзя, пока файлы уезжают. */
form.is-uploading { cursor: wait; }
form.is-uploading input,
form.is-uploading textarea,
form.is-uploading select { opacity: 0.6; }

/* Project page */
.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.project-head-main { flex: 1; min-width: 0; }
.project-title-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.project-title-row h1 { margin: 0; }
.project-head-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Прогресс проекта: тонкая полоска (accent на сером фоне) + «N из M (K %)» */
.project-progress { max-width: 420px; margin-top: 10px; }
.progress {
  height: 6px; min-width: 120px;
  background: #eef0f3; border-radius: 999px; overflow: hidden;
}
.progress-bar { height: 100%; background: var(--accent); border-radius: 999px; }
.progress-text { display: block; margin-top: 4px; font-size: 12.5px; color: var(--muted); }
.tabs {
  display: inline-flex; gap: 4px; margin-bottom: 16px;
  background: #eef0f3; padding: 4px; border-radius: 12px;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 16px; text-decoration: none; color: var(--muted);
  border-radius: 9px; font-size: 14px; line-height: 1.4;
  transition: background 0.15s, color 0.15s;
}
.tab svg { display: block; opacity: 0.7; }
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--accent); color: #fff;
  font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.tab.active svg { opacity: 1; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 20px; z-index: 100; overflow-y: auto;
}
.modal-backdrop[hidden] { display: none; }
.modal-box {
  background: var(--card); border-radius: 10px; padding: 24px 32px;
  width: min(1280px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.modal-box h2 { margin: 0 0 16px; font-size: 20px; }

/* Confirm dialog (подтверждение удаления) */
.confirm-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 400;
}
.confirm-backdrop[hidden] { display: none; }
.confirm-box {
  background: var(--card); border-radius: 10px; padding: 24px 28px;
  width: min(420px, 100%); text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.confirm-icon {
  width: 44px; height: 44px; margin: 0 auto 12px;
  border-radius: 50%; background: #fee2e2; color: var(--danger);
  display: flex; align-items: center; justify-content: center;
}
.confirm-box h2 { margin: 0 0 8px; font-size: 18px; }
.confirm-message { margin: 0 0 20px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.confirm-warning {
  margin: -10px 0 16px; padding: 8px 12px;
  background: #fef3c7; border: 1px solid #fde68a; border-radius: 6px;
  color: #92400e; font-size: 13px; text-align: left;
}
.confirm-warning[hidden] { display: none; }
.confirm-actions { display: flex; gap: 8px; justify-content: center; }
.confirm-actions .btn { min-width: 96px; }
.confirm-actions .btn:disabled { opacity: 0.6; cursor: default; }
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* Lightbox (просмотр изображения с зумом) */
.lightbox-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(15, 23, 42, 0.9);
}
.lightbox-backdrop[hidden] { display: none; }
.lightbox-stage {
  position: absolute; inset: 0; overflow: auto;
  display: flex; padding: 48px 64px 88px;
}
.lightbox-img {
  display: block; margin: auto; /* центрирует при fit и не режет при переполнении */
  max-width: calc(100vw - 128px);
  max-height: calc(100vh - 136px);
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.lightbox-btn {
  position: absolute; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.14); color: #fff;
  cursor: pointer; transition: background 0.15s;
}
.lightbox-btn:hover { background: rgba(255, 255, 255, 0.28); }
.lightbox-close { top: 14px; right: 14px; }
/* Кнопки листания карусели: по центру слева/справа. Видны только при группе
   >1 фото (hidden снимает/ставит app.js); на краях — disabled, без зацикливания.
   Явное [hidden]-правило обязательно: .lightbox-btn задаёт display:flex, который
   перебивает UA-стиль hidden. */
.lightbox-nav { top: 50%; transform: translateY(-50%); }
.lightbox-nav[hidden] { display: none; }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-nav:disabled,
.lightbox-nav:disabled:hover { opacity: 0.35; cursor: default; background: rgba(255, 255, 255, 0.14); }
.lightbox-caption {
  position: absolute; top: 16px; left: 18px; z-index: 1;
  max-width: calc(100% - 90px);
  color: rgba(255, 255, 255, 0.92); font-size: 13px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Счётчик «N / M» внутри caption: перед именем файла, длинное имя режется
   многоточием, счётчик остаётся видимым */
.lightbox-counter {
  margin-right: 8px;
  color: rgba(255, 255, 255, 0.55);
  font-variant-numeric: tabular-nums;
}
.lightbox-counter[hidden] { display: none; }
.lightbox-toolbar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  z-index: 1; display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 24px;
  background: rgba(15, 23, 42, 0.65);
}
.lightbox-toolbar .lightbox-btn { position: static; }
.lightbox-zoom {
  min-width: 46px; text-align: center;
  color: #fff; font-size: 13px; font-variant-numeric: tabular-nums;
}

/* Task card */
/* Переносы строки бейджей и строки иконок на узких экранах: иконки
   при нехватке места уходят на свою строку (margin-left: auto держит их справа) */
.task-card-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.task-card-head { display: flex; gap: 8px; flex-wrap: wrap; }
.task-card-icons { display: flex; gap: 4px; align-items: center; margin-left: auto; }
.task-card-icons form { margin: 0; display: flex; }
/* Крупный хит-таргет у кнопок-иконок в шапке карточки (≥32px) —
   иконки 22px, чтобы по кнопкам было легко попадать курсором/пальцем.
   Глобальный .btn-icon при этом не меняется. */
.task-card-icons .btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; min-height: 34px; padding: 4px;
}
.task-card h2 { margin: 0 0 12px; font-size: 20px; overflow-wrap: anywhere; }
.task-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px 24px; margin: 0 0 12px; }
/* min-width: 0 — грид-элемент может быть уже своего контента (длинное имя
   с бейджем отпуска), иначе колонка раздувается и ломает всю сетку.
   flex-wrap + flex-basis: если значение не помещается рядом с подписью
   (узкая колонка), оно уходит на свою строку во всю ширину ячейки */
.task-meta div { display: flex; gap: 8px; min-width: 0; flex-wrap: wrap; }
.task-meta dt { color: var(--muted); }
.task-meta dd { margin: 0; font-weight: 500; min-width: 0; flex: 1 1 140px; }
.task-meta dd a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.task-meta dd a:hover { text-decoration: underline; }
.task-desc { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Секции карточки задачи — отдельные визуальные блоки */
.card-section {
  background: #fafbfc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px 14px;
  margin-top: 14px;
}
.card-section h3 {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 10px;
  font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted);
}
.card-section h3::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.card-section h3 .muted {
  font-weight: 400; text-transform: none; letter-spacing: normal; font-size: 12px;
}

/* Blockers */
.blocker-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.blocker-row a { color: var(--accent); text-decoration: none; min-width: 0; overflow-wrap: anywhere; }
.blocker-row a:hover { text-decoration: underline; }
.blocker-row form { margin-left: auto; }
.blocker-row.blocker-done { opacity: 0.55; }
.blocker-row.blocker-done a { color: var(--muted); text-decoration: line-through; }
.btn-icon {
  border: none; background: transparent; color: var(--muted);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px;
  border-radius: 6px; text-decoration: none;
}
.btn-icon svg { display: block; }
.btn-icon:hover { color: var(--danger); background: rgba(0,0,0,0.05); }
.btn-icon.icon-edit:hover, .btn-icon.icon-ics:hover { color: var(--accent); }
/* Кнопки-колокольчики (карточка задачи и шапка проекта): зелёный —
   уведомления приходят, красный перечёркнутый — отключены. Специфичность
   класса (0,3,0) выше, чем у .btn-icon:hover (0,2,0) — цвет состояния
   сохраняется при наведении. */
.task-subscription { display: inline-flex; align-items: center; }
.task-subscription .btn-icon.task-bell-on { color: var(--status-done); }
.task-subscription .btn-icon.task-bell-off { color: var(--danger); }
.blocker-form { display: flex; gap: 8px; margin-top: 8px; }
.blocker-form select {
  flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; background: #fff; color: var(--text);
}

/* Comments */
.comment-list { margin-bottom: 4px; }
.comment { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.comment:last-child { border-bottom: none; }
.comment-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.comment-author { font-weight: 600; }
.comment-head form { margin-left: auto; display: flex; }
.comment-head .btn-icon { font-size: 15px; }
/* Кнопка «Цитировать» — справа в шапке комментария; наведение акцентное
   (глобальный .btn-icon:hover красный — это семантика удаления). */
.comment-quote-btn { margin-left: auto; }
.btn-icon.comment-quote-btn:hover { color: var(--accent); }
.comment-text { margin-top: 2px; overflow-wrap: anywhere; }

/* Непрочитанный (чужой новый) комментарий в открытой карточке: заметная
   левая полоса и лёгкий фон; метка «новый» — в шапке рядом с автором.
   Подсветка живёт до первого «прокрутил до секции → прочитано». */
.comment-unread {
  background: #eff5ff;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 8px 10px;
}
.comment-new {
  padding: 0 7px; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}

/* Цитата (`> …`) в текстах карточки: приглушённый блок — светлый фон и
   полоса слева, без моноширинного шрифта и тёмной плашки (в отличие от
   .raw-block). Строки-цитаты собирает фильтр rendertext (text_render.py). */
.comment-quote {
  margin: 4px 0;
  padding: 5px 10px;
  background: var(--bg);
  border-left: 3px solid var(--border);
  border-radius: 0 8px 8px 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* Raw-блоки (```…``` / ~~~…~~~) в описании и комментариях — вид как у
   fenced-блоков кода wiki (тёмная плашка, моноширинный шрифт). Переводы
   строк сохраняются; длинные неразрывные строки переносятся (pre-wrap +
   anywhere: в Chrome 121+ `white-space: pre` = text-wrap-mode: nowrap —
   переносы не работают вообще). */
.raw-block {
  background: #1f2937; color: #e5e7eb; border-radius: 8px;
  padding: 12px 14px; margin: 0.8em 0;
  white-space: pre-wrap; overflow-x: auto; overflow-wrap: anywhere;
}
.raw-block code {
  background: none; padding: 0; color: inherit;
  font-family: var(--mono, monospace); font-size: 0.92em;
}
.comment-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.comment-form textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; color: var(--text); background: #fff;
  resize: vertical;
}
.comment-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.comment-form .btn { align-self: flex-end; }
.comment-form .errorlist { margin: 0; }
.comment-form .file-field { margin: 0; font-size: 13px; color: var(--muted); }
.comment-form .file-field input { margin-top: 4px; }
.comment-files { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; font-size: 13px; }
.comment-file { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; min-width: 0; }
.comment-file a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; min-width: 0; }
.comment-file a:hover { text-decoration: underline; }
.comment-file form { margin-left: auto; display: flex; }
.comment-file .btn-icon { font-size: 15px; }

/* Миниатюры изображений в комментариях */
.comment-file-image { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.comment-file-image .comment-file { width: 100%; }
.comment-thumb-link { display: block; line-height: 0; border-radius: 8px; }
.comment-thumb {
  display: block; max-width: 240px; max-height: 160px; width: auto; height: auto;
  border: 1px solid var(--border); border-radius: 8px;
  cursor: zoom-in; transition: border-color 0.15s;
}
.comment-thumb-link:hover .comment-thumb { border-color: var(--accent); }

/* Видео-плеер вложений (комментарии, описание задачи, записи учёта времени).
   Обёртка повторяет раскладку миниатюры изображения: плеер сверху, строка
   «имя + размер» под ним. Превью — того же формата, что миниатюры
   (max 240×160): ряды картинок и видео получаются одного роста. */
.attachment-video {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  max-width: 100%; min-width: 0;
}
.attachment-video .comment-file { width: 100%; }
.video-preview {
  position: relative; display: inline-block; max-width: 100%;
  line-height: 0;
}
.comment-video, .desc-video, .time-video {
  display: block; max-width: 240px; max-height: 160px; width: auto; height: auto;
  border: 1px solid var(--border); border-radius: 8px;
  background: #000;
}
.video-fullscreen-btn {
  position: absolute; top: 6px; right: 6px; z-index: 1;
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; padding: 0;
  border: none; border-radius: 6px;
  background: rgba(0, 0, 0, 0.55); color: #fff;
  cursor: pointer; transition: background 0.15s;
}
.video-fullscreen-btn:hover { background: rgba(0, 0, 0, 0.8); }
.video-fullscreen-btn svg { display: block; }

/* Превью изображений, вставленных из буфера (ожидают отправки формы).
   Блок общий для форм комментария и остановки таймера: JS вставляет его
   сразу под textarea. */
.clip-pending {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  margin: 2px 0 0;
}
.clip-pending-list { display: flex; gap: 8px; flex-wrap: wrap; }
.clip-pending-item { position: relative; line-height: 0; }
.clip-pending-item img,
.clip-pending-item video {
  width: 64px; height: 64px; object-fit: cover;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
  display: block;
}
.clip-pending-item video { cursor: default; }
/* Файлы без собственного превью (pdf, docx, zip…): иконка + имя + размер. */
.clip-pending-file {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; width: 64px; height: 64px; padding: 4px; box-sizing: border-box;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
  color: var(--muted); line-height: 1.2;
}
.clip-pending-file svg { flex-shrink: 0; }
.clip-pending-file-name {
  font-size: 10px; color: var(--text);
  max-width: 100%; overflow: hidden; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.clip-pending-file-size { font-size: 9px; line-height: 1; }
.clip-pending-remove {
  position: absolute; top: -7px; right: -7px;
  width: 19px; height: 19px; line-height: 1; padding: 0;
  border: 1px solid var(--border); border-radius: 50%;
  background: #fff; color: var(--muted); cursor: pointer;
  font-size: 14px; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.clip-pending-remove:hover { color: var(--danger); border-color: var(--danger); }
.clip-pending-count { font-size: 13px; color: var(--muted); align-self: center; }
.banner-stop-form .clip-pending { width: 100%; }

/* Time tracking */
.time-total { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.timer-running {
  background: #f0f7ff; border: 1px solid #b9d6f2; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 10px;
}
.timer-running-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 14px; }
.timer-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #2e9e44;
  animation: timer-pulse 1.2s ease-in-out infinite;
}
@keyframes timer-pulse { 50% { opacity: 0.25; } }
.timer-clock { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }
/* «Отменить» — второстепенное действие в строке таймера, в правом конце. */
.timer-cancel-form { display: flex; flex-shrink: 0; margin-left: auto; }
.timer-stop-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.timer-stop-form textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; color: var(--text); background: #fff;
  resize: vertical;
}
.timer-stop-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.timer-stop-form .file-field { margin: 0; font-size: 13px; color: var(--muted); }
.timer-stop-form .file-field input { margin-top: 4px; }
.timer-stop-form .errorlist { margin: 0; }
.timer-stop-actions { display: flex; justify-content: flex-end; }
.timer-start-form { margin-bottom: 10px; }
.time-entries { display: flex; flex-direction: column; }
.time-entry { padding: 8px 0; border-bottom: 1px dashed var(--border); }
.time-entry:last-child { border-bottom: none; }
.time-entry-running { border-left: 3px solid #2e9e44; padding-left: 8px; }
.time-entry-head { display: flex; align-items: baseline; gap: 8px; font-size: 13px; flex-wrap: wrap; }
.time-entry-user { font-weight: 600; }
.time-entry-head .badge { font-size: 11px; }
.time-entry-head form { margin-left: 0; display: flex; }
.time-entry-head .btn-icon { font-size: 15px; }
.time-entry-head > :last-child { margin-left: auto; }
.time-entry-duration { font-variant-numeric: tabular-nums; font-weight: 600; }
.time-entry-comment { margin-top: 2px; font-size: 13px; overflow-wrap: anywhere; }
.time-entry-files { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 12px; font-size: 13px; }
.time-entry-files a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; min-width: 0; }
.time-entry-files a:hover { text-decoration: underline; }

/* Плашка идущих таймеров (сверху каждой страницы, base.html) */
.running-timers {
  border: 1px solid #b9d6f2;
  border-left: 4px solid var(--accent);
  background: #f0f7ff;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 16px;
}
.running-timer {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px;
  font-size: 14px;
  padding: 2px 0;
}
.running-timer + .running-timer { border-top: 1px dashed #cfe2f5; }
.running-timer .timer-dot { width: 7px; height: 7px; flex-shrink: 0; }
.running-timer-task { font-weight: 600; color: var(--accent); text-decoration: none; }
.running-timer-task:hover { text-decoration: underline; }
.running-timer-project { font-size: 13px; }
.running-timer-clock { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.running-timer-actions { display: flex; gap: 4px; margin-left: auto; }
.running-timer-stop { display: flex; }
.running-timer-cancel { display: flex; }
.running-timer-actions .btn-sm { padding: 2px 10px; }

/* Компактная форма остановки в плашке: раскрывается по «Стоп», скрыта по умолчанию.
   flex-basis: 100% — форма всегда на отдельной строке записи (в т.ч. на мобильных). */
.banner-stop-form {
  flex-basis: 100%;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 8px 0 2px;
}
.banner-stop-form.open { display: flex; }
.banner-stop-form textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 6px; font: inherit; color: var(--text); background: #fff;
  resize: vertical;
}
.banner-stop-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.banner-stop-form .file-field { margin: 0; font-size: 13px; color: var(--muted); }
.banner-stop-form .file-field input { margin-top: 4px; max-width: 100%; }
.banner-stop-form .errorlist { margin: 0; }
.banner-stop-actions { display: flex; justify-content: flex-end; gap: 8px; }
.banner-error { margin: 0 0 6px; }
.banner-stop-error { margin: 0; }

/* Вкладка «Сейчас работают»: строка таблицы с живым счётчиком */
.working-clock { display: inline-flex; align-items: center; gap: 7px; }
.working-clock .timer-dot { width: 7px; height: 7px; flex-shrink: 0; }
.working-clock .timer-clock { font-size: 14px; }

/* Forms */
label { display: block; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
label input, label select, label textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px; font: inherit;
  color: var(--text); background: #fff;
}
label input:focus, label select:focus, label textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row > * { min-width: 0; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }
.errorlist { color: var(--danger); margin: 4px 0; padding: 0; list-style: none; font-size: 13px; }
.error { color: var(--danger); }
.field-hint { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Команда проекта в модалке формы проекта: список участников + автодополнение */
.team-section { margin-top: 4px; }
.team-members {
  list-style: none; margin: 0 0 8px; padding: 0;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}
.team-member {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
}
.team-member:last-child { border-bottom: none; }
.team-member-name { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.team-member-empty { color: var(--muted); font-size: 13px; }
.team-member-role {
  font-size: 12px; color: var(--muted);
  background: #eef0f3; border-radius: 10px; padding: 2px 8px; white-space: nowrap;
}
/* Бейджи/роль/крестик строки — группа справа: на широких экранах в одной
   строке с именем, на мобильных переносится под имя целиком (см. media) */
.team-member-tags {
  display: inline-flex; align-items: center; gap: 10px;
  margin-left: auto; flex-shrink: 0; min-width: 0;
}
.team-member-remove {
  flex-shrink: 0;
  width: 26px; height: 26px; border: none; border-radius: 6px;
  background: transparent; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.team-member-remove:hover { background: #fee2e2; color: var(--danger); }

/* Переиспользуемый компонент выбора пользователя (userPicker): поле ввода +
   выпадающий список с аватарками (команда проекта, руководитель и т. д.) */
.user-picker { position: relative; }
.user-picker-input {
  display: block; width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px; font: inherit;
  color: var(--text); background: #fff;
}
.user-picker-input:focus { outline: none; border-color: var(--accent); }
/* Выбранное значение: аватарка внутри поля, отступ под неё и под крестик сброса */
.user-picker-avatar {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  display: none; pointer-events: none;
}
.user-picker.has-value .user-picker-avatar { display: inline-flex; }
.user-picker.has-value .user-picker-input { padding-left: 38px; padding-right: 34px; }
.user-picker-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; padding: 0; border: none; border-radius: 50%;
  background: #eef0f3; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.user-picker-clear:hover { background: #fee2e2; color: var(--danger); }
.user-picker-clear[hidden] { display: none; }
.user-picker-suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30;
  list-style: none; margin: 0; padding: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 220px; overflow-y: auto;
}
.user-picker-suggest[hidden] { display: none; }
.user-picker-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 14px;
}
.user-picker-item:hover, .user-picker-item.active { background: #f0f2f5; }
.user-picker-name { overflow-wrap: anywhere; }
.user-picker-empty { padding: 6px 8px; color: var(--muted); font-size: 13px; }
/* Постановщик без права смены: нередактируемое отображение текущего значения */
.user-picker-disabled {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; min-height: 40px;
  border: 1px solid var(--border); border-radius: 6px;
  background: #f5f6f8; color: var(--text);
}
.user-picker-disabled .user-picker-avatar {
  position: static; transform: none; display: inline-flex;
}
.user-picker-static-name { overflow-wrap: anywhere; }

/* Упоминания @логин: чип в тексте комментариев/записей времени + выпадающий
   список кандидатов под textarea (обёртка .mention-wrap встаёт в поток сразу
   после поля, список — absolute, поэтому переполнения по ширине нет). */
.mention {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: #e8f0fe;
  color: var(--accent);
  font-weight: 500;
}
.mention-wrap { position: relative; }
.mention-suggest {
  position: absolute; left: 0; right: 0; top: 4px; z-index: 30;
  list-style: none; margin: 0; padding: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 220px; overflow-y: auto;
  /* У края списка колесо не «перетекает» на страницу: иначе скролл-событие
     страницы/модалки закрывало список (тот же баг, что чинит JS-гард). */
  overscroll-behavior: contain;
}
.mention-suggest[hidden] { display: none; }
.mention-item-login { margin-left: auto; font-size: 12px; }

/* Ссылки на задачи #id: чип-ссылка в текстах + выпадающий список кандидатов
   под textarea (обёртка .task-wrap встаёт в поток сразу после поля, список —
   absolute, поэтому переполнения по ширине нет). Визуально — как .mention,
   но тёплым оттенком: упоминание и ссылку легко различить. */
.task-ref {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: #fdf3e0;
  color: #b45309;
  font-weight: 500;
  text-decoration: none;
}
.task-ref:hover { text-decoration: underline; }
/* Кликабельные URL в текстах (фильтр linkify) — обычный вид ссылок
   приложения (акцентный цвет, подчёркивание по наведению). :not(.task-ref) —
   чипы #id стилизуются собственным правилом выше. */
.task-desc a:not(.task-ref),
.comment-text a:not(.task-ref),
.time-entry-comment a:not(.task-ref) {
  color: var(--accent);
  text-decoration: none;
}
.task-desc a:not(.task-ref):hover,
.comment-text a:not(.task-ref):hover,
.time-entry-comment a:not(.task-ref):hover {
  text-decoration: underline;
}
.task-wrap { position: relative; }
.task-suggest {
  position: absolute; left: 0; right: 0; top: 4px; z-index: 30;
  list-style: none; margin: 0; padding: 4px;
  background: #fff; border: 1px solid var(--border); border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 220px; overflow-y: auto;
  /* У края списка колесо не «перетекает» на страницу: иначе скролл-событие
     страницы/модалки закрывало список (тот же баг, что чинит JS-гард). */
  overscroll-behavior: contain;
}
.task-suggest[hidden] { display: none; }
.task-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 4px; cursor: pointer; font-size: 14px;
}
.task-item:hover, .task-item.active { background: #f0f2f5; }
.task-item-id { color: var(--accent); font-weight: 600; font-size: 13px; white-space: nowrap; }
.task-item-title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.task-item-project { margin-left: auto; font-size: 12px; }
.task-item-empty { padding: 6px 8px; color: var(--muted); font-size: 13px; }

/* Login */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-box { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 32px; width: 100%; max-width: 360px; }
.login-box h1 { text-align: center; margin-bottom: 20px; }
.login-box button { width: 100%; margin-top: 8px; }
.login-title { display: flex; align-items: center; justify-content: center; gap: 12px; }
.login-logo { height: 44px; width: auto; }

/* Filters */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-chip {
  padding: 4px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--muted); font-size: 13px;
  text-decoration: none; white-space: nowrap;
}
.filter-chip:hover { border-color: #c9cfd6; color: var(--text); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.filter-select select {
  padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 13px;
  max-width: 200px; margin: 0;
}
.filter-select select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Board */
.board-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }

/* Поиск по названию в тулбаре списка проектов */
.toolbar-search {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; color: var(--muted); font-size: 13px;
  flex: 1 1 200px; max-width: 300px;
  transition: border-color 0.15s;
}
.toolbar-search:focus-within { border-color: var(--accent); }
.toolbar-search input {
  border: none; background: transparent; outline: none; flex: 1; min-width: 0;
  font: inherit; font-size: 13px; color: var(--text); padding: 0;
}
.toolbar-search input::placeholder { color: var(--muted); }
.toolbar-search-clear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  color: var(--muted); text-decoration: none; font-size: 12px; line-height: 1;
  flex-shrink: 0;
}
.toolbar-search-clear:hover { color: var(--text); background: #eef0f3; }

/* Activity feed */
.activity-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.board-hint { font-size: 13px; }
.board-hint-below { margin: 12px 0 0; }
/* Кнопки «Обновить» на доске и в списке задач */
.board-refresh, .list-refresh {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  padding: 6px 9px; color: var(--muted);
}
.board-refresh:hover, .list-refresh:hover { color: var(--text); }
.board-refresh svg, .list-refresh svg { display: block; }
.board-refresh.spinning svg, .list-refresh.spinning svg { animation: board-spin 0.7s linear infinite; }
@keyframes board-spin { to { transform: rotate(360deg); } }
.board {
  display: flex; gap: 12px; align-items: flex-start;
  overflow-x: auto; padding-bottom: 8px;
}
.board-col {
  flex: 1 1 0; min-width: 230px;
  background: #eef0f3; border: 1px solid var(--border); border-radius: 10px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 230px);
}
.board-col-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; font-size: 14px; border-bottom: 1px solid var(--border);
}
.board-count {
  margin-left: auto; background: rgba(0,0,0,0.06); color: var(--muted);
  border-radius: 999px; padding: 1px 9px; font-size: 12px;
}
.board-col-body {
  padding: 8px; display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto; min-height: 70px;
}
.board-col-body.drag-over {
  background: rgba(37, 99, 235, 0.08);
  outline: 2px dashed var(--accent); outline-offset: -4px; border-radius: 8px;
}
.board-empty { color: var(--muted); font-size: 13px; margin: 4px 10px; }
.board-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; cursor: grab;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.board-card:hover { border-color: #c9cfd6; box-shadow: 0 2px 6px rgba(0,0,0,0.08); }
.board-card.dragging { opacity: 0.45; cursor: grabbing; }
.board-project {
  display: inline-block; margin-bottom: 6px;
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: #f6f8fa; border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 8px; white-space: nowrap;
}
.board-card-title { margin: 0 0 6px; font-size: 14px; font-weight: 600; line-height: 1.35; }
.board-card-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--muted);
}
.board-assignee { display: inline-flex; align-items: center; gap: 6px; }
.board-card-meta .badge { font-size: 11.5px; padding: 1px 8px; }
.board-blocked { margin-top: 6px; font-size: 12px; color: var(--danger); }
.board-due.overdue, .due-date.overdue { color: var(--danger); font-weight: 600; }
/* Карточки в колонке «Архив»: приглушены, как завершённые блокеры */
.board-card[data-archived="1"] { opacity: 0.55; }

/* Строки архивных задач в списке: приглушены, название зачёркнуто */
tr.row-archived { opacity: 0.6; }
tr.row-archived .col-title a { color: var(--muted); text-decoration: line-through; }

/* Колонка #id в списках задач: узкая (1%), приглушённая, не переносится */
.tasks-table .col-id { width: 1%; white-space: nowrap; color: var(--muted); }
/* Неразрывные токены в названии (URL, артикулы) переносятся, а не растягивают таблицу */
.tasks-table .col-title a { overflow-wrap: anywhere; }
/* Имена в колонках «Ответственный»/«Постановщик»: длинное имя переносится, а
   бейдж отпуска при нехватке ширины уходит на свою строку — колонки не раздувают
   min-content таблицы (тот же приём, что у названия задачи и .user-line).
   Обе колонки-люди ведут себя одинаково. При обычных именах переносов нет. */
.tasks-table .col-assignee .user-cell,
.tasks-table .col-requester .user-cell { min-width: 0; flex-wrap: wrap; }
.tasks-table .col-assignee .user-cell > span:not(.avatar):not(.badge),
.tasks-table .col-requester .user-cell > span:not(.avatar):not(.badge) {
  min-width: 0; overflow-wrap: anywhere;
}

/* Карточка заархивированной задачи: заголовок приглушён (бейдж — в шапке) */
.task-card-archived h2 { color: var(--muted); }

/* Toast */
#toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  background: #1f2937; color: #fff; padding: 10px 16px; border-radius: 8px;
  max-width: 380px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  opacity: 0; transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }
#toast.toast-error { background: var(--danger); }
/* Ссылка-действие в тосте (например «Открыть задачу» после публикации
   отложенного комментария): htmx-тост живёт 4 с, ссылка читаемая на тёмном.
   pointer-events: auto обязателен — у #toast стоит none (тост не должен
   перехватывать клики), и наследуемая none делает ссылку некликабельной
   (real bug, пойман живой проверкой в браузере). */
#toast .toast-action {
  margin-left: 10px; color: #9ec5ff; text-decoration: underline;
  white-space: nowrap; pointer-events: auto;
}
#toast.toast-error .toast-action { color: #ffe3e3; }

/* Graph */
.graph-toolbar { display: flex; align-items: center; gap: 24px; margin-bottom: 12px; flex-wrap: wrap; }
/* margin: 0 и width/margin селекта — перебивают глобальные стили форм
   (label { margin-bottom }, label select { margin-top; width: 100% }),
   которые съезжают с них на тулбар графа и ломают выравнивание. */
.graph-filter { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 0; }
.graph-filter select {
  width: auto; margin: 0; height: 34px;
  padding: 0 10px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; background: #fff; color: var(--text);
}
.graph-toolbar .btn {
  height: 34px; padding-top: 0; padding-bottom: 0;
  display: inline-flex; align-items: center;
}
.graph-legend { display: flex; gap: 16px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.graph-legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.graph-canvas {
  height: 68vh; min-height: 360px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card);
  overflow: hidden;
}
.graph-canvas .empty, .graph-canvas .error { padding: 24px; }
.graph-hint { margin-top: 8px; font-size: 13px; }

/* Редактирование связей на графе */
.graph-toolbar .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.edge-popover {
  position: fixed; z-index: 300;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  padding: 12px 14px; width: 300px;
}
.edge-popover-title { font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.edge-popover-text { font-size: 14px; margin-bottom: 10px; overflow-wrap: anywhere; }
.edge-popover-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* Подробный тултип узла графа */
.node-tooltip {
  position: fixed; z-index: 310;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  padding: 12px 14px; width: 320px; max-width: calc(100vw - 16px);
  cursor: default;
}
.node-tooltip-title { font-weight: 600; font-size: 15px; margin-bottom: 6px; overflow-wrap: anywhere; }
.node-tooltip-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.node-tooltip-badges .badge { font-size: 11.5px; padding: 2px 8px; }
.node-tooltip-row { font-size: 13.5px; margin-bottom: 2px; }
.node-tooltip-row .muted { margin-right: 2px; }
.node-tooltip-links { font-size: 13px; color: var(--muted); margin-top: 4px; }
.node-tooltip-desc {
  font-size: 13px; color: var(--muted); line-height: 1.45;
  margin: 6px 0 8px; white-space: pre-line; overflow-wrap: anywhere;
  max-height: 96px; overflow: hidden;
}
.node-tooltip-open {
  display: inline-block; font-size: 13px; font-weight: 500;
  color: var(--accent); text-decoration: none;
}
.node-tooltip-open:hover { text-decoration: underline; }

/* Messages */
.messages { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.message {
  padding: 10px 14px; border-radius: 8px; font-size: 14px;
  border: 1px solid var(--border); background: var(--card);
}
.message-success { border-color: #bbf7d0; background: #f0fdf4; color: #166534; }
.message-error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }

/* Users */
.user-actions { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.user-actions form { display: inline-flex; }
.checkbox-label { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.checkbox-label input { width: auto; }
.radio-group { display: flex; flex-wrap: wrap; gap: 16px; }
.radio-group .checkbox-label { margin: 8px 0; }
.field-label { display: block; margin-bottom: 2px; font-weight: 600; }

/* Avatars (аватарки пользователей) */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--avatar-size, 24px); height: var(--avatar-size, 24px);
  border-radius: 50%; object-fit: cover; flex-shrink: 0;
  line-height: 1; vertical-align: middle;
}
.avatar-16 { --avatar-size: 16px; font-size: 7.5px; }
.avatar-20 { --avatar-size: 20px; font-size: 9px; }
.avatar-24 { --avatar-size: 24px; font-size: 10px; }
.avatar-32 { --avatar-size: 32px; font-size: 13px; }
.avatar-48 { --avatar-size: 48px; font-size: 19px; }
.avatar-96 { --avatar-size: 96px; font-size: 38px; }
img.avatar { border: 1px solid var(--border); background: var(--card); }
.avatar-fallback {
  background: hsl(var(--avatar-hue, 210), 55%, 45%);
  color: #fff; font-weight: 600; user-select: none;
}
/* Имя рядом с аватаркой: в ячейках таблиц и в карточке задачи */
.user-cell, .user-line { display: inline-flex; align-items: center; gap: 6px; }
/* В карточке задачи: строка пользователя не шире своего контейнера;
   длинное имя переносится на свою строку (break только при необходимости) */
.user-line { max-width: 100%; min-width: 0; flex-wrap: wrap; }
.user-line > span:not(.avatar):not(.badge) { min-width: 0; overflow-wrap: anywhere; }
.user-cell .badge { margin-left: 2px; }
/* В строках с baseline-выравниванием кружок центрируется по строке */
.comment-head > .avatar,
.history-head > .avatar,
.time-entry-head > .avatar,
.user-cell > .avatar,
.user-line > .avatar,
.board-assignee > .avatar { align-self: center; }

/* Профиль */
.profile-card {
  background: var(--card);
  border: 1px solid var(--border); border-radius: 10px; padding: 24px 28px;
}
.profile-info { display: flex; align-items: center; gap: 18px; margin-bottom: 20px; }
/* Deep-link привязки Telegram: длинный неразрывный URL обязан переноситься
   (иначе горизонтальный скролл страницы на мобильных). */
.telegram-deeplink { overflow-wrap: anywhere; word-break: break-word; }
.telegram-deeplink a { color: var(--accent); }
/* Кнопки «Проверить привязку»/«Новая ссылка» — сестринские формы в одну строку */
.telegram-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
/* Подсказка после ручной проверки: апдейт /start ещё не пришёл */
.telegram-check-hint {
  color: #92400e; background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 8px; padding: 8px 12px; font-size: 14px; margin: 0 0 12px;
}

/* Журнал изменений («Что нового») */
.changelog-entry {
  max-width: 720px; background: var(--card);
  border: 1px solid var(--border); border-radius: 10px;
  padding: 18px 24px; margin-bottom: 14px;
}
.changelog-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.changelog-head h2 { margin: 0; font-size: 17px; }
.changelog-entry ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.changelog-entry li { overflow-wrap: anywhere; }
.profile-login { font-weight: 600; font-size: 16px; }
.profile-names { display: flex; flex-direction: column; gap: 2px; }
/* Вкладки профиля: четыре подписи в колонке 560px встают впритык — полоса
   скроллится внутри себя (как на мобильных), а не растягивает карточку. */
.profile-card .tabs { display: flex; max-width: 100%; overflow-x: auto; }
.profile-card .tab { flex: 0 0 auto; }
.form-success {
  color: #166534; background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 8px; padding: 8px 12px; font-size: 14px; margin: 0 0 12px;
}

/* Уведомления в профиле: чекбоксы типов */
.field-group-title { display: block; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.notify-types label {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 0; padding: 4px 0; font-size: 14px; color: var(--text);
  cursor: pointer; overflow-wrap: anywhere;
}
.notify-types input[type=checkbox] {
  width: auto; display: inline-block; margin: 3px 0 0; padding: 0; flex-shrink: 0;
}
.notify-types label:has(input:disabled) { color: var(--muted); cursor: default; }

/* Администрирование: превью текущего логотипа сайта */
.settings-logo-preview {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
  padding: 10px 12px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px;
}
.settings-logo-img { height: 40px; width: auto; display: block; }
/* Секции формы настроек (название/логотип, SMTP, Telegram) и тестовые отправки */
.settings-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px 2px;
  margin: 0 0 16px;
}
.settings-section-title {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.settings-tests { padding-bottom: 14px; }
/* Секции профиля с сестринскими формами (Telegram, смена пароля): содержимое
   не заканчивается на .form-field, поэтому нужен полный нижний отступ */
.settings-standalone { padding-bottom: 14px; }
/* Абзацы внутри секций профиля — компактный вертикальный ритм */
.settings-section p { margin: 0 0 12px; }
.settings-test-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}
.settings-test-row:first-child { border-top: none; padding-top: 0; }
.settings-test-channel { flex: 0 0 110px; font-size: 13px; color: var(--muted); }
.settings-test-row form { display: inline-flex; }
.test-result {
  font-size: 13px;
  min-width: 0;
  flex: 1 1 180px;
  overflow-wrap: anywhere;
}
.test-result-ok { color: #166534; }
.test-result-error { color: var(--danger); }
.form-field { margin-bottom: 12px; }
.form-field label { margin-bottom: 4px; }
.form-field input[type=text],
.form-field input[type=password],
.form-field input[type=number],
.form-field input[type=email] {
  display: block; width: 100%; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px; font: inherit;
  color: var(--text); background: #fff;
}
.form-field input[type=text]:focus,
.form-field input[type=password]:focus,
.form-field input[type=number]:focus,
.form-field input[type=email]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form-field .field-hint { margin-top: 4px; }
.form-field .clearable-file-input { font-size: 13px; margin-top: 4px; }
.form-field .clearable-file-input a { color: var(--accent); }
.form-field .clearable-file-input input[type=file] { display: block; margin-top: 4px; font-size: 13px; }
.form-field input[type=date] {
  display: block; width: 100%; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 6px; font: inherit;
  color: var(--text); background: #fff;
}
.form-field input[type=date]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form-row-dates { margin-bottom: 0; }
.form-row-dates .form-field { margin-bottom: 12px; }
.vacation-banner {
  display: inline-block; border-radius: 8px; padding: 8px 14px;
  font-size: 14px; font-weight: 600; margin: 0 0 12px;
}
.vacation-banner.vacation-active { color: #fff; background: var(--vacation); }
.vacation-banner.vacation-planned { color: #115e59; background: #ccfbf1; border: 1px solid #99f6e4; }

/* История карточки */
.history-entry { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.history-entry:last-child { border-bottom: none; }
.history-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.history-actor { font-weight: 600; }
.history-action { font-weight: 600; }
.history-body { margin-top: 2px; overflow-wrap: anywhere; }
.history-change { line-height: 1.6; }
.history-old { color: var(--muted); }

/* Лента активности (вкладка «Активность») */
.activity-feed { max-width: 880px; }
.activity-entry { padding: 10px 0; }
.activity-task { margin: 4px 0 2px; }
.activity-task a { font-weight: 600; }
.pagination { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.pagination-disabled { opacity: 0.45; pointer-events: none; }

/* Поиск по задачам */
.search-group { margin-bottom: 20px; }
.search-section { font-size: 15px; font-weight: 600; color: var(--muted); margin: 4px 0 8px; }
.search-result {
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 16px; margin-bottom: 10px;
}
.search-result-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-result-title { font-weight: 600; font-size: 15px; color: var(--text); text-decoration: none; }
.search-result-title:hover { color: var(--accent); }
.search-result-desc { margin: 6px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.search-result-comment { margin: 6px 0 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.search-result-meta { margin-top: 8px; font-size: 12.5px; }
.search-result-meta a { color: var(--muted); }
mark { background: #fef08a; color: inherit; border-radius: 2px; padding: 0 1px; }

/* Лента уведомлений */
.notifications-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin: 16px 0 12px;
}
.notifications-toolbar .filters { flex: 1 1 auto; min-width: 0; }
.notification-cell { display: inline-flex; align-items: center; gap: 10px; }
.notification-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: #eef2f6; color: var(--muted);
}
.notification-type { font-size: 13px; white-space: nowrap; }
.notifications-table .col-type { width: 1%; white-space: nowrap; }
.notifications-table .col-actor { width: 1%; white-space: nowrap; }
.notifications-table .col-time { width: 1%; white-space: nowrap; }
.notifications-table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.notification-text { overflow-wrap: anywhere; }
.notification-task { margin-top: 3px; font-size: 13px; overflow-wrap: anywhere; }
.notification-task a { font-weight: 600; }
/* Непрочитанные — подсветка фона и акцентная иконка; прочитанные — приглушены */
.notifications-table tr.row-unread { background: #f2f6ff; }
.notifications-table tr.row-unread .notification-icon { background: var(--accent); color: #fff; }
.notifications-table tr.row-unread .notification-text { font-weight: 600; }
.notifications-table tr.row-read td { opacity: 0.6; }

/* Токены API в профиле: компактная таблица; длинное название переносится,
   колонки дат/действия не растягивают строку */
.api-tokens-table .col-created,
.api-tokens-table .col-used,
.api-tokens-table .col-actions { width: 1%; white-space: nowrap; }
.api-tokens-table .col-actions { text-align: right; }
.api-tokens-table .col-name { overflow-wrap: anywhere; }
/* Секрет токена: неразрывная строка переносится посимвольно, клик выделяет весь */
.token-secret code {
  display: block;
  background: #f6f8fa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-size: 13px;
  user-select: all;
}

/* Mobile */
@media (max-width: 640px) {
  /* Профиль/админка: компактные отступы карточки на узких экранах */
  .profile-card { padding: 16px 14px; }
  /* Модалка (карточка задачи, формы) — на весь экран */
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal-box {
    width: 100%; max-width: none;
    height: 100vh; height: 100dvh;
    max-height: none;
    border-radius: 0;
    padding: 16px 14px 24px;
  }
  /* Кнопки с иконкой + подписью: на мобильном — только иконка */
  .btn .btn-label { display: none; }
  /* Телефон: в шапке только аватар (имя скрыто, профиль — тап по аватарке) */
  .topbar-user-link .topbar-user-name { display: none; }
  /* Даты отпуска в профиле — в столбик */
  .form-row-dates { grid-template-columns: 1fr; gap: 0; }
  /* Форма задачи: на узких экранах поля — в один столбец */
  .form-row { grid-template-columns: 1fr; gap: 0; }
  /* Форма проекта: строка участника — имя получает не меньше 40% ширины
     (не сжимается в столбик из букв), бейджи/крестик переносятся под имя,
     когда не помещаются рядом */
  .team-member { flex-wrap: wrap; row-gap: 4px; }
  .team-member-name { flex: 1 1 40%; min-width: 0; }
  /* Кнопки действий — на всю ширину поровну, текст по центру */
  .form-actions .btn { flex: 1 1 0; justify-content: center; }
  /* Пара «Проверить привязку»/«Новая ссылка»: на мобильном — столбик во всю ширину
     (flex-элементы тут — <form>, поэтому тянуть надо формы, кнопкам — width:100%) */
  .telegram-actions { flex-direction: column; align-items: stretch; }
  .telegram-actions .btn { width: 100%; justify-content: center; }
  /* 16px в полях — iOS Safari не зумит страницу при фокусе */
  label input, label select, label textarea, .user-picker-input { font-size: 16px; }
  /* Список автодополнения #: строка пункта переносится — проект уходит под
     название (иначе название сжалось бы в столбик из букв), тап-зона шире */
  .task-item { flex-wrap: wrap; padding: 9px 8px; }
  .task-item-title { flex: 1 1 60%; }
  .task-item-project { margin-left: auto; white-space: normal; overflow-wrap: anywhere; }
  /* Lightbox: компактнее отступы, картинка почти на весь экран */
  .lightbox-stage { padding: 24px 12px 84px; }
  .lightbox-img { max-width: calc(100vw - 24px); max-height: calc(100vh - 108px); }
  .lightbox-close { top: 10px; right: 10px; }
  .lightbox-caption { top: 12px; left: 12px; max-width: calc(100% - 60px); }
  /* Кнопки карусели ближе к краям — не задевают close/caption/тулбар */
  .lightbox-prev { left: 6px; }
  .lightbox-next { right: 6px; }
}

/* Десктоп (≥769px): бургер — крайний справа в углу шапки; в ряду остаются
   только основные пункты (.topbar-main), переносимые (.topbar-overflow) скрыты.
   Открытая панель — тот же #topbar-menu: уходит из ряда под кнопку (absolute
   относительно .topbar, выровнена по правому краю бургера — right: 20px
   равен правому паддингу шапки) и показывает ВСЕ пункты: основные, переносимые,
   «Уведомления», «Выйти». Появление — фейд 0.18s, закрытие мгновенное
   (элемент возвращается в ряд — той же логикой app.js).
   Шаблон и JS-логика открытия/закрытия — общие с мобильным меню. */
@media (min-width: 769px) {
  .burger { display: inline-flex; }
  .topbar-nav { display: flex; align-items: center; gap: 8px; }
  .topbar nav.open {
    position: absolute; top: 100%; left: auto; right: 20px; z-index: 40;
    min-width: 220px;
    flex-direction: column; gap: 2px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 6px;
    animation: topbar-menu-drop 0.18s ease;
  }
  .topbar nav.open .topbar-overflow { display: block; }
  .topbar nav.open .nav-notifications { display: block; }
  .topbar nav.open a { display: block; padding: 9px 12px; font-size: 14px; }
  .topbar nav.open .menu-logout button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 9px 12px;
    background: transparent; border: none; border-radius: 8px;
    color: var(--muted); font: inherit; font-size: 14px;
    cursor: pointer; text-align: left;
  }
  .topbar nav.open .menu-logout button:hover { background: #f0f2f5; color: var(--text); }
}
@keyframes topbar-menu-drop {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}
/* Узкий десктоп (769–900px): четыре пункта в ряду шапки не помещаются — ряд
   вылезает за экран (пункты сжимаются и переносят подпись на две строки).
   В этом диапазоне иконки пунктов скрыты, отступ шапки меньше: подписи
   остаются, ряд помещается, бургер-панель по-прежнему рядом. */
@media (min-width: 769px) and (max-width: 900px) {
  .topbar { gap: 14px; }
  .topbar nav a svg { display: none; }
}

/* Планшеты и телефоны (<768px): список задач таблицей не влезает — превращаем
   в карточки. Строка: проект (если есть) + «#id Название», ниже компактный ряд
   статус / ответственный / приоритет / срок, действия — справа.
   Структура таблицы сохраняется, меняется только раскладка. */
@media (max-width: 768px) {
  /* Шапка: поиск уходит на вторую строку на всю ширину */
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  /* Первая строка: бренд … [колокольчик] [аватар] [бургер] — бургер крайний справа, в углу.
     margin-left:auto у .topbar-right (базовое правило) прижимает блок к правому краю. */
  .topbar-right { order: 1; }
  .topbar-nav { order: 2; }
  .topbar-search { order: 3; flex: 1 1 100%; max-width: none; }
  /* Переносимые пункты (в т.ч. «Выйти»): в мобильной панели — обычные пункты */
  .topbar nav .topbar-overflow { display: block; }
  .topbar nav .menu-logout button {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 11px 12px;
    background: transparent; border: none; border-radius: 8px;
    color: var(--muted); font: inherit; font-size: 15px;
    cursor: pointer; text-align: left;
  }
  .topbar nav .menu-logout button:hover { background: #f0f2f5; color: var(--text); }
  /* Навигация прячется в выпадающую панель под шапкой, открывается бургером */
  .topbar { position: relative; }
  .burger { display: inline-flex; }
  .topbar nav {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 40;
    flex-direction: column; gap: 2px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    padding: 8px 12px;
    visibility: hidden; opacity: 0; transform: translateY(-6px);
    pointer-events: none;
    /* visibility: мгновенно при открытии, с задержкой при закрытии (дождаться fade-out) */
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s linear 0.18s;
  }
  .topbar nav.open {
    visibility: visible; opacity: 1; transform: none; pointer-events: auto;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s;
  }
  .topbar nav a { display: block; padding: 11px 12px; font-size: 15px; }
  /* Пункт «Уведомления»: на десктопе скрыт, в бургер-меню — обычный пункт nav */
  .topbar nav .nav-notifications { display: block; }
  /* Шапка проекта: кнопки переносятся на новую строку, не растягивая страницу */
  .project-head { flex-wrap: wrap; }
  .project-head-actions { flex-wrap: wrap; flex-shrink: 1; min-width: 0; }

  .tasks-table, .tasks-table tbody { display: block; }
  .tasks-table thead { display: none; }
  .tasks-table tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 5px 12px; padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }
  .tasks-table tr:last-child { border-bottom: none; }
  .tasks-table td { display: block; padding: 0; border-bottom: none; }
  .tasks-table .col-project { flex: 1 1 100%; order: 0; font-size: 12px; }
  .tasks-table .col-project a {
    display: inline-block; padding: 1px 8px; font-weight: 600;
    color: var(--muted); background: #f6f8fa; border: 1px solid var(--border);
    border-radius: 4px; text-decoration: none;
  }
  /* Первая строка карточки — #id + название (название переносится, не режется).
     Базис «вся строка минус место под #id» — иначе компактный ряд влезает на
     ту же строку и название сжимается в столбик.
     width: auto обязателен: десктопное width: 1% (строка :869) протекает в этот
     flex-блок, flex-basis: auto берёт ширину из width → бокс #id = 1% строки,
     и nowrap-текст «#42» вылезает поверх названия. */
  .tasks-table .col-id { width: auto; flex: 0 0 auto; order: 1; font-size: 15px; font-weight: 600; }
  .tasks-table .col-title { flex: 1 1 calc(100% - 60px); min-width: 0; order: 2; }
  .tasks-table .col-title a { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
  /* Компактный ряд: статус / ответственный / приоритет / срок, действия справа */
  .tasks-table .col-status { order: 3; }
  .tasks-table .col-assignee { order: 4; font-size: 13px; min-width: 0; }
  .tasks-table .col-assignee .user-cell { overflow-wrap: anywhere; }
  .tasks-table .col-requester { order: 5; font-size: 13px; min-width: 0; }
  .tasks-table .col-requester .user-cell { overflow-wrap: anywhere; }
  .tasks-table .col-priority { order: 6; }
  .tasks-table .col-due { order: 7; font-size: 13px; color: var(--muted); }
  /* Подпись «Срок:» только для пустого срока: у даты теперь иконка 🗓,
     и «Срок: 🗓 …» было бы дублированием. */
  .tasks-table .col-due::before { content: "Срок: "; color: var(--muted); }
  .tasks-table .col-due:has(.due-date)::before { content: none; }
  .tasks-table .col-actions { order: 8; margin-left: auto; }

  /* Проекты: строка таблицы — карточка по образцу задач.
     Первая строка: название (переносится, не режется) + бейдж архива,
     действия справа; ниже руководитель и прогресс на всю ширину. */
  .projects-table, .projects-table tbody { display: block; }
  .projects-table thead { display: none; }
  .projects-table tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }
  .projects-table tr:last-child { border-bottom: none; }
  .projects-table td { display: block; padding: 0; border-bottom: none; }
  .projects-table .col-name { flex: 1 1 auto; order: 0; min-width: 0; }
  .projects-table .col-name a {
    font-size: 15px; font-weight: 600; overflow-wrap: anywhere;
  }
  .projects-table .col-actions { order: 1; margin-left: auto; }
  .projects-table .col-manager { flex: 1 1 100%; order: 2; font-size: 13px; min-width: 0; }
  .projects-table .col-progress { flex: 1 1 100%; order: 3; }
  .projects-table .col-progress .progress-text { overflow-wrap: anywhere; }

  /* Пользователи: строка таблицы — карточка по образцу проектов.
     Первая строка: аватар + имя + бейджи, действия справа;
     ниже компактный ряд роль/статус, затем email и последний вход —
     каждый на всю ширину (длинный email переносится, не распирает экран). */
  .users-table, .users-table tbody { display: block; }
  .users-table thead { display: none; }
  .users-table tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 5px 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }
  .users-table tr:last-child { border-bottom: none; }
  .users-table td { display: block; padding: 0; border-bottom: none; }
  .users-table .col-user { flex: 1 1 auto; order: 0; min-width: 0; }
  .users-table .col-user .user-cell { overflow-wrap: anywhere; }
  .users-table .col-actions { order: 1; margin-left: auto; }
  .users-table .col-role { order: 2; }
  .users-table .col-status { order: 3; }
  .users-table .col-email {
    flex: 1 1 100%; order: 4; font-size: 13px; color: var(--muted);
    min-width: 0; overflow-wrap: anywhere;
  }
  .users-table .col-login { flex: 1 1 100%; order: 5; font-size: 13px; color: var(--muted); }
  .users-table .col-login::before { content: "Вход: "; }
  .users-table .col-seen { flex: 1 1 100%; order: 6; font-size: 13px; color: var(--muted); }
  .users-table .col-seen::before { content: "Онлайн: "; }

  /* Уведомления: строка таблицы — карточка по образцу остальных лент.
     Первая строка: иконка + тип, действие «Прочитать» справа;
     ниже текст на всю ширину, ссылка на задачу, затем актор и время. */
  .notifications-table, .notifications-table tbody { display: block; }
  .notifications-table thead { display: none; }
  .notifications-table tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 5px 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }
  .notifications-table tr:last-child { border-bottom: none; }
  .notifications-table td { display: block; padding: 0; border-bottom: none; }
  .notifications-table .col-type { flex: 1 1 auto; order: 0; min-width: 0; width: auto; }
  .notifications-table .col-actions { order: 1; margin-left: auto; width: auto; flex: 0 0 auto; }
  .notifications-table .col-body { flex: 1 1 100%; order: 2; min-width: 0; }
  /* «Кто … Когда» в один ряд: актор занимает остаток строки, при нехватке
     места обрезается многоточием; время прижато вправо и не сжимается.
     width:auto сбрасывает десктопное width:1% — во flex-контексте оно давало
     flex-базис ~3px, и тексты ячеек рисовались поверх друг друга.
     Базис актора — 0 (не auto): с auto длинное имя заняло бы всю строку и
     вытолкнуло время на вторую строку; margin-left:auto у времени при
     нулевом базисе актора забрал бы всё свободное место себе — вместо
     прижатия справа работает grow актора. */
  .notifications-table .col-actor {
    order: 3; font-size: 13px;
    width: auto; flex: 1 1 0;
    min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .notifications-table .col-time {
    order: 4; font-size: 13px;
    width: auto; flex: 0 0 auto; white-space: nowrap;
  }
  .notification-type { white-space: normal; overflow-wrap: anywhere; }

  /* Токены API: строка таблицы — карточка по образцу уведомлений.
     Первая строка: название, кнопка «Отозвать» справа;
     ниже компактный ряд «Создан … Использован» с подписями.
     width:auto сбрасывает десктопное width:1% (во flex-контексте оно давало
     flex-базис ~3px — см. те же правила у .notifications-table). */
  .api-tokens-table, .api-tokens-table tbody { display: block; }
  .api-tokens-table thead { display: none; }
  .api-tokens-table tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 5px 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }
  .api-tokens-table tr:last-child { border-bottom: none; }
  .api-tokens-table td { display: block; padding: 0; border-bottom: none; }
  .api-tokens-table .col-name { flex: 1 1 auto; order: 0; min-width: 0; font-weight: 600; }
  .api-tokens-table .col-actions { order: 1; margin-left: auto; width: auto; flex: 0 0 auto; }
  .api-tokens-table .col-created {
    order: 2; font-size: 13px;
    width: auto; flex: 1 1 0; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .api-tokens-table .col-created::before { content: "Создан: "; }
  .api-tokens-table .col-used {
    order: 3; font-size: 13px;
    width: auto; flex: 0 0 auto; white-space: nowrap;
  }
  .api-tokens-table .col-used::before { content: "Использован: "; }

  /* Совещания: строка таблицы — карточка по образцу остальных списков.
     Первая строка: название (переносится, не режется) + бейдж статуса;
     ниже — организатор, дата начала и аватарки участников. */
  .meetings-table, .meetings-table tbody { display: block; }
  .meetings-table thead { display: none; }
  .meetings-table tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 6px 12px; padding: 12px 14px;
    border-bottom: 1px solid var(--border);
  }
  .meetings-table tr:last-child { border-bottom: none; }
  .meetings-table td { display: block; padding: 0; border-bottom: none; }
  .meetings-table .col-title { flex: 1 1 100%; order: 0; }
  .meetings-table .col-title a {
    font-size: 15px; font-weight: 600; overflow-wrap: anywhere;
  }
  .meetings-table .col-organizer { order: 1; font-size: 13px; min-width: 0; flex: 1 1 40%; }
  .meetings-table .col-date { order: 2; font-size: 13px; color: var(--muted); }
  .meetings-table .col-participants { order: 3; margin-left: auto; }

  /* Фильтры: чипы и селект переносятся, ничего не вылезает за экран */
  .filters { gap: 6px; }
  .filter-select, .filter-select select { max-width: 100%; }
  .board-toolbar { gap: 8px; }
  /* Поиск по названию: на всю ширину строки; 16px — iOS не зумит при фокусе */
  .toolbar-search { flex: 1 1 100%; max-width: none; }
  .toolbar-search input { font-size: 16px; }

  /* Крестик удаления участника: видимый размер прежний, зона тапа шире
     (26px → 42px) — попадать пальцем легче */
  .team-member-remove { position: relative; }
  .team-member-remove::after { content: ''; position: absolute; inset: -8px; }

  /* Кнопка цитирования: видимый размер прежний, зона тапа шире */
  .comment-quote-btn { position: relative; }
  .comment-quote-btn::after { content: ''; position: absolute; inset: -8px; }

  /* Вкладки страницы/дашборда: полоса прокручивается внутри себя,
     не растягивая страницу горизонтально */
  .tabs { display: flex; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { flex: 0 0 auto; }
  /* Подпись видна только у активной вкладки; у остальных — одна иконка.
     Назначение скрытых подписей подсказывают title/aria-label на ссылке. */
  .tab { padding: 6px 12px; }
  .tab.active { padding: 6px 16px; }
  .tab-label { display: none; }
  .tab.active .tab-label { display: inline; }
}

/* Календарь выбора даты «Срок» (flatpickr, vendor/flatpickr) */

/* Иконка календаря внутри поля: справа, клик по полю открывает пикер. */
input[data-datepicker] {
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px 18px;
}

/* Тема календаря в палитре приложения: выбранный день и «сегодня» — акцент,
   hover — светлый тон акцента, радиусы и шрифт как у остального UI. */
.flatpickr-calendar {
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  /* z-index не переопределяем: vendor ставит .open { z-index: 99999 },
     что выше .modal-backdrop (100) и .confirm-backdrop (400) */
}
.flatpickr-months .flatpickr-month { background: var(--card); color: var(--text); }
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year { font-weight: 600; color: var(--text); }
.flatpickr-months .flatpickr-prev-month,
.flatpickr-months .flatpickr-next-month { fill: var(--muted); }
.flatpickr-months .flatpickr-prev-month:hover,
.flatpickr-months .flatpickr-next-month:hover { fill: var(--text); }
span.flatpickr-weekday { color: var(--muted); }
.flatpickr-day { color: var(--text); border-radius: 8px; font-size: 14px; }
.flatpickr-day:hover {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.12);
}
.flatpickr-day.today { border-color: var(--accent); }
.flatpickr-day.today:hover,
.flatpickr-day.today:focus {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* Очень узкие экраны: календарь фиксированной ширины (~308px) прижимаем к
   левому краю, чтобы не вылезал за вьюпорт (320px). */
@media (max-width: 380px) {
  .flatpickr-calendar { left: 8px !important; }
}
/* ===== Wiki проекта ====================================================== */

/* Раскладка вкладки: слева список страниц, справа контент. */
.wiki-wrap {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  margin-top: 16px;
}
.wiki-sidebar {
  min-width: 0;
}
.wiki-sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
  margin-bottom: 8px;
}
.wiki-sidebar-title { margin: 0; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.wiki-sidebar-subtitle { margin: 14px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.wiki-page-list { list-style: none; margin: 0; padding: 0; }
.wiki-page-list li + li { margin-top: 2px; }
.wiki-page-list a {
  display: block; padding: 6px 10px; border-radius: 6px;
  color: var(--text); text-decoration: none;
  overflow-wrap: anywhere;
}
.wiki-page-list a:hover { background: #f1f3f6; }
.wiki-page-list a.active { background: var(--accent); color: #fff; font-weight: 600; }
.wiki-page-list-archived a { color: var(--muted); }
.wiki-sidebar-empty { margin: 0; }
.wiki-content { min-width: 0; }

/* Страница: шапка с кнопками-иконками и строка «Изменено:». */
.wiki-page-head { margin-bottom: 14px; }
.wiki-page-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.wiki-page-title-row h2 { margin: 0; font-size: 22px; min-width: 0; overflow-wrap: anywhere; flex: 1 1 260px; }
.wiki-page-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.wiki-page-head .muted { margin: 6px 0 0; font-size: 12.5px; }
.wiki-page-content { min-width: 0; }

/* Рендер markdown: типографика контента. */
.wiki-page-content h1, .wiki-page-content h2, .wiki-page-content h3, .wiki-page-content h4,
.wiki-revision-content h1, .wiki-revision-content h2, .wiki-revision-content h3, .wiki-revision-content h4 {
  margin: 1.1em 0 0.5em;
  overflow-wrap: anywhere;
}
.wiki-page-content > :first-child, .wiki-revision-content > :first-child { margin-top: 0; }
.wiki-page-content p, .wiki-revision-content p { margin: 0.6em 0; }
.wiki-page-content ul, .wiki-page-content ol,
.wiki-revision-content ul, .wiki-revision-content ol { padding-left: 1.6em; }
.wiki-page-content blockquote, .wiki-revision-content blockquote {
  margin: 0.6em 0; padding: 4px 14px;
  border-left: 3px solid var(--border); color: var(--muted);
}
.wiki-page-content code, .wiki-revision-content code {
  background: #f1f3f6; border-radius: 4px; padding: 1px 5px;
  font-family: var(--mono, monospace); font-size: 0.92em;
  overflow-wrap: anywhere;
}
.wiki-page-content pre, .wiki-revision-content pre {
  background: #1f2937; color: #e5e7eb; border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; margin: 0.8em 0;
}
.wiki-page-content pre code, .wiki-revision-content pre code {
  background: none; padding: 0; color: inherit;
}
.wiki-page-content table, .wiki-revision-content table {
  border-collapse: collapse; margin: 0.8em 0; max-width: 100%; display: block; overflow-x: auto;
}
.wiki-page-content th, .wiki-page-content td,
.wiki-revision-content th, .wiki-revision-content td {
  border: 1px solid var(--border); padding: 6px 10px; text-align: left;
}
.wiki-page-content th, .wiki-revision-content th { background: #f1f3f6; }
.wiki-page-content a:not(.task-ref), .wiki-revision-content a:not(.task-ref) {
  color: var(--accent); text-decoration: none; overflow-wrap: anywhere;
}
.wiki-page-content a:not(.task-ref):hover, .wiki-revision-content a:not(.task-ref):hover { text-decoration: underline; }
.wiki-page-content img.wiki-img, .wiki-revision-content img.wiki-img {
  max-width: 100%; height: auto; border-radius: 8px;
}
.wiki-page-content a[data-lightbox] { display: inline-block; max-width: 100%; }
.wiki-page-content a[data-lightbox] img { display: block; }

/* Форма страницы в модалке: подсказка и редактор. */
.wiki-form-wrap .wiki-editor-hint { margin: 2px 0 12px; font-size: 12.5px; }
.wiki-form-wrap label { display: block; margin-bottom: 12px; }

/* История: список слева, деталь справа. */
.wiki-history h2 { margin: 0 0 14px; font-size: 20px; }
.wiki-history-body {
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.wiki-rev-list { list-style: none; margin: 0; padding: 0; }
.wiki-rev-list li + li { margin-top: 4px; }
.wiki-rev-link {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid transparent; background: transparent;
  border-radius: 8px; padding: 8px 10px; color: var(--text);
  font: inherit;
}
.wiki-rev-link:hover { background: #f1f3f6; }
.wiki-rev-link.active { border-color: var(--accent); background: #f0f5ff; }
.wiki-rev-date { display: block; font-weight: 600; font-size: 13px; }
.wiki-rev-author { display: block; font-size: 13px; }
.wiki-rev-comment {
  display: block; font-size: 12.5px; color: var(--muted);
  overflow-wrap: anywhere;
}
.wiki-rev-detail { min-width: 0; }
.wiki-revision-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.wiki-revision-head h3 { margin: 0 0 2px; font-size: 16px; }
.wiki-revision-meta { flex: 1 1 240px; min-width: 0; }
.wiki-revision-meta .muted { margin: 0; }
.wiki-revision-content { min-width: 0; }

/* Diff (difflib.HtmlDiff) в детали ревизии. */
.wiki-diff { margin: 0 0 14px; }
.wiki-diff summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.wiki-diff-table { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }
.wiki-diff-table table.diff { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.wiki-diff-table td { padding: 2px 8px; vertical-align: top; border: none; }
.wiki-diff-table td.diff_header { background: #f1f3f6; color: var(--muted); font-weight: 600; white-space: nowrap; }
.wiki-diff-table .diff_add { background: #e6f4ea; }
.wiki-diff-table .diff_sub { background: #fdecea; }
.wiki-diff-table .diff_chg { background: #fff8e1; }
.wiki-diff-table pre {
  margin: 0; font-family: var(--mono, monospace); white-space: pre-wrap; overflow-wrap: anywhere;
}

/* EasyMDE: иконки тулбара без FontAwesome (mask + currentColor), русские
   подписи уже в title. Иконка — <i class="fa fa-*"> ВНУТРИ кнопки (так их
   рендерит EasyMDE); классы fa-* — от его дефолтных опций. */
.wiki-form-wrap .editor-toolbar button {
  color: var(--muted); background-color: transparent; border: none;
}
.wiki-form-wrap .editor-toolbar button:hover,
.wiki-form-wrap .editor-toolbar button.active { color: var(--accent); background-color: transparent; }
/* Тулбар — flex с переносом: кнопки переносятся аккуратными рядами, а не
   «уезжают» произвольно (фидбек: «Таблица» оказалась посреди второго ряда).
   Сепаратор — фиксированная вертикальная линия, центрированная по ряду
   (базовое baseline-выравнивание «вешало» её внизу). На мобильных (≤640px,
   модалка fullscreen, ряды переносятся) сепараторы скрываются целиком —
   осиротевший сепаратор в начале/конце ряда выглядит как мусор. */
.wiki-form-wrap .editor-toolbar {
  display: flex; flex-wrap: wrap; align-items: center;
}
.wiki-form-wrap .editor-toolbar i.separator {
  height: 18px; align-self: center; flex: none;
}
/* Кнопка EasyMDE «Таблица» имеет class="table" — ловит ОБЩИЙ стиль таблиц
   приложения (.table { width: 100%; background; border; border-radius }):
   кнопка растягивалась на всю ширину тулбара и выглядела карточкой (это и
   было «Таблица в непонятном месте»). Нейтрализуем в контексте тулбара. */
.wiki-form-wrap .editor-toolbar button.table {
  width: auto;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
}
.wiki-form-wrap .editor-toolbar button.table:hover,
.wiki-form-wrap .editor-toolbar button.table.active {
  background: #fcfcfc;
  border-color: #95a5a6;
}
.wiki-form-wrap .editor-toolbar i[class*="fa-"] {
  display: block; width: 18px; height: 18px; margin: 0 auto;
  background-color: currentColor;
  -webkit-mask: var(--wiki-icon) center / contain no-repeat;
  mask: var(--wiki-icon) center / contain no-repeat;
}
.wiki-form-wrap .editor-toolbar i.fa-bold { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 5h6a3.5 3.5 0 0 1 0 7H7z'/%3E%3Cpath d='M7 12h7a3.5 3.5 0 0 1 0 7H7z'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-italic { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='19' y1='4' x2='10' y2='4'/%3E%3Cline x1='14' y1='20' x2='5' y2='20'/%3E%3Cline x1='15' y1='4' x2='9' y2='20'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-strikethrough { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 4H9a3 3 0 0 0-2.83 4'/%3E%3Cpath d='M14 12a4 4 0 0 1 0 8H6'/%3E%3Cline x1='4' y1='12' x2='20' y2='12'/%3E%3C/svg%3E"); }
/* У кнопки заголовка и пунктов её меню классы fa-header И fa-heading вместе —
   правило одно на оба, чтобы один --wiki-icon не перебивал другой. */
.wiki-form-wrap .editor-toolbar i.fa-header { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='4 7 4 4 20 4 20 7'/%3E%3Cline x1='9' y1='20' x2='15' y2='20'/%3E%3Cline x1='12' y1='4' x2='12' y2='20'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-quote-left { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-code { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='16 18 22 12 16 6'/%3E%3Cpolyline points='8 6 2 12 8 18'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-list-ul { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='8' y1='6' x2='21' y2='6'/%3E%3Cline x1='8' y1='12' x2='21' y2='12'/%3E%3Cline x1='8' y1='18' x2='21' y2='18'/%3E%3Cline x1='3' y1='6' x2='3.01' y2='6'/%3E%3Cline x1='3' y1='12' x2='3.01' y2='12'/%3E%3Cline x1='3' y1='18' x2='3.01' y2='18'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-list-ol { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='10' y1='6' x2='21' y2='6'/%3E%3Cline x1='10' y1='12' x2='21' y2='12'/%3E%3Cline x1='10' y1='18' x2='21' y2='18'/%3E%3Crect x='3' y='4' width='4' height='4' rx='1'/%3E%3Crect x='3' y='10' width='4' height='4' rx='1'/%3E%3Crect x='3' y='16' width='4' height='4' rx='1'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-link { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-image { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-table { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cline x1='3' y1='9' x2='21' y2='9'/%3E%3Cline x1='3' y1='15' x2='21' y2='15'/%3E%3Cline x1='12' y1='3' x2='12' y2='21'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-minus { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cline x1='5' y1='12' x2='19' y2='12'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-eye { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
.wiki-form-wrap .editor-toolbar i.fa-columns { --wiki-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3h7a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-7m0-18H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7m0-18v18'/%3E%3C/svg%3E"); }
/* Пункты выпадающего меню «Заголовок»: тот же глиф, разный масштаб. */
.wiki-form-wrap .editor-toolbar .header-smaller i { transform: scale(0.75); }
.wiki-form-wrap .editor-toolbar .header-bigger i { transform: scale(1.2); }

/* Редактор в модалке: контейнер не выходит за границы, превью аккуратное. */
.wiki-form-wrap .EasyMDEContainer { max-width: 100%; }
.wiki-form-wrap .editor-preview { padding: 10px 12px; }
.wiki-form-wrap .editor-preview p { margin: 0.5em 0; }

/* Прогресс загрузки файла в wiki-редакторе: своя строка под редактором в
   стиле editor-statusbar (штатный статус-бар отключён: status: false),
   показывается только на время загрузки (app.js, wikiUploadFile). */
.wiki-form-wrap .wiki-upload-progress {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; line-height: 1.4;
}
.wiki-upload-label { min-width: 0; overflow-wrap: anywhere; }
.wiki-upload-bar {
  display: inline-block; width: 90px; height: 5px; flex-shrink: 0;
  background: #e3e6ea; border-radius: 999px; overflow: hidden;
}
.wiki-upload-fill {
  display: block; height: 100%; width: 0;
  background: var(--accent); border-radius: 999px;
  transition: width 0.15s ease;
}
.wiki-upload-fill.indeterminate {
  width: 40% !important;
  background: linear-gradient(90deg, #d8e2f3 25%, var(--accent) 50%, #d8e2f3 75%);
  background-size: 200% 100%;
  animation: upload-stripes 1.1s linear infinite;
}

/* Мобильная модалка (≤640px, fullscreen): тулбар переносится на 2-3 ряда —
   сепараторы групп кнопок скрываем, чтобы не оставались сиротами. */
@media (max-width: 640px) {
  .wiki-form-wrap .editor-toolbar i.separator { display: none; }
}

/* Мобильные: список страниц — компактной карточкой сверху, контент во всю
   ширину; история — столбиком. Модалка на ≤640px уже fullscreen (общее
   правило приложения). */
@media (max-width: 768px) {
  .wiki-wrap { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .wiki-page-list { display: flex; flex-wrap: wrap; gap: 6px; }
  .wiki-page-list li + li { margin-top: 0; }
  .wiki-page-list a { padding: 6px 10px; border: 1px solid var(--border); }
  .wiki-history-body { grid-template-columns: minmax(0, 1fr); }
  .wiki-rev-list { display: flex; flex-direction: column; }
  .wiki-diff-table td.diff_header { display: none; }
  .wiki-page-content pre, .wiki-revision-content pre { font-size: 12px; }
}

/* Отложенные комментарии (очередь черновиков) -----------------------------
   Страница /pending/, нав-пункт со счётчиком (десктопный ряд шапки и
   бургер-меню) и галка «Отложить отправку» в форме комментария. */
.nav-badge {
  display: inline-block; min-width: 18px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
/* В активном пункте (акцентная плашка) бейдж — инверсный */
.topbar nav a.active .nav-badge { background: #fff; color: var(--accent); }

.pending-section { display: flex; flex-direction: column; gap: 12px; }
.pending-toolbar {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 8px; flex-wrap: wrap;
}
.pending-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pending-toolbar-actions form { margin: 0; }
.pending-report {
  border: 1px solid var(--border); border-radius: 8px; background: #fafbfc;
  padding: 10px 14px; font-size: 14px;
}
.pending-report p { margin: 0; }
.pending-report-errors { margin: 6px 0 0; padding-left: 20px; color: var(--danger); }

.pending-list { display: flex; flex-direction: column; gap: 10px; }
.pending-item {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card);
  padding: 12px 14px;
}
/* Залежавшиеся черновики (старше суток) приглушены: видно, что «лежит» */
.pending-item-old { opacity: 0.62; }
.pending-item-old:hover { opacity: 1; }
.pending-item-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 4px 12px; flex-wrap: wrap;
}
.pending-item-task { min-width: 0; overflow-wrap: anywhere; }
.pending-item-task a { color: var(--accent); text-decoration: none; font-weight: 600; }
.pending-item-task a:hover { text-decoration: underline; }
.pending-item-when { font-size: 12px; white-space: nowrap; }
.pending-item-text { margin: 0; }
.pending-item-error { margin: 0; font-size: 13px; }
.pending-item-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pending-item-actions form { margin: 0; }

/* Пометка в заголовке «Комментарии» на карточке задачи */
.pending-mark {
  margin-left: 6px; font-size: 13px; font-weight: 400;
  color: var(--accent); text-decoration: none;
}
.pending-mark:hover { text-decoration: underline; }

/* Галка «Отложить отправку» рядом с кнопкой «Отправить» */
.comment-form-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; flex-wrap: wrap;
}
/* .comment-form .btn { align-self: flex-end } рассчитан на button прямо в
   форме — в ряду с галкой выравниваем по центру */
.comment-form-actions .btn { align-self: center; }
.comment-form-actions .checkbox-label { margin: 0; }
.defer-label { font-size: 13px; color: var(--muted); cursor: pointer; }
.defer-label input { margin: 0; }

/* Селект «Статус» в форме комментария (смена статуса вместе с комментарием):
   в ряду с галкой и кнопкой. margin/width — перебивают глобальные стили форм
   (label { margin-bottom }, label select { margin-top; width: 100% }), которые
   съезжают с ряда; font: inherit тянет 13px заголовка подписи. */
.comment-form-actions .status-field {
  display: flex; align-items: center; gap: 6px;
  margin: 0; font-size: 13px; color: var(--muted); cursor: pointer;
}
.comment-form-actions .status-field select {
  width: auto; min-width: 0; margin: 0; height: 30px;
  padding: 0 8px; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; background: #fff; color: var(--text); cursor: pointer;
}
.comment-form-actions .status-field select:disabled { opacity: 0.6; cursor: default; }

/* Чекбоксы «удалить» в форме правки черновика */
.pending-attachments { display: flex; flex-direction: column; gap: 6px; }
.pending-remove-file { margin: 0; font-size: 12px; color: var(--muted); cursor: pointer; }
.pending-remove-file input { margin: 0; }

@media (max-width: 640px) {
  /* Кнопки очереди — во всю ширину, равными долями (как у форм приложения) */
  .pending-toolbar { justify-content: stretch; }
  .pending-toolbar-actions { width: 100%; }
  .pending-toolbar-actions form { flex: 1 1 0; display: flex; }
  .pending-toolbar-actions .btn { flex: 1 1 0; justify-content: center; }
  .pending-item-actions { width: 100%; }
  .pending-item-actions form { flex: 1 1 0; display: flex; }
  .pending-item-actions .btn { flex: 1 1 0; justify-content: center; }
  .comment-form-actions { justify-content: space-between; }
  /* Селект «Статус» — своей строкой во всю ширину: в тесном ряду он делит
     место с галкой и кнопкой (переносы, «столбик из букв»), а статус —
     главный контрол ряда. flex-basis 100% гарантированно выталкивает
     галку с кнопкой на вторую строку. */
  .comment-form-actions .status-field { flex: 1 1 100%; justify-content: space-between; }
  /* 16px в селекте — iOS Safari не зумит страницу при фокусе (перебивает
     13px подписи выше) */
  .comment-form-actions .status-field select { flex: 1 1 auto; font-size: 16px; height: 34px; }
}
