/* Перенесено из lk/mockup/assets/lk.css командой php bin/sync-assets.php — здесь не править. */
/* ЛК sogl.ru — канон стилей (этап 0, мокапы).
   Источник токенов: style.css темы soglasie (Gotham Pro, зелёный #1a7d2f, серо-зелёные нейтрали, радиус 5px).
   Этот файл переносится в продакшен 1:1. Классы с префиксом .mock- — только для мокапов, в продакшен не переносятся. */

@font-face { font-family: "Gotham Pro"; src: url("fonts/gp.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Gotham Pro"; src: url("fonts/gpm.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Gotham Pro"; src: url("fonts/gpb.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* Бренд */
  --accent: #1a7d2f;
  --accent-hover: #156a27;
  --accent-press: #115a20;
  --accent-soft: #e7f2e9;
  --accent-line: #b9dcc0;
  --mint: #3ec396;

  /* Нейтрали (серо-зелёные, как на сайте) */
  --ink: #2f3a32;
  --ink-2: #56625a;
  --ink-3: #7c887f;
  --icon: #8d988f;
  --line: #e1e6e2;
  --line-strong: #cdd4cf;
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #f9faf9;

  /* Состояния */
  --danger: #c0392b;
  --danger-soft: #fbeceA;
  --warn: #9a5b00;
  --warn-soft: #fdf2df;
  --info: #2c6a8f;
  --info-soft: #e8f1f7;

  /* Форма */
  --r-sm: 5px;
  --r-md: 8px;
  --r-lg: 12px;
  --shadow-1: 0 1px 2px rgba(31, 52, 37, .06);
  --shadow-2: 0 8px 24px -12px rgba(31, 52, 37, .28);
  --shadow-3: 0 24px 60px -24px rgba(31, 52, 37, .45);
  --focus: 0 0 0 3px rgba(26, 125, 47, .22);

  /* Размеры */
  --header-h: 60px;
  --mbar-h: 52px;
  --app-h: 100dvh;
  --font: "Gotham Pro", "Segoe UI", Arial, sans-serif;

  /* Курсоры доски: открытая ладонь — можно тянуть, зелёный кулак — тянем. Из иконок Tabler hand-stop / hand-grab (MIT): 22 px, белая заливка, контур 0.5 px — как системная рука Windows. */
  --cur-grab: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='-0.5 -0.5 25 25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg fill='%23fff' stroke='%23fff' stroke-width='1.2'%3E%3Cpath d='M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5'/%3E%3Cpath d='M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5'/%3E%3Cpath d='M14 5.5a1.5 1.5 0 0 1 3 0v6.5'/%3E%3Cpath d='M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47'/%3E%3C/g%3E%3Cg fill='none' stroke='%231f2421' stroke-width='0.6'%3E%3Cpath d='M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5'/%3E%3Cpath d='M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5'/%3E%3Cpath d='M14 5.5a1.5 1.5 0 0 1 3 0v6.5'/%3E%3Cpath d='M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47'/%3E%3C/g%3E%3C/svg%3E") 11 11, grab;
  --cur-grabbing: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' viewBox='-0.5 -0.5 25 25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cg fill='%23fff' stroke='%23fff' stroke-width='1.2'%3E%3Cpath d='M8 11v-3.5a1.5 1.5 0 0 1 3 0v2.5'/%3E%3Cpath d='M11 9.5v-3a1.5 1.5 0 0 1 3 0v3.5'/%3E%3Cpath d='M14 7.5a1.5 1.5 0 0 1 3 0v2.5'/%3E%3Cpath d='M17 9.5a1.5 1.5 0 0 1 3 0v4.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7l-.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47'/%3E%3C/g%3E%3Cg fill='none' stroke='%231a7d2f' stroke-width='0.6'%3E%3Cpath d='M8 11v-3.5a1.5 1.5 0 0 1 3 0v2.5'/%3E%3Cpath d='M11 9.5v-3a1.5 1.5 0 0 1 3 0v3.5'/%3E%3Cpath d='M14 7.5a1.5 1.5 0 0 1 3 0v2.5'/%3E%3Cpath d='M17 9.5a1.5 1.5 0 0 1 3 0v4.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7l-.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47'/%3E%3C/g%3E%3C/svg%3E") 11 11, grabbing;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 14px/1.45 var(--font); letter-spacing: .005em;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
h1, h2, h3, h4 { margin: 0; font-weight: 700; color: var(--ink); letter-spacing: 0; }
h1 { font-size: 22px; line-height: 1.25; }
h2 { font-size: 18px; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.35; font-weight: 500; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Иконки (спрайт Tabler из assets/icons.js) */
.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
.i-sm { width: 15px; height: 15px; vertical-align: -3px; }
.i-lg { width: 22px; height: 22px; }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 500; font-size: 14px; white-space: nowrap; cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
}
.btn:hover { border-color: var(--icon); }
.btn:active { transform: translateY(1px); }
.btn .i { color: var(--icon); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary .i { color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-primary:active { background: var(--accent-press); }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.btn-soft .i { color: var(--accent); }
.btn-soft:hover { border-color: var(--accent-line); color: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg); border-color: transparent; color: var(--ink); }
.btn-danger { background: var(--surface); border-color: #e7b9b3; color: var(--danger); }
.btn-danger .i { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .5; pointer-events: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; position: relative;
  width: 38px; height: 38px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: transparent; color: var(--ink-2); cursor: pointer; transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn.bordered { border-color: var(--line-strong); background: var(--surface); }
.icon-btn-sm { width: 30px; height: 30px; }

/* ---------- Поля ---------- */
.field { display: grid; gap: 6px; }
.field > label, .field-label { font-size: 13px; font-weight: 500; color: var(--ink); }
.field .hint { font-size: 12.5px; color: var(--ink-2); }
.field .error { font-size: 12.5px; color: var(--danger); display: flex; gap: 6px; align-items: center; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--icon); }
/* Фокус поля — одна зелёная рамка, без второго кольца */
.input:focus, .select:focus, .textarea:focus, .input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: none; }
.input.is-invalid, .select.is-invalid { border-color: var(--danger); }
.input[readonly], .input:disabled { background: var(--surface-2); color: var(--ink-2); }
.select { appearance: none; padding-right: 36px; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c887f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6l6 -6'/%3E%3C/svg%3E") no-repeat right 12px center; }
.input-icon { position: relative; }
.input-icon > .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--icon); pointer-events: none; }
.input-icon > .input { padding-left: 38px; }
/* Поиск: браузерный крестик и оформление скрыты, вместо них — свой крестик в стиле ЛК */
input[type="search"] { -webkit-appearance: none; appearance: none; }
input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.input-icon > .input:has(~ .input-clear) { padding-right: 40px; }
.input-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--icon); cursor: pointer; transition: background .15s ease, color .15s ease; }
.input-clear:hover { background: var(--bg); color: var(--ink); }
.input-clear .i { vertical-align: 0; }
.input-affix { display: flex; }
.input-affix .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
/* Боковая секция поля (₽, календарь, «+», часы): одна ширина 44 px, своя рамка, серый фон, разделитель слева */
.input-affix .affix, .input-trigger, .multi .multi-add { width: 44px; flex: none; display: flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 0 var(--r-sm) var(--r-sm) 0; background: var(--surface-2); color: var(--ink-2); }
.input-affix .affix { border-left: 0; }
.input-affix:focus-within .input, .input-affix:focus-within .affix { border-color: var(--accent); }
.check { display: flex; gap: 10px; align-items: center; min-height: 32px; cursor: pointer; }
.check input { flex: none; width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }
.multi { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; min-height: 40px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); align-items: center; }
.multi .tag { height: 26px; }
.multi-x { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-right: -4px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--icon); cursor: pointer; }
.multi-x:hover { background: var(--line); color: var(--ink); }
.multi-x .i { vertical-align: 0; }

