/* Original / bright palette — indigo accent, cool neutrals, near-black dark mode.
   Inspired by Linear / Superhuman. */
:root {
  --accent: #635BFF;
  --accent-hover: #4F46E5;
  --accent-soft: rgba(99, 91, 255, 0.10);
  --accent-glow: rgba(99, 91, 255, 0.25);

  --bg: #FAFAFA;
  --bg-alt: #FFFFFF;
  --bg-pane: #FFFFFF;
  --bg-sidebar: #F4F4F5;
  --bg-iconbar: #EFEFF2;
  --bg-hover: rgba(0, 0, 0, 0.03);
  --bg-selected: rgba(99, 91, 255, 0.08);
  --unread-bg: rgba(99, 91, 255, 0.05);

  --border: rgba(0, 0, 0, 0.06);
  --border-strong: rgba(0, 0, 0, 0.10);

  --text: #09090B;
  --text-muted: #52525B;
  --text-faint: #A1A1AA;
  --text-quart: #D4D4D8;

  --summary-bg: rgba(99, 91, 255, 0.07);
  --summary-border: #6366F1;

  /* Светофор в системных цветах Apple (владелец, 03.09.2026: «светофор в
     стиле ios»). Два уровня: текстовые варианты - тёмные, они держат контраст
     на белом (green 5.2:1, red 5.9:1, orange 5.4:1); точки, заливки и метки -
     яркие системные, там контраст берёт размер пятна, а не толщина буквы.
     Цветом никогда не говорим в одиночку: рядом всегда слово. */
  --ok: #248A3D;          /* systemGreen, вариант повышенного контраста */
  --warn: #C93400;        /* systemOrange, вариант повышенного контраста */
  --bad: #D70015;         /* systemRed, вариант повышенного контраста */
  --ok-dot: #34C759;      /* systemGreen */
  --warn-dot: #FF9500;    /* systemOrange */
  --bad-dot: #FF3B30;     /* systemRed */

  /* Те же значения прямо: внутри модулей задач --ok собран из --success, и
     ссылка --success -> --ok свернулась бы в круг, а круг в CSS гасит цвет. */
  --danger: #D70015;
  --success: #248A3D;
  --warning: #C93400;
  --violet: #8B5CF6;
  --pink: #EC4899;
  --gold: #EAB308;

}
/* Тёмная тема по макету дизайнеров 14.07.2026 (msg 816): глубокий сине-
   фиолетовый вместо прежнего серого. Палитра: фон #0a0e1f, поверхности
   #141931/#1b2140, бордеры #272e52, текст #eef0fb/#9099c2, акцент #8a83ff. */
:root[data-theme="dark"] {
  /* Нативные контролы (календарь в поле даты, выпадающие списки, скроллбары)
     рисуются браузером и без этой строки остаются светлыми: чёрная иконка
     календаря на тёмном поле и нечитаемый список выбора (письмо, п.1 и 13). */
  color-scheme: dark;
  --accent: #8a83ff;
  --accent-hover: #9c96ff;
  --accent-soft: rgba(138, 131, 255, 0.14);
  --accent-glow: rgba(138, 131, 255, 0.28);

  --bg: #0a0e1f;
  --bg-alt: #141931;
  --bg-pane: #141931;
  --bg-sidebar: #0d1226;
  --bg-iconbar: #080b1a;
  --bg-hover: rgba(144, 153, 194, 0.08);
  --bg-selected: rgba(138, 131, 255, 0.16);
  --unread-bg: rgba(138, 131, 255, 0.08);

  --border: #272e52;
  --border-strong: #3a4272;

  --text: #eef0fb;
  --text-muted: #9099c2;
  --text-faint: #5d6590;
  --text-quart: #3a4272;

  --summary-bg: rgba(138, 131, 255, 0.12);
  --summary-border: #9c96ff;

  /* На тёмном системные цвета Apple уже контрастны - берём их как есть. */
  --ok: #30D158;
  --warn: #FF9F0A;
  --bad: #FF453A;
  --ok-dot: #30D158;
  --warn-dot: #FF9F0A;
  --bad-dot: #FF453A;

  --danger: #FF453A;
  --success: #30D158;
  --warning: #FF9F0A;
  --violet: #948dff;

}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: 'Inter Tight', -apple-system, system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; letter-spacing: -0.005em; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
/* Корневой anti-pan для мобилки: html и body НЕ скроллятся
   горизонтально никогда, даже если внутри что-то выскочит за край.
   Без этого iOS Safari дает прокрутить весь документ влево-вправо
   когда любая sticky-колонка или overflow-auto'нутый блок чуть
   шире 100vw — что юзер и видит как «сайт гуляет под пальцем». */
html, body {
  overflow-x: hidden;
  overscroll-behavior-x: none;
  max-width: 100vw;
}
@media (max-width: 900px) {
  html, body { width: 100vw; }
}
.hidden { display: none !important; }
.error { color: var(--danger); font-size: 12px; margin-top: 8px; }

/* Поля ввода не наследуют цвет текста от страницы — браузер даёт им свой
   чёрный. На тёмной теме это чёрный шрифт на тёмном фоне. Задаём цвет один
   раз на все формы: селектор по тегу, поэтому любые точечные правила и
   инлайновые стили по-прежнему сильнее. */
input, select, textarea, button { color: var(--text); }
input[type="color"] { color: initial; }
::placeholder { color: var(--text-muted); opacity: 1; }

/* login */
#login-screen { display: flex; align-items: center; justify-content: center; height: 100vh; background: var(--bg-alt); }
.login-box { background: var(--bg); padding: 40px; border-radius: 20px; border: 1px solid var(--border); width: 360px; position: relative; }
.login-box h1 { margin: 0 0 24px; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; }
.login-box input { width: 100%; padding: 12px 14px; margin-bottom: 12px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.9rem; transition: border-color .2s; }
.login-box input:focus { outline: none; border-color: var(--accent); }
.login-box button[type="submit"] { width: 100%; padding: 12px; background: var(--accent); color: white; border: none; border-radius: 10px; cursor: pointer; font-weight: 700; font-family: inherit; font-size: 0.9rem; letter-spacing: 0.2px; }
.login-box button[type="submit"]:hover { background: var(--accent-hover); }
.theme-toggle { position: absolute; top: 12px; right: 12px; background: none; border: none; font-size: 18px; cursor: pointer; }

/* app layout */
#app { display: grid; grid-template-columns: 56px var(--sidebar-w, 220px) 4px 380px 4px 1fr; grid-template-rows: 44px minmax(0, 1fr); height: 100vh; }
/* Верхняя строка — общая для всех разделов: пространство, поиск, тема, аватар.
   Ряд 1 занимает всё правее панели иконок, остальные блоки живут в ряду 2. */
#app > .icon-bar { grid-column: 1; grid-row: 1 / -1; }
#app > #app-topbar { grid-column: 2 / -1; grid-row: 1; }
#app > *:not(.icon-bar):not(#app-topbar) { grid-row: 2; }
.resizer { background: var(--border); cursor: col-resize; transition: background 0.15s; }
.resizer:hover, .resizer.dragging { background: var(--accent); }
@media (max-width: 900px) { .resizer { display: none; } }

/* icon bar */
.icon-bar { background: var(--bg-iconbar); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 10px 0 14px; gap: 2px; overflow-y: auto; }
.icon-bar .ib-item { width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; border-radius: 8px; cursor: pointer; color: var(--text-muted); transition: background 0.12s, color 0.12s; position: relative; }
.icon-bar .ib-item:hover { background: var(--bg-hover); color: var(--text); }
.icon-bar .ib-item.active { background: var(--accent-soft); color: var(--accent); }
.icon-bar .ib-item.active::before { content: ""; position: absolute; left: -8px; top: 6px; bottom: 6px; width: 2.5px; border-radius: 0 3px 3px 0; background: var(--accent); }
@media (max-width: 900px) { .icon-bar { display: none; } }

/* sidebar — toggle with arrow button */
.sidebar {
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
  padding: 12px; z-index: 20; transition: width 0.2s ease, padding 0.2s ease;
  position: relative;
}
.sidebar.collapsed { width: 56px; min-width: 56px; padding: 8px; }
.sidebar.collapsed .brand, .sidebar.collapsed .compose-btn, .sidebar.collapsed .folder-title,
.sidebar.collapsed .user-box, .sidebar.collapsed .sidebar-label, .sidebar.collapsed .folder-item .count,
.sidebar.collapsed #mailboxes-group, .sidebar.collapsed #sheets-group, .sidebar.collapsed .folder-label { display: none; }
.sidebar .folder-item { white-space: nowrap; overflow: hidden; border-radius: 8px; padding: 8px 10px; }
.sidebar .folder-item svg { flex-shrink: 0; }
.sidebar-toggle-btn { background: none; border: none; width: 100%; padding: 8px; cursor: pointer; color: var(--text-muted); display: flex; align-items: center; justify-content: center; transition: color 0.15s; flex-shrink: 0; }
.sidebar-toggle-btn:hover { color: var(--accent); }
.sidebar-toggle-btn svg { transition: transform 0.2s; }
.sidebar.collapsed .sidebar-toggle-btn svg { transform: rotate(180deg); }
.brand { font-size: 18px; font-weight: 700; margin-bottom: 0; display: flex; justify-content: space-between; align-items: center; }
/* Название компании живёт в верхней строке; в шапке сайдбара его не дублируем
   (msg 1187), остаётся только счётчик исходящих и кнопка закрытия. */
#brand-label, #brand-mini { display: none !important; }
.sidebar-close { display: none; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text); padding: 4px 8px; }
@media (max-width: 900px) { .sidebar-close { display: block; } .sidebar { width: 280px; min-width: 280px; padding: 16px; } .sidebar .brand, .sidebar .compose-btn, .sidebar .folder-title, .sidebar .user-box, .sidebar .link-btn, .sidebar .folder-item .count { opacity: 1; } }
.badge { font-size: 11px; font-weight: 500; color: var(--text-muted); }
mark { background: yellow; color: inherit; padding: 0 2px; }
.compose-btn { width: 100%; padding: 9px 14px; background: var(--accent); color: white; border: none; border-radius: 8px; cursor: pointer; font-weight: 600; font-family: inherit; font-size: 0.87rem; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; box-shadow: 0 1px 0 rgba(99,91,255,0.25); transition: background .12s, box-shadow .12s; }
.compose-btn:hover { background: var(--accent-hover); box-shadow: 0 4px 12px rgba(99,91,255,0.35); }
.compose-btn-mini { display: none; background: var(--accent); color: white; border: none; border-radius: 50%; width: 38px; height: 38px; cursor: pointer; align-items: center; justify-content: center; margin: 0 auto; }
.compose-btn-mini:hover { background: var(--accent-hover); }
.sidebar.collapsed .compose-btn { display: none; }
.sidebar.collapsed .compose-btn-mini { display: flex; }
.sidebar.collapsed .compose-wrap { display: flex; justify-content: center; }
.folders { flex: 1; }
.folder-group { margin-bottom: 16px; }
.folder-title { font-size: 11px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.5px; }
.folder-item { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); transition: background .12s, color .12s; }
/* Часики у ящика: загрузка старых писем. Появляются по наведению, чтобы
   боковая колонка не рябила иконками. */
.folder-item > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.folder-item .mb-hist { opacity: 0; font-size: 12px; line-height: 1; flex: none; padding-left: 2px; }
.folder-item:hover .mb-hist, .folder-item.active .mb-hist { opacity: .65; }
.folder-item .mb-hist:hover { opacity: 1; }
.folder-item:hover { background: var(--bg-hover); color: var(--text); }
.folder-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.folder-item .count { color: var(--text-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.folder-item.active .count { color: var(--accent); opacity: 0.85; }
.user-box { padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 6px; }
.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; padding: 2px 0; text-align: left; font-size: 12px; }

/* list pane */
.list-pane { border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.toolbar { padding: 12px; border-bottom: 1px solid var(--border); display: flex; gap: 8px; }
.toolbar input, .toolbar select, .toolbar button { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); font-family: inherit; font-size: 0.85rem; transition: border-color .2s; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: var(--accent); }
.toolbar input { flex: 1; }
.messages-list { flex: 1; overflow-y: auto; }
/* Calm list item: dense, unread-dot left of name, 2-line preview, mailbox chip */
.list-pane { background: var(--bg-pane); }
.messages-list { background: var(--bg-pane); }
.msg-item {
  padding: 9px 13px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  display: flex; gap: 10px;
  transition: background .12s;
  position: relative;
}
.msg-item:hover { background: var(--bg-hover); }
/* Выбранное письмо - подложкой и цветом имени, без полосы слева (эталон 21.08). */
.msg-item.selected { background: var(--accent-soft); }
.msg-item.selected .msg-from { color: var(--accent-text); font-weight: 600; }
.msg-item.unread { background: var(--unread-bg); }
.msg-item.unread .msg-from { color: var(--text); font-weight: 700; }
.msg-item.unread .msg-subject { color: var(--text); font-weight: 600; }
.msg-avatar { display: none; }
.msg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.msg-head { display: flex; align-items: center; gap: 8px; }
.msg-from { font-size: 13px; font-weight: 500; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.1px; }
.msg-date { font-size: 11px; color: var(--text-faint); white-space: nowrap; flex-shrink: 0; }
.msg-subject { font-size: 12px; font-weight: 500; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-snippet { font-size: 12px; color: var(--text-faint); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.msg-check { margin-top: 4px; }
/* Галочка выбора письма сама по себе 13 px - пальцем не попасть (норма 24).
   Отступы браузер у галочки игнорирует, а уменьшение через transform ужимает и
   область нажатия, поэтому нажимаемой сделали обёртку вокруг неё: сама галочка
   выглядит как раньше, а промахов больше нет. */
.msg-check-wrap { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; }
@media (pointer: coarse) {
  .msg-check-wrap { min-width: 34px; min-height: 34px; margin: -4px -8px -4px -10px; }
}
.msg-unread-dot { margin-right: -2px; }
.msg-unread-dot:hover { transform: scale(1.3); }
.msg-star:hover { transform: scale(1.2); }
.msg-star, .msg-unread-dot { align-self: center; }
.list-group {
  padding: 9px 13px 5px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-faint);
  background: var(--bg-pane);
  position: sticky; top: 0; z-index: 1;
  border-bottom: 1px solid var(--border);
}
.prio { display: inline-block; width: 14px; height: 14px; line-height: 14px; text-align: center; border-radius: 50%; font-size: 11px; font-weight: 700; margin-right: 6px; }
.prio-high { background: var(--danger); color: white; }
.prio-spam { background: var(--text-muted); color: white; }
.bulk-bar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--bg-alt); border-bottom: 1px solid var(--border); font-size: 13px; }
.bulk-bar button { padding: 6px 12px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); cursor: pointer; font-family: inherit; font-size: 0.8rem; font-weight: 600; transition: all .15s; }
.bulk-bar button:hover { border-color: var(--accent); color: var(--accent); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 14px; font-size: 13px; font-weight: 600; z-index: 200; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 32px oklch(0 0 0 / 0.25); animation: toastIn .3s ease; }
@keyframes toastIn { from { opacity:0; transform:translateX(-50%) translateY(20px); } to { opacity:1; transform:translateX(-50%) translateY(0); } }
.toast button { background: none; border: 1px solid currentColor; color: inherit; padding: 4px 10px; border-radius: 4px; cursor: pointer; }
.toast-wide { display: block; text-align: left; font-weight: 400; padding: 16px 20px; max-width: calc(100vw - 32px); }
.toast-wide ul { list-style: disc; }

/* preview */
.preview-pane { overflow-y: auto; overflow-x: hidden; padding: 24px 32px; min-width: 0; background: var(--bg-pane); }
#tasks-view, #finance-view, #team-view, #admin-view { overflow: auto; word-break: break-word; grid-column: 2 / -1; height: 100vh; }
.preview-pane .empty { color: var(--text-muted); text-align: center; margin-top: 80px; }
.preview-header { padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.preview-header h2 { margin: 0 0 10px; font-size: 20px; font-weight: 700; letter-spacing: -0.3px; color: var(--text); line-height: 1.3; }
.preview-meta { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.preview-actions { display: flex; gap: 6px; margin: 14px 0; flex-wrap: wrap; }
.preview-actions button { padding: 6px 12px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; color: var(--text); font-size: 12px; white-space: nowrap; }
.preview-actions button:hover { background: var(--bg-hover); }
.mobile-back { display: none; }
@media (max-width: 900px) { .mobile-back { display: inline-block; } }
.ai-block { background: var(--summary-bg); padding: 12px 14px; margin: 14px 0; border-radius: 10px; font-size: 13px; }
.ai-block .ai-label { font-size: 11px; text-transform: uppercase; color: var(--summary-border); font-weight: 600; margin-bottom: 4px; }
.preview-body { font-size: 14px; line-height: 1.6; white-space: pre-line; word-wrap: break-word; overflow-wrap: break-word; max-width: 100%; }
.attachments { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.attachment { display: inline-block; padding: 6px 10px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 5px; margin: 4px 6px 4px 0; text-decoration: none; color: var(--text); font-size: 12px; }
.attachment:hover { background: var(--bg-hover); }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: var(--bg); border-radius: 10px; width: 640px; max-width: 90vw; max-height: 90vh; overflow-y: auto; }
.modal-box.wide { width: 1120px; max-width: 96vw; max-height: 94vh; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; }
.modal-header button { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); }

/* Task detail: two-column layout (main text + comments | side meta).
   When the modal is .wide we want it to fill ~94vh so the description has
   real estate. The main column is a vertical flex with description (flex)
   and comments (fixed-flex-basis), separated by a draggable resizer. */
#task-form-modal .modal-box.wide { display: flex; flex-direction: column; height: 94vh; max-height: 94vh; overflow: hidden; }
#task-form-modal .modal-box.wide form { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
#task-form-modal .modal-box.wide .task-detail-layout { flex: 1; min-height: 0; }
.task-detail-layout { display: grid; grid-template-columns: 1fr 220px; gap: 0; }
.modal-box:not(.wide) .task-detail-layout { grid-template-columns: 1fr; }
.modal-box:not(.wide) .task-detail-aside { background: transparent; border-left: none; padding: 4px 20px 12px; }
.modal-box:not(.wide) .task-detail-main { padding: 18px 20px 4px; }
.task-detail-main { padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; }
.task-detail-aside { padding: 14px 12px; background: var(--bg-alt); border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
#task-form-modal .modal-box.wide #task-desc-label { flex: 1 1 auto; min-height: 80px; display: flex; flex-direction: column; gap: 4px; }
#task-form-modal .modal-box.wide #task-desc-input { flex: 1; min-height: 0; resize: none; }
#task-vsplit { height: 6px; cursor: row-resize; background: var(--border); border-radius: 3px; flex-shrink: 0; transition: background 0.1s; }
#task-vsplit:hover, #task-vsplit.dragging { background: var(--accent); }
#task-form-modal .modal-box.wide #task-comments-row { flex: 0 0 220px; min-height: 80px; overflow: hidden; }
/* Подзадач может быть много: список скроллится сам и не выдавливает
   комментарии за пределы окна (замечание Кузнеченко, 07.08 п.3). */
#task-subtasks-row { flex: 0 0 auto; }
#task-subtasks-list { max-height: 168px; overflow-y: auto; }
/* Описание тянут за уголок, и раньше оно выпихивало комментарии и кнопки за
   край окна (п.19): ограничиваем рост и позволяем основной колонке скроллиться. */
#task-desc-input { max-height: 45vh; }
#task-form-modal .modal-box.wide .task-detail-main { overflow-y: auto; }
/* Длинное имя метки не должно ломать раскладку и вешать вкладку (п.20). */
#task-tags-list > span { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-tag-chip { max-width: 220px; }
.docs-tag-chip span:not(.docs-tag-dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#task-form-modal .modal-box.wide #task-comments-list { flex: 1; max-height: none !important; }
.task-detail-aside label { font-size: 11px; color: var(--text-muted); display: flex; flex-direction: column; gap: 3px; line-height: 1.2; }
.task-detail-aside select, .task-detail-aside input { width: 100%; padding: 5px 7px; border: 1px solid var(--border); border-radius: 5px; background: var(--bg); color: var(--text); font-size: 12px; }
.task-title-inline { font-size: 22px; font-weight: 600; line-height: 1.25; padding: 6px 0; border: none; background: transparent; color: var(--text); width: 100%; }
.task-title-inline:focus { outline: none; border-bottom: 1px solid var(--accent); }
.task-desc-inline { min-height: 180px; font-size: 14px; line-height: 1.5; padding: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg-alt); color: var(--text); font-family: inherit; resize: vertical; }
.task-review-banner { background: var(--accent-soft); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.task-review-banner h4 { margin: 0; font-size: 13px; color: var(--text); }
.task-review-banner .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.task-review-banner button { padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; font-size: 12px; background: var(--bg); color: var(--text); }
/* Принять и вернуть - состояния, поэтому системный зелёный и янтарный, а не свои. */
.task-review-banner button.primary { background: var(--ok-dot); color: #fff; border-color: var(--ok-dot); }
.task-review-banner button.secondary { background: var(--warn-dot); color: #fff; border-color: var(--warn-dot); }
.coassignee-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.coassignee-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; font-size: 11px; }
.coassignee-pill button { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0; font-size: 12px; line-height: 1; }
@media (max-width: 900px) {
  .modal-box.wide { width: 100vw; max-width: 100vw; max-height: 100vh; border-radius: 0; }
  .task-detail-layout { grid-template-columns: 1fr; }
  .task-detail-aside { border-left: none; border-top: 1px solid var(--border); }
}

/* ----- iOS-style "New Task" sheet -----
   Activated by .task-create-sheet on the modal element. Reuses the existing
   form markup, restyled into a calm grouped-table layout (Reminders/Things).
   Edit-mode untouched. */
.task-create-sheet {
  background: oklch(0 0 0 / 0.32) !important;
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  align-items: center !important;
  padding: 28px 16px !important;
  font-family: inherit;
}
.task-create-sheet .modal-box {
  width: 600px;
  height: calc(100vh - 56px);
  max-width: calc(100vw - 32px) !important;
  max-height: calc(100vh - 56px) !important;
  min-width: 480px;
  min-height: 480px;
  border-radius: 22px !important;
  background: var(--bg-alt) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  box-shadow: 0 24px 60px oklch(0 0 0 / 0.32), 0 1px 0 oklch(1 0 0 / 0.04) inset;
  animation: taskSheetIn 320ms cubic-bezier(0.22, 1, 0.36, 1);
  letter-spacing: -0.01em;
  position: relative;
}
/* Visible custom resize handle in the bottom-right corner.
   Native CSS resize:both was unreliable here because of the modal's flex
   centering parent — handle never appeared in the right place and the
   browser's tiny default striped corner was easy to miss. */
.task-create-sheet .ios-sheet-resize-handle {
  position: absolute;
  right: 4px;
  bottom: 4px;
  width: 18px;
  height: 18px;
  cursor: nwse-resize;
  z-index: 5;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  color: color-mix(in oklch, var(--text-muted) 90%, transparent);
  user-select: none;
}
.task-create-sheet .ios-sheet-resize-handle::before {
  content: "";
  width: 14px;
  height: 14px;
  background:
    linear-gradient(135deg, transparent 50%, currentColor 50%, currentColor 56%, transparent 56%),
    linear-gradient(135deg, transparent 60%, currentColor 60%, currentColor 66%, transparent 66%),
    linear-gradient(135deg, transparent 70%, currentColor 70%, currentColor 76%, transparent 76%);
  background-size: 100% 100%;
  border-bottom-right-radius: 8px;
}
.task-create-sheet .ios-sheet-resize-handle:hover {
  color: var(--accent);
}
@keyframes taskSheetIn {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Header: Cancel | Title | Save  +  Minimize handle on the far left.
   Native iOS pattern. The original X button is repurposed as the
   "Отмена" text on the left in JS; a Save button is added on the right. */
.task-create-sheet .modal-header {
  display: grid !important;
  grid-template-columns: auto 1fr auto !important;
  gap: 12px;
  padding: 12px 18px !important;
  border-bottom: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
  background: var(--bg-alt);
  align-items: center;
}
.task-create-sheet .modal-header h3 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  text-align: center;
  margin: 0;
  grid-column: 2;
  justify-self: center;
}
.task-create-sheet .ios-sheet-cancel {
  background: transparent;
  border: none;
  padding: 0;
  height: 32px;
  font-size: 15px;
  font-weight: 400;
  color: var(--accent);
  cursor: pointer;
  letter-spacing: -0.1px;
  grid-column: 1;
  justify-self: start;
}
.task-create-sheet .ios-sheet-cancel:hover { opacity: 0.7; }
.task-create-sheet .ios-sheet-save {
  background: transparent;
  border: none;
  padding: 0;
  height: 32px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  letter-spacing: -0.1px;
  grid-column: 3;
  justify-self: end;
}
.task-create-sheet .ios-sheet-save:hover { opacity: 0.7; }
.task-create-sheet .ios-sheet-save:disabled {
  color: color-mix(in oklch, var(--accent) 35%, transparent);
  cursor: not-allowed;
}
/* Hide the original X button entirely in create mode — its job
   (close-on-click) is taken over by the styled "Отмена" text. */
.task-create-sheet .modal-header > button:not(.ios-sheet-cancel):not(.ios-sheet-save):not(.ios-sheet-minimize) {
  display: none !important;
}
.task-create-sheet .ios-sheet-minimize {
  background: transparent;
  border: none;
  padding: 0;
  width: 28px;
  height: 28px;
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  margin-right: 6px;
  border-radius: 6px;
}
.task-create-sheet .ios-sheet-minimize:hover { background: color-mix(in oklch, var(--text) 8%, transparent); }

/* Minimized state — collapses to a small bar at the bottom-right */
#task-form-modal.task-sheet-minimized {
  background: transparent !important;
  pointer-events: none;
  align-items: flex-end !important;
  justify-content: flex-end !important;
  padding: 16px !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
#task-form-modal.task-sheet-minimized .modal-box {
  pointer-events: auto;
  width: 240px !important;
  height: 44px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  resize: none;
  border-radius: 22px !important;
  cursor: pointer;
  box-shadow: 0 6px 20px oklch(0 0 0 / 0.18) !important;
}
#task-form-modal.task-sheet-minimized .modal-box > *:not(.ios-sheet-minimized-bar) { display: none !important; }
.ios-sheet-minimized-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* Form layout */
.task-create-sheet form#task-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.task-create-sheet .task-detail-layout {
  display: block !important;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 18px !important;
}
.task-create-sheet .task-detail-main,
.task-create-sheet .task-detail-aside {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  gap: 0 !important;
  overflow: visible;
}

/* Hide irrelevant elements. NOTE: #task-attach-row was here but is now
   intentionally allowed — create mode buffers files in memory and
   uploads them after the task is saved. See renderTaskAttachments(null,)
   and saveTask() in app.js. */
.task-create-sheet #task-review-banner,
.task-create-sheet #task-vsplit,
.task-create-sheet #task-comments-row,
.task-create-sheet #task-tags-row,
.task-create-sheet #task-tracking-actions,
.task-create-sheet #task-status-label,
.task-create-sheet #task-priority-select { display: none !important; }

/* Files row in the create sheet — match the row layout of other aside
   items (Label / Project / Repetition) so the upload picker reads as
   another grouped-table row, not as a stray block. */
.task-create-sheet #task-attach-row {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.task-create-sheet #task-attach-row > span:first-child {
  font-size: 13px;
  color: var(--text);
  min-width: 80px;
}
.task-create-sheet #task-attach-row #task-attach-list {
  flex: 1;
  flex-wrap: wrap;
}
.task-create-sheet #task-attach-row input[type="file"] {
  font-size: 13px;
}

/* Footer with delete | actions — replace with an inline helper line under fields */
.task-create-sheet form#task-form > div:last-of-type:not(.task-detail-layout) { display: none !important; }

/* Title field — inline display-style input on its own card */
.task-create-sheet #task-title-label {
  display: block;
  font-size: 0;
  margin: 0 0 6px;
}
.task-create-sheet #task-title-input {
  width: 100%;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.3px;
  border: none;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
}
.task-create-sheet #task-title-input::placeholder {
  color: color-mix(in oklch, var(--text-muted) 80%, transparent);
  font-weight: 500;
}
.task-create-sheet #task-title-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--accent) 38%, transparent);
}

/* Description — soft card, autogrows, no border */
.task-create-sheet #task-desc-label {
  display: block;
  font-size: 0;
  margin: 0 0 12px;
}
.task-create-sheet #task-desc-input {
  width: 100%;
  font-size: 13px;
  line-height: 1.45;
  border: none;
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
}
.task-create-sheet #task-desc-input:focus {
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--accent) 38%, transparent);
}

/* Aside fields rendered as a single grouped iOS Settings-style table.
   One rounded container with hairline separators between rows — much
   denser than the previous "card per field" layout. */
.task-create-sheet .task-detail-aside {
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  background: var(--bg) !important;
  border-radius: 14px !important;
  padding: 0 !important;
  overflow: hidden;
}
/* :not(.hidden) — иначе строка, спрятанная кодом (например «Компания», когда
   выбирать не из чего), всё равно показывалась: правило перебивало скрытие. */
.task-create-sheet .task-detail-aside > label:not(.hidden) {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  border-radius: 0;
  padding: 8px 14px;
  margin: 0;
  font-size: 13px;
  color: var(--text);
  min-height: 36px;
  letter-spacing: -0.1px;
}
.task-create-sheet .task-detail-aside > label + label {
  border-top: 1px solid color-mix(in oklch, var(--border) 55%, transparent);
}
.task-create-sheet .task-detail-aside > label > select,
.task-create-sheet .task-detail-aside > label > input:not([type="hidden"]):not([type="number"]) {
  flex: 0 1 60%;
  border: none;
  background: transparent;
  text-align: right;
  font-size: 13px;
  color: var(--text);
  padding: 0 !important;
  font-family: inherit;
  appearance: none;
  -webkit-appearance: none;
  height: 22px;
  line-height: 22px;
}
.task-create-sheet .task-detail-aside > label > select:focus,
.task-create-sheet .task-detail-aside > label > input:focus {
  outline: none;
}
.task-create-sheet .task-detail-aside > label > input[type="datetime-local"] {
  color: var(--text);
  font-feature-settings: "tnum" 1;
}

/* Priority row: full-width segmented control under the "Приоритет" label */
.task-create-sheet #task-priority-label {
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 6px !important;
  padding: 8px 14px !important;
}
.task-create-sheet .ios-segmented {
  display: flex;
  background: color-mix(in oklch, var(--text) 8%, transparent);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}
.task-create-sheet .ios-segmented button {
  flex: 1;
  padding: 5px 8px;
  border: none;
  background: transparent;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  letter-spacing: -0.1px;
  transition: background 140ms ease, transform 100ms ease;
}
.task-create-sheet .ios-segmented button.active {
  background: var(--bg);
  font-weight: 600;
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.08), 0 0 0 0.5px oklch(0 0 0 / 0.04);
}
.task-create-sheet .ios-segmented button:active { transform: scale(0.97); }
.task-create-sheet #task-priority-segmented[data-prio="urgent"] button.active { color: oklch(0.55 0.21 25); }
.task-create-sheet #task-priority-segmented[data-prio="high"] button.active { color: oklch(0.62 0.16 65); }

/* Соисполнители row: same shape as the Исполнитель row above —
   label on the left, dropdown on the right. The pills container only
   takes a row when it has children. */
.task-create-sheet .task-detail-aside > label:has(#task-coassignee-editor) {
  flex-wrap: wrap;
}
.task-create-sheet #task-coassignee-editor {
  display: contents;
}
.task-create-sheet #task-coassignee-add {
  flex: 0 1 60%;
  text-align: right !important;
  padding: 0 !important;
  border: none;
  background: transparent !important;
  font-size: 13px;
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  height: 22px;
}
.task-create-sheet #task-coassignee-pills {
  flex: 1 0 100%;
  margin-top: 6px;
}
.task-create-sheet #task-coassignee-pills:empty { display: none; }

/* Recurrence row: select on the right + tiny interval pill, single line */
.task-create-sheet .task-detail-aside > label:has(#task-recurrence-rule) {
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}
.task-create-sheet #task-recurrence-rule {
  flex: 0 1 auto;
}
.task-create-sheet #task-recurrence-interval {
  width: 40px;
  padding: 2px 6px !important;
  text-align: right;
  background: color-mix(in oklch, var(--text) 6%, transparent);
  border: none;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text);
  height: 22px;
}
.task-create-sheet .task-detail-aside > label:has(#task-recurrence-rule) > span {
  display: none !important;
}

/* iOS-style sheet footer with primary save action */
.task-create-sheet-footer {
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
  background: var(--bg-alt);
  border-top: 1px solid color-mix(in oklch, var(--border) 70%, transparent);
  display: flex;
  gap: 10px;
}
.task-create-sheet-footer button {
  flex: 1;
  height: 46px;
  border: none;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.2px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 100ms ease, opacity 140ms ease;
}
.task-create-sheet-footer button:active { transform: scale(0.985); }

/* Mobile: full-screen sheet that anchors to the bottom of the viewport */
@media (max-width: 720px) {
  .task-create-sheet { padding: 0 !important; align-items: flex-end !important; }
  .task-create-sheet .modal-box {
    width: 100% !important;
    max-height: 92vh !important;
    border-radius: 22px 22px 0 0 !important;
    animation: taskSheetInMobile 320ms cubic-bezier(0.22, 1, 0.36, 1);
  }
  @keyframes taskSheetInMobile {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
}

/* Hide segmented control in edit mode (only the original select is shown) */
#task-form-modal:not(.task-create-sheet) #task-priority-segmented { display: none; }

/* Inline header actions sitting on the left of the title in edit mode.
   Two flavors share a base style: yellow for creator's "Завершить",
   green for the assignee's "На проверку". */
#task-form-modal .modal-header .task-header-action {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: var(--warn-dot);
  color: #fff;
  cursor: pointer;
  margin-right: 12px;
  letter-spacing: -0.1px;
  box-shadow: 0 1px 2px oklch(0 0 0 / 0.08);
  transition: background 140ms ease, transform 100ms ease;
}
#task-form-modal .modal-header .task-header-action:hover { background: color-mix(in oklch, var(--warn-dot) 88%, #000); }
#task-form-modal .modal-header .task-header-action:active { transform: scale(0.97); }
#task-form-modal .modal-header .task-header-action.task-header-action-green {
  background: var(--ok-dot);
}
#task-form-modal .modal-header .task-header-action.task-header-action-green:hover {
  background: color-mix(in oklch, var(--ok-dot) 88%, #000);
}

/* Compose modal — Mail.ru style */
.compose-box { width: min(90vw, 900px) !important; max-width: 900px !important; height: 85vh; max-height: 85vh !important; overflow: hidden !important; display: flex; flex-direction: column; border-radius: 12px; box-shadow: 0 8px 40px rgba(0,0,0,0.25); }
.compose-header { padding: 10px 16px !important; background: var(--bg-alt); flex-shrink: 0; }
.compose-header h3 { font-size: 15px; font-weight: 600; }
.compose-header-btns { display: flex; gap: 4px; }
.compose-header-btns button { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 6px; font-size: 15px; transition: background 0.15s; }
.compose-header-btns button:hover { background: var(--border); }

#compose-form { padding: 0; display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.compose-field-row { display: flex; align-items: center; gap: 8px; padding: 6px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.compose-field-label { font-size: 13px; color: var(--text-muted); min-width: 50px; flex-shrink: 0; }
.compose-field-row input, .compose-field-row select { flex: 1; border: none; outline: none; background: transparent; font-family: inherit; font-size: 14px; color: var(--text); padding: 6px 4px; min-width: 0; }
.compose-field-row select { max-width: 220px; cursor: pointer; }
.compose-field-row input:focus { background: var(--bg-alt); border-radius: 4px; }

.compose-attach-bar { display: flex; align-items: center; gap: 8px; padding: 6px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap; }
.compose-attach-btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 12px; background: var(--bg-alt); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--text); transition: background 0.15s; }
.compose-attach-btn:hover { background: var(--border); }
.compose-attach-bar select { border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 13px; background: var(--bg); color: var(--text); cursor: pointer; }
.compose-tpl-save { border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; font-size: 12px; background: var(--bg); color: var(--text-muted); cursor: pointer; }
.compose-tpl-save:hover { background: var(--bg-alt); }
.compose-file-list { display: flex; gap: 6px; flex-wrap: wrap; margin-left: 8px; font-size: 12px; color: var(--text-muted); }

#compose-form textarea { flex: 1; border: none; outline: none; resize: none; padding: 12px 16px; font-family: inherit; font-size: 13px; line-height: 1.6; background: var(--bg); color: var(--text); min-height: 0; }

.compose-bottom-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border); background: var(--bg-alt); flex-shrink: 0; }
.compose-bottom-left { display: flex; gap: 8px; align-items: center; }
.compose-bottom-right { display: flex; gap: 8px; align-items: center; }
.compose-btn-send { padding: 8px 24px; border-radius: 8px; border: none; background: var(--accent); color: white; font-weight: 600; font-size: 13px; cursor: pointer; transition: background 0.15s; }
.compose-btn-send:hover { background: var(--accent-hover); }
.compose-btn-secondary { padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 13px; cursor: pointer; transition: background 0.15s; }
.compose-btn-secondary:hover { background: var(--bg-alt); }
.compose-schedule-label { display: inline-flex; align-items: center; gap: 6px; }
.compose-schedule-label input[type="datetime-local"] { border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; font-size: 12px; background: var(--bg); color: var(--text); }

/* Tracking toggle buttons */
.track-day-btn { padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 12px; cursor: pointer; transition: all 0.15s; }
.track-day-btn:hover { background: var(--bg-alt); }
.track-day-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.tracking-action-btn { padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg); color: var(--text); font-size: 12px; cursor: pointer; transition: all 0.15s; white-space: nowrap; }
.tracking-action-btn:hover { background: var(--bg-alt); border-color: var(--accent); }

