/* ============================================================
   Розділ «Справи відділу» — дошка вхідних і відповідей

   Базові кольори — ролі теми (--ink, --muted, --line, --surface, --soft,
   --accent, --accent-dark, --accent-fill). Сигнальні кольори дошки (строк,
   зауваження, рецензія, колонки) — власний шар --sp-*, перевизначений нижче
   під :root.dark-theme. Неіснуючих токенів із фолбеками (var(--border, #fff))
   тут немає: так свого часу назавжди засвітлили «Роз'яснення».
   ============================================================ */

:root {
  --sp-col-bg: #eef4f8;
  --sp-card-bg: #ffffff;
  --sp-card-line: #dbe6ee;
  --sp-hot-bg: #fff4d6;
  --sp-hot-ink: #7a5000;
  --sp-over-bg: #fde4e4;
  --sp-over-ink: #a11d1d;
  --sp-ok-bg: #e3f4ea;
  --sp-ok-ink: #1f6b43;
  --sp-rem-bg: #fde4e4;
  --sp-rem-ink: #a11d1d;
  --sp-ver-bg: #e6eefc;
  --sp-ver-ink: #23479a;
  --sp-chip-bg: #eef2f6;
  --sp-chip-ink: #48596a;
  --sp-drop: #cfe3f3;
  --sp-new: #8a9aab;
  --sp-work: #4a8fc7;
  --sp-review: #c58a12;
  --sp-signing: #7a5bc7;
  --sp-sz: #2a8a8a;
  --sp-done: #3a8462;
  --sp-co-bg: #e2f2f2;
  --sp-co-ink: #1d6464;
  --sp-lead-bg: #e8e4f8;
  --sp-lead-ink: #4a3a8f;
  --sp-bell-bg: #fff4d6;
  --sp-bell-ink: #7a5000;
  --sp-ctl: #c2410c;          /* «🎯 На контролі» */
  --sp-ctl-bg: #ffedd5;
  --sp-ctl-ink: #9a3412;
  --sp-wait: #d97706;         /* «⏳ Чекаємо відповіді» — ми надіслали */
  --sp-wait-bg: #fef3c7;
  --sp-wait-ink: #92400e;
  --sp-inc: #2563eb;          /* «📥 Треба врахувати» — нам надіслали */
  --sp-inc-bg: #dbeafe;
  --sp-inc-ink: #1e40af;
  --sp-prol: #7c3aed;         /* «↻ Строк продовжено» */
  --sp-prol-bg: #ede9fe;
  --sp-prol-ink: #5b21b6;
  --sp-note: #0d9488;         /* «📌 Врахувати в роботі» — відповідь не потрібна */
  --sp-note-bg: #ccfbf1;
  --sp-note-ink: #115e59;
  --sp-merge: #b45309;        /* «🧩 Об'єднано» — кілька вхідних, одна відповідь (19.11.2026) */
  --sp-merge-bg: #fdf0e1;
  --sp-merge-ink: #8a3c06;
}
:root.dark-theme {
  --sp-col-bg: #131c2b;
  --sp-card-bg: #1e293b;
  --sp-card-line: #334155;
  --sp-hot-bg: #3d2c08;
  --sp-hot-ink: #fbbf24;
  --sp-over-bg: #3f1416;
  --sp-over-ink: #fca5a5;
  --sp-ok-bg: #12321f;
  --sp-ok-ink: #86efac;
  --sp-rem-bg: #3f1416;
  --sp-rem-ink: #fca5a5;
  --sp-ver-bg: #1d2a4a;
  --sp-ver-ink: #a5c0ff;
  --sp-chip-bg: #273449;
  --sp-chip-ink: #cbd5e1;
  --sp-drop: #1d3a55;
  --sp-new: #94a3b8;
  --sp-work: #38bdf8;
  --sp-review: #fbbf24;
  --sp-signing: #c4b5fd;
  --sp-sz: #5eead4;
  --sp-done: #4ade80;
  --sp-co-bg: #12302f;
  --sp-co-ink: #5eead4;
  --sp-lead-bg: #2a2350;
  --sp-lead-ink: #c4b5fd;
  --sp-bell-bg: #3d2c08;
  --sp-bell-ink: #fbbf24;
  --sp-ctl: #fb923c;
  --sp-ctl-bg: #431a07;
  --sp-ctl-ink: #fdba74;
  --sp-wait: #fbbf24;
  --sp-wait-bg: #3d2c08;
  --sp-wait-ink: #fcd34d;
  --sp-inc: #60a5fa;
  --sp-inc-bg: #172554;
  --sp-inc-ink: #93c5fd;
  --sp-prol: #a78bfa;
  --sp-prol-bg: #2e1065;
  --sp-prol-ink: #c4b5fd;
  --sp-note: #2dd4bf;
  --sp-note-bg: #042f2e;
  --sp-note-ink: #5eead4;
  --sp-merge: #f59e0b;
  --sp-merge-bg: #3a2410;
  --sp-merge-ink: #fdba74;
}

.sp-hero h1 { margin-bottom: 4px; }
/* «Офіс відділу» (25.11.2026): шапка компактна — менший заголовок, опис в один рядок, дрібніші плитки */
.sp-hero { padding-top: 22px; padding-bottom: 16px; gap: 16px; }
.sp-hero .overline { margin-bottom: 6px; }
.sp-hero h1 { font-size: clamp(26px, 2.6vw, 34px); }
.sp-hero .sp-sub { font-size: 14.5px; line-height: 1.4; }
.sp-hero .stats { gap: 8px; }
.sp-hero .stat { min-width: 86px; padding: 8px 12px; border-radius: 12px; }
.sp-hero .stat strong { font-size: 21px; }
.sp-hero .stat span { font-size: 11.5px; }
/* Шапка «Офісу відділу» по центру (25.11.2026): рядок розділів (Головна…) посередині, під ним заголовок,
   опис і плитки стану — теж по центру. Бренд і кнопки входу лишаються на своїх місцях угорі */
.sp-hero { flex-direction: column; align-items: center; text-align: center; }
.sp-hero .hero-copy { display: flex; flex-direction: column; align-items: center; flex: none; width: 100%; max-width: none; }
.sp-hero .header-nav-row { align-self: stretch; text-align: left; }
.sp-hero .nav-row-2 { justify-content: center; }
.sp-hero h1, .sp-hero .sp-sub, .sp-hero .sp-dept { max-width: 900px; text-align: center; }
.sp-hero .overline { align-self: flex-start; }
.sp-hero .stats { justify-content: center; flex-wrap: wrap; }
.sp-hero .stat { text-align: center; }
.sp-sub { max-width: 70ch; }
.sp-dept { margin: 6px 0 0; font-weight: 700; color: var(--accent-dark); }
.sp-dept:empty { display: none; }

.sp-layout {
  /* Портальний .layout — двоколонковий grid: скидаємо, інакше дошка ляже в одну колонку */
  display: block;
  max-width: 1480px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

/* ---------- панель інструментів ---------- */
.sp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.sp-search {
  flex: 1 1 280px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
}
.sp-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  padding: 10px 0;
  outline: none;
}
.sp-toggle { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; cursor: pointer; }
.sp-dept-pick[hidden] { display: none; }
.sp-dept-pick {
  width: auto;
  max-width: 100%;
  min-width: 0;
  font: inherit;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.sp-btn {
  font: inherit;
  font-weight: 700;
  font-size: 14px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.sp-btn:hover { background: var(--soft); }
.sp-btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.sp-btn-primary:hover { background: var(--accent-dark); }
.sp-btn-ghost { background: transparent; }
.sp-btn-danger { color: var(--sp-over-ink); border-color: var(--sp-over-ink); background: transparent; }

/* ---------- дошка ---------- */
.sp-board {
  display: grid;
  grid-template-columns: var(--sp-cols, repeat(6, minmax(0, 1fr)));
  gap: 10px;
  align-items: start;
}
.sp-board.is-empty { display: block; }
.sp-notice {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
  line-height: 1.5;
}

.sp-col {
  background: var(--sp-col-bg);
  border-radius: 14px;
  padding: 10px;
  min-width: 0;
  border-top: 4px solid var(--sp-new);
}
.sp-col[data-stage="work"] { border-top-color: var(--sp-work); }
.sp-col[data-stage="review"] { border-top-color: var(--sp-review); }
.sp-col[data-stage="signing"] { border-top-color: var(--sp-signing); }
.sp-col[data-stage="sz_sent"] { border-top-color: var(--sp-sz); }
.sp-col[data-stage="done"] { border-top-color: var(--sp-done); }

.sp-col-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  padding: 2px 4px 10px;
}
.sp-col-title { font-weight: 800; color: var(--ink); }
.sp-col-count {
  font-size: 12px;
  font-weight: 800;
  padding: 1px 8px;
  border-radius: 99px;
  background: var(--surface);
  color: var(--muted);
}
.sp-col-hint { flex-basis: 100%; font-size: 12px; color: var(--muted); }
.sp-col-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
  border-radius: 10px;
  transition: background-color .15s;
}
.sp-col-body.is-over { background: var(--sp-drop); }

/* Згорнута колонка (лише ширше за 760px — на телефоні колонки й так по одній) */
.sp-col-fold {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font: 800 16px/1 inherit; padding: 0 2px; border-radius: 6px;
}
.sp-col-fold:hover, .sp-col-fold:focus-visible { color: var(--ink); background: var(--surface); }
@media (min-width: 761px) {
  .sp-col.is-folded { padding: 8px 4px; cursor: pointer; }
  .sp-col.is-folded .sp-col-head {
    flex-direction: column; align-items: center; flex-wrap: nowrap; gap: 8px; padding: 2px 0 8px;
  }
  .sp-col.is-folded .sp-col-title { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; font-size: 14px; }
  .sp-col.is-folded .sp-col-hint { display: none; }
  .sp-col.is-folded .sp-col-count { padding: 1px 6px; }
  .sp-col.is-folded .sp-col-body { min-height: 40px; }
  .sp-col.is-folded .sp-col-body > * { display: none; }
}
@media (max-width: 760px) { .sp-col-fold { display: none; } }
.sp-col-empty, .sp-col-more { font-size: 13px; color: var(--muted); text-align: center; padding: 14px 4px; }