/* Сегментированный переключатель */
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-sm); background: var(--bg); border: 1px solid var(--line); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 4px; background: transparent; color: var(--ink-2); font-weight: 500; font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg-icons button { width: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.seg-icons button[aria-pressed="true"] .i { color: var(--accent); }

/* ---------- Счётчики, метки, теги ---------- */
/* Капсула .chip — только для счётчиков (красное число на кнопке). Ярлыки-капсулы с заливкой не используем. */
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--bg); color: var(--ink-2); }
.chip .i { width: 13px; height: 13px; vertical-align: 0; }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
/* Метка — ярлык без капсулы: значок + цветной текст, как статусы задач (.task-st). Цвет — смысл, не украшение. */
.mark { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; line-height: 1.3; color: var(--ink-2); white-space: nowrap; }
.mark .i { width: 15px; height: 15px; vertical-align: 0; color: var(--icon); }
.mark.is-info, .mark.is-info .i { color: var(--info); }
.mark.is-accent, .mark.is-accent .i { color: var(--accent); }
.mark.is-warn, .mark.is-warn .i { color: var(--warn); }
.mark.is-muted { color: var(--ink-3); font-weight: 400; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 4px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink); }
/* Точка «есть новое» на кнопке меню (телефон). Всё «новое» — красное, как счётчики */
.dot-new { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.badge { position: absolute; top: 4px; left: 50%; margin-left: 1px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 17px; text-align: center; border: 2px solid var(--surface); box-sizing: content-box; }
.count { color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; flex: none; }
.avatar-sm { width: 22px; height: 22px; font-size: 10px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Панели ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 16px; }

/* ---------- Каркас приложения ---------- */
.app { min-height: var(--app-h); display: flex; flex-direction: column; }
.app.is-fixed { height: var(--app-h); } /* экран воронки: страница не прокручивается, прокручиваются колонки */
.header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  display: flex; align-items: center; gap: 8px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.header-logo { display: flex; align-items: center; margin-right: 12px; flex: none; }
.header-logo img { height: 30px; width: auto; display: block; }
.nav { display: flex; align-items: center; gap: 2px; min-width: 0; }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-weight: 500; white-space: nowrap; position: relative;
}
.nav-link .i { color: var(--icon); }
.nav-link:hover { background: var(--bg); color: var(--ink); }
.nav-link[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav-link[aria-current="page"] .i { color: var(--accent); }
.nav-sep { width: 1px; height: 24px; background: var(--line); margin: 0 6px; flex: none; }
.nav-funnels { display: flex; align-items: center; gap: 2px; padding-left: 6px; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 5px; border-radius: 999px; color: var(--ink); font-weight: 500; }


.main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.toolbar { display: flex; align-items: center; gap: 12px; padding: 16px 20px 12px; flex-wrap: wrap; }
.toolbar-title { margin-right: 4px; white-space: nowrap; }
.toolbar-search { flex: 1 1 240px; min-width: 0; }
.btn-icon { width: 38px; padding: 0; flex: none; }
.btn-icon .i { width: 20px; height: 20px; }

/* Мобильная верхняя панель и выезжающее меню */
.mbar { display: none; }
.drawer, .scrim { display: none; }

/* ---------- Прокрутка в стиле сайта: тонкий ползунок, проявляется при наведении ---------- */
/* Chrome/Edge/Safari: только ::-webkit-scrollbar — тонкая линия без стрелок. Стандартные scrollbar-width/scrollbar-color
   здесь НЕ задаём: в Chrome они отключают webkit-стиль, и Windows рисует полосу со стрелками. Они — только для Firefox. */
.scroll-y { scrollbar-gutter: stable; }
@supports not selector(::-webkit-scrollbar) {
  .scroll-y { scrollbar-width: thin; scrollbar-color: transparent transparent; }
  .scroll-y:hover, .scroll-y:focus-within { scrollbar-color: var(--line-strong) transparent; }
}
.scroll-y::-webkit-scrollbar { width: 6px; height: 6px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }
.scroll-y::-webkit-scrollbar-thumb { background: transparent; border-radius: 999px; }
.scroll-y:hover::-webkit-scrollbar-thumb { background: var(--line-strong); }
.scroll-y::-webkit-scrollbar-thumb:hover { background: var(--icon); }
.scroll-y::-webkit-scrollbar-button, .scroll-y::-webkit-scrollbar-corner { display: none; height: 0; width: 0; background: transparent; }

/* ---------- Воронка: канбан ---------- */
.board-wrap { flex: 1; min-height: 0; overflow-x: auto; overflow-y: hidden; padding: 0 20px 20px; scrollbar-width: none; cursor: var(--cur-grab); }
.board-wrap::-webkit-scrollbar { display: none; }  /* горизонтальную прокрутку заменяет мини-карта */
.board-wrap.is-panning, .board-wrap.is-panning * { cursor: var(--cur-grabbing) !important; user-select: none; }
.board-wrap .tile { cursor: pointer; }

/* Мини-карта воронки (десктоп): колонки в уменьшенном виде, рамка — видимая часть */
.minimap { position: fixed; right: 20px; bottom: 20px; z-index: 40; padding: 6px; border-radius: var(--r-md); background: rgba(255, 255, 255, .92); border: 1px solid var(--line); box-shadow: var(--shadow-2); backdrop-filter: blur(6px); }
.minimap-track { position: relative; height: 34px; cursor: pointer; }
.minimap-track.is-drag, .minimap-track.is-drag * { cursor: var(--cur-grabbing) !important; }
.minimap-col { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: #e6eae7; border-top: 3px solid var(--stage); }
.minimap-view { position: absolute; top: -3px; bottom: -3px; border-radius: 5px; border: 2px solid var(--accent); background: rgba(26, 125, 47, .08); cursor: var(--cur-grab); transition: left .08s linear; }
.minimap-view.is-drag { cursor: var(--cur-grabbing); transition: none; }
@media (prefers-reduced-transparency: reduce) { .minimap { background: var(--surface); backdrop-filter: none; } }
.board { display: flex; gap: 12px; height: 100%; align-items: stretch; width: max-content; min-width: 100%; } /* по ширине колонок — иначе правый отступ .board-wrap не попадает в прокрутку */
.col { flex: 0 0 288px; display: flex; flex-direction: column; min-height: 0; background: #eef1ef; border-radius: var(--r-md); } /* колонка во всю высоту: пустое место под плитками — тоже зона сброса */
.col-head { padding: 12px 12px 10px; border-top: 3px solid var(--stage, var(--accent)); border-radius: var(--r-md) var(--r-md) 0 0; }
.col-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink); }
.col-sub { margin-top: 2px; font-size: 12px; color: var(--ink-2); }
.col-body { flex: 1; padding: 4px 4px 8px 8px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 80px; overscroll-behavior: contain; }
.col.is-over { background: var(--accent-soft); outline: 2px dashed var(--accent-line); outline-offset: -2px; }
.col-empty { padding: 18px 8px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

.tile {
  display: block; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 10px 12px; color: var(--ink); box-shadow: var(--shadow-1); cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.tile:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); color: var(--ink); }
.tile-link { color: var(--ink); }
.tile-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; } /* вся плитка кликабельна */
.tile-link:hover { color: var(--ink); }
.tile-link:focus-visible { box-shadow: none; }
.tile-link:focus-visible::after { box-shadow: var(--focus); }
.tile .chip, .tile .tile-share { position: relative; z-index: 1; }
.tile.is-dragging { opacity: .45; }
.tile-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tile-title { font-weight: 500; font-size: 14px; line-height: 1.3; color: var(--ink); }
.tile-share { flex: none; color: var(--icon); margin-top: 1px; }
.tile-share.is-new { color: var(--danger); } /* новая: передали или назначили, ещё не открывали */
.tile-sum { margin-top: 4px; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-owner { color: var(--ink-3); }
.tile-fields { margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.tile-foot { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile-days { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile-days.is-stale { color: var(--warn); font-weight: 500; }
/* Статус задач — цветной текст, без капсул */
.task-st { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.task-st .i { color: currentColor; vertical-align: 0; }
.task-st:not(.is-overdue):not(.is-today) .i { color: var(--icon); }
.task-st.is-overdue { color: var(--danger); }
.task-st.is-today { color: var(--warn); }
.task-st.is-none { color: var(--ink-3); font-weight: 400; }

/* Заявка без ответственного */
.tile-lead { border-color: var(--accent-line); background: linear-gradient(0deg, var(--surface), var(--surface)) padding-box; box-shadow: inset 3px 0 0 var(--accent), var(--shadow-1); cursor: default; }
.tile-lead:hover { box-shadow: inset 3px 0 0 var(--accent), var(--shadow-2); }
.tile-lead .tile-kicker { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--accent); font-weight: 500; }
a.tile-kicker:hover { color: var(--accent-hover); text-decoration: underline; }
.tile-lead-time { margin: 2px 0 0 21px; font-size: 12.5px; color: var(--ink-2); } /* под текстом, с отступом на ширину значка */
.lead-title { display: inline-flex; align-items: center; gap: 6px; color: var(--accent); }
.tile-lead .btn { margin-top: 10px; }

/* ---------- Воронка: список ---------- */
.list-wrap { padding: 0 20px 20px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.table th { text-align: left; font-size: 12.5px; font-weight: 500; color: var(--ink-3); padding: 18px 18px 14px; background: var(--surface); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
/* Сортировка по колонке: щелчок по заголовку — по возрастанию (зелёная стрелка вверх), повторный — по убыванию (вниз) */
.th-sort { display: inline-flex; align-items: center; gap: 6px; margin: -6px -8px; padding: 6px 8px; border: 0; border-radius: var(--r-sm); background: none; color: inherit; font: inherit; cursor: pointer; transition: background .15s ease, color .15s ease; }
.th-sort .i { color: var(--line-strong); transition: color .15s ease; }
.th-sort:hover { background: var(--bg); color: var(--ink); }
.th-sort:hover .i { color: var(--icon); }
.table th[aria-sort="ascending"] .th-sort, .table th[aria-sort="descending"] .th-sort { color: var(--ink); }
/* Ведущая стрелка — зелёная, вторая — бледная */
.table th[aria-sort="ascending"] .th-sort .i { --sort-up: var(--accent); --sort-down: var(--line-strong); }
.table th[aria-sort="descending"] .th-sort .i { --sort-up: var(--line-strong); --sort-down: var(--accent); }
.list-sort { display: none; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .t-title { font-weight: 500; }
.table td.is-stale { color: var(--warn); font-weight: 500; white-space: nowrap; }
.table .tile-share { color: var(--icon); vertical-align: -1px; margin-left: 4px; }
.table .tile-share.is-new { color: var(--danger); }
.stage-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.stage-pill .dot { color: var(--stage); }

/* ---------- Лента карточки (центральная зона) ---------- */
.feed { display: grid; gap: 14px; }
.feed-day { text-align: center; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.feed-event { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; }
.feed-ico { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg); color: var(--ink-2); }
.feed-ico .i { width: 15px; height: 15px; vertical-align: 0; }
.feed-text { font-size: 13.5px; color: var(--ink-2); padding-top: 4px; }
.feed-text b { font-weight: 500; color: var(--ink); }
.feed-time { font-size: 12px; color: var(--ink-3); margin-left: 6px; white-space: nowrap; }
/* Сообщения в ленте — как в мессенджере: чужие слева с аватаром и именем, свои справа на зелёном */
.feed-note { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; align-items: end; }
.feed-bubble { justify-self: start; max-width: min(560px, 88%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) var(--r-lg) 4px; padding: 8px 12px 9px; box-shadow: var(--shadow-1); }
.feed-bubble-head { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; margin-bottom: 2px; }
.feed-bubble-head b { font-weight: 500; color: var(--accent); }
.feed-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-note.is-mine { grid-template-columns: minmax(0, 1fr); }
.feed-note.is-mine > .avatar { display: none; }
.feed-note.is-mine .feed-bubble { justify-self: end; background: var(--accent-soft); border-color: var(--accent-line); border-radius: var(--r-lg) var(--r-lg) 4px var(--r-lg); }
.feed-note.is-mine .feed-bubble-head { justify-content: flex-end; }
.feed-note.is-mine .feed-bubble-head b { display: none; }
/* События — нейтральные строки, не похожие на сообщения */
.feed-event .feed-text { font-size: 13px; }

/* ---------- Нижний лист (телефон) / поповер (десктоп) ---------- */
.sheet-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(20, 34, 24, .42); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.sheet-scrim.is-open { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed; z-index: 91; left: 50%; top: 50%; width: min(420px, calc(100vw - 32px)); max-height: 80vh; overflow: auto;
  transform: translate(-50%, -48%) scale(.98); opacity: 0; pointer-events: none;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3); transition: opacity .18s ease, transform .18s ease;
}
.sheet.is-open { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
.sheet:focus { outline: none; box-shadow: var(--shadow-3); }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px; background: var(--surface); border-bottom: 1px solid var(--line); }
.sheet-body { padding: 8px; }
.sheet-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; cursor: pointer; color: var(--ink); }
.menu-item:hover { background: var(--bg); }
.menu-item .dot { color: var(--stage); }
.menu-item[aria-current="true"] { color: var(--accent); font-weight: 500; }
.menu-item[aria-current="true"]::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ---------- Тосты ---------- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; z-index: 100; display: grid; gap: 8px; padding-bottom: env(safe-area-inset-bottom); }
.toast { display: flex; gap: 10px; align-items: flex-start; min-width: 280px; max-width: 380px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); box-shadow: var(--shadow-2); animation: toast-in .25s cubic-bezier(.22, 1, .36, 1); }
.toast .i { color: var(--accent); margin-top: 1px; }
.toast.is-danger { border-left-color: var(--danger); }
.toast.is-danger .i { color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Состояния ---------- */
.empty { display: grid; justify-items: center; gap: 8px; padding: 40px 24px; text-align: center; color: var(--ink-2); }
.empty > .i { width: 40px; height: 40px; color: var(--icon); stroke-width: 1.4; }
.empty-title { font-weight: 500; color: var(--ink); font-size: 15px; }
.empty-text { max-width: 340px; font-size: 13px; }
.skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, #eceff0 25%, #f6f8f7 37%, #eceff0 63%); background-size: 400% 100%; animation: sk 1.4s ease-in-out infinite; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--info-soft); color: var(--info); font-size: 13px; }
.alert.is-danger { background: var(--danger-soft); color: var(--danger); }
.alert.is-warn { background: var(--warn-soft); color: var(--warn); }
.alert .i { margin-top: 1px; }

/* ---------- Мокап-панель (только для мокапов) ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =========================================================
   Адаптивность (канон 360: >1180 десктоп, 768–1180 планшет, ≤768 телефон, ≤480 узкий)
   ========================================================= */
@media (max-width: 1280px) {
  .nav-link { padding: 0 10px; }
  .user-chip .user-name { display: none; }
  .user-chip { padding: 0 5px; }
}
@media (max-width: 1180px) {
  .nav-link .nav-text-opt { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* подпись остаётся для экранных читалок */
}

@media (max-width: 900px) {
  :root { --header-h: var(--mbar-h); }
  .header { display: none; }
  .mbar {
    display: flex; align-items: center; gap: 6px; position: sticky; top: 0; z-index: 60;
    height: calc(var(--mbar-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .mbar-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ink); font-weight: 700; font-size: 16px; text-align: left; cursor: pointer; }
  .mbar-title span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mbar-title .i { color: var(--icon); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(20, 34, 24, .42); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
  .drawer {
    display: flex; flex-direction: column; position: fixed; z-index: 71; top: 0; bottom: 0; left: 0; width: min(320px, 86vw);
    padding: calc(12px + env(safe-area-inset-top)) 12px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface); transform: translateX(-100%); transition: transform .24s cubic-bezier(.22, 1, .36, 1); overflow-y: auto;
  }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .app.drawer-open .drawer { transform: none; box-shadow: var(--shadow-3); }
  .drawer-logo { height: 28px; margin: 4px 8px 16px; align-self: flex-start; }
  .drawer-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); margin-bottom: 12px; }
  .drawer-user .avatar { width: 36px; height: 36px; font-size: 13px; }
  .drawer-sep { height: 1px; background: var(--line); margin: 10px 4px; }
  .drawer-group { font-size: 11.5px; font-weight: 500; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 14px 10px 6px; }
  .drawer .nav-link { height: 44px; width: 100%; }
  .drawer-bottom { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 2px; }

  .toolbar { padding: 12px 12px 8px; gap: 8px; }
  .toolbar-title { display: none; }
  .toolbar-search { flex: 1 1 0; max-width: none; }
  .btn-icon { width: 44px; }
  .board-wrap, .list-wrap { padding-left: 12px; padding-right: 12px; }
}

@media (max-width: 768px) {
  body { font-size: 15px; }
  .input, .select, .textarea { font-size: 16px; height: 44px; } /* 16px — без автозума iOS */
  .input-clear { width: 36px; height: 36px; right: 4px; }
  .btn { height: 44px; }
  .btn-sm { height: 36px; }
  .icon-btn { width: 44px; height: 44px; }
  .icon-btn-sm { width: 36px; height: 36px; }
  .toolbar .seg-owner { order: 3; width: 100%; }
  .toolbar .seg-owner button { flex: 1; }
  .seg-icons button { height: 36px; width: 40px; }

  /* Канбан: одна колонка на экран, чипы колонок сверху */
  .stage-chips { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px 10px; scrollbar-width: none; scroll-snap-type: x proximity; }
  .stage-chips::-webkit-scrollbar { display: none; }
  .stage-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font-weight: 500; font-size: 13px; scroll-snap-align: start; cursor: pointer; white-space: nowrap; }
  .stage-chip .dot { color: var(--stage); }
  .stage-chip[aria-current="true"] { border-color: var(--ink); color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--ink); }
  .board-wrap { padding: 0; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; cursor: auto; }
  .minimap { display: none; }
  .board-wrap::-webkit-scrollbar { display: none; }
  .app.is-fixed { height: auto; }
  .board { gap: 0; height: auto; align-items: flex-start; width: auto; min-width: 0; }
  .col { flex: 0 0 100%; max-height: none; background: transparent; scroll-snap-align: start; padding: 0 12px; }
  .col-head { display: none; }
  .col-body { padding: 0 0 calc(24px + env(safe-area-inset-bottom)); overflow: visible; scrollbar-gutter: auto; }
  .tile { padding: 12px 14px; }

  /* Список → стопка карточек */
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table { background: transparent; border: 0; }
  .table thead { display: none; }
  .list-sort { display: block; margin-bottom: 10px; }
  .table tbody { display: grid; gap: 8px; }
  .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 10px 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .table td { padding: 0; border: 0; }
  .table td[data-m="title"], .table td[data-m="wide"] { grid-column: 1 / -1; font-size: 15px; }
  .table td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--ink-3); margin-bottom: 2px; }
  .table tbody tr:hover td { background: transparent; }

  /* Модалки и листы → нижний лист */
  .sheet { left: 0; right: 0; top: auto; bottom: 0; width: 100%; max-height: 85vh; border-radius: var(--r-lg) var(--r-lg) 0 0; transform: translateY(100%); padding-bottom: env(safe-area-inset-bottom); }
  .sheet.is-open { transform: none; }
  .sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; }
  .toasts { left: 12px; right: 12px; bottom: 12px; transform: none; }
  .toast { max-width: none; min-width: 0; }
}
@media (min-width: 769px) { .stage-chips { display: none; } }