/* Compose minimized bar */
.compose-minimized { position: fixed; bottom: 0; right: 20px; width: 300px; height: 42px; background: var(--accent); color: white; border-radius: 10px 10px 0 0; display: flex; align-items: center; padding: 0 12px; gap: 8px; cursor: pointer; z-index: 200; box-shadow: 0 -2px 12px rgba(0,0,0,0.15); }
.compose-minimized span { flex: 1; font-size: 13px; font-weight: 600; }
.compose-minimized button { background: none; border: none; color: white; font-size: 15px; cursor: pointer; padding: 4px 6px; border-radius: 4px; }
.compose-minimized button:hover { background: rgba(255,255,255,0.2); }

@media (max-width: 600px) {
  .compose-box { width: 100vw !important; height: 100vh !important; max-height: 100vh !important; border-radius: 0; }
  .compose-minimized { right: 0; width: 100vw; border-radius: 0; }
}

/* admin */
/* Компактная одна строка вкладок (в стиле Stripe): не переносится, а мягко
   скроллится по горизонтали при переполнении. Занимает одну строку по высоте. */
.admin-tabs { display: flex; flex-wrap: nowrap; gap: 1px; border-bottom: 1px solid var(--border); padding: 0 10px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--border) transparent; -webkit-overflow-scrolling: touch; }
.admin-tabs::-webkit-scrollbar { height: 6px; }
.admin-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.admin-tabs::-webkit-scrollbar-track { background: transparent; }
.admin-tabs .tab { padding: 9px 11px; background: none; border: none; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; font-size: 12px; line-height: 1.2; white-space: nowrap; flex: none; transition: color .12s ease, border-color .12s ease; }
.admin-tabs .tab:hover { color: var(--text); }
.admin-tabs .tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
#admin-content { padding: 16px 20px; max-height: 65vh; overflow-y: auto; }
/* Таблицы админки живут по метрикам эталона: шапка 30px, строка 26px,
   действия - тихие кнопки, проявляются на наведении строки. */
.admin-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.admin-table th { text-align: left; height: 30px; padding: 0 10px; font-size: 11px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--text-faint); border-bottom: 1px solid var(--border); }
.admin-table td { text-align: left; height: 26px; padding: 0 10px; border-bottom: 1px solid var(--border); }
.admin-table tbody tr:hover > td { background: var(--bg-hover); }
.admin-table tr:last-child > td { border-bottom: 0; }
.admin-table button { height: 22px; padding: 0 8px; font-size: 12px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--field-bg); cursor: pointer; color: var(--text-muted); font-family: inherit; }
.admin-table button:hover { color: var(--text); background: var(--bg-hover); }
.admin-table button.danger { color: var(--danger); border-color: var(--border-strong); }
.admin-form { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: end; }
.admin-form input, .admin-form select { height: 32px; padding: 0 10px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--field-bg); box-shadow: var(--field-shadow); color: var(--text);
  font-size: 13px; font-family: inherit; transition: border-color .15s; outline: none; }
.admin-form input:focus, .admin-form select:focus { border-color: var(--accent); }
.admin-form button { height: 30px; padding: 0 14px; background: var(--accent); color: #fff;
  border: 1px solid var(--accent-hover); border-radius: 8px; box-shadow: var(--btn-shadow); cursor: pointer;
  font-weight: 500; font-size: 13px; font-family: inherit; }

/* Settings cards */
/* Карточка настроек по эталону: скругление 12, воздух между группами, а не
   внутри. Было 16/20/16 - страница из трех строк уезжала на два экрана. */
.settings-card { position: relative; background: var(--bg-alt); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--border); }

/* Info/help button placed in the top-right of any card */
.help-btn {
  position: absolute; top: 14px; right: 14px;
  width: 26px; height: 26px;
  border: none; background: var(--bg-hover);
  color: var(--text-muted);
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px; font-weight: 600; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.15s ease;
  font-family: inherit;
}
.help-btn:hover { background: var(--accent); color: #fff; transform: scale(1.08); }
.help-btn svg { width: 14px; height: 14px; }

/* Help modal */
.help-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
  backdrop-filter: blur(4px);
  animation: help-fade-in 0.15s ease;
}
@keyframes help-fade-in { from { opacity: 0; } to { opacity: 1; } }
.help-modal-box {
  background: var(--bg-alt);
  border-radius: 16px;
  max-width: 560px; width: 100%;
  max-height: 80vh; overflow-y: auto;
  padding: 24px 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  border: 1px solid var(--border);
  animation: help-slide-in 0.2s cubic-bezier(.3,0,.2,1);
}
@keyframes help-slide-in { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.help-modal-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.help-modal-sub   { font-size: 12px; color: var(--text-muted); margin: 0 0 16px; }
.help-modal-box h4 { font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: var(--text); }
.help-modal-box p  { font-size: 13px; line-height: 1.55; color: var(--text); margin: 6px 0; }
.help-modal-box ul { font-size: 13px; line-height: 1.55; color: var(--text); margin: 6px 0; padding-left: 20px; }
.help-modal-box li { margin: 4px 0; }
.help-modal-box code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; padding: 1px 6px; background: var(--bg-hover); border-radius: 4px; }
.help-modal-close {
  margin-top: 16px; width: 100%;
  padding: 10px; border: none; border-radius: 10px;
  background: var(--accent); color: #fff;
  font-size: 13px; font-weight: 500; cursor: pointer;
}
.help-modal-close:hover { background: var(--accent-hover); }
.settings-card legend, .settings-card-title { font-size: 13px; font-weight: 600; letter-spacing: -.01em; color: var(--text); display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.settings-card label { font-size: 13px; color: var(--text); display: block; margin-bottom: 7px; }
.settings-card p { font-size: 11.5px; color: var(--text-faint); margin: 7px 0 0; line-height: 1.45; }
.settings-card input[type="text"], .settings-card input[type="number"], .settings-card input[type="password"], .settings-card input[type="email"], .settings-card select { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--field-bg); box-shadow: var(--field-shadow); color: var(--text); font-size: 13px; font-family: inherit; box-sizing: border-box; outline: none; transition: border-color 0.15s; }
.settings-card input:focus, .settings-card select:focus { border-color: var(--accent); }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 38px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-switch .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background: var(--border-strong); border-radius: 22px; transition: .2s; }
.toggle-switch .slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(16,24,40,.2); transition: .2s; }
.toggle-switch input:checked + .slider { background: var(--accent); }
.toggle-switch input:checked + .slider:before { transform: translateX(16px); }

.burger, .tabbar { display: none; }

/* mobile */
@media (max-width: 900px) {
  #app { display: flex; flex-direction: column; grid-template-columns: none; grid-template-rows: none; position: relative; }
  /* Шапка остаётся и на мобиле, но слева ей мешает бургер (position:fixed),
     поэтому отодвигаем содержимое. */
  #app > #app-topbar { flex: 0 0 44px; padding-left: 44px; }
  /* Кнопка меню размером с остальные органы шапки, а не с плитку: раньше
     она наезжала на название пространства. */
  .burger {
    display: flex; align-items: center; justify-content: center;
    position: fixed; top: 7px; left: 8px; z-index: 50;
    width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border-strong);
    background: var(--field-bg); box-shadow: var(--shadow-xs);
    color: var(--text-muted); font-size: 15px; line-height: 1; cursor: pointer;
  }
  .icon-bar { display: none; }
  .resizer { display: none; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: 280px;
    transform: translateX(-100%); transition: transform 0.2s; z-index: 60;
    box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  }
  #app.show-sidebar .sidebar { transform: translateX(0); }
  #sidebar-overlay { position: fixed; top: 0; right: 0; bottom: 0; left: 280px; background: rgba(0,0,0,0.45); z-index: 55; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  /* Ignore desktop "collapsed" sidebar preference on mobile — always show full-width drawer */
  .sidebar.collapsed { width: 280px; min-width: 280px; padding: 14px; }
  .sidebar.collapsed .brand,
  .sidebar.collapsed .compose-btn,
  .sidebar.collapsed .folder-title,
  .sidebar.collapsed .sidebar-label,
  .sidebar.collapsed .folder-item .count,
  .sidebar.collapsed #mailboxes-group,
  .sidebar.collapsed #sheets-group,
  .sidebar.collapsed .folder-label { display: revert; }
  .sidebar.collapsed .brand-mini,
  .sidebar.collapsed .compose-btn-mini,
  .sidebar.collapsed .sidebar-toggle-btn { display: none; }
  .sidebar.collapsed .sidebar-close { display: inline-flex; }
  .list-pane { flex: 1; width: 100%; border-right: none; }
  .toolbar { padding-left: 60px; padding-top: 8px; }
  .preview-pane { display: none; }
  #app.show-preview .list-pane { display: none; }
  #app.show-preview .preview-pane { display: block; }
  #app.show-preview .burger { left: auto; right: 10px; }
  .messages-list, .preview-pane, #tasks-view, #finance-view, #team-view, #admin-view { padding-bottom: 60px; }
  /* Нижняя панель: иконка и подпись. Иконка без слова заставляет угадывать,
     особенно у похожих разделов - объекты, договоры, документы. */
  /* Колонки равной ширины: у flex кнопки с длинной подписью отбирали место
     у соседей, и «Главная» ужималась вдвое. */
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    position: fixed; bottom: 0; left: 0; right: 0; height: 56px;
    background: var(--bg-pane); border-top: 1px solid var(--border); z-index: 40;
  }
  .tabbar .mtab {
    min-width: 0; background: none; border: none; color: var(--text-muted); cursor: pointer;
    padding: 8px 2px 0; display: grid; justify-items: center; align-content: start; gap: 3px; text-align: center;
    font-family: inherit; font-size: 22px; line-height: 1;
  }
  .tabbar .mtab span {
    display: block; width: 100%; max-width: 100%;
    font-size: 9.5px; line-height: 1.1; letter-spacing: -.02em;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  /* Кто попал в панель, а кто в лист "Еще", решает syncTabbar по одному общему
     правилу для всех разделов. Раньше Договоры были спрятаны отсюда как редкий
     раздел, который открывается из меню, - а меню на телефоне не было, и войти
     в них было нельзя совсем. */
  .tabbar .mtab { padding: 8px 1px 0; }
  .tabbar .mtab svg { display: block; margin: 0 auto; width: 21px; height: 21px; }
  .tabbar .mtab:active { background: var(--bg-hover); }
  .tabbar .mtab.mtab-active { color: var(--accent); }
}

/* Выбор нескольких документов сразу: зона броска + список выбранного.
   Цвет тут означает состояние файла, а не украшает: зелёный - загружен,
   янтарный - такой уже был, красный - не прошёл. */
.dz {
  display: flex; align-items: center; justify-content: center;
  padding: 20px 14px; border: 1px dashed var(--border-strong); border-radius: 10px;
  background: var(--bg-alt); cursor: pointer; transition: border-color .15s, background .15s;
}
.dz.on { border-color: var(--accent); background: color-mix(in oklch, var(--accent) 7%, var(--bg-alt)); }
.dz-hint { font-size: 12.5px; color: var(--text-muted); text-align: center; }
.dz-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 2px; border-top: 1px solid var(--border); font-size: 12.5px;
}
.dz-row:first-child { border-top: 0; padding-top: 10px; }
.dz-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-size { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.dz-st { min-width: 74px; text-align: right; font-weight: 600; color: var(--text-muted); }
.dz-st.ok { color: var(--success); }
.dz-st.dup { color: var(--warning); }
.dz-st.err { color: var(--danger); }
.dz-x {
  border: 0; background: none; color: var(--text-muted); cursor: pointer;
  font-size: 13px; line-height: 1; padding: 3px 4px; border-radius: 5px;
}
.dz-x:hover { background: var(--bg-hover); color: var(--text); }
/* Главное действие окна - одно, и оно акцентное. Класс primary сам по себе
   ничего не красил: кнопка выглядела как вторичная. */
#doc-modal button.primary {
  border: 1px solid var(--accent-hover); border-radius: 8px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
  box-shadow: var(--btn-shadow); cursor: pointer;
}
#doc-modal button.primary:disabled { opacity: .55; cursor: default; box-shadow: none; }

/* Лист разделов на телефоне: то, что не влезло в нижнюю панель. Открывается
   кнопкой "Еще" и всегда показывает ВСЕ доступные разделы, а не только
   спрятанные: так человеку не нужно помнить, где лежит нужный. */
.msheet { position: fixed; inset: 0; z-index: 70; display: none; }
.msheet.on { display: block; }
.msheet-back { position: absolute; inset: 0; background: rgba(16, 18, 27, .38); opacity: 0; transition: opacity .18s ease-out; }
.msheet.on .msheet-back { opacity: 1; }
.msheet-box {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 78vh; overflow-y: auto;
  background: var(--bg-pane); border-top: 1px solid var(--border); border-radius: 14px 14px 0 0;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
  transform: translateY(101%); transition: transform .24s cubic-bezier(.16, 1, .3, 1);
}
.msheet.on .msheet-box { transform: translateY(0); }
.msheet-grip { width: 34px; height: 4px; border-radius: 99px; background: var(--border-strong); margin: 2px auto 12px; }
.msheet-title { padding: 0 18px 8px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.msheet-item {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 52px; padding: 0 18px;
  border: 0; border-top: 1px solid var(--border); background: none; color: var(--text);
  font: inherit; font-size: 15px; text-align: left; cursor: pointer;
}
.msheet-item svg { flex: none; width: 21px; height: 21px; color: var(--text-muted); }
.msheet-item:active { background: var(--bg-hover); }
.msheet-item.on, .msheet-item.on svg { color: var(--accent); }
.msheet-item.on { font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  .msheet-back, .msheet-box { transition: none; }
}

/* Collapsible sidebar sections */
.collapsed-group > :not(.folder-title) { display: none !important; }
.collapsed-group > .folder-title::after { content: ''; }

/* Brand mini (collapsed) */
.brand-mini { display: none; font-size: 15px; font-weight: 800; letter-spacing: 2px; color: var(--text); width: 38px; height: 38px; border-radius: 10px; background: var(--bg-hover); align-items: center; justify-content: center; }
.sidebar.collapsed .brand-mini { display: flex; }
.sidebar.collapsed .brand { display: flex !important; justify-content: center; margin-bottom: 8px; }
.sidebar.collapsed .sidebar-close { display: none; }

/* Scroll to top button */
.scroll-top-btn { display:none; }
.scroll-top-btn:hover { opacity:0.85; }


/* Sidebar drag & drop */
.sidebar .folder-group[draggable="true"] { cursor: grab; }
.sidebar .folder-group.dragging { opacity: 0.4; }
.sidebar .folder-group.drag-over { border-top: 2px solid var(--accent); }
.sidebar .folder-item[draggable="true"] { cursor: grab; }
.sidebar .folder-item.dragging { opacity: 0.4; }
.sidebar .folder-item.drag-over { border-top: 2px solid var(--accent); }

/* Panel scroll-to-top buttons */
.scroll-top-panel { position:absolute; bottom:12px; right:12px; width:32px; height:32px; border-radius:50%; background:var(--bg); color:var(--text-muted); border:1px solid var(--border); cursor:pointer; display:none; align-items:center; justify-content:center; z-index:10; box-shadow:0 2px 8px oklch(0 0 0/0.12); }
.scroll-top-panel:hover { color:var(--accent); border-color:var(--accent); }
.scroll-top-panel.show { display:flex; }

/* ───────────── Home dashboard ───────────── */
#home-view { grid-column: 2 / -1; height: 100vh; overflow-y: auto; background: var(--bg); }
.home-scroll { max-width: 1280px; margin: 0 auto; padding: 32px 36px 60px; }
.home-loading, .home-err { padding: 60px 40px; color: var(--text-muted); text-align: center; }

.home-head { margin-bottom: 22px; }
.home-day { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; color: var(--text-faint); text-transform: uppercase; margin-bottom: 4px; }
.home-title { font-size: 22px; font-weight: 600; letter-spacing: -0.4px; margin: 0; color: var(--text); line-height: 1.2; }

.home-ai {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
:root[data-theme="dark"] .home-ai {
  background: var(--bg-alt);
  border-color: var(--border);
}
.home-ai-label { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; }
.home-ai-text { font-size: 15px; line-height: 1.5; color: var(--text); letter-spacing: -0.1px; }
.home-ai-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.home-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; font-size: 12px; font-weight: 600;
  background: var(--bg-pane); border: 1px solid var(--border); color: var(--accent);
  border-radius: 6px; cursor: pointer; font-family: inherit;
  transition: background .12s, border-color .12s;
}
.home-chip:hover { background: var(--accent-soft); border-color: var(--accent); }

.home-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.home-stat {
  background: var(--bg-pane);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color .12s, transform .08s, box-shadow .12s;
}
.home-stat:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
.home-stat.warn { border-color: rgba(239, 68, 68, 0.3); }
.home-stat.warn:hover { border-color: var(--danger); }
.home-stat-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--text-muted); }
.home-stat-icon { color: var(--accent); display: inline-flex; }
.home-stat.warn .home-stat-icon { color: var(--danger); }
.home-stat-label { font-size: 12px; font-weight: 500; }
.home-stat-value { font-size: 30px; font-weight: 700; color: var(--text); letter-spacing: -0.6px; line-height: 1.1; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.home-stat-sub { font-size: 11px; color: var(--text-faint); }
.home-stat.warn .home-stat-sub { color: var(--danger); font-weight: 600; }

.home-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }

/* «Финансовый пульс» - такая же карточка, но одна во всю ширину, и ровнять её
   не с кем. Общая нижняя граница в 240 пикселей оставляла под тремя цифрами
   160 пикселей пустоты: на телефоне это лишний экран прокрутки, на мониторе -
   дыра посреди главной. Высоту задаёт содержимое. */
#home-pulse { min-height: 0; padding-bottom: 14px; }

.home-block {
  background: var(--bg-pane);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 4px 6px;
  min-height: 240px;
  min-width: 0;
  overflow: hidden;
}
.home-block-wide { padding: 14px 16px 16px; }
.home-block-head { display: flex; justify-content: space-between; align-items: center; padding: 0 14px 10px; }
.home-block-head h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: -0.1px; color: var(--text); }
.home-block-all { font-size: 11px; color: var(--text-muted); cursor: pointer; }
.home-block-all:hover { color: var(--accent); }
.home-empty { padding: 24px 18px; color: var(--text-faint); font-size: 13px; font-style: italic; text-align: center; }

.home-list { list-style: none; margin: 0; padding: 0; }
.home-row { display: flex; align-items: center; gap: 10px; padding: 9px 14px; border-radius: 6px; cursor: pointer; transition: background .1s; min-width: 0; }
.home-row:hover { background: var(--bg-hover); }
.home-row-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 6px; align-self: flex-start; }
.home-row-dot.unread { background: var(--accent); }
.home-row-dot.urgent { background: var(--danger); }
.home-row-dot.high { background: var(--warning); }
.home-row-dot.overdue { background: var(--danger); }
.home-row-dot.credit { background: transparent; width: auto; height: auto; color: var(--text-muted); font-weight: 700; font-size: 13px; margin: 0; align-self: center; }
.home-row-main { flex: 1; min-width: 0; }
.home-row-title { font-size: 13px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 2px; }
.home-row-sub { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-row-date { font-size: 11px; color: var(--text-faint); flex-shrink: 0; font-variant-numeric: tabular-nums; }
.home-row-date.overdue { color: var(--danger); font-weight: 600; }
.home-row-amount { font-size: 13px; font-weight: 700; flex-shrink: 0; font-variant-numeric: tabular-nums; white-space: nowrap; max-width: 40%; overflow: hidden; text-overflow: ellipsis; }
/* Список приходов целиком зелёный ничего не отличает: цвет остаётся состоянию. */
.home-row-amount.credit { color: var(--text); }

/* minmax(0,1fr) и min-width:0 — иначе длинный заголовок задачи (он в одну
   строку, без переносов) растягивает свою колонку и выдавливает остальные дни
   недели за экран. С нулевым минимумом колонка держит ширину, а заголовок
   обрезается многоточием, как и задумано. */
.home-calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.home-cal-day { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; min-height: 110px; display: flex; flex-direction: column; gap: 6px; min-width: 0; overflow: hidden; }
.home-cal-day.today { background: var(--accent-soft); border-color: var(--accent); }
.home-cal-date { display: flex; align-items: baseline; gap: 6px; font-weight: 700; }
.home-cal-dow { font-size: 11px; color: var(--text-faint); letter-spacing: 0.08em; }
.home-cal-day.today .home-cal-dow { color: var(--accent); }
.home-cal-n { font-size: 15px; color: var(--text); }
.home-cal-day.today .home-cal-n { color: var(--accent); }
.home-cal-tasks { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; flex: 1; min-width: 0; }
.home-cal-task { font-size: 11px; line-height: 1.3; padding: 3px 6px; border-radius: 4px; background: var(--bg-pane); border: 1px solid var(--border); color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.home-cal-task.prio-urgent { background: rgba(239,68,68,0.08); color: var(--danger); border-color: rgba(239,68,68,0.2); }
.home-cal-task.prio-high { background: rgba(245,158,11,0.08); color: var(--warning); border-color: rgba(245,158,11,0.2); }
.home-cal-more { font-size: 11px; color: var(--text-faint); padding: 2px 6px; font-weight: 600; }

@media (max-width: 1100px) {
  .home-stats { grid-template-columns: repeat(2, 1fr); }
  .home-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .home-scroll { padding: 20px 16px 80px; }
  .home-title { font-size: 19px; }
  .home-stats { gap: 8px; }
  .home-stat { padding: 12px 14px; }
  .home-stat-value { font-size: 22px; }
  .home-calendar { grid-template-columns: repeat(2, 1fr); }
}

/* Briefing highlights */
.home-ai-text .bi-danger { color: var(--danger); font-weight: 700; }
.home-ai-text .bi-warning { color: var(--warning); font-weight: 700; }
/* Счётчик в тексте - не выделение и не главное действие: жирного хватает,
   индиго остаётся кнопке. */
.home-ai-text .bi-accent { color: var(--text); font-weight: 700; }
.home-ai-text .bi-ok { color: var(--success); font-weight: 700; }
.home-ai-text .bi-muted { color: var(--text-muted); font-weight: 600; }
.home-ai-text .bi-date { color: var(--text); font-weight: 700; }
.home-ai-text .bi-money { color: var(--success); font-weight: 700; font-variant-numeric: tabular-nums; }
.home-ai-text .bi-pct { color: var(--success); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Apple-style avatars (used in admin Telegram tab, could be reused elsewhere) */
.ap-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  font-family: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset 0 -1px 0 rgba(0, 0, 0, 0.10),
    0 1px 2px rgba(0, 0, 0, 0.16),
    0 0 0 0.5px rgba(0, 0, 0, 0.06);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}
.ap-avatar svg { width: 20px; height: 20px; display: block; }

/* Task rows with unread/new comments */
.task-row { position: relative; transition: background 0.15s ease; }
.task-row.has-new {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}
.task-row.has-new:hover { background: var(--bg-hover); }
.task-space-note {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}
/* Задача из другой компании (список «Мои» собирается по всем пространствам). */
.task-space-chip {
  display: inline-block;
  flex-shrink: 0;
  margin-left: 6px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-pane);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  vertical-align: middle;
}
.task-space-hint {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
}
.task-new-dot {
  display: inline-block;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  flex-shrink: 0;
  margin-right: 2px;
  animation: task-pulse 1.8s ease-in-out infinite;
}
@keyframes task-pulse {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-soft); }
  50% { box-shadow: 0 0 0 6px var(--accent-soft); }
}

/* ── Realty section responsive layout ─────────────────────────── */
/* The realty section needs to survive every browser zoom level
   (Ctrl+/-). Past attempts to clip the section with overflow-x:hidden
   on #realty-view + a universal `*{min-width:0}` actually CAUSED the
   tab strip + filter bar to be cut off at zoom 125%+: the heavy-handed
   universal selector defeats the children's own overflow:auto rules
   (no scrollbar can appear inside a hidden parent), and clips sticky
   columns. New rules below scope min-width:0 only to grid/flex parents
   that need it. */
#realty-view { min-width: 0; }
/* Desktop: horizontal scroll on the section when zoom shrinks the
   viewport below the natural width of the tab strip / card. User
   gets a scrollbar instead of silently-clipped content. */
#realty-view { overflow-x: auto; }
/* Mobile (≤720px): NEVER let the whole section pan horizontally —
   it makes the page feel «not glued», как «гуляет под пальцем».
   Tables and grids inside the section still scroll horizontally
   through their own overflow-x:auto wrapper, but the outer card / hero
   / tab strip stay fixed. Without this, touch-pan on iOS happily
   drags everything left-right because the section's own scroll axis
   takes precedence. */
@media (max-width: 720px) {
  #realty-view { overflow-x: hidden; max-width: 100vw; }
  #realty-view * { max-width: 100%; }
  /* Tables и сетки внутри — переопределяем, чтобы они МОГЛИ
     горизонтально скроллиться (внешний max-width:100% сжал бы их). */
  #realty-view table { max-width: none; }
  #realty-view [style*="overflow-x:auto"],
  #realty-view [style*="overflow-x: auto"] {
    max-width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  /* Card hero (синяя верхняя плашка) и плитки KPI — пусть переносятся
     внутри grid'а без выхода за края. Уже работают через
     auto-fit minmax, но max-width:100% перестраховка. */
}
/* Tabs are flex-wrap by inline style — keep them wrapping cleanly.
   flex-shrink:0 prevents the «mid-word truncation» that happens when
   a button is partially squeezed at zoom levels. */
#realty-tabs { padding-bottom: 4px; }
#realty-tabs > button { flex-shrink: 0; }
#realty-mode-bar { overflow-x: auto; padding-bottom: 2px; }
#realty-actions { flex-wrap: wrap; }
/* Body must NOT clip — sticky-right (Итог column) needs a horizontal
   scroll container, not a hidden one. */
#realty-body { max-width: 100%; }
/* Direct children of body get min-width:0 so their inline width:100%
   doesn't blow up the section width. */
#realty-body > * { min-width: 0; }
/* Cells word-break on long sentences but not so aggressively that
   numeric content gets split. */
#realty-body td, #realty-body th { word-break: normal; overflow-wrap: anywhere; }
/* The mode-switch pills lose some padding on narrow screens. */
@media (max-width: 720px) {
  #realty-mode-bar button { padding: 8px 12px !important; font-size: 12px !important; }
  #realty-tabs button { padding: 6px 10px !important; font-size: 12px !important; }
  #realty-view h2 { font-size: 20px !important; }
  /* The object hero card */
  #realty-body > div[style*="linear-gradient"] h2 { font-size: 18px !important; }
}
/* Drawer fills the screen on mobile so forms don't get clipped. */
@media (max-width: 600px) {
  #realty-drawer { width: 100vw !important; }
}


/* Кнопка без своего оформления (например «Отмена» в форме задачи) брала цвет
   текста темы на браузерном светлом фоне: в тёмной теме получался белый текст
   на белом. Задаём вид по умолчанию — кнопки с собственным фоном не задеты. */
button:not([class]):not([style*="background"]) {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
button:not([class]):not([style*="background"]):hover { border-color: var(--accent); color: var(--accent); }

/* Иконка календаря наезжала на дату в узком поле: даём ей место. */
input[type="date"], input[type="datetime-local"], input[type="time"] { padding-right: 8px; }

/* ── Раздел «Документы» ─────────────────────────────────────────────────────
   Шапка как в проводнике (msg 661): навигация, путь, вид, сортировка, поиск.
   Оформление плотное и тихое (см. .impeccable.md): волосяные бордеры, один
   акцент на выделении, тени только у всплывающих слоёв. */

/* ══ Единая палитра продукта (эталон 21.08) ══════════════════════════════════
   У задач, карточки задачи и документов была своя палитра: другой индиго,
   другие нейтральные, свои тени. Разделы выглядели как разные продукты.
   Теперь модули своих цветов не заводят - только имена, которых нет в корне,
   и каждое собрано из общих токенов. Значения меняются в одном месте: в :root. */
#tasks-view, #task-form-modal, #documents-view,
#tc-holder, #nt-holder, #tf-holder, #da-holder, #docs-vdlg, .ui-ask {
  /* Внутри этих модулей --bg значит «поверхность», а --bg-alt «подложка» -
     наоборот к корню. Имена оставлены, значения взяты общие: иначе пришлось бы
     выворачивать восемь десятков правил и что-то обязательно бы перевернулось. */
  --bg: var(--bg-pane);
  --bg-alt: var(--bg-sidebar);
  --surface: var(--bg-pane);
  --surface-hover: var(--bg-hover);
  --surface-sunken: var(--seg-bg);
  --accent-weak: var(--accent-soft);
  --accent-on: #FFFFFF;
  --danger-weak: var(--chip-danger);
  --warn: var(--warning); --warn-weak: var(--chip-warning);
  --ok: var(--success); --ok-weak: var(--chip-success);
  --info: #3B82F6; --info-weak: rgba(59, 130, 246, .12);
  --st-open: var(--text-muted); --st-in_progress: var(--info); --st-awaiting_review: var(--warning);
  --st-done: var(--success); --st-cancelled: var(--text-faint);
  --pr-low: var(--text-quart); --pr-normal: var(--text-faint); --pr-high: var(--warning); --pr-urgent: var(--danger);
  --due-plain: var(--text-muted); --due-today: var(--text); --due-over: var(--num-neg);
  --chkb-plain: var(--border-strong); --overlay: rgba(9, 9, 11, .35);
  --r-4: 6px; --r-6: 8px; --r-8: 12px; --r-12: 16px; --r-full: 999px;
  --sh-1: var(--seg-shadow); --sh-2: var(--shadow-pop);
}
:root[data-theme="dark"] #tasks-view, :root[data-theme="dark"] #task-form-modal,
:root[data-theme="dark"] #documents-view, :root[data-theme="dark"] #tc-holder,
:root[data-theme="dark"] #nt-holder, :root[data-theme="dark"] #tf-holder,
:root[data-theme="dark"] #da-holder, :root[data-theme="dark"] #docs-vdlg,
:root[data-theme="dark"] .ui-ask {
  --accent-on: #0F1230; --overlay: rgba(0, 0, 0, .6);
}
#documents-view {
  padding: 0 !important; display: flex; flex-direction: column; overflow: hidden !important;
  font-family: inherit;
  --docs-row-h: 36px;
}
/* Плотность строк в хранилище больше не переключается (сообщение 1390):
   кнопки «Плотно / Средне / Свободно» меняли высоту строки только в виде
   «Список», в остальных видах не делали ничего. Оставлена плотная строка. */

/* Колонка содержимого: шапка, панель, список. */
.docs-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.docs-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 6px; background: var(--bg); flex: 0 0 auto;
}
.docs-bar h2 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -.02em; color: var(--text); }
.docs-bar .docs-count { font-size: 12px; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.docs-bar .docs-sort { font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.docs-bar h2 { white-space: nowrap; }
.docs-toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 16px 10px; flex-wrap: wrap; flex: 0 0 auto; }

/* Сегменты вида и плотности — те же, что в задачах. */
.docs-seg2 { display: flex; gap: 2px; padding: 2px; background: var(--surface-sunken); border-radius: var(--r-6); }
.docs-seg2 button {
  height: 22px; padding: 0 9px; border: 0; border-radius: var(--r-4); cursor: pointer;
  font: inherit; font-size: 11px; background: transparent; color: var(--text-muted);
}
.docs-seg2 button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.docs-fchip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: var(--r-full); background: transparent;
  font: inherit; font-size: 12px; color: var(--text-muted); cursor: pointer; white-space: nowrap;
}
.docs-fchip:hover { border-color: var(--border-strong); color: var(--text); }
.docs-fchip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-weak); }
.docs-fchip i { font-style: normal; font-size: 11px; opacity: .65; }
.docs-nav { display: flex; gap: 2px; }
.docs-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: none; border-radius: 7px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.docs-icon:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); }
.docs-icon:disabled { color: var(--text-quart); cursor: default; }
.docs-icon.on { background: var(--bg-alt); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.docs-path { display: flex; align-items: center; gap: 4px; min-width: 0; font-size: 13px; font-weight: 650; }
.docs-path button {
  border: none; background: transparent; padding: 2px 4px; border-radius: 5px;
  font: inherit; color: var(--text-muted); font-weight: 500; cursor: pointer;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.docs-path button:hover { color: var(--text); background: var(--bg-hover); }
.docs-path .now { color: var(--text); font-weight: 650; padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-path .sep { color: var(--text-quart); }

/* Переключатель вида: сегменты в одной подложке, как в проводнике. */
.docs-seg { display: flex; gap: 2px; padding: 2px; border-radius: 9px; background: var(--bg-hover); }

.docs-search {
  display: flex; align-items: center; gap: 6px; padding: 0 10px; height: 30px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--bg);
  transition: border-color .12s ease, box-shadow .12s ease; min-width: 180px;
}
.docs-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.docs-search input { border: none; outline: none; background: transparent; color: var(--text); font: inherit; font-size: 13px; width: 100%; }
.docs-search svg { color: var(--text-faint); flex: 0 0 auto; }

/* Границы панелей двигаются мышью, как в проводнике: ширины живут в
   переменных и запоминаются между сеансами. */
.docs-main { flex: 1; display: grid; grid-template-columns: var(--docs-tw, 208px) 7px 1fr; min-height: 0; }
.docs-main.with-info { grid-template-columns: var(--docs-tw, 208px) 7px 1fr 7px var(--docs-iw, 340px); }

.docs-split { cursor: col-resize; position: relative; touch-action: none; }
.docs-split::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px;
  background: var(--border); transform: translateX(-50%); transition: background .12s ease, width .12s ease;
}
.docs-split:hover::after, .docs-split.dragging::after { background: var(--accent); width: 2px; }

.docs-tree { overflow-y: auto; padding: 8px 6px; background: var(--bg-alt); border-right: 1px solid var(--border); }
.docs-tree-up {
  width: 100%; height: 28px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--r-6);
  background: var(--bg-alt); color: var(--text); font: inherit; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
}
.docs-tree-up span { opacity: .6; font-weight: 400; }
.docs-tree-row {
  display: flex; align-items: center; gap: 8px; height: 27px; padding: 0 8px; border-radius: var(--r-6);
  font-size: 12px; color: var(--text); cursor: pointer; user-select: none;
}
.docs-tree-row .ico { width: 14px; text-align: center; font-size: 11px; color: var(--text-faint); flex: 0 0 14px; }
.docs-tree-row:hover { background: var(--bg-hover); }
.docs-tree-row.on { background: var(--accent-weak); color: var(--accent); font-weight: 600; }
.docs-tree-row.on .ico { color: var(--accent); }
.docs-tree-row .count.warn { color: var(--warn); }
.docs-tree-row.drop { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.docs-tree-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-tree-row .count { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.docs-tree-row .more { opacity: 0; border: none; background: transparent; color: var(--text-muted); cursor: pointer; padding: 0 2px; font-size: 13px; line-height: 1; }
.docs-tree-row:hover .more { opacity: 1; }
.docs-tree-caret { width: 12px; text-align: center; color: var(--text-faint); font-size: 11px; transition: transform .12s ease; }
.docs-tree-caret.open { transform: rotate(90deg); }
.docs-tree-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 700; padding: 12px 8px 4px;
}
/* Кнопка «+» у заголовка прижата к правому краю: рядом со словом она
   читалась как часть заголовка. */
.docs-tree-label .more {
  margin-left: auto; width: 18px; height: 18px; line-height: 1; border: 1px solid var(--border);
  border-radius: 6px; background: transparent; color: var(--text-muted); cursor: pointer;
  font-size: 13px; display: flex; align-items: center; justify-content: center; padding: 0;
}
.docs-tree-label .more:hover { border-color: var(--accent); color: var(--accent); }
.docs-tree-add { width: 100%; margin-top: 8px; border: 1px dashed var(--border-strong); background: transparent; color: var(--text-muted); border-radius: 8px; padding: 6px; font-size: 12px; cursor: pointer; }
.docs-tree-add:hover { border-color: var(--accent); color: var(--accent); }

.docs-content { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: auto; padding: 14px 16px 40px; min-width: 0; }

/* Заголовок группы при упорядочивании (msg 665). */
.docs-group {
  display: flex; align-items: baseline; gap: 8px; margin: 18px 0 8px;
  font-size: 11px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; color: var(--text-muted);
}
.docs-group:first-child { margin-top: 2px; }
.docs-group span { font-size: 11px; color: var(--text-faint); letter-spacing: 0; }
/* Разделитель группы внутри списка: имя группы и счётчик пилюлей. */
.docs-table tr.docs-grow td {
  height: 34px; padding: 0 12px; font-size: 12px; letter-spacing: 0;
  text-transform: none; font-weight: 600; color: var(--text); background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.docs-table tr.docs-grow { cursor: default; }
.docs-table tr.docs-grow td span.cv { color: var(--text-faint); font-size: 11px; margin-right: 6px; }
.docs-table tr.docs-grow td span.cnt {
  display: inline-flex; align-items: center; height: 17px; margin-left: 8px; padding: 0 6px;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0;
}

/* Крупный значок формата: в плитке и в панели свойств. */
.docs-fmt.lg { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 10px; font-size: 11px; }
/* Поля документа: две колонки, подпись сверху, значение под ней — как в
   макете. Поле правится на месте, рамку показываем только под курсором. */
.docs-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; margin-top: 14px; }
.docs-fields .wide { grid-column: 1 / -1; }
.docs-fields label { display: block; padding: 6px 0; border-bottom: 1px solid var(--border); }
.docs-fields label > span { display: block; font-size: 11px; color: var(--text-faint); }
.docs-fields input, .docs-fields select {
  width: 100%; box-sizing: border-box; margin-top: 2px; padding: 2px 4px; height: 22px;
  border: 1px solid transparent; border-radius: var(--r-4); background: transparent;
  color: var(--text); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums;
}
.docs-fields input:hover, .docs-fields select:hover { border-color: var(--border); background: var(--surface); }
.docs-fields input:focus, .docs-fields select:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.docs-fields label.soon input { color: var(--warn); }
/* Подписи-рубрики и ссылки в панели свойств. */
.docs-cap { font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); margin: 16px 0 7px; }
.docs-who { display: inline-flex; align-items: center; gap: 5px; background: var(--bg); border-radius: 999px; padding: 1px 6px 1px 1px; font-size: 11px; color: var(--text-muted); }
.docs-who .da-av { width: 14px; height: 14px; flex: 0 0 14px; font-size: 7.5px; }
/* ── Версии документа ────────────────────────────────────────────────────
   Плашка «v3» в строке реестра и история редакций в панели свойств. Размеры
   с макета: строка версии 32px, точка 6px, кнопка замены 28px. */