.sp-card {
  background: var(--sp-card-bg);
  border: 1px solid var(--sp-card-line);
  border-radius: 12px;
  padding: 10px 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  transition: box-shadow .15s, transform .15s;
}
.sp-card:hover, .sp-card:focus-visible { box-shadow: var(--shadow); outline: none; }
.sp-card:focus-visible { border-color: var(--accent); }
.sp-card.is-dragging { opacity: .45; }
.sp-card-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 6px; align-items: center; }
.sp-inno { font-weight: 800; font-size: 13px; color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.sp-dl {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--sp-chip-bg);
  color: var(--sp-chip-ink);
  font-variant-numeric: tabular-nums;
}
.sp-dl.is-hot { background: var(--sp-hot-bg); color: var(--sp-hot-ink); }
.sp-dl.is-over { background: var(--sp-over-bg); color: var(--sp-over-ink); }
.sp-dl.is-closed { opacity: .75; }
.sp-subj {
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.sp-corr { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.sp-badges { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.sp-badges > span {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--sp-chip-bg);
  color: var(--sp-chip-ink);
}
.sp-badges .sp-ver { background: var(--sp-ver-bg); color: var(--sp-ver-ink); }
.sp-badges .sp-ok { background: var(--sp-ok-bg); color: var(--sp-ok-ink); }
.sp-badges .sp-rem { background: var(--sp-rem-bg); color: var(--sp-rem-ink); }
.sp-badges .sp-role-lead { background: var(--sp-lead-bg); color: var(--sp-lead-ink); }
.sp-badges .sp-role-co { background: var(--sp-co-bg); color: var(--sp-co-ink); }
.sp-badges .sp-role-answer { background: var(--sp-inc-bg); color: var(--sp-inc-ink); }
.sp-badges .sp-bell { background: var(--sp-chip-bg); color: var(--sp-chip-ink); }
.sp-badges .sp-bell.is-due { background: var(--sp-bell-bg); color: var(--sp-bell-ink); }
/* «🎯 На контролі» (09.11.2026): смужка ліворуч на картці, бейдж, блок у картці справи */
.sp-card.is-control { box-shadow: inset 4px 0 0 var(--sp-ctl); }
.sp-card.is-control:hover, .sp-card.is-control:focus-visible { box-shadow: inset 4px 0 0 var(--sp-ctl), var(--shadow); }
.sp-badges .sp-ctl { background: var(--sp-ctl-bg); color: var(--sp-ctl-ink); }
/* «↻ Строк продовжено»: бейдж із первинною датою і пунктирна рамка картки */
.sp-prol { background: var(--sp-prol-bg); color: var(--sp-prol-ink); font-weight: 700; cursor: help; }
.sp-prol-mini { font-size: 12px; padding: 0 6px; border-radius: 999px; white-space: nowrap; }
.sp-note { background: var(--sp-note-bg); color: var(--sp-note-ink); font-weight: 700; cursor: help; }
.sp-note-mini { font-size: 12px; padding: 0 6px; border-radius: 999px; white-space: nowrap; }
.sp-card.is-note { box-shadow: inset 4px 0 0 var(--sp-note); }
.sp-card.is-note:hover, .sp-card.is-note:focus-visible { box-shadow: inset 4px 0 0 var(--sp-note), var(--shadow); }
.sp-next.sp-next-note { color: var(--sp-note-ink); border-color: var(--sp-note); }
.sp-card.is-prolonged { outline: 2px dashed var(--sp-prol); outline-offset: -2px; }
.sp-ctl-mini { cursor: help; }
.sp-ctlbox { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; align-items: end;
  margin: 0 0 12px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 12px; }
.sp-ctlbox.is-on { border: 1px solid var(--sp-ctl); background: var(--sp-ctl-bg); }
.sp-ctlbox.is-on .sp-check > span, .sp-ctlbox.is-on .sp-f > span { color: var(--sp-ctl-ink); font-weight: 700; }
.sp-ctlbox input:not([type="checkbox"]) { background: var(--surface); }
.sp-ctl-from { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--sp-ctl-ink); overflow-wrap: anywhere; }
@media (max-width: 560px) { .sp-ctlbox { grid-template-columns: minmax(0, 1fr); } }
.sp-ctl-pick { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.sp-ctl-pick input { margin-top: 3px; flex: none; }
.sp-ctl-dl { color: var(--sp-hot-ink); font-size: 13px; }

/* 🔗 Зв'язки справ (09.11.2026): ⏳ ми надіслали — чекаємо; 📥 нам надіслали — врахувати */
.sp-badges .sp-wait { background: var(--sp-wait-bg); color: var(--sp-wait-ink); }
/* «Ми надіслали — чекаємо»: дата відправлення і скільки днів без відповіді */
.sp-card.is-waiting { box-shadow: inset 4px 0 0 var(--sp-wait); }
.sp-card.is-waiting:hover, .sp-card.is-waiting:focus-visible { box-shadow: inset 4px 0 0 var(--sp-wait), var(--shadow); }
.sp-card.is-control.is-waiting { box-shadow: inset 4px 0 0 var(--sp-ctl), inset 8px 0 0 var(--sp-wait); }
.sp-sent { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 8px;
  margin: 6px 0 2px; padding: 5px 8px; border-radius: 8px; background: var(--sp-wait-bg); color: var(--sp-wait-ink);
  font-size: 12px; line-height: 1.35; min-width: 0; cursor: help; }
.sp-sent-doc { min-width: 0; overflow-wrap: anywhere; }
.sp-sent-doc i { font-style: normal; opacity: .85; }
.sp-sent-wait { font-weight: 700; white-space: nowrap; }
.sp-sent.is-warm .sp-sent-wait { color: var(--sp-wait); }
.sp-sent.is-over, .sp-sent.is-in.is-over { background: var(--sp-over-bg); color: var(--sp-over-ink); }
.sp-sent-mini { font-size: 12px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: var(--sp-wait-bg); color: var(--sp-wait-ink); white-space: nowrap; cursor: help; }
.sp-card.is-incoming { box-shadow: inset 4px 0 0 var(--sp-inc); }
.sp-card.is-incoming:hover, .sp-card.is-incoming:focus-visible { box-shadow: inset 4px 0 0 var(--sp-inc), var(--shadow); }
.sp-sent-dir { font-weight: 800; }
.sp-sent.is-in, .sp-sent-mini.is-in { background: var(--sp-inc-bg); color: var(--sp-inc-ink); }
.sp-sent.is-in.is-warm .sp-sent-wait { color: var(--sp-inc); }
.sp-sent-mini.is-over { background: var(--sp-over-bg); color: var(--sp-over-ink); }
.sp-badges .sp-inc { background: var(--sp-inc-bg); color: var(--sp-inc-ink); }
.sp-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sp-link { border: 1px solid var(--line); border-left: 4px solid var(--sp-wait); border-radius: 10px;
  padding: 8px 10px; background: var(--soft); min-width: 0; }
.sp-link.is-in { border-left-color: var(--sp-inc); }
.sp-link.is-answered { border-left-color: var(--sp-ok-ink); }
.sp-link.is-closed { border-left-color: var(--muted); opacity: .75; }
.sp-link-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; min-width: 0; overflow-wrap: anywhere; }
.sp-link-head b { color: var(--ink); }
.sp-link-dir { font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--sp-wait-bg); color: var(--sp-wait-ink); }
.sp-link.is-in .sp-link-dir { background: var(--sp-inc-bg); color: var(--sp-inc-ink); }
.sp-link-status { width: auto; margin-left: auto; padding: 4px 6px; font-size: 13px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 8px; }
.sp-link-del { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 4px; }
.sp-link-del:hover { color: var(--sp-over-ink); }
.sp-link-body { margin: 6px 0 0; line-height: 1.45; overflow-wrap: anywhere; }
.sp-link-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 0; font-size: 13px; color: var(--muted); }
.sp-link-case { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.sp-link-ans { width: 100%; box-sizing: border-box; background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; font: inherit; font-size: 14px; }
.sp-link-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.sp-link-ctx { margin: 0 0 8px; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.sp-link-ctx b { color: var(--ink); }
.sp-peers { margin: 0 0 8px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 8px; overflow-wrap: anywhere; }
.sp-peers b { color: var(--ink); }
.sp-peer { padding: 1px 8px; border-radius: 999px; background: var(--sp-chip-bg); color: var(--sp-chip-ink); }
@media (max-width: 560px) { .sp-link-status { margin-left: 0; } }

/* ---------- смуга нагадувань ---------- */
.sp-reminders {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--sp-bell-bg);
  color: var(--sp-bell-ink);
}
.sp-reminders[hidden] { display: none; }
.sp-remind {
  font: inherit;
  font-size: 13px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 4px 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.sp-remind:hover { border-color: var(--sp-bell-ink); }
.sp-remind span { font-weight: 800; color: var(--sp-bell-ink); font-variant-numeric: tabular-nums; }
.sp-ava {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: var(--accent-fill);
  color: #fff;
}
.sp-ava.is-none { background: var(--sp-chip-bg); color: var(--muted); }
.sp-out { font-size: 12px; color: var(--sp-ok-ink); font-weight: 700; }

/* перемикач етапів — лише на вузькому екрані */
.sp-stage-tabs { display: none; }

/* ---------- довідка ---------- */
.sp-help {
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 16px;
  color: var(--ink);
}
.sp-help summary { cursor: pointer; font-weight: 700; color: var(--accent-dark); }
.sp-help ul { margin: 10px 0 4px; padding-left: 20px; line-height: 1.55; }
.sp-help code { overflow-wrap: anywhere; }

/* ---------- картка справи (діалог збоку) ---------- */
.sp-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: min(720px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
}
.sp-drawer[open] { display: flex; }
.sp-drawer::backdrop, .sp-new::backdrop { background: rgba(15, 23, 42, .45); }
.sp-drawer-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}
.sp-drawer-titles { flex: 1; min-width: 0; }
.sp-drawer-titles h2 { margin: 0 0 4px; font-size: 19px; color: var(--accent-dark); }
.sp-drawer-titles p { margin: 0; color: var(--ink); line-height: 1.4; overflow-wrap: anywhere; }
.sp-x {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
}
.sp-x:hover { background: var(--soft); color: var(--ink); }
.sp-drawer-body { flex: 1; overflow-y: auto; padding: 14px 18px 24px; }

.sp-stepper { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; margin-bottom: 10px; }
.sp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.sp-actions .sp-btn { font-size: 13px; padding: 7px 10px; }

/* головний виконавець і наша роль — першими в картці */
.sp-lead {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 10px 12px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 10px;
  background: var(--sp-lead-bg);
}
.sp-lead .sp-f > span { color: var(--sp-lead-ink); }
.sp-lead input, .sp-lead select { background: var(--surface); }
/* ↩ ВІДПОВІДЬ — вхідна службова у відповідь на нашу (17.11.2026) */
.sp-answer {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px;
  padding: 9px 12px; margin-bottom: 10px; border-radius: 10px;
  background: var(--sp-inc-bg); color: var(--sp-inc-ink);
}
.sp-answer-txt { flex: 1 1 260px; min-width: 0; font-size: 13px; line-height: 1.35; }
.sp-answer-btn { background: var(--sp-inc); border-color: var(--sp-inc); color: var(--surface, #fff); font-weight: 700; letter-spacing: .02em; }
.sp-answer-btn:hover { filter: brightness(1.08); }
.sp-answer.is-on { background: var(--sp-ok-bg); color: var(--sp-ok-ink); }
.sp-answer.is-on .sp-btn { font-size: 12px; padding: 5px 9px; }
/* ✅ Виконано — співвиконавці: нашу СЗ надано головному, нашу частину закрито (24.11.2026) */
.sp-codone-btn { background: var(--sp-ok-ink); border-color: var(--sp-ok-ink); }
.sp-badges .sp-codone-mini { background: var(--sp-ok-bg); color: var(--sp-ok-ink); font-weight: 700; }
.sp-orig { font-style: normal; font-weight: 600; color: var(--sp-hot-ink); }
.sp-step {
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 4px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sp-step.is-past { color: var(--ink); }
.sp-step.is-current { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }

.sp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.sp-f { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sp-f > span { font-size: 12px; font-weight: 700; color: var(--muted); }
.sp-wide { grid-column: 1 / -1; }
.sp-f input, .sp-f select, .sp-f textarea,
.sp-remark-form input, .sp-remark-form select, .sp-comment-form input,
.sp-remark-answer input, .sp-remark-status {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.sp-f textarea { resize: vertical; line-height: 1.4; }
.sp-f input:focus, .sp-f select:focus, .sp-f textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.sp-check { flex-direction: row; align-items: center; gap: 8px; align-self: end; padding-bottom: 8px; }
.sp-check input { width: auto; }
.sp-check > span { font-size: 14px; color: var(--ink); }
.sp-ro b { font-weight: 700; color: var(--ink); padding: 7px 0; }
.sp-linkrow { display: flex; gap: 6px; }
.sp-linkrow input { flex: 1; }

.sp-block { margin-top: 22px; }
.sp-block h3 { font-size: 15px; margin: 0 0 8px; color: var(--ink); }
.sp-muted { color: var(--muted); font-weight: 500; font-size: 13px; }
.sp-none { list-style: none; padding: 6px 0; }

.sp-remarks, .sp-feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sp-remark {
  border: 1px solid var(--line);
  border-left: 4px solid var(--sp-rem-ink);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--soft);
}
.sp-remark.is-done { border-left-color: var(--sp-ok-ink); }
.sp-remark.is-rejected { border-left-color: var(--muted); }
.sp-remark-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.sp-remark-head b { color: var(--ink); }
.sp-remark-status { width: auto; margin-left: auto; padding: 4px 6px; font-size: 13px; }
.sp-remark-body { margin: 6px 0; line-height: 1.45; overflow-wrap: anywhere; }
.sp-remark.is-done .sp-remark-body { color: var(--muted); }
.sp-remark-answer { display: grid; grid-template-columns: minmax(0, 1fr) 72px; gap: 6px; }
.sp-remark-answer input { background: var(--surface); }

.sp-remark-form, .sp-comment-form { display: flex; gap: 6px; margin-top: 8px; }
.sp-remark-form select { width: auto; flex: none; max-width: 40%; }
.sp-remark-form input, .sp-comment-form input { flex: 1; }
.sp-comment-form { margin: 0 0 10px; }

.sp-ev {
  display: grid;
  grid-template-columns: 20px 82px minmax(0, 130px) minmax(0, 1fr);
  gap: 8px;
  font-size: 13.5px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.sp-ev-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-ev-who { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-ev-what { overflow-wrap: anywhere; color: var(--ink); }
.sp-ev-comment .sp-ev-what { font-style: italic; }
.sp-ev-stage .sp-ev-what { color: var(--accent-dark); font-weight: 700; }
.sp-ev-ico { text-align: center; }
.sp-ev-returned .sp-ev-what, .sp-ev-remark .sp-ev-what { color: var(--sp-rem-ink); }
.sp-ev-deadline .sp-ev-what { color: var(--sp-hot-ink); font-weight: 600; }
.sp-ev-outgoing .sp-ev-what { color: var(--sp-ok-ink); }
.sp-ev.is-done { opacity: .6; }
.sp-ev.is-done .sp-ev-what span { text-decoration: line-through; }
.sp-rem-check { display: flex; gap: 6px; align-items: flex-start; cursor: pointer; }
.sp-rem-check input { margin-top: 3px; }

.sp-drawer-foot { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- нова справа ---------- */
.sp-new {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  padding: 18px;
  box-shadow: var(--shadow);
}
.sp-new h2 { margin: 0 0 12px; font-size: 18px; }
.sp-act .sp-check { align-self: start; padding-bottom: 0; }
.sp-new .sp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sp-new-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.sp-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 1000;
  max-width: calc(100vw - 32px);
  background: var(--ink);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.sp-toast.is-bad { background: var(--sp-over-ink); color: #fff; }

/* ---------- адаптивність ---------- */
@media (max-width: 1180px) {
  /* П'ять колонок у ряд стають завузькими: горизонтальна прокрутка дошки,
     а не сторінки (сама сторінка ширшою за екран не стає). */
  .sp-board { grid-template-columns: var(--sp-cols-narrow, repeat(6, minmax(210px, 1fr))); overflow-x: auto; padding-bottom: 8px; }
}

@media (max-width: 760px) {
  .sp-layout { padding: 12px 16px 40px; }
  .sp-toolbar .sp-search { flex-basis: 100%; }
  .sp-dept-pick { flex: 1 1 100%; }
  .sp-toolbar .sp-btn-primary { margin-left: auto; }

  .sp-stage-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-bottom: 10px;
  }
  .sp-stab {
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    padding: 7px 2px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
    min-width: 0;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }
  .sp-stab b { display: block; font-size: 15px; color: var(--ink); }
  .sp-stab.is-active { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
  .sp-stab.is-active b { color: #fff; }

  /* Одна колонка за раз — та, що обрана в перемикачі */
  .sp-board { display: block; overflow: visible; }
  .sp-col { display: none; }
  .sp-col.is-mobile-active { display: block; }
  .sp-col-head { display: none; }

  .sp-drawer { width: 100vw; border-left: 0; }
  .sp-drawer-head { padding: 12px 14px 10px; }
  .sp-drawer-body { padding: 12px 14px 24px; }
  .sp-stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sp-lead { grid-template-columns: minmax(0, 1fr); }
  .sp-actions .sp-btn { flex: 1 1 calc(50% - 6px); white-space: normal; }
  .sp-step { font-size: 11px; padding: 7px 2px; }
  .sp-grid, .sp-new .sp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sp-ev { grid-template-columns: 20px minmax(0, 1fr) minmax(0, 1fr); }
  .sp-ev-what { grid-column: 2 / -1; }
  .sp-remark-form { flex-wrap: wrap; }
  .sp-remark-form select { max-width: none; flex: 1 1 100%; }
}

/* ---------- крок 2 спрощення: «далі →» і «Більше полів» ---------- */
.sp-next {
  align-self: flex-end;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
}
.sp-next:hover { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.sp-more { margin-top: 12px; border-top: 1px dashed var(--line); padding-top: 8px; }
.sp-more > summary { cursor: pointer; font-weight: 700; font-size: 13px; color: var(--muted); padding: 4px 0 8px; }
.sp-more[open] > summary { color: var(--accent-dark); }

/* ---------- крок 4: вигляди «Список» і «За виконавцями» ---------- */
.sp-view {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface);
}
.sp-view button {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.sp-view button + button { border-left: 1px solid var(--line); }
.sp-view button[aria-pressed="true"] { background: var(--accent-fill); color: #fff; }
.sp-stage-tabs[hidden] { display: none !important; }

.sp-board.is-list { display: block; overflow: visible; }
.sp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sp-row {
  display: grid;
  grid-template-columns: 190px 120px minmax(0, 1fr) 170px 170px;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border: 1px solid var(--sp-card-line);
  border-radius: 10px;
  background: var(--sp-card-bg);
  cursor: pointer;
  font-size: 14px;
  min-width: 0;
}
.sp-person .sp-row { grid-template-columns: 190px 120px minmax(0, 1fr) 170px; }
.sp-row:hover, .sp-row:focus-visible { box-shadow: var(--shadow); outline: none; }
.sp-row-no { font-weight: 800; color: var(--accent-dark); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.sp-row-subj { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.sp-row-subj i { font-style: normal; color: var(--muted); margin-left: 8px; font-size: 13px; }
.sp-row-ex { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-row-stage { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-stage-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--sp-new); }
.sp-row-work .sp-stage-dot { background: var(--sp-work); }
.sp-row-review .sp-stage-dot { background: var(--sp-review); }
.sp-row-signing .sp-stage-dot { background: var(--sp-signing); }
.sp-row-sz_sent .sp-stage-dot { background: var(--sp-sz); }
.sp-row-done, .sp-row-sz_sent { opacity: .65; }
/* «СЗ надано» = закрито: картка приглушена, але смужку «⏳ чекаємо» видно повністю */
.sp-card.is-closed > :not(.sp-sent) { opacity: .7; }
.sp-row-done .sp-stage-dot { background: var(--sp-done); }
.sp-rem-mini { color: var(--sp-rem-ink); font-weight: 700; }

.sp-person { margin-bottom: 18px; }
.sp-person-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.sp-person-head b { color: var(--ink); font-size: 15px; }
.sp-person-stats { color: var(--muted); font-size: 13px; }

@media (max-width: 1180px) {
  .sp-row, .sp-person .sp-row { grid-template-columns: 170px 110px minmax(0, 1fr); }
  .sp-row-ex, .sp-row-stage { grid-column: 3; }
}
@media (max-width: 760px) {
  .sp-view { flex: 1 1 100%; }
  .sp-view button { flex: 1; padding: 8px 4px; }
  .sp-row, .sp-person .sp-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; }
  .sp-row-dl { grid-column: 1; }
  .sp-row-no { grid-column: 2; grid-row: 1; text-align: right; }
  .sp-row-subj, .sp-row-ex, .sp-row-stage { grid-column: 1 / -1; }
  .sp-row-subj { white-space: normal; }
}

/* ============================================================
   Голосова кімната відділу (voice.js)
   Свій шар --spv-*, перевизначений під :root.dark-theme.
   ============================================================ */
:root {
  --spv-bg: #f3f8fc;
  --spv-line: #d3e3ef;
  --spv-ava: #dbe8f3;
  --spv-ava-ink: #23476b;
  --spv-speak: #22a25b;
  --spv-live: #22a25b;
  --spv-on-bg: #e3f4ea;
  --spv-on-ink: #1f6b43;
  --spv-off-bg: #fde4e4;
  --spv-off-ink: #a11d1d;
  --spv-office-bg: #f1faf5;
  --spv-office-line: #bfe3cd;
  --spv-office-ink: #1f6b43;
  --spv-office-ico: #d5f0e0;
  --spv-tet-bg: #f6f3fd;
  --spv-tet-line: #d4c9f1;
  --spv-tet-ink: #4b3a8a;
  --spv-tet-ico: #e7e0fa;
}
:root.dark-theme {
  --spv-bg: #16202f;
  --spv-line: #2c3b52;
  --spv-ava: #26364d;
  --spv-ava-ink: #cfe0f5;
  --spv-speak: #4ade80;
  --spv-live: #4ade80;
  --spv-on-bg: #12321f;
  --spv-on-ink: #86efac;
  --spv-off-bg: #3f1416;
  --spv-off-ink: #fca5a5;
  --spv-office-bg: #0f2419;
  --spv-office-line: #285640;
  --spv-office-ink: #86efac;
  --spv-office-ico: #173a28;
  --spv-tet-bg: #1d1830;
  --spv-tet-line: #4d4180;
  --spv-tet-ink: #c9bdf5;
  --spv-tet-ico: #2c2550;
}

.spv {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid var(--spv-line);
  border-radius: 14px;
  background: var(--spv-bg);
  color: var(--ink);
}
.spv-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.spv-head {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.spv-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
  flex: none;
}
.spv-dot.is-live { background: var(--spv-live); box-shadow: 0 0 0 3px color-mix(in srgb, var(--spv-live) 25%, transparent); }
.spv-count { color: var(--muted); font-size: 13px; }

.spv-people {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  flex: 1 1 auto;
  min-width: 0;
}
.spv-person {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 220px;
  padding: 3px 9px 3px 3px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--spv-line);
  font-size: 13px;
}
.spv-ava {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--spv-ava);
  color: var(--spv-ava-ink);
  font-size: 11px;
  font-weight: 800;
  flex: none;
  box-shadow: 0 0 0 2px transparent;
  transition: box-shadow 0.12s ease;
}
.spv-person.is-speaking .spv-ava { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--spv-speak); }
.spv-person.is-wait { opacity: 0.65; }
.spv-person.is-bad { border-color: var(--spv-off-ink); }
.spv-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spv-name i { color: var(--muted); font-style: normal; }
.spv-flag { font-size: 12px; flex: none; }

.spv-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  flex: 1 1 220px;
}
.spv-note.is-bad { color: var(--spv-off-ink); }
/* «🚪 В гості»: стуки в нашу кімнату і список кімнат інших відділів */
.spv-knocks { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.spv-knock {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 6px 8px;
  border: 1px solid var(--spv-line); border-left: 4px solid var(--spv-live); border-radius: 10px;
  background: var(--spv-on-bg); color: var(--spv-on-ink); font-size: 14px; min-width: 0;
}
.spv-knock > span { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.spv-knock i { font-style: normal; opacity: .85; }
/* «Вивести» гостя, якого впустили за стуком (17.11.2026) */
.spv-kick {
  flex: none; margin-left: 2px; padding: 1px 7px;
  border: 1px solid var(--spv-line); border-radius: 7px;
  background: transparent; color: var(--spv-off-ink);
  font: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer;
}
.spv-kick:hover { border-color: var(--spv-off-ink); }
.spv-visit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.spv-visit-hint { flex-basis: 100%; font-size: 13px; color: var(--muted); }
/* Сюди перетягують ім'я зі списку «в мережі» — покликати в кімнату */
.spv.is-drop { outline: 3px dashed var(--spv-live); outline-offset: 2px; }

/* «Показати екран» — зрозуміла кнопка з іконкою монітора й підписом (25.11.2026) */
.spv-share { display: inline-flex; align-items: center; gap: 6px; }
.spv-svg { width: 17px; height: 17px; flex: none; display: block; }
/* Показ екрана — окрема дія: стоїть осторонь від кнопок голосу, синім тоном */
.spv-actions .spv-share { margin-right: 10px; border-color: color-mix(in srgb, var(--accent) 55%, transparent); color: var(--accent-dark, var(--accent)); }
.spv-actions .spv-share.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* Дві кімнати поруч (25.11.2026): «🎙 Голосовий офіс відділу» і «🤝 Дорадча кімната» — картки одного
   вигляду й однієї ваги, кожна у своєму відтінку (офіс — зелений, дорадча — бузковий) */
.spv-rooms { flex: 1 1 100%; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 10px; min-width: 0; }
.spv-rooms.is-single { grid-template-columns: minmax(0, 1fr); }
.spv-room {
  --room-bg: var(--spv-office-bg); --room-line: var(--spv-office-line); --room-ink: var(--spv-office-ink); --room-ico: var(--spv-office-ico);
  display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 10px 12px;
  border: 1px solid var(--room-line); border-radius: 14px; background: var(--room-bg);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.spv-room.is-tet { --room-bg: var(--spv-tet-bg); --room-line: var(--spv-tet-line); --room-ink: var(--spv-tet-ink); --room-ico: var(--spv-tet-ico); }
.spv-room.is-live { box-shadow: 0 0 0 1px var(--room-line), 0 6px 18px color-mix(in srgb, var(--room-ink) 10%, transparent); }
.spv-room-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.spv-room-ico {
  flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: var(--room-ico); font-size: 18px; line-height: 1;
}
.spv-room-title { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.spv-room-title b { color: var(--room-ink); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spv-room-title small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spv-live-txt { color: var(--spv-live); font-weight: 700; }
.spv-room .spv-people:empty { display: none; }
.spv-room-hint { margin: 0; font-size: 13px; color: var(--muted); }
.spv-room-foot { display: flex; justify-content: flex-end; }
.spv-room .spv-tet-in { border-color: var(--room-line); color: var(--room-ink); font-weight: 700; }
.spv-room .spv-tet-in:hover { border-color: var(--room-ink); }
/* Куди перетягнути колегу: тонка пунктирна площина всередині картки, яскравіша під час перетягування */
.spv-room-drop {
  margin: 0; flex: 1 1 auto; display: grid; place-items: center; min-height: 46px; padding: 8px 10px; text-align: center;
  border: 1.5px dashed color-mix(in srgb, var(--room-line) 80%, transparent); border-radius: 10px;
  color: var(--muted); font-size: 12.5px;
}
.spv-room.is-off .spv-room-drop { opacity: .75; }
.spv.is-dragging .spv-room[data-tetzone] .spv-room-drop { border-color: var(--room-ink); color: var(--room-ink); }
.spv-room[data-tetzone].is-over { border-color: var(--room-ink); background: color-mix(in srgb, var(--room-line) 35%, var(--room-bg)); }
.spv-room[data-droproom].is-over { border-color: var(--room-ink); background: color-mix(in srgb, var(--room-line) 35%, var(--room-bg)); }
.spv.is-dragging .spv-room { border-style: dashed; }
.spv-person.is-lifted { opacity: .4; }
.spv-room[data-tetzone].is-over .spv-room-drop { border-style: solid; border-color: var(--room-ink); color: var(--room-ink); }
.spv-person.is-draggable { cursor: grab; }
.spv-person.is-draggable:active { cursor: grabbing; }
@media (prefers-reduced-motion: reduce) { .spv-room { transition: none; } }
@media (max-width: 700px) { .spv-rooms { grid-template-columns: minmax(0, 1fr); } }

.spv-actions {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
.spv-btn {
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.spv-btn:hover { background: var(--soft); }
.spv-btn.is-on { background: var(--spv-on-bg); color: var(--spv-on-ink); border-color: var(--spv-on-ink); }
.spv-btn.is-off { background: var(--spv-off-bg); color: var(--spv-off-ink); border-color: var(--spv-off-ink); }
.spv-icon { padding: 7px 10px; }
.spv-ghost { background: transparent; }
.spv-join { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.spv-join:hover { background: var(--accent-dark); }
.spv-sound { background: var(--sp-hot-bg); color: var(--sp-hot-ink); border-color: var(--sp-hot-ink); }

@media (max-width: 760px) {
  .spv-main { gap: 8px; }
  .spv-people { flex-basis: 100%; }
  .spv-person { max-width: calc(50% - 3px); }
  .spv-actions { margin-left: 0; flex-basis: 100%; }
  .spv-actions .spv-btn:first-child { flex: 1 1 auto; }
}

/* ============================================================
   Текстовий канал відділу (room-chat.js) — під голосовою кімнатою.
   Кольори — шар --spv-* голосової кімнати і ролі теми.
   ============================================================ */
.spc {
  margin: -6px 0 14px;
  border: 1px solid var(--spv-line);
  border-radius: 14px;
  background: var(--spv-bg);
  color: var(--ink);
  overflow: hidden;
  position: relative;
}
.spc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.spc-head:hover { background: color-mix(in srgb, var(--spv-line) 35%, transparent); }
.spc-title { font-weight: 700; white-space: nowrap; }
.spc-badge {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--spv-off-ink);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}
.spc-last {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spc-caret { color: var(--muted); transition: transform 0.15s ease; }
.spc-head[aria-expanded="true"] .spc-caret { transform: rotate(180deg); }

.spc-body { border-top: 1px solid var(--spv-line); position: relative; }
/* display у правилах нижче не має перебивати атрибут hidden */
.spc [hidden] { display: none !important; }
.spc-list {
  max-height: 340px;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.spc-empty { margin: 8px 0; color: var(--muted); font-size: 13px; }
.spc-day {
  display: flex;
  justify-content: center;
  margin: 8px 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.spc-day span { padding: 1px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--spv-line); }

.spc-msg {
  position: relative;
  max-width: min(78%, 620px);
  padding: 6px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--spv-line);
  font-size: 14px;
  line-height: 1.4;
  margin-top: 6px;
  align-self: flex-start;
}
.spc-msg.is-cont { margin-top: 0; }
.spc-msg.is-mine { align-self: flex-end; background: var(--spv-on-bg); border-color: color-mix(in srgb, var(--spv-on-ink) 30%, transparent); }
.spc-meta { display: flex; gap: 8px; align-items: baseline; margin-bottom: 2px; font-size: 12px; }
.spc-meta b { color: var(--ink); }
.spc-meta time { color: var(--muted); }
.spc-text { overflow-wrap: anywhere; }
.spc-text a { color: var(--accent); }
.spc-del {
  position: absolute;
  top: 2px;
  right: 4px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  opacity: 0;
}
.spc-msg:hover .spc-del, .spc-del:focus-visible { opacity: 1; }

.spc-file {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  border-radius: 8px;
  background: var(--soft);
  border: 1px solid var(--line);
  color: var(--ink) !important;
  text-decoration: none;
  max-width: 100%;
}
.spc-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.spc-file small { color: var(--muted); }
.spc-file img { max-width: 260px; max-height: 180px; border-radius: 6px; object-fit: cover; }
.spc-file:hover { border-color: var(--accent); }

.spc-busy { margin: 0; padding: 4px 12px; font-size: 12px; color: var(--muted); }
.spc-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--spv-line);
}
.spc-attach {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-size: 16px;
}
.spc-attach:hover { background: var(--soft); }
.spc-form textarea {
  flex: 1 1 auto;
  min-width: 0;
  resize: none;
  font: inherit;
  font-size: 14px;
  line-height: 1.4;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  max-height: 140px;
}
.spc-foot { padding: 0 12px 8px; font-size: 12px; color: var(--muted); }
.spc-foot a { color: var(--accent); }
.spc-drop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--spv-bg) 88%, transparent);
  border: 2px dashed var(--accent);
  border-radius: 0 0 14px 14px;
  font-weight: 700;
  pointer-events: none;
}

@media (max-width: 760px) {
  .spc-msg { max-width: 92%; }
  .spc-last { display: none; }
  .spc-form .spv-btn { padding: 7px 10px; }
}

/* Над голосовою кімнатою: «Кімната відділу» і посилання на кімнату департаменту в чаті (з 04.11.2026) */
.spv-scope { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 12px; margin-bottom: 8px; }
.spv-scope[hidden] { display: none; }
.spv-scope-here { font-size: 13px; font-weight: 800; color: var(--ink); }
.spv-scope-link { font-size: 13px; font-weight: 700; color: var(--accent); text-decoration: none; white-space: nowrap; }
.spv-scope-link:hover { text-decoration: underline; }

/* Види справ (03.11.2026): вибір виду в діалозі нової справи, значки на картках */
.sp-kinds { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.sp-kinds label { cursor: pointer; }
.sp-kinds input { position: absolute; opacity: 0; pointer-events: none; }
.sp-kinds span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 13px; font-weight: 700; color: var(--ink); }
.sp-kinds input:checked + span { background: var(--accent-fill); border-color: var(--accent-fill); color: #fff; }
.sp-kinds input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
#spNewForm [data-for][hidden] { display: none !important; }
.sp-kind-task, .sp-kind-event, .sp-kind-project { background: var(--sp-chip-bg); color: var(--sp-chip-ink); }
.sp-card-event { border-left: 3px solid var(--sp-review); }
.sp-card-task { border-left: 3px solid var(--sp-work); }
.sp-card-project { border-left: 3px solid var(--sp-signing); }

/* Напрями (етап 2, 03.11.2026): належність до напряму, віхи, пов'язані справи */
.sp-parent { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-ms-line { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.sp-ms-bar { flex: 0 0 56px; height: 6px; border-radius: 3px; background: var(--sp-chip-bg);
  background-image: linear-gradient(var(--sp-ok-ink), var(--sp-ok-ink)); background-repeat: no-repeat; background-size: var(--p) 100%; }
.sp-ms, .sp-kids { list-style: none; margin: 0 0 10px; padding: 0; }
.sp-ms-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--line); }
.sp-ms-item label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.sp-ms-item.is-done span { text-decoration: line-through; color: var(--muted); }
.sp-ms-due { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sp-ms-item.is-late .sp-ms-due { color: #c0392b; font-weight: 700; }
.sp-ms-del { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.sp-ms-del:hover { background: var(--sp-chip-bg); color: var(--ink); }
.sp-ms-form { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; margin: 0 0 18px; }
.sp-ms-form input { min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font: inherit; }
.sp-kid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; width: 100%; text-align: left;
  padding: 7px 9px; margin-bottom: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.sp-kid:hover { border-color: var(--accent); }
.sp-kid span { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sp-kid b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-kid i { grid-column: 2; font-style: normal; font-size: 12px; color: var(--muted); }
.sp-kid.is-done { opacity: .6; }
@media (max-width: 560px) {
  .sp-ms-form { grid-template-columns: minmax(0, 1fr) auto; }
  .sp-ms-form .sp-btn { grid-column: 1 / -1; }
}

/* ---------- журнал АСКОД (askod-upload.js) ---------- */
.sp-jr { width: min(640px, calc(100vw - 32px)); }
.sp-jr-file { margin: 0 0 10px; overflow-wrap: anywhere; }
.sp-jr-warn { margin: 0 0 10px; padding: 8px 12px; border-radius: 10px; background: var(--sp-hot-bg); color: var(--sp-hot-ink); font-size: 14px; }
.sp-jr-warn.is-bad { background: var(--sp-over-bg); color: var(--sp-over-ink); }
.sp-jr-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin: 4px 0 10px; }
.sp-jr-stats div { border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; background: var(--soft); }
.sp-jr-stats strong { display: block; font-size: 22px; line-height: 1.1; }
.sp-jr-stats span { color: var(--muted); font-size: 13px; }
.sp-jr-note { display: block; margin: 0 0 10px; line-height: 1.4; }
.sp-jr-list { border-top: 1px solid var(--line); padding: 6px 0; }
.sp-jr-list summary { cursor: pointer; font-weight: 700; }
.sp-jr-list ul { list-style: none; margin: 6px 0 0; padding: 0; max-height: 240px; overflow: hidden auto; }
.sp-jr-list li { padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 14px; overflow-wrap: anywhere; }
.sp-jr-chg { color: var(--sp-ver-ink); font-size: 13px; }
.sp-jr-subj { color: var(--muted); font-size: 13px; }

/* Нарада із записом (03.11.2026): кнопка й смуга «іде запис» у голосовій кімнаті */
.spv-btn.spv-rec.is-on { background: #c0392b; border-color: #c0392b; color: #fff; }
.spv-recbar { margin: 6px 0 0; padding: 6px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 700;
  background: color-mix(in srgb, #c0392b 12%, transparent); color: #c0392b; }
:root.dark-theme .spv-recbar { color: #ff8a80; }

/* Кнопка «Нарада» (03.11.2026, правка): у спокої — звичайна кнопка з сірою крапкою;
   під час запису — червона, крапка біла й «дихає». Раніше була червоною завжди */
.rec-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px;
  border: 2px solid currentColor; box-sizing: border-box; opacity: .7; }
.is-on > .rec-dot { background: #fff; border-color: #fff; opacity: 1; animation: rec-pulse 1.2s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: .25; transform: scale(.75); } }
@media (prefers-reduced-motion: reduce) { .is-on > .rec-dot { animation: none; } }

/* Пінг до колеги в голосовій кімнаті (04.11.2026): зелений < 150 мс, жовтий < 300, червоний — далі */
.spv-ping { flex: none; font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.spv-ping.is-good { color: var(--spv-on-ink); }
.spv-ping.is-mid { color: #b7791f; }
.spv-ping.is-bad { color: var(--spv-off-ink); }
:root.dark-theme .spv-ping.is-mid { color: #fbbf24; }
@media (min-width: 761px) { .spv-person { max-width: 280px; } }

/* Смуги дошки (09.11.2026): листи й звернення окремо від вхідних службових записок */
.sp-lane { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 8px; margin: 6px 0 0; padding: 6px 2px 6px 10px;
  font-size: 15px; font-weight: 800; color: var(--ink); border-left: 4px solid var(--accent); border-bottom: 1px solid var(--line); }
.sp-lane b { font-variant-numeric: tabular-nums; color: var(--accent-dark); }
.sp-lane i { font-style: normal; font-weight: 500; font-size: 13px; color: var(--muted); }
.sp-lane-sz { border-left-color: var(--sp-signing); }
.sp-lane-main { margin-top: 18px; }
.sp-board.is-list .sp-lane { margin: 14px 0 8px; }
.sp-board.is-list .sp-lane:first-child { margin-top: 0; }
@media (max-width: 1180px) { .sp-lane { position: sticky; left: 0; } }

/* Згортання смуг (09.11.2026) */
.sp-lane { padding: 0; }
.sp-lane-tg { all: unset; box-sizing: border-box; width: 100%; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px;
  padding: 6px 2px 6px 10px; cursor: pointer; border-radius: 6px; }
.sp-lane-tg:hover { background: var(--soft); }
.sp-lane-tg:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sp-lane-chev { display: inline-block; transition: transform .15s; color: var(--muted); }
.sp-lane.is-closed .sp-lane-chev { transform: rotate(-90deg); }
.sp-lane-sum { font-style: normal; font-weight: 500; font-size: 13px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .sp-lane-chev { transition: none; } }

/* Номер копіюється кліком (09.11.2026) */
.sp-copy { all: unset; cursor: copy; border-radius: 4px; padding: 0 2px; font: inherit; color: inherit;
  border-bottom: 1px dashed currentColor; }
.sp-copy:hover { background: var(--soft); }
.sp-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sp-copy-ico { font-size: .7em; margin-left: 4px; opacity: .55; vertical-align: .15em; border: 0; }

/* ---------- Маршрут документа (10.11.2026) ---------- */
.sp-route { margin: 4px 0 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); }
.sp-rt-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-bottom: 8px; }
.sp-rt-sel { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.sp-rt-sel select { font: inherit; font-size: 13px; padding: 2px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.sp-rt-wait { margin: 0 0 8px; font-size: 13px; color: var(--sp-wait-ink); background: var(--sp-wait-bg); padding: 4px 8px; border-radius: 8px; }
.sp-rt { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; }
.sp-rt-arrow { align-self: center; color: var(--muted); font-weight: 700; }
.sp-rt-node { position: relative; display: flex; }
.sp-rt-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 120px; max-width: 220px;
  padding: 6px 10px; border-radius: 10px; border: 1px dashed var(--line); background: var(--surface); color: var(--ink);
  font: inherit; text-align: left; cursor: pointer; }
.sp-rt-btn b { font-size: 13px; overflow-wrap: anywhere; }
.sp-rt-role { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.sp-rt-btn i { font-style: normal; font-size: 12px; color: var(--muted); }
.sp-rt-node.is-ok .sp-rt-btn { border-style: solid; border-color: var(--sp-ok-ink, #1f6b43); background: var(--sp-ok-bg, #e3f4ea); }
.sp-rt-node.is-ok .sp-rt-btn i { color: var(--sp-ok-ink, #1f6b43); font-weight: 700; }
.sp-rt-node.is-cur .sp-rt-btn { border-style: solid; border-color: var(--sp-wait); box-shadow: 0 0 0 2px var(--sp-wait-bg); }
.sp-rt-del { position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 10px; line-height: 1; cursor: pointer; opacity: 0; }
.sp-rt-node:hover .sp-rt-del, .sp-rt-del:focus-visible { opacity: 1; }
.sp-rt-mvs { display: flex; justify-content: space-between; gap: 4px; }
.sp-rt-mv { border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--muted);
  font-size: 11px; line-height: 1; padding: 3px 8px; cursor: pointer; }
.sp-rt-mv:hover, .sp-rt-mv:focus-visible { color: var(--ink); border-color: var(--accent); }
.sp-badges .sp-rt-mini { background: var(--soft); color: var(--ink); border: 1px solid var(--line); }
.sp-head-proj { font-size: .8em; font-weight: 600; color: var(--muted); }
@media (max-width: 560px) { .sp-rt-btn { min-width: 0; } .sp-rt-del { opacity: 1; } }

/* ---------- «☑ Опрацьовано сьогодні» (10.11.2026) ---------- */
.sp-reviewed { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 10px; font-weight: 700; cursor: pointer; }
.sp-reviewed input { width: 18px; height: 18px; accent-color: var(--sp-prol); }
.sp-reviewed i { font-style: normal; font-weight: 400; font-size: 13px; }
.sp-card.is-reviewed { outline: 3px solid var(--sp-prol); outline-offset: -1px; }
.sp-row.is-reviewed { box-shadow: inset 4px 0 0 var(--sp-prol); background: var(--sp-prol-bg); }
.sp-badges .sp-rev-mini { background: var(--sp-prol-bg); color: var(--sp-prol-ink); font-weight: 700; }
/* Постійна позначка (10.11.2026): не опрацьовано сьогодні — червона, щоранку скидається */
.sp-rev-mini.sp-signed-mini { background: var(--sp-prol-bg); color: var(--sp-prol-ink); font-weight: 700; }
.sp-badges .sp-rev-mini.is-todo, .sp-rev-mini.is-todo { background: var(--sp-over-bg); color: var(--sp-over-ink); border: 1px solid var(--sp-over-ink); font-weight: 700; }
.sp-reviewed.is-todo span { color: var(--sp-over-ink); }
.sp-reviewed.is-todo input { accent-color: var(--sp-over-ink); outline: 2px solid var(--sp-over-ink); outline-offset: 1px; }
/* Днів на підписі: від 3 — жирніше */
.sp-sent-sign.is-long { background: var(--sp-over-bg); color: var(--sp-over-ink); border-color: var(--sp-over-ink); }
.sp-rt-days { display: block; color: var(--sp-over-ink); font-size: 12px; }

/* ---------- «🖋 Підписано» (10.11.2026) ---------- */
.sp-badges .sp-signed, .sp-signed-mini { background: var(--sp-ok-bg); color: var(--sp-ok-ink); font-weight: 800; border: 1px solid var(--sp-ok-ink); }
.sp-signed-mini { font-size: 12px; padding: 0 6px; border-radius: 999px; white-space: nowrap; }
.sp-card.is-signed { background-image: linear-gradient(to top, var(--sp-ok-ink) 0 4px, transparent 4px); }

/* ---------- підписант: «📤 відправлено на підпис» і «🖋 підписано» з датами (10.11.2026) ---------- */
.sp-rt-node { flex-direction: column; align-items: stretch; gap: 3px; }
.sp-rt-date { font: inherit; font-size: 12px; padding: 1px 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.sp-rt-signbox { cursor: default; gap: 4px; min-width: 190px; }
.sp-rt-dt { display: flex; flex-direction: column; gap: 1px; font-size: 11px; color: var(--muted); }
.sp-rt-dt input { font: inherit; font-size: 12px; padding: 1px 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.sp-rt-signnode.is-sent .sp-rt-btn { border-style: solid; border-color: var(--sp-signing, #7c5cc4); }
.sp-badges .sp-sent-sign, .sp-sent-sign.sp-signed-mini { background: var(--sp-wait-bg); color: var(--sp-wait-ink); font-weight: 800; border: 1px solid var(--sp-wait); }
.sp-rt-date, .sp-rt-dt input { width: 8.5em; max-width: 100%; }
.sp-rt-date::placeholder, .sp-rt-dt input::placeholder { color: var(--muted); opacity: .7; }

/* ---------- Маршрут по центру, ланки однакової ширини (вимога користувача 10.11.2026) ---------- */
.sp-rt { justify-content: center; align-items: center; row-gap: 10px; }
.sp-rt-node { align-items: center; }
.sp-rt-btn { align-items: center; text-align: center; width: 160px; min-width: 0; max-width: none; box-sizing: border-box; }
.sp-rt-signbox { width: 190px; }
.sp-rt-dt { align-items: center; }
.sp-rt-date, .sp-rt-dt input { text-align: center; }
.sp-rt-mvs { width: 100%; }
@media (max-width: 560px) { .sp-rt-btn { width: 140px; } .sp-rt-signbox { width: 170px; } }

/* ---------- Службова: ланка «📨 Розглядає» (вимога користувача 10.11.2026) ---------- */
.sp-rt-note { margin: 0 0 8px; font-size: 12px; color: var(--muted); text-align: center; }
.sp-rt-tonode .sp-rt-btn { border-style: dashed; }
.sp-rt-tonode.is-ok .sp-rt-btn { border-style: solid; }
.sp-rt-tonode select { font: inherit; font-size: 12px; width: 100%; padding: 2px 4px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }

/* ---------- «опрацьовано» — кнопка просто на дошці; версія внизу (10.11.2026) ---------- */
button.sp-rev-mini { font: inherit; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px;
  border: 1px solid transparent; cursor: pointer; line-height: inherit; }
button.sp-rev-mini.sp-signed-mini { font-size: 12px; padding: 0 6px; border-radius: 999px; }
button.sp-rev-mini:hover, button.sp-rev-mini:focus-visible { filter: brightness(.95); outline: 2px solid var(--sp-prol); outline-offset: 1px; }
button.sp-rev-mini.is-todo:hover, button.sp-rev-mini.is-todo:focus-visible { outline-color: var(--sp-over-ink); }
.sp-ver-foot { margin: 18px 0 4px; text-align: right; font-size: 11px; color: var(--muted); opacity: .8; }

/* Співвиконавці: маршрут — за необхідністю (10.11.2026) */
.sp-rt-szbtn { font: inherit; font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 8px; border: 1px solid var(--accent);
  background: var(--surface); color: var(--accent); cursor: pointer; }
.sp-rt-clear { margin-left: auto; font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); cursor: pointer; }
.sp-rt-clear:hover, .sp-rt-szbtn:hover { filter: brightness(.95); }

/* «⏳ у кого зараз» на картці (10.11.2026) */
.sp-badges .sp-rt-mini, .sp-rt-mini.sp-signed-mini { background: var(--sp-wait-bg); color: var(--sp-wait-ink); border: 1px solid var(--sp-wait); font-weight: 700; }
.sp-rt-mini i { font-style: normal; font-weight: 400; opacity: .75; }

/* «📨 Розглядає» — кілька адресатів (11.11.2026) */
.sp-rt-tolist { list-style: none; margin: 2px 0 4px; padding: 0; display: flex; flex-direction: column; gap: 3px; width: 100%; }
.sp-rt-tolist li { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px; }
.sp-rt-tolist b { overflow-wrap: anywhere; }
.sp-rt-todel { border: 1px solid var(--line); border-radius: 50%; width: 16px; height: 16px; padding: 0; font-size: 9px; line-height: 1;
  background: var(--surface); color: var(--muted); cursor: pointer; flex: none; }

/* ---------- «📝 Зарахувати в 37-Д» поруч з «опрацьовано сьогодні» (16.11.2026) ---------- */
.sp-reviewed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0 0 10px; }
.sp-reviewed-row .sp-reviewed { margin: 0; }
.sp-btn-37d { padding: 4px 10px; }
.sp-f37d-had { color: var(--sp-over-ink); font-weight: 600; }

/* ---------- 🧩 Об'єднання: кілька вхідних одного автора — одна відповідь (19.11.2026) ---------- */
.sp-merge-hint-btn {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--sp-merge);
  background: var(--sp-merge-bg); color: var(--sp-merge-ink);
}
.sp-merge-hint-btn[aria-pressed="true"] { background: var(--sp-merge); color: var(--surface, #fff); }
.sp-merge-line {
  margin: 2px 0 1px; padding: 2px 8px; border-radius: 7px; width: fit-content; max-width: 100%;
  font-size: 12px; font-weight: 700; background: var(--sp-merge-bg); color: var(--sp-merge-ink);
  overflow-wrap: anywhere;
}
.sp-badges .sp-mergecand { background: transparent; color: var(--sp-merge-ink); border: 1px dashed var(--sp-merge); cursor: help; }
.sp-merge-mini { font-size: 12px; font-weight: 700; padding: 0 6px; border-radius: 999px; background: var(--sp-merge-bg); color: var(--sp-merge-ink); white-space: nowrap; }
.sp-merge h3 .sp-muted { font-weight: 400; font-size: 13px; }
.sp-merge-main {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 10px 12px; border-radius: 10px; background: var(--sp-merge-bg); color: var(--sp-merge-ink);
}
.sp-merge-txt { flex: 1 1 260px; min-width: 0; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.sp-merge-list { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sp-merge-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 4px 10px;
  padding: 7px 10px; border: 1px solid var(--line); border-left: 3px solid var(--sp-merge); border-radius: 9px;
  background: var(--surface);
}
.sp-merge-no {
  font: inherit; font-weight: 700; font-size: 13px; color: var(--accent); background: none; border: 0; padding: 0;
  cursor: pointer; text-align: left; white-space: nowrap;
}
.sp-merge-no:hover { text-decoration: underline; }
.sp-merge-about { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.sp-merge-subj { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-merge-about i { font-style: normal; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.sp-merge-row .sp-btn { padding: 4px 10px; font-size: 12.5px; white-space: nowrap; }
.sp-merge-note, .sp-merge-hint { margin: 4px 0 8px; font-size: 13px; color: var(--muted); }
.sp-merge-hint { color: var(--sp-merge-ink); font-weight: 600; }
.sp-merge-find summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--accent); margin: 2px 0 6px; }
.sp-merge-find input {
  width: 100%; box-sizing: border-box; margin: 0 0 8px; padding: 7px 10px; font: inherit; font-size: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink);
}
.sp-stepper.is-merged { opacity: .6; }
.sp-stepper.is-merged .sp-step { cursor: not-allowed; }
@media (max-width: 560px) {
  .sp-merge-row { grid-template-columns: minmax(0, 1fr) auto; }
  .sp-merge-about { grid-column: 1 / -1; grid-row: 2; }
  .sp-merge-subj { white-space: normal; }
}
.sp-merge-top { margin: 0 0 10px; }

/* ---------- 📤 Наші службові — вкладка «📝 Службові» (19.11.2026) ---------- */
.sp-lane-ours { border-left-color: var(--sp-wait); margin-top: 18px; }
.sp-oursz { grid-column: 1 / -1; min-width: 0; margin: 8px 0 4px; }
.sp-oursz-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.sp-oursz-bar button {
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.sp-oursz-bar button[aria-pressed="true"] { background: var(--sp-wait-bg); color: var(--sp-wait-ink); border-color: var(--sp-wait); }
.sp-oursz-bar b { font-variant-numeric: tabular-nums; margin-left: 2px; }
.sp-row.sp-oursz-row { grid-template-columns: 96px minmax(170px, 260px) minmax(0, 1fr) auto; border-left: 4px solid var(--sp-wait); }
.sp-oursz-date { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sp-oursz-doc { min-width: 0; display: flex; flex-direction: column; gap: 1px; overflow-wrap: anywhere; }
.sp-oursz-doc b { color: var(--ink); }
.sp-oursz-doc i, .sp-oursz-case i { font-style: normal; font-size: 12.5px; color: var(--muted); }
.sp-oursz-case { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.sp-oursz-case b { color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.sp-oursz-case i { margin-left: 8px; }
.sp-oursz-st { font-size: 12.5px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--sp-wait-bg); color: var(--sp-wait-ink); }
.sp-oursz-row.is-warm .sp-oursz-st { background: var(--sp-hot-bg); color: var(--sp-hot-ink); }
.sp-oursz-row.is-over { border-left-color: var(--sp-over-ink); }
.sp-oursz-row.is-over .sp-oursz-st { background: var(--sp-over-bg); color: var(--sp-over-ink); }
.sp-oursz-row.is-draft { border-left-color: var(--sp-work); }
.sp-oursz-row.is-draft .sp-oursz-st { background: var(--sp-ver-bg); color: var(--sp-ver-ink); }
.sp-oursz-row.is-ok, .sp-oursz-row.is-off, .sp-oursz-row.is-sent { border-left-color: var(--sp-done); }
.sp-oursz-row.is-ok .sp-oursz-st { background: var(--sp-ok-bg); color: var(--sp-ok-ink); }
.sp-oursz-row.is-off, .sp-oursz-row.is-sent { opacity: .8; }
.sp-oursz-row.is-off .sp-oursz-st, .sp-oursz-row.is-sent .sp-oursz-st { background: var(--sp-chip-bg); color: var(--sp-chip-ink); }
@media (max-width: 1180px) {
  .sp-row.sp-oursz-row { grid-template-columns: 96px minmax(0, 1fr) auto; }
  .sp-oursz-case { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .sp-row.sp-oursz-row { grid-template-columns: minmax(0, 1fr) auto; }
  .sp-oursz-date { grid-column: 1; grid-row: 1; }
  .sp-oursz-st { grid-column: 2; grid-row: 1; justify-self: end; }
  .sp-oursz-doc, .sp-oursz-case { grid-column: 1 / -1; }
  .sp-oursz-case { white-space: normal; }
}
.sp-board:not(.is-list) .sp-oursz { position: sticky; left: 0; width: var(--sp-board-w, auto); max-width: 100%; box-sizing: border-box; }
.sp-board:not(.is-list) .sp-lane-ours { width: var(--sp-board-w, auto); max-width: 100%; }
/* 🧩 Щойно об'єднана група — підсвітка картки на кілька секунд */
.sp-card.is-flash, .sp-row.is-flash { outline: 3px solid var(--sp-merge); outline-offset: 2px; transition: outline-color .3s; }
@media (prefers-reduced-motion: reduce) { .sp-card.is-flash, .sp-row.is-flash { transition: none; } }

/* ───── 📑 Проміжна відповідь і запити інформації (19.11.2026) ───── */
.sp-badges .sp-interim { background: var(--sp-prol-bg); color: var(--sp-prol-ink); font-weight: 700; cursor: help; }
.sp-link-sum { margin: 0 0 8px; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: var(--soft); border: 1px solid var(--line); color: var(--ink); overflow-wrap: anywhere; }
.sp-link-sum.is-all { background: var(--sp-ok-bg); border-color: transparent; color: var(--sp-ok-ink); }
.sp-im-box { margin: 0; padding: 10px 12px 12px; border: 1px solid var(--line); border-radius: 10px; min-width: 0;
  display: flex; flex-direction: column; gap: 10px; }
.sp-im-box legend { padding: 0 6px; font-size: 13px; font-weight: 700; color: var(--ink); }
.sp-im-on { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.sp-im-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; }
.sp-im-grid input:disabled { opacity: .5; }
.sp-im-rows { display: flex; flex-direction: column; gap: 8px; }
.sp-im-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.sp-im-del { border: 1px solid var(--line); background: var(--soft); color: var(--muted); border-radius: 8px;
  width: 34px; height: 34px; cursor: pointer; font: inherit; }
.sp-im-del:hover { color: var(--ink); }
.sp-im-add { align-self: flex-start; }
@media (max-width: 640px) {
  .sp-im-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sp-im-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
  .sp-im-row .sp-f:first-child { grid-column: 1 / -1; }
  .sp-im-del { justify-self: end; grid-column: 2; }
}
.sp-act.is-wide { width: min(780px, calc(100vw - 32px)); }

/* ───── 🧭 Маршрут службової-запиту в «Зв'язках» (19.11.2026) ───── */
.sp-lr { margin: 6px 0 2px; padding: 8px 10px; border-radius: 10px; background: var(--soft); border: 1px dashed var(--line); }
.sp-lr-head { font-size: 12px; color: var(--muted); margin-bottom: 6px; overflow-wrap: anywhere; }
.sp-lr-head b { color: var(--ink); }
.sp-lr-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.sp-lr-arr { color: var(--muted); font-weight: 700; }
.sp-lr-wrap { position: relative; display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.sp-lr-node { font: inherit; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px;
  border: 1px dashed var(--line); background: var(--surface); color: var(--ink); cursor: pointer; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.sp-lr-node i { font-style: normal; color: var(--muted); font-size: 11px; white-space: nowrap; }
.sp-lr-node.is-ok { border-style: solid; border-color: var(--sp-ok-ink); background: var(--sp-ok-bg); }
.sp-lr-node.is-ok i { color: var(--sp-ok-ink); font-weight: 700; }
.sp-lr-node.is-cur, .sp-lr-sign.is-cur select { border-style: solid; border-color: var(--sp-wait); box-shadow: 0 0 0 2px var(--sp-wait-bg); }
.sp-lr-sign.is-ok select { border-color: var(--sp-ok-ink); }
.sp-lr-sign select { font: inherit; font-size: 12px; padding: 3px 6px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 210px; }
.sp-lr-x { position: absolute; top: -7px; right: -7px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 10px; line-height: 1; cursor: pointer; opacity: 0; padding: 0; }
.sp-lr-wrap:hover .sp-lr-x, .sp-lr-x:focus-visible { opacity: 1; }
.sp-lr-add { font: inherit; font-size: 12px; padding: 3px 8px; border-radius: 8px; border: 1px dashed var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.sp-lr-add:hover { color: var(--ink); border-color: var(--accent); }
.sp-lr-to { font-size: 12px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.sp-lr-send { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted); }
.sp-lr-send input { font: inherit; font-size: 13px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); min-width: 0; }
.sp-lr-send input[data-lr-no] { width: 9em; }
.sp-badges .sp-lr-mini { background: var(--sp-wait-bg); color: var(--sp-wait-ink); font-weight: 700; cursor: help; }
.sp-link.is-draft { border-left-color: var(--sp-wait); }
.sp-im-hint { margin: 0; font-size: 12px; line-height: 1.45; }
@media (hover: none) { .sp-lr-x { opacity: 1; } }

/* ───── 📑 Блок «Проміжна відповідь і запити» з маршрутами документів (19.11.2026) ───── */
.sp-docs { border: 1px solid var(--sp-wait); border-radius: 12px; padding: 10px 12px; background: var(--surface); }
.sp-docs h3 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 4px; }
.sp-docs h3 .sp-muted { font-size: 13px; font-weight: 600; }
.sp-docs-hint { margin: 0 0 8px; font-size: 12px; }
.sp-docs-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sp-doc { border: 1px solid var(--line); border-left: 4px solid var(--sp-wait); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.sp-doc.is-sent { border-left-color: var(--sp-ok-ink); }
.sp-doc-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 14px; overflow-wrap: anywhere; }
.sp-doc-st { margin-left: auto; font-size: 12px; color: var(--muted); }
.sp-doc-st b { color: var(--ink); }
.sp-doc-about { font-weight: 400; font-size: 12px; }
.sp-doc-x { font: inherit; font-size: 12px; padding: 2px 8px; border-radius: 8px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.sp-doc-x:hover { color: var(--ink); border-color: var(--muted); }
.sp-doc-proj { font: inherit; font-size: 12px; width: 11em; padding: 2px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.sp-doc .sp-lr { margin-top: 8px; }
.sp-lr-dl { display: inline-flex; align-items: center; gap: 4px; }
.sp-lr-line { margin-top: 6px; font-size: 12px; color: var(--sp-wait-ink); background: var(--sp-wait-bg); padding: 4px 8px; border-radius: 8px; overflow-wrap: anywhere; }
.sp-badges .sp-interim.is-draft { background: var(--sp-wait-bg); color: var(--sp-wait-ink); }
.sp-r2-mini { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--sp-wait-bg); color: var(--sp-wait-ink); border: 1px solid var(--sp-wait); cursor: help; white-space: nowrap; }
.sp-r2-mini.is-mini { padding: 0 6px; font-size: 11px; }
@media (max-width: 640px) { .sp-doc-st { margin-left: 0; flex-basis: 100%; } }

/* «Офіс відділу» (25.11.2026): голосовий блок охайніший і щільніший — менші відступи, картки й кружечки */
.sp-layout { padding-top: 12px; }
.spv-scope { justify-content: flex-end; margin-bottom: 4px; }
.spv { margin-bottom: 10px; padding: 8px 10px; border-radius: 12px; }
.spv-main { gap: 6px 10px; }
.spv-rooms { gap: 8px; }
.spv-room { gap: 6px; padding: 8px 10px; border-radius: 12px; }
.spv-room-head { gap: 8px; }
.spv-room-ico { width: 30px; height: 30px; border-radius: 9px; font-size: 16px; }
.spv-room-title b { font-size: 14px; }
.spv-room-title small { font-size: 12px; }
.spv-room-drop { min-height: 34px; padding: 6px 8px; font-size: 12px; }
.spv-people { gap: 4px; }
.spv-person { padding: 2px 8px 2px 2px; font-size: 12.5px; }
.spv-ava { width: 24px; height: 24px; font-size: 10.5px; }
.spv-actions { gap: 5px; }
.spc { margin: -4px 0 10px; }
/* «Не вимикати сам» біля мікрофона і попередження про довгу тишу (25.11.2026) */
.spv-keep { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.spv-keep input { margin: 0; accent-color: var(--accent); }
.spv-idle { border-left-color: #d97706; background: color-mix(in srgb, #f59e0b 12%, var(--surface)); color: var(--ink); }

/* Компактні кнопки й значки голосового блоку (25.11.2026: «зроби іконки в голосовому чаті більш компактні»).
   Однакова висота 28 px, кнопки-іконки — квадратні, дрібніші значки й кружечки учасників */
.spv-btn { font-size: 12.5px; padding: 4px 10px; min-height: 28px; border-radius: 8px; line-height: 1.2; }
.spv-icon { padding: 4px; min-width: 28px; display: inline-grid; place-items: center; font-size: 14px; }
.spv-actions { gap: 4px; align-items: center; }
.spv-share { gap: 4px; }
.spv-svg { width: 15px; height: 15px; }
.spv-actions .spv-share { margin-right: 6px; }
.rec-dot { width: 8px; height: 8px; margin-right: 4px; }
.spv-keep { font-size: 11.5px; }
.spv-flag { font-size: 11px; }
.spv-ping { font-size: 10.5px; }
.spv-kick { padding: 0 5px; font-size: 11px; line-height: 18px; border-radius: 6px; }
.spv-person { gap: 4px; padding: 2px 7px 2px 2px; }
.spv-ava { width: 22px; height: 22px; font-size: 10px; }
.spv-room-ico { width: 26px; height: 26px; border-radius: 8px; font-size: 14px; }
.spv-room .spv-tet-in { padding: 3px 9px; }

/* «🎙 Увійти в кімнату» — точка входу (25.11.2026): баклажанна кнопка з м'яким світлом, що повільно пульсує
   (той самий тон, що й кнопки сцени доповідача, zviazok/stage.js) */
.spv { --join-glow: 108, 52, 96; --join-bg: #6c3460; --join-bg-h: #7d3f70; }
:root.dark-theme .spv { --join-glow: 192, 120, 176; --join-bg: #7a3d6d; --join-bg-h: #8d4a7f; }
.spv-btn.spv-join[data-act="join"] {
  background: var(--join-bg); border-color: rgba(var(--join-glow), .9); color: #fff;
  padding-inline: 14px; animation: spv-join-glow 3s ease-in-out infinite; animation-delay: calc(var(--pulse-t, 0) * -1s);
}
.spv-btn.spv-join[data-act="join"]:hover { background: var(--join-bg-h); }
@keyframes spv-join-glow {
  0%, 100% { box-shadow: inset 0 0 4px rgba(255, 255, 255, .12), 0 0 0 0 rgba(var(--join-glow), .35); }
  50% { box-shadow: inset 0 0 12px rgba(255, 255, 255, .28), 0 0 0 5px rgba(var(--join-glow), .18), 0 0 14px rgba(var(--join-glow), .45); }
}
@media (prefers-reduced-motion: reduce) {
  .spv-btn.spv-join[data-act="join"] { animation: none; box-shadow: 0 0 0 3px rgba(var(--join-glow), .25), 0 0 10px rgba(var(--join-glow), .35); }
}

/* «🎙 Говорити» (мікрофон вимкнено) — червона кнопка з м'яким пульсом, щоб її було видно в рядку дій
   (25.11.2026). Мікрофон увімкнено («Мікрофон увімк.») — звичайна зелена, без пульсу */
.spv { --talk-glow: 200, 40, 40; --talk-bg: #b42323; --talk-bg-h: #c62d2d; }
:root.dark-theme .spv { --talk-glow: 248, 113, 113; --talk-bg: #a12020; --talk-bg-h: #b52a2a; }
.spv-btn[data-act="mic"]:not(.is-on), .spv-btn[data-act="wmic"]:not(.is-on) {
  background: var(--talk-bg); border-color: rgba(var(--talk-glow), .9); color: #fff;
  animation: spv-talk-glow 3s ease-in-out infinite; animation-delay: calc(var(--pulse-t, 0) * -1s);
}
.spv-btn[data-act="mic"]:not(.is-on):hover, .spv-btn[data-act="wmic"]:not(.is-on):hover { background: var(--talk-bg-h); }
@keyframes spv-talk-glow {
  0%, 100% { box-shadow: inset 0 0 4px rgba(255, 255, 255, .10), 0 0 4px rgba(var(--talk-glow), .20); }
  50% { box-shadow: inset 0 0 9px rgba(255, 255, 255, .22), 0 0 12px rgba(var(--talk-glow), .40); }
}
@media (prefers-reduced-motion: reduce) {
  .spv-btn[data-act="mic"]:not(.is-on), .spv-btn[data-act="wmic"]:not(.is-on) { animation: none; box-shadow: 0 0 0 3px rgba(var(--talk-glow), .22); }
}

/* «Показати екран» — синя кнопка з м'яким пульсом (25.11.2026); під час показу — суцільна синя, без пульсу.
   Ритм — той самий годинник, що й у «Говорити» та «Увійти в кімнату» (--pulse-t із spravy/voice.js) */
.spv { --share-glow: 47, 107, 158; }
:root.dark-theme .spv { --share-glow: 56, 189, 248; }
.spv-actions .spv-share:not(.is-on) {
  border-color: rgba(var(--share-glow), .75); color: rgb(var(--share-glow));
  background: color-mix(in srgb, rgb(var(--share-glow)) 8%, var(--surface));
  animation: spv-share-glow 3s ease-in-out infinite; animation-delay: calc(var(--pulse-t, 0) * -1s);
}
@keyframes spv-share-glow {
  0%, 100% { box-shadow: inset 0 0 3px rgba(var(--share-glow), .15), 0 0 3px rgba(var(--share-glow), .15); }
  50% { box-shadow: inset 0 0 9px rgba(var(--share-glow), .35), 0 0 12px rgba(var(--share-glow), .40); }
}
@media (prefers-reduced-motion: reduce) { .spv-actions .spv-share:not(.is-on) { animation: none; box-shadow: 0 0 6px rgba(var(--share-glow), .3); } }

/* Пульс виразніший (25.11.2026: «пульс не візуалізується»): попередні тіні були надто тонкі — пік і спад
   майже не відрізнялися. Тепер кнопка помітно світлішає і навколо розходиться кольорове кільце.
   Ці @keyframes пізніші за однойменні вище — діють вони. Ритм — той самий годинник (--pulse-t) */
.spv { --talk-bg-hi: #e14b4b; --join-bg-hi: #9a4f8a; }
:root.dark-theme .spv { --talk-bg-hi: #d94545; --join-bg-hi: #a35a93; }
@keyframes spv-talk-glow {
  0%, 100% { background-color: var(--talk-bg); box-shadow: 0 0 0 0 rgba(var(--talk-glow), 0); }
  50% { background-color: var(--talk-bg-hi); box-shadow: 0 0 0 4px rgba(var(--talk-glow), .28), 0 0 16px 2px rgba(var(--talk-glow), .55); }
}
@keyframes spv-join-glow {
  0%, 100% { background-color: var(--join-bg); box-shadow: 0 0 0 0 rgba(var(--join-glow), 0); }
  50% { background-color: var(--join-bg-hi); box-shadow: 0 0 0 4px rgba(var(--join-glow), .30), 0 0 16px 2px rgba(var(--join-glow), .55); }
}
@keyframes spv-share-glow {
  0%, 100% { background-color: color-mix(in srgb, rgb(var(--share-glow)) 6%, var(--surface)); box-shadow: 0 0 0 0 rgba(var(--share-glow), 0); }
  50% { background-color: color-mix(in srgb, rgb(var(--share-glow)) 22%, var(--surface)); box-shadow: 0 0 0 4px rgba(var(--share-glow), .25), 0 0 14px 2px rgba(var(--share-glow), .45); }
}

/* ── Просунутий вигляд кімнати: 3D-герої (25.11.2026) ─────────────────────────────────────────────
   Спрайт героя — 4 кадри в ряд (рот закритий · трохи · широко · очі заплющені), voice/heroes/*.webp.
   Рот керує рушій: data-lvl на <li> (0/1/2) раз на 150 мс. Дихання прив'язане до годинника (--pulse-t),
   як пульс кнопок, — перемальовування панелі його не збиває. */
.spv-viewbar { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex: 1 1 100%; min-width: 0; }
.spv-seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--soft); border: 1px solid var(--line); }
.spv-seg button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 7px; cursor: pointer; }
.spv-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.spv-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.spv-myhero { min-height: 26px; padding: 3px 9px; }

.spv-person.is-hero {
  display: inline-flex; flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 1px 4px; width: 96px; max-width: none; padding: 4px 4px 6px; border-radius: 14px; text-align: center;
}
.spv-person.is-hero .spv-name { flex: 1 1 100%; font-size: 12px; font-weight: 600; }
.spv-person.is-hero .spv-name i { font-weight: 400; }
.spv-hero {
  position: relative; flex: 0 0 100%; display: block; width: 76px; height: 76px; margin: 0 auto;
  background: var(--hero) 0 0 / 400% 100% no-repeat;
  transform-origin: 50% 90%;
  animation: spv-breathe 3.6s ease-in-out infinite;
  animation-delay: calc(var(--pulse-t, 0) * -1s);
}
.spv-hero::before {                         /* м'яка тінь під ногами */
  content: ''; position: absolute; left: 22%; right: 22%; bottom: 1px; height: 7px; z-index: -1;
  border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.22), transparent);
}
.spv-person.is-hero[data-lvl="1"] .spv-hero { background-position: 33.333% 0; }
.spv-person.is-hero[data-lvl="2"] .spv-hero { background-position: 66.667% 0; }
.spv-hero-blink {
  position: absolute; inset: 0; background: var(--hero) 100% 0 / 400% 100% no-repeat; opacity: 0;
  animation: spv-blink var(--blink, 5s) step-end infinite; animation-delay: var(--blink-d, 0s);
}
.spv-person.is-speaking .spv-hero-blink { animation: none; opacity: 0; }
.spv-person.is-speaking .spv-hero {
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--spv-speak) 70%, transparent));
  animation: spv-talkbob 0.42s ease-in-out infinite alternate;
}
.spv-person.is-hero.is-speaking { border-color: var(--spv-speak); }
.spv-person.is-deaf .spv-hero { opacity: 0.7; }
.spv-hero.is-new { animation: spv-pop 0.7s cubic-bezier(0.3, 1.6, 0.5, 1) both, spv-breathe 3.6s ease-in-out 0.7s infinite; }
.spv-person.is-sleepy .spv-hero-blink { animation: none; opacity: 1; }
.spv-person.is-sleepy .spv-hero::after {
  content: 'z'; position: absolute; top: 4px; right: 6px; font: 800 14px/1 system-ui, sans-serif; color: var(--muted);
  animation: spv-zzz 2.2s ease-out infinite;
}
.spv-hero-badge {
  position: absolute; right: 2px; bottom: 6px; display: grid; place-items: center; width: 22px; height: 22px;
  border-radius: 50%; background: #2563eb; color: #fff; font-size: 11px; font-style: normal;
  box-shadow: 0 0 0 2px var(--surface), 0 0 10px rgba(37, 99, 235, 0.6);
}
.spv-hero.is-still { animation: none; flex: none; width: 56px; height: 56px; }

.spv-heropick { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; flex: 1 1 100%; }
.spv-heropick-i {
  display: grid; justify-items: center; gap: 2px; width: 92px; padding: 4px 4px 6px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink); font: inherit;
}
.spv-heropick-i small { font-size: 11px; line-height: 1.2; }
.spv-heropick-i:hover { border-color: var(--accent); }
.spv-heropick-i.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }

@keyframes spv-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, 1.035); } }
@keyframes spv-talkbob { from { transform: translateY(0) scale(1, 1); } to { transform: translateY(-2px) scale(1.01, 1.025); } }
@keyframes spv-pop { 0% { transform: translateY(14px) scale(0.6); opacity: 0; } 60% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes spv-blink { 0% { opacity: 0; } 96% { opacity: 1; } 99% { opacity: 0; } }
@keyframes spv-zzz { 0% { transform: translate(0, 4px) scale(0.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: translate(8px, -14px) scale(1.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .spv-hero, .spv-hero.is-new, .spv-person.is-speaking .spv-hero, .spv-person.is-sleepy .spv-hero::after { animation: none; }
}
@media (max-width: 700px) {
  .spv-person.is-hero { width: 84px; }
  .spv-hero { width: 66px; height: 66px; }
}

/* Офіс і дорадча — рівні картки (25.11.2026): однакова ширина й рамка, низ дорадчої (смуга перетягування,
   «Зайти») притиснутий до краю — нижні краї обох карток на одній лінії */
.spv-rooms:not(.is-single) { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.spv-room.is-live { box-shadow: 0 6px 18px color-mix(in srgb, var(--room-ink) 12%, transparent); }
.spv-room > .spv-people { flex: 1 1 auto; align-content: flex-start; }
.spv-room-drop { flex: 0 0 auto; }
.spv-room-foot { margin-top: auto; }
@media (max-width: 700px) { .spv-rooms:not(.is-single) { grid-template-columns: minmax(0, 1fr); } }
/* Герої розходяться на всю картку: рівні комірки на всю ширину, ряди — рівномірно по висоті */
.spv-room > .spv-people:has(> .is-hero) {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); justify-items: center;
  align-content: space-evenly; gap: 8px 6px;
}
@media (max-width: 700px) { .spv-room > .spv-people:has(> .is-hero) { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); } }

/* Ми — співвиконавці (our_role = 'co'): хвиляста рамка замість звичайної межі,
   кольором бейджа «Співвик.» (01.12.2026, слово власника). Рамку малює ::after
   маскою з хвилястих смуг, тож outline і box-shadow інших позначок (контроль,
   продовжено, рецензія) лишаються вільними й лягають поверх. */
.sp-card.is-co, .sp-row.is-co { position: relative; border-color: transparent; }
.sp-card.is-co::after, .sp-row.is-co::after {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background: var(--sp-co-ink);
  --wave-h: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='6'%3E%3Cpath d='M0 3 Q4 0.6 8 3 T16 3' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E");
  --wave-v: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='16'%3E%3Cpath d='M3 0 Q0.6 4 3 8 T3 16' fill='none' stroke='%23000' stroke-width='1.6'/%3E%3C/svg%3E");
  -webkit-mask: var(--wave-h) repeat-x 0 0 / 16px 6px, var(--wave-h) repeat-x 0 100% / 16px 6px,
                var(--wave-v) repeat-y 0 0 / 6px 16px, var(--wave-v) repeat-y 100% 0 / 6px 16px;
          mask: var(--wave-h) repeat-x 0 0 / 16px 6px, var(--wave-h) repeat-x 0 100% / 16px 6px,
                var(--wave-v) repeat-y 0 0 / 6px 16px, var(--wave-v) repeat-y 100% 0 / 6px 16px;
}
