/* ЛИС AI — стили интерфейса. Внешний файл: CSP запрещает inline-стили и скрипты. */

:root {
  --bg: #0f1620;
  --panel: #18212e;
  --panel-2: #1f2a3a;
  --border: #2c3a4f;
  --text: #eef3fa;
  --muted: #a8b8cc;
  --accent: #2f6fb5;
  --accent-2: #4e94dd;
  --ok: #2e7d54;
  --warn: #b8612f;
  --danger: #b8452f;
  --radius: 12px;
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); }

h1 { margin: 0 0 6px; font-size: 30px; line-height: 1.25; letter-spacing: -.01em; }
h2 { margin: 0 0 10px; font-size: 19px; line-height: 1.3; }
h3 { margin: 22px 0 10px; font-size: 15px; text-transform: uppercase;
     letter-spacing: .08em; color: var(--muted); font-weight: 600; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: "Cascadia Mono", Consolas, monospace; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ каркас */

.layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  max-height: 100vh;
  overflow-y: auto;
}

.brand { font-size: 21px; font-weight: 700; letter-spacing: .02em; }
.brand-sub { font-size: 12px; color: var(--muted); margin-top: -10px;
             text-transform: uppercase; letter-spacing: .1em; }

nav { display: flex; flex-direction: column; gap: 3px; }

.nav-sections { margin-top: 4px; }

.nav-group {
  margin: 8px 0 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.3;
}