.docs-ver {
  flex: 0 0 auto; display: inline-flex; align-items: center; height: 18px; padding: 0 7px;
  border-radius: var(--r-full); background: var(--surface-sunken); color: var(--text-faint); font-size: 11px;
}
.docs-vrow { display: flex; align-items: center; gap: 8px; height: 32px; border-radius: var(--r-4); }
.docs-vrow:hover { background: var(--surface-hover); }
.docs-vrow .dot { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; }
.docs-vrow .dot.ok { background: var(--ok); }
.docs-vrow .t { flex: 1; min-width: 0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-vrow .t.dim { color: var(--text-muted); }
.docs-vrow .act { flex: 0 0 auto; display: none; gap: 7px; }
.docs-vrow:hover .act { display: flex; }
.docs-vtag {
  flex: 0 0 auto; display: inline-flex; align-items: center; height: 18px; padding: 0 7px;
  border-radius: var(--r-full); background: var(--ok-weak); color: var(--ok); font-size: 11px;
}
.docs-vnote { font-size: 11px; color: var(--text-faint); padding: 0 0 6px 14px; margin-top: -4px; }
.docs-vempty { font-size: 11px; color: var(--text-faint); padding: 2px 0 4px; }
.docs-vadd {
  width: 100%; height: 28px; margin-top: 9px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-6); background: var(--surface);
  font-size: 12px; color: var(--text-muted); cursor: pointer;
}
.docs-vadd:hover { background: var(--surface-hover); color: var(--text); }
/* Сравнение редакций: две колонки, разошедшиеся строки на жёлтом. */
.docs-vcmp {
  margin-top: 12px; border: 1px solid var(--border); border-radius: var(--r-8);
  background: var(--surface); overflow: hidden;
}
.docs-vcmp .hd {
  display: flex; align-items: center; height: 34px; padding: 0 12px; font-size: 12px; font-weight: 600;
  background: var(--bg-alt); border-bottom: 1px solid var(--border);
}
.docs-vcmp .bd { display: grid; grid-template-columns: 1fr 1fr; }
.docs-vcol { padding: 10px 12px 12px; min-width: 0; }
.docs-vcol + .docs-vcol { border-left: 1px solid var(--border); }
.docs-vcol .h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.docs-vcol .h b { font-size: 12px; }
.docs-vcol .h span { font-size: 11px; color: var(--text-faint); }
.docs-vcol .r { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.docs-vcol .r:last-child { border-bottom: 0; }
.docs-vcol .r.diff { background: var(--warn-weak); }
.docs-vcol .r .k { flex: 0 0 76px; font-size: 11px; color: var(--text-faint); padding-left: 4px; }
.docs-vcol .r .val { font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Диалог «Новая версия»: 420px, зона перетаскивания 96px. */
.docs-vdlg { position: fixed; inset: 0; z-index: 90; background: rgba(14, 23, 32, .32); display: grid; place-items: center; }
.docs-vdlg .box {
  width: 420px; max-width: calc(100vw - 32px); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-8); box-shadow: var(--sh-2); overflow: hidden;
}
.docs-vdlg .hd { display: flex; align-items: center; height: 42px; padding: 0 16px; border-bottom: 1px solid var(--border); font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
.docs-vdlg .bd { padding: 14px 16px 16px; }
.docs-vdlg .drop {
  height: 96px; border: 1px dashed var(--border-strong); border-radius: var(--r-8);
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 0 12px;
  font-size: 12px; color: var(--text-faint); cursor: pointer;
}
.docs-vdlg .drop:hover, .docs-vdlg .drop.over { border-color: var(--accent); color: var(--text); }
.docs-vdlg .lab { font-size: 11px; color: var(--text-faint); margin: 12px 0 5px; }
.docs-vdlg input[type="text"], .docs-vdlg .bd input:not([type]) {
  width: 100%; box-sizing: border-box; height: 30px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--r-6);
  background: var(--surface); color: var(--text); font: inherit; font-size: 12px;
}
.docs-vdlg .bd input:focus { outline: none; border-color: var(--accent); }
.docs-vdlg .err { font-size: 11px; color: var(--danger); margin-top: 8px; min-height: 14px; }
.docs-vdlg .ft { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-top: 1px solid var(--border); background: var(--bg-alt); }
.docs-more {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-6); font-size: 12px; color: var(--text-muted);
}
.docs-more span { margin-left: auto; font-size: 11px; color: var(--text-faint); }
.docs-more:hover { background: var(--surface-hover); color: var(--text); }
/* Пустой экран: рамка на всю область, как в макете при перетаскивании. */
.docs-empty-frame {
  border: 1px dashed var(--border-strong); border-radius: var(--r-8); background: var(--bg-alt);
  min-height: 260px; display: grid; place-items: center;
}
.docs-content.dragover .docs-empty-frame { border-color: var(--accent); background: var(--accent-weak); }

/* Плитка */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
/* Плитка карточкой: значок формата, имя в две строки, снизу размер и доступ. */
.docs-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: 12px; border-radius: var(--r-8); cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
}
.docs-tile:hover { background: var(--surface-hover); }
.docs-tile.on { border-color: var(--accent); background: var(--accent-weak); }
.docs-tile .nm { font-size: 12px; line-height: 1.35; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.docs-tile .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin-top: auto; }
.docs-tile .sub { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }

