:root {
  --bg: #f8fafc;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e7ecf3;
  --line-strong: #e2e8f0;
  --line-soft: #eef2f7;
  --accent: #2563eb;
  --accent-dark: #1d4fd8;
  --accent-soft: #eff4ff;
  --warn: #9a3412;
  --bad: #d92d20;
  --good: #079455;
  --good-bg: #ecfdf3;
  --bad-bg: #fef2f2;
  --bad-text: #991b1b;
  --warn-bg: #ffedd5;
  --warn-text: #9a3412;
  --neutral-bg: #f1f5f9;
  --neutral-text: #334155;
  /* Семантика: контакт = бурштин (--warn-*), спад = червоний (--bad-*).
     Рівень підготовки — власна палітра, ОДНА на всю систему: чип у картці,
     тег на Головній і фільтр когорти мають бути однакового кольору.
     Раніше «навчання» на Головній було фіолетовим, а фіолет уже означав
     «Досвідчені» — два різні поняття одним кольором. */
  --level-pro-bg: #ede9fe;
  --level-pro-text: #6d28d9;
  --level-mid-bg: #fef3c7;
  --level-mid-text: #92400e;
  --level-train-bg: #fdeee0;
  --level-train-text: #b4622c;
  --radius-card: 12px;
  --radius-lg: 16px;
  --shadow: none;
  --shadow-card: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .04);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: -.005em;
  display: grid;
  grid-template-columns: var(--sidebar-width, 220px) 1fr;
  min-height: 100vh;
  transition: grid-template-columns .18s ease;
}

body.auth-pending > .sidebar, body.auth-pending > main {
  visibility: hidden;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f4f6f8;
}

body.authenticated .login-screen {
  display: none;
}

.login-card {
  width: min(380px, 100%);
  display: grid;
  gap: 16px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(23, 32, 42, .08);
}

.login-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 6px 0 4px;
}

.login-brand {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--ink);
}

.login-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--accent);
}

.login-mark svg {
  width: 40px;
  height: 40px;
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 24px;
}

.login-card p {
  margin: 0;
  color: var(--muted);
}

.login-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.login-card input {
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.login-card input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(15, 118, 110, .12);
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--bad);
  font-size: 12px;
}

body.sidebar-collapsed {
  --sidebar-width: 76px;
}

.sidebar {
  background: #ffffff;
  color: var(--ink);
  padding: 18px 12px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 48px;
  margin: 0 4px 24px;
  position: relative;
}

.brand-mark {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  height: 46px;
  color: var(--accent);
}

.brand-mark svg {
  width: 34px;
  height: 34px;
}

.brand-copy {
  display: grid;
  min-width: 0;
}

.brand-copy strong {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--ink);
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.sidebar-toggle {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: auto;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #b4bccb;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.sidebar-toggle:hover {
  color: var(--accent);
  background: #eef2ff;
}

body.sidebar-collapsed .sidebar {
  padding: 18px 9px 14px;
}

body.sidebar-collapsed .brand {
  justify-content: center;
  margin-bottom: 24px;
}

body.sidebar-collapsed .brand-copy, body.sidebar-collapsed .nav-label {
  display: none;
}

/* Глобальний пошук у сайдбарі — згорнутий у лупу, розкривається кліком */
.sidebar-search {
  position: relative;
  margin: 0 4px 14px;
}

.sidebar-search-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.sidebar-search-toggle:hover {
  background: var(--bg);
  color: var(--ink);
}

.sidebar-search-toggle svg { width: 18px; height: 18px; flex: 0 0 auto; }

.sidebar-search-toggle[hidden] { display: none; }
.sidebar-search-field[hidden] { display: none; }

body.sidebar-collapsed .sidebar-search-toggle { justify-content: center; padding: 9px; }

.sidebar-search-field { position: relative; }

.sidebar-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
  z-index: 1;
}

#globalSearch {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px 7px 32px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  font-size: 13px;
}

#globalSearch:focus {
  background: #fff;
  border-color: var(--accent);
  outline: none;
}

body.sidebar-collapsed .sidebar-search { display: none; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 340px;
  max-height: 62vh;
  overflow-y: auto;
  z-index: 40;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
}

.search-results[hidden] { display: none; }

.search-group + .search-group { margin-top: 6px; border-top: 1px solid var(--line-soft); padding-top: 6px; }