/* =========================================================
   Карточка: три зоны (поля · лента · файлы и действия)
   ========================================================= */
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px 12px; min-width: 0; }
.card-head h1 { font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card-head .back { flex: none; }
/* Ширина блока «колонка воронки + Задача» = ширине правой колонки карточки, края совпадают */
.card-head-right { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; width: 300px; }
.card-head-right > .pop-wrap { flex: 1; min-width: 0; }
.card-head-right .stage-btn { width: 100%; justify-content: flex-start; }
.card-head-right .stage-btn > span:not(.dot) { overflow: hidden; text-overflow: ellipsis; }
.card-head-right .stage-btn > .i:last-child { margin-left: auto; }
.stage-btn { gap: 8px; }
.stage-btn .dot { color: var(--stage); }
.pop-wrap { position: relative; }
.pop { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-2); }
.pop.pop-left { left: 0; right: auto; }
.pop.pop-full { left: 0; right: 0; min-width: 0; }
.pop.pop-up { top: auto; bottom: calc(100% + 6px); }   /* у нижнего края колонки меню открывается вверх */
/* Колонка воронки в шапке правой колонки — на всю ширину */
.zone-head-action .stage-btn { width: 100%; justify-content: flex-start; }
.zone-head-action .stage-btn > span:not(.dot) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zone-head-action .stage-btn > .i:last-child { margin-left: auto; }
/* «Задача» и «Поделиться» в заголовке карточки — поровну по ширине */
.card-head-right > .btn { flex: 1 1 0; min-width: 0; }
.gen-btn { height: 40px; }
/* Кому открыт доступ — строкой под задачами в «Ленте»: имя, вид доступа, крестик «Закрыть доступ» */
.card-shares { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 6px 12px 6px 16px; border-bottom: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.card-shares.is-empty { display: none; }
.cs-title { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); }
.cs-title .i { color: var(--icon); vertical-align: 0; }
.cs-item { display: inline-flex; align-items: center; gap: 6px; min-width: 0; color: var(--ink); }
.cs-access { color: var(--ink-3); }
.cs-item .icon-btn-sm { width: 26px; height: 26px; margin-left: -2px; }

.card-alert { margin: 0 20px 12px; }
.card-page { flex: 1; min-height: 0; display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; gap: 12px; padding: 0 20px 20px; }
.zone { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
/* Шапки всех трёх зон карточки — одной высоты, нижние линии на одном уровне */
.zone-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--line); font-weight: 500; }
.zone-head-action { padding: 0 10px; }
.zone-head-action > .pop-wrap { flex: 1; min-width: 0; }
.zone-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; }

/* Левая зона: поля карточки */
.form-grid { display: grid; gap: 14px; }
/* Системные поля (ФИО или Наименование) — отдельной группой над полями воронки */
.sys-fields { display: grid; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.field-static { min-height: 40px; display: flex; align-items: center; gap: 8px; }
.save-bar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-md) var(--r-md); }


/* Центральная зона: лента и поле заметки */
.feed-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; background: var(--surface-2); border-radius: var(--r-md) var(--r-md) 0 0; }
.composer { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); border-radius: 0 0 var(--r-md) var(--r-md); }
.composer .textarea { min-height: 42px; max-height: 160px; resize: none; padding: 10px 12px; }
.composer-actions { display: flex; align-items: center; gap: 4px; }
.composer .i-send { width: 20px; height: 20px; stroke-width: 2.25; } /* «Отправить» — стрелка вверх, чуть плотнее */
.drop-overlay { position: absolute; inset: 6px; z-index: 20; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 2px dashed var(--accent); border-radius: var(--r-md); background: rgba(231, 242, 233, .94); color: var(--accent); font-weight: 500; text-align: center; padding: 16px; pointer-events: none; }
.drop-overlay .i { width: 32px; height: 32px; }
.zone.is-drop .drop-overlay { display: flex; }
/* Карточка: одна зона «Отпустите…» поверх ленты и правой колонки сразу (та же ячейка сетки, колонки 2–3) */
.card-page > [data-zone="fields"] { grid-column: 1; grid-row: 1; }
.card-page > [data-zone="feed"] { grid-column: 2; grid-row: 1; }
.card-page > [data-zone="files"] { grid-column: 3; grid-row: 1; }
.drop-common { position: relative; inset: auto; grid-column: 2 / -1; grid-row: 1; z-index: 20; margin: 0; }
.card-page.is-drop .drop-common { display: flex; }
.feed-file { color: var(--ink); font-weight: 500; }
/* Ответственный — справа в заголовке ленты */
.owner-line { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 400; min-width: 0; }
.owner-static { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; white-space: nowrap; }
.select-sm { height: 32px; width: auto; padding: 0 32px 0 10px; font-size: 13px; background-position: right 8px center; }