/* Значок файла: цвет по типу, подпись расширением. */
.docs-glyph { position: relative; width: 44px; height: 56px; border-radius: 5px 9px 5px 5px; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 7px; background: var(--bg-alt); border: 1px solid var(--border-strong); }
.docs-glyph::after { content: ""; position: absolute; top: -1px; right: -1px; width: 13px; height: 13px; background: var(--bg); border-left: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); border-radius: 0 9px 0 4px; }
.docs-glyph span { font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }
.docs-glyph.pdf span { color: #d64545; }
.docs-glyph.img span { color: #2f9e6f; }
.docs-glyph.doc span { color: #3b6fd4; }
.docs-glyph.xls span { color: #1f8b52; }
.docs-glyph.sm { width: 18px; height: 23px; border-radius: 3px 5px 3px 3px; padding-bottom: 3px; }
.docs-glyph.sm::after { width: 7px; height: 7px; border-radius: 0 5px 0 2px; }
.docs-glyph.sm span { font-size: 5.5px; }

/* Список. Ширины колонок заданы жёстко: иначе длинное имя файла растягивает
   таблицу за край экрана и правые колонки уезжают из виду. */
/* Список карточкой: рамка вокруг всей таблицы, строки разделены линиями,
   полос-зебры нет — так же, как в списке задач. */
.docs-table {
  width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-8); overflow: hidden;
}
.docs-table col.c-name { width: auto; }
.docs-table td { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-table thead th {
  position: sticky; top: 0; z-index: 1; background: var(--surface);
  text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); font-weight: 600; padding: 10px 12px 9px;
  white-space: nowrap; cursor: pointer; border-bottom: 1px solid var(--border);
}
.docs-table thead th.on { color: var(--text-muted); }
.docs-table thead th:hover { color: var(--text-muted); }

.docs-table td {
  padding: 0 12px; border-top: none; border-bottom: 1px solid var(--border);
  vertical-align: middle; height: var(--docs-row-h); color: var(--text-muted); font-size: 12px;
}
.docs-table tbody tr:last-child td { border-bottom: 0; }
.docs-table tr { cursor: pointer; }
.docs-table tbody tr:hover td { background: var(--surface-hover); }
.docs-table tr.on td { background: var(--accent-weak); }
/* Значок формата: подложка цвета семейства файла, буквы мелкие и плотные. */
.docs-fmt {
  flex: 0 0 26px; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  font-size: 7.5px; font-weight: 700; letter-spacing: .02em;
  background: var(--surface-sunken); color: var(--text-faint);
}
.docs-fmt.pdf { background: #FBE9EA; color: #C0392B; }
.docs-fmt.xls { background: #E6F3EC; color: #0E7A46; }
.docs-fmt.doc { background: #E9F1F9; color: #2A6FB0; }
.docs-fmt.img { background: #F1ECFB; color: #6B46C1; }
:root[data-theme="dark"] .docs-fmt.pdf { background: #3A1D26; color: #F5849A; }
:root[data-theme="dark"] .docs-fmt.xls { background: #0F2E22; color: #4FC495; }
:root[data-theme="dark"] .docs-fmt.doc { background: #17232F; color: #7FB3E8; }
:root[data-theme="dark"] .docs-fmt.img { background: #221A33; color: #B09AF0; }
/* Ручка на правом краю заголовка: тянем — колонка меняет ширину. */
.docs-grip { position: absolute; top: 0; right: -5px; width: 11px; height: 100%; cursor: col-resize; z-index: 2; }
.docs-grip::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px;
  background: transparent; transform: translateX(-50%); transition: background .12s ease;
}
.docs-grip:hover::after, .docs-grip:active::after { background: var(--accent); }
/* Строка группы идёт через всю ширину — вертикальные линии в ней лишние. */
.docs-table tr.docs-grow td { border-right: none !important; }

.docs-nm { display: flex; align-items: center; gap: 8px; min-width: 0; }
.docs-nm .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Подпись «где нашлось» в выдаче поиска: причина, по которой документ в списке. */
.docs-hit {
  font-size: 11px;
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.docs-nm .docs-hit { flex: 1; padding-left: 6px; border-left: 1px solid var(--border); margin-left: 2px; }
.docs-tile .docs-hit { max-width: 100%; }
.docs-dim { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.docs-over { color: var(--danger); }

/* Колонки: сколько уровней дерева, столько панелей рядом. */
.docs-cols { display: flex; height: 100%; min-height: 320px; overflow-x: auto; }
.docs-col { position: relative; flex: 0 0 var(--docs-pane, 232px); border-right: 1px solid var(--border); overflow-y: auto; padding: 6px; }
.docs-col-row { display: flex; align-items: center; gap: 7px; padding: 5px 8px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.docs-col-row:hover { background: var(--bg-hover); }
.docs-col-row.on { background: var(--bg-selected); color: var(--accent); }
.docs-col-row .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Галерея: крупный просмотр и лента снизу. */
/* Галерея: просмотр сверху, лента снизу, между ними подвижная граница. */
.docs-gal {
  display: grid; grid-template-rows: minmax(0, 1fr) 7px auto var(--docs-gal-strip, 96px);
  gap: 0; height: 100%; min-height: 420px;
}
.docs-gal-split { position: relative; cursor: row-resize; touch-action: none; }
.docs-gal-split::after {
  content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px;
  background: var(--border); transform: translateY(-50%); transition: background .12s ease, height .12s ease;
}
.docs-gal-split:hover::after, .docs-gal-split.dragging::after { background: var(--accent); height: 2px; }
.docs-gal-big { display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
.docs-gal-meta { display: flex; align-items: center; gap: 12px; padding: 10px 0 6px; font-size: 12px; color: var(--text-muted); }
.docs-gal-meta b { font-size: 13px; font-weight: 650; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-gal-meta button { margin-left: auto; flex: 0 0 auto; }
.docs-gal-strip { display: flex; align-items: flex-start; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 2px 2px 8px; min-height: 0; }
/* Плитки ленты подстраиваются под её высоту: границу тянут, лента не режется. */
.docs-gal-item {
  flex: 0 0 auto; height: 100%; aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 9px; background: var(--bg-alt); cursor: pointer; overflow: hidden;
}
.docs-gal-item img { width: 100%; height: 100%; object-fit: cover; }
.docs-gal-item.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }

/* Метки: цветные точки и переключатели (msg 688). */
.docs-tag-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.docs-tag-dot.red { background: #ef4444; }
.docs-tag-dot.orange { background: #f97316; }
.docs-tag-dot.yellow { background: #eab308; }
.docs-tag-dot.green { background: #22c55e; }
.docs-tag-dot.blue { background: #3b82f6; }
.docs-tag-dot.purple { background: #a855f7; }
.docs-tag-dot.gray { background: #9ca3af; }
.docs-tag-dots { display: inline-flex; gap: 3px; margin-left: 6px; flex: 0 0 auto; }
.docs-tags-pick { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; }
.docs-tag-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
.docs-tag-chip:hover { border-color: var(--border-strong); color: var(--text); }
.docs-tag-chip.on { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.docs-menu .docs-tag-dot { margin-right: 2px; }

/* Панель предпросмотра — последняя колонка в виде «Колонки». */
.docs-col-prev { flex: 1 0 300px; display: flex; flex-direction: column; gap: 10px; padding: 14px 12px; }
.docs-prev-box { flex: 1; min-height: 180px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.docs-prev-name { font-size: 13px; font-weight: 650; line-height: 1.35; word-break: break-word; }
.docs-prev-meta { display: grid; gap: 4px 10px; font-size: 12px; color: var(--text-muted); margin: 0; }
.docs-prev-row { display: grid; grid-template-columns: 118px 1fr; gap: 10px; }
.docs-prev-row dt { color: var(--text-faint); }
.docs-prev-row dd { margin: 0; color: var(--text); word-break: break-word; }
.docs-prev-head { display: flex; align-items: baseline; gap: 10px; font-size: 13px; font-weight: 650; margin-top: 4px; }
.docs-prev-head button { margin-left: auto; border: none; background: transparent; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.docs-prev-sub { font-size: 12px; color: var(--text-faint); margin-top: -4px; }
.docs-prev-acts { display: flex; gap: 8px; }

/* Панель свойств справа */
.docs-info { overflow-y: auto; padding: 16px; background: var(--bg); }
.docs-info h3 { margin: 0 0 2px; font-size: 15px; line-height: 1.3; font-weight: 650; word-break: break-word; }
.docs-info .file { font-size: 12px; color: var(--text-faint); margin-bottom: 14px; word-break: break-all; }
.docs-field { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 6px 0; font-size: 12px; border-top: 1px solid var(--border); }
.docs-field dt { color: var(--text-faint); }
.docs-field dd { margin: 0; color: var(--text); word-break: break-word; }
.docs-btn {
  border: 1px solid var(--border-strong); background: var(--bg-alt); color: var(--text);
  border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer;
  transition: border-color .12s ease, color .12s ease;
}
.docs-btn:hover { border-color: var(--accent); color: var(--accent); }
.docs-btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; }
.docs-btn.pri:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.docs-btn.warn:hover { border-color: var(--danger); color: var(--danger); }

/* Состояние разбора точкой: зелёная — прочитан, красная — не вышло,
   жёлтая пульсирует, пока документ в очереди (msg 664). */
.docs-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--text-quart); }
.docs-dot.ok { background: var(--success); }
.docs-dot.bad { background: var(--danger); }
.docs-dot.wait { background: var(--warning); animation: docsPulse 1.4s ease-in-out infinite; }
@keyframes docsPulse { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }
@media (prefers-reduced-motion: reduce) { .docs-dot.wait { animation: none; opacity: .8 } }

.docs-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: var(--bg-hover); color: var(--text-muted); }
.docs-chip.ok { background: color-mix(in oklab, var(--success) 14%, transparent); color: color-mix(in oklab, var(--success) 75%, var(--text)); }
.docs-chip.wait { background: var(--bg-hover); color: var(--text-faint); }
.docs-chip.bad { background: color-mix(in oklab, var(--danger) 12%, transparent); color: var(--danger); }

.docs-text {
  margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg-alt); font-size: 12px; line-height: 1.55; color: var(--text-muted);
  white-space: pre-wrap; max-height: 320px; overflow: auto;
}

/* Меню и выпадающие слои */
.docs-menu {
  position: fixed; z-index: 9998; min-width: 210px; padding: 5px;
  background: var(--bg-alt); border: 1px solid var(--border-strong); border-radius: 11px;
  box-shadow: 0 12px 32px rgba(0,0,0,.16);
  animation: docsPop .12s cubic-bezier(.2,.8,.3,1);
}
@keyframes docsPop { from { opacity: 0; transform: translateY(-4px) } to { opacity: 1; transform: none } }
.docs-menu button {
  display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 9px;
  border: none; background: transparent; color: var(--text); font: inherit; font-size: 13px;
  border-radius: 7px; cursor: pointer; text-align: left;
}
.docs-menu button:hover { background: var(--bg-hover); }
.docs-menu button.danger:hover { color: var(--danger); }
.docs-menu .sep { height: 1px; margin: 5px 4px; background: var(--border); }
.docs-menu .cap { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); font-weight: 700; padding: 7px 9px 4px; }
/* Заголовок-имя (папка, метка) — не рубрика: без капса и разрядки, иначе в
   одном меню соседствуют два разных типа заголовков (п.6). */
.docs-menu .cap.name { font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--text); font-weight: 650; padding-bottom: 6px; }
.docs-menu .on::after { content: "✓"; margin-left: auto; color: var(--accent); }

/* Доступ к документу: плашка в строке реестра и карточка на весь список. */
.docs-acc {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 22px; padding: 0 9px;
  border: 0; border-radius: 999px; font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap;
  background: transparent; color: var(--text-muted);
}
/* «Только я» стоит у каждого документа и повторяет умолчание: заливку носят
   лишь те, у кого доступ отдан кому-то ещё. */
.docs-acc.me .dot { background: var(--border-strong); }
.docs-acc.me:hover { background: var(--bg-hover); }
.docs-acc .dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: currentColor; }
.docs-acc .cv { font-size: 11px; opacity: .65; }
.docs-acc.team { background: #E6F6EF; color: #0E8A5F; }
.docs-acc.named { background: #EEF0FE; color: #4B57D6; }
.docs-acc:hover { filter: brightness(.97); }
:root[data-theme="dark"] .docs-acc { background: #1E2632; color: #9AA8B8; }
:root[data-theme="dark"] .docs-acc.team { background: #0F2E22; color: #4FC495; }
:root[data-theme="dark"] .docs-acc.named { background: #232853; color: #8E97F5; }
.docs-menu .da-mn { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.docs-menu .da-mx { color: var(--text-faint); font-size: 13px; }
.docs-menu button.acc { color: var(--accent); }
.docs-link { border: 0; background: none; padding: 0 0 0 8px; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; }

#da-holder { font-family: inherit; }
#da-holder .da-scrim { position: fixed; inset: 0; background: var(--overlay, rgba(14,23,32,.34)); z-index: 9990; }
#da-holder [data-da-card] {
  position: fixed; z-index: 9991; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--text); font-size: 13px;
}
#da-holder [data-da-card="modal"] {
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(466px, 94vw); max-height: 86vh;
  border-radius: 16px; box-shadow: 0 24px 70px rgba(14,23,32,.22), 0 4px 14px rgba(14,23,32,.10);
}
#da-holder [data-da-card="panel"] {
  right: 0; top: 0; bottom: 0; width: min(420px, 96vw);
  border-left: 1px solid var(--border); box-shadow: var(--sh-2);
}
#da-holder [data-da-card="page"] { left: 0; top: 0; right: 0; bottom: 0; }
#da-holder [data-da-card="page"] .da-body, #da-holder [data-da-card="page"] .da-head,
#da-holder [data-da-card="page"] .da-foot { max-width: 760px; margin: 0 auto; width: 100%; }
#da-holder .da-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 12px; }
#da-holder .da-title { display: flex; flex-direction: column; min-width: 0; }
#da-holder .da-title b { font-weight: 600; font-size: 15px; letter-spacing: -.015em; }
#da-holder .da-title span { margin-top: 3px; font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#da-holder .da-seg { display: flex; gap: 2px; padding: 2px; margin-top: 1px; background: var(--bg-alt); border-radius: 999px; }
#da-holder .da-seg button {
  height: 20px; padding: 0 9px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-muted); font: inherit; font-size: 11px; cursor: pointer;
}
#da-holder .da-seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
#da-holder .da-back { height: 24px; padding: 0 9px; border: 1px solid var(--border); border-radius: var(--r-6); background: transparent; color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer; }
#da-holder .da-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 18px 4px; }
#da-holder .da-load { padding: 40px; text-align: center; color: var(--text-muted); }
#da-holder .da-find { position: relative; }
#da-holder .da-find input {
  width: 100%; box-sizing: border-box; height: 34px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--r-6);
  background: var(--surface); color: var(--text); font: inherit; font-size: 12px;
}
#da-holder .da-find input:focus { outline: none; border-color: var(--accent); }
#da-holder .da-sugg {
  position: absolute; left: 0; right: 0; top: 40px; z-index: 3; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-8); box-shadow: var(--sh-1);
}
#da-holder .da-sugg button {
  display: flex; width: 100%; align-items: center; gap: 9px; height: 30px; padding: 0 10px;
  border: 0; background: transparent; color: var(--text); font: inherit; font-size: 12px;
  cursor: pointer; text-align: left;
}
#da-holder .da-sugg button:hover { background: var(--surface-hover); }
#da-holder .da-sugg .da-nm { flex: 1; min-width: 0; }
#da-holder .da-none { padding: 8px 10px; color: var(--text-faint); font-size: 12px; }
#da-holder .da-cap { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); font-weight: 600; margin: 16px 0 8px; }
#da-holder .da-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
#da-holder .da-who { flex: 1; min-width: 0; }
#da-holder .da-nm { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#da-holder .da-sub { margin-top: 1px; font-size: 11px; color: var(--text-faint); }
#da-holder .da-fixed { font-size: 11px; color: var(--text-faint); }
.da-av {
  width: 20px; height: 20px; flex: 0 0 20px; border-radius: 999px; display: grid; place-items: center;
  color: #fff; font-size: 8.5px; font-weight: 600;
}
.da-av.b { width: 26px; height: 26px; flex: 0 0 26px; font-size: 9.5px; }
/* Отдел — не человек: вместо инициалов ромб на серой подложке. */
.da-av.dept { background: var(--surface-sunken, #EDF1F6); color: var(--text-muted); font-size: 11px; }
.da-av.b.dept { font-size: 11px; }
#da-holder .da-sel {
  display: inline-flex; align-items: center; gap: 5px; padding: 0;
  border: 0; background: transparent;
  color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
}
#da-holder .da-sel:hover { color: var(--text); }
#da-holder .da-sel i { font-style: normal; font-size: 11px; opacity: .65; }
#da-holder .da-rule {
  display: flex; align-items: center; gap: 10px; margin: 11px -18px 0; padding: 11px 18px;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg-alt);
}
#da-holder .da-ic {
  width: 26px; height: 26px; flex: 0 0 26px; border-radius: 999px; display: grid; place-items: center;
  background: var(--surface-sunken); color: var(--text-muted); font-size: 11px;
}
#da-holder .da-x { width: 20px; height: 20px; margin-left: 2px; border: 0; border-radius: var(--r-4); background: transparent; color: var(--text-faint); font-size: 12px; cursor: pointer; }
#da-holder .da-x:hover { color: var(--text); }
#da-holder .da-log {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 -18px; padding: 10px 18px;
  font-size: 11px; color: var(--text-muted);
}
#da-holder .da-loglist { width: 100%; display: flex; flex-direction: column; gap: 5px; }
#da-holder .da-loglist > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; }
#da-holder .da-lnk { margin-left: auto; border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: 11px; cursor: pointer; }
#da-holder .da-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--border); }
#da-holder .da-btn {
  height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-6);
  background: transparent; color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer;
}
#da-holder .da-btn:hover { color: var(--text); background: var(--surface-hover); }
#da-holder .da-btn.pri { padding: 0 16px; background: var(--accent); border-color: var(--accent); color: var(--accent-on); font-weight: 600; }
#da-holder .da-btn.pri:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-on); }

.docs-empty { padding: 48px 24px; text-align: center; color: var(--text-muted); font-size: 13px; }
.docs-empty b { display: block; font-size: 13px; color: var(--text); margin-bottom: 6px; font-weight: 650; }

/* Перетаскивание файла из системы прямо в содержимое папки. */
.docs-content.dropping { outline: 2px dashed var(--accent); outline-offset: -8px; border-radius: 12px; }

/* ── Страница расходов объекта (msg 1195, 1200-1202) ────────────────────── */
/* Шапка экрана по эталону: имя объекта крупно, контекст тише, действия справа.
   Итоги ушли в подвал экрана — в шапке они спорили с заголовком. */
.exp-page { display: flex; flex-direction: column; gap: 24px; }
/* Шапка страницы расходов липнет к верху: список длинный, и прокрутив вниз,
   человек уже не понимал, чей это объект, и лез обратно наверх (msg 1903).
   Фон обязателен — иначе сквозь липкую шапку просвечивают строки таблицы. */
.exp-page-head {
  margin-bottom: 0; position: sticky; top: 0; z-index: 8;
  background: var(--bg); padding: 10px 0 8px; border-bottom: 1px solid var(--border);
}
/* Заголовок в липкой шапке чуть мельче: он висит над списком постоянно. */
.exp-page-head .ds-t b { font-size: 17px; }
/* Итог по объекту — главная цифра страницы. Владелец (01.09.2026): «надо общую
   цифру наверх рядом с адресом». Раньше она лежала в подвале, за девяноста
   строками, и до нее надо было долистать. Отдельной карточки и рамки не даем:
   в шапке и так есть заголовок и кнопки, третья коробка превратила бы строку в
   панель. Цифру держим тем же кеглем, что и адрес, а подпись — тише на тон:
   иерархию задает вес и цвет, а не размер плашки. */
.exp-page-head .exp-total {
  display: flex; flex-direction: column; align-items: flex-end;
  gap: 2px; flex: none; margin-left: auto;
}
.exp-page-head .exp-total .exp-total-l {
  font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); white-space: nowrap;
}
.exp-page-head .exp-total > b {
  font-size: 20px; font-weight: 600; line-height: 1.15;
  letter-spacing: -.015em; font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* Красный только там, где есть состояние: долг есть — виден, долга нет — и цвета нет. */
.exp-page-head .exp-total .exp-total-debt {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--danger); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.exp-page-head .exp-total .exp-total-debt .ds-dot { background: var(--danger); }
/* Воздух между смысловыми группами: адрес, деньги, действия. */
.exp-page-head.ds-head { gap: 28px; }
.exp-back, .exp-add, .exp-row-add {
  padding: 7px 13px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--bg-alt); color: var(--text); font-size: 12px; cursor: pointer;
}
.exp-add { background: var(--accent); border-color: var(--accent); color: var(--accent-on); font-weight: 600; }
/* «Добавить месяц» — второстепенное действие под таблицей, а не кнопка-конфета. */
.exp-row-add { align-self: flex-start; margin: 0; padding: 0 12px; height: 28px; border-radius: 8px;
  border: 1px solid var(--border-strong); background: var(--field-bg); box-shadow: var(--shadow-xs);
  font-size: 12.5px; color: var(--text-muted); }
.exp-row-add:hover { background: var(--bg-hover); color: var(--text); }
.exp-add.ds-btn, .exp-row-add.ds-btn { padding: 0 12px; height: 30px; font-size: 13px; }

/* Секция расходов: рамки нет, её роль играет карточка вокруг таблицы. */
.exp-block { margin-bottom: 0; }
.exp-grid-extra { display: flex; flex-direction: column; gap: 8px; }
.exp-grid-wrap { padding: 0 12px 12px; overflow-x: auto; }
.exp-grid { background: var(--bg-alt); }
.exp-grid th.per { position: sticky; left: 0; z-index: 3; }
.exp-grid td.per { position: sticky; left: 0; background: var(--bg-alt); z-index: 1; }
.exp-grid tbody tr:hover > td.per { background: var(--bg-hover); }
.exp-grid td.st { white-space: nowrap; }
.exp-grid td.per { white-space: nowrap; color: var(--text-muted); }
.exp-grid td.tot { font-weight: 600; }
.exp-grid td.empty { color: var(--text-faint); }
.exp-cell { cursor: pointer; }
.exp-cell:hover { background: var(--bg-hover); }
.exp-grid td.exp-cell { text-align: right; font-size: 13px; line-height: 1.15; white-space: nowrap; }
.exp-cell .v { display: block; }
.exp-cell .d { display: block; font-size: 10.5px; color: var(--text-faint); }
.exp-cell .d.nod { opacity: 0.55; }
.exp-cell .add { color: var(--text-faint); }
.exp-cell.editing { background: var(--accent-weak); }
.exp-cell input { width: 92px; padding: 3px 5px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
.exp-cell-acts { display: inline-flex; gap: 3px; margin-left: 4px; }
.exp-cell-acts button { border: 1px solid var(--border); background: var(--bg); border-radius: 6px; cursor: pointer; font-size: 11px; padding: 2px 6px; color: var(--text-muted); }
.exp-adv td { background: var(--bg-alt); }
.exp-adv td:nth-child(2) { text-align: left; }
.exp-adv-item, .exp-adv-add {
  border: 1px solid var(--border); background: var(--bg); border-radius: 8px; cursor: pointer;
  font-size: 12px; padding: 3px 9px; margin-right: 6px; color: var(--text); font-variant-numeric: tabular-nums;
}
.exp-adv-item .d { color: var(--text-faint); font-size: 11px; margin-left: 6px; }
/* Внесённые авансы по услуге — список под полем ввода в ячейке. */
.exp-adv-line {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 4px; font-size: 11px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.exp-adv-line button {
  border: 1px solid var(--border); background: var(--bg); border-radius: 6px;
  cursor: pointer; font-size: 10px; padding: 1px 5px; color: var(--text-muted);
}
/* Возвраты переплат: строка под периодами и карточка пришедшей переплаты. */
.exp-ovp td { background: var(--bg-alt); }
.exp-ovp td:nth-child(2) { text-align: left; }
.exp-ovp .tot { color: var(--danger); }
.exp-ovp-item {
  display: inline-flex; align-items: baseline; gap: 6px; margin: 0 6px 4px 0;
  border: 1px solid var(--border); background: var(--bg); border-radius: 8px;
  cursor: pointer; font-size: 12px; padding: 3px 9px; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.exp-ovp-item b { color: var(--danger); font-weight: 600; }
.exp-ovp-item i { font-style: normal; color: var(--text-faint); font-size: 11px; }
.exp-ovp-item .w { color: var(--text-muted); font-size: 11px; }
.exp-ovp-item .n { color: var(--text-faint); font-size: 11px; }
.exp-cell .d.ovp { color: var(--accent); }
/* Ячейка, за которой стоит несколько платежей: сумма та же, а под ней тихая
   подпись, сколько их. Цветом не выделяем - это не состояние, а факт. */
.exp-cell .d.pays { color: var(--text-muted); }
.exp-cell.many:hover { background: var(--bg-hover); }

/* ── Платежи за один период: плановый, доплата, корректировка, пеня ──────── */
.exp-pay-pop {
  position: fixed; z-index: 1200; width: min(300px, calc(100vw - 16px));
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--rt-lg);
  box-shadow: var(--shadow-pop); padding: 10px 12px 10px; font-size: 12.5px; color: var(--text);
}
.epp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.epp-head .t { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.epp-x { border: 0; background: none; cursor: pointer; color: var(--text-faint); font-size: 12px; line-height: 1; padding: 2px; }
.epp-x:hover { color: var(--text); }
.epp-row {
  display: flex; align-items: center; gap: 8px; height: 28px;
  border-top: 1px solid var(--border); font-variant-numeric: tabular-nums;
}
.epp-row:first-child { border-top: 0; }
.epp-row .d { flex: 0 0 76px; color: var(--text-muted); font-size: 11.5px; }
.epp-row .a { flex: 1; text-align: right; }
.epp-row .acts { display: inline-flex; gap: 2px; }
.epp-row .acts button {
  border: 1px solid transparent; background: none; border-radius: var(--r-6, 6px); cursor: pointer;
  font-size: 11px; padding: 2px 5px; color: var(--text-faint);
}
.epp-row .acts button:hover { border-color: var(--border); color: var(--text); }
.epp-row .acts button.pri { color: var(--accent); }
.epp-row.edit { height: 34px; }
.epp-row.edit input { padding: 3px 5px; font-size: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--text); }
.epp-row.edit input.d { flex: 0 0 108px; }
.epp-row.edit input.a { flex: 1; min-width: 0; text-align: right; }
.epp-row.edit input:focus { outline: none; border-color: var(--accent); }
.epp-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums;
}
.epp-foot b { color: var(--text); font-weight: 600; }
.epp-add {
  margin-top: 8px; width: 100%; height: 26px; border: 1px solid var(--border); border-radius: var(--r-6, 6px);
  background: var(--bg); color: var(--text-muted); font-size: 12px; cursor: pointer;
}
.epp-add:hover { color: var(--accent); border-color: var(--accent); }
.exp-ovp-in {
  margin: 10px 0 2px; padding: 10px 12px; border-radius: var(--r-8);
  background: var(--accent-soft); border: 1px solid var(--accent);
}
.exp-ovp-in.done { background: var(--bg-alt); border-color: var(--border); }
.exp-ovp-in .t { font-size: 12px; color: var(--text); }
.exp-ovp-in .t .s { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.exp-ovp-in .u { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.exp-ovp-in .u button.x {
  border: 0; background: transparent; cursor: pointer; color: var(--text-faint); font-size: 11px; padding: 0 2px;
}
.exp-ovp-in .f { margin-top: 6px; font-size: 11px; color: var(--text-muted); }
.exp-ovp-use {
  margin-top: 8px; border: 1px solid var(--accent); background: var(--bg); color: var(--text);
  border-radius: var(--r-6); cursor: pointer; font-size: 12px; padding: 5px 12px; font-weight: 500;
}
.exp-ovp-use:hover { background: var(--surface-hover); }
/* Поле формы возврата: подпись сверху, поле снизу. */
.ovp-f { display: block; margin-top: 10px; }
.ovp-f > span { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.ovp-f .in { margin-top: 0; height: 32px; }
.ovp-f select.in { padding: 0 8px; }
#ovp-form .btn.danger-text, #ovp-use .btn.danger-text { color: var(--danger); }

/* Дни недели у повторяющейся задачи. */
.tc-wd-row { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 10px; }
.tc-wd {
  min-width: 34px; padding: 5px 8px; border: 1px solid var(--border); border-radius: var(--r-6);
  background: var(--bg); color: var(--text); font-size: 12px; cursor: pointer;
}
.tc-wd.on { border-color: var(--accent); background: var(--accent); color: #fff; font-weight: 600; }
.tc-wd-hint { flex: 1 0 100%; font-size: 11px; color: var(--text-muted); }

/* Палитра цвета ярлыка: кружки вместо кода вида #3b82f6. */
.tag-sw-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.tag-sw {
  width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; padding: 0;
}
.tag-sw.on { border-color: var(--text); }

/* График рассрочки в блоке «Аренда и НДС»: платежи отмечают прямо тут. */
.exp-sched { margin: 12px 0 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-8); background: var(--bg-alt); }
.exp-sched .t { font-size: 12px; font-weight: 600; color: var(--text); }
.exp-sched .t .s { margin-left: 8px; font-weight: 400; color: var(--text-muted); }
.exp-sched table { width: 100%; border-collapse: collapse; margin-top: 6px; }
.exp-sched td { padding: 4px 6px; font-size: 12px; color: var(--text); border-top: 1px solid var(--border); }
.exp-sched tr:first-child td { border-top: 0; }
.exp-sched td.num { text-align: right; font-variant-numeric: tabular-nums; width: 30%; }
.exp-sched td.st { text-align: right; white-space: nowrap; }
.exp-sched .ok { color: var(--ok, #21a038); }
.exp-sched .wait { color: var(--text-muted); }
/* Найденное в выписке. Это не состояние платежа, а подсказка, поэтому цвета
   светофора тут нет: платёж пока не оплачен, зелёным он станет после отметки
   человеком. Тише текста строки на тон, цифры в табличных знаках - чтобы
   сумма подсказки читалась рядом с суммой графика. */
.exp-sched .found {
  color: var(--text-muted); font-size: 12px; font-variant-numeric: tabular-nums;
  white-space: nowrap; margin-right: 8px;
}
/* Та же подсказка в окне отметки: объясняет, откуда взялась подставленная дата. */
.sched-hint {
  margin: 0 0 12px; padding: 8px 10px; font-size: 12px; line-height: 1.45;
  color: var(--text-muted); background: var(--surface-2, rgba(127,127,127,.06));
  border: 1px solid var(--border, rgba(127,127,127,.18)); border-radius: 8px;
}
.exp-sched button.x { border: 0; background: transparent; cursor: pointer; color: var(--text-faint); font-size: 11px; padding: 0 2px; }
.exp-sched button.pay {
  border: 1px solid var(--accent); background: var(--bg); color: var(--text);
  border-radius: var(--r-6); cursor: pointer; font-size: 11px; padding: 3px 10px; font-weight: 500;
}
.exp-sched button.pay:hover { background: var(--surface-hover); }

/* ── Переменные расходы и вставка пачкой ───────────────────────────────────
   Метрики из эталона: строка 26px, шапка 30px, столбцы правка/дата/сумма/
   назначение, карточка с радиусом 12 вокруг таблицы. Порядок столбцов и полная
   дата — требование владельца (msg 1800-1802), в эталоне тот же порядок. */
.exp-var { table-layout: fixed; }
.exp-var .act { width: 56px; }
.exp-var .d { width: 92px; }
.exp-var .num { width: 120px; }

/* Банк списания. Колонка есть не всегда: у долей это обязательная часть учёта,
   у обычного объекта появляется, только если банк заполняли. */
.exp-var .bnk { width: 150px; }
.exp-var thead th.bnk { text-align: left; }
.exp-var td.bnk { color: var(--text-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.exp-var td.bnk .exp-dash { color: var(--text-faint); }
.exp-var tr.editing td.bnk input { width: 100%; }

.exp-var thead th.d, .exp-var thead th.ttl { text-align: left; }
.exp-var td.d { color: var(--text-soft); white-space: nowrap; }
.exp-var td.num { text-align: right; white-space: nowrap; }
.exp-var td.ttl { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exp-var td.act { padding: 0 8px; }

/* Подзаголовок месяца: воздух между группами и готовый итог месяца. */
.exp-var tr.m > td {
  height: 28px; padding: 0 12px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; cursor: pointer; background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}
.exp-var tr.m:hover > td { color: var(--text); }
.exp-var tr.m td.mh { text-align: left; padding-right: 12px; }
.exp-var tr.m td.mh .mw { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.exp-var tr.m td.mh .l { white-space: nowrap; }
.exp-var tr.m td.mh .s { letter-spacing: 0; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.exp-var tr.m td.mh .cv { color: var(--text-faint); font-size: 9px; margin-right: 6px; }
.exp-var tr.m td.mh .n { margin-left: 8px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-faint); }
.exp-var tr.m.shut > td { color: var(--text-faint); }

/* Правка: строка на время становится формой и единственная имеет фон. */
.exp-var tr.editing > td { background: var(--accent-soft); height: 34px; }
.exp-var tr.editing input {
  width: 100%; padding: 3px 8px; height: 26px; font-size: 12.5px; font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--field-bg); color: var(--text); box-shadow: var(--field-shadow);
}
.exp-var tr.editing td.num input { text-align: right; font-variant-numeric: tabular-nums; }
.exp-var tr.editing input:focus { border-color: var(--accent); outline: none; }
.exp-var tr.editing td.d { color: var(--text-faint); }
.exp-var tr.editing td.ttl .pair { display: flex; gap: 6px; align-items: center; }
.exp-var tr.editing td.ttl .pair input[type="date"] { width: 128px; flex: 0 0 auto; }
/* В правке обе кнопки видны: искать «отмену» наведением — издевательство. */
.exp-var tr.editing .ds-row-acts { opacity: 1; }
.exp-var .ds-row-acts button.ok { color: var(--accent); }

/* Пустой блок учит, а не сообщает о пустоте. */
.exp-var-empty { padding: 22px 16px 26px; max-width: 46ch; }
.exp-var-empty .h { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.exp-var-empty .p { font-size: 12px; color: var(--text-muted); line-height: 1.45; }

/* Экран делится пополам: слева таблица, справа окно вставки (msg 1802). */
.exp-var-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1100px) { .exp-var-wrap { grid-template-columns: minmax(0, 1fr); } }
.exp-var-main { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.exp-var-plus { align-self: flex-start; }

.exp-paste { position: sticky; top: 12px; }
.exp-paste-body { padding: 12px; display: flex; flex-direction: column; gap: 12px; max-height: calc(100vh - 120px); overflow-y: auto; }
.exp-paste-note { font-size: 12px; color: var(--text-muted); line-height: 1.45; }
.exp-paste-area { min-height: 150px; resize: vertical; }
.exp-paste-stats { display: flex; flex-direction: column; gap: 6px; }
.exp-paste-stats b.bad { display: inline-flex; align-items: center; gap: 6px; color: var(--num-neg); }
.exp-paste-stats b.bad .ds-dot { background: var(--danger); }
.exp-paste-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.exp-paste-file { font-size: 12px; color: var(--text-muted); cursor: pointer; text-decoration: underline dotted; }
.exp-paste-file input { display: none; }
.exp-paste-msg { font-size: 11.5px; color: var(--danger); line-height: 1.35; }

/* Предпросмотр распознанного: строка в одну линию и в том же порядке, что в
   таблице — галочка, дата, сумма, назначение. Тесно — линия переносится. */
.exp-paste-list { display: flex; flex-direction: column; gap: 6px; }
.epr { border: 1px solid var(--border); border-radius: 8px; padding: 5px 6px; background: var(--bg); }
.epr.off { opacity: 0.45; }
.epr-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.epr input[type="date"] { flex: 0 0 118px; min-width: 0; }
.epr input.num { width: 88px; text-align: right; font-variant-numeric: tabular-nums; }
.epr input[type="text"], .epr input[type="date"], .epr input[type="number"] {
  padding: 3px 6px; height: 24px; font-size: 11.5px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--field-bg); color: var(--text);
}
.epr .epr-ttl { flex: 1 1 140px; min-width: 0; }
.epr input:focus { border-color: var(--accent); outline: none; }

/* Рамка выделения мышью и панель массовых действий (msg 1190). */
.docs-lasso {
  position: fixed; z-index: 9995; pointer-events: none;
  border: 1px solid var(--accent); background: var(--accent-weak); border-radius: 3px;
}
.docs-content { user-select: none; }
.docs-bulk {
  position: fixed; z-index: 9994; bottom: 18px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px 7px 14px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16);
  font-size: 12px; color: var(--text-muted); white-space: nowrap;
}
.docs-bulk b { color: var(--text); font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .docs-main, .docs-main.with-info { grid-template-columns: 1fr; }
  .docs-tree, .docs-split { display: none; }
  .docs-info { position: fixed; inset: 0 0 0 auto; width: min(360px, 100vw); z-index: 60; background: var(--bg); box-shadow: -8px 0 32px rgba(0,0,0,.18); }
  .docs-bar { flex-wrap: wrap; }
  .docs-search { min-width: 120px; flex: 1; }
}


/* ── Окно «Старые письма» ────────────────────────────────────────────────────
   Спокойная панель в духе stripe: тонкая рамка, один акцент, воздух между
   смысловыми группами. Выбор периода — сегментами как в iOS: подложка-жёлоб,
   выбранный сегмент приподнят светлой плашкой. */
.mailhist-back {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: color-mix(in oklch, #0b0f1e 42%, transparent);
  animation: mailhist-fade .16s ease-out;
}
.mailhist {
  width: 420px; max-width: 100%; box-sizing: border-box;
  background: var(--bg-alt); color: var(--text);
  border: 1px solid var(--border); border-radius: 18px;
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px -20px color-mix(in oklch, #0b0f1e 45%, transparent);
  animation: mailhist-rise .22s cubic-bezier(.2, .9, .3, 1);
}
@keyframes mailhist-fade { from { opacity: 0 } to { opacity: 1 } }
@keyframes mailhist-rise { from { opacity: 0; transform: translateY(10px) scale(.985) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) {
  .mailhist-back, .mailhist { animation: none; }
}

.mailhist { position: relative; }
.mailhist-x {
  position: absolute; top: 14px; right: 14px; width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 8px; background: transparent;
  color: var(--text-faint); cursor: pointer; font-size: 13px; line-height: 1;
  transition: background .14s ease-out, color .14s ease-out;
}
.mailhist-x:hover { background: var(--bg-hover); color: var(--text); }
.mailhist-h { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.mailhist-who { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Цифры загрузки: крупное число — то, что уже есть, остальное тише. */
.mailhist-num { margin-top: 18px; display: flex; align-items: baseline; gap: 7px; }
.mailhist-num b { font-size: 24px; font-weight: 640; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.mailhist-num span { font-size: 13px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mailhist-bar { margin-top: 9px; height: 5px; border-radius: 99px; background: var(--bg-hover); overflow: hidden; }
.mailhist-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s cubic-bezier(.2,.9,.3,1); }
.mailhist-bar.run i { background: linear-gradient(90deg, var(--accent) 0 40%, color-mix(in oklch, var(--accent) 45%, var(--bg-hover)) 40% 100%); background-size: 220% 100%; animation: mailhist-run 1.1s linear infinite; }
@keyframes mailhist-run { from { background-position: 100% 0 } to { background-position: -20% 0 } }
.mailhist-note { margin-top: 7px; font-size: 12px; color: var(--text-muted); }
.mailhist-note.run { color: var(--accent); }

.mailhist-lab { margin: 20px 0 8px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); }

/* Сегменты: жёлоб с приподнятой активной плашкой. */
.mailhist-seg { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--bg-hover); }
.mailhist-seg button {
  flex: 1 1 0; min-width: 0; padding: 7px 4px; border: none; border-radius: 9px;
  background: transparent; color: var(--text-muted); cursor: pointer;
  font: inherit; font-size: 11px; line-height: 1; white-space: nowrap;
  transition: background .16s ease-out, color .16s ease-out, box-shadow .16s ease-out;
}
.mailhist-seg button:hover { color: var(--text); }
.mailhist-seg button.on {
  background: var(--bg-alt); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 2px color-mix(in oklch, #0b0f1e 12%, transparent);
}
:root[data-theme="dark"] .mailhist-seg button.on { box-shadow: 0 1px 2px color-mix(in oklch, #000 40%, transparent); }

/* Своя дата: появляется только когда выбрали «свой», без прыжка высоты окна. */
.mailhist-own { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s cubic-bezier(.2,.9,.3,1); }
.mailhist-own.on { grid-template-rows: 1fr; }
.mailhist-own > div { overflow: hidden; }
.mailhist-own label { display: flex; align-items: center; gap: 10px; padding-top: 12px; font-size: 12px; color: var(--text-muted); }
.mailhist-own input {
  flex: 1; padding: 8px 10px; font: inherit; font-size: 13px;
  border: 1px solid var(--border); border-radius: 9px;
  background: var(--bg); color: var(--text); color-scheme: light dark;
}
.mailhist-own input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklch, var(--accent) 18%, transparent); }

.mailhist-foot { margin-top: 18px; display: flex; align-items: center; gap: 10px; }
.mailhist-foot .hint { flex: 1; font-size: 11px; line-height: 1.45; color: var(--text-faint); }
.mailhist-btn {
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background .14s ease-out, opacity .14s ease-out;
}
.mailhist-btn.go { background: var(--accent); color: #fff; }
.mailhist-btn.go:hover { background: color-mix(in oklch, var(--accent) 88%, #000); }
.mailhist-btn.go:disabled { opacity: .45; cursor: default; }
.mailhist-btn.ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.mailhist-btn.ghost:hover { color: var(--text); }

/* ── Доска задач: колонки тянутся за правый край, исполнитель виден на карточке ── */
.kanban-board {
  display: flex; gap: 10px; align-items: flex-start;
  overflow-x: auto; padding-bottom: 8px;
}
.kanban-col {
  position: relative; min-width: 190px; min-height: 300px; padding: 8px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 6px;
}
/* Полоска захвата на правом краю колонки: узкая, проявляется под курсором. */
.kanban-col-grip {
  position: absolute; top: 0; right: -5px; width: 10px; height: 100%; z-index: 4;
  cursor: col-resize; touch-action: none; display: flex; align-items: center; justify-content: center;
}
/* Ручка видна всегда — 4×26 (макет, раздел «Изменение ширины»). */
.kanban-col-grip::after {
  content: ""; width: 4px; height: 26px; border-radius: 3px;
  background: var(--border-strong); opacity: .9;
}
.kanban-col-grip:hover {
  background: linear-gradient(to right, transparent 4px, var(--accent) 4px, var(--accent) 6px, transparent 6px);
}

.kb-who {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 5px;
  max-width: 100%; padding: 2px 8px 2px 2px; border-radius: 999px;
  background: var(--bg-alt); border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.kb-ava {
  flex: none; width: 17px; height: 17px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8.5px; font-weight: 700; letter-spacing: .2px; color: #fff;
}
.kb-who-none { border-style: dashed; }
.kb-who-none .kb-ava { background: var(--border); color: var(--text-faint); }

/* Блоки-сотрудники внутри колонки: имя сверху, задачи под ним. */
.kb-toggle {
  padding: 5px 11px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600;
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--text-muted);
}
.kb-toggle.on { color: var(--text); border-color: color-mix(in oklch, var(--accent) 45%, var(--border)); }

.kb-group { margin-bottom: 10px; }
.kb-group + .kb-group { border-top: 1px solid var(--border); padding-top: 8px; }
.kb-group-head {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px; padding: 3px 4px;
  border-radius: 7px; cursor: grab; user-select: none;
  font-size: 11px; font-weight: 700; color: var(--text);
}
.kb-group-head:hover { background: color-mix(in oklch, var(--accent) 8%, transparent); }
.kb-chevron { font-size: 11px; color: var(--text-faint); width: 9px; }
.kb-group-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-group-count {
  margin-left: auto; flex: none; padding: 0 6px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border);
  font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.kb-group.collapsed .kb-group-body { display: none; }
.kb-ava-none { background: var(--border); color: var(--text-faint); }

/* ══ Модуль «Задачи»: цвета общие (см. единую палитру выше), здесь только
   имена календаря и высота строки. ══ */
#tasks-view, #task-form-modal {
  --calbg-norm: transparent; --calbg-dim: var(--bg); --calbg-today: var(--accent-soft); --calbg-weekend: var(--bg);
  --calnum-norm: transparent; --calnum-dim: transparent; --calnum-today: var(--accent); --calnum-weekend: transparent;
  --calnumc-norm: var(--text); --calnumc-dim: var(--text-faint); --calnumc-today: #FFFFFF; --calnumc-weekend: var(--text-muted);
  --caltx-live: var(--text); --caltx-over: var(--num-neg); --caltx-done: var(--text-faint);
  --row-h: 36px;
}
:root[data-theme="dark"] #tasks-view, :root[data-theme="dark"] #task-form-modal {
  --calnumc-today: #0F1230;
}
#tasks-view[data-density="dense"] { --row-h: 36px; }
#tasks-view[data-density="mid"] { --row-h: 44px; }
#tasks-view[data-density="loose"] { --row-h: 56px; }

/* Панель над списком и доской: плотность строк, группировка. */
.t2-bar { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; flex-wrap: nowrap; }
.t2-seg { display: inline-flex; flex-wrap: nowrap; background: var(--seg-bg); border-radius: 9px; padding: 2px; gap: 2px; }
.t2-seg button {
  height: 26px; padding: 0 12px; border: 0; border-radius: 7px; cursor: pointer;
  font: inherit; font-size: 12.5px; background: transparent; color: var(--text-muted);
}
.t2-seg button.on { background: var(--bg-pane); color: var(--text); font-weight: 500; box-shadow: var(--seg-shadow); }
.t2-bar-hint { font-size: 11px; color: var(--text-faint); }

/* Строка списка: плотная, всё важное в одну линию. */
.t2-list { border: 1px solid var(--border); border-radius: var(--r-8); background: var(--surface); overflow: hidden; }
.t2-row {
  display: flex; align-items: center; gap: 8px; height: var(--row-h);
  padding: 0 10px 0 8px; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px;
}
.t2-row:last-child { border-bottom: 0; }
.t2-row:hover { background: var(--surface-hover); }
.t2-row.sel { background: var(--accent-weak); }
.t2-row input[type="checkbox"] { flex: 0 0 14px; width: 14px; height: 14px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.t2-pr { flex: 0 0 3px; width: 3px; height: 15px; border-radius: 2px; }
.t2-st { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; }
.t2-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.t2-row.done .t2-title { color: var(--text-muted); }
.t2-meta { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.t2-progress { display: block; width: 16px; height: 3px; border-radius: 2px; background: var(--surface-sunken); overflow: hidden; }
.t2-progress i { display: block; height: 3px; background: var(--st-done); }
.t2-dot { width: 5px; height: 5px; border-radius: 50%; background: transparent; }
.t2-meta.unread { color: var(--accent); }
.t2-meta.unread .t2-dot { background: var(--accent); }
.t2-tag { flex: 0 0 auto; font-size: 11px; color: var(--text-muted); background: var(--bg-alt); border-radius: var(--r-full); padding: 1.5px 7px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Колонка исполнителя шире: рядом с фамилией теперь идёт должность (просьба
   владельца 18.08) — по одной фамилии не видно, кто отвечает за задачу. */
.t2-emp { flex: 0 0 188px; width: 188px; display: flex; align-items: center; gap: 5px; overflow: hidden; font-size: 12px; color: var(--text-muted); }
.t2-emp span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Должность — приписка потише имени, чтобы фамилия читалась первой. */
.t2-role, .kb-role {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 11px; font-weight: 400; color: var(--text-faint);
}
.t2-role::before, .kb-role::before { content: "\00b7"; margin: 0 4px 0 3px; color: var(--text-faint); }
.t2-ava { flex: 0 0 17px; width: 17px; height: 17px; border-radius: var(--r-full); color: #fff; font-size: 8.5px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.t2-ava.none { background: transparent; border: 1px dashed var(--warn); color: var(--warn); }
.t2-due { flex: 0 0 74px; width: 74px; text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--due-plain); }
.t2-due.today { color: var(--due-today); font-weight: 600; }
.t2-due.over { color: var(--due-over); font-weight: 600; }

/* Доска по макету: колонка со своей шапкой, блок сотрудника, плотная карточка. */
#tasks-view .kanban-board { gap: 8px; }
#tasks-view .kanban-col {
  padding: 0; border-radius: var(--r-8); background: var(--bg-alt); border: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 120px;
}
.t2-colhead {
  display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px;
  border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text);
}
.t2-colhead .t2-st { flex: 0 0 7px; }
.t2-colhead .cnt { font-size: 11px; font-weight: 400; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.t2-colhead .add {
  margin-left: auto; width: 20px; height: 20px; border: 0; border-radius: var(--r-4); cursor: pointer;
  background: transparent; color: var(--text-faint); font: inherit; font-size: 13px; line-height: 1;
}
.t2-colhead .add:hover { background: var(--surface-hover); color: var(--text); }
.t2-colbody { padding: 6px; display: flex; flex-direction: column; gap: 6px; }

#tasks-view .kb-group { margin: 0; border-radius: var(--r-6); }
#tasks-view .kb-group + .kb-group { border-top: 0; padding-top: 0; }
#tasks-view .kb-group[data-who="__none"] { background: var(--warn-weak); border: 1px dashed #E7BE97; }
:root[data-theme="dark"] #tasks-view .kb-group[data-who="__none"] { background: #2A2016; border-color: #6B4A28; }
#tasks-view .kb-group-head { height: 26px; margin-bottom: 0; padding: 0 8px; font-size: 11px; }
#tasks-view .kb-group[data-who="__none"] .kb-group-name { color: var(--warn); }
#tasks-view .kb-group[data-who="__none"] .kb-ava { border: 1px dashed var(--warn); background: transparent; color: var(--warn); }
#tasks-view .kb-group-count { background: transparent; border: 0; color: var(--text-faint); padding: 0; }
#tasks-view .kb-group-body { display: flex; flex-direction: column; gap: 5px; padding: 0 5px 5px; }

#tasks-view .kanban-card {
  margin: 0; padding: 7px 8px 6px; border: 1px solid var(--border); border-radius: var(--r-6);
  background: var(--surface); box-shadow: var(--sh-1); font-size: 12px;
}
#tasks-view .kanban-card:hover { border-color: var(--border-strong); }
.t2-cardtop { display: flex; gap: 6px; align-items: flex-start; }
.t2-cardtop .t2-pr { height: 14px; margin-top: 2px; }
.t2-cardtitle {
  flex: 1; min-width: 0; font-size: 12px; line-height: 1.35; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.t2-cardmeta { display: flex; align-items: center; gap: 7px; margin-top: 6px; padding-left: 9px; font-size: 11px; color: var(--text-faint); }
.t2-cardmeta .grow { flex: 1; }
.t2-chip { display: flex; align-items: center; gap: 4px; background: var(--bg-alt); border-radius: var(--r-full); padding: 1px 6px 1px 1px; color: var(--text-muted); }
.t2-chip .t2-ava { flex: 0 0 14px; width: 14px; height: 14px; font-size: 7.5px; }


/* Узкая колонка доски не должна ломать подписи по буквам: всё в одну строку
   с многоточием (замечание владельца по чипу «Гаврилова»). */
.t2-chip, .t2-emp, .t2-tag, .t2-due, .t2-meta, .kb-who { white-space: nowrap; }
.t2-chip { flex: 0 1 auto; min-width: 0; overflow: hidden; }
.t2-chip span:last-child, .t2-emp span:last-child, .kb-who { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.t2-cardmeta { overflow: hidden; }
.t2-cardmeta > * { min-width: 0; }
.t2-cardmeta .t2-tag { max-width: 96px; }
.t2-cardtitle { overflow-wrap: anywhere; }

/* ══ Карточка задачи по макету: крупный заголовок, поля справа строками,
   комментарии/история/файлы — вкладками ══ */
.t2-task #task-title-label, .t2-task #task-desc-label { font-size: 0 !important; gap: 0 !important; }
.t2-task #task-title-input {
  border: 0 !important; padding: 0 !important; background: transparent !important;
  font-size: 20px; font-weight: 600; letter-spacing: -.02em; line-height: 1.3;
}
.t2-task #task-desc-input {
  border: 0 !important; padding: 0 !important; margin-top: 10px; background: transparent !important;
  font-size: 13px; line-height: 1.6; color: var(--text-muted);
}
.t2-task #task-title-input:focus, .t2-task #task-desc-input:focus { outline: none; }
.t2-task .task-detail-main { padding: 16px 18px 24px; }
.t2-task #task-subtasks-row {
  border: 1px solid var(--border); border-radius: var(--r-8, 12px); padding: 0; margin-top: 18px; gap: 0; overflow: hidden;
}
.t2-task #task-subtasks-row > div:first-child { height: 30px; padding: 0 10px; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.t2-task #task-subtasks-list { padding: 0 10px; }
.t2-task #task-subtask-input { border: 0; border-top: 1px solid var(--border); border-radius: 0; }

/* Вкладки вместо трёх лент подряд. */
.t2-tabs { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--border); margin: 18px 0 0; }
.t2-tabs button {
  height: 32px; padding: 0 10px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.t2-tabs button.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.t2-tabs button i { font-style: normal; color: var(--text-faint); font-weight: 400; }
.t2-task #task-comments-row, .t2-task #task-history-row { border-top: 0; margin-top: 0; padding-top: 14px; }
.t2-task #task-comments-row > span:first-child, .t2-task #task-history-row > span:first-child { display: none; }

/* Правая колонка: строки «подпись — значение», как в макете. */
.t2-task .task-detail-aside { background: var(--bg-alt); padding: 12px 14px; gap: 0; }
.t2-task .task-detail-aside > label {
  display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 8px;
  min-height: 32px; padding: 4px 0; border-bottom: 1px solid var(--border);
  font-size: 11px; color: var(--text-faint);
}
.t2-task .task-detail-aside > label > select,
.t2-task .task-detail-aside > label > input:not([type="hidden"]),
.t2-task .task-detail-aside > label > div {
  font-size: 12px; color: var(--text); background: transparent; border: 1px solid transparent;
  border-radius: 6px; padding: 3px 6px; min-width: 0; width: 100%;
}
.t2-task .task-detail-aside > label > select:hover,
.t2-task .task-detail-aside > label > input:not([type="hidden"]):hover { border-color: var(--border); background: var(--surface, var(--bg)); }
.t2-task .task-detail-aside > label > select:focus,
.t2-task .task-detail-aside > label > input:focus { border-color: var(--accent); background: var(--bg); outline: none; }
.t2-task #task-priority-segmented { display: none; }

/* ══ Окно постановки задачи: разметка и стили взяты из макета (Zadachi-B-Yasnost) ══ */
/* Окно постановки задачи берет цвета из единой палитры. */
#nt-holder [data-form] {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(720px, 94vw); max-height: 88vh; z-index: 92;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-12);
  box-shadow: var(--sh-2); display: flex; flex-direction: column; overflow: hidden;
  animation: ntFade .12s ease-out; color: var(--text); font-size: 13px;
}
@keyframes ntFade { from { opacity: 0 } to { opacity: 1 } }
#nt-holder button:hover { background: var(--surface-hover); }
#nt-holder [data-form] input, #nt-holder [data-form] textarea, #nt-holder [data-form] select { font-family: inherit; color: var(--text); }
#nt-holder [data-form] input::placeholder, #nt-holder [data-form] textarea::placeholder { color: var(--text-faint); }
@media (max-width: 640px) { #nt-holder [data-form] > div:nth-child(2) > div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; } }

/* Карточка задачи, окна и диалоги живут на единой палитре (блок выше). */
/* Левая колонка раздела задач — как в макете: 196px, свои разделы и срезы. */
#tasks-nav {
  width: 196px; flex: 0 0 196px; border-right: 1px solid var(--border);
  background: var(--bg-alt); padding: 8px 6px; overflow-y: auto;
}
#tasks-nav button:hover { background: var(--surface-hover, var(--bg)); }
#tasks-nav a:hover { background: var(--surface-hover, var(--bg)); color: var(--text); }
@media (max-width: 900px) {
  #tasks-nav { display: none; }
  /* Срезы на телефоне - одна лента с прокруткой пальцем. Раньше кнопки
     переносились и занимали четыре ряда, пол-экрана до первой задачи. */
  #tasks-subnav {
    display: flex !important; flex-wrap: nowrap !important; overflow-x: auto;
    overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
    margin: 0 -12px 10px !important; padding: 0 12px 4px;
  }
  #tasks-subnav > * { flex: 0 0 auto; }
  #tasks-subnav::-webkit-scrollbar { height: 0; }
  #tasks-main { padding: 12px !important; }
}
#tc-holder, #nt-holder, #tasks-view { font-family: inherit; }
#tc-holder [data-card] {
  position: fixed; z-index: 90; background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; overflow: hidden; animation: tcFade .12s ease-out;
  font-size: 13px;
}
#tc-holder [data-card="modal"] {
  left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(1040px, 93vw); height: min(780px, 88vh);
  border-radius: var(--r-12); box-shadow: var(--sh-2); border: 1px solid var(--border);
}
#tc-holder [data-card="panel"] { right: 0; top: 0; bottom: 0; width: min(560px, 96vw); border-left: 1px solid var(--border); box-shadow: var(--sh-2); }
#tc-holder [data-card="page"] { left: var(--tc-page-left, 196px); top: var(--tc-page-top, 44px); right: 0; bottom: 0; }
#tc-holder [data-card-body] { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
#tc-holder [data-card="page"] [data-card-body] { grid-template-columns: minmax(0, 1fr) 340px; }
#tc-holder [data-card="panel"] [data-card-body] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
#tc-holder [data-card-side] { border-left: 1px solid var(--border); overflow-y: auto; background: var(--bg-alt); padding: 12px 14px; }
#tc-holder [data-card="panel"] [data-card-side] { order: -1; border-left: 0; border-bottom: 1px solid var(--border); overflow: visible; padding: 10px 14px; }
#tc-holder [data-card-fields] { display: flex; flex-direction: column; }
#tc-holder [data-card="panel"] [data-card-fields] { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
#tc-holder [data-card="page"] [data-card-main] { max-width: 860px; margin: 0 auto; width: 100%; }
#tc-holder button:hover { background: var(--surface-hover); }
#tc-holder [data-card] input, #tc-holder [data-card] textarea { font-family: inherit; color: var(--text); }
#tc-holder [data-card] input::placeholder, #tc-holder [data-card] textarea::placeholder { color: var(--text-faint); }
#tc-holder [data-card-fields] > div:hover { background: var(--surface-hover); }
/* Действия у комментария видно сразу: пряталось до наведения, и владелец
   дважды не находил ни «ответить», ни правку своего текста (msg 2274, 2302). */
#tc-holder .tc-cact { opacity: 1; transition: color .12s ease-out; }
@keyframes tcFade { from { opacity: 0 } to { opacity: 1 } }
@media (max-width: 900px) {
  #tc-holder [data-card-body] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  #tc-holder [data-card-side] { order: -1; border-left: 0; border-bottom: 1px solid var(--border); }
}

/* Карточка задачи: размеры и раскладка из спецификации макета (раздел 6). */
#task-form-modal .modal-box.t2-task {
  width: min(1040px, 93vw) !important; max-width: min(1040px, 93vw) !important;
  height: min(780px, 88vh) !important; max-height: min(780px, 88vh) !important;
  border-radius: 16px; overflow: hidden;
}
.t2-task .task-detail-layout { grid-template-columns: minmax(0, 1fr) 300px !important; }
.t2-task .modal-head, #task-form-modal .modal-box.t2-task > .modal-head {
  height: 44px; padding: 0 12px; background: var(--bg-alt); border-bottom: 1px solid var(--border);
}
.t2-task #task-form-title { font-size: 11px; font-weight: 400; color: var(--text-faint); }

/* ── Панель списка: меню группировки и сортировки, виды, плотность ── */
.t2-bar { align-items: center; }
.t2-menu-wrap { position: relative; }
/* Метрики кнопок и сегментов - общие для всей CRM (эталон 21.08):
   кнопка 30px, скругление 8px, подпись 13px. */
.t2-mbtn {
  height: 30px; padding: 0 10px 0 12px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--field-bg); box-shadow: var(--shadow-xs);
  color: var(--text-muted); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 5px;
}
.t2-mbtn b { font-weight: 600; color: var(--text); }
.t2-mbtn span { font-size: 8px; color: var(--text-faint); }
.t2-mbtn.open { border-color: var(--accent); }
.t2-mbtn:hover { background: var(--surface-hover); color: var(--text); }
.t2-menu {
  position: absolute; top: 30px; left: 0; z-index: 40; width: 210px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-8); box-shadow: var(--sh-1);
}
.t2-menu button {
  width: 100%; display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 8px;
  border: 0; border-radius: var(--r-6); background: none; text-align: left; font: inherit; font-size: 12px;
  color: var(--text); cursor: pointer;
}
.t2-menu button:hover { background: var(--surface-hover); }
.t2-menu button.on { background: var(--row-sel, var(--accent-weak)); }
.t2-menu .ck { width: 12px; color: var(--accent); font-size: 11px; }
.t2-menu .lb { flex: 1; }
.t2-menu .hint { font-size: 11px; color: var(--text-faint); }

/* ── Быстрое создание ── */
.t2-quick {
  display: flex; align-items: center; gap: 8px; height: 32px; margin: 0 0 10px;
  padding: 0 10px 0 8px; border: 1px solid var(--border); border-radius: var(--r-6); background: var(--surface);
}
.t2-quick span { color: var(--text-faint); font-size: 13px; }
.t2-quick input { flex: 1; border: 0; outline: none; background: transparent; font: inherit; font-size: 13px; color: var(--text); }

/* ── Шапка группы ── */
.t2-grp {
  display: flex; align-items: center; gap: 7px; height: 27px; padding: 0 10px; cursor: pointer;
  background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.t2-grp .chev { width: 10px; color: var(--text-faint); font-size: 11px; }
.t2-grp .dot { width: 6px; height: 6px; border-radius: 50%; }
.t2-grp .ttl { font-size: 11px; font-weight: 600; color: var(--text); }
.t2-grp .cnt { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.t2-more {
  width: 100%; height: 29px; padding: 0 34px; text-align: left; border: 0; border-bottom: 1px solid var(--border);
  background: none; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer;
}
.t2-more:hover { background: var(--surface-hover); }

/* ── Плитки ── */
.t2-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); gap: 8px; }
.t2-tile {
  border: 1px solid var(--border); border-radius: var(--r-8); background: var(--surface); padding: 9px 10px;
  cursor: pointer; display: flex; flex-direction: column; gap: 7px; box-shadow: var(--sh-1); min-width: 0;
}
.t2-tile:hover { border-color: var(--border-strong); }
.t2-tile .top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.t2-tile .ttl { font-size: 13px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.t2-tile .bot { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); min-width: 0; }
.t2-stchip { font-size: 11px; font-weight: 600; padding: 1.5px 7px; border-radius: var(--r-full); white-space: nowrap; }

/* ── Таблица ── */
.t2-table { border: 1px solid var(--border); border-radius: var(--r-8); background: var(--surface); overflow: auto; }
.t2-thead, .t2-trow { display: grid; align-items: center; }
.t2-thead {
  height: 28px; background: var(--bg-alt); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 2;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint);
}
.t2-thead .th { position: relative; padding-right: 15px; white-space: nowrap; }
.t2-trow { height: var(--row-h); border-bottom: 1px solid var(--border); font-size: 12px; cursor: pointer; }
.t2-trow:hover { background: var(--surface-hover); }
.t2-trow.sel { background: var(--row-sel, var(--accent-weak)); }
.t2-trow input[type="checkbox"] { justify-self: center; width: 14px; height: 14px; accent-color: var(--accent); }
.t2-trow .t2-cell { display: flex; align-items: center; gap: 5px; min-width: 0; padding-right: 8px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t2-trow .t2-emp { display: flex; align-items: center; gap: 5px; min-width: 0; overflow: hidden; }
.cgrip { position: absolute; top: 0; right: -5px; width: 11px; height: 100%; cursor: col-resize; z-index: 6; display: flex; align-items: center; justify-content: center; touch-action: none; }
.cgrip::after { content: ""; width: 2px; height: 16px; border-radius: 2px; background: var(--accent); opacity: 0; transition: opacity .12s; }
.cgrip:hover::after, .cgrip:active::after { opacity: 1; }

/* ── Пустое состояние ── */
.t2-empty {
  border: 1px solid var(--border); border-radius: var(--r-8); background: var(--surface);
  padding: 46px 24px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.t2-empty .ico { width: 34px; height: 34px; border-radius: var(--r-8); display: flex; align-items: center; justify-content: center; font-size: 15px; }
.t2-empty .ttl { font-size: 14.5px; font-weight: 600; }
.t2-empty .txt { font-size: 12px; color: var(--text-muted); max-width: 380px; line-height: 1.5; }
.t2-empty button { margin-top: 5px; height: 27px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--r-6); background: var(--surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer; }

/* ── Массовые действия: плашка снизу по центру (макет, раздел 2) ── */
#tasks-view #task-bulk-bar.bulk-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 8px 0 14px; margin: 0;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-8);
  box-shadow: var(--sh-2); animation: t2Rise .14s ease-out; width: auto; max-width: 96vw; overflow-x: auto;
}
@keyframes t2Rise { from { opacity: 0; transform: translate(-50%, 6px) } to { opacity: 1; transform: translate(-50%, 0) } }
#tasks-view #task-bulk-bar > span:first-child { font-size: 12px; font-weight: 600; white-space: nowrap; }
#tasks-view #task-bulk-bar button, #tasks-view #task-bulk-bar select {
  height: 26px; padding: 0 9px; border: 0; border-radius: var(--r-6); background: transparent;
  color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
}
#tasks-view #task-bulk-bar button:hover, #tasks-view #task-bulk-bar select:hover { background: var(--surface-hover); color: var(--text); }

/* ── Карточка задачи: три контейнера (модалка, панель, страница) ── */
#task-form-modal .modal-box.t2-task.as-panel {
  position: fixed; right: 0; top: 0; bottom: 0; left: auto; width: min(560px, 96vw) !important;
  max-width: min(560px, 96vw) !important; height: 100vh !important; max-height: 100vh !important;
  border-radius: 0; border-left: 1px solid var(--border); transform: none;
}
#task-form-modal .modal-box.t2-task.as-panel .task-detail-layout { grid-template-columns: minmax(0, 1fr) !important; grid-template-rows: auto minmax(0, 1fr); }
#task-form-modal .modal-box.t2-task.as-panel .task-detail-aside { order: -1; border-left: 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
#task-form-modal .modal-box.t2-task.as-page {
  position: fixed; left: 64px; top: 0; right: 0; bottom: 0; width: auto !important; max-width: none !important;
  height: 100vh !important; max-height: 100vh !important; border-radius: 0; transform: none;
}
#task-form-modal .modal-box.t2-task.as-page .task-detail-layout { grid-template-columns: minmax(0, 1fr) 340px !important; }
.t2-cseg { display: flex; background: var(--surface-sunken); border-radius: var(--r-6); padding: 2px; gap: 2px; margin-left: auto; }
.t2-cseg button { height: 20px; padding: 0 8px; border: 0; border-radius: var(--r-4); background: transparent; color: var(--text-muted); font: inherit; font-size: 11px; cursor: pointer; }
.t2-cseg button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }

/* ══ Справка внутри модуля: панель поверх раздела, содержимое берётся из help.html ══ */
#help-panel .help-panel-scrim {
  position: fixed; inset: 0; z-index: 120; background: rgba(14, 23, 32, .35);
  animation: tcFade .12s ease-out;
}
:root[data-theme="dark"] #help-panel .help-panel-scrim { background: rgba(0, 0, 0, .6); }
#help-panel .help-panel-box {
  position: fixed; z-index: 121; right: 0; top: 0; bottom: 0;
  width: min(880px, 96vw); display: flex; flex-direction: column;
  background: var(--bg); border-left: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(14, 23, 32, .16), 0 4px 12px rgba(14, 23, 32, .08);
  animation: tcFade .14s ease-out;
}
#help-panel .help-panel-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 9px;
  height: 46px; padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--border); background: var(--bg-alt);
}
#help-panel .help-panel-title { font-size: 13px; font-weight: 600; color: var(--text); }
#help-panel .help-panel-sub { font-size: 11px; color: var(--text-muted); }
#help-panel .help-panel-out { font-size: 12px; color: var(--text-muted); text-decoration: none; }
#help-panel .help-panel-out:hover { color: var(--accent); }
#help-panel .help-panel-x {
  width: 26px; height: 26px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-muted); font-size: 15px; cursor: pointer;
}
#help-panel .help-panel-x:hover { background: var(--bg-hover, var(--bg-alt)); }
#help-panel .help-panel-body { flex: 1; min-height: 0; overflow-y: auto; }
#help-panel .help-panel-body .wrap { padding: 0 28px; gap: 40px; max-width: none; }
#help-panel .help-panel-body nav.toc { top: 12px; padding-top: 28px; }
#help-panel .help-panel-body main { padding-top: 28px; }
#help-panel .help-panel-body .top { display: none; }
#help-panel .help-panel-load {
  position: fixed; inset: 0; z-index: 121; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px;
}
@media (max-width: 720px) {
  #help-panel .help-panel-body .wrap { padding: 0 16px; }
}