.nav-item:hover { background: var(--panel-2); }
.nav-item.active { background: var(--accent); color: #fff; }
.nav-item.disabled { color: var(--muted); cursor: default; }
.nav-item.disabled:hover { background: none; }
.nav-item.sub { font-size: 14px; color: var(--muted); }
.nav-item.sub:hover { color: var(--text); }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #0b1420;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}
.nav-item.active .badge { background: #fff; }

.who {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.who-name { font-weight: 600; }
.who-links { display: flex; gap: 12px; align-items: center; margin-top: 4px; }

main { padding: 24px 28px 40px; max-width: 1560px; }

/* --------------------------------------------------------------- элементы */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.card-head h2 { margin: 0; }

.tag {
  font-size: 12px;
  text-transform: lowercase;
  letter-spacing: .02em;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.tag.tiny { font-size: 11px; padding: 0 6px; }
.tag.warn { border-color: var(--warn); color: #ffd0b3; }

.pill {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.pill.prio-critical { border-color: var(--danger); color: #ffd2c6; }
.pill.prio-high { border-color: var(--warn); color: #ffe0c6; }
.pill.danger { border-color: var(--danger); background: rgba(184, 69, 47, .22); color: #ffd2c6; }
.pill.warn { border-color: var(--warn); background: rgba(184, 97, 47, .18); color: #ffe0c6; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 200px; }
/* Поля «название подзадачи», «пункт чек-листа» и «что делали» в учёте времени
   раньше были шириной в один короткий input — текст не помещался. Тянем их на
   всю доступную ширину строки формы. */
.row .field-wide { flex: 1 1 360px; min-width: 260px; }
.inline { display: inline-flex; gap: 6px; align-items: center; }

.link {
  background: none;
  border: none;
  color: var(--accent-2);
  padding: 0;
  text-decoration: underline;
  font: inherit;
}

label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
label.checkbox { flex-direction: row; align-items: center; gap: 8px; }

input, select, button, textarea {
  font: inherit;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}

input:focus, select:focus, button:focus, textarea:focus {
  outline: 2px solid var(--accent-2);
  outline-offset: 1px;
}

button { cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); }
button.primary:hover { background: var(--accent-2); }
button:disabled { cursor: not-allowed; opacity: .55; }
/* Удаление — красноватая кнопка: видно, что действие необратимое. */
button.danger {
  background: rgba(184, 69, 47, .22);
  border-color: var(--danger);
  color: #ffd2c6;
}
button.danger:hover { background: rgba(184, 69, 47, .34); }
/* Кнопки в строке журнала импортов стоят рядом, а не друг под другом. */
.import-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.import-actions form { margin: 0; }
/* Кнопка удаления на карточке клиента — отдельной строкой справа. */
.card-actions { display: flex; justify-content: flex-end; margin: 0 0 8px; }

.centered { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login { width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin-bottom: 4px; }

.alert {
  background: rgba(184, 97, 47, .18);
  border: 1px solid var(--warn);
  color: #ffd9c2;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.alert.ok {
  background: rgba(47, 111, 181, .18);
  border-color: var(--accent);
  color: #cfe4ff;
}

/* ------------------------------------------------------- таблицы и списки */

.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.table th { color: var(--muted); font-weight: 500; font-size: 13px; }
.table tr:hover td { background: rgba(255, 255, 255, .02); }

.counters { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.counter {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 120px;
  text-align: center;
}
.counter.has-open { border-color: var(--accent-2); }
.counter-value { font-size: 24px; font-weight: 700; }
.counter-title { font-size: 13px; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* ------------------------------------------------------- директорский пульт */

.dash-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.dash-head-text p { margin: 0; }

.kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 138px;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--panel);
  text-decoration: none;
  color: var(--text);
}
.kpi:hover { border-color: var(--accent-2); }
.kpi-value { font-size: 27px; font-weight: 700; line-height: 1.1; }
.kpi-label { font-size: 12.5px; color: var(--muted); }
.kpi.danger { border-color: var(--danger); }
.kpi.danger .kpi-value { color: #ffb9a6; }
.kpi.warn { border-color: var(--warn); }
.kpi.warn .kpi-value { color: #ffd0b3; }

.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 0 0 18px;
}

.dash-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  text-decoration: none;
  color: inherit;
}

.dash-card:hover { border-color: var(--accent-2); }
.dash-card-value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.dash-card-title { font-size: 13px; color: var(--muted); }
.dash-card-note { font-size: 11.5px; color: var(--muted); }
.dash-card.danger { border-color: var(--danger); }
.dash-card.danger .dash-card-value { color: #ffb9a6; }
.dash-card.warn { border-color: var(--warn); }
.dash-card.warn .dash-card-value { color: #ffd0b3; }

@media (max-width: 860px) {
  .dash-cards { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
}

.dash {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 1fr);
  gap: 18px;
  align-items: start;
}

.dash-center, .dash-right { min-width: 0; }

/* --- секретарь */

.secretary { border-color: #35507a; }
.secretary p.small { margin: 0 0 4px; }

.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.event {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  background: var(--panel-2);
  flex-wrap: wrap;
}
.event-text { flex: 1; min-width: 220px; }
.event-link { font-size: 13px; white-space: nowrap; }
.event.danger { border-left-color: var(--danger); }
.event.warn { border-left-color: var(--warn); }
.event.ok { border-left-color: var(--ok); }
.event.info { border-left-color: var(--accent-2); }

.proposals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.proposal {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px dashed var(--border);
  background: rgba(47, 111, 181, .07);
}
.proposal-title { font-weight: 600; margin-bottom: 2px; }
.proposal-cta { font-size: 14px; display: inline-block; margin-top: 6px; }

.voice-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
button.voice { padding: 9px 16px; }

/* --- чат */

.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.bubble {
  max-width: 92%;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bubble.me { align-self: flex-end; background: rgba(47, 111, 181, .22); border-color: var(--accent); }
.bubble-who { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.bubble-text { white-space: pre-wrap; }
.bubble-links { display: flex; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-top: 4px; }

.chat-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.chat-input { flex: 1; min-width: 220px; }

/* --- фильтры */

/* Фильтры в карточке стоят в потоке. Раньше панель была sticky с top: 18px:
   при прокрутке она «плавала» над списком и наезжала на сами запросы
   (Согласования, Маркетинг, Поддержка). Наложение убрано — панель
   прокручивается вместе со страницей. */
.filters { position: static; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

/* --- карточки задач */

.tasks { display: flex; flex-direction: column; gap: 12px; }
.task-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--panel-2);
}
.task-card.overdue { border-left-color: var(--danger); }
.task-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.task-title { font-size: 16px; font-weight: 600; line-height: 1.35; margin-bottom: 4px; }
.task-meta { margin-bottom: 10px; }
.task-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.task-actions form { margin: 0; }
.task-actions button { padding: 7px 13px; font-size: 14px; }

/* ------------------------------------------------------ прочие страницы */

.qr { background: #fff; padding: 12px; border-radius: 10px; display: inline-block; }
.qr svg { display: block; width: 220px; height: 220px; }

.codes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.codes code {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 15px;
  letter-spacing: .08em;
  text-align: center;
}

/* ------------------------------------------------------------- адаптив */

@media (max-width: 1180px) {
  .dash { grid-template-columns: minmax(0, 1fr); }
  .filters { position: static; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .nav-sections, .nav-departments { flex-direction: row; flex-wrap: wrap; }
  .who { margin: 0; border-top: none; padding-top: 0; width: 100%; }
  main { padding: 16px; }
  h1 { font-size: 24px; }
  .kpis { width: 100%; }
  .kpi { flex: 1; min-width: 120px; }
}
/* ------------------------------------------------ ИИ-секретарь (страница /ai) */

.chat-log {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 16px;
}

.bubble.tool {
  align-self: flex-start;
  background: rgba(184, 97, 47, .12);
  border: 1px dashed var(--warn);
}
.bubble.tool.proposed { border-style: solid; }
.bubble.bot { background: var(--panel-2); }
.bubble-text { white-space: pre-wrap; word-break: break-word; }

.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.plain-list li { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.plain-list li:last-child { border-bottom: none; }

.kpi-value { font-variant-numeric: tabular-nums; }
/* ------------------------------------------- волна 1C: согласования и уведомления */

.button-like {
  display: inline-block;
  padding: 7px 13px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.button-like:hover { border-color: var(--accent-2); }

.form-stack { display: flex; flex-direction: column; gap: 10px; }

.details-block { margin-top: 12px; }
.details-block summary { cursor: pointer; color: var(--accent-2); font-size: 14px; }

.pill.ok { border-color: var(--ok); color: #b8f0cf; background: rgba(46, 125, 84, .18); }

/* --------------------------- задачи: области списка и кнопки сотрудников ---
   Переключатель «Все / Общие / Мои» и строка сотрудников — заметные, но не
   спорящие с содержимым: счётчики на кнопке читаются сразу. */
.scope-bar { display: flex; flex-direction: column; gap: 8px; }
.scope-switch { display: flex; gap: 8px; flex-wrap: wrap; }
.scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
}
.scope-chip:hover { border-color: var(--accent-2); }
.scope-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.scope-chip.active .tag { background: rgba(255, 255, 255, .22); border-color: transparent; color: #fff; }
.chip-counts { display: inline-flex; gap: 4px; align-items: center; }
.chip-counts .tag { font-variant-numeric: tabular-nums; }

.assignee-bar { display: flex; flex-direction: column; gap: 10px; }
.assignee-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.assignee-chip-group {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: var(--panel-2);
}
.assignee-chip-group:hover { border-color: var(--accent-2); }
.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.assignee-chip.active { background: var(--accent); color: #fff; }
.assignee-chip.active .tag { background: rgba(255, 255, 255, .22); border-color: transparent; color: #fff; }
.assignee-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  border-left: 1px solid var(--border);
  color: var(--accent-2);
  text-decoration: none;
  font-size: 17px;
  font-weight: 700;
}
.assignee-add:hover { background: var(--accent); color: #fff; }

/* Постоянное окно критических уведомлений: не закрывается без подтверждения */
.notif-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100vw - 36px));
  max-height: 60vh;
  overflow: auto;
  z-index: 50;
  background: var(--panel);
  border: 2px solid var(--danger);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .45);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notif-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-weight: 600;
}
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notif-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-2);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--panel-2);
}
.notif-item.notif-critical { border-left-color: var(--danger); }
.notif-item.notif-warning { border-left-color: var(--warn); }
.notif-item-title { font-weight: 600; margin-bottom: 4px; }
.notif-item-body { color: var(--muted); font-size: 13px; }
.notif-item-when { color: var(--muted); font-size: 12px; margin-top: 4px; }
.notif-item-actions { display: flex; gap: 12px; align-items: center; margin-top: 8px; font-size: 13px; }
.notif-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Аварийное окно: постоянное, с усиленной рамкой и заголовком */
.notif-panel.notif-emergency {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px rgba(184, 69, 47, .35), 0 12px 32px rgba(0, 0, 0, .5);
}
.notif-panel.notif-emergency .notif-head { color: #ffd2c6; text-transform: uppercase; }

/* ---------------------------------------------------------------- реальное время */
.live-dot { color: #7ddc7d; font-size: 0.7rem; margin-left: 6px; vertical-align: middle; }
[data-live="offline"] .live-dot { color: #e0a33a; }
[data-live="offline"] .live-dot::after { content: " офлайн"; font-size: 0.65rem; }
[data-live="online"] .live-dot { color: #4cc94c; }
.live-pending { outline: 1px dashed #e0a33a; outline-offset: 4px; border-radius: 6px; }

/* ---------------------------------------------------------------- голос */
.voice-status { display: inline-block; max-width: 42ch; }
.voice-status.error { color: #ffb3a7; }
.voice-status.warn { color: #ffd08a; }
.voice-status.listening { color: #9fe0a0; }
.voice-status.speaking { color: #9fd0ff; }
button.voice.live { background: #2c5c34; border-color: #4cc94c; color: #eaffea; }
button.voice.unsupported { opacity: 0.65; }
.voice-log { margin-top: 10px; max-height: 260px; overflow-y: auto; }
.voice-log:empty { display: none; }
.bubble-links { display: inline-block; margin-top: 6px; font-size: 0.85rem; }

/* ---------------------------------------------------- голос: диагностика этапов */
.voice-panel { margin-top: 8px; }
.voice-stages { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 6px; }
.vstage {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
  padding: 8px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
}
.vstage-name { font-weight: 600; min-width: 15ch; }
.vstage[data-state="unknown"] .vstage-state { color: #9aa4b2; }
.vstage[data-state="running"] .vstage-state { color: #e0c26a; }
.vstage[data-state="ok"] { border-color: #2f6b3a; }
.vstage[data-state="ok"] .vstage-state { color: #7ddc7d; }
.vstage[data-state="fail"] { border-color: #7a3030; }
.vstage[data-state="fail"] .vstage-state { color: #ff9d8f; }
.vstage-note { color: #b9c2cf; font-size: 0.85rem; flex: 1 1 100%; }
.voice-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.voice-fallback {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  border: 1px solid #7a3030; background: rgba(122, 48, 48, 0.12);
}
.tag.ok { background: #2f6b3a; color: #eaffea; }
button.voice.live { background: #2c5c34; border-color: #4cc94c; color: #eaffea; }

/* ------------------------------------------- голос: волна, результаты, этапы */
.voice-wave-wrap { margin: 10px 0 6px; }
#voice-wave {
  display: block; width: 100%; height: 72px; border-radius: 10px;
  background: rgba(20, 26, 34, 0.55); border: 1px solid rgba(255, 255, 255, 0.08);
}
.voice-wave-caption { margin-top: 4px; font-size: 0.8rem; color: #9aa4b2; }
.voice-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 6px; }
button.voice-main { min-width: 190px; }
button.voice-main.live { background: #2c5c34; border-color: #4cc94c; color: #eaffea; }
.voice-status-line {
  margin: 6px 0 10px; font-size: 0.9rem; color: #cfd6df; min-height: 1.4em;
}
.voice-stages { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; }
.vstage {
  display: grid; grid-template-columns: minmax(10ch, 16ch) auto 1fr; gap: 8px;
  align-items: baseline; padding: 7px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
}
.vstage-name { font-weight: 600; }
.vstage[data-state="unknown"] .vstage-state { color: #9aa4b2; }
.vstage[data-state="running"] .vstage-state { color: #e0c26a; }
.vstage[data-state="ok"] { border-color: #2f6b3a; }
.vstage[data-state="ok"] .vstage-state { color: #7ddc7d; }
.vstage[data-state="fail"] { border-color: #7a3030; }
.vstage[data-state="fail"] .vstage-state { color: #ff9d8f; }
.vstage-note { color: #b9c2cf; font-size: 0.85rem; }
.voice-results { display: grid; gap: 6px; margin: 8px 0; }
.vresult {
  padding: 8px 10px; border-radius: 8px; font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.03);
}
.vresult.ok { border-color: #2f6b3a; background: rgba(47, 107, 58, 0.14); }
.vresult.fail { border-color: #7a3030; background: rgba(122, 48, 48, 0.14); }
.voice-heard {
  margin: 8px 0; padding: 8px 10px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.05); border: 1px dashed rgba(255, 255, 255, 0.16);
}
.voice-heard-label { color: #9aa4b2; font-size: 0.85rem; margin-right: 6px; }
.voice-heard-text { font-size: 1rem; }
.voice-heard-text.interim { color: #9aa4b2; font-style: italic; }
.voice-fallback {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid #7a3030; background: rgba(122, 48, 48, 0.12);
}
.voice-fallback-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 8px 0; }
.tag.ok { background: #2f6b3a; color: #eaffea; }

/* --------------------------------------------- прокрутка истории и голосовой чат */
.chat.chat-log {
  max-height: 420px; overflow-y: auto; overscroll-behavior: contain;
  scroll-behavior: smooth;
}
.voice-log { max-height: 300px; overflow-y: auto; }
.chat.chat-log .bubble { word-break: break-word; }

/* Голос: выбор голоса и темпа, сравнение образцов, подтверждение предложения. */
.voice-voicepick {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin: 8px 0 4px;
}

.voice-compare {
  margin: 8px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line, #d8dee4);
  border-radius: 8px;
}

.voice-compare-table th,
.voice-compare-table td {
  vertical-align: middle;
}

.voice-proposal {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--accent, #2f7d54);
  border-radius: 8px;
  background: rgba(47, 125, 84, 0.06);
}

.voice-local-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0;
}
/* Этап 2: карточка задачи и представления. */
.task-fields { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; margin: 10px 0; }
.task-fields dt { color: var(--muted); }
.task-fields dd { margin: 0; }
.preserve-lines { white-space: pre-wrap; }
.strike { text-decoration: line-through; }
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.kanban-column { flex: 0 0 240px; background: var(--panel-2); border-radius: var(--radius); padding: 8px; }
.kanban-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.task-card { display: block; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px; margin-bottom: 8px; text-decoration: none; color: inherit; }
.task-card:hover { border-color: var(--accent); }
.task-card-title { display: block; font-weight: 600; margin-bottom: 2px; }
.task-card.overdue { border-color: var(--danger); }
.link.active { font-weight: 700; text-decoration: underline; }
@media (max-width: 860px) {
  .task-fields { grid-template-columns: 1fr; }
  .kanban { flex-direction: column; }
  .kanban-column { flex: 1 1 auto; }
}

/* Экран выбора пользователя: четыре карточки */
.pick { width: min(980px, 92vw); margin: 6vh auto; }
.pick h1 { margin-bottom: 6px; font-size: 28px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin: 22px 0; }
.pick-card { display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  background: var(--card, #fff); border: 1px solid var(--line, #e3e6ea); border-radius: 14px;
  padding: 18px; cursor: pointer; transition: box-shadow .15s ease, transform .15s ease; }
.pick-card:hover { box-shadow: 0 6px 18px rgba(20, 30, 45, .12); transform: translateY(-1px); }
.pick-card.muted { opacity: .72; }
.pick-role { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7280); }
.pick-name { font-size: 20px; font-weight: 600; }
.pick-hint { font-size: 12px; color: var(--muted, #6b7280); min-height: 32px; }
.pick-card button { margin-top: 8px; width: 100%; }

/* Сотрудники: карточки, кнопки и полоса пространства */

.space-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: linear-gradient(90deg, rgba(47, 111, 181, .28), rgba(47, 111, 181, .12));
  border-bottom: 1px solid var(--accent);
  font-size: 15px;
}
.space-bar-what strong { font-size: 17px; }
.space-bar-actions { display: flex; gap: 8px; align-items: center; }
.space-bar-actions form { margin: 0; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head h1 { margin-bottom: 4px; }

a.button, .button {
  display: inline-block;
  padding: 9px 15px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
}
a.button:hover, .button:hover { border-color: var(--accent-2); }
a.button:visited { color: var(--text); }

.person-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.person-actions form { margin: 0; }
.person-actions .button, .person-actions button { font-size: 14px; padding: 8px 13px; }

.owner-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.owner-name { font-size: 24px; font-weight: 600; }

.people {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.person-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.person-card:hover { border-color: var(--accent); }

.person-name {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
  text-decoration: none;
  line-height: 1.15;
}
.person-name:hover { color: var(--accent-2); text-decoration: underline; }

.person-meta { font-size: 14px; color: var(--muted); margin-top: -6px; }

.person-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}
.person-stats.wide { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.person-stats li { display: flex; flex-direction: column; gap: 2px; }
.stat-value { font-size: 21px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); }

.person-status { margin-top: auto; }

@media (max-width: 860px) {
  .person-name { font-size: 23px; }
  .people { grid-template-columns: 1fr; }
}

/* Рабочий стол и клиенты менеджера */

/* Быстрый доступ на рабочем столе: четыре крупных входа */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px; margin-bottom: 18px; }
.quick-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; color: var(--text); }
.quick-card:hover { border-color: var(--accent); }
.quick-icon { font-size: 22px; color: var(--accent-2); }
.quick-title { font-size: 20px; font-weight: 700; }
.quick-note { color: var(--muted); font-size: 13px; min-height: 34px; }
.quick-action { color: var(--accent-2); font-size: 14px; }

/* Территория и направления */
.territory-form { align-items: flex-end; }
.territory-form label { min-width: 180px; }
.territory-form input[list] { min-width: 220px; }
.direction-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px; }
.direction-tile { display: flex; flex-direction: column; gap: 4px; text-decoration: none;
  border: 1px solid var(--border); background: var(--panel-2); border-radius: var(--radius);
  padding: 14px; color: var(--text); }
.direction-tile:hover { border-color: var(--accent-2); }
.direction-tile.active { border-color: var(--accent); background: rgba(47, 111, 181, .18); }
.direction-icon { font-size: 18px; color: var(--accent-2); }
.direction-title { font-weight: 600; font-size: 15px; }
.direction-note { font-size: 12px; color: var(--muted); }

/* Список организаций с филиалами */
.org-list { display: flex; flex-direction: column; gap: 10px; }
.org-block { border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-2); padding: 12px 14px; }
.org-head { cursor: pointer; display: flex; flex-wrap: wrap; gap: 8px 16px;
  align-items: baseline; }
.org-name { font-size: 17px; font-weight: 600; }
.org-meta { color: var(--muted); font-size: 13px; }
.org-stats { color: var(--muted); font-size: 12px; margin-left: auto; }
.branches { margin-top: 10px; }
.add-branch { margin-top: 10px; }

/* Карточка филиала */
.branch-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px 18px; }
.branch-facts > div { display: flex; flex-direction: column; gap: 2px; }
.fact-label { font-size: 12px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .05em; }
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px; }
.action-block { border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; background: var(--panel-2); }
.action-button { cursor: pointer; font-weight: 600; font-size: 16px; color: var(--accent-2); }
.pill.neutral { border-color: var(--border); color: var(--muted); }

/* Карточка организации: компактная шапка, факты, три действия рядом */
.org-head { align-items: flex-start; }
.org-compact { padding: 16px 18px; }
.org-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 18px; }
.org-facts > div { display: flex; flex-direction: column; gap: 1px; }
.org-next { margin: 12px 0 0; font-size: 14px; }
.action-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px; margin-top: 14px; align-items: start; }
.action-row .action-block { padding: 10px 12px; }
.action-row .action-block form { margin-top: 8px; }

/* История клиента одной лентой */
.history { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 10px; }
.history-item { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px;
  border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.history-time { color: var(--muted); }
.history-body { display: flex; flex-direction: column; gap: 2px; }

@media (max-width: 860px) {
  .history-item { grid-template-columns: 1fr; gap: 2px; }
  .org-stats { margin-left: 0; }
}

/* Рабочий стол: лента работы, задачи, достижения */

.quick-grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
/* Плитки быстрого доступа — сверху по центру рабочего стола */
.quick-block { max-width: 1020px; margin: 0 auto 18px; }
.quick-block .card-head { justify-content: center; }
.desktop-center { margin: 0 auto; }

/* Импорт Excel: контекст территории внутри блока «Организации» */
.import-context { display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  justify-content: space-between; border: 1px dashed var(--border);
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
.import-context p { margin: 0; }
.desk-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: 18px; align-items: start; }
.desk-right { display: flex; flex-direction: column; gap: 18px; }

.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.feed-item { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px;
  border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.feed-when { color: var(--muted); }
.feed-body { display: flex; flex-direction: column; gap: 2px; }

.task-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.task-feed-item { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.task-feed-item.overdue .task-title { color: #ffd2c6; }
.task-feed-item summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 8px;
  align-items: baseline; }
.task-title { font-weight: 600; }
.task-meta { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; }

.period-switch { display: flex; gap: 12px; margin-bottom: 10px; font-size: 13px; }
.period-switch .link.active { font-weight: 700; text-decoration: none; }

.achievements { list-style: none; margin: 0; padding: 0; display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.achievements li { display: flex; flex-direction: column; gap: 2px; }

.org-table .org-link { font-size: 15px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px; align-items: end; }
.form-grid button { grid-column: 1 / -1; justify-self: start; }

@media (max-width: 1100px) {
  .desk-grid { grid-template-columns: minmax(0, 1fr); }
}

/* =========================================================================
   Тема 2.0 — светлая CRM с фиолетовым меню (ТЗ №3, оформление)
   Ниже — слои оформления поверх базовых правил: палитра, каркас, карточки,
   значки, плитки рабочего стола, лента и показатели. Никакой логики здесь нет.
   ========================================================================= */

:root {
  --bg: #f4f2fb;
  --panel: #ffffff;
  --panel-2: #f7f5fd;
  --border: #e8e4f4;
  --text: #1f1637;
  --muted: #7b7594;
  --accent: #6b46ff;
  --accent-2: #6b46ff;
  --ok: #1f9254;
  --warn: #b7791f;
  --danger: #d64545;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(31, 17, 71, .06);
  --shadow-sm: 0 2px 10px rgba(31, 17, 71, .05);
  --sidebar-1: #241046;
  --sidebar-2: #150a2e;
  --sidebar-text: #cfc6ea;
  --sidebar-active: #f1ecff;
  --tile-lavender: #efe7ff;
  --tile-blue: #e3eeff;
  --tile-green: #e2f7ec;
  --tile-orange: #fff0e2;
}

body { background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--accent); }

/* --------------------------------------------------------------- каркас */
.layout { grid-template-columns: 248px minmax(0, 1fr); background: var(--bg); }

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-1) 0%, var(--sidebar-2) 100%);
  border-right: none;
  padding: 20px 14px 16px;
  gap: 16px;
  color: var(--sidebar-text);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 20px;
  font-weight: 700; color: #fff; letter-spacing: .01em; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-sub { font-size: 11px; color: #9c8fc4; margin: -8px 0 0 44px;
  text-transform: none; letter-spacing: .02em; line-height: 1.35; }

.nav-sections, .nav-departments { gap: 2px; }
.nav-group { color: #7f74a8; font-size: 11px; letter-spacing: .12em; margin: 10px 0 4px; }
.nav-item { color: var(--sidebar-text); border-radius: 12px; padding: 9px 12px;
  font-size: 14.5px; gap: 10px; justify-content: flex-start; }
.nav-item .nav-icon { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-item.active { background: var(--sidebar-active); color: #2a1160; font-weight: 600; }
.nav-item.active .nav-icon { opacity: 1; }
.nav-item.disabled { color: #6f6494; }
.nav-item.sub { color: #a99ecb; font-size: 14px; }
.nav-item.sub:hover { color: #fff; }
.nav-label { flex: 1 1 auto; }
.badge { background: #ff7a45; color: #fff; font-weight: 700; min-width: 22px;
  padding: 0 7px; font-size: 12px; border-radius: 999px; }
.nav-item.active .badge { background: #6b46ff; color: #fff; }

.who { border-top: 1px solid rgba(255, 255, 255, .12); color: #fff; padding-top: 12px; }
.who-name { font-weight: 600; }
.who .muted { color: #9c8fc4; }
.who-links { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-top: 6px; }
.who-links a, .who-links button.link { color: #cfc6ea; }
.who-links a:hover, .who-links button.link:hover { color: #fff; }

main { padding: 0 26px 40px; max-width: 1560px; }

/* ------------------------------------------------------------- верхняя панель */
.topbar { display: flex; align-items: center; gap: 14px; justify-content: flex-end;
  padding: 18px 0 6px; }
.topbar-title { margin-right: auto; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.topbar-title small { display: block; font-size: 12.5px; font-weight: 500; color: var(--muted);
  letter-spacing: 0; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
  background: #fff; display: inline-flex; align-items: center; justify-content: center;
  color: #574e77; cursor: pointer; box-shadow: var(--shadow-sm); position: relative; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn .dot { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px;
  border-radius: 999px; background: #ff5b5b; color: #fff; font-size: 11px; font-weight: 700;
  display: none; align-items: center; justify-content: center; padding: 0 4px; }
.icon-btn .dot.on { display: inline-flex; }
.user-chip { display: flex; align-items: center; gap: 10px; background: #fff;
  border: 1px solid var(--border); border-radius: 14px; padding: 6px 12px 6px 8px;
  box-shadow: var(--shadow-sm); text-decoration: none; color: var(--text); }
.user-chip:hover { border-color: var(--accent); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #e7e0ff; color: #4b2bb8;
  font-weight: 700; font-size: 13px; display: inline-flex; align-items: center;
  justify-content: center; flex: none; text-transform: uppercase; }
.user-chip-name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.user-chip-role { font-size: 12px; color: var(--muted); line-height: 1.2; }
.user-chip svg { width: 14px; height: 14px; color: var(--muted); }

/* Меню пользователя под кнопкой с именем (просьба Анжелики). */
.user-menu { position: relative; }
.user-menu > .user-chip { font: inherit; cursor: pointer; }
.user-menu-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  min-width: 220px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 16px 32px rgba(24, 16, 48, .16);
}
.user-menu-list[hidden] { display: none; }
.user-menu-form { margin: 0; }
.user-menu-item {
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text);
  font: inherit; text-decoration: none; cursor: pointer;
}
.user-menu-item:hover { background: #f3efff; }
.user-menu-item.danger { color: var(--danger); }

/* ------------------------------------------------------------- страница */
.page-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin: 6px 0 18px; flex-wrap: wrap; }
h1 { font-size: 26px; letter-spacing: -.02em; }
h2 { font-size: 17px; letter-spacing: -.01em; }
h3 { font-size: 12px; letter-spacing: .1em; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.card-head { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 svg { width: 18px; height: 18px; color: var(--accent); }

.button, button, .primary {
  border-radius: 12px; border: 1px solid var(--border); background: #fff;
  color: var(--text); padding: 8px 14px; font-size: 14px; cursor: pointer;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
.button:hover, button:hover { border-color: var(--accent); color: var(--accent); }
.primary, button.primary { background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600; }
.primary:hover, button.primary:hover { background: #5a35ef; border-color: #5a35ef; color: #fff; }
input, select, textarea { background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px;
  font: inherit; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #d9cdff; border-color: var(--accent); }

.tag { background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  border-radius: 999px; padding: 1px 10px; font-size: 12px; }
.tag.ok { background: #e2f7ec; border-color: #bfe9d2; color: #1f9254; }
.tag.warn { background: #fff2dd; border-color: #f4dcb2; color: #b7791f; }
.pill { border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600;
  border: 1px solid transparent; background: #eee9ff; color: #5a35ef; }
.pill.ok { background: #e2f7ec; border-color: #bfe9d2; color: #1f9254; }
.pill.warn { background: #fff2dd; border-color: #f4dcb2; color: #b7791f; }
.pill.danger { background: #ffe7e7; border-color: #f7c9c9; color: #d64545; }
.pill.neutral { background: #f1eefa; border-color: var(--border); color: var(--muted); }
.pill.prio-critical { background: #ffe7e7; border-color: #f7c9c9; color: #d64545; }
.pill.prio-high { background: #fff2dd; border-color: #f4dcb2; color: #b7791f; }

.alert { background: #fff6ec; border: 1px solid #f6dcbd; color: #8a5a12;
  border-radius: var(--radius-sm); padding: 12px 16px; }
.alert.ok { background: #e9f9f0; border-color: #bfe9d2; color: #176a3e; }
/* «Сохранённые условия ничего не нашли»: показываем всех клиентов и объясняем. */
.crm-fallback { margin: 0 0 12px; display: flex; gap: 10px; flex-wrap: wrap;
  align-items: baseline; justify-content: space-between; }
.crm-fallback .link { color: #176a3e; font-weight: 600; white-space: nowrap; }

.table th, .table td { border-bottom: 1px solid var(--border); padding: 10px 8px;
  text-align: left; vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .06em; }
.table tr:hover td { background: #faf8ff; }

.kpi { background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.kpi-value { font-size: 24px; }
.kpi-label { color: var(--muted); }
.kpi.warn .kpi-value { color: var(--warn); }
.kpi.danger .kpi-value { color: var(--danger); }

.plain-list li { border-bottom: 1px solid var(--border); }

/* ------------------------------------------------- плитки быстрого доступа */
.desk-wrap { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start; }
.desk-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px; margin-bottom: 18px; }
.tile { display: flex; gap: 12px; align-items: flex-start; text-decoration: none;
  border-radius: var(--radius); padding: 16px 18px; border: 1px solid transparent;
  color: var(--text); transition: transform .12s ease; }
.tile:hover { transform: translateY(-2px); border-color: rgba(107, 70, 255, .25); }
.tile-lavender { background: var(--tile-lavender); }
.tile-blue { background: var(--tile-blue); }
.tile-green { background: var(--tile-green); }
.tile-icon { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .7);
  display: inline-flex; align-items: center; justify-content: center; flex: none; }
.tile-icon svg { width: 21px; height: 21px; }
.tile-lavender .tile-icon { color: #6b46ff; }
.tile-blue .tile-icon { color: #2f6fb5; }
.tile-green .tile-icon { color: #1f9254; }
.tile-body { flex: 1 1 auto; min-width: 0; }
.tile-title { font-weight: 700; font-size: 16px; display: block; }
.tile-note { color: #5f5779; font-size: 13px; line-height: 1.35; display: block; margin-top: 2px; }
.tile-chevron { color: #6b46ff; align-self: center; }
.tile-chevron svg { width: 18px; height: 18px; }

/* ------------------------------------------------------- лента активности */
.feed2 { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column;
  gap: 6px; }
.feed2-item { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 12px;
  align-items: start; padding: 12px 8px; border-radius: 14px; }
.feed2-item:hover { background: #faf8ff; }
.feed2-icon { width: 40px; height: 40px; border-radius: 12px; background: #f2eeff;
  color: #6b46ff; display: inline-flex; align-items: center; justify-content: center; }
.feed2-icon svg { width: 20px; height: 20px; }
.feed2-main { min-width: 0; }
.feed2-org { font-weight: 650; font-size: 15px; text-decoration: none; color: var(--text); }
.feed2-org:hover { color: var(--accent); }
.feed2-sub { color: var(--muted); font-size: 12.5px; }
.feed2-action { display: flex; align-items: center; gap: 6px; font-size: 13.5px;
  color: #3f3660; margin-top: 2px; }
.feed2-action svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.feed2-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  text-align: right; }
.feed2-when { color: var(--muted); font-size: 12px; }

/* --------------------------------------------------------- мои задачи */
.task2 { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 4px; }
.task2-item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px;
  align-items: start; padding: 10px 6px; border-radius: 12px; }
.task2-item:hover { background: #faf8ff; }
.task2-check { width: 22px; height: 22px; border-radius: 50%; border: 1.6px solid #d6cfea;
  background: #fff; cursor: pointer; padding: 0; margin-top: 1px; }
.task2-check:hover { border-color: var(--accent); }
.task2-title { font-weight: 600; font-size: 14.5px; line-height: 1.3; display: block;
  color: var(--text); text-decoration: none; }
.task2-sub { color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.due-chip { border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 600;
  white-space: nowrap; background: #f1eefa; color: var(--muted); }
.due-chip.today { background: #ffe7e7; color: #d64545; }
.due-chip.soon { background: #fff2dd; color: #b7791f; }
.due-chip.later { background: #e9f1ff; color: #2f6fb5; }

/* --------------------------------------------------------- мои успехи */
.period-seg { display: inline-flex; background: #f1eefa; border-radius: 999px; padding: 3px; }
.period-seg a { padding: 4px 12px; border-radius: 999px; font-size: 13px; color: var(--muted);
  text-decoration: none; }
.period-seg a.active { background: #fff; color: var(--accent); font-weight: 600;
  box-shadow: var(--shadow-sm); }
.stat-hero { display: flex; align-items: center; gap: 14px; background: #f8f4ff;
  border: 1px solid #ece4ff; border-radius: var(--radius); padding: 14px 16px; }
.stat-hero-icon { width: 44px; height: 44px; border-radius: 12px; background: #ffe9b8;
  color: #a9730b; display: inline-flex; align-items: center; justify-content: center; }
.stat-hero-icon svg { width: 22px; height: 22px; }
.stat-hero-body { flex: 1 1 auto; min-width: 0; }
.stat-hero-label { font-weight: 600; font-size: 14px; }
.stat-hero-value { font-size: 26px; font-weight: 700; line-height: 1.1; }
.stat-hero-delta { font-size: 12.5px; color: #1f9254; }
.stat-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex;
  flex-direction: column; gap: 2px; }
.stat-item { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px; align-items: center; padding: 8px 4px; }
.stat-item + .stat-item { border-top: 1px solid var(--border); }
.stat-icon { width: 32px; height: 32px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; }
.stat-icon svg { width: 17px; height: 17px; }
.stat-icon.lavender { background: #efe7ff; color: #6b46ff; }
.stat-icon.blue { background: #e3eeff; color: #2f6fb5; }
.stat-icon.green { background: #e2f7ec; color: #1f9254; }
.stat-icon.orange { background: #fff0e2; color: #c2691a; }
.stat-value { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------- компактная карточка клиента */
.org-facts { gap: 10px 18px; }
.org-compact { padding: 16px 18px; }
.org-next { background: #f8f4ff; border-radius: var(--radius-sm); padding: 8px 12px;
  display: inline-block; }
.action-button { color: var(--accent); font-weight: 600; font-size: 15px; }
.action-block { background: #fbf9ff; border-color: var(--border); border-radius: 14px; }
.history-item { border-bottom: 1px solid var(--border); }
.history-body strong { font-weight: 600; }
.import-context { background: #f8f4ff; border-color: #e2d9ff; }

@media (max-width: 1180px) {
  .desk-wrap { grid-template-columns: minmax(0, 1fr); }
  .desk-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .desk-tiles { grid-template-columns: minmax(0, 1fr); }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; max-height: none; }
}

/* =========================================================================
   ИИ-агенты: карточки, рабочие места, чат, очередь поручений, видеостудия
   ========================================================================= */

.agent-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px; margin-bottom: 18px; }
.agent-card { display: flex; flex-direction: column; gap: 12px; }
.agent-card-top { display: flex; gap: 12px; align-items: flex-start; }
.agent-avatar { width: 42px; height: 42px; border-radius: 12px; background: #efe7ff;
  color: #6b46ff; display: inline-flex; align-items: center; justify-content: center;
  flex: none; }
.agent-avatar svg { width: 22px; height: 22px; }
.agent-card h2 { margin: 0; font-size: 16px; }
.agent-card p { margin: 2px 0 0; }
.agent-state { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.agent-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 0; }
.agent-facts dt { color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .05em; }
.agent-facts dd { margin: 0; font-size: 14px; }

.agent-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin: 6px 0 16px; flex-wrap: wrap; }
.agent-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) 340px;
  gap: 16px; align-items: start; }
.agent-col { display: flex; flex-direction: column; gap: 10px; }

.conv-list { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 4px; }
.conv-item { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px;
  border-radius: 10px; text-decoration: none; color: var(--text); font-size: 14px; }
.conv-item:hover { background: #faf8ff; }
.conv-item.active { background: #efe7ff; color: #4b2bb8; font-weight: 600; }
.conv-when { color: var(--muted); font-size: 12px; white-space: nowrap; }
.client-line { margin: 0; }

.chat-log { display: flex; flex-direction: column; gap: 10px; min-height: 260px;
  max-height: 460px; overflow-y: auto; padding: 4px 2px; }
.chat-msg { border-radius: 14px; padding: 10px 14px; max-width: 92%; }
.chat-msg.mine { align-self: flex-end; background: #efe7ff; }
.chat-msg.agent { align-self: flex-start; background: #f8f6ff; border: 1px solid var(--border); }
.chat-who { font-size: 11.5px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .06em; margin-bottom: 2px; }
.chat-text { white-space: pre-wrap; font-size: 14.5px; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form input { flex: 1 1 auto; }
.chat-form + .chat-form { margin-top: 8px; }

.job-list { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 10px; }
.job-item { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.job-item:last-child { border-bottom: none; }
.job-line { display: flex; gap: 8px; align-items: center; }
.job-kind { color: var(--muted); font-size: 12px; }
.job-title { font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none;
  display: block; margin-top: 2px; }
.job-result { font-size: 13px; color: #3f3660; margin-top: 2px; }
.job-error { font-size: 12.5px; color: var(--danger); }
.job-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px;
  align-items: center; flex-wrap: wrap; margin-top: 2px; }

.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px; margin-bottom: 18px; align-items: start; }
.studio-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px 18px; }
.studio-facts > div { display: flex; flex-direction: column; gap: 2px; }
.studio-status { margin-bottom: 18px; }
.studio-log { background: #f8f6ff; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: 12.5px; white-space: pre-wrap; max-height: 220px;
  overflow-y: auto; }

@media (max-width: 1250px) {
  .agent-grid { grid-template-columns: 260px minmax(0, 1fr); }
  .agent-grid > .agent-col:last-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .agent-grid { grid-template-columns: minmax(0, 1fr); }
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
}


/* Значки внутри кнопок и заголовков: фиксированный размер */
.button svg, button svg, .tile-chevron svg, .card-head h2 svg,
.task-actions svg, .nav-icon {
  width: 16px; height: 16px; flex: none; vertical-align: -2px;
}
.card-head h2 svg { width: 18px; height: 18px; }
.button svg, button svg { margin-right: 2px; }


/* ------------------------------------------- Голосовой секретарь (упрощённый) */
.voice-simple { margin-top: 16px; }
.vsec-main { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.vsec-button {
  position: relative; width: 132px; height: 132px; border-radius: 50%; flex: none;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; background: linear-gradient(160deg, #6b46ff, #4b2bb8); color: #fff;
  border: none; cursor: pointer; box-shadow: 0 12px 28px rgba(107, 70, 255, .35);
  transition: transform .12s ease, box-shadow .12s ease;
}
.vsec-button:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(107,70,255,.42); }
.vsec-button.is-on { background: linear-gradient(160deg, #1f9254, #147a43);
  box-shadow: 0 12px 28px rgba(31, 146, 84, .35); }
.vsec-button.is-blocked { background: linear-gradient(160deg, #8b8b9c, #5d5d70);
  box-shadow: none; }
.vsec-mic svg { width: 34px; height: 34px; }
.vsec-label { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.vsec-level {
  position: absolute; inset: -8px; border-radius: 50%; pointer-events: none;
  box-shadow: 0 0 0 calc(var(--level, 0) * 18px) rgba(107, 70, 255, .18);
  transition: box-shadow .1s linear;
}
.vsec-button.is-on .vsec-level { box-shadow: 0 0 0 calc(var(--level, 0) * 18px) rgba(31, 146, 84, .2); }
.vsec-copy { flex: 1 1 260px; min-width: 220px; }
.vsec-hint { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.vsec-lines { margin: 14px 0 0; display: flex; flex-direction: column; gap: 6px; }
.vsec-lines p { margin: 0; }
.vsec-line-label { color: var(--muted); font-size: 12.5px; text-transform: uppercase;
  letter-spacing: .06em; margin-right: 6px; }
.vsec-line-text { font-size: 14.5px; }
#vsec-status[data-phase="listening"] { background: #e2f7ec; color: #1f9254; }
#vsec-status[data-phase="thinking"] { background: #fff2dd; color: #b7791f; }
#vsec-status[data-phase="speaking"] { background: #ece6ff; color: #6b46ff; }
#vsec-status[data-phase="error"] { background: #ffe7e7; color: #d64545; }
.tech-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px; align-items: start; }
.tech-voice { grid-column: 1 / -1; }


/* ------------------------------------- Уведомления: не мешают работе */
.notif-panel {
  position: fixed; right: 18px; bottom: 18px; width: 340px; max-height: 52vh;
  overflow: auto; z-index: 40; border-radius: 16px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--border);
  box-shadow: 0 18px 44px rgba(31, 17, 71, .16);
}
.notif-panel.notif-emergency { border-color: #f0b9b9; }
.notif-head { display: flex; align-items: center; gap: 8px; }
.notif-head #notif-title { font-weight: 700; font-size: 14px; }
.notif-collapse { margin-left: auto; }
.notif-list { list-style: none; margin: 10px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px; max-height: 30vh; overflow: auto; }
.notif-item { border-left: 3px solid var(--border); padding: 6px 0 6px 10px; }
.notif-item-title { font-weight: 600; font-size: 13.5px; }
.notif-item-body { font-size: 13px; color: #3f3660; }
.notif-item-when { font-size: 12px; color: var(--muted); }
.notif-actions { display: flex; align-items: center; gap: 10px; margin-top: 10px;
  flex-wrap: wrap; }
.notif-panel.notif-collapsed { width: 210px; }
.notif-panel.notif-collapsed .notif-list,
.notif-panel.notif-collapsed .notif-actions,
.notif-panel.notif-collapsed #notif-critical { display: none; }
@media (max-width: 900px) {
  .notif-panel { width: calc(100% - 24px); right: 12px; bottom: 12px; }
}


/* --------------------------------------------------- Иконки направлений */
.dir-icon { width: 22px; height: 22px; color: #6b46ff; }
.direction-icon .dir-icon { width: 26px; height: 26px; }
.feed2-icon .dir-icon { width: 20px; height: 20px; }

/* ----------------------------- Лента: свёрнутые подробности по клиенту */
.feed-more { margin-top: 4px; }
.feed-more summary { cursor: pointer; }
.feed-sub { list-style: none; margin: 6px 0 0; padding: 8px 0 0 12px;
  border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.feed-sub li { font-size: 13px; color: #3f3660; }

/* --------------------------------------------- Задачи: компактный список */
.task-list { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 2px; }
.task-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 12px; align-items: center; padding: 10px 8px; border-radius: 12px; }
.task-row + .task-row { border-top: 1px solid var(--border); }
.task-row:hover { background: #faf8ff; }
.task-row-title { font-weight: 600; font-size: 14.5px; color: var(--text);
  text-decoration: none; }
.task-row-title:hover { color: var(--accent); }
.task-row-sub { color: var(--muted); font-size: 12.5px; }
.task-row-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  justify-content: flex-end; }
.task-row-actions { display: flex; gap: 6px; }
.task-row-actions form { margin: 0; }
.task-filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-bottom: 12px; }
@media (max-width: 900px) {
  .task-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .task-row-meta { justify-content: flex-start; }
}

/* ----------------------------------------------- Маркетинг: рабочее место */
.market-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px; align-items: start; }
.market-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0;
  border-top: 1px solid var(--border); }
.market-item:first-child { border-top: none; }
.market-item-body { min-width: 0; }
.market-item-title { font-weight: 600; font-size: 14px; }
.market-item-sub { color: var(--muted); font-size: 12.5px; }


/* ===================== Карточка клиента прямо в списке организаций ===== */
.org-cell { display: flex; align-items: flex-start; gap: 8px; }
.org-toggle { width: 26px; height: 26px; padding: 0; border-radius: 8px; flex: none;
  border: 1px solid var(--border); background: #fff; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.org-toggle svg { width: 14px; height: 14px; transition: transform .15s ease; }
.org-toggle:hover { border-color: var(--accent); color: var(--accent); }
.org-toggle.is-open svg { transform: rotate(90deg); }
.org-toggle.is-open { background: #efe7ff; border-color: #d9cdff; color: #4b2bb8; }
tr.org-row-open > td { background: #faf8ff; }
tr.org-panel-row > td { padding: 0 !important; border-bottom: 1px solid var(--border); }
.org-panel-slot { padding: 0; }
.panel-loading { padding: 12px 16px; }

.panel { padding: 16px 18px 18px; background: #fbfaff; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-title { display: flex; align-items: center; gap: 10px; }
.panel-title .dir-icon { width: 24px; height: 24px; }
.panel-head-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.panel-branches { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 12px; }
.chip { border: 1px solid var(--border); background: #fff; color: #3f3660;
  border-radius: 999px; padding: 4px 12px; font-size: 13px; cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: #efe7ff; border-color: #d9cdff; color: #4b2bb8; font-weight: 600; }

.panel-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px 18px; margin-bottom: 10px; }
.panel-facts > div { display: flex; flex-direction: column; gap: 1px; }
.panel-next { margin: 6px 0 10px; font-size: 14px; }

.panel-contacts { margin-bottom: 12px; }
.panel-contact-list { list-style: none; margin: 6px 0 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px; }
.panel-contact-list li { display: flex; gap: 10px; align-items: baseline;
  flex-wrap: wrap; font-size: 14px; }

.panel-actions { margin-bottom: 14px; }
.panel-action-row { display: flex; gap: 8px; flex-wrap: wrap; }
/* Скрытые формы карточки: правило класса сильнее атрибута hidden из браузера,
   поэтому гасим явно — открыта только одна компактная форма. */
.panel [hidden], tr.org-panel-row[hidden] { display: none !important; }
.panel-form { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 14px; background: #fff; display: flex; flex-direction: column; gap: 8px; }
.panel-form .row { gap: 10px; }
.panel-form label { font-size: 13px; color: var(--muted); }
.panel-form input, .panel-form select, .panel-form textarea { font-size: 14px; }
.panel-form-buttons { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.panel-notice { margin-bottom: 10px; }

.panel-history-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.panel-history-list { list-style: none; margin: 0; padding: 0; max-height: 340px;
  overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.panel-history-list .history-item { grid-template-columns: 118px minmax(0, 1fr);
  padding-bottom: 6px; }
.panel-history .panel-history-list .history-body strong { font-weight: 600; }

@media (max-width: 1100px) {
  .panel-facts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .panel-history-list .history-item { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (max-width: 768px) {
  .panel { padding: 12px; }
  .panel-action-row .button { flex: 1 1 45%; }
}


/* Список клиентов на небольших экранах: прокрутка внутри карточки */
.table-scroll { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table-scroll .org-table { min-width: 720px; }
.panel { max-width: 100%; box-sizing: border-box; }

@media (max-width: 1280px) {
  .org-table .col-city, .org-table .col-resp { display: none; }
}
@media (max-width: 1024px) {
  .org-table .col-branches, .org-table .col-payment { display: none; }
  .table-scroll .org-table { min-width: 520px; }
}
@media (max-width: 768px) {
  .org-table .col-phone { display: none; }
  .table-scroll .org-table { min-width: 380px; }
  .panel-head { flex-direction: column; align-items: flex-start; }
  .panel-head-actions { gap: 10px; }
}

/* ==========================================================================
   «Правки CRM»: компактный боковой блок и панель со списком предложений.
   Блок живёт в правой колонке рабочего стола и не перекрывает работу.
   ========================================================================== */
.cf-block { padding: 14px 16px; }
.cf-block-note { margin: 6px 0 10px; }
.cf-block-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cf-count {
  margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px;
  border-radius: 999px; background: var(--accent, #6b46ff); color: #fff;
  font-size: 12px; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center;
}

.cf-panel {
  position: fixed; top: 64px; right: 16px; bottom: 16px;
  width: min(460px, calc(100vw - 32px)); z-index: 60;
  background: #fff; border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 18px 48px rgba(36, 16, 70, .18);
  overflow: hidden; display: flex;
}
.cf-panel[hidden] { display: none; }
.cf-panel-body { overflow-y: auto; overflow-x: hidden; padding: 14px 16px;
  width: 100%; }
.cf-panel-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
  margin-bottom: 10px; }
.cf-panel-title { font-weight: 700; font-size: 16px; }
.cf-loading { padding: 8px 0; }
.cf-notice { margin-bottom: 10px; }

.cf-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.cf-label { font-size: 13px; color: var(--muted); display: flex;
  flex-direction: column; gap: 4px; }
.cf-form textarea, .cf-form select, .cf-form input[type="file"] { font-size: 14px; }
.cf-form-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.cf-file { font-size: 12px; color: var(--muted); display: flex;
  flex-direction: column; gap: 2px; }
.cf-file input { font-size: 12px; max-width: 190px; }
.cf-hint { margin: 2px 0 0; }

.cf-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

.cf-list { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 10px; align-items: stretch; }
/* Карточка правки подкрашена лёгким фоном: блоки замечаний отделяются друг от
   друга и от страницы, но текст остаётся читаемым. */
.cf-item { border: 1px solid #e2dbf8; border-left: 3px solid #cdbff5;
  border-radius: 12px; padding: 10px 12px; background: #f7f6fd;
  box-shadow: 0 1px 2px rgba(60, 40, 120, .04); }
/* Ширина карточек одинаковая при любом содержимом: длинные слова, длинные имена
   файлов и отчёты не должны «разъезжаться» и делать список неровным. */
.cf-list > .cf-item { width: 100%; max-width: 100%; min-width: 0;
  box-sizing: border-box; }
.cf-item, .cf-item-head, .cf-item-actions, .cf-files, .cf-file-item,
.cf-body, .cf-meta, .cf-history, .cf-comments { min-width: 0; }
.cf-body, .cf-meta, .cf-history li, .cf-comments li, .cf-file-name,
.cf-more-hint { overflow-wrap: anywhere; }
.cf-item,
.cf-item:nth-child(even) { background: #f7f6fd; }
.cf-item-fixed { opacity: .78; }
.cf-item-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.cf-when { margin-left: auto; font-size: 12px; }
/* Сколько дней замечание ждёт решения: подпись рядом с датой создания. */
.cf-wait { white-space: nowrap; }
.cf-body { margin: 8px 0 6px; font-size: 14.5px; line-height: 1.5;
  white-space: pre-line; color: var(--text); }
.cf-meta { font-size: 12px; }
/* Кнопка «Развернуть» под текстом и файлами: за ней переписка и действия.
   Видно, что внутри что-то есть, — рядом счётчики. */
.cf-more { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px;
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px;
  background: #fff; cursor: pointer; list-style: none; font-size: 13px;
  color: var(--accent); font-weight: 600; }
.cf-more::-webkit-details-marker { display: none; }
.cf-more::marker { content: ""; }
.cf-more:hover { border-color: var(--accent); background: #f4f0ff; }
.cf-more-hint { font-weight: 400; color: var(--muted); }
.cf-more-caret { transition: transform .15s ease; color: var(--muted); }
.cf-details[open] > .cf-more { margin-bottom: 8px; }
.cf-details[open] > .cf-more .cf-more-caret { transform: rotate(180deg); }
.cf-more-open { display: none; }
.cf-details[open] > .cf-more .cf-more-open { display: inline; }
.cf-details[open] > .cf-more .cf-more-closed { display: none; }
.cf-no-comments { margin: 8px 0 0; }
/* Отчёт Harness: длинные строки не должны растягивать карточку вбок. */
.cf-report { margin-top: 8px; }
.cf-report-text { margin: 6px 0 0; padding: 8px 10px; background: #fbfaff;
  border: 1px solid var(--border); border-radius: 10px; white-space: pre-wrap;
  overflow-wrap: anywhere; max-width: 100%; max-height: 320px;
  overflow-y: auto; }
.cf-files { list-style: none; margin: 6px 0 0; padding: 0; display: flex;
  flex-direction: column; gap: 6px; }
/* Вложение правки: у скрина миниатюра и кнопка «Скрин», у документа —
   «Открыть файл» и «скачать». */
.cf-file-item { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cf-file-name { font-size: 12px; word-break: break-all; }
.cf-file-meta { font-size: 11px; white-space: nowrap; }
.cf-file-download { font-size: 11px; }
.cf-file-preview { flex: 1 1 100%; }
.cf-file-preview summary { display: flex; gap: 8px; align-items: baseline;
  flex-wrap: wrap; cursor: pointer; list-style: none; }
.cf-file-preview summary::-webkit-details-marker { display: none; }
.cf-file-preview summary::before { content: "▸"; color: var(--muted); font-size: 11px; }
.cf-file-preview[open] summary::before { content: "▾"; }
.cf-file-image { display: block; margin: 6px 0 2px; }
.cf-file-image img { max-width: 100%; max-height: 520px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; }
.cf-file-links { display: flex; gap: 10px; flex-wrap: wrap; font-size: 11px;
  align-items: center; }
/* Скрин замечания: миниатюра в карточке и кнопка «Скрин» рядом с ней. */
.cf-shot-thumb { display: block; flex: 0 0 auto; line-height: 0;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: #fff; }
.cf-shot-thumb img { max-height: 84px; max-width: 160px; display: block; }
.cf-shot-thumb:hover { border-color: var(--accent, #6b4ce6); }
.cf-shot-link { cursor: pointer; text-decoration: underline dotted; }
/* Кнопка «Скрин» — яркая, чтобы её находили сразу (просьба владельца). */
.cf-shot-button {
  cursor: pointer;
  background: #1f8a4c; border: 1px solid #1f8a4c; color: #fff;
  font-weight: 700; padding: 7px 18px; border-radius: 9px;
  box-shadow: 0 2px 10px rgba(31, 138, 76, .38);
  animation: cf-shot-pulse 2.4s ease-in-out infinite;
}
.cf-shot-button:hover, .cf-shot-button:focus {
  background: #17703d; border-color: #17703d; color: #fff;
  animation: none;
}
@keyframes cf-shot-pulse {
  0%, 100% { box-shadow: 0 2px 10px rgba(31, 138, 76, .38); }
  50% { box-shadow: 0 2px 16px rgba(31, 138, 76, .75); }
}
@media (prefers-reduced-motion: reduce) {
  .cf-shot-button { animation: none; }
}
/* Правки CRM — зелёный блок и кнопка, правки приложения — красный.
   Красим и карточку на странице правок, и блок на рабочем столе. */
.cf-card-crm { border-left: 6px solid #1f8a4c; }
.cf-card-app { border-left: 6px solid #c0392b; }
/* Блок на рабочем столе подкрашен целиком: видно издалека, какой это канал.
   Подложка сделана полупрозрачной — так подкраска читается и на светлой теме,
   и на тёмной (браузеры с тёмной темой для сайтов инвертируют белое). */
.cf-block.cf-card-crm { border-left: 6px solid #1f8a4c;
  background: linear-gradient(90deg, rgba(31, 138, 76, .14), rgba(31, 138, 76, 0) 72%); }
.cf-block.cf-card-app { border-left: 6px solid #c0392b;
  background: linear-gradient(90deg, rgba(192, 57, 43, .14), rgba(192, 57, 43, 0) 72%); }
.cf-block.cf-card-crm .cf-block-title { color: #1f8a4c; }
.cf-block.cf-card-app .cf-block-title { color: #c0392b; }
.cf-block.cf-card-crm .cf-block-title::before,
.cf-block.cf-card-app .cf-block-title::before {
  content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px;
  border-radius: 50%; vertical-align: middle;
}
.cf-block.cf-card-crm .cf-block-title::before { background: #1f8a4c; }
.cf-block.cf-card-app .cf-block-title::before { background: #c0392b; }
.cf-block.cf-card-crm .cf-block-stats strong { color: #1f8a4c; }
.cf-block.cf-card-app .cf-block-stats strong { color: #c0392b; }
.cf-chan-crm:not(.primary) { border-color: #1f8a4c; color: #1f8a4c; }
.cf-chan-crm.primary { background: #1f8a4c; border-color: #1f8a4c; color: #fff; }
.cf-chan-crm.primary:hover { background: #17703d; border-color: #17703d; }
.cf-chan-app:not(.primary) { border-color: #c0392b; color: #c0392b; }
.cf-chan-app.primary { background: #c0392b; border-color: #c0392b; color: #fff; }
.cf-chan-app.primary:hover { background: #a03225; border-color: #a03225; }
/* Раскрытая панель канала: заголовок того же цвета, что и блок. */
.cf-panel-crm .cf-panel-title { color: #1f8a4c; }
.cf-panel-app .cf-panel-title { color: #c0392b; }
/* «Сделано» у разработчика приложений — заметная зелёная кнопка. */
.cf-done { background: #1f8a4c; border-color: #1f8a4c; color: #fff; font-weight: 700; }
.cf-done:hover { background: #17703d; border-color: #17703d; color: #fff; }
/* «Открыть файл» — главная кнопка под текстом замечания: её видно сразу, без
   разворота карточки, поэтому она контрастная. */
.cf-file-open { background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 700; padding: 7px 16px;
  box-shadow: 0 2px 8px rgba(107, 76, 230, 0.28); }
.cf-file-open:hover, .cf-file-open:focus { background: #5a35ef;
  border-color: #5a35ef; color: #fff; }
/* Просмотр скрина поверх страницы: нажатие мимо фото закрывает. */
body.cf-shot-open { overflow: hidden; }
.cf-shot { position: fixed; inset: 0; z-index: 90; display: flex;
  align-items: center; justify-content: center; padding: 24px;
  background: rgba(12, 18, 28, 0.78); cursor: zoom-out; }
.cf-shot-image { max-width: 94vw; max-height: 92vh; border-radius: 10px;
  background: #fff; box-shadow: 0 18px 60px rgba(0, 0, 0, 0.45);
  cursor: default; }
.cf-shot-close { position: absolute; top: 14px; right: 18px; width: 38px;
  height: 38px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(12, 18, 28, 0.65); color: #fff; font-size: 22px;
  line-height: 1; cursor: pointer; }
.cf-shot-close:hover { background: rgba(12, 18, 28, 0.9); }
.cf-comments { list-style: none; margin: 8px 0 0; padding: 8px 0 0;
  border-top: 1px dashed var(--border); display: flex; flex-direction: column; gap: 4px; }
/* Техническая история правки: подписана мелко, чтобы не путали с перепиской. */
.cf-history-title { margin-top: 8px; font-size: 11.5px; letter-spacing: .02em;
  text-transform: lowercase; }
.cf-item-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 8px; }
.cf-comment-form { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 220px; }
.cf-comment-form input { flex: 1 1 120px; min-width: 0; font-size: 13px; }
.cf-status-form { display: flex; gap: 6px; align-items: center; }
.cf-status-form select { font-size: 13px; }

.cf-pick { list-style: none; margin: 0 0 10px; padding: 0; display: flex;
  flex-direction: column; gap: 6px; }
.cf-pick li label { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
  font-size: 14px; cursor: pointer; }
.cf-pick-section { color: var(--muted); font-size: 13px; }
.cf-merge { display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.cf-merge input { font-size: 13px; max-width: 240px; }
.cf-tz-list { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 8px; }
.cf-tz-list li { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.cf-group { margin-bottom: 10px; }
.cf-group-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.cf-included { list-style: none; margin: 0; padding: 0; display: flex;
  flex-direction: column; gap: 6px; }
.cf-included li { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.cf-doc { background: #faf8ff; border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; font-size: 13px; line-height: 1.5; white-space: pre-wrap;
  max-height: 460px; overflow: auto; margin: 10px 0; }

@media (max-width: 1280px) {
  .cf-panel { top: 56px; right: 10px; bottom: 10px; width: min(430px, calc(100vw - 20px)); }
}
@media (max-width: 900px) {
  .cf-panel { left: 10px; right: 10px; width: auto; top: 52px; }
  .cf-item-actions { flex-direction: column; align-items: stretch; }
  .cf-comment-form { flex: 1 1 100%; }
}
/* Компактный блок «Правки CRM»: одна строка заголовка, короткая подсказка,
   две кнопки. Стоит первым в правой колонке рабочего стола. */
.cf-block { padding: 12px 14px; }
.cf-block-head { display: flex; align-items: center; gap: 8px; }
.cf-block-title { font-weight: 700; font-size: 14px; }
.cf-block-note { margin: 4px 0 8px; font-size: 12px; line-height: 1.35; }
.cf-block-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.cf-block-actions .button { padding: 5px 10px; font-size: 13px; }
/* Галочка выбора замечания для ТЗ — прямо в строке списка у директора. */
.cf-pick-box { margin: 0 2px 0 0; width: 16px; height: 16px; accent-color: #6b46ff; }
.cf-tz-pick { margin: 0 0 12px; padding: 10px 12px; border: 1px dashed var(--border);
  border-radius: 12px; background: #fbfaff; }
/* Объединение повторов: выбор из списка, а не ввод идентификаторов. */
.cf-merge select { font-size: 13px; max-width: 320px; }
.cf-merge .cf-label { flex: 1 1 240px; }

/* ==========================================================================
   Клиенты: выборки «Все | Новые | В работе | Подключённые | Подключены не
   полностью | Оплаченные | Неоплаченные» и сроки подписки прямо в списке.
   ========================================================================== */
/* Поле поиска клиентов (заявка CRM): было коротким, а кнопки «Найти» и
   «Скачать выборку» стояли по центру подписи и висели выше самого поля.
   Поле тянется по ширине строки, кнопки выровнены по низу — то есть по высоте
   поля, а не подписи над ним. */
.cf-list-search { margin-bottom: 10px; align-items: flex-end; }
.cf-list-search label { flex: 1 1 420px; min-width: 260px; max-width: 640px; }
.cf-list-search input[name="search"] {
  width: 100%;
  height: 38px;
  padding: 0 12px;
}
.cf-list-search button,
.cf-list-search .button {
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}
/* «Развернуть все» / «Свернуть все» над списком правок. Кнопки — обычные
   ссылки с open=1, поэтому строка не зависит от клиентского скрипта. */
.cf-tools { display: flex; flex-direction: row; gap: 8px; flex-wrap: wrap;
  align-items: center; margin: 0 0 10px; }
.cf-tools .button, .cf-tools a { display: inline-flex; width: auto;
  flex: 0 0 auto; text-decoration: none; }
.cf-views { display: flex; flex-direction: row; gap: 6px; flex-wrap: wrap;
  align-items: center; margin: 0 0 6px; }
.cf-views .button { text-decoration: none; }
.cf-view-hint { margin: 0 0 12px; }
.sub-date { white-space: nowrap; }
.sub-trial { color: #6b6b7b; }

/* Цвета относятся к индикаторам и срокам, а не ко всей строке. */
.sub-pill-green { color: #1f7a45; background: #e7f6ec; }
.sub-pill-yellow { color: #8a5a00; background: #fdf1d6; }
.sub-pill-red { color: #a3242a; background: #fdeaea; }
.sub-pill-gray { color: #5f5f70; background: #f0eff5; }

.org-table .col-until, .org-table .col-left { white-space: nowrap; }

@media (max-width: 1280px) {
  .org-table .col-city, .org-table .col-resp { display: none; }
  .org-table .col-until { display: none; }
}
@media (max-width: 1024px) {
  .org-table .col-branches { display: none; }
  .org-table .col-left { display: none; }
  .table-scroll .org-table { min-width: 520px; }
  .cf-views { gap: 4px; }
  .cf-views .button { padding: 4px 8px; font-size: 13px; }
}
@media (max-width: 768px) {
  .org-table .col-phone { display: none; }
  .table-scroll .org-table { min-width: 360px; }
}

/* Карточка клиента: сроки подписки по каждой точке отдельно. */
.panel-subs { margin: 10px 0 4px; }
.panel-subs-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap;
  margin-bottom: 6px; }
.panel-subs-table { width: 100%; font-size: 12px; }
.panel-subs-table th, .panel-subs-table td { padding: 4px 6px; vertical-align: top; }
.panel-subs-table tr.is-selected { background: #f6f2ff; }
.panel-subs-note { margin: 6px 0 0; }
/* Кнопки выборок не должны растягиваться на всю ширину карточки:
   общее правило ссылок в карточке делает их блоками. */
.cf-views .button, .cf-views a {
  display: inline-flex; width: auto; flex: 0 0 auto;
}

/* Явные стили кнопок выборок: общие правила ссылок в карточке делают элементы
   блочными, из-за чего шесть кнопок выстраивались в столбик. */
.cf-views > a.button {
  display: inline-flex;
  width: auto;
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 13px;
  line-height: 1.2;
  white-space: nowrap;
}

/* ==========================================================================
   Чат сотрудников: скрепка для вложения и показ приложенных файлов.
   ========================================================================== */
.chat-form { align-items: center; flex-wrap: wrap; }
.chat-attach {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 12px; padding: 6px 10px;
  background: #fff; color: var(--muted); max-width: 220px;
}
.chat-attach:hover { border-color: var(--accent); color: var(--accent); }
.chat-attach-input {
  position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none;
}
.chat-attach-icon svg { width: 18px; height: 18px; display: block; }
.chat-attach-name {
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chat-attach-has-file { border-color: var(--accent); color: var(--accent); }
.chat-files { list-style: none; margin: 6px 0 0; padding: 0; display: flex;
  flex-direction: column; gap: 4px; }
.chat-file {
  display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  padding: 4px 9px; border: 1px solid var(--border); border-radius: 10px;
  background: #fbfaff; text-decoration: none;
}
.chat-file:hover { border-color: var(--accent); }
.chat-file svg { width: 15px; height: 15px; color: var(--accent); }

@media (max-width: 768px) {
  .chat-form { flex-direction: column; align-items: stretch; }
  .chat-attach { max-width: none; justify-content: flex-start; }
}

/* Вторая строка кнопок выгрузки: «В ТЗ и скачать файл» — отдельная форма POST. */
.cf-tz-pick + .cf-file-form { margin-top: 6px; }
.cf-file-form .button { white-space: nowrap; }

/* Разделение правок по спрашивающим: у каждого автора своя группа. */
.cf-author {
  display: flex; align-items: baseline; gap: 10px;
  margin: 14px 0 6px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border, #e6e4ef);
}
.cf-author-name { font-weight: 700; font-size: 14.5px; }
.cf-author-count { font-size: 12.5px; }
.cf-author-single .cf-author-name::after {
  content: " · единственный автор";
  font-weight: 500; font-size: 12px; color: var(--muted);
}

/* Кнопка удаления и строка правки под задачей. */
.button.danger {
  border-color: #f0c2c2; color: #c0392b; background: #fff5f5;
}
.button.danger:hover { background: #ffecec; }
.cf-edit-form {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  width: 100%; margin-top: 6px;
}
.cf-edit-form input[name="body"] { flex: 1 1 320px; min-width: 220px; }

/* Уведомления: панели на экране нет — список раскрывается колокольчиком
   сверху справа, а число непрочитанных видно на самом колокольчике. */
.notif-panel {
  position: fixed; top: 68px; right: 18px; bottom: auto;
  width: min(420px, calc(100vw - 36px)); max-height: 60vh; z-index: 60;
}
.notif-panel[hidden] { display: none; }
.notif-close { margin-left: auto; }
.notif-empty { margin: 8px 0 0; }

/* Кнопка «Удалить» в строке правки: видна сразу, не только в раскрытой задаче.
   Просьба владельца: справа и не подчёркнутой ссылкой, а прямоугольной кнопкой
   с закруглёнными краями в красноватом цвете. */
.cf-delete-form { margin-left: auto; }
.cf-delete-form .cf-delete {
  color: #c0392b; background: #fdeeee; border: 1px solid #f0c2c2;
  padding: 5px 14px; cursor: pointer; font-size: 12.5px; font-weight: 600;
  border-radius: 9px; text-decoration: none; line-height: 1.2;
}
.cf-delete-form .cf-delete:hover {
  background: #f9d9d9; border-color: #e3a3a3; color: #96271a;
}

/* Окружение: «РАБОЧАЯ CRM» или «ТЕСТОВАЯ CRM» — видно на каждой странице. */
.env-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: .02em; white-space: nowrap; border: 1px solid transparent;
}
.env-badge.env-prod { background: #e8f7ee; color: #1c7a44; border-color: #bfe6ce; }
.env-badge.env-test { background: #fff3d6; color: #8a5a00; border-color: #f0d699; }
.env-strip {
  padding: 7px 16px; background: #fff3d6; color: #7a5100;
  border-bottom: 1px solid #f0d699; font-size: 13px; text-align: center;
}
.env-strip strong { text-transform: uppercase; letter-spacing: .04em; }
.login .env-badge { position: static; margin-bottom: 8px; }


/* ---------------------------------------------------------------------------
   Умный импорт клиентов: строки файла и правки на месте
   --------------------------------------------------------------------------- */
.import-table {
  table-layout: fixed;
  width: 100%;
}
.import-table th, .import-table td {
  vertical-align: top;
  padding: 8px 8px;
  overflow-wrap: anywhere;
}
.import-table .col-number { width: 38px; }
.import-table .col-what { width: 21%; }
.import-table .col-direction { width: 13%; }
.import-table .col-date { width: 9%; }
.import-table .col-history { width: 29%; }
.import-table .col-decision { width: 22%; }
.import-table .import-row td { border-top: 1px solid rgba(0, 0, 0, 0.08); }
.import-table .import-clarify td { background: rgba(255, 196, 0, 0.06); }
.import-table .import-duplicate td { background: rgba(255, 120, 0, 0.07); }
.import-table .import-skip td { opacity: 0.65; }
.import-table select { width: 100%; max-width: 260px; }
.import-table .pill { margin: 2px 4px 0 0; white-space: normal; }
.import-table label.small { display: block; margin-top: 4px; }
.import-edit { margin-top: 6px; }
.import-edit summary { cursor: pointer; color: #1a56db; }
.import-edit label { display: block; margin-top: 4px; }
.import-edit input, .import-edit textarea { width: 100%; max-width: 320px; }

/* ---------------------------------------------------------------------------
   Отчёты: категории свёрнуты при открытии вкладки, заголовки таблиц сортируют.
   --------------------------------------------------------------------------- */
.report-card { padding-bottom: 8px; }
.report-card > .report-head {
  cursor: pointer;
  list-style: none;
  margin-bottom: 8px;
}
.report-card > .report-head::-webkit-details-marker { display: none; }
.report-card > .report-head::before {
  content: "▸";
  color: var(--accent-2);
  margin-right: 8px;
  font-size: 13px;
}
.report-card[open] > .report-head::before { content: "▾"; }
.report-card[open] > .report-head { margin-bottom: 14px; }
.report-card .report-body { padding-bottom: 6px; }
.report-card h3 { margin: 18px 0 6px; font-size: 15px; }
.report-sort { text-decoration: none; }
.report-sort.active { text-decoration: underline; }
.report-sort:hover { text-decoration: underline; }
/* ---------------------------------------------------- постоянный ИИ-помощник
   Кнопка в правом нижнем углу и боковая панель на каждой странице. Панель не
   перекрывает работу: она сбоку, страница остаётся доступной. */
.aiw { position: fixed; right: 18px; bottom: 18px; z-index: 55; }
.aiw-button { display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 16px; border-radius: 999px; border: 1px solid #cdbff5;
  background: linear-gradient(180deg, #7b5cf0, #5a35ef); color: #fff;
  font-weight: 700; font-size: 14px; cursor: pointer;
  box-shadow: 0 10px 26px rgba(90, 53, 239, .34); }
.aiw-button:hover { filter: brightness(1.06); }
.aiw-button-icon { font-size: 16px; line-height: 1; }
.aiw-open .aiw-button { display: none; }
.aiw-panel { position: fixed; right: 0; top: 0; bottom: 0; width: min(420px, 100vw);
  display: flex; flex-direction: column; background: #fff;
  border-left: 1px solid var(--border, #e6e4ef);
  box-shadow: -12px 0 34px rgba(36, 16, 70, .16); z-index: 60; }
@media (max-width: 620px) { .aiw-panel { width: 100vw; } }
.aiw-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--border, #e6e4ef); }
.aiw-title { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto;
  min-width: 0; }
.aiw-title strong { font-size: 15px; }
.aiw-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aiw-icon-link { font-size: 12px; color: #5a35ef; text-decoration: none; }
.aiw-icon { width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--border, #e6e4ef);
  background: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.aiw-log { flex: 1 1 auto; overflow-y: auto; padding: 14px; display: flex;
  flex-direction: column; gap: 10px; background: #faf9ff; }
.aiw-msg { max-width: 92%; padding: 9px 12px; border-radius: 12px; font-size: 14px;
  line-height: 1.45; white-space: pre-line; }
.aiw-msg-user { align-self: flex-end; background: #efe7ff; border: 1px solid #ded1fb; }
.aiw-msg-assistant { align-self: flex-start; background: #fff;
  border: 1px solid var(--border, #e6e4ef); }
.aiw-proposal { margin-top: 8px; padding: 8px 10px; border-radius: 10px;
  background: #f4f0ff; border: 1px dashed #cdbff5; }
.aiw-proposal-actions { display: flex; gap: 8px; margin-top: 6px; }
.aiw-done { color: #1f9254; }
.aiw-form { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
  border-top: 1px solid var(--border, #e6e4ef); background: #fff; }
.aiw-form textarea { resize: vertical; min-height: 44px; max-height: 140px;
  font-size: 14px; }
.aiw-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
/* Скрытое состояние помощника: без этого правила display:flex перебивает hidden. */
.aiw[hidden], .aiw-panel[hidden] { display: none; }

/* Группировка правок по дням: заголовок даты, ниже — замечания этого дня. */
.cf-day { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  margin: 18px 0 8px; padding: 0 0 6px 2px;
  border-bottom: 2px solid #e6e0fb; }
.cf-day:first-of-type { margin-top: 6px; }
.cf-day-title { font-weight: 700; font-size: 15px; color: #3c2a72;
  letter-spacing: .01em; }
.cf-day-sub { text-transform: capitalize; }
.cf-day-count { margin-left: auto; }

/* Кнопки подтверждения предложения в чате помощника: главная — «Подтвердить». */
.aiw-confirm { font-weight: 700; padding: 7px 18px; }
.aiw-reject { padding: 7px 14px; }
.aiw-proposal-actions .button:disabled { opacity: .6; cursor: default; }
.aiw-proposal + .aiw-proposal { margin-top: 8px; }

/* ---------------------------------------------------- новая задача у сотрудника
   Назначенная задача подсвечивается и мягко «помигивает», пока сотрудник её не
   принял: так он её точно заметит. После кнопки «Принять» (статус «в работе»)
   подсветка исчезает сама. Анимация медленная и неяркая, чтобы не мешать. */
.task-new { position: relative; }
.task2-item.task-new,
li.task-row.task-new {
  background: linear-gradient(90deg, #f6f1ff, #fdfbff);
  border: 1px solid #cdbff5;
  border-left: 4px solid #7b5cf0;
  border-radius: 12px;
  animation: task-new-pulse 2.6s ease-in-out infinite;
}
.task2-item.task-new { padding: 6px 8px; }
.task-new .task2-title,
li.task-row.task-new .task-row-title { font-weight: 700; }
.task-new::after {
  content: "новая";
  position: absolute; top: 4px; right: 8px;
  font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
  color: #5a35ef; background: #fff; border: 1px solid #cdbff5;
  border-radius: 999px; padding: 1px 8px;
}
.task2-accept { margin-left: 6px; }
@keyframes task-new-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(123, 92, 240, .18); }
  50%      { box-shadow: 0 0 0 6px rgba(123, 92, 240, .10); }
}
@media (prefers-reduced-motion: reduce) {
  .task2-item.task-new, li.task-row.task-new { animation: none; }
}

/* ----------------------------------------------- рабочий стол маркетинга (канбан)
   Колонки-этапы, карточки-ролики, пустая карточка «+» в каждой колонке и
   отдельный список готовых роликов. */
.mb-board { display: grid; gap: 14px;
  grid-template-columns: repeat(5, minmax(190px, 1fr)); align-items: start; }
@media (max-width: 1200px) { .mb-board { grid-template-columns: repeat(3, minmax(180px, 1fr)); } }
@media (max-width: 780px) { .mb-board { grid-template-columns: minmax(0, 1fr); } }
.mb-column { background: #f7f5ff; border: 1px solid var(--border);
  border-radius: 14px; padding: 10px; }
.mb-column-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.mb-column-title { font-weight: 700; font-size: 14.5px; }
.mb-column-count { background: #fff; border: 1px solid var(--border);
  border-radius: 999px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.mb-column-hint { margin: 2px 0 8px; }
.mb-cards { list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px; }
.mb-card { background: #fff; border: 1px solid var(--border);
  border-left: 3px solid #cdbff5; border-radius: 12px; padding: 9px 10px; }
.mb-card-important { border-left-color: #f0b429; background: #fffdf5; }
.mb-card-top { display: flex; gap: 6px; align-items: baseline; }
.mb-card-title { font-size: 14px; }
.mb-card-text { margin: 6px 0 0; }
.mb-card-script { margin-top: 6px; }
.mb-card-script p { margin: 6px 0 0; white-space: pre-line; }
.mb-card-video { margin: 6px 0 0; }
.mb-card-meta { margin-top: 6px; font-size: 11.5px; }
.mb-card-actions { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.mb-card-new { border-style: dashed; border-left-style: dashed; background: #fbfaff; }
.mb-add { display: block; text-align: center; font-size: 22px; line-height: 1.1;
  color: var(--accent); cursor: pointer; list-style: none; padding: 6px 0; }
.mb-add::-webkit-details-marker { display: none; }
.mb-add::marker { content: ""; }
.mb-form { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.mb-form label { font-size: 12.5px; color: var(--muted);
  display: flex; flex-direction: column; gap: 3px; }
.mb-form input, .mb-form textarea { font-size: 13px; }
.mb-ready { margin-top: 18px; }
.mb-ready-list { margin: 0; padding-left: 18px; display: flex;
  flex-direction: column; gap: 8px; }