/* Правая зона: файлы, «Сформировать», доступ */
.side-sec { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.side-sec:last-child { border-bottom: 0; }
.side-foot { flex: none; border-bottom: 0; padding-top: 8px; } /* доступ и «Поделиться» — внизу правой колонки, без заголовка и линии */
.side-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-weight: 500; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); color: var(--ink-2); font-size: 12.5px; text-align: center; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.dropzone:hover { border-color: var(--icon); }
.dropzone .i { color: var(--icon); }
.dropzone b { color: var(--accent); font-weight: 500; }
.dropzone .dropzone-hint { font-size: 11.5px; color: var(--ink-3); }
.file-meta .spin { width: 11px; height: 11px; border-width: 1.5px; vertical-align: -1px; margin-right: 3px; }
.files { display: grid; gap: 2px; margin-top: 8px; }
.file-row { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 8px; padding: 6px 6px 6px 4px; border-radius: var(--r-sm); }
.file-row:hover { background: var(--bg); }
/* Значок файла (LK.fileIcon): лист с загнутым углом и цветной плашкой расширения */
.file-ico { display: block; width: 30px; height: 37.5px; flex: none; overflow: visible; }
.file-ico .fi-page { fill: var(--surface); stroke: var(--line-strong); stroke-width: 1.5; }
.file-ico .fi-fold { fill: var(--bg); stroke: var(--line-strong); stroke-width: 1.5; stroke-linejoin: round; }
.file-ico .fi-tag { fill: #7c887f; }
.file-ico.is-pdf .fi-tag { fill: #d4473b; }
.file-ico.is-doc .fi-tag { fill: #2f6fdb; }
.file-ico.is-xls .fi-tag { fill: #1d8a4e; }
.file-ico.is-img .fi-tag { fill: #8a5cd1; }
.file-ico.is-video .fi-tag { fill: #e0761f; }
.file-ico .fi-ext { fill: #fff; font-family: var(--font); font-size: 8.4px; font-weight: 700; letter-spacing: .02em; }
.file-name { display: block; max-width: 100%; padding: 0; border: 0; background: none; color: var(--ink); text-align: left; cursor: pointer; font: inherit; font-size: inherit; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta { font-size: 12.5px; color: var(--ink-3); }
/* Кнопки файла появляются поверх строки при наведении — название не обрезается заранее */
.file-actions { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: flex; gap: 2px; padding-left: 16px; background: linear-gradient(90deg, transparent, var(--bg) 16px); opacity: 0; transition: opacity .15s ease; }
/* Кнопки — при наведении и при работе с клавиатуры (тогда подсвечена и строка). Фокус, вернувшийся после щелчка мышью
   (например, на «глаз» после закрытия просмотра), их не держит — иначе они «залипают» без подсветки строки */
.file-row:hover .file-actions, .file-row:has(:focus-visible) .file-actions { opacity: 1; }
.file-row:has(:focus-visible) { background: var(--bg); }
.icon-btn.is-off { color: var(--icon); cursor: default; } /* просмотр недоступен (Word, Excel) */
.icon-btn.is-off:hover { background: none; color: var(--icon); }
@media (hover: none) { .file-row { grid-template-columns: 30px minmax(0, 1fr) auto; } .file-actions { position: static; transform: none; padding: 0; background: none; opacity: 1; } }
.share-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 0; }
.share-row .small { color: var(--ink-3); }
.radio-row { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: var(--r-sm); cursor: pointer; }
.radio-row:hover { background: var(--bg); }
.radio-row input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

/* Заявка не взята: карточка закрыта */
.card-locked { flex: 1; display: flex; align-items: center; justify-content: center; padding: 20px; }
.card-locked .panel { max-width: 440px; width: 100%; }

.card-tabs { display: none; }
.sheet-form { display: grid; gap: 14px; padding: 16px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

@media (max-width: 1180px) {
  .card-page { grid-template-columns: 300px minmax(0, 1fr) 260px; }
  .card-head-right { width: 260px; }
}
@media (max-width: 900px) {
  .card-head { padding: 10px 12px 6px; }
  .card-head h1, .card-head .back { display: none; }
  .card-head-right { margin-left: 0; width: 100%; }
  .card-head-right .pop-wrap { flex: 1; }
  .card-head-right .stage-btn { width: 100%; justify-content: flex-start; }
  .card-head-right .stage-btn .i:last-child { margin-left: auto; }
  .card-head-right .desk-only { display: none; }
  .card-alert { margin: 0 12px 8px; }
  .card-tabs { display: flex; gap: 4px; padding: 0 12px 8px; }
  .card-tabs button { flex: 1; height: 40px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-2); font-weight: 500; cursor: pointer; }
  .card-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
  .card-page { display: block; padding: 0; }
  .card-page > .zone { display: none; border-radius: 0; border-left: 0; border-right: 0; }
  .card-page > .zone.is-active { display: flex; }
  .drop-common { position: fixed; inset: 12px; }
  .zone-head { display: none; }
  .zone-head.zone-head-action { display: flex; height: 60px; padding: 0 12px; }   /* «Сформировать» во вкладке «Файлы» */
  .zone-feed .zone-head { display: flex; height: auto; padding: 8px 12px; background: var(--surface); }   /* на телефоне — только строка «Ответственный» */
  .zone-feed .zh-title { display: none; }
  .zone-feed .owner-line { width: 100%; justify-content: space-between; }
  .select-sm { height: 36px; font-size: 16px; }
  .zone-feed { min-height: calc(var(--app-h) - var(--mbar-h) - 120px); }
  .feed-scroll { border-radius: 0; padding: 14px 12px 8px; }
  .composer { position: sticky; bottom: 0; border-radius: 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); z-index: 5; }
  .save-bar { position: sticky; bottom: 0; border-radius: 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .zone-body { overflow: visible; }
  .row-2 { grid-template-columns: 1fr; }
}
@media (min-width: 901px) { .mob-only { display: none !important; } }
@media (max-width: 900px) { .desk-only { display: none !important; } }
.file-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Контактные лица (воронка юрлиц): ярлычки и «+ Контактное лицо» */
.contact-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.contact-tag { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.contact-tag .i { color: var(--icon); }
.contact-tag:hover { border-color: var(--icon); background: var(--surface-2); }
.contact-tag.is-add { border-style: dashed; border-color: var(--accent-line); color: var(--accent); background: none; }
.contact-tag.is-add .i { color: var(--accent); }
.contact-tag.is-add:hover { background: var(--accent-soft); border-color: var(--accent); }

/* Форма, выезжающая снизу вверх внутри зоны полей */
.zone[data-zone="fields"] { overflow: hidden; }
.zone-scrim { position: absolute; inset: 0; z-index: 24; background: rgba(20, 34, 24, .28); opacity: 0; pointer-events: none; transition: opacity .2s ease; border-radius: inherit; }
.zone-scrim.is-open { opacity: 1; pointer-events: auto; }
.zone-sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 25; max-height: 90%; overflow-y: auto; background: var(--surface); border-top: 1px solid var(--line); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: 0 -16px 40px -24px rgba(31, 52, 37, .5); transform: translateY(100%); visibility: hidden; transition: transform .26s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .26s; }
.zone-sheet.is-open { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.22, 1, .36, 1); }
.zone-sheet .sheet-head { border-radius: var(--r-lg) var(--r-lg) 0 0; }
.zone-sheet .row-2 { grid-template-columns: 1fr; }
@media (max-width: 900px) {
  .zone[data-zone="fields"] { overflow: visible; }
  .zone-scrim { position: fixed; z-index: 90; border-radius: 0; }
  .zone-sheet { position: fixed; z-index: 91; max-height: 85vh; padding-bottom: env(safe-area-inset-bottom); }
  .zone-sheet::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--line-strong); margin: 8px auto 0; }
}


/* =========================================================
   Свои выпадающие поля (компьютер): список, календарь, время, мультивыбор
   ========================================================= */
.pop.pop-float { position: fixed; z-index: 120; right: auto; padding: 6px; }
.select-btn { display: block; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.select-btn.is-placeholder { color: var(--ink-3); }
.select-btn.is-open, .input.is-open { border-color: var(--accent); }
.select-btn:disabled { background-color: var(--surface-2); color: var(--ink-2); cursor: default; }

/* Список */
.lb { max-height: 288px; overflow-y: auto; }
.lb-opt { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: var(--r-sm); cursor: pointer; color: var(--ink); white-space: nowrap; }
.lb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.lb-opt.is-active { background: var(--bg); }
.lb-opt[aria-selected="true"] { font-weight: 500; }
.lb-opt[aria-selected="true"] > .i { color: var(--accent); }
.lb-opt.is-muted .lb-text { color: var(--ink-3); }
/* Мультивыбор: квадратик с галочкой слева */
.lb-multi .lb-opt[aria-selected="true"] { font-weight: 400; }
.lb-check { flex: none; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid var(--line-strong); border-radius: 4px; color: transparent; }
.lb-check .i { width: 13px; height: 13px; stroke-width: 2.5; vertical-align: 0; }
.lb-opt.is-checked .lb-check { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Поле с кнопкой справа (календарь, часы) */
.input-trigger-wrap { position: relative; display: block; }
.input-trigger-wrap > .input { padding-right: 56px; }
.input-trigger { position: absolute; top: 0; right: 0; bottom: 0; cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.input-trigger:hover, .multi .multi-add:hover, .input.is-open + .input-trigger, .multi .multi-add.is-open { background: var(--accent-soft); color: var(--accent); }
.input-trigger-wrap:focus-within .input-trigger, .input.is-open + .input-trigger { border-color: var(--accent); }
.input-trigger:disabled { display: none; }

/* Календарь */
.cal { width: 300px; padding: 10px; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.cal-title { display: flex; gap: 2px; }
.cal-title button { height: 32px; padding: 0 8px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.cal-title button:hover { background: var(--bg); }
.cal-nav { display: flex; gap: 2px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-grid-3 { grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px 0; }
.cal-dow { padding: 6px 0; text-align: center; font-size: 11.5px; font-weight: 500; color: var(--ink-3); }
.cal-day, .cal-cell { height: 36px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: inherit; font-size: 13.5px; font-variant-numeric: tabular-nums; cursor: pointer; }
.cal-cell { height: 44px; }
.cal-day:hover, .cal-cell:hover { background: var(--bg); }
.cal-day.is-out { color: var(--ink-3); }
.cal-day.is-today, .cal-cell.is-today { box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); font-weight: 500; }
.cal-day.is-sel, .cal-cell.is-sel { background: var(--accent); color: #fff; font-weight: 500; box-shadow: none; }
.cal-foot { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.cal-foot .cal-today { color: var(--accent); }

/* Мультивыбор: «+» — секция у правого края поля, как «₽» у суммы; по нажатию — список с галочками */
.multi { position: relative; padding-right: 52px; }
.multi .multi-add { position: absolute; top: -1px; right: -1px; bottom: -1px; margin: 0; cursor: pointer; transition: background .15s ease, color .15s ease, border-color .15s ease; }
.multi:has(.multi-add.is-open), .multi:has(.multi-add.is-open) .multi-add { border-color: var(--accent); }
.save-q { margin-right: auto; font-weight: 500; }
.row-tight { gap: 8px; }

/* Просмотр файла: поверх ЛК, тёмный фон, сверху — название, «Скачать», «Закрыть»; стрелки — соседние файлы */
.viewer { position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; background: #141a16; color: #fff; }   /* непрозрачный: под окном ничего не просвечивает */
.viewer:focus { outline: none; }
.viewer[hidden] { display: none; }
body.is-viewer { overflow: hidden; }
.viewer-bar { display: flex; align-items: center; gap: 12px; height: 60px; padding: calc(env(safe-area-inset-top)) 16px 0; flex: none; }
.viewer-title { flex: 1; min-width: 0; }
.viewer-title > div:first-child { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-meta { font-size: 12.5px; color: rgba(255, 255, 255, .65); }
.viewer-btn { color: #fff; }
.viewer-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.viewer-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 8px 72px 32px; }
.viewer-page { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; width: min(820px, 100%); height: 100%; max-height: 1060px; padding: 32px; border-radius: var(--r-md); background: var(--surface); color: var(--ink-2); }
.viewer-page > .i { width: 48px; height: 48px; color: var(--icon); stroke-width: 1.4; }
.viewer-photo { background: #2a312c; color: rgba(255, 255, 255, .75); }
.viewer-photo > .i { color: rgba(255, 255, 255, .5); }
/* Видео: встроенный плеер браузера (MP4 и MOV играют без скачивания) */
.viewer-video { position: relative; background: #000; color: rgba(255, 255, 255, .75); }
.viewer-play { display: inline-flex; align-items: center; justify-content: center; width: 72px; height: 72px; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.viewer-play .i { width: 34px; height: 34px; color: #fff; fill: #fff; margin-left: 4px; }
.viewer-video-bar { position: absolute; left: 16px; right: 16px; bottom: 14px; display: flex; align-items: center; gap: 10px; font-size: 12px; color: rgba(255, 255, 255, .7); }
.viewer-video-bar i { flex: 1; height: 4px; border-radius: 2px; background: linear-gradient(90deg, #fff 28%, rgba(255, 255, 255, .25) 28%); }
.viewer-office { height: auto; max-width: 440px; }
.viewer-office-t { font-weight: 500; font-size: 16px; color: var(--ink); }
.viewer-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; }
.viewer-nav:hover { background: rgba(255, 255, 255, .2); }
.viewer-nav.is-prev { left: 12px; }
.viewer-nav.is-next { right: 12px; }
@media (max-width: 768px) {
  .viewer-body { padding: 4px 8px calc(72px + env(safe-area-inset-bottom)); }
  .viewer-page { padding: 20px; }
  .viewer-nav { top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); transform: none; }
  .viewer-nav.is-prev { left: calc(50% - 60px); }
  .viewer-nav.is-next { right: calc(50% - 60px); }
}


/* =========================================================
   Задачи: разделы · список по датам · задача (по образцу Microsoft To Do)
   ========================================================= */
.tasks-page { flex: 1; min-height: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr) 380px; gap: 12px; padding: 0 20px 20px; }
.tasks-nav { display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); align-self: start; }
.tasks-nav-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-2); font: inherit; font-weight: 500; text-align: left; cursor: pointer; white-space: nowrap; }
.tasks-nav-item .i { color: var(--icon); }
.tasks-nav-item .count, .tasks-nav-item .chip { margin-left: auto; }
.tasks-nav-item:hover { background: var(--bg); color: var(--ink); }
.tasks-nav-item[aria-current="true"] { background: var(--accent-soft); color: var(--accent); }
.tasks-nav-item[aria-current="true"] .i { color: var(--accent); }
.tasks-nav-sep { height: 1px; margin: 6px 4px; background: var(--line); flex: none; }

/* Список: строка «Добавить задачу», группы по датам */
.tl-head .zh-sub { font-weight: 400; font-size: 13px; color: var(--ink-3); }
.tl-body { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 16px; }
.task-add { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 12px; margin-bottom: 4px; border: 1px solid transparent; border-radius: var(--r-md); background: var(--surface-2); transition: border-color .15s ease, background .15s ease; }
.task-add .i { color: var(--accent); }
.task-add input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; background: none; color: var(--ink); font-size: 14px; outline: none; }
.task-add input:focus, .task-add input:focus-visible { box-shadow: none; }   /* без контура: при вводе подсказка просто бледнеет */
.task-add input::placeholder { color: var(--accent); font-weight: 500; }
.task-add:focus-within input::placeholder { color: var(--ink-3); font-weight: 400; }
.task-group-title { display: flex; align-items: center; gap: 8px; padding: 14px 6px 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.task-group-title.is-overdue { color: var(--danger); }
.task-group-title.is-today { color: var(--warn); }
.task-group { display: grid; gap: 6px; }
.task-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 11px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; transition: border-color .15s ease, background .15s ease, opacity .3s ease; }
.task-row:hover { border-color: var(--line-strong); }
.task-row.is-selected { background: var(--accent-soft); border-color: var(--accent-line); }
.task-row.is-leaving { opacity: .35; }
.task-open { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.task-title { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.task-row.is-new .task-title { font-weight: 700; }
.task-row.is-done .task-title, .task-row.is-leaving .task-title { font-weight: 400; color: var(--ink-3); text-decoration: line-through; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 3px; font-size: 12.5px; color: var(--ink-2); }
.task-meta > * { display: inline-flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; }
.task-meta .i { color: var(--icon); vertical-align: 0; }
.task-meta .is-new, .task-meta .is-new .i { color: var(--danger); font-weight: 500; }
.task-meta-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-card-link { color: var(--ink-2); }
.task-card-link:hover, .task-card-link:hover .i { color: var(--accent); }
.task-card-off { color: var(--ink-3); }
.task-side { display: flex; align-items: center; gap: 8px; padding-top: 1px; }
.task-check { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; padding: 0; border: 1.5px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: transparent; cursor: pointer; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.task-check .i { width: 14px; height: 14px; stroke-width: 2.6; vertical-align: 0; }
.task-check:hover { border-color: var(--accent); color: var(--accent); }
.task-check[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.task-check:disabled { cursor: default; opacity: .45; }
.task-check:disabled:hover { border-color: var(--line-strong); color: transparent; }

/* Задача (правая колонка) */
.task-detail { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.td-head { flex: none; display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 8px 0 16px; border-bottom: 1px solid var(--line); }
.td-head-title { flex: 1; min-width: 0; font-weight: 500; }
.td-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 14px; padding: 16px; }
.td-title-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; }
.td-title-row .task-check { margin-top: 7px; }
.td-title { width: calc(100% + 8px); min-height: 36px; padding: 5px 8px; margin: 0 0 0 -8px; border: 1px solid transparent; border-radius: var(--r-sm); background: none; color: var(--ink); font: inherit; font-size: 17px; font-weight: 700; line-height: 1.35; resize: none; overflow: hidden; }
.td-title:hover { border-color: var(--line); }
.td-title:focus { outline: none; border-color: var(--accent); }
.td-title.is-done { color: var(--ink-3); text-decoration: line-through; }
.td-from { display: flex; align-items: center; gap: 8px; margin-top: -6px; padding-left: 32px; font-size: 12.5px; color: var(--ink-2); }
.td-pair { display: grid; grid-template-columns: minmax(0, 1fr) 128px; gap: 8px; }
.td-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.td-label-row label { font-size: 13px; font-weight: 500; color: var(--ink); }
.td-label-row a { font-size: 12.5px; font-weight: 500; }
.td-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
.td-empty { flex: 1; align-content: center; }

@media (max-width: 1280px) {
  .tasks-page { grid-template-columns: 200px minmax(0, 1fr) 340px; }
}
/* Узкий экран: разделы — строкой чипов над списком */
@media (max-width: 1100px) {
  .tasks-page { grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto minmax(0, 1fr); }
  .tasks-nav { grid-column: 1 / -1; flex-direction: row; gap: 6px; padding: 0; overflow-x: auto; background: none; border: 0; border-radius: 0; scrollbar-width: none; }
  .tasks-nav::-webkit-scrollbar { display: none; }
  .tasks-nav-item { flex: none; width: auto; height: 34px; gap: 6px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-size: 13px; }
  .tasks-nav-item .i { display: none; }
  .tasks-nav-item .count, .tasks-nav-item .chip { margin-left: 0; }
  .tasks-nav-item[aria-current="true"] { border-color: var(--ink); color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--ink); }
  .tasks-nav-sep { display: none; }
}
/* Телефон: список на всю ширину, задача открывается на весь экран, «Назад» возвращает в список */
@media (max-width: 768px) {
  .tasks-page { display: block; padding: 0; }
  .tasks-nav { padding: 0 12px 10px; }
  .tasks-nav-item { height: 36px; }
  .tasks-list { background: none; border: 0; border-radius: 0; }
  .task-add { background: var(--surface); border-color: var(--line); }
  .tl-head { display: none !important; }
  .tl-body { overflow: visible; padding: 10px 12px calc(88px + env(safe-area-inset-bottom)); }
  .task-row { grid-template-columns: 26px minmax(0, 1fr) auto; padding: 12px; }
  .task-check { width: 26px; height: 26px; }
  .task-detail { position: fixed; inset: 0; z-index: 80; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top); transform: translateX(100%); visibility: hidden; transition: transform .26s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .26s; }
  .task-detail.is-open { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.22, 1, .36, 1); }
  .td-head { height: var(--mbar-h); padding: 0 8px; }
  .td-head-title { font-weight: 700; font-size: 16px; }
  .td-title-row { grid-template-columns: 26px minmax(0, 1fr); }
  .td-title { font-size: 18px; }
  .td-from { padding-left: 36px; }
  .td-pair { grid-template-columns: minmax(0, 1fr) 132px; }
  .td-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  body.is-task-open { overflow: hidden; }
}

/* =========================================================
   Карточка: открытые задачи над лентой — «что дальше и когда»
   ========================================================= */
.card-tasks { flex: none; display: grid; gap: 2px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--surface); }
.ct-row { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; min-height: 40px; padding: 4px 8px; border-radius: var(--r-sm); transition: background .15s ease, opacity .3s ease; }
.ct-row:hover { background: var(--bg); }
.ct-row.is-overdue { background: var(--danger-soft); }
.ct-row.is-leaving { opacity: .35; }
.ct-row.is-leaving .ct-title { text-decoration: line-through; }
.ct-title { min-width: 0; padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 500; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.ct-title:hover { color: var(--accent); }
.ct-title:disabled { cursor: default; color: var(--ink); }
.ct-more { justify-self: start; display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 8px; margin-left: 32px; border: 0; border-radius: var(--r-sm); background: none; color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.ct-more:hover { background: var(--accent-soft); }
.ct-empty { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 8px; color: var(--ink-3); font-size: 13px; }
.ct-empty .btn { margin-left: auto; }
.card-tasks:not(.is-open) .ct-row:nth-of-type(n+3) { display: none; }   /* видны две ближайшие, остальные — по «Ещё …» */
@media (max-width: 900px) {
  /* Телефон: полоса прилипает под верхней панелью, видна одна ближайшая задача */
  .card-tasks { position: sticky; top: calc(var(--mbar-h) + env(safe-area-inset-top)); z-index: 6; padding: 4px 6px; }
  .card-tasks:not(.is-open) .ct-row:nth-of-type(n+2) { display: none; }
  /* срок — второй строкой под названием, чтобы название не обрезалось */
  .ct-row { grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "c t a" "c s a"; row-gap: 1px; min-height: 44px; padding: 6px 8px; }
  .ct-row > .task-check { grid-area: c; width: 26px; height: 26px; }
  .ct-row > .ct-title { grid-area: t; }
  .ct-row > .task-st { grid-area: s; }
  .ct-row > span:not(.task-st) { grid-area: a; }
  .ct-more { height: 36px; }
}

/* =========================================================
   Главная: четыре блока на одном экране без прокрутки страницы (сетка 2×2 на всю высоту).
   Мои задачи · Мои карточки / Мои застрявшие карточки · Мои непрочитанные письма. Не поместилось — листается внутри блока (без «Ещё …»), страница не прокручивается.
   ========================================================= */
.dash-date { color: var(--ink-3); font-size: 14px; }
.dash { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "tasks funnels" "att mail"; gap: 16px; padding: 0 20px 20px; }
.app-dash .toolbar { padding-top: 12px; padding-bottom: 10px; }
.dash-tasks { grid-area: tasks; }
.dash-att { grid-area: att; }
.dash-funnels { grid-area: funnels; }
.dash-mail { grid-area: mail; }
.dash-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.dash-head { flex: none; display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.dash-head h2 { font-size: 15px; font-weight: 500; }
/* Число в заголовке блока — сколько в нём — зелёное и жирное, чтобы сразу бросалось в глаза */
.dash-head .count { color: var(--accent); font-weight: 700; font-size: 15px; }
.dash-head-link { margin-left: auto; display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.dash-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 1px; padding: 6px 8px 8px; }
.dash-sub { display: flex; align-items: center; gap: 6px; padding: 6px 10px 2px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.dash-sub.is-overdue { color: var(--danger); }
.dash-sub.is-today { color: var(--warn); }
.dash-sub .i { vertical-align: 0; }
.dash-empty { padding: 20px 12px; color: var(--ink-3); font-size: 13px; text-align: center; }
/* Не поместилось — листается внутри блока; пока не долистали до конца, нижний край затухает */
.dash-body.has-more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent); }

/* Задачи на главной — строки из «Задач»: первый ряд — название, второй — карточка и «поручил …»; срок справа */
.dash .task-row { align-items: center; gap: 10px; padding: 6px 10px; border-color: transparent; }
.dash .task-row:hover { background: var(--surface-2); border-color: transparent; }
.dash-task-main { min-width: 0; }
.dash .task-meta { margin-top: 1px; }

/* Застрявшие карточки и «Мои карточки»: карточка и колонка слева, причины справа */
/* Ряд 1: имя карточки слева, причина по задачам справа. Ряд 2: воронка и колонка слева, «Нет движения» справа */
.att-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1px 16px; padding: 8px 10px; border-radius: var(--r-md); }
.att-row:hover { background: var(--surface-2); }
.att-row > .att-title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.att-why { justify-self: end; }
.att-title { font-weight: 500; color: var(--ink); }
.att-title::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }   /* вся строка — ссылка на карточку */
.att-title:hover { color: var(--ink); }
.att-title:focus-visible { box-shadow: none; }
.att-title:focus-visible::after { box-shadow: var(--focus); }
.att-meta { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.task-st.is-stale, .task-st.is-stale .i { color: var(--warn); }

/* Мои карточки: выбранная воронка и колонка — серым после заголовка; фильтр — значок в правом углу шапки блока */
.dash-head h2 { white-space: nowrap; }
.dash-filter-label { min-width: 0; font-size: 13px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-head-end { margin-left: auto; flex: none; margin-right: -6px; }
.dash-filter-pop { width: 300px; max-height: min(60vh, 440px); overflow-y: auto; padding: 4px 6px 6px; }
.dfp-funnel { padding: 10px 12px 4px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.dash-filter-pop .menu-item { min-height: 36px; gap: 8px; }
.dash-filter-pop .menu-item .count { margin-left: auto; }
.dash-filter-pop .menu-item[aria-current="true"]::after { margin-left: 10px; }
.dash-help { width: 300px; padding: 12px 14px; font-size: 13px; line-height: 1.45; color: var(--ink-2); }
.dash-help b { font-weight: 500; color: var(--ink); }
.dash-leads { padding: 4px 10px 6px; }

/* Непрочитанная почта */
.mail-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 0 10px; align-items: center; padding: 7px 10px; border-radius: var(--r-md); color: var(--ink); }
.mail-row:hover { background: var(--surface-2); color: var(--ink); }
.mail-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.mail-from { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-time { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.mail-subj { grid-column: 2 / -1; font-size: 13px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-box { color: var(--ink-3); }

/* Низкий экран (ноутбук 1366×768, 1280×720): блоки плотнее; совсем низкий — без строки «Главная · дата» (раздел и так выделен в шапке) */
@media (min-width: 901px) and (max-height: 820px) {
  .app-dash .toolbar { padding-top: 8px; padding-bottom: 8px; }
  .dash { gap: 12px; padding-bottom: 12px; }
  .dash-head { height: 44px; }
}
@media (min-width: 901px) and (max-height: 740px) {
  .app-dash .toolbar { display: none; }
  .dash { padding-top: 12px; }
}

/* Телефон и узкий планшет: экран не вмещает четыре блока — одна колонка, страница прокручивается.
   Порядок: задачи, «Требуют внимания», воронки, почта (как в разметке). */
@media (max-width: 900px) {
  .app.is-fixed.app-dash { height: auto; }
  .dash { display: flex; flex-direction: column; gap: 12px; padding: 0 12px calc(88px + env(safe-area-inset-bottom)); }
  .dash-body { overflow: visible; }
  .toolbar .dash-date { font-size: 13px; }
}
@media (max-width: 768px) {
  .dash-head { padding: 0 12px; }
  .dash-body { padding: 4px; }
  .dash .task-row { align-items: start; padding: 10px 8px; }
  .att-row { padding: 10px 8px; }
  .att-meta { flex-wrap: wrap; white-space: normal; }
  .dash-filter-pop, .dash-help { width: min(300px, calc(100vw - 48px)); }
  .mail-row { padding: 10px 8px; }
}

/* =========================================================
   Почта: ящики и папки · рабочая область — ЛИБО список, ЛИБО переписка, ЛИБО новое письмо (как в 360)
   ========================================================= */
.mail-page { flex: 1; min-height: 0; display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 12px; padding: 0 20px 20px; }
.mail-nav { min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 14px 12px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
/* Как в 360: блок «Ящики» (только если ящиков несколько) и блок «Папки» выбранного ящика */
.mnav-group { display: flex; flex-direction: column; gap: 4px; }
.mnav-group + .mnav-group { margin-top: 20px; }
.mnav-title { margin: 2px 6px 8px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.mitem { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 8px 12px; border: 1px solid transparent; border-radius: var(--r-md); background: none; color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; transition: background .12s ease, color .12s ease, border-color .12s ease; }
.mitem .i { color: var(--icon); }
.mitem:hover { background: var(--accent-soft); border-color: var(--line); }
.mitem:hover .i { color: var(--accent); }
.mitem-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mitem-count { flex: none; min-width: 20px; height: 19px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.mitem[aria-current="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 6px 16px -12px rgba(13, 24, 18, .55); }
.mitem[aria-current="true"] .i { color: #fff; }
.mitem[aria-current="true"] .mitem-count { background: rgba(255, 255, 255, .18); color: #fff; }

/* Рабочая область: без общей рамки — панель действий, список, шапка переписки и письма — отдельными карточками */
.mail-main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.mail-view { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.mail-view[hidden] { display: none; }

/* Панель действий над списком (как Gmail и 360): всегда видна, действия активны при выборе */
.ml-bar { flex: none; display: flex; align-items: center; gap: 4px; min-height: 52px; margin-bottom: 12px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.ml-bar .icon-btn { width: 34px; height: 34px; }
.ml-bar .icon-btn[disabled] { opacity: .4; pointer-events: none; }
.ml-bar .icon-btn.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.ml-select { position: relative; display: inline-flex; align-items: center; gap: 2px; margin-right: 6px; padding-right: 8px; border-right: 1px solid var(--line); }
.ml-select .ml-caret { width: 22px; }
.ml-select .pop { left: 0; right: auto; min-width: 180px; }
.ml-spacer { flex: 1; }
.ml-folder { margin-left: 4px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.ml-list { flex: 1; min-height: 0; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.mcheck { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; border: 1.5px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: transparent; cursor: pointer; }
.mcheck .i { width: 13px; height: 13px; stroke-width: 2.6; vertical-align: 0; }
.mcheck:hover { border-color: var(--accent); }
.mcheck[aria-checked="true"], .mcheck[aria-checked="mixed"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.mcheck-hit { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: -7px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; }
/* Строка: флажок · точка · отправитель · тема — начало текста · скрепка · число писем · дата */
.ml-row { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 14px; border-bottom: 1px solid var(--line); color: var(--ink-2); cursor: pointer; transition: background .12s ease; }
.ml-row:last-child { border-bottom: 0; }
.ml-row:hover { background: var(--surface-2); }
.ml-row.is-checked { background: var(--accent-soft); }
.ml-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.ml-row.is-unread .ml-dot { background: var(--accent); }
.ml-from { flex: none; width: 168px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ml-draft { color: var(--warn); }
.ml-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ml-snip { color: var(--ink-3); }
.ml-tail { flex: none; display: inline-flex; align-items: center; gap: 8px; }
.ml-att { display: inline-flex; color: var(--icon); }
.ml-badge { min-width: 19px; height: 19px; display: inline-flex; align-items: center; justify-content: center; padding: 0 5px; border-radius: 999px; background: var(--bg); color: var(--ink-2); font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ml-time { min-width: 38px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.ml-row.is-unread .ml-from, .ml-row.is-unread .ml-subj { font-weight: 700; color: var(--ink); }
.ml-row.is-unread .ml-time { color: var(--ink); font-weight: 700; }

/* Переписка: шапка (значки, ниже тема), затем форма ответа, затем письма — свежее сверху */
.mt-head { flex: none; display: grid; gap: 8px; margin-bottom: 12px; padding: 8px 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.mt-tools { display: flex; align-items: center; gap: 2px; }
.mt-tools .is-danger:hover { color: var(--danger); background: var(--danger-soft); }
.mt-subject { padding: 0 10px; font-size: 17px; overflow-wrap: anywhere; }
.mt-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 10px; }
.msg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; }
.msg.is-collapsed { cursor: pointer; transition: background .12s ease; }
.msg.is-collapsed:hover { background: var(--bg); }
.msg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; cursor: pointer; }
.msg-who { flex: 1; min-width: 0; }
.msg-from-row { display: flex; align-items: center; gap: 4px; min-width: 0; }
.msg-from { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--ink); }
.msg-copy { width: 28px; height: 28px; flex: none; color: var(--icon); }
.msg-copy:hover { color: var(--accent); background: var(--accent-soft); }
.msg-to { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: 12.5px; color: var(--ink-3); }
.msg-to .i { width: 13px; height: 13px; flex: none; }
.msg-to span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-date { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.msg-reply { display: flex; gap: 2px; }
.msg-reply .btn { height: 28px; padding: 0 8px; font-size: 12.5px; gap: 5px; }
.msg-reply .btn .i { width: 15px; height: 15px; }
/* Тело — в продакшене iframe sandbox по высоте содержимого; картинки из интернета вырезаются всегда */
.msg-body { margin-top: 14px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.msg-files { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.msg-files-title { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.msg-files-title .i { width: 15px; height: 15px; }
.msg-files-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 6px; }
.msg-files-list .file-row { border: 1px solid var(--line); }
/* Вложение больше 20 МБ: в ЛК не загружено — только название и размер, без просмотра и скачивания */
.file-row.is-off { cursor: default; border-style: dashed; }
.file-row.is-off:hover { background: none; }
.file-row.is-off .file-ico { opacity: .45; }
.file-row.is-off .file-name { color: var(--ink-2); cursor: default; }
.msg-actions { display: flex; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.msg.is-collapsed .msg-reply, .msg.is-collapsed .msg-body, .msg.is-collapsed .msg-files, .msg.is-collapsed .msg-actions { display: none; }

/* Форма письма: ответ — вверху переписки, новое письмо — на месте списка */
.mc { display: grid; gap: 10px; padding: 12px 16px 14px; background: var(--surface); border: 1px solid var(--accent-line); border-radius: var(--r-md); box-shadow: var(--shadow-1); }
.mc-head { display: flex; align-items: center; gap: 8px; min-height: 30px; }
.mc-head b { font-weight: 700; }
.mc-saved { margin-left: auto; font-size: 12.5px; color: var(--ink-3); }
.mc-line { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.mc-line > label { font-size: 13px; color: var(--ink-3); }
.mc-cc { padding: 4px; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.mc { position: relative; }
.mc.is-drop .mc-drop { display: flex; }   /* «Отпустите, чтобы прикрепить к письму» — поверх всей формы, как рамка карточки */
.mc-drop { inset: 0; }
.mc-atts { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-atts:empty { display: none; }
.mc-att { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 2px 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); font-size: 13px; }
.mc-att .i { color: var(--icon); }
.mc-att-sum { align-self: center; margin-left: 4px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }   /* «3,4 МБ из 20 МБ» */
.mc-att-sum.is-near { color: var(--warn); font-weight: 500; }
.mc-foot { display: flex; align-items: center; gap: 8px; }
.mc-foot .ml-spacer { flex: 1; }
.mc-page { flex: 1; min-height: 0; overflow-y: auto; }
.mc-page .mc { max-width: 860px; }
.mc-page .mc-text .rte-area { min-height: 300px; }   /* новое письмо на месте списка — поле выше */

@media (max-width: 1180px) {
  .mail-page { grid-template-columns: 220px minmax(0, 1fr); }
  .ml-from { width: 130px; }
}
/* Телефон: ящики и папки — из заголовка (как переключатель воронок); список, переписка и форма — на месте друг друга */
@media (max-width: 768px) {
  .app.is-fixed.app-mail { height: auto; }
  .mail-page { display: block; padding: 0 8px; }
  .mail-nav { display: none; }
  .mail-main { min-height: calc(var(--app-h) - var(--mbar-h) - 60px); }
  .ml-bar { position: sticky; top: calc(var(--mbar-h) + env(safe-area-inset-top)); z-index: 5; margin-bottom: 8px; padding: 4px 8px; }
  .ml-bar .icon-btn { width: 40px; height: 40px; }
  .ml-folder { display: none; }
  .ml-list, .mt-body, .mc-page { overflow: visible; }
  /* строка списка в две строки: кто · хвост (число писем, дата) / тема — начало текста */
  .ml-row { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; grid-template-areas: "d f t" "d x x"; gap: 2px 10px; padding: 10px 12px; }
  .ml-row > .mcheck-hit { display: none; }
  .ml-row > .ml-dot { grid-area: d; align-self: start; margin-top: 7px; }
  .ml-row > .ml-from { grid-area: f; width: auto; }
  .ml-row > .ml-text { grid-area: x; }
  .ml-row > .ml-tail { grid-area: t; }
  .mt-head { padding: 6px 4px 12px; margin-bottom: 8px; }
  .mt-body { padding-bottom: 16px; }
  .msg { padding: 12px; }
  /* шапка письма в столбик: кто и кому, под ними дата и кнопки ответа */
  .msg-head { flex-direction: column; align-items: stretch; gap: 6px; }
  .msg-meta { align-items: flex-start; }
  .msg-reply { flex-wrap: wrap; gap: 4px; }
  .msg-reply .btn { height: 36px; }
  .msg-files-list { grid-template-columns: minmax(0, 1fr); }
  .mc { padding: 12px; }
  .mc-text .rte-area, .mc-page .mc-text .rte-area { min-height: 36vh; }
}

/* =========================================================
   Вход: одна форма для всех (сотрудник и администратор). Без шапки, по центру экрана.
   ========================================================= */
.app-login { align-items: center; justify-content: center; padding: 32px 16px; }
.login { width: 100%; max-width: 400px; display: grid; gap: 24px; }
.login-logo { justify-self: center; display: block; }
.login-logo img { height: 40px; width: auto; display: block; }
.login-box { display: grid; gap: 16px; padding: 28px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.login-box h1 { font-size: 20px; }
.login-box .btn-primary { margin-top: 4px; }
.login-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); }
.login-note .i { color: var(--icon); margin-top: 1px; }
/* «Показать пароль» — та же боковая секция 44 px, что у ₽ и календаря, только кнопка */
.input-affix button.affix { cursor: pointer; transition: color .15s ease; }
.input-affix button.affix:hover { color: var(--ink); }
.input-affix .input.is-invalid, .input-affix .input.is-invalid + .affix { border-color: var(--danger); }
.field .hint.is-warn { color: var(--warn); display: flex; gap: 6px; align-items: center; }
.alert b { font-weight: 500; }

@media (max-width: 768px) {
  .app-login { justify-content: flex-start; padding: calc(40px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); }
  .login { gap: 20px; }
  .login-logo img { height: 34px; }
  .login-box { padding: 20px 16px; }
}

/* =========================================================
   Плашка «Получать уведомления на этом устройстве?» — после входа, на любой странице; после «Не сейчас» — снова через 14 дней.
   Своя плашка нужна потому, что системный запрос браузера можно показать только по нажатию («Включить»).
   ========================================================= */
.push-ask { position: fixed; right: 20px; bottom: 20px; z-index: 65; width: 400px; display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 4px 14px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-3); animation: toast-in .25s cubic-bezier(.22, 1, .36, 1); }
.push-ask-icon { grid-row: span 2; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.push-ask-icon .i { vertical-align: 0; }
.push-ask-title { font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.35; }
.push-ask-text { font-size: 13px; color: var(--ink-2); }
.push-ask-text .i { color: var(--ink); }
.push-ask-text b { font-weight: 500; color: var(--ink); }
.push-ask-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

@media (max-width: 900px) {
  .push-ask { top: calc(var(--mbar-h) + env(safe-area-inset-top) + 8px); bottom: auto; right: 12px; }
}
@media (max-width: 768px) {
  .push-ask { left: 12px; width: auto; padding: 14px; gap: 4px 12px; }
  .push-ask-actions .btn { flex: 1; }
}

/* =========================================================
   Новая карточка («+» в воронке): одна форма полей. Ленты, файлов и задач до создания нет —
   после «Создать карточку» открывается обычная карточка. Поля — те же, что в левой зоне карточки.
   ========================================================= */
.newcard-wrap { flex: 1; padding: 0 20px 24px; }
.newcard { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; }
.newcard-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-md) var(--r-md) 0 0; }
.newcard-meta-item { display: flex; align-items: center; gap: 8px; min-height: 32px; }
.newcard-meta-item > .muted { font-size: 13px; }
.newcard-meta-item b { font-weight: 500; }
.newcard-meta-item .dot { color: var(--stage); }
.newcard-meta-item .select { height: 32px; min-width: 220px; }
.newcard-body { display: grid; gap: 16px; padding: 20px; }
.newcard-body .sys-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 16px; }
.newcard-body .sys-fields[data-sys="company"] { grid-template-columns: minmax(0, 1fr); }
.newcard-body .sys-fields > .error { grid-column: 1 / -1; font-size: 12.5px; color: var(--danger); display: flex; gap: 6px; align-items: center; margin-top: -6px; }
.newcard-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
.newcard-fields .is-wide { grid-column: 1 / -1; }
/* Предупреждение «Клиент с этим телефоном уже есть»: на всю ширину сразу под строкой с телефоном (dense — соседнее поле не съезжает) */
.newcard-fields { grid-auto-flow: row dense; }
.dup-warn a { color: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.dup-warn a:hover { color: var(--ink); }
.dup-warn .dup-list { display: grid; gap: 2px; margin-top: 2px; }
.dup-warn .dup-note { margin-top: 4px; color: var(--ink-2); }
.newcard-foot { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-md) var(--r-md); }
.newcard-foot .newcard-note { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-2); }

@media (max-width: 768px) {
  .newcard-wrap { padding: 12px 12px 0; }
  .newcard-meta { padding: 10px 14px; gap: 2px 20px; }
  .newcard-meta-item { min-height: 28px; }
  .newcard-meta-item .select { min-width: 0; flex: 1; height: 40px; }
  .newcard-meta-item:has(.select) { width: 100%; }
  .newcard-body { padding: 16px 14px; }
  .newcard-body .sys-fields, .newcard-fields { grid-template-columns: minmax(0, 1fr); }
  .newcard-foot { position: sticky; bottom: 0; z-index: 5; margin: 0 -12px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-radius: 0; }
  .newcard-foot .newcard-note { display: none; }
  .newcard-foot .btn { flex: 1; }
}

/* =========================================================
   Администрирование: каркас всех экранов админки — разделы слева · рабочая область.
   Как на экране «Задачи»: узкий экран — разделы строкой чипов, телефон — деталь на весь экран.
   ========================================================= */
.icon-btn[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.admin-page { flex: 1; min-height: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 12px; padding: 0 20px 20px; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; padding: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); align-self: start; }
.admin-nav a { display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 10px; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.admin-nav a .i { color: var(--icon); }
.admin-nav a:hover { background: var(--bg); color: var(--ink); }
.admin-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); }
.admin-nav a[aria-current="page"] .i { color: var(--accent); }
.admin-nav-sep { height: 1px; margin: 6px 4px; background: var(--line); flex: none; }
.admin-work { min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 12px; }

/* Пользователи: список */
.ul-list { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.ul-head { flex: none; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 10px 0 16px; border-bottom: 1px solid var(--line); font-weight: 500; }
.ul-head .btn { margin-left: auto; }
.ul-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 6px; padding: 12px; }
.ul-group { padding: 10px 6px 2px; font-size: 12.5px; font-weight: 500; color: var(--ink-3); }
.ul-row { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.ul-row:hover { border-color: var(--line-strong); }
.ul-row[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent-line); }
.ul-row .avatar { width: 36px; height: 36px; font-size: 12.5px; }
.ul-row.is-off .avatar { background: var(--bg); color: var(--ink-3); }
.ul-row.is-off .ul-name { color: var(--ink-2); }
.ul-name { font-weight: 500; color: var(--ink); }
.ul-login { margin-left: 8px; font-size: 12.5px; font-weight: 400; color: var(--ink-3); }
.ul-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; font-size: 12.5px; color: var(--ink-2); }
.ul-meta b { font-weight: 500; color: var(--ink); }

/* Пользователи: сотрудник справа */
.ud { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); }
.ud-head { flex: none; display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--line); }
.ud-head-title { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ud-head .back { display: none; }
.ud-body { flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 16px; padding: 16px; }
.ud-sec { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.ud-sec-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 500; }
.ud-sec-title a { font-size: 12.5px; font-weight: 500; }
.pw-row { display: flex; gap: 6px; }
.pw-row .input { flex: 1; min-width: 0; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.pw-row .icon-btn { flex: none; width: 40px; height: 40px; }
.pw-set { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; color: var(--ink-2); }
.fa-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 40px; }
.fa-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 500; }
.fa-row .seg button { padding: 0 10px; }
.fa-row .seg button[data-scope="none"][aria-pressed="true"] { color: var(--ink-3); }
.mail-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ud-foot { flex: none; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.ud-foot .ud-created { flex: 1; min-width: 0; font-size: 12.5px; color: var(--ink-3); }
.ud-foot.save-bar { background: var(--surface-2); border-radius: 0 0 var(--r-md) var(--r-md); }
.ud-foot.save-bar .save-q { flex: 1; font-weight: 500; }
.ud-admin { display: grid; gap: 12px; }
.sheet-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; }

@media (max-width: 1280px) {
  .admin-page { grid-template-columns: 200px minmax(0, 1fr); }
  .admin-work { grid-template-columns: minmax(0, 1fr) 380px; }
}
@media (max-width: 1100px) {
  .admin-page { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .admin-nav { flex-direction: row; gap: 6px; padding: 0; overflow-x: auto; background: none; border: 0; border-radius: 0; scrollbar-width: none; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav a { flex: none; height: 34px; gap: 6px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-size: 13px; }
  .admin-nav a .i { display: none; }
  .admin-nav a[aria-current="page"] { border-color: var(--ink); color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--ink); }
  .admin-nav-sep { display: none; }
}
@media (max-width: 768px) {
  .app.is-fixed.app-admin { height: auto; }
  .admin-page { display: block; padding: 0; }
  .admin-nav { padding: 0 12px 10px; }
  .admin-nav a { height: 36px; }
  .admin-work { display: block; }
  .ul-list { background: none; border: 0; border-radius: 0; }
  .ul-head { height: auto; padding: 0 12px 4px; border: 0; }
  .ul-head .ul-head-title { display: none; }
  .ul-head .btn { margin-left: 0; width: 100%; }
  .ul-body { overflow: visible; padding: 6px 12px calc(88px + env(safe-area-inset-bottom)); }
  .ul-row { grid-template-columns: 36px minmax(0, 1fr); }
  .ul-row[aria-current="true"] { background: var(--surface); border-color: var(--line); }   /* на телефоне выбранного нет — сотрудник открыт на весь экран */
  .ul-login { display: block; margin-left: 0; }
  .ud { position: fixed; inset: 0; z-index: 80; border: 0; border-radius: 0; padding-top: env(safe-area-inset-top); transform: translateX(100%); visibility: hidden; transition: transform .26s cubic-bezier(.22, 1, .36, 1), visibility 0s linear .26s; }
  .ud.is-open { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.22, 1, .36, 1); }
  .ud-head { height: var(--mbar-h); padding: 0 8px; }
  .ud-head .back { display: inline-flex; }
  .ud-head-title { font-weight: 700; font-size: 16px; }
  .fa-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .fa-row .seg { width: 100%; }
  .fa-row .seg button { flex: 1; height: 36px; }
  .ud-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .ud-foot.save-bar { border-radius: 0; }
  body.is-detail-open { overflow: hidden; }
}

/* =========================================================
   Администрирование → Воронки и поля: список воронок · воронка (основное и колонки).
   Список и деталь — те же .ul-* / .ud-*, что у «Пользователей».
   ========================================================= */
.admin-work.is-funnels { grid-template-columns: 340px minmax(0, 1fr); }
.fn-cols { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; padding: 0 12px 0 14px; font-size: 12px; color: var(--ink-3); }
.fn-cols span:last-child { grid-column: 3; }
.fn-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px 10px 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.fn-row:hover { border-color: var(--line-strong); }
.fn-row[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent-line); }
.fn-row.is-archived { cursor: pointer; }
.fn-row.is-archived .ul-name { color: var(--ink-2); }
.fn-open { min-width: 0; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.fn-site { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; margin: -6px -4px -6px 0; cursor: pointer; }
.fn-site input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.grip { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 32px; color: var(--icon); cursor: grab; touch-action: none; }
.grip:hover { color: var(--ink); }
.grip .i { vertical-align: 0; }
.is-dragging { opacity: .55; }
.is-dragging, .is-dragging * { cursor: grabbing !important; }

/* Вкладки воронки: Колонки · Поля карточки · Шаблоны документов */
.fd-tabs { flex: none; display: flex; gap: 2px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.fd-tabs::-webkit-scrollbar { display: none; }
.fd-tabs a { display: inline-flex; align-items: center; gap: 6px; height: 44px; padding: 0 10px; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.fd-tabs a:hover { color: var(--ink); }
.fd-tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); }
.fd-row-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.fd-site { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; color: var(--ink-2); }
.fd-site .i { margin-top: 1px; }

/* Колонки воронки */
.stg-list { display: grid; gap: 6px; }
.stg-row { display: grid; grid-template-columns: 20px 32px minmax(0, 1fr) 128px 92px 32px; gap: 8px; align-items: center; padding: 6px 8px 6px 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.stg-row .input { height: 36px; }
.stg-row.is-start .grip { visibility: hidden; }
.stg-swatch { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; cursor: pointer; }
.stg-swatch::before { content: ""; width: 18px; height: 18px; border-radius: 50%; background: var(--stage); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.stg-swatch:hover { background: var(--bg); }
.stg-kind { display: flex; align-items: center; min-height: 32px; font-size: 13px; }
.stg-kind .check { min-height: 32px; gap: 8px; }
.stg-count { font-size: 12.5px; color: var(--ink-3); text-align: right; white-space: nowrap; }
.stg-row .icon-btn-sm:disabled { opacity: .35; cursor: default; }
.stg-row .icon-btn-sm:disabled:hover { background: none; color: var(--ink-2); }
.stg-palette { display: grid; grid-template-columns: repeat(5, 28px); gap: 6px; padding: 8px; min-width: 0; left: 0; right: auto; }
.stg-palette button { width: 28px; height: 28px; padding: 0; border: 2px solid transparent; border-radius: 50%; background: var(--stage); cursor: pointer; }
.stg-palette button[aria-pressed="true"] { border-color: var(--surface); box-shadow: 0 0 0 2px var(--ink); }
.stg-add { justify-self: start; }
.choice { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; align-items: start; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--r-md); cursor: pointer; }
.choice input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice b { display: block; font-weight: 500; }
.choice span { font-size: 12.5px; color: var(--ink-2); }
.choice-list { display: grid; gap: 8px; }

@media (max-width: 1280px) {
  .admin-work.is-funnels { grid-template-columns: 290px minmax(0, 1fr); }
  .stg-row { grid-template-columns: 20px 32px minmax(0, 1fr) 118px 80px 32px; }
}
@media (max-width: 768px) {
  .fn-cols { padding: 0 12px 0 14px; }
  .fn-row[aria-current="true"] { background: var(--surface); border-color: var(--line); }
  .fd-row-2 { grid-template-columns: minmax(0, 1fr); }
  /* колонка в две строки: ⋮⋮ · цвет · название · удалить / конечная · карточек */
  .stg-row { grid-template-columns: 20px 32px minmax(0, 1fr) 36px; grid-template-areas: "g c n d" ". . k n2"; row-gap: 2px; }
  .stg-row > .grip { grid-area: g; }
  .stg-row > .pop-wrap { grid-area: c; }
  .stg-row > .input { grid-area: n; height: 40px; }
  .stg-row > .stg-kind { grid-area: k; grid-column: 3; }
  .stg-row > .stg-count { grid-area: n2; display: none; }
  .stg-row > .icon-btn { grid-area: d; }
  .stg-kind { justify-content: space-between; gap: 12px; }
  .stg-kind::after { content: attr(data-count); font-size: 12.5px; color: var(--ink-3); }
}

/* =========================================================
   Администрирование → Воронки и поля → «Поля карточки»: конструктор полей.
   Список полей во вкладке воронки; правка поля — в окне (телефон — нижний лист).
   ========================================================= */
.fl-row { display: grid; grid-template-columns: 20px 32px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px 8px 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color .15s ease; }
.fl-row:hover { border-color: var(--line-strong); }
.fl-row.is-system { cursor: default; background: var(--surface-2); }
.fl-row.is-system:hover { border-color: var(--line); }
.fl-type { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--bg); color: var(--ink-2); }
.fl-type .i { vertical-align: 0; }
.fl-main { min-width: 0; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: inherit; }
.fl-label { font-weight: 500; color: var(--ink); }
.fl-sub { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; font-size: 12.5px; color: var(--ink-2); }
.fl-marks { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; }
.code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; color: var(--ink-2); }
.fl-empty { padding: 20px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); text-align: center; color: var(--ink-2); }

/* Окно поля */
.sheet.sheet-wide { width: min(620px, calc(100vw - 32px)); max-height: 88vh; }
.sheet.sheet-wide .sheet-foot { position: sticky; bottom: 0; background: var(--surface); }
.sheet-form.ff { display: grid; gap: 16px; padding: 16px; }
.ff-types { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ff-type { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 64px; padding: 8px 4px; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); color: var(--ink-2); font: inherit; font-size: 12.5px; font-weight: 500; text-align: center; cursor: pointer; }
.ff-type .i { color: var(--icon); }
.ff-type:hover { border-color: var(--icon); color: var(--ink); }
.ff-type[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.ff-type[aria-pressed="true"] .i { color: var(--accent); }
.ff-type:disabled { opacity: .45; cursor: default; }
.ff-type:disabled:hover { border-color: var(--line-strong); color: var(--ink-2); }
.opt-list { display: grid; gap: 6px; }
.opt-row { display: grid; grid-template-columns: 20px minmax(0, 1fr) 64px 32px; gap: 6px; align-items: center; }
.opt-row .input { height: 36px; }
.opt-used { font-size: 12px; color: var(--ink-3); white-space: nowrap; }
.ff-checks { display: grid; gap: 4px; }
.ff-checks .check { align-items: flex-start; }
.ff-checks .check input { margin-top: 1px; }
.ff-checks .check b { display: block; font-weight: 500; }
.ff-checks .check span span { display: block; font-size: 12.5px; color: var(--ink-2); }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.code-row .input { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.ff-preview { padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); }
.ff-preview-title { margin-bottom: 8px; font-size: 12px; font-weight: 500; color: var(--ink-3); }

@media (max-width: 768px) {
  .fl-row { grid-template-columns: 20px 32px minmax(0, 1fr); }
  .fl-row > .fl-marks { grid-column: 3; justify-content: flex-start; }
  .ff-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ff-type { flex-direction: row; justify-content: flex-start; min-height: 44px; padding: 6px 12px; gap: 8px; text-align: left; }
  .sheet.sheet-wide { width: 100%; max-height: 92vh; }
  .sheet.sheet-wide .sheet-foot { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .opt-row .input { height: 40px; }
}

/* =========================================================
   Администрирование → Шаблоны документов (вкладка воронки): шаблоны Word с кодами ${…},
   из них в карточке «Сформировать». Список и окно шаблона — как у «Полей карточки».
   ========================================================= */
.tp-row { display: grid; grid-template-columns: 20px 30px minmax(0, 1fr) auto 36px; gap: 10px; align-items: center; padding: 8px 8px 8px 4px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color .15s ease; }
.tp-row:hover { border-color: var(--line-strong); }
.tp-drop { flex-direction: row; justify-content: center; gap: 10px; padding: 16px; font-size: 13px; }
.tp-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }

/* Какие коды можно вставить — раскрывающийся справочник */
.codes-ref { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.codes-ref > summary { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; font-weight: 500; cursor: pointer; list-style: none; }
.codes-ref > summary::-webkit-details-marker { display: none; }
.codes-ref > summary .i:last-child { margin-left: auto; color: var(--icon); transition: transform .15s ease; }
.codes-ref[open] > summary .i:last-child { transform: rotate(180deg); }
.codes-ref-body { display: grid; gap: 4px; padding: 0 12px 12px; }
.codes-group { padding: 8px 0 2px; font-size: 12px; font-weight: 500; color: var(--ink-3); }

/* Строка кода: ${код} · что подставится · копировать / подсказка */
.cd-row { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 34px; padding: 2px 4px 2px 8px; border-radius: var(--r-sm); }
.cd-row:hover { background: var(--surface); }
.cd-row .code { color: var(--ink); overflow-wrap: anywhere; }
.cd-what { font-size: 13px; color: var(--ink-2); }
.cd-row.is-bad { background: var(--warn-soft); }
.cd-row.is-bad .code { color: var(--warn); font-weight: 600; }
.cd-row.is-bad .cd-what { color: var(--warn); }
.cd-list { display: grid; gap: 2px; }
.tp-file { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
.tp-file-name { flex: 1; min-width: 0; }
.tp-file-name b { display: block; font-weight: 500; overflow-wrap: anywhere; }
.tp-file-name span { font-size: 12.5px; color: var(--ink-2); }
.tp-test { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.field .hint.is-ok { display: flex; gap: 6px; align-items: center; }
@media (max-width: 900px) { .tp-drop { display: none; } }

@media (max-width: 768px) {
  .tp-row { grid-template-columns: 20px 30px minmax(0, 1fr) 36px; }
  .tp-row > .tp-status { grid-column: 3; grid-row: 2; }
  .tp-row > .icon-btn { grid-column: 4; grid-row: 1; }
  .cd-row { grid-template-columns: minmax(0, 1fr) auto; padding: 6px 4px 6px 8px; }
  .cd-row > .cd-what { grid-column: 1; grid-row: 2; }
  .cd-row > :last-child { grid-column: 2; grid-row: 1 / span 2; }
  .tp-test { grid-template-columns: minmax(0, 1fr); }
}

/* =========================================================
   Карточка → «Сформировать»: строка шаблона — значок Word и название (щелчок — сформировать).
   Справа: данные полные — «скачать»; чего-то не хватает — янтарный (!), по нему — какие поля пусты и «Заполнить».
   ========================================================= */
.gen-pop { padding: 6px; }
.gen-item { display: grid; grid-template-columns: minmax(0, 1fr) 36px; align-items: center; border-radius: var(--r-sm); }
.gen-item + .gen-item { margin-top: 2px; }
.gen-item:hover, .gen-item:has(:focus-visible) { background: var(--bg); }
.gen-main { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; padding: 6px 4px 6px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.gen-main:focus-visible { box-shadow: none; }
.gen-main .file-ico { width: 24px; height: 30px; }
.gen-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gen-side { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--icon); cursor: pointer; }
.gen-side .i { vertical-align: 0; }
.gen-item:hover .gen-side:not(.is-warn) { color: var(--accent); }
.gen-side.is-warn { color: var(--warn); }
.gen-warn { position: relative; display: inline-flex; }
.gen-warn:hover .gen-side, .gen-warn.is-open .gen-side, .gen-side.is-warn:focus-visible { background: var(--warn-soft); }
/* Подсказка у (!): при наведении (и пока мышь на ней — можно нажать «Заполнить»), по фокусу, на телефоне — по нажатию */
.gen-tip { position: absolute; z-index: 5; top: calc(100% + 2px); right: 0; display: none; width: 250px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-2); font-size: 12.5px; color: var(--ink-2); cursor: default; }
.gen-tip::before { content: ""; position: absolute; left: 0; right: 0; top: -6px; height: 6px; }   /* мостик: подсказка не гаснет на пути мыши */
.gen-warn:hover .gen-tip, .gen-warn:has(:focus-visible) .gen-tip, .gen-warn.is-open .gen-tip { display: block; }
.gen-item.is-busy, .gen-item.is-busy .gen-main { cursor: progress; }
/* Пока есть (!) — сформировать нельзя: название и значок бледные */
.gen-item.is-blocked .gen-name { color: var(--ink-3); }
.gen-item.is-blocked .gen-main .file-ico { opacity: .45; }
.gen-why-title { display: block; margin-bottom: 2px; font-weight: 500; color: var(--warn); }
.gen-why-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; color: var(--ink); }
.gen-why-row .btn { height: 28px; padding: 0 8px; color: var(--accent); }
.gen-foot { margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--line); font-size: 12.5px; }
.gen-foot a { font-weight: 500; }
.spin { display: inline-block; width: 15px; height: 15px; flex: none; border: 2px solid var(--accent-line); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 768px) {
  .gen-main { min-height: 48px; }
  /* телефон: пояснение раскрывается под строкой шаблона во всю ширину (всплывающее ушло бы за край листа) */
  .gen-warn { display: contents; }
  .gen-tip { position: static; grid-column: 1 / -1; width: auto; margin: 0 8px 8px 44px; box-shadow: none; background: var(--warn-soft); border-color: transparent; }
  .gen-tip::before { display: none; }
  .gen-why-row .btn { height: 34px; }
}
/* «Заполнить» из «Сформировать»: поле подсвечивается, чтобы его было видно сразу */
.field.is-flash .input, .field.is-flash .textarea, .field.is-flash .select, .field.is-flash .multi { animation: field-flash 1.8s ease; }
@keyframes field-flash { 0%, 45% { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(26, 125, 47, .18); } 100% { box-shadow: 0 0 0 0 rgba(26, 125, 47, 0); } }

/* =========================================================
   Администрирование → Заявки с сайта: подключение сайтов, сопоставление полей форм CF7 с полями карточки,
   журнал заявок. Одна панель на всю ширину рабочей области (без списка слева).
   ========================================================= */
.admin-work.is-single { grid-template-columns: minmax(0, 1fr); }
.ld-conn { display: grid; gap: 6px; }
.ld-site { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
.ld-site > .i { color: var(--icon); }
.ld-site b { font-weight: 500; }
.ld-site-meta { font-size: 12.5px; color: var(--ink-2); }
.ld-site .mark { margin-left: auto; }
/* Воронка сайта: у каждого сайта своя, двум сайтам можно выбрать одну */
.ld-route { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.ld-route .select, .ld-route .select-btn { width: 170px; height: 34px; }
.ld-route + .mark { margin-left: 10px; }
.mp-tools { display: flex; align-items: center; gap: 10px; }
.mp-tools .select, .mp-tools .select-btn { width: auto; min-width: 260px; max-width: 100%; }

/* Строка сопоставления: подпись и код поля формы · пример · → · поле карточки и что встанет */
.mp-cols, .mp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr) 18px minmax(250px, 320px); gap: 12px; }
.mp-cols { margin-bottom: -10px; padding: 0 13px; font-size: 12px; color: var(--ink-3); }
.mp-list { display: grid; gap: 6px; }
.mp-row { align-items: start; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.mp-row.is-new { border-color: #e8c890; box-shadow: inset 3px 0 0 var(--warn); }
.mp-src { display: grid; gap: 4px; min-width: 0; }
.mp-src .input { height: 36px; font-weight: 500; }
.mp-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--ink-2); }
.mp-ex { min-width: 0; padding-top: 8px; overflow-wrap: anywhere; }
.mp-ex-label { display: none; }
.mp-arrow { padding-top: 9px; color: var(--icon); }
.mp-arrow .i { vertical-align: 0; }
.mp-dst { display: grid; gap: 6px; min-width: 0; }
.mp-dst .select { height: 36px; }
.mp-notes { display: grid; gap: 4px; }
.mp-note { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); }
.mp-note .i { margin-top: 1px; }
.mp-note.is-ok { color: var(--ink); }
.mp-note.is-ok .i { color: var(--accent); }
.mp-note.is-warn, .mp-note.is-warn .i { color: var(--warn); }
.mp-notes .error { font-size: 12.5px; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }
.mp-site { display: flex; align-items: center; gap: 6px; padding: 4px 2px 0; color: var(--ink); }

/* Журнал заявок */
.lj-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lj-search { flex: 1 1 280px; min-width: 0; }
.lj-table td { vertical-align: top; }
.lj-sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--ink-2); }
.lj-sub.is-warn { color: var(--warn); font-weight: 500; }
.lj-when { white-space: nowrap; color: var(--ink-2); }
.lj-result { display: table-cell; }
.lj-result .mark { white-space: normal; }
.lj-issue { display: flex; margin-top: 4px; }
.lj-card { font-weight: 500; }
.lj-table tr.is-rejected .t-title { color: var(--ink-2); }
.lj-more { justify-self: center; }

/* Заявка (окно): итог · откуда · поля формы и куда легли */
.ld-result { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft); }
.ld-result > .i { color: var(--accent); align-self: start; margin-top: 1px; }
.ld-result b { font-weight: 500; }
.ld-result span { display: block; font-size: 12.5px; color: var(--ink-2); }
.lf-list { display: grid; gap: 2px; }
.lf-row { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr) minmax(0, 210px); gap: 10px; align-items: start; padding: 6px 8px; border-radius: var(--r-sm); font-size: 13px; }
.lf-row:hover { background: var(--surface-2); }
.lf-row.is-bad { background: var(--warn-soft); }
.lf-src b { display: block; font-weight: 500; }
.lf-val { overflow-wrap: anywhere; }
.lf-ok { display: flex; gap: 6px; color: var(--ink); }
.lf-ok .i { margin-top: 2px; color: var(--accent); }
.lf-bad { display: flex; gap: 6px; color: var(--warn); }
.lf-bad .i { margin-top: 2px; }
.ld-raw { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface); font: 12px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 1280px) {
  .mp-cols, .mp-row { grid-template-columns: minmax(0, 1fr) minmax(0, .7fr) 18px minmax(220px, 280px); }
}
@media (max-width: 1100px) {
  /* узко для четырёх колонок: пример уходит под подпись */
  .mp-cols { display: none; }
  .mp-row { grid-template-columns: minmax(0, 1fr) 18px minmax(220px, 300px); }
  .mp-src { grid-column: 1; grid-row: 1; }
  .mp-ex { grid-column: 1; grid-row: 2; padding-top: 0; font-size: 13px; }
  .mp-ex-label { display: inline; margin-right: 6px; color: var(--ink-3); }
  .mp-arrow { grid-column: 2; grid-row: 1; }
  .mp-dst { grid-column: 3; grid-row: 1 / span 2; }
}
@media (max-width: 768px) {
  /* одна панель, а не деталь списка: на телефоне стоит на месте, страница прокручивается целиком */
  .admin-work.is-single .ud { position: static; transform: none; visibility: visible; transition: none; margin: 0 12px; padding-top: 0; border: 1px solid var(--line); border-radius: var(--r-md); }
  .admin-work.is-single .ud-head { display: none; }
  .admin-work.is-single .ud-body { overflow: visible; padding: 14px 12px; }
  .admin-work.is-single .ud-foot:not(.save-bar) { display: none; }
  .ld-route { order: 5; width: 100%; margin: 4px 0 0; }
  .ld-route .select, .ld-route .select-btn { flex: 1; width: auto; height: 40px; }
  .ld-route + .mark { margin-left: auto; }
  .admin-work.is-single .ud-foot { position: sticky; bottom: 0; z-index: 5; background: var(--surface); border-radius: 0 0 var(--r-md) var(--r-md); }
  .admin-work.is-single { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .mp-tools { flex-wrap: wrap; gap: 4px; }
  .mp-tools .select, .mp-tools .select-btn { width: 100%; min-width: 0; }
  .mp-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .mp-src, .mp-ex, .mp-dst { grid-column: 1; grid-row: auto; }
  .mp-arrow { display: none; }
  .mp-src .input, .mp-dst .select { height: 40px; }
  .lj-search { flex-basis: 100%; }
  .lj-tools .seg { width: 100%; overflow-x: auto; }
  .lj-tools .seg button { flex: 1; }
  .lj-table tr { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .lj-result { display: block; }
  .ld-result { grid-template-columns: 18px minmax(0, 1fr); }
  .ld-result .btn { grid-column: 1 / -1; }
  .lf-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ld-where .cd-row { grid-template-columns: minmax(0, 130px) minmax(0, 1fr); padding: 4px 8px; }
  .ld-where .cd-row > .cd-what { grid-column: 2; grid-row: 1; }
  .ld-where .cd-row > :last-child:empty { display: none; }
  .lf-dst { grid-column: 1 / -1; }
}

/* =========================================================
   Администрирование → Почтовые ящики: список ящиков · ящик (название, подключение с проверкой, доступ сотрудников).
   Список и деталь — те же .ul-* / .ud-*, раскладка — как у «Воронок и полей».
   ========================================================= */
.mb-row { grid-template-columns: 32px minmax(0, 1fr); }
.mb-row .ul-meta { flex-direction: column; gap: 0; }   /* название и сервис · кому выдан — всегда двумя строками */
.mb-row.is-off .fl-type { color: var(--ink-3); }
.mb-row.is-off .ul-name { color: var(--ink-2); }
.mb-hint { font-size: 12.5px; color: var(--ink-2); }
.mb-list-hint { padding: 8px 6px 0; font-size: 12.5px; color: var(--ink-3); }
.mb-prov { width: 100%; }
.mb-prov button { flex: 1; }
.mb-servers { display: grid; gap: 12px; }
.mb-host { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 6px; }
.mb-check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.mb-check { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-2); font-size: 13px; }
.mb-ok { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-radius: var(--r-md); background: var(--accent-soft); font-size: 13px; }
.mb-ok > .i { color: var(--accent); margin-top: 1px; }
.mb-ok b { display: block; font-weight: 500; }
.mb-ok span { display: block; margin-top: 2px; color: var(--ink-2); }
.mb-access { display: grid; gap: 2px; }
@media (max-width: 768px) {
  .mb-prov button { padding: 0 6px; height: 36px; }
  .mb-check-row .btn { width: 100%; }
}

/* =========================================================
   Администрирование → Общие настройки: порог «застрявшей» карточки (app_settings.attention_days).
   Одна панель на всю ширину, как «Заявки с сайта»; текст — колонкой для чтения.
   ========================================================= */
.st-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 24px; align-items: start; }
.st-main { display: grid; gap: 20px; min-width: 0; }
.st-sec { display: grid; gap: 16px; }
.st-h { font-size: 15px; font-weight: 500; }
.st-row { display: flex; align-items: center; gap: 10px; }
.num-step { display: inline-flex; align-items: center; gap: 6px; }
.num-step .icon-btn { width: 40px; height: 40px; font-size: 18px; font-weight: 500; }
.num-step .input { width: 64px; text-align: center; font-weight: 500; }
.st-unit { color: var(--ink-2); }
/* Правая колонка: карточки, которые сейчас попадают под порог */
.st-side { position: sticky; top: 0; display: grid; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.st-side-head { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; background: var(--warn-soft); font-size: 13px; }
.st-side-head .i { color: var(--warn); margin-top: 1px; }
.st-side-head b { font-weight: 500; }
.st-side-head.is-ok { background: var(--accent-soft); }
.st-side-head.is-ok .i { color: var(--accent); }
.st-side-empty, .st-side-foot { padding: 12px 14px; font-size: 12.5px; color: var(--ink-2); }
.st-side-foot { border-top: 1px solid var(--line); }
.st-list { margin: 0; padding: 4px 0; list-style: none; max-height: 420px; overflow-y: auto; }
.st-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; font-size: 13px; }
.st-list li + li { border-top: 1px solid var(--line); }
.st-name { min-width: 0; color: var(--ink); }
.st-name .muted { display: block; font-size: 12.5px; }
.st-list .st-days { display: inline-flex; align-items: center; gap: 4px; color: var(--warn); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-where { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.st-where-t { font-weight: 500; color: var(--ink); }
.st-where b { font-weight: 500; color: var(--ink); }
.st-ico { color: var(--warn); }
@media (max-width: 1100px) {
  .st-body { grid-template-columns: minmax(0, 1fr); }
  .st-side { position: static; }
}

/* =========================================================
   Администрирование → Импорт и экспорт (пока только импорт карточек из Excel, раздел 7.6 плана):
   шаг 1 — шаблон, шаг 2 — проверка без загрузки и загрузка.
   ========================================================= */
.im-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; min-width: 0; }
.im-step { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }   /* колонка не шире панели: длинный фильтр и таблица не распирают телефон */
.im-step + .im-step { padding-top: 20px; border-top: 1px solid var(--line); }
.im-step-head { display: flex; align-items: center; gap: 10px; }
.im-num { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 700; }
.im-funnels { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.im-cols { display: grid; gap: 8px; }
.im-cols-t { font-size: 13px; font-weight: 500; }
.im-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.im-chips .tag.is-req { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.im-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.im-sum { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border-radius: var(--r-md); font-size: 13px; }
.im-sum > .i { margin-top: 1px; }
.im-sum b { display: block; font-weight: 500; }
.im-sum span { display: block; margin-top: 2px; color: var(--ink-2); }
.im-sum .im-actions { margin-top: 10px; }
.im-sum.is-ok { background: var(--accent-soft); }
.im-sum.is-ok > .i { color: var(--accent); }
.im-sum.is-err { background: var(--danger-soft); }
.im-sum.is-err > .i, .im-sum.is-err b { color: var(--danger); }
.im-progress { display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.im-bar { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; }
.im-bar span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s ease; }
.im-prev { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.im-table td { vertical-align: top; }
.im-table tbody tr { cursor: default; }
.im-fields { display: block; color: var(--ink); }
.im-msg { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; font-size: 12.5px; font-weight: 500; }
.im-msg .i { margin-top: 1px; }
.im-table tr.im-err td { background: var(--danger-soft); }
.im-table tr.im-err .im-msg { color: var(--danger); }
.im-table tr.im-warn .im-msg { color: var(--warn); }
.im-table tr.im-dup td { color: var(--ink-3); }
.im-table tr.im-dup .im-msg { color: var(--ink-3); font-weight: 400; }
@media (max-width: 768px) {
  .im-actions .btn { flex: 1 1 auto; }
  .im-table tr.im-err { background: var(--danger-soft); border-color: #e7b9b3; }
  .im-table tr.im-err td { background: transparent; }
}

/* =========================================================
   Редактор текста письма и подписи ящика (LK.richEditor, как RichMailEditor 360): панель над полем,
   поле contenteditable. Подсказка в пустом поле — data-placeholder.
   ========================================================= */
.rte { display: grid; grid-template-rows: auto minmax(0, 1fr); border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); transition: border-color .15s ease; }
.rte:focus-within { border-color: var(--accent); }
.rte-bar { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 4px 6px; border-bottom: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.rte-btn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-2); cursor: pointer; }
.rte-btn .i { width: 17px; height: 17px; vertical-align: 0; }
.rte-btn:hover { background: var(--bg); color: var(--ink); }
.rte-btn[aria-pressed="true"], .rte-btn.is-open { background: var(--accent-soft); color: var(--accent); }
.rte-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--line-strong); }
.rte-anchor { position: relative; display: inline-flex; }
.rte-pop { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; display: grid; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-2); }
.rte-pop-link { width: 280px; }
.rte-pop .input { height: 36px; }
.rte-swatches { display: grid; grid-template-columns: repeat(5, 24px); gap: 6px; }
.rte-sw { width: 24px; height: 24px; padding: 0; border: 2px solid var(--surface); border-radius: 50%; box-shadow: 0 0 0 1px var(--line-strong); cursor: pointer; }
.rte-sw:hover { box-shadow: 0 0 0 2px var(--ink-2); }
.rte-pop-link-btn { justify-self: start; padding: 2px 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.rte-pop-actions { display: flex; justify-content: flex-end; gap: 6px; }
.rte-err { font-size: 12.5px; color: var(--danger); }
.rte-area:focus, .rte-area:focus-visible { outline: none; box-shadow: none; }   /* фокус — зелёная рамка всего редактора */
.rte-area { min-height: 120px; max-height: 380px; overflow-y: auto; padding: 10px 12px; line-height: 1.5; color: var(--ink); outline: none; overflow-wrap: anywhere; }
.rte-area[data-empty]::before { content: attr(data-placeholder); color: var(--ink-3); pointer-events: none; }
.rte-area img { max-width: 100%; height: auto; border-radius: 4px; vertical-align: bottom; }
.rte-area a, .msg-body.is-html a { color: var(--accent); text-decoration: underline; }
.rte-area [data-signature] { color: var(--ink-2); }
.rte-area > div, .rte-area > p { margin: 0; }
/* Письмо в переписке, набранное в редакторе: HTML (в продакшене — после HTMLPurifier, в iframe sandbox) */
.msg-body.is-html { white-space: normal; }
.msg-body.is-html img { max-width: 100%; height: auto; }
.msg-body.is-html [data-signature] { color: var(--ink-2); }
@media (max-width: 768px) {
  .rte-btn { width: 36px; height: 36px; }
  .rte-pop-link { width: min(280px, calc(100vw - 48px)); }
  .rte-anchor { position: static; }   /* окошко цвета и ссылки — от левого края панели, иначе на узком экране уходит за край */
  .rte-pop { left: 6px; }
}

/* =========================================================
   Каркас ЛК (этап 1): «Выйти» — кнопка формы POST (защита от выхода по чужой ссылке), вид — как у ссылок шапки и меню;
   пустой раздел до своего этапа; «Администрирование → Проверка сервера».
   ========================================================= */
.logout-form { display: contents; }
button.nav-link { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.mark.is-danger, .mark.is-danger .i { color: var(--danger); }
.stub-wrap { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; padding: 0 20px 20px; max-width: 920px; }
.srv-group { display: grid; }
.srv-title { padding: 12px 16px; font-size: 15px; font-weight: 500; border-bottom: 1px solid var(--line); }
.srv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, auto) 150px; align-items: center; gap: 4px 16px; padding: 10px 16px; font-size: 13px; }
.srv-row + .srv-row { border-top: 1px solid var(--line); }
.srv-name { min-width: 0; font-weight: 500; color: var(--ink); }
.srv-hint { display: block; margin-top: 2px; font-size: 12.5px; font-weight: 400; color: var(--ink-2); }
.srv-value { color: var(--ink-2); overflow-wrap: anywhere; }
@media (max-width: 768px) {
  .stub-wrap { padding: 0 12px 16px; }
  .srv-row { grid-template-columns: minmax(0, 1fr) auto; }
  .srv-value { grid-column: 1; grid-row: 2; }
  .srv-row .mark { grid-column: 2; grid-row: 1 / span 2; }
}