/* ── Кнопка «?» в правом верхнем углу ────────────────────────────────────
   Одно и то же место во всех разделах: последним элементом шапки там, где
   шапка есть, и плавающей — там, где её нет. */
.help-corner {
  width: 26px; height: 26px; flex: 0 0 26px; border: 0; border-radius: var(--r-6, 8px);
  background: transparent; color: var(--text-faint); font-size: 13px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.help-corner:hover { background: var(--bg-alt); color: var(--text); }
#help-float { position: fixed; top: 10px; right: 12px; z-index: 40; }
#help-float .help-corner { background: var(--bg); border: 1px solid var(--border); }
#help-float .help-corner:hover { background: var(--bg-alt); }

/* Уголок изменения размера окна «Новая задача». */
#nt-holder [data-form] { position: fixed; }
/* Полосы для растягивания окна: по всем четырем граням и четырем углам.
   Ширина 6px по грани и 14px в углу - палец и мышь попадают, а содержимое
   окна не перекрывается. */
.nt-rs { position: absolute; z-index: 3; }
.nt-rs.n { top: -3px; left: 12px; right: 12px; height: 8px; cursor: ns-resize; }
.nt-rs.s { bottom: -3px; left: 12px; right: 12px; height: 8px; cursor: ns-resize; }
.nt-rs.w { left: -3px; top: 12px; bottom: 12px; width: 8px; cursor: ew-resize; }
.nt-rs.e { right: -3px; top: 12px; bottom: 12px; width: 8px; cursor: ew-resize; }
.nt-rs.nw { left: -3px; top: -3px; width: 15px; height: 15px; cursor: nwse-resize; }
.nt-rs.se { right: -3px; bottom: -3px; width: 15px; height: 15px; cursor: nwse-resize; }
.nt-rs.ne { right: -3px; top: -3px; width: 15px; height: 15px; cursor: nesw-resize; }
.nt-rs.sw { left: -3px; bottom: -3px; width: 15px; height: 15px; cursor: nesw-resize; }
/* Уголок справа снизу видно - он подсказывает, что окно тянется. */
.nt-rs.se::after {
  content: ""; position: absolute; right: 4px; bottom: 4px; width: 8px; height: 8px;
  border-right: 2px solid var(--border-strong); border-bottom: 2px solid var(--border-strong);
  border-bottom-right-radius: 3px;
}
.nt-rs.se:hover::after { border-color: var(--accent); }

/* ── Строка человека в списках выбора (кому поручить, соисполнители,
   наблюдатели). Должность идёт второй строкой под именем: справа она
   отрывалась от человека, а длинные названия отделов резались. */
.pick-row {
  width: 100%; display: flex; align-items: center; gap: 9px; height: 30px; padding: 0 8px;
  border: 0; border-radius: var(--r-6, 8px); text-align: left; font-size: 12px;
  color: var(--text); cursor: pointer;
}
.pick-row.two { height: 42px; }
.pick-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.pick-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.25; }
.pick-sub {
  font-size: 11px; color: var(--text-faint); line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pick-hint { flex: 0 0 auto; font-size: 11px; color: var(--text-faint); }

/* Подпись группы внутри списка выбора: «Объекты», «Проекты». В одном списке
   два справочника, и без подписи адрес и название проекта читаются как один
   ворох. Подпись негромкая: это ориентир, а не заголовок. */
.pick-head {
  padding: 8px 8px 3px; font-size: 10px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--text-faint); user-select: none;
}
.pick-head:first-child { padding-top: 3px; }

/* ── Свои окна вопросов вместо системного confirm ────────────────────────
   Токены живут внутри модулей, а окно вешается на body — поэтому значения
   продублированы селектором ниже (см. блок #tc-holder). */
.ui-ask { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.ui-ask .scrim { position: absolute; inset: 0; background: rgba(14, 23, 32, .32); }
.ui-ask .box {
  position: relative; width: 380px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-8);
  box-shadow: var(--sh-2); padding: 16px 18px 14px; color: var(--text);
  font-family: inherit;
}
.ui-ask .hd { font-size: 15px; font-weight: 600; letter-spacing: -.015em; }
.ui-ask .tx { margin-top: 7px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.ui-ask .in {
  width: 100%; box-sizing: border-box; margin-top: 12px; height: 30px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--r-6);
  background: var(--bg); color: var(--text); font: inherit; font-size: 12px;
}
.ui-ask .in:focus { outline: none; border-color: var(--accent); }
.ui-ask .ft { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.ui-ask .btn {
  height: 28px; padding: 0 12px; border-radius: var(--r-6); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 12px; cursor: pointer;
}
.ui-ask .btn:hover { background: var(--surface-hover); }
.ui-ask .btn.pri { border: 0; background: var(--accent); color: var(--accent-on); font-weight: 600; padding: 0 14px; }
.ui-ask .btn.pri:hover { background: var(--accent-hover); }
.ui-ask .btn.pri.danger { background: var(--danger); }
.ui-ask .btn.pri.danger:hover { filter: brightness(.94); }

/* ══ Недвижимость: единый язык таблиц раздела (макет «Реестр») ═══════════════
   Существующие токены продукта не менялись — добавлены новые, и только внутри
   контейнеров раздела (.rt2, .rt2-panel), чтобы не задеть --row-h модуля задач. */
:root {
  --text-soft: #5F5F6A;
  --accent-text: #4F46E5;
  --field-bg: #FFFFFF;
  --group-1: rgba(0, 0, 0, .045);
  --group-2: rgba(0, 0, 0, .02);
  --chip-neutral: rgba(0, 0, 0, .05);
  --chip-danger: color-mix(in oklab, var(--bad-dot) 12%, transparent);
  --chip-warning: color-mix(in oklab, var(--warn-dot) 14%, transparent);
  --chip-success: color-mix(in oklab, var(--ok-dot) 15%, transparent);
  --chip-fg-danger: var(--bad);
  --chip-fg-warning: var(--warn);
  --chip-fg-success: var(--ok);
  --num-neg: #B42318;
  --num-pos: #067647;
  --btn-pos-bg: #0B8A5B; --btn-pos-border: #097A50;
  --btn-neg-bg: #DC2626; --btn-neg-border: #C11F1F;
  --xls: #107C41; --xls-soft: rgba(16, 124, 65, .10);
  --pdf: #C8102E; --pdf-soft: rgba(200, 16, 46, .10);
  --focus-ring: rgba(99, 91, 255, .35);
  --rt-sm: 8px; --rt-md: 10px; --rt-lg: 16px; --rt-pill: 999px;
  --shadow-xs: 0 1px 1px rgba(16, 24, 40, .04);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-md: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 20px -8px rgba(16, 24, 40, .12);
  --shadow-pop: 0 12px 32px -10px rgba(16, 24, 40, .24), 0 2px 6px rgba(16, 24, 40, .06);
  --field-shadow: inset 0 1px 1px rgba(16, 24, 40, .04);
  --btn-shadow: 0 1px 2px rgba(55, 48, 163, .32), inset 0 1px 0 rgba(255, 255, 255, .16);
  --seg-shadow: 0 1px 3px rgba(16, 24, 40, .10), 0 1px 1px rgba(16, 24, 40, .04);
  --rt-ease: cubic-bezier(.32, .72, 0, 1);
  /* Подложка сегментированного контрола (эталон 17.08). */
  --seg-bg: rgba(0, 0, 0, .05);
}
/* Тёмная тема продукта сине-фиолетовая, поэтому чипы и поля пересобраны под неё,
   а не скопированы из макета (там нейтральный чёрный). */
:root[data-theme="dark"] {
  --text-soft: #8189b4;
  --accent-text: #b8b3ff;
  --field-bg: #1b2140;
  --group-1: rgba(144, 153, 194, .13);
  --group-2: rgba(144, 153, 194, .05);
  --chip-neutral: rgba(144, 153, 194, .12);
  --chip-danger: color-mix(in oklab, var(--bad-dot) 18%, transparent);
  --chip-warning: color-mix(in oklab, var(--warn-dot) 18%, transparent);
  --chip-success: color-mix(in oklab, var(--ok-dot) 18%, transparent);
  /* На тёмном текст фишки светлее самого цвета: системный красный буквой на
     подложке читается тяжело. */
  --chip-fg-danger: color-mix(in oklab, var(--bad-dot) 78%, #ffffff);
  --chip-fg-warning: color-mix(in oklab, var(--warn-dot) 82%, #ffffff);
  --chip-fg-success: color-mix(in oklab, var(--ok-dot) 82%, #ffffff);
  --num-neg: #ff8fa3;
  --num-pos: #6ee7b7;
  --btn-pos-bg: #0B8A5B; --btn-pos-border: #0d9d68;
  --btn-neg-bg: #DC2626; --btn-neg-border: #e94b4b;
  --xls: #4ADE80; --xls-soft: rgba(74, 222, 128, .14);
  --pdf: #FF8A80; --pdf-soft: rgba(255, 138, 128, .14);
  --focus-ring: rgba(138, 131, 255, .38);
  --shadow-xs: 0 1px 1px rgba(0, 0, 0, .4);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .35);
  --shadow-md: 0 1px 2px rgba(0, 0, 0, .5), 0 10px 24px -10px rgba(0, 0, 0, .7);
  --shadow-pop: 0 16px 40px -12px rgba(0, 0, 0, .8), 0 2px 8px rgba(0, 0, 0, .5);
  --field-shadow: inset 0 1px 1px rgba(0, 0, 0, .3);
  --btn-shadow: 0 1px 2px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .12);
  --seg-shadow: 0 1px 3px rgba(0, 0, 0, .6);
  --seg-bg: rgba(255, 255, 255, .07);
}

.rt2, .rt2-panel, .rt2-wiz { --row-h: 40px; --th-h: 44px; }

/* ── Система кнопок (решение по msg 1278) ───────────────────────────────
   pri     — индиго, главное действие экрана, ровно одно;
   обычная — обводка, рядовое действие;
   quiet   — без рамки, вторичное: экспорт, переключатели вида;
   ok      — зелёная, деньги приходят к нам или факт подтверждается;
   danger  — красная, деньги уходят от нас и разрушающие действия. */
.rt2-btn.ok { border-color: var(--btn-pos-border); background: var(--btn-pos-bg); color: #fff; }
.rt2-btn.ok:hover { filter: brightness(1.06); background: var(--btn-pos-bg); }

/* ── Панель над таблицей: первичное действие, поиск, фильтры, экспорт ── */
.rt2-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 36px; padding: 5px 0; }
/* Панель управления идёт двумя строками, как в макете: сверху — что отобрано
   (счётчик, сегменты, чипы), снизу — чем управляют (поиск, период, фильтры,
   выгрузки, «Добавить»). Перенос задаём явно, иначе строка рвалась где придётся
   и основная кнопка уезжала вниз одна. */
.rt2-bar > .rt2-caps { flex: 0 1 auto; min-width: 0; }
.rt2-brk { flex: 1 0 100%; height: 0; margin: 0; }
.rt2-title { font-size: 15px; font-weight: 600; margin-right: 6px; letter-spacing: -.01em; }
.rt2-spring { flex: 1 1 auto; }
.rt2-sep { width: 1px; height: 20px; background: var(--border); flex: none; }
.rt2-search {
  display: flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; flex: 0 1 220px; min-width: 130px;
  border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--field-bg); box-shadow: var(--field-shadow);
}
.rt2-search input { font-size: 12.5px; }
.rt2-search svg { flex: none; color: var(--text-faint); }
.rt2-search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 13px; color: var(--text); outline: none; }
/* Метрики кнопки и пилюли выровнены по эталону 17.08: 30px, радиус 8, 13px.
   До этого раздел жил на 26px/7px/12.5px и рядом с экраном расходов выглядел
   мельче — из-за таких мелких расхождений экраны и «расходились». */
.rt2-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: 8px; border: 1px solid var(--border-strong); background: var(--field-bg);
  color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer;
  box-shadow: var(--shadow-xs); white-space: nowrap;
  transition: background-color .14s var(--rt-ease), border-color .14s var(--rt-ease), color .14s var(--rt-ease);
}
/* Единственное первичное действие чуть выше остальных — его видно первым. */
.rt2-btn.pri { padding: 0 14px; }
/* Выгрузки узнаются по фирменному цвету, а не по весу кнопки. */
.rt2-btn.xls { color: var(--text); }
.rt2-btn.xls:hover { background: var(--xls-soft); color: var(--xls); }
.rt2-btn.pdf { color: var(--text); }
.rt2-btn.pdf:hover { background: var(--pdf-soft); color: var(--pdf); }
.rt2-btn:hover { background: var(--bg-hover); }
.rt2-btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.rt2-btn.pri { border-color: var(--accent-hover); background: var(--accent); color: #fff; box-shadow: var(--btn-shadow); }
.rt2-btn.pri:hover { background: var(--accent-hover); }
.rt2-btn.quiet { border-color: transparent; background: transparent; box-shadow: none; color: var(--text-muted); font-weight: 400; padding: 0 10px; }
.rt2-btn.quiet:hover { background: var(--bg-hover); color: var(--text); }
.rt2-btn[disabled] { cursor: not-allowed; opacity: .55; }
.rt2-count {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--accent);
  color: #fff; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; justify-content: center;
}
.rt2-seg { display: flex; background: var(--chip-neutral); border-radius: 8px; padding: 2px; flex: none; }
.rt2-seg > button {
  height: 22px; padding: 0 9px; border: 0; border-radius: 6px; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
.rt2-seg > button.on { background: var(--bg-alt); color: var(--text); font-weight: 500; box-shadow: var(--seg-shadow); }
/* Кнопка-иконка в сегменте (плотность строк) — квадратная, без текстовых полей. */
.rt2-seg > button:has(> svg) { width: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* Переключатели вида пальцем.
   Мышью в кнопку 22 пикселя высотой попадаешь всегда, пальцем - через раз:
   палец накрывает около сорока, и промах уводит на соседний вид. На экранах
   без мыши поднимаем высоту до 34 - это нижняя граница, на которой перестаёшь
   промахиваться. На настольном виде ничего не меняется: правило включается
   только там, где указатель грубый. */
@media (pointer: coarse) {
  .rt2-seg > button, .t2-seg button { min-height: 34px; }
  .rt2-seg > button:has(> svg) { width: 34px; }
}

/* ── Раскрывающийся блок фильтров по колонкам ── */
/* Панель фильтров: акцентная полоска сверху — видно, что список сейчас
   отобран этой панелью, а не просто раскрыт лишний блок (макет 13.08). */
.rt2-filters {
  padding: 14px 16px 16px; margin: 0 -16px; border-top: 1px solid var(--border);
  background: var(--bg-alt); box-shadow: inset 0 2px 0 var(--accent);
}
.rt2-fgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 16px; }
.rt2-flabel { font-size: 11px; color: var(--text-muted); margin-bottom: 5px; }
.rt2-finput {
  width: 100%; height: 30px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: 7px;
  background: var(--field-bg); color: var(--text); font: inherit; font-size: 13px; outline: none;
}
.rt2-finput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
/* Заполненное поле видно с первого взгляда: фон, рамка, цвет текста и вес —
   все четыре признака сразу, как в макете. */
.rt2-finput.on {
  border-color: rgba(99, 91, 255, .35); background: var(--accent-soft);
  color: var(--accent-text); font-weight: 500;
}
.rt2-fbot { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.rt2-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }

/* ── Строка состояния: сколько найдено + капсулы активных фильтров ── */
/* Число записей стоит первым в строке — по макету 13.08 это подпись к списку,
   а не хвост у фильтров. */
.rt2-cnt { font-size: 12px; color: var(--text-muted); white-space: nowrap; flex: none; }
.rt2-caps { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }
.rt2-cap {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 10px; white-space: nowrap;
  border-radius: 7px; background: var(--chip-neutral); border: 1px solid transparent;
  font-size: 12.5px; font-weight: 500; color: var(--accent-text); cursor: pointer;
}
.rt2-cap:hover { background: var(--bg-hover); }
.rt2-cap .car { color: var(--text-faint); flex: none; }
/* Крестик показываем на наведении: в спокойном состоянии чип читается как в
   макете — подпись, значение, галка. */
.rt2-cap .x { opacity: 0; width: 0; margin-left: -6px; transition: opacity .12s var(--rt-ease); }
.rt2-cap:hover .x, .rt2-cap:focus-within .x { opacity: 1; width: 16px; margin-left: 0; }
.rt2-cap .k { color: var(--text-muted); font-weight: 400; }
.rt2-cap .x {
  width: 16px; height: 16px; border: 0; padding: 0; border-radius: var(--rt-pill); background: transparent;
  color: var(--text-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.rt2-cap .x:hover { background: var(--bg-hover); color: var(--text); }
.rt2-reset { border: 0; background: transparent; padding: 0; color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--border-strong); }

/* ── Таблица ── */
.rt2-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--rt-lg); background: var(--bg-alt); box-shadow: var(--shadow-sm); }
.rt2-table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.rt2-table th {
  position: sticky; top: 0; z-index: 5; height: var(--th-h); padding: 0 12px; text-align: left;
  font-size: 12px; font-weight: 500; color: var(--text-muted); background: var(--bg);
  border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
.rt2-table th.num { text-align: right; }
/* Сортировка щелчком по заголовку. Стрелка появляется только у выбранной
   колонки: постоянные стрелки у всех заголовков превращают шапку в частокол. */
.rt2-table th { cursor: pointer; user-select: none; }
.rt2-table th:hover { color: var(--text); }
.rt2-table th.rt2-sorted { color: var(--text); font-weight: 600; }
.rt2-sarr { margin-left: 5px; font-size: 9px; color: var(--accent, #635bff); vertical-align: 1px; }
.rt2-table td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt2-table td { padding: 6px 12px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: 13px; line-height: 1.3; }
.rt2-table tbody tr.row { height: var(--row-h); cursor: pointer; transition: background-color .12s var(--rt-ease); }
.rt2-table tbody tr.row:hover > td { background: var(--bg-hover); }
.rt2-table tbody tr.flag > td:first-child { box-shadow: inset 2px 0 0 var(--warning); }
/* Строка договора, который ещё не заключён: бледно-янтарная заливка - по
   светофору это «внимание», работа не закончена. Заключённые, расторгнутые и
   АРДД цвета не получают: цвет здесь означает состояние, а не украшение. */
.rt2-table tbody tr.row.warnrow > td { background: color-mix(in oklab, var(--warn-dot) 9%, transparent); }
.rt2-table tbody tr.row.warnrow:hover > td { background: color-mix(in oklab, var(--warn-dot) 16%, transparent); }
.rt2-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rt2-sub { font-size: 11px; color: var(--text-soft); margin-top: 2px; font-variant-numeric: tabular-nums; }
.rt2-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt2-num.pos { color: var(--num-pos); font-weight: 500; }
.rt2-num.neg { color: var(--num-neg); font-weight: 500; }
/* Третий цвет светофора для чисел: «внимание», между «в порядке» и «плохо».
   Просрочка до десяти дней, частичная оплата — жёлтый, а не сразу красный. */
.rt2-num.warn { color: var(--chip-fg-warning); font-weight: 500; }
.rt2-date { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rt2-dim { color: var(--text-muted); }
.rt2-strong { font-weight: 500; }

/* Заголовки групп: город липнет под шапкой, адрес — под городом. */
/* Фон групп обязан быть непрозрачным: строки данных проезжают под липкой
   шапкой группы, и на полупрозрачной заливке они просвечивали друг сквозь друга.
   Тинт кладём слоем поверх сплошной поверхности. */
.rt2-g1 > td {
  position: sticky; top: var(--th-h); z-index: 4; height: 34px; padding: 0 12px;
  background: linear-gradient(var(--group-1), var(--group-1)), var(--bg-alt);
  border-top: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong);
}
/* Адрес не липкий: внутри города таких групп десятки, и вторая липкая строка
   наезжала на первую. Липнет только город — он и нужен при прокрутке. */
.rt2-g2 > td { height: 30px; padding: 0 12px 0 26px; background: linear-gradient(var(--group-2), var(--group-2)), var(--bg-alt); border-bottom: 1px solid var(--border); }
.rt2-g1 .t { font-size: 13px; font-weight: 600; }
.rt2-g2 .t { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.rt2-g1 .n, .rt2-g2 .n { font-size: 11px; color: var(--text-faint); font-variant-numeric: tabular-nums; margin-left: 8px; }

/* ── Статус: одно слово, никогда не переносится ── */
.rt2-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 19px; padding: 0 8px; border-radius: var(--rt-pill);
  white-space: nowrap; font-size: 11.5px; font-weight: 500; background: var(--chip-neutral); color: var(--text-muted);
}
.rt2-chip i { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--text-faint); }
.rt2-chip.ok { background: var(--chip-success); color: var(--chip-fg-success); }
.rt2-chip.ok i { background: var(--ok-dot); }
.rt2-chip.warn { background: var(--chip-warning); color: var(--chip-fg-warning); }
.rt2-chip.warn i { background: var(--warn-dot); }
.rt2-chip.bad { background: var(--chip-danger); color: var(--chip-fg-danger); }
.rt2-chip.bad i { background: var(--bad-dot); }
.rt2-chip.acc { background: var(--accent-soft); color: var(--accent-text); }
.rt2-chip.acc i { background: var(--accent); }

/* ── Пустые состояния ── */
.rt2-empty { padding: 56px 24px; text-align: center; }
.rt2-empty .h { font-size: 13px; font-weight: 500; }
.rt2-empty .p { font-size: 13px; color: var(--text-muted); margin-top: 6px; }
.rt2-empty .a { margin-top: 14px; display: flex; justify-content: center; gap: 8px; }

/* ── Панель записи (создание и редактирование одним компонентом) ── */
.rt2-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 1000;
  display: flex; flex-direction: column; background: var(--bg-alt); border-left: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
}
.rt2-phead { flex: none; padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 12px; }
.rt2-pkind { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.rt2-ptitle { font-size: 15px; font-weight: 600; line-height: 1.3; }
.rt2-psub { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.rt2-pico {
  width: 30px; height: 30px; flex: none; border-radius: var(--rt-sm); border: 1px solid transparent; background: transparent;
  color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.rt2-pico:hover { background: var(--bg-hover); color: var(--text); }
.rt2-pico.bordered { border-color: var(--border-strong); background: var(--field-bg); box-shadow: var(--shadow-xs); }
.rt2-pmenu { position: absolute; right: 18px; top: 52px; z-index: 3; min-width: 210px; border: 1px solid var(--border); border-radius: var(--rt-md); background: var(--field-bg); box-shadow: var(--shadow-pop); overflow: hidden; }
.rt2-pmenu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.rt2-pmenu button:last-child { border-bottom: 0; }
.rt2-pmenu button:hover { background: var(--bg-hover); }
.rt2-pmenu button.danger { color: var(--danger); }
.rt2-pbody { flex: 1; min-height: 0; overflow: auto; padding: 4px 18px 18px; }
/* Та же панель окном по центру (переключатель в шапке): без прижатия к краю,
   со скруглением и ограничением по высоте - иначе она была бы «панелью сбоку,
   сдвинутой в середину». */
.rt2-panel.windowed {
  position: relative; top: auto; right: auto; bottom: auto; max-height: 90vh;
  border: 1px solid var(--border); border-radius: var(--rt-lg);
}
/* Развёрнутая карточка: открывается кликом по услуге или контрагенту, когда
   человеку нужен весь договор целиком, а не одна колонка. Большое окно, но не
   во весь экран (владелец, 09.09.2026): по краям видно таблицу, поэтому ясно,
   что это карточка над списком, а не другая страница. */
.rt2-panel.windowed.full {
  width: min(1440px, 94vw); max-width: 94vw;
  height: 92vh; max-height: 92vh;
  border-radius: var(--rt-lg);
}
/* На широком экране строка полей во всю ширину читается плохо: глаз теряет,
   какая подпись к какому полю. Окно большое, а содержимое живёт в колонке
   разумной ширины по центру - проценты считаются от самого окна. */
.rt2-panel.full .rt2-pbody > * { max-width: 1240px; }
.rt2-panel.full .rt2-pbody,
.rt2-panel.full .rt2-phead { padding-left: max(24px, calc((100% - 1240px) / 2)); }
/* Клетки, по которым карточка открывается развёрнутой: курсор тот же, но
   подсветка своя - видно, что нажатие здесь ведёт себя иначе. */
.rt2-table td.openfull { cursor: pointer; }
.rt2-table tr.row:hover td.openfull { background: var(--bg-hover, transparent); }
.rt2-pgroup { padding: 18px 0 8px; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.rt2-pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.rt2-f.wide { grid-column: 1 / -1; }
.rt2-flab { font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.rt2-flab .req { color: var(--danger); }
.rt2-fhint { font-size: 11px; color: var(--text-soft); margin-top: 4px; }
/* Предупреждение в шапке блока: доли не сходятся в сотню. */
.rt2-warn { margin-left: 10px; font-size: 11px; color: var(--danger); font-weight: 500; }
.rt2-ferr { font-size: 11px; color: var(--danger); margin-top: 4px; }
.rt2-in {
  width: 100%; height: 34px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: var(--rt-md);
  background: var(--field-bg); color: var(--text); font: inherit; font-size: 13px; box-shadow: var(--field-shadow); outline: none;
}
.rt2-in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.rt2-in.bad { border-color: var(--danger); }
.rt2-in.money, .rt2-in.date { font-variant-numeric: tabular-nums; }
.rt2-in.money { padding-right: 26px; text-align: left; }
.rt2-in.date { padding-right: 30px; }
textarea.rt2-in { height: auto; min-height: 88px; padding: 9px 10px; line-height: 1.45; resize: vertical; }
.rt2-fwrap { position: relative; }
.rt2-fsuffix { position: absolute; right: 10px; top: 0; height: 34px; display: flex; align-items: center; color: var(--text-faint); font-size: 13px; pointer-events: none; }
.rt2-fbtn { position: absolute; right: 6px; top: 3px; width: 28px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--text-faint); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.rt2-fbtn:hover { background: var(--bg-hover); color: var(--text); }
/* Дата с календариком в обычном окне (например «Платёж внесён»): место под
   кнопку и цифры равной ширины. */
.ovp-f .rt2-fwrap .in { padding-right: 34px; font-variant-numeric: tabular-nums; }
.rt2-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.rt2-pick > button {
  height: 32px; padding: 0 12px; display: inline-flex; align-items: center; gap: 7px; border-radius: var(--rt-sm);
  border: 1px solid var(--border-strong); background: var(--field-bg); color: var(--text-muted);
  font: inherit; font-size: 13px; cursor: pointer;
}
.rt2-pick > button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 500; }
.rt2-pick i { width: 5px; height: 5px; border-radius: 50%; flex: none; background: var(--text-faint); }
.rt2-pick i.ok { background: var(--success); }
.rt2-pick i.warn { background: var(--warning); }
.rt2-note { margin-top: 14px; padding: 10px 12px; border-radius: var(--rt-md); background: var(--chip-danger); display: flex; gap: 9px; align-items: flex-start; font-size: 12px; line-height: 1.4; }
.rt2-note .b { width: 16px; height: 16px; flex: none; border-radius: 50%; background: var(--danger); color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.rt2-pmeta { font-size: 11px; color: var(--text-faint); padding-top: 14px; line-height: 1.5; }
.rt2-pfoot { flex: none; padding: 12px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.rt2-pfoot .st { font-size: 12px; color: var(--text-faint); }
.rt2-pbtn { height: 34px; padding: 0 16px; border-radius: var(--rt-sm); border: 1px solid var(--border-strong); background: var(--field-bg); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-xs); }
.rt2-pbtn.pri { border-color: var(--accent-hover); background: var(--accent); color: #fff; font-weight: 500; box-shadow: var(--btn-shadow); }
.rt2-pbtn.pri:hover { background: var(--accent-hover); }
.rt2-pbtn.pri[disabled] { border-color: var(--border-strong); background: var(--chip-neutral); color: var(--text-faint); box-shadow: none; cursor: not-allowed; }

/* Свой календарь: нативное поле даты зависит от локали браузера и в русском
   интерфейсе читается инородно (письмо дизайнера, п.13). */
.rt2-cal { position: absolute; z-index: 1002; width: 232px; padding: 10px; border: 1px solid var(--border); border-radius: var(--rt-md); background: var(--field-bg); box-shadow: var(--shadow-pop); }
.rt2-cal .hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.rt2-cal .hd .m { font-size: 13px; font-weight: 500; }
.rt2-cal .hd button { width: 22px; height: 22px; border: 0; border-radius: var(--rt-sm); background: transparent; color: var(--text-muted); cursor: pointer; }
.rt2-cal .hd button:hover { background: var(--bg-hover); color: var(--text); }
.rt2-cal .gr { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.rt2-cal .wd { height: 18px; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-faint); }
.rt2-cal .d { height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; }
.rt2-cal .d:hover { background: var(--bg-hover); }
.rt2-cal .d.out { color: var(--text-faint); }
.rt2-cal .d.today { color: var(--accent-text); font-weight: 600; }
.rt2-cal .d.on { background: var(--accent); color: #fff; }
.rt2-cal .ft { display: flex; justify-content: space-between; margin-top: 8px; }
.rt2-cal .ft button { border: 0; background: transparent; padding: 2px 4px; color: var(--text-muted); font: inherit; font-size: 12px; cursor: pointer; }
.rt2-cal .ft button:hover { color: var(--text); }

/* ── Страница договора субаренды и экран отчётов: те же кирпичи, что и списки ── */
.rt2-page { max-width: 1180px; }
.rt2-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 4px 0 14px; }
.rt2-back {
  width: 30px; height: 30px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: var(--rt-sm); background: var(--field-bg);
  color: var(--text-muted); cursor: pointer; box-shadow: var(--shadow-xs);
}
.rt2-back:hover { background: var(--bg-hover); color: var(--text); }
.rt2-h1 { font-size: 20px; font-weight: 600; letter-spacing: -.015em; margin: 0; line-height: 1.2; }
.rt2-h1 .dim { color: var(--text-muted); font-weight: 400; }

/* Полоса реквизитов: не карточка, а сетка пар между двумя линиями — так она
   не спорит с блоками ниже и не даёт «карточку в карточке». */
.rt2-facts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px 24px;
  padding: 14px 0 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.rt2-facts .k { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.rt2-facts .v { font-size: 13px; line-height: 1.35; }
.rt2-facts .v .sub { font-size: 11px; color: var(--text-soft); margin-top: 2px; }

/* Финансовые показатели — только то, что реально смотрят: получено и дисциплина. */
.rt2-tiles { display: flex; gap: 12px; flex-wrap: wrap; margin: 18px 0; }
.rt2-tile { min-width: 190px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--rt-md); background: var(--bg-alt); }
.rt2-tile .k { font-size: 11px; color: var(--text-muted); }
.rt2-tile .v { font-size: 20px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.rt2-tile .v.pos { color: var(--num-pos); }
.rt2-tile .v.neg { color: var(--num-neg); }
.rt2-tile .n { font-size: 11px; color: var(--text-soft); margin-top: 3px; }

/* Сворачиваемый блок: заметка не должна занимать столько же места, сколько деньги. */
.rt2-fold { border-top: 1px solid var(--border); }
.rt2-fold > summary { list-style: none; cursor: pointer; padding: 12px 0; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.rt2-fold > summary::-webkit-details-marker { display: none; }
.rt2-fold > summary .chev { width: 12px; height: 12px; color: var(--text-faint); transition: transform .16s var(--rt-ease); }
.rt2-fold[open] > summary .chev { transform: rotate(90deg); }
.rt2-fold > summary .note { font-size: 12px; color: var(--text-soft); font-weight: 400; }
.rt2-fold .body { padding: 0 0 16px; }

.rt2-sec { display: flex; align-items: center; gap: 10px; padding: 20px 0 10px; }
.rt2-sec .t { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.rt2-sec .n { font-size: 12px; color: var(--text-soft); }

/* Строка года в таблице поступлений + итог года. */
.rt2-year > td { background: linear-gradient(var(--group-1), var(--group-1)), var(--bg-alt); border-top: 1px solid var(--border-strong); border-bottom: 1px solid var(--border-strong); height: 34px; padding: 0 12px; font-size: 13px; font-weight: 600; }
.rt2-total > td { background: linear-gradient(var(--group-2), var(--group-2)), var(--bg-alt); font-weight: 600; }
.rt2-quiet { color: var(--text-faint); font-size: 12px; }

/* Лента месяцев в отчёте «Неплательщики: аренда + КУ». Под лентой — счётчик
   отмеченного и снятие: тринадцать кнопок глазами не пересчитывают. */
.subl-months { display: flex; flex-direction: column; gap: 7px; max-width: 660px; }
.subl-months .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.subl-months .foot { display: flex; align-items: center; gap: 10px; min-height: 16px; }
.rt2-linkbtn {
  border: 0; background: transparent; padding: 0; font: inherit; font-size: 12px;
  color: var(--accent-text); cursor: pointer;
}
.rt2-linkbtn:hover { text-decoration: underline; }

/* Лампочка: по договору есть выставленные, но не оплаченные счета. Янтарь —
   средний цвет светофора: это «вернись и добери», а не «всё пропало». Точка
   стоит слева от имени и держит собственную линию, не толкая текст. */
.subl-bulb { flex: none; width: 11px; height: 11px; margin-top: 4px; border-radius: 50%; background: var(--warning); }

/* ── Итоги таблицы и групп (msg 1445) ──
   Строка итога липнет к низу окна: суммы нужны и в середине списка, а не
   только когда долистаешь до конца. Суммы групп идут справа в той же строке
   заголовка города или адреса. */
/* Макет 12.08: итог — не «ещё одна строка таблицы», а её подошва: сплошной
   фон страницы, тонкая линия сверху вместо рамки, ничего лишнего. */
.rt2-foot > tr > td {
  position: sticky; bottom: 0; z-index: 6; height: 36px; padding: 0 12px;
  background: var(--bg); box-shadow: inset 0 1px 0 var(--border-strong);
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
}
.rt2-foot .lbl { color: var(--text); }
.rt2-foot .num { text-align: right; font-variant-numeric: tabular-nums; }
/* Суммы группы стоят под своими колонками, в тон заголовку группы: они
   подсказка, а не главная цифра таблицы. */
.rt2-g1 .gsum {
  text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap;
  font-size: 12.5px; font-weight: 600;
}
.rt2-g1 .gsum.pos, .rt2-foot .num .rt2-num.pos { color: var(--num-pos); }
.rt2-g1 .gsum.neg, .rt2-foot .num .rt2-num.neg { color: var(--num-neg); }

/* Период таблицы: пресеты и свои месяцы. */
.rt2-period { position: relative; flex: none; }
.rt2-period > details > summary { list-style: none; user-select: none; }
.rt2-period > details > summary::-webkit-details-marker { display: none; }
.rt2-period .rt2-pmenu {
  position: absolute; top: calc(100% + 6px); right: 0; left: auto; padding: 6px; z-index: 20;
  display: flex; flex-direction: column; gap: 2px; min-width: 210px;
}
.rt2-period .rt2-pitem { border-radius: 6px; border-bottom: 0; }
.rt2-period .rt2-pitem.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.rt2-period .rt2-prange { display: flex; gap: 8px; border-top: 1px solid var(--border); margin-top: 4px; padding: 8px 6px 4px; }
.rt2-period .rt2-prange label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted); }
.rt2-period .rt2-prange input {
  width: 100%; min-width: 0; padding: 5px 6px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--field-bg); color: var(--text); font: inherit; font-size: 12px;
}
.rt2-paydates { font-size: 11px; color: var(--text-soft); margin-top: 2px; }

/* Полоса формы (добавление поступления, фильтры отчёта) — поля в одну линию с подписями. */
.rt2-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; padding: 12px 0 4px; }
.rt2-form .f { display: flex; flex-direction: column; gap: 5px; }
.rt2-form .f > .rt2-flabel { margin: 0; }
.rt2-form input, .rt2-form select {
  height: 32px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: var(--rt-sm);
  background: var(--field-bg); color: var(--text); font: inherit; font-size: 13px; outline: none;
}
.rt2-form input:focus, .rt2-form select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

/* Карточки выбора (отчёты, шаги мастера): вариант с подписью, а не голая кнопка. */
.rt2-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr)); gap: 10px; align-items: stretch; }
/* Отчёты субаренды: карточки разложены по смысловым группам; ярлык группы тянется
   на всю ширину решётки, поэтому карточки во всех блоках остаются одной ширины. */
.rt2-cards.rt2-rep { row-gap: 9px; }
.rt2-cardgrp-lbl {
  grid-column: 1 / -1; margin: 15px 0 1px; font-size: 11px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint);
}
.rt2-cardgrp-lbl:first-child { margin-top: 2px; }
.rt2-card {
  position: relative; text-align: left; padding: 13px 15px; border: 1px solid var(--border-strong); border-radius: var(--rt-md);
  background: var(--bg-alt); color: var(--text); font: inherit; cursor: pointer;
  transition: border-color .14s var(--rt-ease), background-color .14s var(--rt-ease), transform .14s var(--rt-ease);
}
.rt2-card:hover { border-color: var(--accent); background: var(--bg-hover); transform: translateY(-1px); }
.rt2-card.on { border-color: var(--accent); background: var(--accent-soft); }
.rt2-card .t { font-size: 13px; font-weight: 600; letter-spacing: -.005em; padding-right: 18px; }
.rt2-card.on .t { color: var(--accent-hover); }
.rt2-card .d { font-size: 12px; color: var(--text-muted); margin-top: 5px; line-height: 1.45; }
.rt2-card .chk {
  position: absolute; top: 12px; right: 12px; display: block; width: 15px; height: 15px;
  color: var(--accent); opacity: 0; transform: scale(.7);
  transition: opacity .14s var(--rt-ease), transform .14s var(--rt-ease);
}
.rt2-card.on .chk { opacity: 1; transform: scale(1); }
@media (prefers-reduced-motion: reduce) { .rt2-card:hover { transform: none; } }

/* ── Мастер расхода: шаги, карточки выбора, предсказуемая высота ── */
.rt2-panel-ov {
  position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(9, 9, 11, .45);
}
:root[data-theme="dark"] .rt2-panel-ov { background: rgba(0, 0, 0, .6); }
.rt2-wiz {
  width: 620px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--rt-lg);
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.rt2-wiz-head { flex: none; display: flex; align-items: flex-start; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.rt2-steps { flex: none; display: flex; align-items: center; gap: 16px; padding: 10px 18px; background: var(--bg); border-bottom: 1px solid var(--border); }
.rt2-steps .s { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-faint); white-space: nowrap; }
.rt2-steps .s .n {
  width: 18px; height: 18px; border-radius: var(--rt-pill); display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; background: var(--chip-neutral); color: var(--text-muted);
}
.rt2-steps .s.on { color: var(--text); font-weight: 500; }
.rt2-steps .s.on .n { background: var(--accent); color: #fff; }
.rt2-steps .s.done { color: var(--text-muted); }
.rt2-steps .s.done .n { background: var(--chip-success); color: var(--chip-fg-success); }
.rt2-steps .crumb { font-size: 12px; color: var(--text-soft); }
/* Минимальная высота держит окно от прыжков между шагами. */
.rt2-wiz-body { flex: 1; min-height: 264px; overflow: auto; padding: 16px 18px 20px; }
.rt2-wiz-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--bg-alt); }
.rt2-pickbtn {
  height: 32px; padding: 0 12px; border-radius: var(--rt-sm); border: 1px solid var(--border-strong);
  background: var(--field-bg); color: var(--text-muted); font: inherit; font-size: 13px; cursor: pointer;
}
.rt2-pickbtn:hover { background: var(--bg-hover); color: var(--text); }
.rt2-pickbtn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--text); font-weight: 500; }
.rt2-found { border: 1px solid var(--chip-success); border-radius: var(--rt-md); background: var(--chip-success); padding: 10px 12px; margin-bottom: 14px; }
.rt2-found .h { font-size: 12px; font-weight: 500; color: var(--chip-fg-success); margin-bottom: 6px; }
.rt2-found .r { display: flex; gap: 8px; align-items: center; font-size: 12px; padding: 3px 0; cursor: pointer; }