.search-group-label {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.search-item {
  display: grid;
  gap: 1px;
  width: 100%;
  text-align: left;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

.search-item:hover { background: var(--accent-soft); }
.search-item-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.search-item-sub {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-empty, .search-more {
  padding: 10px 8px;
  font-size: 12px;
  color: var(--muted);
}
.search-more { padding: 4px 8px 2px; font-style: italic; }

body.sidebar-collapsed .sidebar-toggle {
  position: absolute;
  right: -7px;
  top: 37px;
  z-index: 3;
  background: #fff;
  transform: rotate(180deg);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-height: 0;
  overflow-y: auto;
}

.nav-divider {
  height: 1px;
  margin: 11px 12px;
  background: var(--line);
}

body.sidebar-collapsed .nav-divider {
  margin: 11px 14px;
}

.sidebar-user {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 9px;
  margin-top: auto;
  padding: 12px 4px 0;
  border-top: 1px solid var(--line);
}

.sidebar-user-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--accent-dark);
  font-weight: 800;
}

.sidebar-user-copy {
  min-width: 0;
}

.sidebar-user-copy strong, .sidebar-user-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user-copy strong { font-size: 13px; }
.sidebar-user-copy small { margin-top: 2px; color: var(--muted); font-size: 11px; }

.sidebar-logout {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.sidebar-logout:hover {
  background: #fef2f2;
  color: var(--bad);
}

body.sidebar-collapsed .sidebar-user {
  grid-template-columns: 1fr;
  justify-items: center;
}

body.sidebar-collapsed .sidebar-user-copy, body.sidebar-collapsed .sidebar-logout {
  display: none;
}

.role-hidden {
  display: none !important;
}

.nav-btn, button {
  border: 0;
  cursor: pointer;
  font: inherit;
}

.nav-btn {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  color: #475467;
  background: transparent;
  min-height: 44px;
  padding: 9px 11px;
  border-radius: 8px;
  transition: color .14s ease, background .14s ease;
}

.nav-btn:hover {
  background: #f3f7f6;
  color: var(--ink);
}

.nav-btn.active {
  background: var(--neutral-bg);
  color: var(--ink);
  font-weight: 600;
}

.nav-btn.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #667085;
}

.nav-icon svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-btn.active .nav-icon {
  color: var(--accent);
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.sidebar-collapsed .nav-btn {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 9px;
}

body.sidebar-collapsed .nav-btn.active::before {
  top: 8px;
  bottom: 8px;
}

main {
  padding: 22px;
  min-width: 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.is-hidden {
  display: none !important;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

h1, h2, h3, p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.2;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 17px;
}

.page-head p, .muted, small {
  color: var(--muted);
}

.primary {
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  padding: 10px 14px;
  min-height: 40px;
}

.primary:hover {
  background: var(--accent-dark);
}

.ghost {
  color: var(--accent-dark);
  background: #eef2ff;
  border-radius: 7px;
  padding: 9px 12px;
}

.ghost.danger {
  color: var(--bad);
  background: #fde8e7;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.kpi, .panel, .unit-card, .unit-list {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}

.kpi {
  border-radius: var(--radius-card);
  padding: 14px 16px;
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.kpi strong {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.panel {
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
}

/* ── Міні progress-bar у клітинках таблиць (покриття/ефективність) ── */
.cell-bar {
  height: 4px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--neutral-bg);
  overflow: hidden;
}
.cell-bar > div {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}
.cell-bar.is-good > div { background: var(--good); }

/* ── Єдиний компонент періоду: сегменти пресетів + дати в одній рамці ── */
.seg-group {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.seg-group button {
  padding: 8px 12px;
  border: none;
  border-left: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.seg-group button:first-child { border-left: none; }
.seg-group button:hover { background: var(--bg); }
.seg-group button.is-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}
.date-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  padding: 0 8px;
  cursor: pointer;
}
.date-group:hover { border-color: var(--accent); }
.date-group input[type="date"] {
  border: none;
  background: transparent;
  min-height: 34px;
  height: 34px;
  padding: 0 2px;
  font-size: 13px;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
}
.date-group input[type="date"]:focus { outline: none; box-shadow: none; border: none; }
.date-group input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: .5;
  padding: 2px;
  margin-left: 2px;
}
.date-group input[type="date"]:hover::-webkit-calendar-picker-indicator { opacity: .85; }
.date-group > span { color: var(--muted); padding: 0 2px; }
.period-days {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.period-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.report-owner-slot {
  display: inline-flex;
  align-items: center;
  margin-right: 4px;
}
.report-owner-slot select { min-width: 180px; }
.seg-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.task-deadline-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* Швидкий запис — міні-меню вибору (комунікація / задача) */
.quick-add-menu {
  position: fixed;
  z-index: 9000;
  width: 190px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .12);
}
.quick-add-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding: 9px 10px;
  border: none;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.quick-add-menu button:hover { background: var(--accent-soft); color: var(--accent-dark); }
.quick-add-menu button span { color: var(--accent); font-size: 15px; }

/* Порожній донат → компактний stat-блок */
.task-report-donut-empty {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-card);
  background: var(--bg);
}
.task-report-donut-empty strong {
  font-size: 24px;
  font-weight: 800;
  color: var(--muted);
}
.task-report-donut-empty span {
  font-size: 12px;
  color: var(--muted);
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.split {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: 92px 1fr 110px;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}

.bar-track {
  background: #e6ebef;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
}

.bar {
  height: 100%;
  min-width: 4px;
  background: linear-gradient(90deg, #3b66f6, #2563eb);
}

.table-list {
  display: grid;
  gap: 12px;
}

#tab-tasks .table-list {
  padding: 0 16px 18px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #edf1f4;
}

.row:last-child {
  border-bottom: 0;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f0f4ff;
}

.top-common {
  background: #fff7ed;
  border-radius: 6px;
  padding-left: 8px;
  padding-right: 8px;
}

.row strong {
  display: block;
  margin-bottom: 3px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #eef2f6;
  color: #344054;
}

.pill.active {
  color: var(--good);
  background: #e7f6ee;
}

.pill.problem {
  color: var(--bad);
  background: #fde8e7;
}

.pill.unknown, .pill.no_contact, .pill.needs_training {
  color: var(--warn);
  background: #fff4df;
}

.filters {
  display: flex;
  gap: 10px;
}

.list-pane {
  min-width: 0;
  /* Висота — від ЕКРАНА, а не від картки справа. Прив'язка до картки
     давала стрибки: на кожній частині панель то коротшала, то довшала.
     Тепер вона стала й передбачувана; список гортається всередині.
     Липка, щоб не їхала вгору, коли картка довша за екран.
     top = верхній padding main (22px), 44px = верх + низ. */
  position: sticky;
  top: 22px;
  align-self: start;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 44px);
}

input, select, textarea {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  min-height: 40px;
  padding: 9px 10px;
  font: inherit;
  background: #fff;
  color: var(--ink);
}

/* Кастомна стрілка замість важкої нативної — щоб селекти не «випадали» з дизайну */
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
select:hover { border-color: var(--border-strong, #cdd4dc); }
select:focus, input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Компактні контроли у фільтрах/тулбарах — заввишки як сегменти (36px) */
.filters select, .team-page-actions select, .reporting-page-head select, .task-report-actions select, .period-picker select {
  min-height: 36px;
  height: 36px;
  padding: 0 30px 0 12px;
  font-size: 13px;
}

textarea {
  min-height: 82px;
  resize: vertical;
}

.workbench {
  display: grid;
  grid-template-columns: minmax(300px, 370px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.unit-list {
  border-radius: var(--radius-card);
  overflow: hidden;
  /* Забирає всю висоту, що лишилась у липкій панелі під пошуком і
     фільтрами, і гортається всередині. */
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.unit-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-soft);
  border-left: 2px solid transparent;
  cursor: pointer;
  background: #fff;
  transition: background .12s ease;
}
.unit-quick-add {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--accent);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
  transition: opacity .12s ease, background .12s ease, border-color .12s ease;
}
.unit-item:hover .unit-quick-add, .unit-quick-add:focus-visible { opacity: 1; }
.unit-quick-add:hover { background: var(--accent-soft); border-color: var(--accent); opacity: 1; }

/* Вартовий автодовантаження: тонкий рядок «Завантаження…» унизу списку.
   Не кнопка — з'являється сам, коли доскролили до низу. */
.unit-list-sentinel {
  padding: 12px;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* Ліва лінія лишається тільки як сигнал контакту: немає контакту або >30 днів */
.unit-item--stale { border-left-color: #f59e0b; }
.unit-item--nocontact { border-left-color: #ef4444; }

.unit-item-id { min-width: 0; flex: 1; }
.unit-item-head { display: flex; align-items: center; gap: 6px; min-width: 0; }
.unit-item-head strong {
  min-width: 0;
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unit-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 4px;
}
.unit-item-sub {
  min-width: 0;
  margin-right: auto;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unit-item-contact {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.unit-overdue-badge {
  display: inline-grid;
  place-items: center;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #dc2626;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.unit-item:hover { background: #f8fafc; }
.unit-item.active { background: var(--accent-soft); }

.empty-list {
  padding: 18px 14px;
  color: var(--muted);
}

.overflow-banner {
  margin: 0 0 10px;
  padding: 8px 12px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  border-radius: 8px;
  font-size: 13px;
}

.unit-card {
  border-radius: 8px;
  padding: 15px;
  min-height: 520px;
}

.empty-state {
  color: var(--muted);
  display: grid;
  place-items: center;
  min-height: 420px;
}

.meta {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  background: #fafbfc;
}

.meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin: 12px 0;
}

.tab {
  background: transparent;
  padding: 10px 4px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.form-grid label {
  display: grid;
  gap: 5px;
  font-size: 13px;
  color: var(--muted);
}

.span-2 {
  grid-column: span 2;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.timeline {
  display: grid;
  gap: 0;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}

.timeline-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 14px;
  border-radius: 0;
}
.timeline-item:last-of-type {
  border-bottom: 0;
}

.timeline-item a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.checkbox-line {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px;
  color: var(--ink) !important;
}

.checkbox-line input {
  min-height: auto;
  width: 16px;
  height: 16px;
}

.profile-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.profile-section h3 {
  margin-bottom: 10px;
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.profile-section-head h3 {
  margin-bottom: 0;
}

.links-list {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.link-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fafbfc;
}

.link-row-actions {
  display: flex;
  gap: 6px;
}

.link-row strong {
  display: block;
  margin-bottom: 3px;
}

.link-row.is-editing {
  border-color: var(--accent);
  background: #f0f8f6;
}

.uc-unrecognized {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  background: rgba(180, 83, 9, 0.05);
}
.uc-unrecognized-text {
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 10px;
}
.uc-unrecognized-assign {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.uc-unrecognized-assign input {
  flex: 1;
  min-width: 240px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.uc-unrecognized-assign input.input-error {
  border-color: var(--bad);
  background: #fef2f2;
}

.task-subnav {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.task-status-tab {
  position: relative;
  min-width: 140px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.task-status-tab.active {
  background: var(--panel);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.task-status-tab:hover:not(.active) {
  color: var(--ink);
}

.task-status-tab span { text-align: center; }

.task-status-tab--open { color: var(--ink); }
.task-status-tab--open.active {
  color: var(--accent-dark);
  border-color: #c3d2f7;
  background: var(--accent-soft);
}
.task-status-tab--done { color: var(--ink); }
.task-status-tab--done.active {
  color: var(--good);
  border-color: #a6e6c3;
  background: var(--good-bg);
}

.task-saved-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 11px 14px;
  margin-bottom: 0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}
.task-saved-card.task-highlight {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #d9f1ec;
}

.timeline-item.comm-highlight {
  border-radius: 10px;
  box-shadow: 0 0 0 3px #d9f1ec;
  background: #f3fbf8;
}

.task-view {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
}

.task-main { min-width: 0; }

.task-view strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  line-height: 1.25;
}

.task-title {
  cursor: pointer;
}
.task-title:hover { color: var(--accent); }

.task-view small {
  color: var(--muted);
}

.task-check {
  width: 18px;
  height: 18px;
  margin-top: 0;
  border: 1.5px solid rgba(37, 99, 235, .4);
  border-radius: 50%;
  background: var(--panel);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.task-check:not(.checked):hover {
  border-color: var(--good);
  background: #f0fdf4;
}
.task-check.checked {
  border-color: var(--good);
  background: var(--good);
  position: relative;
}
.task-check.checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 4px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  min-height: 18px;
  margin-bottom: 6px;
}

.task-meta-label {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.task-deadline, .task-priority {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 650;
  background: #fff;
  color: var(--muted);
}
.task-deadline.overdue { border-color: #fecaca; background: #fee2e2; color: #b91c1c; }
.task-deadline.today {
  border-color: #c3d2f7;
  background: #eef2ff;
  color: #2c4fd7;
}
.task-deadline.tomorrow { border-color: #fde68a; background: #fef3c7; color: #92400e; }
.task-priority.high { border-color: #fecaca; background: #fee2e2; color: #b91c1c; }
.task-priority.normal { border-color: #fde68a; background: #fef3c7; color: #92400e; }

/* Дії задачі — ті самі іконки, що в комунікаціях і контактах */
.task-row-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.task-view p {
  margin-top: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-edit {
  display: grid;
  grid-template-columns: minmax(180px, 1.5fr) repeat(3, minmax(120px, 0.75fr));
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.task-edit.is-hidden {
  display: none;
}

.task-edit input, .task-edit select, .task-edit textarea {
  min-height: 36px;
  padding: 7px 9px;
  min-width: 0;
}

.task-edit textarea {
  min-height: 72px;
  resize: vertical;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-edit label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.task-edit label input, .task-edit label select {
  color: var(--ink);
  font-size: 16px;
}

.task-comment {
  grid-column: 1 / span 2;
}

.task-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-self: end;
}

.task-board {
  display: grid;
  gap: 8px;
}

.task-view-tab {
  background: transparent;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 9px 4px;
}

.task-view-tab.active, .task-view-tab:hover {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.task-view-title {
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}

.task-filter-bar {
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 16px;
}
.task-filter-bar .task-quick-action {
  margin-left: auto;
  height: 36px;
}

/* ── Задачі: 2 колонки (список + рейл) ────────────────────────────── */
.task-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 18px;
  align-items: start;
}
.task-rail { display: grid; gap: 14px; position: sticky; top: 14px; }
.task-rail.is-hidden { display: none; }
.task-workbench:has(.task-rail.is-hidden) { grid-template-columns: 1fr; }

.task-rail-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 14px;
}
.task-rail-title { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }

.week-cal-head {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  text-align: center;
}
.week-cal-head .task-rail-title {
  margin-bottom: 2px;
}
.week-cal-range {
  color: var(--muted);
  font-size: 11px;
}
.week-cal-nav {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
}
.week-cal-nav:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: #f0f4ff;
}

.week-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.week-cal-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 2px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.week-cal-day:hover { background: var(--bg); }
.week-cal-wd { font-size: 10px; color: var(--muted); text-transform: uppercase; }
.week-cal-dom { font-size: 14px; font-weight: 600; color: var(--ink); }
.week-cal-count {
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  border-radius: 9px;
  color: var(--muted);
}
.week-cal-count.has { background: var(--accent); color: #fff; padding: 0 5px; }
.week-cal-day.is-today { background: #f0f4ff; }
.week-cal-day.is-today .week-cal-dom { color: var(--accent-dark); }
.week-cal-day.is-sel { border-color: var(--accent); background: #f0f4ff; }

.task-rail-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.trs-item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--bg);
}
.trs-val { font-size: 18px; font-weight: 800; color: var(--ink); }
.trs-label { font-size: 12px; color: var(--muted); }
.trs--overdue { background: #fef2f2; }
.trs--overdue .trs-val { color: var(--bad); }
.trs--today { background: #fffbeb; }
.trs--today .trs-val { color: var(--warn); }
.trs--done { background: #ecfdf5; }
.trs--done .trs-val { color: var(--good); }
.trs--done[data-toggle-completed-today] {
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.trs--done[data-toggle-completed-today]:hover, .trs--done[data-toggle-completed-today]:focus-visible {
  border-color: #86d7c5;
  background: #e3f8f1;
  outline: none;
}

.task-completed-today {
  display: grid;
  margin-top: 10px;
  border: 1px solid #ccebe3;
  border-radius: 9px;
  overflow: hidden;
  background: #fbfcff;
}
.task-completed-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  cursor: pointer;
  transition: background .15s ease;
}
.task-completed-item:hover, .task-completed-item:focus-visible {
  background: #f0faf7;
  outline: none;
}
.task-completed-item + .task-completed-item {
  border-top: 1px solid var(--line);
}
.task-completed-check {
  margin: 0;
  cursor: inherit;
  pointer-events: none;
}
.task-completed-main {
  display: grid;
  min-width: 0;
}
.task-completed-main strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-completed-main span {
  color: var(--muted);
  font-size: 11px;
}
.task-reopen-btn {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
}
.task-reopen-btn:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}
.task-completed-empty {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.task-progress-head {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}
.task-progress-head strong { color: var(--accent-dark); }
.task-progress-track {
  height: 7px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef2;
}
.task-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width .2s ease;
}
.task-quick-action {
  justify-self: end;
}

.quick-unit-field {
  position: relative;
}

.quick-unit-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
}

.quick-unit-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.quick-unit-option:hover {
  background: #f0f4ff;
}

.quick-unit-option strong {
  font-size: 14px;
}

.quick-unit-option span, .quick-unit-empty {
  color: var(--muted);
  font-size: 12px;
}

.quick-unit-empty {
  padding: 10px;
}

.task-report {
  display: grid;
  gap: 18px;
}

.reporting-page-head {
  align-items: flex-end;
}

.reporting-page-head select {
  min-width: 220px;
}

.settings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.settings-tab {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: color .12s, border-color .12s;
}
.settings-tab:hover:not(.is-active) { color: var(--ink); }

.settings-tab.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.settings-pane {
  display: none;
}

.settings-pane.is-active {
  display: grid;
  gap: 14px;
}

.task-report-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.task-report-toolbar--compact {
  justify-content: flex-end;
}

.task-report-toolbar h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.task-report-toolbar p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.task-report-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-report-actions select {
  min-width: 170px;
}

.task-report-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.task-report-stats > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.task-report-stats strong {
  font-size: 22px;
  line-height: 1;
}

.task-report-stats span {
  color: var(--muted);
  font-size: 12px;
}

.task-report-text, .task-report-details {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.task-report-section-title {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 700;
}

.task-report-text pre {
  min-height: 96px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.task-report-empty {
  padding: 30px 14px;
  color: var(--muted);
  text-align: center;
}

.task-report--operator {
  gap: 14px;
}

.task-report-stats--operator {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.task-report-stats--operator > div {
  display: flex;
  min-height: 82px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 14px 16px;
}

.task-report-stats--operator strong {
  font-size: 25px;
}

.task-report-stats--operator span {
  color: var(--ink);
  font-size: 12px;
}
.report-kpi-top { display: flex; align-items: baseline; gap: 8px; }

.task-report-distribution {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

/* Рейтингові бари (заміна донатам) */
.task-report-bars-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.task-report-bars-col {
  min-width: 0;
  padding: 10px 18px 16px;
  display: flex;
  flex-direction: column;
}
/* Легенда типів — відцентрована й притиснута до нижнього краю колонки */
.task-report-bars-col .rb-legend { margin-top: auto; justify-content: center; padding-top: 14px; }
.task-report-bars-col + .task-report-bars-col {
  border-left: 1px solid var(--line);
}
.task-report-bars-col > .task-report-section-title {
  margin: -10px -18px 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.task-report-bars-col > p.small { margin: 0 0 12px; }
.rb-list { display: grid; gap: 8px; }
.rb-row {
  display: grid;
  grid-template-columns: minmax(96px, 150px) 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 2px 0;
  font: inherit;
  text-align: left;
  color: var(--ink);
}
.rb-row--click { cursor: pointer; border-radius: 8px; }
.rb-row--click:hover { background: #f6f8fc; }
.rb-label {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rb-track {
  height: 18px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
}
.rb-fill { display: flex; height: 100%; min-width: 3px; border-radius: 6px; overflow: hidden; }
.rb-seg { height: 100%; }
.rb-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.rb-value em { margin-left: 6px; font-style: normal; font-weight: 500; color: var(--muted); }
.rb-empty { color: var(--muted); font-size: 13px; padding: 8px 0; }
.rb-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--muted); }
.rb-key { display: inline-flex; align-items: center; gap: 6px; }
.rb-key i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.rb-key--hover { cursor: pointer; padding: 2px 6px; border-radius: 6px; transition: background 0.12s; }
.rb-key--hover:hover { background: #eef2f7; color: var(--ink); }

/* Плаваючий тултип для рейтингових барів (рядок / легенда) */
.import-warning {
  color: var(--warn-text);
  font-weight: 600;
}

.import-preview {
  margin: 12px 0;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: #fff;
}

.import-preview[hidden] { display: none; }

.import-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.import-preview-head strong { font-size: 15px; }

.import-preview-kind {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 3px 9px;
  border-radius: 999px;
}

.import-preview-file {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
  word-break: break-all;
}

.import-preview-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-bottom: 8px;
}

.import-preview-grid > div { display: grid; gap: 2px; }
.import-preview-grid span { font-size: 12px; color: var(--muted); }
.import-preview-grid strong { font-size: 18px; }
.import-preview-grid strong.is-warn { color: var(--warn-text); }

.import-preview-note {
  margin: 4px 0;
  font-size: 13px;
  color: var(--muted);
}

.import-preview-warn {
  margin: 8px 0 0;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 13px;
  line-height: 1.4;
}

.import-preview-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.trash-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.trash-filters select {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.trash-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 4px;
  border-bottom: 1px solid var(--line);
}

.trash-row-main { min-width: 0; }
.trash-row-title { font-size: 14px; font-weight: 600; color: var(--ink); }
/* Тип — кольором, а не лише словом: у довгому списку однакові сірі чипи
   зливаються, і задачу від комунікації видно тільки якщо вчитуватись. */
.trash-kind {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--neutral-bg);
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 4px;
}
.trash-kind--task { background: #dbeafe; color: #1d4ed8; }
.trash-kind--communication { background: #d1fae5; color: #047857; }
.trash-kind--contact { background: #fef3c7; color: #92400e; }
.trash-kind--unit { background: #ede9fe; color: #6d28d9; }

.trash-more {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.trash-more:hover { background: var(--accent-soft); border-color: var(--accent); }
.trash-row-sub { margin-top: 2px; font-size: 12px; color: var(--muted); }
.trash-row-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.trash-purge { color: var(--bad); }
.trash-purge:hover { background: var(--bad-bg); }

.user-delete { color: var(--bad); }
.user-delete:hover { background: var(--bad-bg); border-color: var(--bad); }

.import-rollback-btn {
  color: var(--bad-text);
}

.import-rollback-btn:hover {
  border-color: var(--bad);
  background: var(--bad-bg);
}

.task-report-truncated {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 12.5px;
}

.home-empty-state {
  display: grid;
  gap: 6px;
  padding: 22px 24px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
}

.home-empty-state[hidden] {
  display: none;
}

.home-empty-state strong {
  font-size: 16px;
  color: var(--ink);
}

.home-empty-state span {
  color: var(--muted);
  font-size: 13px;
}

/* Історія дій у картці частини (лише тімлід, згорнута за замовчуванням) */
.uc-history {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.uc-history summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  cursor: pointer;
  user-select: none;
}

.uc-history summary:hover {
  color: var(--accent);
}

/* Порожній стан / завантаження — тим самим компактним кеглем, що й рядки
   історії, а не великим базовим шрифтом. */
.uc-history-empty {
  padding: 6px 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.uc-history-list {
  margin-top: 10px;
  display: grid;
  gap: 2px;
  max-height: 320px;
  overflow-y: auto;
}

.uc-history-row {
  display: grid;
  grid-template-columns: 110px 90px 1fr;
  gap: 10px;
  padding: 5px 2px;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line-soft);
}

.uc-history-when {
  color: var(--muted);
  white-space: nowrap;
}

.uc-history-user {
  color: var(--ink);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uc-history-action {
  color: var(--muted);
}

.rb-tip {
  position: fixed;
  z-index: 60;
  pointer-events: none;
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.6;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  max-width: 260px;
}
.rb-tip strong { display: block; margin-bottom: 3px; font-size: 12px; }
.rb-tip span { display: flex; align-items: center; gap: 6px; color: #cbd5e1; }
.rb-tip b { color: #fff; margin-left: auto; padding-left: 12px; }
.rb-tip-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }
.rb-tip-empty { color: #94a3b8; }

.task-report-donut-column {
  min-width: 0;
  padding: 8px 16px 14px;
}

.task-report-donut-column + .task-report-donut-column {
  border-left: 1px solid var(--line);
}

.task-report-donut-title {
  margin-bottom: 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.task-report-donut-content {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
}

.task-report-donut {
  width: 126px;
  height: 126px;
  padding: 20px;
  border-radius: 50%;
}

.task-report-donut > div {
  display: grid;
  width: 100%;
  height: 100%;
  place-content: center;
  border-radius: 50%;
  background: var(--panel);
  text-align: center;
}

.task-report-donut strong {
  font-size: 21px;
  line-height: 1;
}

.task-report-donut span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.task-report-donut-legend {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.task-report-donut-legend button {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 36px 50px;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.task-report-donut-legend button:disabled {
  cursor: default;
}

.task-report-donut-legend button:not(:disabled):hover span {
  color: var(--accent-dark);
  text-decoration: underline;
}

.task-report-donut-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.task-report-donut-legend span {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-report-donut-legend strong {
  justify-self: end;
  font-size: 13px;
  font-weight: 700;
  font-style: normal;
  color: var(--ink);
}

.task-report-donut-legend em {
  justify-self: end;
  font-size: 12px;
  font-style: normal;
  color: var(--muted);
}

.task-report-donut-legend p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.task-report-text--operator {
  overflow: hidden;
}

.task-report-text-head, .task-report-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 10px;
}

.task-report-text-head .task-report-section-title, .task-report-results-head .task-report-section-title {
  padding: 0;
  border: 0;
  font-size: 15px;
}

.task-report-text-head p, .task-report-results-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.task-report-text--operator pre {
  min-height: 0;
  margin: 0 16px 16px;
  padding: 13px 14px;
  border: 1px solid #d9ebe7;
  border-radius: 8px;
  background: #f4faf8;
  font-size: 13px;
  line-height: 1.65;
}

.task-report-results {
  overflow: hidden;
}

.task-report-filters {
  display: flex;
  gap: 5px;
  padding: 4px 16px 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
}

.task-report-filters button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.task-report-filters button.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent-dark);
  font-weight: 700;
}

.task-report-filters button span {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: #eef2f5;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.task-report-filters button.is-active span {
  background: #dff2ed;
  color: var(--accent-dark);
}

.task-report-result-head, .task-report-result-row {
  display: grid;
  grid-template-columns: minmax(150px, 1.1fr) 116px minmax(150px, 1fr) minmax(220px, 1.8fr) 100px;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
}

/* Тімлід бачить додаткову колонку «Відповідальний» */
.task-report-result-table.is-lead .task-report-result-head, .task-report-result-table.is-lead .task-report-result-row {
  grid-template-columns: minmax(150px, 1.1fr) minmax(90px, .7fr) 116px minmax(140px, 1fr) minmax(200px, 1.6fr) 100px;
}

.task-report-result-owner {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Тип (комунікація/задача) — нейтральний тег з обвідкою, щоб не змагався
   кольором із результатами */
.task-report-result-source span {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid var(--line);
  background: #fff;
  color: #526071;
}
.task-report-result-source .is-communication::before { content: "◇ "; }
.task-report-result-source .is-task::before { content: "✓ "; }
.task-report-result-none { color: #b6bdc6; }

.task-report-result-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.task-report-result-row {
  border-top: 1px solid var(--line);
  min-height: 58px;
  cursor: pointer;
}

.task-report-result-row:hover {
  background: #f7f9fe;
}

.task-report-result-unit {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.task-report-result-row:hover .task-report-result-unit {
  color: var(--accent-dark);
}

.task-report-stats--operator > div.is-clickable {
  cursor: pointer;
}

.task-report-stats--operator > div.is-clickable:hover {
  border-color: var(--accent);
}

.task-report-result-types {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.task-report-result-types span {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
/* Три різні кольори результату: цінність зелена, практика синя, ідея бурштин */
.task-report-result-types .is-value {
  background: var(--good-bg);
  color: var(--good);
}
.task-report-result-types .is-practice {
  background: #e6f1fb;
  color: #185fa5;
}
.task-report-result-types .is-improvement {
  background: #fff4df;
  color: #a35a00;
}

.task-report-result-types .is-document {
  background: #eef2f6;
  color: #526071;
}

.task-report-result-text {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.task-report-result-text > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-report-result-text a {
  display: inline-block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.task-report-result-text a:hover { color: var(--accent-dark); }

.task-report-result-row time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.task-report-show-more {
  display: block;
  margin: 10px auto 13px;
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
}

.task-report-show-more:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

@media (max-width: 920px) {
  .task-report-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .task-report-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .task-report-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-report-stats--operator {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-report-donut-column + .task-report-donut-column {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .task-report-result-table {
    overflow-x: auto;
  }

  .task-report-result-head, .task-report-result-row {
    min-width: 860px;
  }

  .task-report-result-table.is-lead .task-report-result-head, .task-report-result-table.is-lead .task-report-result-row {
    min-width: 960px;
  }
}

@media (max-width: 520px) {

  .task-report-donut-content {
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 12px;
  }

  .task-report-donut {
    width: 104px;
    height: 104px;
    padding: 17px;
  }
}

.task-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.task-day-title { font-size: 15px; font-weight: 700; color: var(--ink); }
.task-day-clear {
  font-size: 12px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 4px 10px;
  cursor: pointer;
}
.task-day-clear:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 920px) {
  .task-workbench { grid-template-columns: 1fr; }
  .task-rail { position: static; }
}

/* ── Задачі: підсумок-стрічка (старий, у рейлі тепер) ─────────────── */
.task-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

/* ── Задачі: групи ────────────────────────────────────────────────── */
.task-group { margin-bottom: 14px; }
.task-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  cursor: pointer;
  text-align: left;
}
.task-group-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.task-group--overdue .task-group-head { background: var(--bad-bg); border-color: #fee2e2; }
.task-group--overdue .task-group-title { color: var(--bad-text); }
.task-group--today .task-group-head {
  background: var(--accent-soft);
  border-color: #dbe6fe;
}
.task-group--today .task-group-title { color: var(--accent-dark); }
.task-group--later .task-group-head { background: var(--bg); border-color: var(--line); }
.task-group--later .task-group-title { color: var(--muted); }
.task-group-chevron {
  width: 9px; height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform .15s;
}
.task-group-chevron.open { transform: rotate(45deg); }
.task-group-body { margin-top: 8px; display: grid; gap: 8px; }
.task-group.is-collapsed .task-group-body { display: none; }

/* ── Задачі: рядок ────────────────────────────────────────────────── */
.task-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.task-row:hover {
  background: #f8fafc;
  border-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.task-row--prio-high { border-left: 3px solid var(--bad); }
.task-row--prio-low { border-left: 3px solid #cbd5e1; }
.task-prio {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: middle;
}
.task-prio--high { background: #fee2e2; color: var(--bad); }
.task-prio--low { background: #f1f5f9; color: #64748b; }
.task-row-check {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border: 1.5px solid rgba(37, 99, 235, .4);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
}
.task-row-check:hover { border-color: var(--good); background: #f0fdf4; }
.task-row-check.is-done {
  border-color: var(--good);
  background: var(--good);
  cursor: default;
  position: relative;
}
.task-row-check.is-done::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.task-row--done .task-row-title { color: var(--muted); font-weight: 500; }
.task-row-deadline.is-done { color: var(--good); }
.task-row-main { flex: 1; min-width: 0; }
.task-row-title { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.task-row-sub { font-size: 12px; color: var(--muted); }
.task-row-due { text-align: right; flex-shrink: 0; }
.task-row-deadline { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.task-row-deadline.overdue { color: var(--bad); }
.task-row-deadline.today {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #2c4fd7;
  font-weight: 700;
}
.task-row-deadline.tomorrow { color: var(--warn); }
.task-row-date { font-size: 11px; color: var(--muted); }

@media (max-width: 720px) {
  .task-summary { grid-template-columns: repeat(2, 1fr); }
}

.task-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.task-card:hover {
  background: #f0f4ff;
}

.task-card strong {
  display: block;
  margin-bottom: 3px;
}

.task-card.compact {
  display: block;
  padding: 10px;
}

.task-card.compact small, .task-card.compact span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(190px, 1fr));
  gap: 10px;
  align-items: start;
}

.kanban-column, .week-day {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  padding: 10px;
  min-width: 0;
}

.kanban-column h3, .week-day h3 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  font-size: 15px;
  margin-bottom: 10px;
}

.kanban-column h3 span, .week-day h3 span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.kanban-items, .week-day-items {
  display: grid;
  gap: 8px;
}

.week-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.metric-history {
  display: grid;
  gap: 8px;
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fafbfc;
}

.metric-row strong {
  display: block;
  margin-bottom: 3px;
}

.delta-up {
  color: var(--good);
}

.delta-down {
  color: var(--bad);
}

.delta-flat {
  color: var(--muted);
}

.import-panel label {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }

  .sidebar-toggle {
    display: none;
  }

  body.sidebar-collapsed .brand-copy, body.sidebar-collapsed .nav-label {
    display: initial;
  }

  body.sidebar-collapsed .nav-btn {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    justify-items: stretch;
    padding: 9px 11px;
  }

  .kpi-grid, .split, .workbench {
    grid-template-columns: 1fr;
  }

  /* Одна колонка: список іде НАД карткою звичайним потоком — липкість і
     висота на весь екран тут лише заважали б. */
  .list-pane {
    position: static;
    height: auto;
    max-height: none;
  }
  .unit-list {
    flex: none;
    max-height: 60vh;
  }

  .page-head, .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .task-edit {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .kanban-board {
    grid-template-columns: 1fr;
  }

  .task-edit label:first-child, .task-comment, .task-actions {
    grid-column: span 2;
  }
}

@media (max-width: 620px) {
  .task-card {
    grid-template-columns: 1fr;
  }

  .task-edit {
    grid-template-columns: 1fr;
  }

  .task-edit label:first-child, .task-comment, .task-actions {
    grid-column: span 1;
  }

  .task-actions {
    justify-content: stretch;
  }

  .task-actions button {
    flex: 1;
  }
}

/* Небезпечна зона в редагуванні картки: видалення частини */
.uc-danger-zone {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 18px;
  padding: 14px 16px;
  border: 1px solid #f3c7c2;
  border-left: 3px solid var(--bad);
  border-radius: 10px;
  background: #fef6f5;
}
.uc-danger-zone > div { flex: 1; min-width: 0; }
.uc-danger-zone strong { font-size: 14px; color: var(--ink); }
.uc-danger-zone p { margin: 3px 0 0; }
.uc-danger-zone button { flex: none; }
@media (max-width: 720px) {
  .uc-danger-zone { flex-direction: column; align-items: stretch; }
  .uc-danger-zone button { width: 100%; }
}

/* Вивантаження даних (сторінка Імпорт) */
/* Два компактні кубики поруч, а не дві смуги на всю ширину сторінки:
   вивантажень усього два, і кожне з них — дрібна дія, не розділ. */
.export-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 290px));
  justify-content: start;
  gap: 12px;
}
.export-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcfe;
}
.export-item > div { min-width: 0; }
.export-item strong { display: block; font-size: 13.5px; color: var(--ink); }
.export-item p { margin: 3px 0 0; font-size: 12px; line-height: 1.4; }
.export-item button { align-self: flex-start; min-height: 32px; padding: 0 14px; font-size: 13px; }
@media (max-width: 720px) {
  .export-row { grid-template-columns: 1fr; }
}

.drop-zone {
  border: 2px dashed var(--line);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.drop-zone.drag-over {
  border-color: var(--accent);
  background: rgba(15, 118, 110, 0.06);
}

.drop-hint {
  margin: 0 0 6px;
  font-size: 15px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.small {
  font-size: 12px;
}

.unmatched-box {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--warn);
  border-radius: 8px;
  background: rgba(180, 83, 9, 0.04);
}

.unmatched-box strong {
  display: block;
  margin-bottom: 8px;
  color: var(--warn);
}

.unmatched-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.unmatched-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.unmatched-info strong {
  display: inline;
  margin-bottom: 0;
  color: var(--ink);
}
.unmatched-assign {
  display: flex;
  align-items: center;
  gap: 6px;
}
.unmatched-unit-input {
  min-width: 240px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.unmatched-unit-input.input-error {
  border-color: var(--bad);
  background: #fef2f2;
}
.unmatched-done {
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 13px;
}

.chart-box {
  position: relative;
  height: 240px;
  margin-bottom: 16px;
}

.chart-box--analytics {
  height: 230px;
  margin: 4px 4px 0;
}

/* ── Кнопки (оновлені назви) ─────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-radius: 7px;
  padding: 10px 14px;
  min-height: 40px;
  border: none;
  cursor: pointer;
  font: inherit;
}
.btn-primary:hover { background: var(--accent-dark); }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  border-left: 3px solid var(--line);
}

.stat-val {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
}

.page-head-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Дата на Головній — праворуч у шапці, тим самим оформленням, що й
   пікери періоду в «Команді» та «Звітності». */
.home-date {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.home-date svg { color: var(--muted); flex: 0 0 auto; }
.home-date-day { color: var(--muted); font-weight: 500; }
.home-date-day::before { content: "· "; }

.home-control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 10px;
}

.home-owner-filter {
  min-width: 200px;
  max-width: 260px;
  min-height: 36px;
  height: 36px;
  padding: 0 34px 0 13px;
  font-size: 13px;
  font-weight: 500;
}

/* ── Головна — задачі ────────────────────────────────────────────────────── */
.kanban-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: 8px 0 6px;
}

.kanban-section-label--danger { color: var(--bad); }

.home-task-col {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.home-task-card {
  padding: 9px 12px;
  border-radius: 7px;
  background: #fafbfc;
  border: 1px solid var(--line);
  cursor: pointer;
  display: grid;
  gap: 2px;
}

.home-task-card:hover { background: #f0f4ff; }
.home-task-card strong { font-size: 13px; }
.home-task-card small, .home-task-card span { font-size: 11px; color: var(--muted); }

.home-task-card--overdue {
  border-left: 3px solid var(--bad);
  background: #fff8f7;
}

.home-task-card--today {
  border-left: 3px solid var(--warn);
}

/* ── Аналітика ───────────────────────────────────────────────────────────── */
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 4px 0 12px;
  color: var(--ink);
}

/* ── Команда ─────────────────────────────────────────────────────────────── */
.team-table-head {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(130px, 1.3fr) 72px 84px 60px 84px 100px 100px;
  gap: 12px;
  padding: 8px 14px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  min-width: 920px;
}

.team-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(130px, 1.3fr) 72px 84px 60px 84px 100px 100px;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #edf1f4;
  font-size: 13px;
  min-width: 920px;
  cursor: pointer;
  transition: background .15s ease;
}

.team-row:last-child { border-bottom: none; }
.team-row:hover { background: #f7f9fe; }
.team-row:focus-visible {
  outline: 2px solid #9cb4f5;
  outline-offset: -2px;
}
.team-row--attention {
  box-shadow: inset 3px 0 0 #e6a23c;
}

.team-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.team-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  border-radius: 50%;
  color: var(--accent-dark);
  background: #e5f4f1;
  font-size: 10px;
  font-weight: 800;
}

.team-bar-col { display: grid; gap: 4px; }

.team-bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}

.team-table-head span:nth-child(n+3):nth-child(-n+7) { text-align: center; }

.team-imbalance-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid #edf1f4;
  font-size: 13px;
}
.team-imbalance-row:first-child { border-top: none; }
.team-imbalance-row strong { color: var(--ink); }
.team-imbalance-row span { color: var(--warn); font-size: 12px; text-align: right; }

.team-bar-track {
  height: 8px;
  background: transparent;
  border-radius: 999px;
  overflow: hidden;
}

.team-bar-fill {
  height: 100%;
  border-radius: 999px;
}

.team-bar-fill--ok { background: var(--accent); }

.team-stat { text-align: center; font-size: 13px; }
.team-stat--result { color: var(--accent-dark); font-weight: 700; }
.team-stat--muted { color: #9aa7b3; }

.team-last-activity { color: var(--muted); font-size: 12px; }

.team-overdue-link {
  justify-self: center;
  min-width: 30px;
  height: 28px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: default;
}

.team-overdue-link.has-overdue {
  background: #fdebea;
  color: var(--bad);
  cursor: pointer;
  font-weight: 800;
}

.team-overdue-link.has-overdue:hover {
  background: #fbd9d7;
}

.team-page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.team-kpi {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 94px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-card);
}

.team-kpi-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 46px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 18px;
}

.team-kpi--units .team-kpi-icon::before { content: "Ч"; }
.team-kpi--contact .team-kpi-icon::before { content: "↔"; }
.team-kpi--tasks .team-kpi-icon::before { content: "!"; }
.team-kpi--comms .team-kpi-icon::before { content: "К"; }
.team-kpi--result .team-kpi-icon::before { content: "✓"; }
.team-kpi--rate .team-kpi-icon::before { content: "%"; }
.team-kpi--coverage .team-kpi-icon::before { content: "◎"; }
.team-kpi--contact .team-kpi-icon { background: #fff4e7; color: #ad6500; }
.team-kpi--tasks .team-kpi-icon { background: #fdebea; color: var(--bad); }
.team-kpi--comms .team-kpi-icon { background: #eef2ff; color: #4b63b8; }
.team-kpi--result .team-kpi-icon { background: var(--good-bg); color: var(--good); }
.team-kpi--rate .team-kpi-icon { background: var(--accent-soft); color: var(--accent-dark); }
.team-kpi--coverage .team-kpi-icon { background: var(--accent-soft); color: var(--accent-dark); }

.team-trend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.team-trend-controls-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.team-trend-display { display: flex; align-items: center; gap: 8px; }
.seg-group--sm { height: 34px; }
.seg-group--sm button { padding: 6px 12px; font-size: 12px; }
.team-trend-owner {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #fff;
  padding: 0 30px 0 12px;
  font-size: 13px;
  color: var(--ink);
}
/* Власний date-range picker */
.dr-wrap { position: relative; }
.dr-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #fff;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.dr-trigger:hover { border-color: #cbd5e1; }
.dr-trigger svg { color: var(--muted); }
.dr-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  display: flex;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  overflow: hidden;
}
.dr-pop[hidden] { display: none; }
.dr-pop--right { left: auto; right: 0; }
.dr-presets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}
.dr-preset {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.dr-preset:hover { background: #eef2ff; border-color: #dbe3ff; }
.dr-cal { padding: 12px 14px; }
.dr-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.dr-cal-head strong { font-size: 14px; color: var(--ink); text-transform: capitalize; }
.dr-nav { display: flex; gap: 4px; }
.dr-nav button {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s;
}
.dr-nav button:hover { background: #f1f5f9; }
.dr-weekdays, .dr-grid { display: grid; grid-template-columns: repeat(7, 34px); }
.dr-weekdays {
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}
.dr-weekdays span { padding: 4px 0; }
.dr-grid { gap: 2px; }
.dr-day {
  height: 34px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.1s;
}
.dr-day:hover { background: #eef2ff; }
.dr-day.is-out { color: #cbd5e1; }
.dr-day.is-today { box-shadow: inset 0 0 0 1px var(--line-strong); }
.dr-day.is-range { background: #eff4ff; border-radius: 0; color: #1e3a8a; }
.dr-day.is-edge { background: var(--accent); color: #fff; border-radius: 8px; }
/* Метрики над графіком — 3 акуратні scorecard-колонки */
.team-trend-scores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.tt-score {
  display: grid;
  gap: 3px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}
.tt-score-label { font-size: 12px; color: var(--muted); }
.tt-score-value {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}
.tt-score-delta { font-weight: 600; }
/* Розклад типів результату окремим рядком під картками й над графіком */
.tt-type-split {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin: 12px 0 2px;
  font-size: 13px;
  color: var(--muted);
}
.tt-type-split span { display: inline-flex; align-items: center; gap: 6px; }
.tt-type-split b { color: var(--ink); font-weight: 700; }
.tt-type-split .tt-dot { width: 10px; height: 10px; border-radius: 3px; }
.tdelta { font-size: 12px; font-weight: 600; }
.tdelta.is-up { color: var(--good); }
.tdelta.is-down { color: var(--bad); }
.tdelta.is-flat { color: #9aa7b3; }

.team-trend-plot { position: relative; }
.team-trend-svg { width: 100%; height: auto; display: block; overflow: visible; }
.team-trend-svg .tsvg-lbl { font-size: 9.5px; fill: #94a3b8; }
.team-trend-svg .tsvg-grid { stroke: #f1f5f9; stroke-width: 1; }
.team-trend-svg .tsvg-hit { fill: transparent; cursor: pointer; }
.team-trend-tip {
  position: absolute;
  top: -4px;
  transform: translateX(-50%);
  pointer-events: none;
  background: #0f172a;
  color: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.6;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.22);
  white-space: nowrap;
  z-index: 5;
}
.team-trend-tip strong { display: block; margin-bottom: 3px; font-size: 12px; }
.team-trend-tip span { display: flex; align-items: center; gap: 6px; color: #cbd5e1; }
.team-trend-tip b { color: #fff; margin-left: auto; padding-left: 10px; }
.tt-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tt-dot--act { background: #94a3b8; }
.tt-dot--val { background: #16a34a; }
.tt-dot--prac { background: #2563eb; }
.tt-dot--idea { background: #e0913a; }

/* Взаємодія по частинах — контроли (відповідальний + вкладки) */
.team-interaction-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.team-kpi div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.team-kpi div > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.team-kpi strong {
  color: var(--ink);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  display: flex;
  align-items: center;
  gap: 8px;
}

.team-kpi small {
  color: var(--muted);
  font-size: 12px;
  white-space: normal;
}

.team-load-panel {
  min-width: 0;
}

.team-table-scroll {
  overflow-x: auto;
}

.team-interaction-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.team-interaction-row:last-child {
  border-bottom: 0;
}

.team-interaction-row:hover {
  background: #f7f9fe;
}

.team-interaction-row strong span {
  color: var(--muted);
  font-weight: 500;
}

.team-interactions-panel {
  margin-bottom: 12px;
}

.team-interaction-tabs {
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--neutral-bg);
  max-width: min(100%, 760px);
  overflow-x: auto;
}

.team-interaction-tabs button {
  height: 32px;
  border: 0;
  border-radius: 8px;
  padding: 0 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.team-interaction-tabs button.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .06);
  font-weight: 600;
}

.team-interaction-head, .team-interaction-row {
  display: grid;
  /* «Результативність» — найдовший заголовок у рядку; при gap 12px він
     впритул сходився з «Типи (Ц·П·І)» і читався як одне слово. */
  grid-template-columns: minmax(150px, 1.3fr) minmax(150px, 1.2fr) minmax(100px, .9fr) 76px 80px 116px minmax(120px, 1fr);
  gap: 12px 18px;
  align-items: center;
  min-width: 980px;
}

/* Статуси в рядку — ті самі кольори, що в картці частини й на Головній.
   Клас окремий: .ti-chip уже зайнятий чипами типів (Ц·П·І). */
.ti-statuses {
  /* Дві фіксовані колонки: активність | рівень. Кожен чип (чи прочерк)
     сидить у своїй, тож у стовпчику вони вирівняні один під одним. */
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 4px 8px;
  align-items: center;
}
.ti-axis { display: flex; min-width: 0; }
.ti-status-chip {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.team-interaction-head {
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.team-interaction-list {
  overflow-x: auto;
}

.team-interaction-row {
  padding: 11px 12px;
  font-size: 13px;
}

.team-interaction-row > span:not(:first-child) {
  color: var(--muted);
}
.team-interaction-row .ti-result {
  color: var(--accent-dark);
  font-weight: 600;
}
.team-interaction-row .ti-muted { color: #b6bdc6; }
.ti-types {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.ti-chip {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  background: #eef2ff;
  color: #2c4fd7;
  white-space: nowrap;
}
.ti-chip.is-zero {
  background: #f1f3f5;
  color: #b6bdc6;
}
.ti-tab-count {
  margin-left: 6px;
  font-size: 11px;
  opacity: .7;
}
.team-interaction-more {
  margin-top: 8px;
  width: 100%;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.team-interaction-more:hover { background: #f7f9fe; }

.team-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 12px;
}

.team-empty {
  margin: 0;
  padding: 22px 8px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.success-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 250px;
  padding: 12px 16px;
  border: 1px solid #c3d2f7;
  border-radius: 8px;
  background: #f0faf7;
  color: #2c4fd7;
  box-shadow: 0 10px 30px rgba(20, 52, 47, .14);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity .18s ease, transform .18s ease;
}

.success-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Тост не перехоплює кліки по сторінці, але кнопка-дія всередині — має */
.success-toast-action {
  pointer-events: auto;
}

.success-toast-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  border-radius: 50%;
  background: #158477;
  color: #fff;
  font-size: 13px;
}

.success-toast-action {
  margin-left: 6px;
  padding: 4px 10px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  flex: 0 0 auto;
}

.success-toast-action:hover { background: rgba(255, 255, 255, .5); }

.success-toast--error {
  border-color: #f3c6c6;
  background: var(--bad-bg);
  color: var(--bad-text);
}

.success-toast--error .success-toast-icon {
  background: var(--bad);
}

@media (max-width: 640px) {
  .success-toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    min-width: 0;
  }
}

/* Картки, а не смуги на всю ширину: фахівців одиниці, і кожен — це
   короткий набір фактів, а не таблиця на пів екрана. */
.users-list {
  display: grid;
  /* 320px — рівно стільки, щоб три дії стали в один рядок. */
  grid-template-columns: repeat(auto-fit, minmax(240px, 320px));
  justify-content: start;
  gap: 12px;
}

.user-access-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.user-access-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-access-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-access-main { min-width: 0; }
.user-access-main strong, .user-access-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-access-main small {
  margin-top: 2px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .users-list { grid-template-columns: 1fr; }
}

.user-access-stat {
  color: var(--muted);
  font-size: 12px;
}

.user-access-role, .user-access-status {
  display: inline-flex;
  justify-content: center;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475467;
  font-size: 11px;
  font-weight: 700;
}

.user-access-status.is-active {
  background: #dcfce7;
  color: #15803d;
}

.user-access-status.is-blocked {
  background: #fee2e2;
  color: #b91c1c;
}

.user-access-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* Три дії в картці 300px: у звичайному розмірі вони переносились на два
   рядки й картка виростала до 180px. */
.user-access-actions button {
  min-height: 28px;
  padding: 0 9px;
  font-size: 12px;
}

.modal-box--small {
  width: 460px;
}

.user-unit-field {
  display: grid;
  gap: 8px;
}

.user-unit-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.user-unit-field-head small {
  color: var(--accent-dark);
  font-weight: 700;
}

.user-unit-field > input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.user-unit-field > input:focus {
  border-color: var(--accent);
  outline: 2px solid rgba(15, 118, 110, .1);
}

.user-unit-picker {
  max-height: 230px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

/* Селектор із .form-grid — інакше загальне правило «label у формі — це
   колонка» (.form-grid label) перебивало сітку, і чекбокс ставав над
   назвою: кожна частина займала три рядки. */
.form-grid .user-unit-option {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 34px;
  padding: 5px 11px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
}

/* Глобальне `input { min-height: 40px }` розтягувало чекбокс на весь рядок
   — звідси й були рядки по 50px замість 34. */
.user-unit-option input[type="checkbox"] {
  width: 15px;
  height: 15px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}
.user-unit-option .uu-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-unit-option .uu-num { color: var(--muted); font-size: 12px; }

.user-unit-option:last-child {
  border-bottom: 0;
}

.user-unit-option:hover {
  background: var(--bg);
}

.form-grid .user-unit-option:has(input:checked) {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

/* Пошук частин у модалці — той самий вигляд, що й пошук у списку частин. */
.user-unit-search { flex: 0 0 auto; }
/* .form-grid input задає власний padding і йде нижче за .search-main input,
   тож місце під лупу доводиться повертати звідси. */
.form-grid .user-unit-search input {
  min-height: 36px;
  padding-left: 34px;
  border-radius: 9px;
}

.user-unit-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.user-unit-option strong, .user-unit-option small {
  display: block;
}

.user-unit-option strong {
  font-size: 13px;
}

.user-unit-option small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.user-unit-empty {
  padding: 22px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.portal-rows {
  display: grid;
  gap: 4px;
  margin-top: 4px;
}

.portal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.portal-tag {
  display: inline-flex;
  align-items: center;
  min-width: 46px;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 6px;
  background: #eef2ff;
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 12px;
}

.portal-empty {
  margin: 8px 0 0;
  font-size: 13px;
}

.meta em {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  font-style: normal;
}

.asset-form {
  display: grid;
  grid-template-columns: 1fr 110px auto;
  gap: 8px;
}

/* Засоби — колонки по категоріях */
.asset-groups {
  display: grid;
  grid-template-columns: repeat(var(--asset-cols, 4), minmax(0, 1fr));
  gap: 18px;
  align-items: start;
  margin-top: 12px;
}
.asset-group {
  min-width: 0;
}
/* Колір типу засобу — той самий, що в іконці картки, щоб колонка й картки
   в ній читались як одне ціле. */
.asset-group--reb { --asset-accent: #2563eb; }
.asset-group--rer { --asset-accent: #7c3aed; }
.asset-group--video { --asset-accent: #0891b2; }
.asset-group--other { --asset-accent: #64748b; }
.asset-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ink);
  margin-bottom: 10px;
  padding-bottom: 8px;
  /* Кольорова риска під назвою типу — щоб колонки читались як окремі
     колонки, а не суцільна сітка карток. Колір задає сама колонка. */
  border-bottom: 2px solid var(--asset-accent, var(--line-strong));
}
.asset-group-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--muted);
}
.asset-group-items {
  display: grid;
  gap: 8px;
}

.asset-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}
.asset-card-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 8px;
  background: #eef5f4;
  color: var(--accent);
}
.asset-card-ico svg { display: block; }
.asset-card-body { flex: 1; min-width: 0; cursor: pointer; }
.asset-card-body:hover .asset-card-name { color: var(--accent); }
.asset-card-name { font-size: 14px; font-weight: 500; color: var(--ink); }
.asset-card-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.asset-card .asset-delete {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  flex-shrink: 0;
}
.asset-card .asset-delete:hover { color: var(--bad); }

@media (max-width: 1180px) {
  .asset-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .asset-groups {
    grid-template-columns: 1fr;
  }

  .uc-asset-form select[name="category"], .uc-asset-form input[name="name"], .uc-asset-form input[name="quantity"] {
    flex: 1 1 100%;
  }
}

/* Consistent edit/add panels */
.uc-edit-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafbfc;
  padding: 14px;
  margin-top: 10px;
}

.uc-edit-panel.uc-blocked {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 128, 118, 0.12);
}

.uc-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.uc-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.uc-form .span-2 { grid-column: 1 / -1; }
.uc-form input, .uc-form select, .uc-form textarea {
  font-weight: 400;
  color: var(--ink);
  background: var(--panel);
}
.uc-form textarea { min-height: 72px; resize: vertical; }

.uc-form--inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.uc-form--inline select, .uc-form--inline input { flex: 1; min-width: 120px; }
.uc-form--inline input[name="quantity"] { flex: 0 0 90px; min-width: 0; }
.uc-form--inline .uc-btn-add { flex: 0 0 auto; }
.uc-form--inline .uc-btn-save { flex: 0 0 auto; }

.uc-asset-form {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  align-items: center;
  gap: 10px;
}

.uc-asset-form select, .uc-asset-form input {
  min-height: 40px;
  padding: 9px 12px;
  font-size: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
}

.uc-asset-form select:focus, .uc-asset-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Кастомний дропдаун категорії засобу (нативний select не стилізується) */
.asset-cat-picker { position: relative; flex: 0 0 190px; }

.asset-cat-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}

.asset-cat-btn:hover { border-color: var(--accent); }
.asset-cat-btn[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.asset-cat-text { flex: 1; }
.asset-cat-caret { color: var(--muted); font-size: 11px; }
.asset-cat-ico { display: inline-flex; width: 18px; height: 18px; color: var(--accent); flex: 0 0 18px; }
.asset-cat-ico svg { width: 100%; height: 100%; }

.asset-cat-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .14);
}

.asset-cat-menu[hidden] { display: none; }

.asset-cat-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}

.asset-cat-option:hover { background: var(--bg); }
.asset-cat-option.is-selected { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }

/* Підказки назв — лише в межах обраної категорії */
.asset-name-field { position: relative; flex: 1 1 260px; }
.asset-name-field input { width: 100%; }

.asset-name-hints {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .14);
  max-height: 240px;
  overflow-y: auto;
}

.asset-name-hints[hidden] { display: none; }

.asset-name-hint {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}

.asset-name-hint:hover { background: var(--accent-soft); }

.uc-asset-form input[name="name"] {
  flex: 1 1 260px;
}

.uc-asset-form input[name="quantity"] {
  flex: 0 0 84px;
}

.uc-asset-form .uc-btn-add, .uc-asset-form .uc-btn-save, .uc-asset-form .uc-btn-ghost {
  min-height: 40px;
  padding: 9px 16px;
  font-size: 14px;
  border-radius: 9px;
}

.uc-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.uc-edit-links {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.uc-edit-links-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
  margin-bottom: 10px;
}
.uc-edit-links .uc-form--inline { margin-top: 10px; }

.rank-box {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: baseline;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
  margin-bottom: 4px;
}

.rank-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rank-item span {
  color: var(--muted);
  font-size: 12px;
}

.rank-item strong {
  font-size: 22px;
  color: var(--accent-dark);
}

.rank-box small { flex-basis: 100%; }

@media (max-width: 980px) {
  .team-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .team-kpi-grid { grid-template-columns: 1fr; }
  .team-page-actions { width: 100%; justify-content: space-between; }
  .team-interactions-panel .panel-head {
    align-items: stretch;
    flex-direction: column;
  }
  .team-interaction-tabs {
    overflow-x: auto;
  }
  .team-interaction-tabs button {
    flex: 0 0 auto;
  }
}

/* ── Unit Card V2 ────────────────────────────────────────────────────────── */
.uc-header {
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.uc-title-row {
  display: flex;
  align-items: center;          /* кільце по центру відносно назви+статусів */
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 0;
}

/* Назва і статуси — один блок, а не два окремі поверхи */
.uc-title-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.uc-title-row h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.uc-title-row h2 span {
  color: var(--ink);
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: 0;
  margin-left: 8px;
  margin-right: 8px;
}

.uc-btn-edit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  font-size: 13px;
  font-weight: 600;
  padding: 0 14px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
}
.uc-btn-edit:hover { background: var(--bg); border-color: var(--border-strong, #cdd4dc); }
.uc-btn-edit svg { display: block; color: var(--muted); }

.uc-status-badge {
  border: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
}

.uc-status-badge:hover {
  filter: brightness(.97);
}

/* top/left — лише запасні значення: реальну позицію ставить JS, від чипа
   (ширина чипа активності залежить від тексту, статично не вгадати). */
.uc-status-menu {
  position: absolute;
  top: 74px;
  left: 18px;
  z-index: 20;
  width: min(240px, calc(100% - 36px));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 16px 40px rgba(15, 23, 42, .14);
}

.uc-status-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.uc-status-menu-item:hover, .uc-status-menu-item.active {
  background: #f1f5f9;
}

.uc-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  flex-shrink: 0;
}

.uc-contact-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
}

/* Активність — наскільки регулярно тримаємо звʼязок */
.uc-status-active { background: #dcfce7; color: #15803d; }
.uc-status-neutral { background: #e0f2fe; color: #0369a1; }
.uc-status-inactive { background: #f1f5f9; color: #64748b; }
.uc-status-unknown { background: #f1f5f9; color: #64748b; }

/* Рівень підготовки — окрема вісь, тому й палітра інша: не зелений/сірий,
   щоб з першого погляду не плутати з активністю. */
.uc-level-badge {
  border: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
}
.uc-level-badge:hover { filter: brightness(.97); }
.uc-level-pro { background: var(--level-pro-bg); color: var(--level-pro-text); }
.uc-level-mid { background: var(--level-mid-bg); color: var(--level-mid-text); }
.uc-level-training { background: var(--level-train-bg); color: var(--level-train-text); }

/* «Активність не вказана» і «Рівень не вказано» — ОДНЕ правило на обидві осі:
   це той самий стан «чекає на рішення», тож і виглядають однаково.
   Стоїть ПІСЛЯ .uc-level-badge навмисно: те правило має border:0 і своє
   padding, і раніше перебивало пунктир — чипи виглядали по-різному. */
.uc-status-unset, .uc-level-none {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  padding: 2px 9px;
}
/* Кольорові крапки в меню рівня */
.uc-status-dot.uc-level-none { background: #cbd5e1; border: 0; padding: 0; }
.uc-status-dot.uc-level-pro { background: var(--level-pro-text); }
.uc-status-dot.uc-level-mid { background: var(--level-mid-text); }
.uc-status-dot.uc-level-training { background: var(--level-train-text); }
.uc-contact-fresh { background: #dcfce7; color: #15803d; }
.uc-contact-stale { background: #fef3c7; color: #92400e; }
.uc-contact-none { background: #fee2e2; color: #b91c1c; }

.uc-btn-ghost {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
  color: var(--muted);
  white-space: nowrap;
}
.uc-btn-ghost:hover { background: var(--bg); }

.uc-btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  font-size: 13px;
  font-weight: 600;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
}
.uc-btn-add:hover { background: var(--bg); border-color: var(--border-strong, #cdd4dc); }

.uc-btn-row-action {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.uc-btn-row-action:hover {
  border-color: #c3d2f7;
  background: #f8fafc;
  color: var(--accent);
}
.uc-btn-row-action.danger:hover {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--bad);
}

.uc-btn-danger {
  display: inline-flex;
  align-items: center;
  margin-right: auto;
  padding: 7px 12px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 600;
}
.uc-btn-danger:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.uc-btn-save {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 7px;
  cursor: pointer;
  color: #fff;
  white-space: nowrap;
}
.uc-btn-save:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.uc-meta-primary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--ink);
}

.uc-meta-sep {
  width: 1px;
  height: 13px;
  background: var(--line);
  display: inline-block;
}
/* Підказки на картці: що варто зробити з цією частиною */
.uc-suggest-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.uc-suggest {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
  border-radius: 10px;
  background: #fbfcfe;
}
.uc-suggest--high { border-left-color: var(--bad); }
.uc-suggest--warn { border-left-color: var(--warn); }
.uc-suggest--info { border-left-color: var(--accent); }

/* Кільце заповненості картки в шапці частини.
   Підпис у звичайному потоці (а не absolute) — інакше він вилазив за межі
   шапки і доводилось підпирати її зайвим нижнім відступом. */
.uc-fill-ring {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: default;
}
.uc-fill-circle {
  position: relative;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
}
.uc-fill-circle svg {
  position: absolute;
  inset: 0;
  width: 46px;
  height: 46px;
  transform: rotate(-90deg);   /* щоб заповнення починалось згори */
}
.uc-fill-ring circle {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
}
.uc-fill-track { stroke: var(--line); }
.uc-fill-value { transition: stroke-dashoffset .35s ease; }
.uc-fill-ring.is-low .uc-fill-value { stroke: var(--bad); }
.uc-fill-ring.is-mid .uc-fill-value { stroke: #d97706; }
.uc-fill-ring.is-full .uc-fill-value { stroke: var(--good); }
.uc-fill-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.uc-fill-num small { font-size: 9px; font-weight: 600; }
.uc-fill-caption {
  font-size: 9.5px;
  color: var(--muted);
  white-space: nowrap;
  line-height: 1;
}
.uc-suggest-text {
  margin: 0;
  flex: 1;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
}
/* Компактний «+», як швидкий запис у списку частин: текст дії («Створити
   задачу» тощо) переїхав у tooltip, щоб рядок підказки не роздувався. */
.uc-suggest-btn {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 17px;
  line-height: 1;
  color: var(--accent);
  cursor: pointer;
}
.uc-suggest-btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.uc-suggest-close {
  flex: none;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.uc-suggest-close:hover { background: #eef2f7; color: var(--ink); }
@media (max-width: 720px) {
  .uc-suggest { flex-direction: column; align-items: stretch; }
}

.uc-info-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 0;
}

.uc-link-pair {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.uc-link-pair + .uc-link-pair::before {
  content: "";
  display: inline-block;
  width: 2px;
  height: 16px;
  margin: 0 14px;
  background: var(--line);
}

/* KPI strip */
.uc-analytics-title {
  padding: 14px 14px 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

/* Шапка аналітики: заголовок + перемикач типу періоду і підпис періоду */
.uc-analytics-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.uc-analytics-head .uc-analytics-title { padding-bottom: 0; }

.uc-analytics-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 0;
}

.metric-kind-switch {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--bg);
}

.metric-kind-btn {
  padding: 5px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.metric-kind-btn.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, .12);
}

.uc-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 10px 14px 12px;
}

.uc-kpi-card {
  min-height: 78px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.02);
}

.uc-kpi-val { font-size: 22px; font-weight: 750; line-height: 1.05; color: var(--ink); margin: 8px 0 6px; }
.uc-kpi-label { font-size: 12px; color: var(--ink); margin: 0; font-weight: 500; }
.uc-kpi-delta { font-size: 11px; font-weight: 500; }
.uc-kpi-delta.up { color: var(--good); }
.uc-kpi-delta.down { color: var(--bad); }

/* Tabs */
.uc-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 10px;
  gap: 0;
  background: var(--panel);
}

.uc-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 11px 14px;
  border: none;
  background: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}
.uc-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.uc-tab:hover:not(.active) { color: var(--ink); }
.uc-tab-ico { display: inline-flex; align-items: center; }
.uc-tab-ico svg { display: block; opacity: .85; }

/* Tab panes */
.uc-tab-pane { display: none; padding: 14px 18px; }
.uc-tab-pane.active { display: block; }

/* Section blocks */
.uc-section {
  margin-bottom: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.uc-section:first-child {
  padding-top: 0;
  border-top: 0;
}
.uc-section-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
}
.uc-section-title .uc-btn-edit, .uc-section-title .uc-btn-add {
  margin-left: auto;
}
.uc-section-title svg { color: var(--muted); display: block; }

/* Profile info grid */
.uc-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.uc-info-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}
.uc-info-label { font-size: 12px; font-weight: 600; color: var(--muted); }
.uc-info-val { font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.35; }

.uc-info-row--add {
  border-style: dashed;
  background: transparent;
  cursor: pointer;
  text-align: left;
  align-items: flex-start;
}
.uc-info-row--add:hover { border-color: var(--accent); }
.uc-info-add { font-size: 13px; color: var(--muted); font-weight: 600; }
.uc-info-row--add:hover .uc-info-add { color: var(--accent); }

/* Comment section */
.uc-comment-section {
  padding-top: 16px;
}
.uc-comment-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  white-space: pre-wrap;
  cursor: pointer;
}
.uc-comment-body:hover {
  color: var(--accent);
}

.uc-comment-form {
  display: grid;
  gap: 8px;
}

.uc-comment-form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
}

.uc-inline-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.uc-add-field {
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.uc-add-field:hover { border-color: var(--accent); color: var(--accent); }

/* Contacts */
.uc-contacts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.uc-contacts-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.uc-contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color .12s, background .12s;
}
.uc-contact-row:hover {
  border-color: #c3d2f7;
  background: #fbfcff;
}
.uc-contact-row strong { display: block; font-size: 14px; }
.uc-contact-row small { font-size: 12px; color: var(--muted); }
.uc-contact-info { min-width: 0; }
.uc-contact-last { font-size: 12px; color: var(--muted); margin-top: 3px; }
.uc-contact-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
}

.uc-contact-details {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

/* Звʼязки між розділами */
.comm-contact-link { color: var(--accent-dark); font-weight: 700; cursor: pointer; text-decoration: none; }
.comm-contact-link:hover { text-decoration: underline; }
.comm-next { font-size: 12px; color: var(--muted); margin: 4px 0 0; }

.task-source {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: 2px 7px;
  border-radius: 10px;
}

/* ── КОНТАКТИ (фінальний вигляд) ──────────────────────────────────── */
.uc-contact-row { align-items: center; }
.uc-contact-name-row { font-size: 14px; }
.contact-name-filter { color: var(--ink); font-weight: 700; cursor: pointer; text-decoration: none; }
.contact-name-filter:hover { color: var(--accent); text-decoration: underline; }
.uc-contact-role { color: var(--muted); font-weight: 400; }
.uc-contact-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }

@media (max-width: 720px) {
  .uc-contact-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .uc-contact-actions {
    align-self: flex-end;
  }
}

/* ── КОМУНІКАЦІЯ: фільтр ──────────────────────────────────────────── */
.comm-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comm-filter-clear-all {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  padding: 2px 4px;
}
.comm-filter-clear-all:hover { color: var(--bad); }
.comm-filter-select {
  min-height: 32px;
  padding: 4px 28px 4px 10px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background-color: var(--panel);
}
.comm-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 12px;
  border-radius: 16px;
  background: #eef2ff;
  border: 1px solid #c3d2f7;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 600;
}
.comm-filter-pill button {
  border: none;
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 2px;
}
.comm-filter-pill button:hover { color: var(--bad); }

/* ── КОМУНІКАЦІЯ: запис ───────────────────────────────────────────── */
.comm-row1 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.comm-row-actions {
  display: grid;
  justify-items: end;
  gap: 6px;
  min-width: 0;
}
.comm-actions-top {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
}
/* Єдині дії в рядку: олівець = редагувати, кошик = видалити.
   Один вигляд у комунікаціях, контактах і задачах — раніше в кожному
   місці була своя кнопка (десь іконка, десь меню «···», десь текст). */
.uc-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.uc-row-btn:hover { border-color: var(--line); color: var(--accent); background: #f8fafc; }
.uc-row-btn--danger:hover { border-color: var(--line); color: var(--bad); background: #fef2f2; }
.uc-row-btn svg { display: block; }

.comm-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #eef1f4;
  color: var(--muted);
  flex-shrink: 0;
}
.comm-icon svg { display: block; }
.comm-icon--call, .comm-icon--msg, .comm-icon--video, .comm-icon--meet, .comm-icon--other { background: #eef1f4; color: var(--muted); }

.task-result {
  margin-top: 7px;
  padding: 8px 10px;
  background: #f4f8fc;
  border-left: 2px solid #7dd3fc;
  border-radius: 0 6px 6px 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
}
.task-result--comment {
  background: #f4f8fc;
  border-left-color: #7dd3fc;
}
.task-result-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #0369a1;
  margin-bottom: 3px;
}
.task-doc-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}
.task-doc-link:hover { text-decoration: underline; }
.task-done-meta {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* Метрики результату взаємодії */
.task-complete-metrics {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #f6f8fa;
  border-radius: 10px;
}
.task-metrics-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted);
}
.task-complete-metrics.is-saved {
  box-shadow: 0 0 0 2px rgba(15, 128, 118, 0.18) inset;
}

.task-metric-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.task-metric-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  background: #eef2ff;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 600;
}

.uc-metrics-section { margin-top: 4px; }
.task-metrics-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}
.metric-stat {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  text-align: center;
}
.metric-stat-val { font-size: 22px; font-weight: 800; color: var(--ink); }
.metric-stat-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.task-field-readonly input[readonly] {
  background: #f6f8fa;
  color: var(--ink);
  font-weight: 600;
}
.task-show-more {
  width: 100%;
  margin-top: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--accent-dark);
  padding: 9px 12px;
  font-weight: 600;
  cursor: pointer;
}
.task-show-more:hover {
  border-color: var(--accent);
  background: #f7fbfa;
}
.comm-main { min-width: 0; }
.comm-date { font-size: 12px; color: var(--muted); }
.comm-identity { font-size: 14px; font-weight: 600; margin-top: 0; }
.comm-result {
  margin: 3px 0 0;
  padding-top: 0;
  border-top: 0;
  font-size: 13px;
  line-height: 1.4;
  color: var(--ink);
  white-space: pre-wrap;
}

.comm-next-line {
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
}
.timeline-item a.comm-next-link { color: #2563eb; cursor: pointer; text-decoration: none; font-weight: 700; }
.timeline-item a.comm-next-link:hover { text-decoration: underline; }
.comm-next-text { color: var(--ink); }

.comm-show-more {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent);
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.comm-show-more:hover { background: #f8fafc; }
.comm-show-more span { margin-left: 5px; }

.uc-tab-count {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}
.comm-extra { font-size: 13px; }
.comm-extra summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 2px 0; }
.comm-extra label { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; color: var(--muted); }

.comm-section {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.comm-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 700;
}

.comm-section summary::-webkit-details-marker { display: none; }
.comm-section summary::after {
  content: "›";
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transform: rotate(90deg);
  transition: transform .16s ease;
}
.comm-section[open] summary::after { transform: rotate(-90deg); }
.comm-section-body {
  display: grid;
  gap: 10px;
  padding-top: 10px;
}
.comm-result-checks {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f7f9fe;
}

.comm-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 60;
  width: 400px;
  max-width: calc(100vw - 24px);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 44px rgba(15, 23, 42, .14);
}

.comm-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--line);
}

.comm-drawer-head h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

.comm-drawer-close {
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.comm-drawer-close:hover {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--ink);
}

.comm-drawer-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 16px 18px;
  overflow: auto;
}

.comm-drawer-form label, .comm-extra label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.comm-drawer-form input, .comm-drawer-form select, .comm-drawer-form textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
}

.comm-drawer-form textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

.comm-drawer-form .comm-result-input {
  min-height: 58px;
  max-height: 180px;
  resize: none;
  overflow-y: hidden;
}

.comm-drawer-form input[readonly] {
  background: #f8fafc;
  color: var(--muted);
}

.comm-next-panel {
  padding: 12px 12px 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: rgba(15, 128, 118, 0.055);
  display: grid;
  gap: 10px;
}

.comm-result-tags {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  margin-top: 5px;
}
.comm-row-actions .comm-result-tags {
  justify-content: flex-end;
  margin-top: 0;
}
.comm-result-tags span {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
/* Єдина семантика зі звітністю: цінність зелена, практика синя, ідея бурштин */
.comm-result-tags .is-value, .task-metric-chip.is-value { background: var(--good-bg); color: var(--good); }
.comm-result-tags .is-practice, .task-metric-chip.is-practice { background: #e6f1fb; color: #185fa5; }
.comm-result-tags .is-improvement, .task-metric-chip.is-improvement { background: #fff4df; color: #a35a00; }
.comm-document-link {
  display: inline-block;
  margin-top: 5px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
.comm-document-link:hover { text-decoration: underline; }
.comm-document-link--inline, .comm-document-text--inline {
  max-width: 180px;
  margin-top: 0;
  margin-right: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comm-document-text {
  display: inline-block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.task-report-doc-note {
  display: inline-block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 600;
}

.task-doc-text {
  display: inline-block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.comm-next-panel label {
  margin: 0;
}

.comm-form-hint {
  margin: -7px 0 0;
  font-size: 12px;
  color: #92400e;
}

.comm-drawer-form .checkbox-line {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 500;
}

.comm-drawer-form .checkbox-line input {
  width: auto;
  min-height: 0;
}

.comm-drawer-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px 16px;
  border-top: 1px solid var(--line);
}
.uc-drawer-spacer { flex: 1; }
.uc-btn-danger {
  font-size: 13px;
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  background: #fff;
  color: var(--bad);
  cursor: pointer;
}
.uc-btn-danger:hover { background: #fef2f2; border-color: var(--bad); }

.comm-drawer-actions .uc-btn-save:disabled {
  opacity: .45;
  cursor: not-allowed;
  background: var(--accent);
}

.comm-unsaved {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 72px;
  padding: 12px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fffbeb;
  box-shadow: 0 14px 30px rgba(15, 23, 42, .12);
}

.comm-unsaved p {
  margin: 0 0 10px;
  font-size: 13px;
  color: #78350f;
}

.comm-unsaved div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (max-width: 680px) {
  .comm-drawer {
    width: calc(100vw - 16px);
  }
  .timeline-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .comm-row-actions {
    grid-column: 2;
    justify-items: start;
    margin-top: 6px;
  }
  .comm-actions-top {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
  }
  .comm-row-actions .comm-result-tags {
    justify-content: flex-start;
    max-width: none;
  }
  .comm-document-link--inline, .comm-document-text--inline {
    max-width: min(210px, 55vw);
  }
}

/* Comm / Tasks heads */
.uc-comm-head, .uc-tasks-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.uc-tasks-head {
  margin: 0 0 14px;
}

.task-add-main {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 12px;
  box-shadow: none;
}

/* Analytics */
.uc-chart-card {
  margin: 8px 14px 12px;
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.uc-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.uc-chart-label {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 0;
  color: var(--ink);
}

/* ── SEARCH (units) ───────────────────────────────────────────────── */
/* Один рядок керування списком: пошук + сортування + фільтри.
   Панель вузька (300–370px), тож пошук тягнеться, сортування компактне,
   а «Фільтри» — іконка з лічильником: текст туди просто не влазив. */
.search-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  align-items: center;
}
/* Одна висота на всі три контроли. Раніше пошук і кнопка були 40px, а
   сортування — 36px, і рядок виглядав нерівним. */
.search-row .search-main input,
.search-row .sort-group,
.search-row .search-adv-btn { height: 38px; min-height: 38px; }
.search-row .sort-group-select { height: 36px; min-height: 36px; }
.search-row .sort-group-dir { height: 36px; }
.search-row .search-main { flex: 1 1 auto; min-width: 96px; }
.search-row .sort-group { flex: 0 0 auto; }
.search-row .sort-group-select {
  min-width: 0;
  width: 118px;
  font-size: 12.5px;
  padding-right: 26px;
}

.search-main {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}
/* Лупа — SVG, а не гліф «⌕»: гліф різниться між шрифтами й сидів криво
   відносно тексту поля. */
.search-main .search-ico {
  position: absolute;
  left: 11px;
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}
.search-main .search-ico svg { display: block; width: 15px; height: 15px; }
.search-main input {
  width: 100%;
  padding-left: 34px;
  padding-right: 32px;
  /* Один в один із сусіднім сортуванням (.sort-group-select): у рядку з
     трьох контролів різний кегль одразу впадав в око. */
  font-size: 12.5px;
  font-weight: 600;
}
.search-main input::placeholder { font-weight: 600; color: var(--muted); }
.search-clear {
  position: absolute;
  right: 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  padding: 4px;
  line-height: 1;
}
.search-clear:hover { color: var(--ink); }

.search-adv-btn {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 40px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.search-adv-btn svg { display: block; }
.search-adv-btn:hover { background: var(--bg); }
.search-adv-btn[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--accent);
}
.adv-count {
  position: absolute;
  top: -6px;
  right: -6px;
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  border: 2px solid var(--panel);
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.advanced-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
}
.adv-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}
.adv-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
}
/* Поля фільтрів — м'якші за загальні: менші, з округленням як у чипів,
   на легкому тлі. Раніше вони виглядали як великі квадратні інпути форми. */
#advancedPanel input, #advancedPanel select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding-top: 0;
  padding-bottom: 0;
  border-radius: 9px;
  border-color: var(--line);
  background-color: var(--bg);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
#advancedPanel select { background-color: var(--bg); }
#advancedPanel input:focus, #advancedPanel select:focus {
  background-color: #fff;
  border-color: var(--accent);
}
.adv-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}
.advanced-cohorts {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.advanced-cohorts-label {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.active-filters:empty { display: none; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 10px;
  border-radius: 14px;
  background: #eef2ff;
  border: 1px solid #c3d2f7;
  color: var(--accent-dark);
  font-size: 12px;
}
.filter-chip button {
  border: none;
  background: transparent;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
}
.filter-chip button:hover { color: var(--bad); }

/* «Додати частину» переїхала в шапку сторінки, справа — вона стосується
   розділу, а не рядка пошуку, і звільнила місце для сортування. */
/* Компактніша за типову btn-primary: у шапці поруч із заголовком велика
   кнопка виглядала важкою. */
.page-head-action {
  flex: 0 0 auto;
  align-self: center;
  white-space: nowrap;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
}

.cohort-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
}
.cohort-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
}
.cohort-chip:hover { border-color: var(--accent); }
.cohort-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cohort-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cohort-dot--danger { background: #ef4444; }
.cohort-dot--warn { background: #f59e0b; }
.cohort-dot--neutral { background: #94a3b8; }
.cohort-chip.active .cohort-dot { background: #fff; }

/* Єдиний контрол сортування: підпис + критерій + напрям в одній рамці */
.sort-group {
  display: inline-flex;
  align-items: center;
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.sort-group:hover { border-color: var(--border-strong, #cdd4dc); }
.sort-group:focus-within { border-color: var(--accent); }
.sort-group-select {
  border: none !important;
  min-height: 34px;
  height: 34px;
  border-radius: 0;
  background-color: transparent;
  padding: 0 26px 0 13px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.sort-group-select:focus { box-shadow: none; }
.sort-group-dir {
  display: grid;
  place-items: center;
  width: 34px;
  height: 36px;
  padding: 0;
  border: none;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--muted);
  font-size: 15px;
  cursor: pointer;
}
.sort-group-dir:hover { background: var(--accent-soft); color: var(--accent-dark); }

/* ── HOME SUMMARY BAR ─────────────────────────────────────────────── */
#home .page-head h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
}
#home .page-head p {
  font-size: 13px;
  margin-top: 5px;
}
#home .panel-head h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -.01em;
}

.home-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 14px;
  padding: 10px 0 16px;
}

.home-stat-card {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 16px;
  min-height: 86px;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  font: inherit;
  cursor: pointer;
  transition: border-color .12s, background .12s, transform .12s;
}
.home-stat-card:hover {
  border-color: var(--line-strong);
  background: #fcfdfe;
  transform: translateY(-1px);
}
.home-stat-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  flex: 0 0 auto;
}
.home-stat-icon svg {
  width: 22px;
  height: 22px;
}
.home-stat-card--warn .home-stat-icon { background: var(--warn-bg); color: #ea580c; }
.home-stat-card--danger .home-stat-icon { background: var(--bad-bg); color: #dc2626; }
.home-stat-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}
.home-stat-value {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.05;
  margin: 5px 0 4px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.home-stat-sub {
  font-size: 12px;
  color: var(--muted);
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, .9fr);
  gap: 14px;
  align-items: start;
}

.home-side-column {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.home-attention-panel, .home-tasks-panel, .home-activity-panel {
  border-radius: var(--radius-lg);
  padding: 20px;
}

.home-link-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.home-link-btn:hover { color: var(--accent); }

/* ── ACTION LIST (home) ───────────────────────────────────────────── */
.action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 13px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: background .12s, box-shadow .12s, border-color .12s;
}
.action-row:hover {
  background: #f8fafc;
  border-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.action-body { flex: 1; min-width: 0; }
.action-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.action-title span { color: var(--muted); font-weight: 600; }
/* Теги-пігулки причини — окремим рядком під назвою */
.action-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.attn-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.attn-tag--det { background: var(--bad-bg); color: var(--bad-text); }
.attn-tag--contact { background: var(--warn-bg); color: var(--warn-text); }
.attn-tag--train { background: var(--level-train-bg); color: var(--level-train-text); }
/* Заглушення спаду в картці частини */
.uc-mute-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
}
.uc-mute-check input { width: 16px; height: 16px; min-height: 0; flex-shrink: 0; }
.uc-mute-reason { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; max-width: 480px; }
.uc-mute-reason.is-hidden { display: none; }
.uc-mute-hint { font-size: 12px; color: var(--muted); }

.attn-muted { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.attn-muted-toggle {
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 2px;
}
.attn-muted-toggle:hover { color: var(--ink); }
.attn-muted-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.attn-muted-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.attn-muted-row strong { font-size: 14px; font-weight: 600; display: block; }
.attn-muted-row small { font-size: 12px; color: var(--muted); }
.attn-unmute {
  flex-shrink: 0;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  color: var(--accent);
  border-radius: 8px;
  padding: 5px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.attn-unmute:hover { background: var(--accent-soft); }
.attention-filter--all.active { color: var(--accent-dark); background: var(--accent-soft); }
.attention-filter--all.active span { background: #d4e2fd; color: var(--accent-dark); }
/* Навчання — фіолетовий (щоб не збігався з бурштиновим «контактом») */
.attention-filter--training.active { color: var(--level-train-text); background: var(--level-train-bg); }
.attention-filter--training.active span { background: #fcd9bd; color: var(--level-train-text); }
.home-stat-card--training .home-stat-icon { background: var(--level-train-bg); color: var(--level-train-text); }
.attention-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 14px;
}
.attention-filter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  cursor: pointer;
  transition: background .12s;
}
.attention-filter:not(.active):hover { background: #f8fafc; }
.attention-filter span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 19px;
  padding: 0 6px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--neutral-bg);
  color: var(--neutral-text);
}
.attention-filter--critical.active {
  color: var(--bad-text);
  background: var(--bad-bg);
}
.attention-filter--critical.active span { background: #fcdcdc; color: var(--bad-text); }
.attention-filter--attention.active {
  color: var(--warn-text);
  background: var(--warn-bg);
}
.attention-filter--attention.active span { background: #fcd9b0; color: var(--warn-text); }
.attention-filter--info.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}
.attention-filter--info.active span { background: #d4e2fd; color: var(--accent-dark); }
.action-contact {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  color: #94a3b8;
  font-size: 12px;
}
.action-contact svg {
  width: 13px;
  height: 13px;
}
/* Відповідальний у рядку — тільки для тімліда */
.action-owner {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-weight: 600;
}
.action-more {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}
.action-more summary {
  display: inline-flex;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
}
.action-more[open] summary {
  color: var(--accent-dark);
}
.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: center;
}
.action-quick {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.action-quick:hover { background: var(--accent-soft); border-color: #c7d9fe; }
.action-show-more {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 6px 2px 0;
  margin-top: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.action-show-more:hover {
  text-decoration: underline;
}

.action-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--muted);
  font-size: 14px;
  display: grid;
  gap: 4px;
}
.action-empty strong { color: var(--ink); }

.home-task-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.home-task-stats div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.home-task-stats div:first-child { border-color: #dbeafe; }
.home-task-stats .is-danger { border-color: #fee2e2; }
.home-task-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.home-task-stats strong {
  display: block;
  color: var(--ink);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.home-task-stats .is-danger strong { color: var(--bad); }

.home-task-list {
  border-top: 1px solid var(--line);
}
.home-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.home-task-row:hover .home-task-main strong { color: var(--accent); }
.home-task-main {
  min-width: 0;
}
.home-task-main strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.home-task-main small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.home-task-badge {
  padding: 4px 8px;
  border-radius: 8px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.home-task-badge--bad {
  background: #fee2e2;
  color: #b91c1c;
}
.home-task-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.home-task-priority {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.home-task-priority--high {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}
.home-task-priority--low {
  background: #f1f5f9;
  color: #64748b;
}
.home-task-empty {
  padding: 24px 4px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.home-activity-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 16px;
  gap: 12px;
  align-items: center;
  padding: 12px 2px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.home-activity-row:last-child { border-bottom: none; }
.home-activity-row:hover .home-activity-main strong { color: var(--accent); }
.home-activity-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}
.home-activity-icon svg { width: 17px; height: 17px; }
.home-activity-icon--task_done {
  background: #ecfdf5;
  color: #059669;
}
.home-activity-main { min-width: 0; }
.home-activity-time {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 2px;
  min-height: 14px;
}
.home-activity-main strong {
  display: block;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-activity-main small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  min-height: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-activity-arrow {
  color: #cbd5e1;
  font-size: 16px;
  text-align: right;
}
.home-activity-toggle {
  display: block;
  width: 100%;
  padding: 11px 4px 2px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.home-activity-toggle:hover {
  background: #f8fafc;
}

/* ── Єдиний контрол «Показати ще / Згорнути» на всіх сторінках ─────────
   Один вигляд: дискретна центрована кнопка акцентним текстом. */
.action-show-more, .home-activity-toggle, .comm-show-more, .task-show-more, .task-report-show-more, .team-interaction-more {
  display: block;
  width: fit-content;
  margin: 12px auto 0;
  padding: 8px 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  transition: background .12s;
}
.action-show-more:hover, .home-activity-toggle:hover, .comm-show-more:hover, .task-show-more:hover, .task-report-show-more:hover, .team-interaction-more:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

@media (max-width: 760px) {
  .home-summary-bar, .home-grid, .home-task-stats {
    grid-template-columns: 1fr;
  }

  .home-activity-panel {
    grid-column: auto;
  }

  .action-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .action-buttons {
    grid-column: 2;
    justify-content: flex-start;
    margin-top: 2px;
  }
}

/* ── MODAL ────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal-overlay.is-hidden { display: none; }

.modal-box {
  background: var(--panel);
  border-radius: 12px;
  width: 520px;
  max-width: 94vw;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.modal-head h2 { margin: 0; font-size: 18px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.form-grid label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 4px; }
.form-grid label.span-2 { grid-column: 1 / -1; }
.form-grid input, .form-grid select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
  outline: none;
}
.form-grid input:focus, .form-grid select:focus {
  border-color: var(--accent);
  background: #fff;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
/* Обидві кнопки внизу вікна — однакового розміру й накреслення: базові
   класи (.btn-primary / .uc-btn-ghost) мали різні висоту, радіус і кегль,
   і пара виглядала розбалансованою. */
.modal-actions button {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
}

@media (max-width: 1100px) {
  .uc-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .uc-tasks-head {
    align-items: stretch;
    flex-direction: column;
    margin: 12px 8px 14px;
  }

  .task-subnav {
    gap: 8px;
  }

  .task-status-tab {
    flex: 1 1 0;
    min-width: 0;
    padding: 11px 12px;
    font-size: 14px;
  }

  .task-add-main {
    width: 100%;
  }

  #tab-tasks .table-list {
    padding: 0 8px 14px;
  }

  .task-saved-card {
    padding: 14px;
  }

  .task-view {
    gap: 10px;
  }

  .task-view strong {
    font-size: 16px;
  }

  .uc-kpi-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px 8px;
  }

  .uc-kpi-card {
    min-height: auto;
    padding: 12px 14px;
  }

  .uc-kpi-val {
    margin: 7px 0 5px;
    font-size: 21px;
  }

  .uc-chart-card {
    margin: 8px;
    padding: 12px 10px 14px;
  }

  .chart-box--analytics {
    height: 220px;
    margin: 0;
  }
}

/* ── Вікно підтвердження (замість системного confirm) ────────────────────── */
.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, .45);
}
.confirm-box {
  width: min(440px, 100%);
  padding: 20px 22px 18px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .25);
}
.confirm-box h3 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--ink);
}
.confirm-message {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--muted);
}
.confirm-lines {
  margin: 12px 0 0;
  padding: 12px 14px;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  font-size: 13px;
  line-height: 1.7;
  color: var(--ink);
}
.confirm-lines li::before { content: "• "; color: var(--muted); }
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

/* ── Розподіл частин за статусами (Команда) ─────────────────────────── */
/* Два окремі блоки поруч — читається легше, ніж дві колонки в одній панелі */
.team-status-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.team-status-panel .panel-head { margin-bottom: 4px; }

/* «Стан бази» у Звітності: цифри тут не за період, тому блок трохи
   відокремлений від періодного звіту нижче — приглушений фон і підпис,
   щоб його не читали як показники за обрані дати. */
.report-state-row .team-status-panel { background: var(--bg); }
.report-state-note {
  margin: 2px 0 0;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
}
.tsb-body {
  display: flex;
  align-items: center;
  gap: 18px;
}

/* Пончик */
.tsb-donut {
  position: relative;
  flex: 0 0 auto;
  width: 120px;
  height: 120px;
  display: grid;
  place-items: center;
}
.tsb-donut svg {
  position: absolute;
  inset: 0;
  width: 120px;
  height: 120px;
  transform: rotate(-90deg);   /* починаємо згори */
}
.tsb-donut circle {
  fill: none;
  stroke-width: 14;
}
.tsb-track { stroke: var(--line); }
.tsb-arc { transition: stroke-dasharray .35s ease; }
.tsb-center { text-align: center; line-height: 1.15; }
.tsb-center strong { display: block; font-size: 20px; font-weight: 700; color: var(--ink); }
.tsb-center span { font-size: 10.5px; color: var(--muted); }

/* Сегменти пончика — ті самі кольори, що в чипах */
.tsb-arc.uc-status-active { stroke: #15803d; }
.tsb-arc.uc-status-neutral { stroke: #0369a1; }
.tsb-arc.uc-status-inactive { stroke: #64748b; }
.tsb-arc.uc-status-unset { stroke: #cbd5e1; }
.tsb-arc.uc-level-pro { stroke: var(--level-pro-text); }
.tsb-arc.uc-level-mid { stroke: var(--level-mid-text); }
.tsb-arc.uc-level-training { stroke: var(--level-train-text); }
.tsb-arc.uc-level-none { stroke: #cbd5e1; }

/* Легенда */
.tsb-legend {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.tsb-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}
.tsb-row:hover { background: var(--bg); }
.tsb-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--line-strong);
}
.tsb-dot.uc-status-active { background: #15803d; }
.tsb-dot.uc-status-neutral { background: #0369a1; }
.tsb-dot.uc-status-inactive { background: #64748b; }
.tsb-dot.uc-status-unset { background: #cbd5e1; border: 0; padding: 0; }
.tsb-dot.uc-level-pro { background: var(--level-pro-text); }
.tsb-dot.uc-level-mid { background: var(--level-mid-text); }
.tsb-dot.uc-level-training { background: var(--level-train-text); }
.tsb-dot.uc-level-none { background: #cbd5e1; border: 0; padding: 0; }
.tsb-label {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tsb-num {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

/* Прочерк, коли жодна з осей не проставлена */
.ti-none { color: var(--muted); font-size: 13px; }

/* ── ВЛАСНИЙ ПЕРЕЛІК ОПЦІЙ (xselect.js) ───────────────────────────── */
/* Сам <select> лишається нативним і стилізованим як досі — тут лише той
   перелік, який браузер малює по-своєму й не дає оформити. */
.xsel-menu {
  position: fixed;
  /* Над модалкою (z-index 9999): у вікні «Новий фахівець» список ролі
     інакше ховався б за оверлеєм і виглядав, ніби його немає. */
  z-index: 10000;
  max-height: min(320px, 60vh);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 38px rgba(15, 23, 42, .16);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.xsel-opt {
  display: block;
  width: 100%;
  padding: 8px 11px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.xsel-opt:hover, .xsel-opt:focus-visible { background: var(--bg); outline: none; }
.xsel-opt.is-on { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.xsel-opt[disabled] { color: var(--muted); cursor: default; background: transparent; }

/* ── РЕЖИМ ПЕРЕГЛЯДУ (роль «Глядач») ──────────────────────────────── */
/* Глядач бачить усе, але не змінює нічого. Заборона тримається на
   сервері (do_POST / do_DELETE), а тут ми прибираємо кнопки, щоб не
   пропонувати дію, яка все одно завершиться помилкою. Перелік — за
   класами дій, а не поштучно за id: нові кнопки успадковують ті самі
   класи й ховаються самі. */
body.is-viewer .uc-btn-add,
body.is-viewer .uc-btn-edit,
body.is-viewer .uc-btn-save,
body.is-viewer .uc-btn-danger,
body.is-viewer .uc-row-btn,
body.is-viewer .uc-btn-row-action,
body.is-viewer .uc-suggest-btn,
body.is-viewer .qa-bar,
body.is-viewer .action-quick,
body.is-viewer .unit-quick-add,
body.is-viewer .uc-suggest-close,
body.is-viewer .uc-info-row--add,
body.is-viewer .uc-add-field,
body.is-viewer .user-access-actions,
body.is-viewer .trash-row-actions,
body.is-viewer .import-panel,
body.is-viewer #addUserBtn,
body.is-viewer #addUnitBtn { display: none !important; }

/* Те, що лишається видимим як інформація, але не має клікатись глядачем:
   чипи статусів, тіло коментаря (клік по ньому відкривав редагування). */
body.is-viewer .uc-status-badge,
body.is-viewer .uc-level-badge,
body.is-viewer .uc-comment-body { pointer-events: none; }

/* Виняток: кнопка «Закрити» в діалозі незбережених змін теж має клас
   .uc-btn-save, але це не запис, а вихід. Без цього винятку глядач, який
   усе ж відкрив драйвер, лишався б із самою «Залишитись» — у пастці. */
body.is-viewer .comm-unsaved .uc-btn-save { display: inline-flex !important; }

/* Порожнє поле в режимі перегляду — приглушений прочерк замість «+ Додати». */
.uc-info-empty { color: var(--muted); }

/* ── ОСТАННІ ІМПОРТИ ──────────────────────────────────────────────── */
/* Компактні рядки з кольоровим типом ліворуч, а не однакові смуги:
   довідник / статистика / архів видно з першого погляду. */
.import-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
}
.import-item:last-child { border-bottom: 0; }

.import-item-main { min-width: 0; flex: 1; }
.import-item-main strong {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.import-item-main small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

.import-kind {
  flex: 0 0 auto;
  min-width: 78px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.import-kind--stats { background: #dbeafe; color: #1d4ed8; }
.import-kind--mapping { background: #d1fae5; color: #047857; }
.import-kind--legacy { background: var(--neutral-bg); color: var(--muted); }

.import-item .import-rollback-btn { flex: 0 0 auto; }