/* Владелец попросил вернуть неустойке красный вид (msg 1276). */
/* Опасное действие не спорит с главным: на экране ровно одна залитая кнопка —
   основная. «Неустойка» и «Удалить» — обычные кнопки с красной надписью. */
.rt2-btn.danger { border-color: var(--border-strong); background: var(--field-bg); color: var(--chip-fg-danger); box-shadow: var(--shadow-xs); }
.rt2-btn.danger:hover { background: var(--chip-danger); color: var(--chip-fg-danger); }
/* Заливкой остаётся только подтверждение в диалоге: там оно последнее слово. */
.rt2-btn.danger.fill { border-color: var(--btn-neg-border); background: var(--btn-neg-bg); color: #fff; }
.rt2-btn.danger.fill:hover { filter: brightness(1.06); background: var(--btn-neg-bg); }

/* ── Шапка раздела Недвижимость одной строкой (макет 11.08) ── */
.rt2-head-bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  height: 44px; margin: 0 -18px 0; padding: 0 18px; background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}
.rt2-head-bar .nm { font-size: 15px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; }
.rt2-head-bar .sep { width: 1px; height: 18px; background: var(--border); flex: none; }
.rt2-head-bar #realty-tabs { display: flex; align-items: center; gap: 2px; height: 44px; overflow-x: auto; scrollbar-width: none; }
.rt2-head-bar #realty-tabs::-webkit-scrollbar { display: none; }
.rt2-head-bar #realty-tabs button {
  height: 44px; padding: 0 12px; border: 0; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.rt2-head-bar #realty-tabs button:hover { color: var(--text); }
.rt2-head-bar #realty-tabs button.on { color: var(--accent); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.rt2-head-bar #realty-actions { display: flex; align-items: center; gap: 6px; flex: none; }
#realty-split > #realty-body { padding-top: 12px; }
#realty-view #realty-actions button { height: 30px; padding: 0 12px; border-radius: var(--rt-sm); border: 1px solid var(--border-strong); background: var(--field-bg); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; white-space: nowrap; }
#realty-view #realty-actions button:hover { background: var(--bg-hover); }
/* .quiet идёт ниже по файлу и перебивал цвет выгрузок — задаём явно. */
.rt2-btn.quiet.xls { color: var(--xls); }
.rt2-btn.quiet.xls:hover { background: var(--xls-soft); color: var(--xls); }
.rt2-btn.quiet.pdf { color: var(--text-muted); }
.rt2-btn.quiet.pdf:hover { background: var(--pdf-soft); color: var(--pdf); }

/* Списки договоров тянутся до низа окна, как плитки во вкладке «Объекты»:
   раздел — колонка, тело — её растущая часть, прокручивается сама таблица. */
#realty-view { display: flex; flex-direction: column; overflow: hidden; }
#realty-split { flex: 1; min-height: 0; display: flex; align-items: stretch; }
#realty-split > #realty-body { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: auto; }
.rt2-fill { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rt2-fill > .rt2-wrap { flex: 1; min-height: 0; max-height: none; }
/* Единое правило закрепления: полоса управления стоит, прокручивается только
   перечень; внутри него липнут шапка колонок и заголовок города. */
.rt2-scroll { flex: 1; min-height: 0; overflow: auto; padding-bottom: 18px; }
.rt2-gh {
  position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 8px;
  margin: 18px 0 10px; padding: 6px 0; background: var(--bg);
}
.rt2-scroll > .rt2-gh:first-child { margin-top: 0; }

/* ── Панель записи рядом с таблицей, а не поверх неё ──
   Раньше карточка накрывала список и было не видно, какую строку правишь.
   Теперь таблица ужимается, выбранная строка подсвечена. На узком экране
   панель остаётся выезжающей — ужимать там нечего. */
.rt2-panel.docked {
  /* relative, а не static: календарь и меню «…» внутри панели позиционируются
     от неё, иначе улетают в угол экрана. */
  position: relative; top: auto; right: auto; bottom: auto; width: 420px; flex: none; z-index: auto;
  margin: 0 0 0 14px; box-shadow: none; border-left: 1px solid var(--border);
}
.rt2-table tr.row.sel > td { background: var(--accent-soft); }

/* Плотность строк: то же, что «Плотно / Обычно / Просторно» в макете. */
#realty-view[data-dens="compact"] .rt2 { --row-h: 32px; --th-h: 38px; }
#realty-view[data-dens="compact"] .rt2-table td { padding: 3px 10px; }
#realty-view[data-dens="compact"] .rt2-table th { padding: 0 10px; }
#realty-view[data-dens="wide"] .rt2 { --row-h: 48px; --th-h: 46px; }
#realty-view[data-dens="wide"] .rt2-table td { padding: 11px 12px; }

/* Меню «Колонки» */
.rt2-cols { position: relative; flex: none; }
.rt2-cols > details > summary { list-style: none; user-select: none; }
.rt2-cols > details > summary::-webkit-details-marker { display: none; }
.rt2-cols .rt2-pmenu {
  /* выше липкой шапки таблицы — иначе она накрывает первую строку меню */
  position: absolute; top: calc(100% + 6px); right: 0; left: auto; padding: 6px; z-index: 20;
  display: flex; flex-direction: column; gap: 2px; min-width: 210px; max-height: 60vh; overflow: auto;
}
.rt2-cols .rt2-pmenu label { padding: 6px 8px; border-radius: 6px; white-space: nowrap; font-size: 13px; }
.rt2-cols .rt2-pmenu label:hover { background: var(--bg-hover); }
.rt2-cols .rt2-pmenu .foot { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

/* ── Карточка объекта: три способа показа, как у карточки задачи ──
   Страница остаётся как была; модалка и панель не уводят со списка. */
.objc-ov {
  position: fixed; inset: 0; z-index: 1000; background: rgba(16, 24, 40, .38);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
:root[data-theme="dark"] .objc-ov { background: rgba(0, 0, 0, .6); }
.objc-box {
  width: min(1000px, 100%); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--rt-lg); background: var(--bg); box-shadow: var(--shadow-pop);
}
.objc-panel {
  width: min(560px, 100%); flex: none; display: flex; flex-direction: column; overflow: hidden;
  border-left: 1px solid var(--border); background: var(--bg);
}
/* Шапка и футер стоят, прокручиваются только секции — правило раздела. */
.objc-head {
  flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 20px; border-bottom: 1px solid var(--border); background: var(--bg-alt);
  /* Адрес объекта виден всегда: в режиме «страницы» карточка едет вместе со
     страницей, и, уехав вниз, человек терял, чей это объект (msg 1903). */
  position: sticky; top: 0; z-index: 6;
}
.objc-head .ttl { font-size: 17px; font-weight: 600; letter-spacing: -.015em; line-height: 1.25; }
.objc-buy { font-size: 12.5px; color: var(--text-muted); }
.objc-buy b { color: var(--accent-text); font-weight: 500; font-variant-numeric: tabular-nums; }
.objc-spring { flex: 1; }
.objc-body { flex: 1; min-height: 0; overflow: auto; padding: 16px 20px 22px; }
.objc-foot {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 20px;
  border-top: 1px solid var(--border); background: var(--bg-alt);
}
.objc-saved { font-size: 12px; color: var(--text-faint); }
.objc-head .t2-cseg { margin-left: 0; }

/* Секция карточки: карточка с рамкой, а не абзац на фоне страницы. */
.objc-sec {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--rt-lg);
  padding: 16px 18px 18px; margin-bottom: 14px; box-shadow: var(--shadow-xs);
}
.objc-sec-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.objc-sec-h .t { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.objc-f { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--text-muted); }
.objc-in {
  height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--rt-md);
  background: var(--field-bg); color: var(--text); font: inherit; font-size: 13.5px;
  box-shadow: var(--field-shadow); outline: none;
}
.objc-in:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.objc-x {
  width: 28px; height: 28px; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: var(--rt-sm); border: 1px solid var(--border-strong); background: var(--field-bg);
  color: var(--text-muted); cursor: pointer; padding: 0;
}
.objc-x:hover { background: var(--bg-hover); color: var(--text); }
@media (max-width: 1100px) { .objc-panel { position: fixed; inset: 0 0 0 auto; z-index: 1000; box-shadow: var(--shadow-pop); } }

/* ── Долевое участие ── */
/* Незаполненное поле должно читаться как незаполненное, а не как ноль. */
.rt2-none { color: var(--text-faint); }
.rt2-err {
  margin: 16px 2px; padding: 10px 12px; border: 1px solid var(--btn-neg-border); border-radius: var(--rt-md);
  background: var(--chip-danger); display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--chip-fg-danger);
}
.rt2-err .rt2-btn { margin-left: auto; }
.rt2-g1 .rt2-spring { flex: 1; }
#share-panel .rt2-pbody textarea.rt2-in { min-height: 96px; }

/* Режим «Страница»: содержимое по центру колонкой, а не во всю ширину. */
#realty-body > .objc-head { border-radius: var(--rt-lg) var(--rt-lg) 0 0; }
#realty-body > .objc-body { max-width: 1180px; width: 100%; margin: 0 auto; overflow: visible; padding: 18px 0 24px; }
/* Список под модалкой уходит на второй план — как в макете. */
body:has(#objc-ov) #realty-body { filter: blur(1.5px); }

/* Плитка вложенной папки в области содержимого (сообщение 1384): тот же
   размер, что у документа, но кликается сразу и подсвечивается как ссылка. */
.docs-fmt.folder { background: var(--accent-weak); color: var(--accent); }
.docs-fmt.folder svg { width: 22px; height: 22px; }
.docs-tile-folder { cursor: pointer; }
.docs-tile-folder .nm { font-weight: 600; }

/* Непрочитанное в списке задач (msg 1783). В этом виде строка раньше ничем не
   отличалась: выделение держалось только на цвете счётчика комментариев, а
   новую, ни разу не открытую задачу не отмечало вовсе. */
.t2-row.has-new { background: var(--accent-soft); }
.t2-row.has-new:hover { background: var(--bg-hover); }
.t2-row.has-new .t2-title { font-weight: 600; }

/* ══ Общий слой внутренних экранов ═══════════════════════════════════════
   Эталон - макет «Расходы объекта» (17.08). Один набор примитивов на все
   внутренние экраны разделов, чтобы они перестали расходиться: шапка экрана,
   сегменты, подпись секции, карточка, таблица, пилюля состояния, подвал.

   Метрики взяты из макета и менять их поштучно нельзя - именно из-за этого
   экраны и разъезжались: шапка 30px, строка таблицы 26px, шапка таблицы 30px,
   итоговая строка 32px, радиус карточки 12, радиус контрола 8.

   Шрифт остаётся общий для CRM: в макете стоит Inter Tight с гугл-шрифтов, а
   страница обязана работать без единого запроса наружу. */

.ds-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.ds-head .ds-t { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ds-head .ds-t b { font-size: 20px; font-weight: 600; letter-spacing: -.015em; line-height: 1.2; }
.ds-head .ds-t span { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ds-head .ds-acts { display: flex; align-items: center; gap: 8px; flex: none; }

.ds-btn {
  height: 30px; padding: 0 12px; flex: none; white-space: nowrap;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--field-bg); box-shadow: var(--shadow-xs);
  font-family: inherit; font-size: 13px; font-weight: 500; color: var(--text); cursor: pointer;
}
.ds-btn:hover { background: var(--bg-hover); }
.ds-btn.primary { padding: 0 14px; border-color: var(--accent-hover); background: var(--accent); color: #fff; box-shadow: var(--btn-shadow); }
.ds-btn.primary:hover { background: var(--accent-hover); }
.ds-btn.icon { width: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--text-muted); }
.ds-btn[disabled] { opacity: .45; cursor: default; }

/* Секция: подпись над карточкой, а не внутри неё. */
.ds-sec { display: flex; flex-direction: column; gap: 8px; }
.ds-sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.ds-sec-label {
  display: flex; align-items: baseline; gap: 8px; border: 0; padding: 0; background: none;
  font-family: inherit; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-faint); cursor: pointer;
}
.ds-sec-label:hover { color: var(--text-muted); }
.ds-sec-label .cv { font-size: 9px; letter-spacing: 0; }
.ds-sec-label .n { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-quart); }
.ds-sec-meta { display: flex; align-items: center; gap: 14px; font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.ds-sec-meta b { font-weight: 600; color: var(--text-muted); }

.ds-card { border: 1px solid var(--border); border-radius: 12px; background: var(--bg-alt); overflow: hidden; }
.ds-card.scroll-x { overflow-x: auto; }

.ds-table { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.ds-table th {
  height: 30px; padding: 0 12px; text-align: left; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-faint); background: var(--bg-alt); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2;
}
.ds-table td { height: 26px; padding: 0 12px; font-size: 13px; border-bottom: 1px solid var(--border); }
.ds-table tbody tr:hover > td { background: var(--bg-hover); }
.ds-table th.num, .ds-table td.num { text-align: right; white-space: nowrap; }
.ds-table td.soft { color: var(--text-soft); }
.ds-table tbody tr:last-child > td { border-bottom: 0; }
.ds-table tfoot td {
  height: 32px; font-size: 12.5px; font-weight: 600;
  border-top: 1px solid var(--border-strong); border-bottom: 0; white-space: nowrap;
}
.ds-table tfoot td.note { font-size: 11.5px; font-weight: 400; color: var(--text-faint); }

/* Светофор. Цвет никогда не единственный носитель: рядом всегда слово. */
.ds-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 19px; padding: 0 8px;
  border-radius: 999px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--chip-neutral); color: var(--text-muted);
}
.ds-dot { width: 6px; height: 6px; border-radius: 999px; flex: none; background: var(--text-faint); }
.ds-chip.ok { background: var(--chip-success); color: var(--chip-fg-success); }
.ds-chip.ok .ds-dot { background: var(--ok-dot); }
.ds-chip.warn { background: var(--chip-warning); color: var(--chip-fg-warning); }
.ds-chip.warn .ds-dot { background: var(--warn-dot); }
.ds-chip.bad { background: var(--chip-danger); color: var(--chip-fg-danger); }
.ds-chip.bad .ds-dot { background: var(--bad-dot); }
.ds-legend { display: flex; align-items: center; gap: 14px; font-size: 11.5px; color: var(--text-faint); }
.ds-legend span { display: inline-flex; align-items: center; gap: 5px; }

/* Действия строки: проявляются при наведении, чтобы 140 строк не пестрели. */
.ds-row-acts { display: inline-flex; align-items: center; gap: 2px; opacity: 0; transition: opacity .14s cubic-bezier(.32,.72,0,1); }
tr:hover .ds-row-acts, .ds-row-acts:focus-within { opacity: 1; }
.ds-row-acts button {
  width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px; background: transparent; color: var(--text-faint); cursor: pointer;
}
.ds-row-acts button:hover { background: var(--bg-hover); color: var(--text-muted); }
.ds-row-acts button.danger:hover { color: var(--danger); }

.ds-field {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--field-bg); box-shadow: var(--field-shadow);
  font-family: inherit; font-size: 12.5px; line-height: 1.5; color: var(--text);
}
.ds-field:focus { border-color: var(--accent); outline: none; }
.ds-kv { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; }
.ds-kv > span:first-child { color: var(--text-muted); }
.ds-kv b { font-weight: 500; font-variant-numeric: tabular-nums; }
.ds-rule { height: 1px; background: var(--border); }
.ds-note { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; }

/* Подвал экрана: сколько всего, на сколько денег, где долг. */
.ds-foot {
  display: flex; align-items: center; gap: 16px; height: 40px; padding: 0 24px; margin: 16px -24px 0;
  border-top: 1px solid var(--border); background: var(--bg-alt);
  font-size: 12px; color: var(--text-muted);
}
.ds-foot b { color: var(--text); font-variant-numeric: tabular-nums; }
/* Внутри раздела у прокручиваемой области нет боковых полей, и текст ложился
   на самую кромку: подпись секции слева, итог справа - оба впритык, а подвал
   с отрицательными полями контейнер обрезал. Поля задаём экрану, подвал
   растягиваем ровно на них. */
#expenses-sub-body > .exp-page { padding: 0 20px; }
/* Двенадцать колонок в сводке: ячейки чуть теснее, иначе последняя уезжает
   за край карточки и «Статус» видно наполовину. */
.ds-table.exp-tight th, .ds-table.exp-tight td { padding: 0 9px; }
#expenses-sub-body > .exp-page > .ds-foot { margin: 16px -20px 0; padding: 0 20px; }
.ds-foot .sep { color: var(--text-faint); }
.ds-foot .debt { display: inline-flex; align-items: center; gap: 6px; }
.ds-foot .debt .ds-dot { background: var(--danger); }

@media (prefers-reduced-motion: reduce) { .ds-row-acts { transition: none; } }

/* Плитки долей: та же сетка, что во вкладке «Объекты» (msg 1821). */
.rbuy-city { display: flex; align-items: baseline; gap: 8px; margin: 16px 2px 8px; font-size: 13px; font-weight: 600; }
.rbuy-city .n { font-size: 11px; font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.rbuy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

/* Сердечко на задаче и комментарии (msg 1834). Пустое — тихий контур, своё —
   залитое. Счётчик рядом, имена — в подсказке. */
.t2-heart {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: 999px; background: transparent;
  color: var(--text-faint); font-family: inherit; font-size: 12px; cursor: pointer;
  transition: background-color .12s ease-out, color .12s ease-out, border-color .12s ease-out;
}
.t2-heart:hover { border-color: var(--border-strong); color: var(--chip-fg-danger); background: var(--chip-danger); }
.t2-heart.on { border-color: transparent; background: var(--chip-danger); color: var(--chip-fg-danger); }
.t2-heart .i { font-size: 12px; line-height: 1; }
.t2-heart .n { font-variant-numeric: tabular-nums; font-weight: 600; }
.t2-heart:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Ряд реакций: сердечко и дизлайк рядом, между ними воздух в один шаг. */
.t2-react { display: inline-flex; align-items: center; gap: 4px; }
/* Дизлайк не красный: красным в системе помечено просроченное, и одинаковый
   цвет у «не нравится» и у сроков сбивает с толку. Выключенный — приглушён. */
.t2-heart.down .i { filter: grayscale(1); opacity: .5; }
.t2-heart.down:hover { border-color: var(--border-strong); color: var(--text-muted); background: var(--bg-hover); }
.t2-heart.down.on { border-color: transparent; background: var(--bg-selected); color: var(--text); }
.t2-heart.down.on .i { filter: none; opacity: 1; }
/* В плотном списке сердечко мельче: строка задачи не должна из-за него расти. */
.t2-row .t2-heart, .t2-tile .t2-heart, .t2-trow .t2-heart { height: 18px; padding: 0 6px; font-size: 11px; }
.t2-row .t2-heart .i, .t2-tile .t2-heart .i { font-size: 11px; }

/* Панель смайликов: вкладки групп сверху, сетка ниже. Ширина под восемь
   столбцов — как в телеграме, чтобы глаз попадал в знакомый ритм. */
.emoji-picker {
  display: none; position: fixed; z-index: 500; width: 306px; max-height: 300px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r-10, 10px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18); overflow: hidden;
}
.emoji-tabs { display: flex; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.emoji-tab {
  flex: 1; height: 26px; border: 0; border-radius: var(--r-6, 6px); background: transparent;
  font-size: 15px; line-height: 1; cursor: pointer; opacity: .55;
}
.emoji-tab:hover { background: var(--bg-hover); opacity: .85; }
.emoji-tab.on { background: var(--bg-selected); opacity: 1; }
.emoji-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  padding: 8px; max-height: 250px; overflow-y: auto;
}
.emoji-cell {
  height: 32px; border: 0; border-radius: var(--r-6, 6px); background: transparent;
  font-size: 19px; line-height: 1; cursor: pointer;
}
.emoji-cell:hover { background: var(--bg-hover); }
.emoji-cell:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Визитка сотрудника: контакты по клику на фамилию (msg 1890). */
.pcard-link { cursor: pointer; border-bottom: 1px dashed var(--border-strong); }
.pcard-link:hover { color: var(--accent); border-bottom-color: var(--accent); }
.pcard {
  display: none; position: fixed; z-index: 520; width: 268px; padding: 12px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r-10, 10px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .18);
}
.pcard-head { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.pcard-ava {
  flex: 0 0 34px; width: 34px; height: 34px; border-radius: var(--r-full, 999px); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.pcard-name { display: flex; flex-direction: column; min-width: 0; }
.pcard-name b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-name span { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-row {
  display: flex; align-items: center; gap: 9px; padding: 7px 2px; font-size: 12px;
  color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border);
}
.pcard-row:last-child { border-bottom: 0; }
.pcard-row:hover { color: var(--accent); }
.pcard-ico { flex: 0 0 16px; color: var(--text-faint); font-size: 12px; }
.pcard-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard-hint { flex: 0 0 auto; font-size: 10px; color: var(--text-faint); }
.pcard-load { padding: 8px 2px; font-size: 12px; color: var(--text-faint); }

/* Плашки уведомлений: правый верхний угол, стопкой, поверх всего (msg 1889).
   Появляются сдвигом справа — движение подсказывает, откуда взялось, и не
   отвлекает от текста, который человек читает в середине экрана. */
.ntoasts {
  position: fixed; top: 56px; right: 16px; z-index: 600;
  display: flex; flex-direction: column; gap: 8px; width: 344px; max-width: calc(100vw - 32px);
  pointer-events: none;
}
.ntoast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px; border-radius: var(--r-10, 10px);
  background: var(--bg); border: 1px solid var(--border-strong);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .16);
  cursor: pointer; opacity: 0; transform: translateX(14px);
  transition: opacity .16s ease-out, transform .18s cubic-bezier(.22, 1, .36, 1);
}
.ntoast.in { opacity: 1; transform: none; }
.ntoast:hover { border-color: var(--accent); }
.ntoast-ico { flex: 0 0 18px; font-size: 14px; line-height: 1.3; }
.ntoast-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ntoast-txt b { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.ntoast-txt span { font-size: 11.5px; color: var(--text-muted); line-height: 1.4; }
.ntoast-x {
  flex: 0 0 auto; border: 0; background: none; color: var(--text-faint);
  font-size: 15px; line-height: 1; cursor: pointer; padding: 0 2px;
}
.ntoast-x:hover { color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  .ntoast { transition: none; transform: none; }
}

/* Колонки «Команды»: свернуть, скрыть, покрасить (msg 1894). Шапка держит
   имя и действия в одну строку, счётчики уходят второй строкой потише. */
.team-col-head {
  display: grid; grid-template-columns: 18px 1fr auto auto; align-items: center; column-gap: 6px;
  padding: 9px 10px 8px; border-bottom: 1px solid var(--border); background: var(--bg); cursor: grab;
}
.team-col-head .tch-name {
  font-weight: 600; font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.team-col-head .tch-sub { grid-column: 1 / -1; font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.tch-fold, .tch-act {
  border: 0; background: none; color: var(--text-faint); font-size: 13px; line-height: 1;
  cursor: pointer; padding: 2px 3px; border-radius: 4px;
}
.tch-fold:hover, .tch-act:hover { background: var(--bg-hover); color: var(--text); }
/* Свёрнутая колонка: полоска шириной под число, имя вертикально. */
.team-column-min {
  min-width: 44px; width: 44px; flex-shrink: 0; align-self: stretch; min-height: 160px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; cursor: pointer;
}
.team-column-min:hover { border-color: var(--accent); }
.team-column-min .tcm-count { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.team-column-min .tcm-name {
  writing-mode: vertical-rl; font-size: 11.5px; color: var(--text-muted);
  max-height: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Скрытые сотрудники: строка-возврат, чтобы скрытое не пропадало навсегда. */
.team-hidden-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 0 0 10px; font-size: 11px; color: var(--text-faint); }
.team-hidden-chip, .team-hidden-all {
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  border-radius: 999px; padding: 2px 9px; font-size: 11px; cursor: pointer; font-family: inherit;
}
.team-hidden-chip:hover, .team-hidden-all:hover { border-color: var(--accent); color: var(--accent); }
/* Кнопка цвета на плитке задачи: появляется при наведении, чтобы не шуметь. */
.tt-color {
  flex: 0 0 auto; border: 0; background: none; color: var(--text-quart);
  font-size: 12px; line-height: 1; cursor: pointer; padding: 0 1px; opacity: 0; transition: opacity .12s;
}
.team-task:hover .tt-color { opacity: 1; }
.tt-color:hover { color: var(--accent); }
/* Палитра: шесть приглушённых цветов и «без цвета». */
.tpal {
  display: none; position: fixed; z-index: 540; padding: 8px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--r-8, 8px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .16);
}
.tpal-row { display: flex; align-items: center; gap: 6px; }
.tpal-dot {
  width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0;
}
.tpal-dot:hover { transform: scale(1.08); }
.tpal-dot.on { border-color: var(--text); }
.tpal-none {
  width: 20px; height: 20px; border-radius: 50%; border: 1px dashed var(--border-strong);
  background: transparent; color: var(--text-faint); font-size: 12px; line-height: 1; cursor: pointer; padding: 0;
}
.tpal-none:hover { border-color: var(--accent); color: var(--accent); }

/* Правая колонка карточки задачи (msg 1900). Человек занимает две строки:
   имя сверху, должность мельче под ним — в одну строку «Жигарев Антон ·
   Генеральный директор» не влезало и обрывалось на середине слова. */
.tcf-row {
  display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 4px;
  border-bottom: 1px solid var(--border); border-radius: var(--r-6, 6px);
}
.tcf-row.act { cursor: pointer; }
.tcf-row.act:hover { background: var(--bg-hover); }
.tcf-lbl { flex: 0 0 92px; font-size: 11px; color: var(--text-faint); }
.tcf-val { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 12px; }
.tcf-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcf-sub { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Выбор «как открывать» ушёл из шапки в меню: это настройка вида, а не действие. */
.tcm-cap { padding: 6px 8px 2px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }
.tcm-seg { display: flex; gap: 2px; padding: 2px 6px 6px; }
.tcm-seg button {
  flex: 1; height: 24px; border: 1px solid var(--border); background: transparent;
  border-radius: var(--r-6, 6px); font-family: inherit; font-size: 11px; color: var(--text-muted); cursor: pointer;
}
.tcm-seg button:hover { border-color: var(--border-strong); color: var(--text); }
.tcm-seg button.on { background: var(--bg-selected); border-color: transparent; color: var(--text); font-weight: 600; }

/* ══ Редактор задачи: просторное окно вместо мини-поля (msg 2096) ══════════
   Один язык на три места: создание задачи, правка описания в карточке и
   фокус-режим на весь экран. Цветом отмечаем только состояние: срок и
   приоритет; всё остальное серое. */
/* Окно постановки задачи: два размера вместо одного большого (макет 22.08.2026).
   Компактное - записал и пошел: название, кому, срок, короткое описание.
   Обычное - рабочее: описание на десять строк, подзадачи, файлы и колонка
   свойств. Полноэкранного нет намеренно - растянутая копия той же сетки давала
   пустоту, а для разбора крупной работы открывается сама карточка задачи. */
#nt-holder[data-mode="compact"] [data-form] { width: min(620px, 94vw); height: auto; max-height: 86vh; }
#nt-holder[data-mode="normal"] [data-form] { width: min(920px, 94vw); height: min(640px, 88vh); max-height: 88vh; }

.te-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 292px; }
#nt-holder[data-mode="compact"] .te-body { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1000px) { .te-body { grid-template-rows: minmax(0, 1fr) auto; } }
.te-pane { min-width: 0; overflow-y: auto; padding: 16px 18px 18px; }
.te-rail { border-left: 1px solid var(--border); background: var(--bg-alt); padding: 10px 12px 18px; overflow-y: auto; }
@media (max-width: 1000px) { .te-rail { border-left: 0; border-top: 1px solid var(--border); max-height: 40vh; } }

.nw-head { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; height: 46px;
  padding: 0 10px 0 16px; border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.nw-ttl { flex: 0 0 auto; font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.nw-src { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 11.5px; color: var(--text-muted); }
.nw-src .bar { flex: 0 0 1px; width: 1px; height: 14px; background: var(--border-strong); }
.nw-src .tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nw-src button { flex: 0 0 auto; border: 0; background: none; padding: 0; color: var(--accent);
  font-family: inherit; font-size: 11.5px; cursor: pointer; }
.nw-seg { display: flex; gap: 2px; padding: 2px; border-radius: var(--r-6); background: var(--surface-sunken); }
.nw-seg button { height: 22px; padding: 0 9px; border: 0; border-radius: var(--r-4); background: transparent;
  color: var(--text-muted); font-family: inherit; font-size: 11.5px; cursor: pointer; }
.nw-seg button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--sh-1); }

/* Название набрано крупнее подписей: раньше заголовок задачи и подпись поля
   были одного кегля и глазу не за что было зацепиться. */
.nw-title { display: block; width: 100%; border: 0; outline: none; background: transparent; resize: none;
  padding: 0; font-family: inherit; font-size: 18px; font-weight: 600; letter-spacing: -.02em;
  line-height: 1.35; color: var(--text); overflow: hidden; }
.nw-rule { height: 1px; margin-top: 4px; background: var(--border); }

/* Компактный размер: три самых частых поля лентой, остальные - за кнопкой Все поля. */
.nw-quick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; row-gap: 6px; margin-top: 8px; }
.nw-qb { display: flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: var(--r-6);
  border: 1px solid var(--border); background: var(--surface); font-family: inherit; font-size: 12.5px; cursor: pointer; }
.nw-qb .k { color: var(--text-muted); }
.nw-qb .v { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.nw-qb.set { border-color: var(--accent); background: var(--accent-weak); }
.nw-qb.set .v { color: var(--accent); }
.nw-more { display: flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 0;
  border-radius: var(--r-6); background: transparent; color: var(--accent); font-family: inherit;
  font-size: 12.5px; cursor: pointer; }

/* Описание в рамке, панель разметки внутри. Нижний край тянется мышью. */
.nw-desc { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--r-8);
  background: var(--bg); overflow: hidden; }
.nw-desc:focus-within { border-color: var(--accent); }
#nt-holder .nw-desc .te-tools { height: 30px; padding: 0 6px; border-top: 0; background: var(--bg-alt); }
/* Поле описания растет под текст (ntGrowDesc), поэтому тянуть его за уголок
   не нужно: две разные высоты у одного поля спорили бы между собой. */
#nt-holder .te-area, #nt-holder .te-rich { display: block; flex: none; width: 100%; min-height: 320px; padding: 10px 12px;
  font-size: 13px; line-height: 1.6; resize: none; overflow-y: auto; max-height: 60vh; }
#nt-holder[data-mode="compact"] .te-area, #nt-holder[data-mode="compact"] .te-rich { min-height: 148px; }

.nw-card { margin-top: 14px; border: 1px solid var(--border); border-radius: var(--r-8); overflow: hidden; }
.nw-card-h { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 11px; background: var(--bg-alt);
  border-bottom: 1px solid var(--border); font-size: 11.5px; font-weight: 600; }
.nw-card-h .n { font-weight: 400; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.nw-sub { display: flex; align-items: center; gap: 9px; height: 32px; padding: 0 11px; border-bottom: 1px solid var(--border); }
.nw-sub:last-child { border-bottom: 0; }
.nw-sub .box { flex: 0 0 14px; width: 14px; height: 14px; border-radius: var(--r-4); border: 1px solid var(--chkb-plain); }
.nw-sub .tx { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.nw-sub .x { border: 0; background: none; color: var(--text-faint); font-size: 13px; cursor: pointer; }
.nw-sub input { flex: 1; border: 0; outline: none; background: transparent; font-family: inherit; font-size: 12.5px; }

.nw-drop { margin-top: 12px; display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1px dashed var(--border-strong); border-radius: var(--r-8); background: var(--bg-alt); }
.nw-drop.over { border-color: var(--accent); background: var(--accent-weak); }
.nw-drop .t { display: block; font-size: 12.5px; font-weight: 600; }
.nw-drop .s { display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.5; color: var(--text-muted); }
.nw-file { display: flex; align-items: center; gap: 10px; height: 34px; margin-top: 6px; padding: 0 11px;
  border: 1px solid var(--border); border-radius: var(--r-6); background: var(--surface); font-size: 12.5px; }
.nw-file .ext { flex: 0 0 auto; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; }
.nw-file .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nw-file .sz { font-size: 11.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.nw-file .x { border: 0; background: none; color: var(--text-faint); font-size: 13px; cursor: pointer; }

/* Редкое поле не занимает строку, пока его не позвали: по выгрузке 266 задач
   соисполнителей, повтор и метку ставят в паре процентов случаев, а восемь
   полей подряд со словом Нет занимали половину окна. */
.nw-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; row-gap: 6px; margin-top: 14px; }
.nw-add .lab { font-size: 11.5px; color: var(--text-faint); }
.nw-chip { height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-full);
  background: transparent; color: var(--text-muted); font-family: inherit; font-size: 12px; cursor: pointer; }
.nw-chip:hover { color: var(--text); }

.nw-err { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; row-gap: 8px;
  padding: 9px 16px; background: var(--danger-weak); border-top: 1px solid var(--border); }
.nw-err .dot { flex: 0 0 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--danger); }
.nw-err .tx { flex: 1; min-width: 200px; font-size: 12.5px; line-height: 1.45; }
.nw-foot { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; row-gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--border); background: var(--bg-alt); }
.nw-again { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
/* Телефон: размер один (окно и так во весь экран), а кнопка Создать и открыть
   уводило кнопки в два ряда - карточку задачи там открывают из списка. */
@media (max-width: 700px) { .nw-seg, .nw-open { display: none; } }

.te-tools { display: flex; align-items: center; gap: 2px; height: 36px; padding: 0 22px; flex: 0 0 auto;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg-alt); }
.te-tb { width: 27px; height: 25px; border-radius: var(--r-6); border: 0; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.te-tb:hover { background: var(--surface-hover); color: var(--text); }
.te-tb svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round; }
.te-tsep { width: 1px; height: 15px; background: var(--border-strong); margin: 0 6px; }
.te-hint { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
.te-full { display: flex; align-items: center; gap: 6px; height: 25px; padding: 0 9px; border: 0; border-radius: var(--r-6);
  background: transparent; color: var(--text-muted); font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.te-full:hover { background: var(--surface-hover); color: var(--text); }

.te-area { flex: 1; min-height: 0; width: 100%; border: 0; outline: none; background: transparent; resize: none;
  padding: 16px 22px; font-family: inherit; font-size: 14px; line-height: 1.72; color: var(--text); }
.te-area::placeholder { color: var(--text-faint); }

/* Живое форматирование: то же поле, но жирное сразу жирное, список сразу
   список. Метрики повторяют .te-area, чтобы высота окна не прыгала. */
.te-rich { flex: 1; min-height: 0; width: 100%; outline: none; background: transparent;
  padding: 16px 22px; font-family: inherit; font-size: 14px; line-height: 1.72; color: var(--text);
  overflow-y: auto; overflow-wrap: anywhere; }
.te-rich.is-empty::before { content: attr(data-ph); color: var(--text-faint); pointer-events: none; }
.te-rich > div, .te-rich > p { margin: 0; min-height: 1.72em; }
.te-rich b, .te-rich strong { font-weight: 650; color: var(--text); }
.te-rich i, .te-rich em { font-style: italic; }
.te-rich a { color: var(--accent); text-underline-offset: 2px; }
.te-rich ul, .te-rich ol { margin: 4px 0; padding-left: 20px; }
.te-rich li { margin: 0 0 2px; }
.te-rich ul.chk { list-style: none; padding-left: 0; }
.te-rich ul.chk > li { position: relative; padding-left: 24px; }
.te-rich ul.chk > li::before { content: ""; position: absolute; left: 1px; top: .38em; width: 14px; height: 14px;
  border: 1.5px solid var(--border-strong); border-radius: var(--r-4); background: var(--bg); cursor: pointer; }
.te-rich ul.chk > li[data-chk="1"]::before { background: var(--ok); border-color: var(--ok); }
.te-rich ul.chk > li[data-chk="1"] { color: var(--text-faint); text-decoration: line-through; }
.te-rich ul.chk > li[data-chk="~"]::before { background: var(--warn); border-color: var(--warn); }
.te-rich ul.chk > li[data-chk="!"]::before { background: var(--danger); border-color: var(--danger); }
/* Кнопка светится, пока курсор стоит внутри жирного, курсива или списка. */
.te-tb.on { background: var(--accent-soft); color: var(--accent); }

/* Строки свойств справа: подпись слева, значение рядом. Пустое поле - строка
   со светлым Не указано, а не блок с крупным Нет. */
.te-fld { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 5px 8px;
  border: 0; border-radius: var(--r-6); background: transparent; text-align: left; font-family: inherit;
  font-size: 12.5px; color: var(--text); cursor: pointer; }
.te-fld:hover, .te-fld.on { background: var(--surface-hover); }
.te-fld.on .te-lab { color: var(--accent); }
.te-lab { flex: 0 0 90px; width: 90px; font-size: 12px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.te-val { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text); }
.te-val .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.te-val .nm.off { font-weight: 400; color: var(--text-faint); }
.te-chev { flex: 0 0 auto; width: 9px; height: 9px; fill: none; stroke: var(--text-faint);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.te-sec { font-size: 10.5px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-faint); padding: 9px 2px 4px; }
.te-sec.first { padding-top: 2px; }
.te-chip { display: inline-flex; align-items: center; gap: 5px; height: 20px; padding: 0 8px; flex: 0 0 auto;
  border-radius: var(--r-full); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.te-chip.ok { background: var(--ok-weak); color: var(--ok); }
.te-chip.warn { background: var(--warn-weak); color: var(--warn); }
.te-chip.bad { background: var(--danger-weak); color: var(--danger); }
.te-chip.quiet { background: var(--surface-sunken); color: var(--text-muted); }
.te-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; }

/* правка описания внутри карточки задачи */
.te-edit { margin: 10px -18px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  background: var(--surface); }
.te-edit .te-tools { border-top: 0; padding: 0 18px; }
.te-edit .te-area { display: block; min-height: 250px; padding: 14px 18px; font-size: 13.5px; }

/* Поле комментария в карточке задачи. Была строка rows="1": больше трёх
   предложений в неё не помещалось, начало текста уезжало вверх (msg 2195).
   Теперь поле сразу на несколько строк и растёт под текст, потолок задаёт js. */
.tc-area { display: block; width: 100%; border: 0; outline: none; background: transparent; resize: none;
  font-family: inherit; font-size: 13px; line-height: 1.6; color: var(--text); min-height: 116px; }
.tc-area::placeholder { color: var(--text-faint); }
.te-edit-foot { display: flex; align-items: center; gap: 10px; padding: 9px 18px;
  border-top: 1px solid var(--border); background: var(--bg-alt); }
.te-state { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-faint); }
.te-btn { height: 30px; padding: 0 13px; border-radius: var(--r-6); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-size: 12.5px; font-family: inherit; cursor: pointer; }
.te-btn:hover { background: var(--surface-hover); }
.te-btn.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-on); font-weight: 600; }
.te-btn.pri:hover { background: var(--accent-hover); }
.te-btn.off { background: var(--surface-sunken); border-color: var(--border); color: var(--text-faint); }
.te-btn.bad { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }

/* показ описания: списки, галочки, ссылки */
.tdesc { margin: 10px 0 0; font-size: 13px; line-height: 1.7; color: var(--text-muted); cursor: text; }
.tdesc.empty { color: var(--text-faint); }
.tdesc p { margin: 0 0 9px; }
.tdesc p:last-child, .tdesc ul:last-child, .tdesc ol:last-child { margin-bottom: 0; }
.tdesc ul, .tdesc ol { margin: 0 0 9px; padding-left: 20px; }
.tdesc li { margin-bottom: 2px; }
.tdesc ul.chk { list-style: none; padding-left: 0; }
.tdesc ul.chk li { display: flex; align-items: flex-start; gap: 8px; }
.tdesc ul.chk i { flex: 0 0 14px; width: 14px; height: 14px; margin-top: 4px; border-radius: var(--r-4);
  border: 1.5px solid var(--chkb-plain); background: var(--surface); }
.tdesc ul.chk li.done i { background: var(--ok); border-color: var(--ok); }
.tdesc ul.chk li.done span { color: var(--text-faint); text-decoration: line-through; }
/* Метка строки светофором: янтарь - на внимании, красный - стоп. Цвет тут
   означает состояние строки, а не украшает её. */
.tdesc ul.chk li.warn i { background: var(--warn); border-color: var(--warn); }
.tdesc ul.chk li.stop i { background: var(--danger); border-color: var(--danger); }
.tdesc ul.chk li.stop span { color: var(--text); }
.tdesc a { color: var(--accent); }
.tdesc strong { color: var(--text); font-weight: 600; }
.tdesc .at { color: var(--accent); background: var(--accent-weak); border-radius: var(--r-4); padding: 0 3px; }

/* фокус-режим: только текст на весь экран */
#tf-holder .te-focus { position: fixed; inset: 0; z-index: 120; background: var(--surface); color: var(--text);
  display: flex; flex-direction: column; font-size: 13px; animation: ntFade .12s ease-out; }
#tf-holder .te-fhead { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; height: 50px; padding: 0 18px;
  border-bottom: 1px solid var(--border); background: var(--bg-alt); }
#tf-holder .te-fback { display: flex; align-items: center; gap: 8px; height: 28px; padding: 0 10px; border: 0;
  border-radius: var(--r-6); background: transparent; color: var(--text-muted); font-size: 12.5px; font-family: inherit; cursor: pointer; }
#tf-holder .te-fback:hover { background: var(--surface-hover); color: var(--text); }
#tf-holder .te-fttl { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; max-width: 40vw; }
#tf-holder .te-fbody { flex: 1; min-height: 0; display: flex; justify-content: center; overflow: hidden; }
#tf-holder .te-farea { width: 780px; max-width: 100%; border: 0; outline: none; background: transparent; resize: none;
  padding: 34px 24px 60px; font-family: inherit; font-size: 15.5px; line-height: 1.8; color: var(--text); }
#tf-holder .te-rich { width: 780px; max-width: 100%; overflow-y: auto;
  padding: 34px 24px 60px; font-size: 15.5px; line-height: 1.8; }
#tf-holder .te-ffoot { position: fixed; right: 20px; bottom: 14px; font-size: 11.5px; color: var(--text-faint); }
/* Поиск внутри списка выбора: свой фокус вместо чёрной рамки браузера. */
#nt-holder [data-pick-q]:focus, #tc-holder [data-pick-q]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak);
}

/* ══ Новое в задаче (msg 2110) ════════════════════════════════════════════
   На доске «Команда» видно, что в задаче дописали, не открывая её; в самой
   карточке новые комментарии подсвечены мягким голубым. Голубой, а не
   зелёный: зелёный в CRM означает «оплачено, в срок», и путать эти два
   смысла нельзя. */
.tt-new {
  flex: 0 0 auto; display: inline-flex; align-items: center; height: 18px; padding: 0 7px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent-text);
  font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums;
}
#tc-holder .tc-cwrap.new {
  background: var(--info-weak); border-radius: var(--r-8);
  margin: 0 -10px; padding: 8px 10px;
}
#tc-holder .tc-tab-new {
  margin-left: 6px; padding: 0 6px; border-radius: 999px;
  background: var(--info-weak); color: var(--info); font-size: 11px; font-weight: 600;
}

/* ══ Телефон: окна во весь экран и своя прокрутка (msg 2123) ══════════════
   Раньше карточка задачи на телефоне была маленьким модальным окном: внутри
   оставалась полоска в полтора сантиметра, палец её не ловил и прокручивался
   список позади. Теперь окно занимает экран целиком, прокрутка одна на всё
   содержимое, а фон под окном зафиксирован. */
body.has-overlay { overflow: hidden; }

@media (max-width: 700px) {
  #tc-holder [data-card] {
    left: 0 !important; right: 0 !important; top: 0 !important; bottom: 0 !important;
    width: 100% !important; height: 100% !important; max-width: none !important;
    transform: none !important; border: 0; border-radius: 0;
  }
  #tc-holder [data-card-body] {
    display: block; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  }
  #tc-holder [data-card-body] > div { overflow: visible !important; height: auto !important; }
  #tc-holder [data-card-side] {
    order: 0; border-left: 0; border-top: 1px solid var(--border); border-bottom: 0;
    overflow: visible; max-height: none;
  }
  #tc-holder [data-card-fields] { display: block; }
  #tc-holder .tc-head { gap: 6px; padding: 0 8px; }
  #tc-holder .tc-head-crumb { display: none; }
  #tc-holder .tc-cact { opacity: 1; }
  #tc-holder .te-edit { margin: 10px -14px 0; }
  #tc-holder .te-edit .te-tools, #tc-holder .te-edit .te-area, #tc-holder .te-edit-foot { padding-left: 14px; padding-right: 14px; }

  /* Отбор с [data-mode] - чтобы перебить правила размеров окна: они заданы
     через #nt-holder[data-mode="..."] и иначе выигрывают по весу. */
  #nt-holder[data-mode] [data-form], #nt-holder [data-form] {
    left: 0; top: 0; transform: none; width: 100%; height: 100%; max-height: none;
    border: 0; border-radius: 0;
  }
  #nt-holder .te-body { display: block; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  #nt-holder .te-pane { display: block; }
  #nt-holder .te-area, #nt-holder .te-rich { min-height: 220px; }
  #nt-holder .te-rail { border-left: 0; border-top: 1px solid var(--border); max-height: none; overflow: visible; }
  #nt-holder .nt-rs { display: none; }

  #tf-holder .te-farea, #tf-holder .te-rich { padding: 20px 16px 60px; font-size: 15px; }
  #tf-holder .te-fttl { display: none; }

  /* Подсказка про Ctrl+Enter на телефоне бесполезна - клавиатуры нет, а место
     она занимает, из-за нее подписи кнопок переносились в две строки. */
  .te-hint, .tc-hint { display: none !important; }
  #nt-holder .te-btn, #tc-holder .te-btn { white-space: nowrap; }
  #nt-holder [data-form] > div:last-of-type label { font-size: 12px; line-height: 1.2; }

  /* Формы настроек на телефоне - в одну колонку: два поля рядом на 390px
     режут и подписи, и значения. */
  .settings-card form[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .settings-card form[style*="grid-template-columns"] > [style*="span 2"] { grid-column: auto !important; }
}

/* ══ Телефон: шапки разделов не сжимают заголовок ═════════════════════════
   В шапке рядом стоят заголовок и панель кнопок. На узком экране панель не
   ужимается и выдавливала заголовок в ноль - «Мои задачи» печаталось по одной
   букве в строку (msg 2123). На телефоне заголовок занимает свою строку,
   кнопки уезжают под него отдельной лентой с прокруткой пальцем. */
@media (max-width: 700px) {
  #tasks-head { flex-wrap: wrap; row-gap: 8px; }
  #tasks-head > div:first-child { flex: 1 1 100%; min-width: 0; }
  #tasks-head-tools {
    flex: 1 1 100% !important; overflow-x: auto; overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch; padding-bottom: 4px;
  }
  .ds-head { flex-wrap: wrap; row-gap: 8px; }
  .ds-head .ds-t { flex: 1 1 100%; min-width: 0; }
  .ds-head .ds-acts { flex: 1 1 100%; overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  /* На телефоне шапка переносится: итог встает под адрес, по левому краю —
     иначе цифра болталась бы посреди строки. */
  .exp-page-head .exp-total { flex: 1 1 100%; align-items: flex-start; margin-left: 0; }
  .rt2-seg, .rt2-tabs { overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  #tasks-head-tools::-webkit-scrollbar, .ds-acts::-webkit-scrollbar,
  .rt2-seg::-webkit-scrollbar, .rt2-tabs::-webkit-scrollbar { height: 0; }
}

/* Телефон: лента кнопок не сжимает сами кнопки, а прокручивается; в строке
   задачи заголовок важнее лайков и фамилии исполнителя. */
@media (max-width: 700px) {
  #tasks-head-tools > * { flex: 0 0 auto; }
  #tasks-head-tools .t2-bar > * { flex: 0 0 auto; white-space: nowrap; }
  /* Реакции прячем только в строках списка - в карточке по ним нажимают. */
  .t2-row .t2-react { display: none; }
  .t2-emp { flex: 0 1 auto !important; max-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .t2-title { min-width: 45%; }
}
/* Совсем узкий экран: имя исполнителя прячем, остается аватар - иначе срок
   («131 дн.») обрезался на правом краю. */
@media (max-width: 480px) {
  .t2-emp span:last-child, .t2-role { display: none; }
  .t2-emp { max-width: 26px !important; }
  /* Заголовок ужимается с многоточием, срок остается целым: «131 дн.» без
     последних букв читается как другое число. */
  .t2-title { min-width: 0 !important; flex: 1 1 auto; }
  .t2-due { flex: 0 0 auto; width: auto; font-size: 11.5px; }
  .t2-tag { display: none; }
}

/* ══ iPhone: безопасные зоны, высота экрана, размер полей ═════════════════
   Сафари считает 100vh вместе с полосой адреса, поэтому низ страницы уезжал
   под нее; нижняя панель разделов пряталась под полосу жестов; поля мельче
   16px Сафари приближает при касании, и после ввода страница оставалась
   увеличенной. */
html { -webkit-text-size-adjust: 100%; }

@supports (height: 100dvh) {
  #app, #tasks-view, #finance-view, #team-view, #admin-view, #home-view, #login-screen { height: 100dvh; }
}

@media (max-width: 900px) {
  .tabbar {
    height: calc(56px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    align-items: flex-start;
  }
  .messages-list, .preview-pane, #tasks-view, #finance-view, #team-view, #admin-view, #home-view,
  #people-view, #realty-view, #documents-view, #contracts-view {
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 700px) {
  /* Сафари приближает экран, если в поле шрифт меньше 16px. Часть полей
     задает размер прямо в разметке, поэтому здесь важность обязательна. */
  input:not([type="checkbox"]):not([type="radio"]), select, textarea { font-size: 16px !important; }
  /* Палец крупнее курсора: мелкие кнопки в шапках подрастают. */
  #tc-holder .tc-head button, #nt-holder [data-form] .te-tb, .rt2-pico { min-width: 34px; min-height: 34px; }
  /* Кнопка справки не должна выступать за край экрана. */
  #help-float { right: calc(8px + env(safe-area-inset-right)); }
  .help-corner { flex: 0 0 26px; }
  /* Ленты вкладок в договорах, настройках и почте прокручиваются пальцем. */
  .tabs, #contracts-view .tab, #admin-view .tabs,
  .doc-tabs { max-width: 100%; }
  #contracts-view .tabs, #admin-view .tabs, .doc-tabs {
    display: flex; flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  #contracts-view .tabs > *, #admin-view .tabs > *, .doc-tabs > * { flex: 0 0 auto; }
}

/* На телефоне в строке задачи остается аватар исполнителя без имени: имя
   съедало половину строки, а название задачи важнее. */
@media (max-width: 700px) {
  .t2-emp { flex: 0 0 auto !important; width: auto !important; max-width: none; }
  .t2-emp span:last-child { display: none; }
  .t2-title { min-width: 55%; }
}

/* ══ Телефон: экран не ездит вбок (msg 2132) ══════════════════════════════
   Когда блок прокручивается по вертикали, браузер разрешает ему и боковой
   ход. Палец при пролистывании всегда идет чуть наискось - и окно уезжало
   влево-вправо. Разрешаем только вертикальное движение, а боковую прокрутку
   оставляем там, где она осмысленна: широкие таблицы, ленты вкладок, доска
   «Команда». Длинные слова и ссылки переносим, чтобы не растягивали окно. */
@media (max-width: 700px) {
  html, body { overflow-x: hidden; overscroll-behavior-x: none; }
  #tc-holder [data-card-body], #nt-holder .te-body, #tf-holder .te-fbody,
  #tasks-main, #home-view, #people-view, #documents-view, #contracts-view {
    overflow-x: hidden; touch-action: pan-y;
  }
  #tc-holder [data-card-main], #tc-holder [data-card-side],
  #nt-holder .te-pane, #nt-holder .te-rail {
    overflow-wrap: anywhere; word-break: break-word;
  }
  #tc-holder [data-card-main] img, #tc-holder [data-card-main] pre { max-width: 100%; }
  .ds-card.scroll-x, .rt2-scroll, #tasks-head-tools, .rt2-seg, .rt2-tabs,
  .ds-acts, #team-columns, .team-drop-zone { touch-action: auto; }
}

/* Телефон: по сердечку в карточке попадают пальцем, а не курсором. */
@media (max-width: 900px) {
  #tc-holder .t2-heart, #nt-holder .t2-heart { height: 30px; padding: 0 12px; font-size: 13px; }
  #tc-holder .t2-heart .i { font-size: 14px; }
  #tc-holder .t2-react { gap: 8px; }
}

/* ══ Телефон боком: карточка тоже во весь экран и с одной прокруткой ══════
   В альбомной ориентации ширина уже не «телефонная» (844), поэтому прежние
   правила не срабатывали: свойства занимали всю высоту, комментариям
   оставалось 40 пикселей и их нельзя было пролистать (msg 2134). */
@media (max-width: 900px), (max-height: 520px) {
  #tc-holder [data-card-body] {
    display: block; overflow-y: auto; overflow-x: hidden;
    overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch;
  }
  #tc-holder [data-card-body] > div { overflow: visible !important; height: auto !important; }
  #tc-holder [data-card-side] {
    order: 0; border-left: 0; border-top: 1px solid var(--border); border-bottom: 0;
    overflow: visible; max-height: none;
  }
  #tc-holder [data-card-fields] { display: block; }
}
@media (max-height: 520px) {
  #tc-holder [data-card], #nt-holder [data-form] {
    left: 0 !important; right: 0 !important; top: 0 !important; bottom: 0 !important;
    width: 100% !important; height: 100% !important; max-width: none !important; max-height: none !important;
    transform: none !important; border: 0; border-radius: 0;
  }
  #nt-holder .te-body {
    display: block; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y;
  }
  #nt-holder .te-pane { display: block; }
  #nt-holder .te-area, #nt-holder .te-rich { min-height: 180px; }
  #nt-holder .te-rail { border-left: 0; border-top: 1px solid var(--border); overflow: visible; }
  #nt-holder .nt-rs { display: none; }
}

/* Телефон: поле комментария выше, кнопка «Во весь экран» рядом со скрепкой,
   подсказка про Ctrl+Enter лишняя - клавиатуры с Ctrl там нет (msg 2195). */
@media (max-width: 700px) {
  .tc-area { min-height: 150px; line-height: 1.55; }
  .tc-hint { display: none; }
}

/* Телефон: в шапке полноэкранного редактора кнопки правки уезжали вправо
   вместе с «Готово» - сохранить текст было нечем. Панель уходит во вторую
   строку и листается, «Готово» остается видимой (msg 2195). */
#tf-holder .te-fbar { display: flex; align-items: center; gap: 2px; }
@media (max-width: 700px) {
  #tf-holder .te-fhead { flex-wrap: wrap; height: auto; min-height: 46px; padding: 5px 12px 3px; row-gap: 2px; }
  #tf-holder .te-fback { white-space: nowrap; padding: 0 6px 0 0; }
  #tf-holder .te-fhead > .te-tsep { display: none; }
  #tf-holder .te-fbar { order: 5; flex: 1 1 100%; overflow-x: auto; padding: 2px 0; }
  #tf-holder .te-fbar::-webkit-scrollbar { display: none; }
  #tf-holder .te-btn.pri { order: 4; }
  #tf-holder .te-ffoot { left: 14px; right: 14px; text-align: center; }
}

/* ══ Видно, что нажал (msg 2268) ══════════════════════════════════════════
   Между нажатием по задаче и появлением карточки проходило до двух секунд
   молча - человек решал, что промахнулся, и жал еще раз. Три уровня отклика:
   строка вдавливается прямо под пальцем (это чистый css, отклик мгновенный),
   вверху экрана идет полоса загрузки, а карточка открывается сразу каркасом
   из серых полос и заполняется, когда придут данные. */
.t2-row:active, .t2-trow:active, .t2-tile:active, .kanban-card:active,
.msg-item:active, .task-row:active, .team-task:active, .ds-table tbody tr:active,
.pick-row:active, .nw-qb:active, .nw-chip:active {
  background: var(--accent-soft);
}
.t2-tile:active, .kanban-card:active, .team-task:active { transform: translateY(1px); }
.ds-btn:active, .te-btn:active, .t2-mbtn:active, .compose-btn:active,
.nw-seg button:active { transform: translateY(1px); }

/* Полоса загрузки: тонкая линия поверх всего, пока идут запросы. */
html.is-busy::after {
  content: ""; position: fixed; left: 0; top: 0; width: 100%; height: 2px; z-index: 9998;
  background: var(--accent-soft); pointer-events: none;
}
html.is-busy::before {
  content: ""; position: fixed; left: 0; top: 0; width: 22%; height: 2px; z-index: 9999;
  background: var(--accent); pointer-events: none;
  animation: busyRun 1.05s cubic-bezier(.45, 0, .35, 1) infinite;
}
@keyframes busyRun { from { transform: translateX(-100%) } to { transform: translateX(455%) } }

/* Каркас карточки, пока едут данные. */
.sk-bar { border-radius: 6px; background: var(--surface-sunken); position: relative; overflow: hidden; flex: 0 0 auto; }
.sk-bar::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  animation: skShine 1.25s ease-in-out infinite;
}
:root[data-theme="dark"] .sk-bar::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .07), transparent);
}
@keyframes skShine { to { transform: translateX(100%) } }

@media (prefers-reduced-motion: reduce) {
  html.is-busy::before { animation: none; width: 100%; opacity: .45; }
  .sk-bar::after { animation: none; }
}

/* ══ Шапка комментария в карточке задачи (msg 2274) ═══════════════════════
   Имя с должностью стояли одной строкой, которая не сжималась: на телефоне
   она уезжала за край и уносила с собой время, сердечко и кнопку «ответить» -
   их просто не было видно. Теперь имя стоит целиком, должность переносится
   на свою строку и помещается вся, а действия всегда на экране. */
#tc-holder .tc-chead { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; row-gap: 3px; }
#tc-holder .tc-cwho { flex: 0 0 auto; font-size: 12px; font-weight: 600; }
#tc-holder .tc-crole { flex: 0 1 auto; min-width: 0; font-size: 11px; color: var(--text-muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tc-holder .tc-crole::before { content: "· "; color: var(--text-faint); }
#tc-holder .tc-ctime { flex: 0 0 auto; font-size: 11px; color: var(--text-faint); white-space: nowrap; }
#tc-holder .tc-cacts { flex: 0 0 auto; margin-left: auto; display: inline-flex; align-items: center; gap: 8px; }
#tc-holder .tc-cact { border: 0; background: none; padding: 0; font-family: inherit; font-size: 11px;
  color: var(--text-faint); cursor: pointer; white-space: nowrap; }
#tc-holder .tc-cact:hover { color: var(--text); }
#tc-holder .tc-cact.icon { display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: var(--r-4); }
#tc-holder .tc-cact.icon:hover { background: var(--surface-hover); }
#tc-holder .tc-cact.icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor;
  stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#tc-holder .tc-cedited { font-size: 11px; color: var(--text-faint); }
/* Текст комментария разбирается той же разметкой, что описание задачи. */
#tc-holder .tc-ctext { margin-top: 3px; font-size: 13px; line-height: 1.55; color: var(--text); }
#tc-holder .tc-ctext p { margin: 0 0 6px; }
#tc-holder .tc-ctext ul, #tc-holder .tc-ctext ol { margin: 4px 0 6px; }

@media (max-width: 700px) {
  /* Три строки вместо одной уехавшей: имя со временем, под ними должность
     целиком, ниже действия. На 390 точках должность рядом с именем не
     помещается ни при каком сокращении. */
  #tc-holder .tc-cwho { order: 1; }
  #tc-holder .tc-ctime { order: 2; }
  #tc-holder .tc-crole { order: 3; flex: 1 1 100%; }
  #tc-holder .tc-crole::before { content: ""; }
  #tc-holder .tc-cacts { order: 4; margin-left: 0; flex: 1 1 100%; justify-content: flex-start; gap: 14px; margin-top: 2px; }
  #tc-holder .tc-cact { font-size: 12px; min-height: 26px; }
}

/* ══ Объекты на телефоне: список во весь экран (msg 2277) ═════════════════
   Полоса отбора переносилась на пять рядов и занимала половину экрана -
   объектам оставалась вторая половина. Теперь полоса идет одной лентой с
   боковой прокруткой, а при листании списка уезжает совсем: список получает
   весь экран. Листнули вверх - полоса вернулась. */
@media (max-width: 700px) {
  #realty-body .rt2-bar {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch; touch-action: auto; gap: 6px; padding: 4px 0 6px;
  }
  #realty-body .rt2-bar > * { flex: 0 0 auto; }
  #realty-body .rt2-bar .rt2-spring, #realty-body .rt2-bar .rt2-sep { display: none; }
  #realty-body .rt2-search { flex: 0 0 150px !important; width: 150px !important; min-width: 0 !important; }
  /* «Колонки» работают только в виде «Список» на широком экране - на телефоне
     кнопка все равно неактивна и лишь занимает место. */
  #realty-body .rt2-bar details { display: none; }

  #realty-body .rt2-bar, #realty-body .rt2-caps {
    overflow-y: hidden;
    transition: max-height .18s ease-out, opacity .14s ease-out, padding .18s ease-out;
    max-height: 60px;
  }
  #realty-body .rt2-caps { max-height: 40px; }
  #realty-body .rt2.bar-off .rt2-bar, #realty-body .rt2.bar-off .rt2-caps {
    max-height: 0; min-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0;
  }

  /* Нижняя лента вкладок закрывала последние карточки: список кончался под
     ней, и до последнего объекта было не добраться. */
  #realty-body .rt2-scroll { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }

  /* Список плиток и строк листается только по вертикали: с touch-action auto
     палец, идущий чуть наискось, отдавал ход боковой оси, и список замирал.
     Таблице боковой ход нужен - ей оставляем как было. */
  #realty-body .rt2-scroll[data-view="tile"],
  #realty-body .rt2-scroll[data-view="list"],
  #realty-body .rt2-scroll[data-view="kanban"] { touch-action: pan-y; }
}

/* ══ Карточка объекта на телефоне (msg 2280) ══════════════════════════════
   Длинный адрес в шапке карточки стоял гибким блоком с min-width:auto - он не
   умел сжиматься и раздвигал страницу вбок на 89 точек. Вся карточка ездила
   под пальцем, а верхняя строка с кнопками уходила за край.
   Гибким блокам разрешаем сжиматься, широкие таблицы листаются внутри своей
   рамки, а строка раздела переносится на вторую строку. */
@media (max-width: 700px) {
  /* Строка раздела - одна лента с боковой прокруткой, как полоса отбора:
     переносить ее рядами дороже по высоте, а листать вбок привычно. */
  #realty-view .rt2-head-bar { overflow-x: auto; scrollbar-width: none; gap: 10px; }
  #realty-view .rt2-head-bar::-webkit-scrollbar { display: none; }
  #realty-view .rt2-head-bar > * { flex: 0 0 auto; }
  #realty-view .rt2-head-bar .rt2-spring { display: none; }

  /* Шапка карточки: сначала адрес во всю ширину, кнопки под ним. Иначе адрес
     жался в узкую колонку рядом с кнопками и печатался по слогам. */
  #realty-body .rt2-objhead { flex-wrap: wrap; }
  #realty-body .rt2-objtitle { flex: 1 1 100%; order: -1; font-size: 19px; }

  /* Ни один блок карточки не имеет права быть шире экрана. */
  #realty-body [id$="-table"] { max-width: 100%; min-width: 0; }

  /* Возврат к списку - в самой карточке: в ленте раздела он за краем экрана. */
  #realty-body .rt2-cardback { display: block; margin: 0 0 10px; }
}
.rt2-cardback { display: none; }

/* ══ Денежные карточки объекта: шапка и плитка оценок ═════════════════════
   Раскладка вынесена из инлайновых стилей в классы: только так медиазапрос
   может переставить блоки на телефоне (инлайн перебивает любой селектор). */
.rt2-chead {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.rt2-chead-title { font-size: 15px; font-weight: 600; }
.rt2-chead-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rt2-chead-acts { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
/* Выгрузки держим одной группой: на узком экране они переносятся вместе,
   а не так, что Excel остался у итога, а PDF уехал строкой ниже. */
.rt2-chead-btns { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.rt2-chead-total {
  font-size: 18px; font-weight: 700; color: var(--text);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

.rt2-valgrid { display: flex; gap: 10px; align-items: flex-start; margin-top: 2px; }
.rt2-valcell { flex: 1; min-width: 0; }
.rt2-vallab {
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; margin-bottom: 2px;
}
.rt2-valnum {
  font-size: 15px; font-weight: 700; color: var(--text); line-height: 1.2;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rt2-valsep { width: 1px; background: var(--border); align-self: stretch; }

/* ══ Те же карточки на телефоне (msg 2283: «часть цифр съеденная») ════════ */
@media (max-width: 700px) {
  /* Итог стоял в одной строке с кнопками выгрузки: строка не влезала в
     ширину карточки, вылезала на 18 точек за её край, а overflow:hidden
     срезал цифры. Теперь итог - отдельная строка и первый по важности. */
  #realty-body .rt2-chead { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  #realty-body .rt2-chead-acts { flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
  #realty-body .rt2-chead-total { order: -1; margin-right: auto; font-size: 21px; letter-spacing: -.01em; }

  /* Оценки: колонка в 100 точек не вмещала восьмизначную сумму, и многоточие
     съедало последние разряды. На телефоне - строки «подпись - число». */
  #realty-body .rt2-valgrid { flex-direction: column; gap: 0; margin-top: 4px; }
  #realty-body .rt2-valsep { display: none; }
  #realty-body .rt2-valcell {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 12px; padding: 7px 0;
  }
  #realty-body .rt2-valcell ~ .rt2-valcell { border-top: 1px solid var(--border); }
  #realty-body .rt2-vallab { margin-bottom: 0; letter-spacing: .06em; }
  #realty-body .rt2-valnum { overflow: visible; text-overflow: clip; font-size: 16px; }

  /* Постоянные платежи: две липкие колонки на 353 точках оставляли месяцам
     окно в 87 точек, и цифры месяца уходили под колонку «Итог». Липкой
     остаётся статья - она держит строку, - а итог листается вместе с
     месяцами и потому виден целиком. */
  #realty-body .rt2-ftot { position: static !important; box-shadow: none !important; }
  /* Ширину статьи задаём жёстко: с одним лишь max-width браузер ужимал
     колонку до самой узкой буквы и печатал «А р е н д а» столбиком. */
  #realty-body .rt2-fart {
    white-space: normal !important; overflow-wrap: anywhere;
    width: 122px; min-width: 122px; max-width: 122px;
    padding-left: 12px !important; padding-right: 10px !important;
  }
}

/* Панель разметки над полем комментария и подсказки в списках выбора. */
#tc-holder .tc-cbox { overflow: hidden; }
#tc-holder .tc-ctools { height: 30px; padding: 0 6px; border-top: 0; border-bottom: 1px solid var(--border);
  background: var(--bg-alt); overflow-x: auto; scrollbar-width: none; }
#tc-holder .tc-ctools::-webkit-scrollbar { display: none; }
#tc-holder .tc-cbox .tc-area, #tc-holder .tc-cbox .te-rich { padding: 9px 10px; }
#tc-holder .tc-cbox > div:last-child { padding: 0 10px 9px; }
.pick-note { padding: 5px 10px; border-top: 1px solid var(--border); background: var(--bg-alt);
  font-size: 11px; color: var(--text-faint); }
.pick-ok { flex: 0 0 auto; margin-left: auto; font-size: 11px; color: var(--accent); }

/* ══ Карточка объекта: просмотр и правка (msg 2309) ═══════════════════════
   По умолчанию раздел показывает сохранённое как текст: пустые поля не висят
   готовыми к вводу и не занимают место. Правка открывается карандашом. */
.objc-pen { flex: 0 0 auto; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--r-6); background: transparent; color: var(--text-muted);
  font-size: 11.5px; cursor: pointer; padding: 0 6px; width: auto; min-width: 26px; }
.objc-pen:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.objc-pen.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-on); font-weight: 600; }
.objc-pen.pri:hover { background: var(--accent-hover, var(--accent)); color: var(--accent-on); }
.objc-pen svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }
.objc-view { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px 24px; }
.objc-vrow { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 2px 0; }
.objc-vrow .l { font-size: 11px; color: var(--text-faint); }
.objc-vrow .v { font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.objc-empty { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--text-faint); }
.objc-add { height: 26px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--r-6);
  background: transparent; color: var(--text); font-family: inherit; font-size: 12px; cursor: pointer; }
.objc-add:hover { background: var(--surface-hover); }

/* ── Раздел «Проекты» (04.09.2026, страница по макету владельца) ──────────
   Инструмент, а не витрина: тонкие бордеры, воздух между смысловыми группами,
   один индиго-акцент, светофор только там, где есть состояние. */
.prj-wrap { padding: 22px 26px 40px; max-width: 1400px; }
.prj-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.prj-h1 { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.prj-sub { font-size: 12.5px; color: var(--text-faint); margin-top: 5px; }
.prj-back {
  border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px;
  color: var(--accent); cursor: pointer;
}
.prj-back:hover { text-decoration: underline; }

/* Список проектов: карточки одного размера, но без сетки-конвейера - у
   каждого свой текст, и высота идёт по нему. */
.prj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.prj-card {
  display: flex; flex-direction: column; gap: 8px; text-align: left; width: 100%;
  border: 1px solid var(--border); border-radius: var(--rt-lg); background: var(--bg-alt);
  padding: 16px 18px; cursor: pointer; font: inherit;
}
.prj-card:hover { border-color: var(--border-strong); }
.prj-card-h { display: flex; align-items: center; gap: 10px; }
.prj-card-name { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.prj-card-d { font-size: 12.5px; color: var(--text-muted); line-height: 1.45; }
.prj-card-m { font-size: 12.5px; color: var(--text-muted); }
.prj-card-m b { font-size: 15px; color: var(--text); }
.prj-card-f { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-faint); margin-top: 2px; }

/* Шапка карточки проекта. */
.prj-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
/* Действия над проектом стоят тише названия: главное действие страницы -
   написать в ленту, а архив и удаление нужны раз в жизни проекта. */
.prj-acts { display: flex; gap: 6px; flex-shrink: 0; padding-top: 4px; }
.prj-act {
  border: 1px solid var(--border); background: var(--bg); border-radius: var(--rt-md);
  padding: 6px 12px; font: inherit; font-size: 12.5px; color: var(--text-muted); cursor: pointer;
}
.prj-act:hover { border-color: var(--border-strong); color: var(--text); }
/* Красное появляется только под курсором: пока кнопку не трогают, она не
   кричит. */
.prj-act.del:hover { border-color: var(--bad); color: var(--bad); }
.prj-arch {
  margin-left: 10px; vertical-align: middle; font-size: 11.5px; font-weight: 600;
  color: var(--text-muted); background: var(--bg-alt); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 9px;
}
.prj-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--text-muted); margin-top: 10px; }
.prj-dot { color: var(--text-quart); margin: 0 4px; }
.prj-ava {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
  border-radius: 999px; background: var(--accent-soft); color: var(--accent);
  font-size: 9.5px; font-weight: 700; letter-spacing: .02em; flex: none;
}
.prj-avas { display: inline-flex; }
.prj-avas .prj-ava { margin-right: -6px; border: 1.5px solid var(--bg); }
.prj-delta { font-size: 12.5px; color: var(--text-muted); margin-top: 12px; }
.prj-late { color: var(--bad); font-weight: 600; }
.prj-soon { color: var(--warn); font-weight: 600; }

/* Готовность: дорожка стадий и процент, раскрывается в блоки. */
.prj-ind { border: 1px solid var(--border); border-radius: var(--rt-lg); background: var(--bg-alt); margin-top: 18px; }
.prj-ind-h {
  display: flex; align-items: center; gap: 24px; width: 100%; text-align: left;
  border: 0; background: none; padding: 16px 20px; cursor: pointer; font: inherit;
}
.prj-road { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; min-width: 0; }
.prj-st i { display: block; height: 4px; border-radius: 999px; background: var(--surface-sunken); }
.prj-st span { display: block; font-size: 12px; color: var(--text-faint); margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prj-st.done i { background: var(--accent); }
.prj-st.done span { color: var(--text-muted); }
.prj-st.cur i { background: color-mix(in oklab, var(--accent) 45%, var(--bg)); }
.prj-st.cur span { color: var(--text); font-weight: 600; }
.prj-pct { display: flex; align-items: baseline; gap: 5px; flex: none; }
.prj-pct b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.prj-pct span { font-size: 11.5px; color: var(--text-muted); }
.prj-caret { color: var(--text-faint); margin-left: 6px; font-size: 10px; }
.prj-blocks { border-top: 1px solid var(--border); padding: 6px 20px 14px; }
.prj-blk { display: grid; grid-template-columns: minmax(0, 1fr) 160px 74px 108px; gap: 16px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.prj-blk:last-of-type { border-bottom: 0; }
.prj-blk.head { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); }
.prj-blk .bar { height: 4px; border-radius: 999px; background: var(--surface-sunken); overflow: hidden; }
.prj-blk .bar i { display: block; height: 100%; background: var(--accent); }
.prj-blk .n { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.prj-blk .s { font-size: 12.5px; color: var(--text-muted); }
.prj-blk .s.done { color: var(--ok); }
.prj-blk .s.none { color: var(--text-faint); }
.prj-blk-note { font-size: 11.5px; color: var(--text-faint); padding-top: 10px; }
.prj-ind-empty {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px;
  border: 1px dashed var(--border-strong); border-radius: var(--rt-lg); padding: 16px 20px;
}
.prj-ind-empty .t { font-size: 13.5px; font-weight: 600; }
.prj-ind-empty .p { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; max-width: 66ch; }

/* Рабочая часть и правая колонка. */
.prj-cols { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 40px; margin-top: 26px; }
.prj-tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--border); }
.prj-tab {
  border: 0; background: none; padding: 0 0 10px; margin-bottom: -1px; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--text-muted); border-bottom: 2px solid transparent;
}
.prj-tab .n { color: var(--text-faint); margin-left: 6px; font-size: 12px; }
.prj-tab:hover { color: var(--text); }
.prj-tab.on { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.prj-write { display: flex; gap: 10px; margin: 18px 0 8px; }
.prj-feed-empty { text-align: center; color: var(--text-faint); font-size: 13px; padding: 34px 0; }
.prj-day { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); margin: 18px 0 6px; }
.prj-entry { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.prj-entry .b { flex: 1; min-width: 0; }
.prj-entry .h { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.prj-entry .tm { color: var(--text-faint); font-size: 12px; }
.prj-entry .t { font-size: 13.5px; line-height: 1.5; margin-top: 3px; overflow-wrap: anywhere; }
.prj-entry .acts { margin-left: auto; display: flex; gap: 4px; }
.prj-entry .acts button { border: 0; background: none; padding: 2px 7px; border-radius: var(--r-6); cursor: pointer; font: inherit; font-size: 12px; color: var(--text-faint); }
.prj-entry .acts button:hover { background: var(--surface-hover); color: var(--accent); }
.prj-entry .acts button.danger:hover { color: var(--bad); }
/* Правка записи на месте: поле встаёт ровно туда, где был текст, - человек
   правит там же, где читал, без окна поверх всего. */
.prj-edit { margin-top: 6px; }
.prj-edit textarea {
  width: 100%; resize: vertical; font: inherit; font-size: 13.5px; line-height: 1.5;
  padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--rt-md);
  background: var(--bg); color: var(--text);
}
.prj-edit textarea:focus { outline: none; border-color: var(--accent); }
.prj-edit .a { display: flex; gap: 8px; margin-top: 8px; }
@media (hover: hover) {
  .prj-entry .acts { opacity: 0; transition: opacity .12s ease-out; }
  .prj-entry:hover .acts, .prj-entry:focus-within .acts { opacity: 1; }
}

/* Списки задач и багов. */
.prj-rows { margin-top: 14px; }
.prj-row { display: grid; grid-template-columns: 116px minmax(0, 1fr) max-content 150px 96px; gap: 14px; align-items: center; padding: 9px 10px; margin: 0 -10px; border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer; border-radius: var(--r-6); }
.prj-row:hover { background: var(--bg-hover); }
.prj-row .st { color: var(--text-muted); font-size: 12.5px; }
.prj-row .st.done { color: var(--ok); }
.prj-row .ti, .prj-row .bl, .prj-row .as { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prj-row .bl, .prj-row .as { color: var(--text-muted); font-size: 12.5px; }
.prj-row .dt { text-align: right; color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.prj-row .sev { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; color: var(--text-muted); background: var(--bg-hover); }
.prj-row .sev.bad { color: var(--bad); background: color-mix(in oklab, var(--bad-dot) 12%, transparent); }
.prj-row .sev.warn { color: var(--warn); background: color-mix(in oklab, var(--warn-dot) 14%, transparent); }

.prj-side-h { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 10px; }
.prj-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 4px 0; }
.prj-kv span { color: var(--text-muted); }
.prj-att { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 3px 0; }
.prj-att i { width: 6px; height: 6px; border-radius: 999px; flex: none; }
.prj-att i.bad { background: var(--bad-dot); }
.prj-att i.warn { background: var(--warn-dot); }
.prj-pin { font-size: 12.5px; line-height: 1.5; color: var(--text); }
.prj-pin .a { color: var(--text-faint); margin-top: 6px; }
.prj-members { margin-top: 16px; }
.prj-mem { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.prj-mem .n { flex: 1; }
.prj-mem .n .t { display: block; color: var(--text-faint); font-size: 12px; }
.prj-mem .r { color: var(--text-muted); font-size: 12.5px; }
.prj-mem .n .me { color: var(--text-faint); font-weight: 400; }
.prj-rights {
  border: 1px solid var(--border); background: none; border-radius: var(--r-6); cursor: pointer;
  font: inherit; font-size: 12px; color: var(--text-muted); padding: 4px 9px;
}
.prj-rights:hover { border-color: var(--border-strong); color: var(--text); }
.prj-rights.del { padding: 4px 8px; color: var(--text-faint); }
.prj-rights.del:hover { border-color: var(--bad); color: var(--bad); }

/* Отбор, быстрое добавление и статус кликом - в списках задач и багов. */
.prj-chip .n { margin-left: 6px; font-variant-numeric: tabular-nums; opacity: .75; }
.prj-sel {
  height: 26px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-alt);
  padding: 0 8px; font: inherit; font-size: 12px; color: var(--text-muted); cursor: pointer;
}
.prj-sel:hover { border-color: var(--border-strong); color: var(--text); }
.prj-qa { display: flex; align-items: center; gap: 12px; height: 42px; border-bottom: 1px solid var(--border); margin-top: 8px; }
.prj-qa i { width: 7px; height: 7px; border-radius: 999px; border: 1.5px solid var(--border-strong); flex: none; }
.prj-qa i.warn { background: var(--warn-dot); border-color: var(--warn-dot); }
.prj-qa input { flex: 1; min-width: 0; border: 0; outline: none; background: none; font: inherit; font-size: 13px; color: var(--text); }
.prj-qa .h { color: var(--text-faint); font-size: 12px; }
.prj-hits { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0; }
.prj-hits button {
  border: 1px solid var(--border); background: none; border-radius: var(--r-6); cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--text); padding: 5px 10px;
}
.prj-hits button:hover { border-color: var(--accent); color: var(--accent); }
.prj-hits button span { color: var(--text-faint); margin-left: 6px; font-size: 11.5px; }
.prj-stb {
  display: flex; align-items: center; gap: 7px; border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--text-muted); text-align: left;
}
.prj-stb:hover { color: var(--text); }
.prj-stb i { width: 7px; height: 7px; border-radius: 999px; flex: none; border: 1.5px solid var(--border-strong); }
.prj-stb i.ok { background: var(--ok-dot); border-color: var(--ok-dot); }
.prj-stb i.warn { background: var(--warn-dot); border-color: var(--warn-dot); }
.prj-stb i.bad { background: var(--bad-dot); border-color: var(--bad-dot); }
.prj-row button.sev { cursor: pointer; border: 0; font: inherit; justify-self: start; }

/* Шапка проекта: одно меню действий вместо ряда кнопок. */
.prj-acts { position: relative; }
.prj-dots {
  width: 30px; height: 30px; border-radius: var(--r-6); border: 1px solid var(--border);
  background: none; color: var(--text-muted); cursor: pointer; font: inherit; font-size: 15px; letter-spacing: .04em;
}
.prj-dots:hover { background: var(--bg-hover); color: var(--text); }
.prj-menu {
  position: absolute; right: 0; top: 36px; width: 220px; z-index: 7; padding: 4px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--r-6); box-shadow: var(--shadow-lg, 0 12px 32px rgba(0,0,0,.12));
  display: flex; flex-direction: column;
}
.prj-menu button {
  height: 30px; padding: 0 10px; border: 0; background: none; border-radius: var(--r-4, 6px); cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--text); text-align: left;
}
.prj-menu button:hover { background: var(--bg-hover); }
.prj-menu button.del { color: var(--bad); }
.prj-people { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-size: 12.5px; color: var(--text-muted); display: inline-flex; align-items: center; }
.prj-people:hover { color: var(--text); }
.prj-done-mark { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); }
.prj-done-mark i { width: 7px; height: 7px; border-radius: 999px; background: var(--ok-dot); }
.prj-dgo { border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-size: 12.5px; color: var(--text-muted); }
.prj-dgo:hover { text-decoration: underline; color: var(--text); }
.prj-dgo.prj-late { color: var(--bad); }
.prj-closed { margin: 18px 0 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-6); font-size: 12.5px; color: var(--text-muted); }

/* Поле ленты: растет под текст, отправка по Enter. */
.prj-write { align-items: flex-start; }
.prj-write .b { flex: 1; min-width: 0; }
.prj-write textarea {
  width: 100%; resize: none; overflow: hidden; font: inherit; font-size: 13.5px; line-height: 1.45;
  padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--r-6);
  background: var(--bg-alt); color: var(--text); min-height: 36px;
}
.prj-write textarea:focus { outline: none; border-color: var(--accent); }
.prj-write .a { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.prj-write .a .h { flex: 1; color: var(--text-faint); font-size: 12px; }

/* Пункты правой колонки кликабельны: цифра ведет туда, где эти записи лежат. */
.prj-att { border: 0; background: none; padding: 3px 0; cursor: pointer; font: inherit; font-size: 13px; color: var(--text); text-align: left; width: 100%; }
.prj-att:hover { text-decoration: underline; }
.prj-att i.none { background: var(--text-quart); }

/* Файлы проекта: список вложений всех его задач. */
.prj-find {
  height: 28px; width: 240px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-6);
  background: var(--bg-alt); color: var(--text); font: inherit; font-size: 12.5px;
}
.prj-find:focus { outline: none; border-color: var(--accent); }
.prj-files { margin-top: 8px; }
.prj-file { display: grid; grid-template-columns: 40px minmax(0, 1fr) 76px 220px 92px; gap: 14px; align-items: center; padding: 8px 10px; margin: 0 -10px; border-bottom: 1px solid var(--border); font-size: 13px; border-radius: var(--r-6); }
.prj-file:hover { background: var(--bg-hover); }
.prj-file .ex {
  height: 26px; border: 1px solid var(--border); border-radius: var(--r-4, 6px); color: var(--text-muted);
  font-size: 9px; font-weight: 700; letter-spacing: .04em; display: flex; align-items: center; justify-content: center; text-decoration: none;
}
.prj-file .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; }
.prj-file .nm:hover { color: var(--accent); text-decoration: underline; }
.prj-file .sz { color: var(--text-muted); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }
.prj-file .src {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: left;
  border: 0; background: none; padding: 0; cursor: pointer; font: inherit; font-size: 12px; color: var(--text-muted);
}
.prj-file .src:hover { color: var(--accent); text-decoration: underline; }
.prj-file .dt { color: var(--text-faint); font-size: 12px; text-align: right; }

/* График проекта: задачи отрезками на календаре. Цвет полосы говорит о
   состоянии - готово, в работе, еще не начато, просрочено; серого больше
   всего, потому что состояний без тревоги тоже больше всего. */
.prj-gtop { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.prj-gsum { font-size: 12.5px; color: var(--text-muted); }
.prj-chip {
  margin-left: auto; height: 26px; padding: 0 10px; border-radius: 999px; white-space: nowrap;
  border: 1px solid var(--border); background: none; color: var(--text-muted);
  font: inherit; font-size: 12px; cursor: pointer;
}
.prj-chip:hover { border-color: var(--border-strong); color: var(--text); }
.prj-chip.on { background: var(--accent-soft); border-color: transparent; color: var(--accent); }

.prj-gwrap { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--rt-lg); background: var(--bg-alt); overflow: hidden; }
.prj-gscroll { overflow-x: auto; }
.prj-gin { min-width: 640px; position: relative; }

.prj-ghead { display: flex; height: 44px; border-bottom: 1px solid var(--border); position: relative; }
/* Высокая шапка - когда над шкалой идут полосы стадий. */
.prj-ghead.tall { height: 64px; }
.prj-gst {
  position: absolute; top: 26px; height: 20px; box-sizing: border-box; border-radius: 4px;
  display: flex; align-items: center; padding: 0 7px; overflow: hidden; white-space: nowrap;
  font-size: 11px; border: 1px solid transparent; color: var(--text-faint);
}
.prj-gst.done { background: var(--surface-sunken); color: var(--text-muted); }
.prj-gst.cur { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.prj-gst.next { border-color: var(--border); }
.prj-gstages { margin-top: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--text-faint); }
.prj-gstages button {
  border: 1px dashed var(--border-strong); background: none; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--text-muted); padding: 3px 10px;
}
.prj-gstages button:hover { border-color: var(--accent); color: var(--accent); }
.prj-gbar.grab { cursor: grab; }
.prj-gbar.grab:active { cursor: grabbing; }
.prj-gbar.grab:hover { border-color: var(--accent); }
.prj-gleft {
  width: 240px; flex: 0 0 240px;
  /* Кнопка тут работает клеткой таблицы: своей рамки и скругления у нее быть
     не должно, иначе строки графика превращаются в грядку кнопок. */
  border: 0; border-right: 1px solid var(--border); border-radius: 0; appearance: none;
  display: flex; align-items: center; gap: 8px; padding: 0 14px; min-width: 0;
  font: inherit; font-size: 12.5px; color: var(--text); background: none; text-align: left;
}
.prj-ghead .prj-gleft {
  align-items: flex-end; padding-bottom: 6px;
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint);
}
.prj-gright { flex: 1; position: relative; min-width: 0; }
.prj-ghead .prj-gright { overflow: hidden; }
.prj-gmon {
  position: absolute; top: 0; height: 22px; border-left: 1px solid var(--border-strong);
  padding-left: 6px; font-size: 12px; color: var(--text-muted);
  display: flex; align-items: center; white-space: nowrap;
}
.prj-gnow { position: absolute; bottom: 2px; font-size: 11px; font-weight: 600; line-height: 14px; white-space: nowrap; color: var(--accent); }
.prj-gnow.ok { color: var(--ok); }
.prj-gnow.bad { color: var(--bad); }
.prj-gnow.mid { color: var(--text-muted); }

.prj-gover { position: absolute; left: 240px; right: 0; bottom: 0; pointer-events: none; }
.prj-gweek { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--border); }
.prj-gline { position: absolute; top: 0; bottom: 0; border-left: 1.5px solid var(--accent); }
.prj-gline.dl { border-left-style: dashed; border-left-color: var(--text-quart); }
.prj-gline.dl.bad { border-left-color: var(--bad-dot); }
.prj-gline.dl.ok { border-left-color: var(--ok-dot); }

.prj-grow { display: flex; height: 34px; border-bottom: 1px solid var(--border); }
.prj-grow:last-of-type { border-bottom: 0; }
.prj-grow.g { height: 30px; background: var(--bg); }
.prj-grow.g .prj-gright { background: var(--bg); }
.prj-grow.g .prj-gleft { font-weight: 600; cursor: pointer; }
.prj-grow.g .prj-gleft:hover { background: var(--bg-hover); }
.prj-gleft.t { padding-left: 30px; cursor: pointer; }
.prj-gleft.t:hover { background: var(--bg-hover); }
.prj-gleft .cv { width: 10px; flex: none; color: var(--text-faint); font-size: 10px; }
.prj-gleft .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prj-gleft .nm.off { color: var(--text-muted); }
.prj-gleft .ct { flex: none; color: var(--text-faint); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
.prj-gleft i { width: 7px; height: 7px; border-radius: 999px; flex: none; border: 1.5px solid var(--border-strong); }
.prj-gleft i.ok { background: var(--ok-dot); border-color: var(--ok-dot); }
.prj-gleft i.warn { background: var(--warn-dot); border-color: var(--warn-dot); }
.prj-gleft i.bad { background: var(--bad-dot); border-color: var(--bad-dot); }
.prj-gleft .av {
  flex: none; width: 20px; height: 20px; border-radius: 999px; background: var(--surface-sunken);
  color: var(--text-muted); font-size: 8.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

.prj-gbar { position: absolute; top: 8px; height: 18px; border-radius: 4px; box-sizing: border-box; border: 1px solid transparent; }
.prj-gbar.done { background: color-mix(in oklab, var(--accent) 55%, var(--bg-alt)); }
.prj-gbar.progress { background: var(--accent-soft); border-color: var(--accent); }
.prj-gbar.open { background: var(--surface-sunken); border-color: var(--border-strong); }
.prj-gbar.late { background: color-mix(in oklab, var(--bad-dot) 16%, var(--bg-alt)); border-color: var(--bad-dot); }
.prj-gsum-bar { position: absolute; top: 13px; height: 4px; border-radius: 999px; background: var(--border-strong); overflow: hidden; }
.prj-gsum-bar i { display: block; height: 100%; background: var(--accent); }
.prj-glbl {
  position: absolute; top: 0; height: 34px; display: flex; align-items: center;
  font-size: 11.5px; white-space: nowrap; pointer-events: none; color: var(--text-faint);
}
.prj-glbl.warn { color: var(--warn); }
.prj-glbl.bad { color: var(--bad); }

@media (max-width: 1100px) {
  .prj-cols { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  /* Узкий экран: название занимает верхнюю строку целиком, под ним статус и
     срок по краям. Блок и исполнитель уходят - они дочитываются в карточке. */
  .prj-row { grid-template-columns: max-content max-content minmax(0, 1fr); row-gap: 4px; }
  .prj-row .ti { grid-column: 1 / -1; order: -1; white-space: normal; }
  .prj-row .bl, .prj-row .as { display: none; }
  /* Срок всегда в правом краю строки, даже когда рядом нет приоритета. */
  .prj-row .dt { grid-column: 3; text-align: right; }
  .prj-qa .h { display: none; }
  .prj-file { grid-template-columns: 40px minmax(0, 1fr) max-content; row-gap: 2px; }
  .prj-file .src { grid-column: 2 / -1; }
  .prj-file .dt { display: none; }
  .prj-find { width: 100%; }
  .prj-blk { grid-template-columns: minmax(0, 1fr) 64px 96px; }
  .prj-blk .bar { display: none; }
  /* На узком экране левой колонке графика хватает 150px: месяцы и полосы
     важнее длинного названия, а название дочитывается в карточке. */
  .prj-gleft { width: 150px; flex: 0 0 150px; padding: 0 10px; }
  .prj-gleft.t { padding-left: 20px; }
  .prj-gover { left: 150px; }
  .prj-gin { min-width: 560px; }
}

/* Просроченный срок в таблице: цвет плюс слово в подсказке, цветом одним не
   говорим. Без плашки - это дата, а не метка состояния. */
.rt2-late { color: var(--danger); font-weight: 600; font-variant-numeric: tabular-nums; }

/* Пояснение к статье, которую пока не ведут в CRM: откуда взялась цифра.
   Спокойная плашка на тонированной поверхности, без цветных полос и значков. */
.ovh-src { border: 1px solid var(--border); border-radius: var(--rt-md); padding: 13px 15px; background: var(--bg-hover); }
.ovh-src .t { font-size: 13px; font-weight: 600; letter-spacing: -.01em; }
.ovh-src .p { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin-top: 5px; max-width: 68ch; }
.ovh-src .a { display: inline-block; margin-top: 9px; font-size: 12.5px; color: var(--accent); text-decoration: none; }
.ovh-src .a:hover { text-decoration: underline; }

/* Окно «Объект продан»: тонкая карточка, воздух между смысловыми группами,
   одно главное действие. Ни теней-подушек, ни цветных полос. */
.objs-ov { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(15, 17, 21, .42); }
.objs-box { width: 100%; max-width: 470px; background: var(--bg-pane); border: 1px solid var(--border);
  border-radius: 14px; padding: 22px 24px 18px; box-sizing: border-box; }
.objs-h { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.objs-sub { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.45; }
.objs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }
.objs-ft { display: flex; gap: 8px; justify-content: flex-end; margin-top: 22px; }
.objs-pri { height: 32px; padding: 0 16px; border: 1px solid var(--accent); border-radius: var(--r-6);
  background: var(--accent); color: var(--accent-on); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.objs-pri:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
@media (max-width: 520px) { .objs-grid { grid-template-columns: 1fr; } }

/* Выбор порядка строк в панели списка: та же высота и тон, что у соседних
   кнопок, без собственной раскраски. */
.rt2-sel {
  height: 30px; padding: 0 26px 0 10px; border: 1px solid var(--border-strong); border-radius: var(--r-6);
  background: var(--field-bg); color: var(--text); font: inherit; font-size: 12px; cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 12px center, right 7px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.rt2-sel:hover { border-color: var(--text-faint); }
.rt2-sel:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }

/* Список записей внутри секции карточки (договоры КУ и всё, что придёт следом).
   Колонки задаёт сама секция через --cols: ширины - настройка блока, а не
   отдельный набор правил на каждый список. Строка тихая: шапка мелким
   капителем, волосяные разделители, действия проявляются под курсором. */
.objc-list { display: flex; flex-direction: column; }
.objc-lh, .objc-lr { display: grid; grid-template-columns: var(--cols); gap: 0 18px; align-items: center; }
.objc-lh {
  font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--text-faint);
  padding: 0 10px 7px; margin: 0 -10px; border-bottom: 1px solid var(--border);
}
.objc-lr {
  padding: 9px 10px; margin: 0 -10px; border-bottom: 1px solid var(--border);
  font-size: 13px; min-height: 38px; border-radius: var(--r-6);
}
.objc-lr:last-child { border-bottom: 0; }
.objc-lr:hover { background: var(--bg-hover); }
.objc-lr .k { font-weight: 600; letter-spacing: -.01em; }
.objc-lr .s { color: var(--text-muted); }
.objc-lr .n { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.objc-lr .k, .objc-lr .s, .objc-lr .n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.objc-lm { display: flex; align-items: center; gap: 8px; min-width: 0; }
.objc-acts { display: flex; gap: 2px; justify-content: flex-end; }
.objc-act {
  border: 0; background: none; padding: 3px 7px; border-radius: var(--r-6); cursor: pointer;
  font: inherit; font-size: 12px; color: var(--text-faint);
}
.objc-act:hover { background: var(--surface-hover); color: var(--accent); }
.objc-act.danger:hover { color: var(--danger); }
/* Мышь есть - действия не мозолят глаза; на тачскрине скрывать нечем. */
@media (hover: hover) {
  .objc-acts { opacity: 0; transition: opacity .12s ease-out; }
  .objc-lr:hover .objc-acts, .objc-lr:focus-within .objc-acts { opacity: 1; }
}
/* Метка состояния. Цвет только там, где состояние есть: обычный действующий
   договор молчит. */
.objc-tag { font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.objc-tag.warn { color: var(--warning); background: color-mix(in oklab, var(--warning) 14%, transparent); }
.objc-tag.acc { color: var(--accent); background: var(--accent-soft); }
.objc-tag.mute { color: var(--text-muted); background: var(--bg-hover); }
.objc-tag.ok { color: var(--ok); background: color-mix(in oklab, var(--ok-dot) 14%, transparent); }
.objc-tag.bad { color: var(--bad); background: color-mix(in oklab, var(--bad-dot) 14%, transparent); }
.objc-lr .soft, .objc-res .soft, .utp-body .soft { color: var(--text-faint); font-weight: 400; font-size: 12px; }
.objc-f-chk { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-muted); }

/* Блок «Ресурсы» карточки объекта (спека РСО 2.1). */
.objc-hint { max-width: 62ch; }
.objc-hint .t { font-weight: 600; font-size: 13px; }
.objc-hint .p { font-size: 12.5px; color: var(--text-muted); line-height: 1.5; margin-top: 3px; }
.objc-resform { display: flex; flex-direction: column; gap: 2px; }
.objc-res { display: grid; grid-template-columns: 180px 1fr; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border); }
.objc-res-h { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.objc-res-b { display: none; flex-wrap: wrap; gap: 8px; align-items: center; }
.objc-res.on .objc-res-b { display: flex; }
.objc-res:not(.on) .objc-res-h { color: var(--text-muted); font-weight: 500; }
.objc-meter { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 4px 1px 8px; border: 1px solid var(--border); border-radius: 999px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.objc-meter .x { border: 0; background: none; color: var(--text-faint); cursor: pointer; font-size: 13px; padding: 0 3px; line-height: 1; }
.objc-meter .x:hover { color: var(--bad); }
.objc-prolong { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 14px; font-size: 12.5px; color: var(--text-muted); }
.objc-prolong input { padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 12.5px; background: var(--bg-alt); color: var(--text); }

/* Карточка ресурсного договора в разделе. */
.utp-body { display: flex; flex-direction: column; gap: 22px; padding-top: 16px; }
.utp-sec { display: block; }
.utp-h { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.utp-h .n { font-weight: 500; color: var(--text-faint); }
.utp-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px 12px; }
.utp-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); min-width: 0; }
.utp-f input, .utp-f select { padding: 7px 9px; border: 1px solid var(--border); border-radius: var(--rt-md); font: inherit; font-size: 13px; background: var(--bg); color: var(--text); min-width: 0; }
.utp-f input:focus, .utp-f select:focus { outline: none; border-color: var(--accent); }
.utp-chk { flex-direction: row; align-items: center; gap: 6px; align-self: end; padding-bottom: 8px; }
.utp-pwd { display: flex; align-items: center; gap: 10px; padding-top: 6px; }
.utp-pwd code { font-size: 13px; }
.utp-acts { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.utp-lnk { border: 0; background: none; padding: 0; font: inherit; font-size: 12.5px; color: var(--accent); cursor: pointer; text-decoration: none; }
.utp-lnk:hover { text-decoration: underline; }
.utp-links { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; font-size: 12.5px; }
.utp-links a { color: var(--accent); text-decoration: none; }
.utp-links a:hover { text-decoration: underline; }
.utp-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.utp-sugg-b { border: 1px solid var(--border); background: var(--bg-alt); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--text); }
.utp-sugg-b:hover { border-color: var(--accent); }
.utp-sugg-b .n { color: var(--text-faint); margin-left: 4px; }
.utp-meters { display: flex; flex-wrap: wrap; gap: 4px; }
.utp-cform { display: flex; gap: 8px; margin-bottom: 12px; }
.utp-cform input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--rt-md); font: inherit; font-size: 13px; background: var(--bg); color: var(--text); }
.utp-c { padding: 8px 0; border-top: 1px solid var(--border); font-size: 13px; }
.utp-c .h { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.utp-c .tm { color: var(--text-faint); }
.utp-c .x { margin-left: auto; border: 0; background: none; color: var(--text-faint); cursor: pointer; }
.utp-c .x:hover { color: var(--bad); }
.utp-c .t { margin-top: 2px; line-height: 1.45; overflow-wrap: anywhere; }
.utp-c.sys .t { color: var(--text-muted); font-style: italic; }
/* «Продлить срок» (спека 2.2, docx 05.09.2026): кнопка под датой и всплывающая
   карточка истории сроков. Спокойная поверхность, тонкий бордер, один акцент. */
/* ── Комментарии в реестре: свёрнуто последний, стрелка открывает всё ─────
   Строка реестра держит одну высоту: полная переписка выходит карточкой
   поверх таблицы, у самой стрелки, - соседние строки не разъезжаются. */
.rt2-cm { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.rt2-cm-last {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text-soft);
}
.rt2-cm-x {
  flex: 0 0 auto; border: 1px solid transparent; background: none; border-radius: var(--r-6, 6px);
  padding: 1px 3px; color: var(--text-faint); cursor: pointer; line-height: 1;
}
.rt2-cm-x svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; display: block; transition: transform .15s ease; }
.rt2-cm-x:hover { color: var(--accent); border-color: var(--border); }
.rt2-cm-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.rt2-cm-x.on { color: var(--accent); border-color: var(--border); }
.rt2-cm-x.on svg { transform: rotate(180deg); }
.rt2-cm-pop {
  position: fixed; z-index: 1200; width: min(380px, calc(100vw - 16px));
  max-height: min(360px, calc(100vh - 32px)); overflow: auto;
  display: flex; flex-direction: column; gap: 8px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--rt-lg);
  box-shadow: var(--shadow-pop); padding: 10px 12px; font-size: 12.5px; color: var(--text);
}
.rt2-cm-pt { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.rt2-cm-item { color: var(--text); white-space: normal; }
.rt2-cm-item .d { display: block; font-size: 10.5px; color: var(--text-faint); margin-bottom: 1px; }

/* ── Выбор значения всплывашкой (статус договора) ─────────────────────────
   Тот же приём, что у переписки: список выходит поверх таблицы, строка
   остаётся на месте. Выбранное подсвечено, сохраняем отдельной кнопкой. */
.rt2-vpick {
  position: fixed; z-index: 1200; width: min(260px, calc(100vw - 16px));
  display: flex; flex-direction: column; gap: 2px;
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--rt-lg);
  box-shadow: var(--shadow-pop); padding: 8px; font-size: 12.5px; color: var(--text);
}
.rt2-vpick.busy { opacity: .6; pointer-events: none; }
.rt2-vpick-t { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); padding: 2px 4px 4px; }
.rt2-vpick-i {
  display: flex; align-items: center; text-align: left; gap: 6px; width: 100%;
  border: 1px solid transparent; border-radius: var(--r-6, 6px); background: none;
  padding: 4px 6px; font: inherit; cursor: pointer;
}
.rt2-vpick-i:hover { background: var(--bg-hover); }
.rt2-vpick-i.on { border-color: var(--accent); background: var(--bg-hover); }
.rt2-vpick-f { display: flex; gap: 6px; padding-top: 6px; margin-top: 4px; border-top: 1px solid var(--border); }
.rt2-vpick-f button {
  flex: 1; border: 1px solid var(--border); border-radius: var(--r-6, 6px); background: var(--bg);
  padding: 5px 8px; font: inherit; font-size: 12px; color: var(--text-muted); cursor: pointer;
}
.rt2-vpick-f button.pri { border-color: var(--accent); background: var(--accent); color: #fff; }
.rt2-vpick-f button:hover { border-color: var(--accent); color: var(--accent); }
.rt2-vpick-f button.pri:hover { color: #fff; filter: brightness(1.05); }

/* ── Правка прямо в клетке реестра (номер договора) ──────────────────────
   Карандаш тихий и появляется на наведении: в таблице на 300 строк постоянно
   видимые кнопки шумят сильнее, чем помогают. У пустой клетки он виден всегда -
   иначе там просто не за что взяться. */
.rt2-editcell { display: flex; align-items: flex-start; gap: 6px; min-height: 18px; }
.rt2-editcell .rt2-clamp { flex: 1; min-width: 0; }
.rt2-pen {
  flex: 0 0 auto; border: 1px solid transparent; background: none; border-radius: var(--r-6, 6px);
  padding: 1px 4px; color: var(--text-faint); cursor: pointer; opacity: 0; transition: opacity .12s ease;
}
.rt2-pen svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; display: block; }
.rt2-pen.bare { opacity: .45; }
tr:hover .rt2-pen, .rt2-editcell:hover .rt2-pen { opacity: 1; }
.rt2-pen:hover { color: var(--accent); border-color: var(--border); }
.rt2-pen:focus-visible { opacity: 1; outline: 2px solid var(--accent); outline-offset: 1px; }
.rt2-editcell.editing { flex-direction: column; gap: 4px; }
.rt2-editcell.busy { opacity: .6; pointer-events: none; }
.rt2-editcell input {
  width: 100%; box-sizing: border-box; height: 24px; padding: 0 6px; font: inherit; font-size: 12px;
  border: 1px solid var(--border); border-radius: var(--r-6, 6px); background: var(--bg); color: var(--text);
}
.rt2-editcell input:focus { outline: none; border-color: var(--accent); }
/* Тот же ввод, но списком: статус меняется прямо в строке реестра. */
.rt2-editcell select {
  width: 100%; box-sizing: border-box; height: 24px; padding: 0 4px; font: inherit; font-size: 12px;
  border: 1px solid var(--border); border-radius: var(--r-6, 6px); background: var(--bg); color: var(--text);
}
.rt2-editcell select:focus { outline: none; border-color: var(--accent); }
.rt2-editacts { display: inline-flex; gap: 4px; }
.rt2-editacts button {
  border: 1px solid var(--border); background: var(--bg); border-radius: var(--r-6, 6px);
  padding: 2px 8px; font-size: 11px; color: var(--text-muted); cursor: pointer;
}
.rt2-editacts button.ok { border-color: var(--accent); color: var(--accent); }
.rt2-editacts button:hover { border-color: var(--accent); color: var(--accent); }

.utd-btn { display: inline-block; margin-top: 3px; border: 0; background: none; padding: 0; font: inherit; font-size: 11px; color: var(--accent); cursor: pointer; }
.utd-btn:hover { text-decoration: underline; }
.utd-pop { position: fixed; z-index: 1200; width: min(380px, calc(100vw - 16px)); background: var(--bg-alt); border: 1px solid var(--border); border-radius: var(--rt-lg); box-shadow: var(--shadow-pop); padding: 14px 16px 12px; font-size: 12.5px; color: var(--text); }
.utd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.utd-kicker { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-muted); }
.utd-addr { font-size: 12px; color: var(--text-soft); margin-top: 2px; }
.utd-now { font-size: 14px; margin-bottom: 12px; }
.utd-now b { font-weight: 600; }
.utd-acts { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.utd-a { color: var(--accent); text-decoration: none; font-size: 12.5px; }
.utd-a:hover { text-decoration: underline; }
.utd-row { display: flex; align-items: flex-end; gap: 8px; margin: 0; }
.utd-row label { display: flex; flex-direction: column; gap: 3px; flex: 1; font-size: 11.5px; color: var(--text-muted); }
.utd-row input { padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--rt-md); font: inherit; font-size: 13px; background: var(--bg); color: var(--text); }
.utd-row input:focus { outline: none; border-color: var(--accent); }
.utd-hist { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.utd-ev { display: grid; grid-template-columns: max-content minmax(0, 1fr) max-content; gap: 8px; align-items: baseline; font-size: 12px; }
.utd-when { color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
.utd-x { border: 0; background: none; color: var(--text-faint); cursor: pointer; font-size: 14px; line-height: 1; padding: 0 2px; }
.utd-x:hover { color: var(--danger); }
.utd-line { margin-top: 8px; font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.utd-line .utd-btn { font-size: 12.5px; margin: 0; }
.rt2-sub { font-size: 10.5px; color: var(--text-faint); line-height: 1.2; white-space: normal; }
@media (max-width: 720px) {
  .objc-lh { display: none; }
  .objc-lr { grid-template-columns: minmax(0, 1fr) max-content; row-gap: 3px; }
  .objc-lr .s, .objc-lr .n, .objc-lm { grid-column: 1; white-space: normal; }
  .objc-acts { grid-column: 2; grid-row: 1 / span 2; opacity: 1; }
}

/* «Что нового» - одноразовая подсказка о новых возможностях. Спокойно, по
   контексту: тонкая карточка, один индиго-акцент, воздух, мягкое появление. */
#whatsnew { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
#whatsnew .wn-backdrop { position: absolute; inset: 0; background: rgba(15, 17, 21, .42); backdrop-filter: blur(2px); }
/* Фон берём из корневого токена --bg-pane (непрозрачный, есть и в светлой, и в
   тёмной теме). --surface живёт только внутри модулей задач/почты, а это окно
   висит на body - там его нет, и карточка получалась прозрачной (msg 2366). */
#whatsnew .wn-card { position: relative; width: 100%; max-width: 500px; background: var(--bg-pane); border: 1px solid var(--border);
  border-radius: 16px; padding: 26px 28px 22px; box-shadow: 0 12px 40px -14px rgba(15, 17, 21, .28);
  animation: wnIn .32s cubic-bezier(.16, .84, .44, 1) both; }
#whatsnew.wn-closing .wn-card { animation: wnOut .16s ease-in both; }
#whatsnew.wn-closing .wn-backdrop { opacity: 0; transition: opacity .16s; }
#whatsnew .wn-x { position: absolute; top: 14px; right: 14px; width: 28px; height: 28px; border: 0; background: transparent;
  color: var(--text-faint); font-size: 20px; line-height: 1; border-radius: 8px; cursor: pointer; transition: background .12s, color .12s; }
#whatsnew .wn-x:hover { background: var(--bg-hover); color: var(--text); }
#whatsnew .wn-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
#whatsnew .wn-title { margin: 8px 0 0; font-size: 20px; font-weight: 650; letter-spacing: -.02em; color: var(--text); }
#whatsnew .wn-sub { margin: 6px 0 0; font-size: 13px; color: var(--text-muted); }
#whatsnew .wn-list { list-style: none; margin: 20px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
#whatsnew .wn-item { display: flex; gap: 12px; align-items: flex-start; animation: wnItem .34s ease-out both; }
#whatsnew .wn-dot { flex: 0 0 7px; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--accent); }
#whatsnew .wn-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
#whatsnew .wn-t { font-size: 14px; font-weight: 600; color: var(--text); }
#whatsnew .wn-d { font-size: 12.5px; line-height: 1.45; color: var(--text-muted); }
#whatsnew .wn-foot { margin-top: 24px; display: flex; justify-content: flex-end; }
#whatsnew .wn-ok { height: 36px; padding: 0 18px; border: 0; border-radius: 9px; background: var(--accent); color: #fff;
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: filter .12s; }
#whatsnew .wn-ok:hover { filter: brightness(1.06); }
@keyframes wnIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes wnOut { to { opacity: 0; transform: translateY(6px); } }
@keyframes wnItem { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
