/* ─────────────────────────────────────────────────────────────
   v2 — Minimal Judicial.

   Принципы:
   1. Палитра — нейтрально-серая шкала + один тёмный акцент-чёрный
      для CTA. Никаких градиентов, пастельных пилюль и неона.
   2. Глубина — только бордерами 1px, без shadow.
   3. Иерархия — типографикой, не цветом.
   4. Иконки — outline (line-style), монохром.
   5. Воздух — щедрый, плотность — низкая.
   6. Цвет — только для смысла (статус: ok / warn / error), не для декора.
   ───────────────────────────────────────────────────────────── */

:root {
  /* Neutrals (Tailwind neutral, чуть скорректированы для печатно-серьёзного вида) */
  --bg:        #ffffff;
  --bg-soft:   #fafaf9;
  --surface:   #ffffff;
  --line:      #e7e5e4;
  --line-strong: #d6d3d1;

  --text:        #0c0a09;   /* near-black */
  --text-2:      #44403c;
  --text-3:      #78716c;
  --text-mute:   #a8a29e;

  /* Acccent: один чёрный для primary CTA. Никаких bright blue. */
  --accent:        #0c0a09;
  --accent-text:   #ffffff;

  /* Status — приглушённые, не «mall sale red», а «document marker».
     Семантика:
       ok    = выполнено успешно           (зелёный, цвет результата)
       info  = в работе сейчас             (голубой, цвет процесса)
       warn  = предупреждение / captcha    (бледно-красный, мягкий сигнал)
       err   = ошибка / отказ              (тёмно-красный, жёсткий сигнал) */
  --ok:      #15803d;
  --ok-soft: #86bf9c;   /* «фактически исполнено» — светлее «присуждено» */
  --ok-bg:   #f0fdf4;
  --info:    #0a84ff;
  --info-bg: #eff6ff;
  --warn:    #f87171;
  --warn-bg: #fef2f2;
  --err:     #991b1b;
  --err-bg:  #fee2e2;

  /* Важность дела — светофор. Три тона разведены по кругу (~0°/50°/140°),
     чтобы уровни не сливались боковым зрением, как красный с оранжевым. */
  --prio-high:    #dc2626;  --prio-high-bg: #fef2f2;
  --prio-mid:     #eab308;  --prio-mid-bg:  #fefce8;
  --prio-low:     #22a04a;  --prio-low-bg:  #f0fdf4;

  --radius: 8px;
  --radius-sm: 6px;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text",
          "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11", "tnum";
}
body {
  min-height: 100vh;
  background: var(--bg);
  font-size: 13px;
  line-height: 1.5;
}

/* ─── Window chrome ─── */
/* Рамка с полями осталась от макета, где страница изображала окно macOS.
   В браузере это окно и есть, поэтому рамки нет — приложение занимает вкладку
   целиком. */
.window {
  min-height: 100vh;
  background: var(--bg);
}
.titlebar {
  height: 36px; padding: 0 12px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
  position: relative;
}
.traffic { display: flex; gap: 7px; }
.dot-tr {
  width: 11px; height: 11px; border-radius: 50%;
  box-shadow: 0 0 0 0.5px rgba(0,0,0,0.18) inset;
}
.dot-tr.close { background: #ff5f57; }
.dot-tr.min   { background: #febc2e; }
.dot-tr.max   { background: #28c840; }
.title {
  position: absolute; left: 0; right: 0; text-align: center;
  font-size: 12px; font-weight: 500; color: var(--text-3);
  pointer-events: none; letter-spacing: -0.005em;
}

/* ─── Layout ─── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 18px; font-weight: 600; font-size: 14px;
  letter-spacing: -0.01em;
}
.sidebar .brand .logo {
  width: 28px; height: 28px;
  display: grid; place-items: center;
}
.sidebar .brand .logo svg { width: 28px; height: 28px; display: block; stroke: var(--text); }
.sidebar .nav-group {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-mute); padding: 16px 12px 4px;
  font-weight: 500;
}
.sidebar .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font-size: 15px;
  text-decoration: none;     /* пункты меню — не текстовые ссылки в абзаце */
}
.sidebar .nav-item:hover { background: var(--bg); color: var(--text); }
.sidebar .nav-item .ico {
  width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.sidebar .nav-item .ico svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.sidebar .nav-item .badge {
  margin-left: auto;
  color: var(--text-3); font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.sidebar .nav-item.active {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  padding: 7px 9px;          /* на 1px меньше — рамку компенсируем, чтобы
                                активный пункт не был выше остальных */
  font-weight: 500;
}
.sidebar .nav-item.active .ico { color: var(--text); }
.sidebar .nav-item.active .badge { color: var(--text); }

/* ─── Content ─── */
.content { padding: 24px 32px 28px; overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.toolbar h1 {
  margin: 0; font-size: 22px; font-weight: 600;
  letter-spacing: -0.02em;
}
.toolbar .sub { color: var(--text-3); font-size: 12px; }
.toolbar .spacer { flex: 1; }

/* ─── Buttons ─── */
.btn {
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: 500 12px var(--font);
  letter-spacing: -0.005em;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: default;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;     /* для <a class="btn"> — без браузерного underline */
}
.btn:hover, .btn:focus, .btn:active { text-decoration: none; }

/* Текстовая ссылка-«breadcrumb» в шапке (например, «← Модули» на странице
   модуля): наследует цвет, без подчёркивания, hover чуть выделяет. */
.nav-back { color: inherit; text-decoration: none; }
.nav-back:hover { color: var(--text); }
.btn:hover { background: var(--bg-soft); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.btn.ghost {
  border-color: transparent;
  color: var(--text-2);
}
/* Текстовый деструктивный (например, «Отключить пользователя»,
   «Удалить группу») — красный контур + красный текст. На hover
   усиливаем фон. */
.btn.danger {
  color: var(--err, #c33);
  border-color: var(--err, #c33);
}
.btn.danger:hover {
  background: var(--err-bg, rgba(204, 51, 51, 0.08));
  color: var(--err, #c33);
}
.btn .ico { display: inline-flex; }

/* Корзина. Значок без подписи — приглушённый, пока на него не навели: в
   списке из сотни строк ряд красных иконок читается как ряд ошибок. Цвет
   опасности появляется на наведении, когда действие уже осмысленно. */
.btn-trash {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: none; cursor: pointer;
  color: var(--text-3);
}
.btn-trash svg { width: 15px; height: 15px; display: block; }
.btn-trash:hover, .btn-trash:focus-visible {
  color: var(--err, #c33);
  background: var(--err-bg, rgba(204, 51, 51, 0.08));
  border-color: var(--err-bg, rgba(204, 51, 51, 0.08));
}
.btn-trash[disabled] { opacity: .35; cursor: not-allowed; }
.btn-trash[disabled]:hover { color: var(--text-3); background: none; border-color: transparent; }

/* Удаление в карточке дела — правый нижний угол, отдельно от всего
   остального: рядом с кнопками сохранения по нему промахиваются. */
.card-danger {
  display: flex; justify-content: flex-end; align-items: center; gap: 10px;
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--line);
}
.card-danger .sub { color: var(--text-3); }
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.7; }

/* ─── Icon-only action button (для строк таблиц) ───
   Квадратный 30×30 с центрированной SVG-иконкой. Использовать на
   action-кнопках в строках таблиц: preview, скачать, заменить, удалить.
   Поддерживает .danger вариант (для деструктивных) и focus-visible
   обводку. */
.btn.icon {
  width: 30px; height: 30px;
  padding: 0;
  justify-content: center;
  border-color: var(--line);
  color: var(--text-2);
  background: var(--surface);
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.btn.icon svg { width: 16px; height: 16px; }
.btn.icon:hover {
  background: var(--bg-soft);
  color: var(--text);
  border-color: var(--line-strong);
}
.btn.icon:active { transform: translateY(0.5px); }
.btn.icon:disabled,
.btn.icon[disabled] {
  opacity: 0.4;
  pointer-events: none;
}
.btn.icon.danger { color: var(--err, #c33); }
.btn.icon.danger:hover {
  background: var(--err-bg, #fdecec);
  color: var(--err, #c33);
  border-color: var(--err, #c33);
}
.btn.icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Группа кнопок-действий в правой колонке таблицы — единый компактный ряд */
.btn-row {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.segmented {
  display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px;
  background: var(--bg-soft);
}
.segmented .seg {
  font: 500 12px var(--font);
  padding: 4px 10px; border-radius: 4px; color: var(--text-3);
  letter-spacing: -0.005em; border: 1px solid transparent;
}
.segmented .seg.active {
  background: var(--surface); border-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(0,0,0,.10); color: var(--text); font-weight: 600;
}

/* ─── Cards / panels ─── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  /* Без этого внутренние элементы с background (table.users thead,
     .workers-grid, .log-view, .form-section) выпирают за скруглённые
     углы карточки. На outer box-shadow (свечение лампы в dark-теме)
     overflow:hidden не влияет — он рендерится снаружи. */
  overflow: hidden;
}
.card .card-header {
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--line);
}
.card .card-header h2 {
  margin: 0; font-size: 13px; font-weight: 600;
  letter-spacing: -0.005em;
}
.card .card-header .h-sub {
  color: var(--text-3); font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.card .card-body { padding: 14px 16px; }

/* ─── KPI ─── */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin-bottom: 24px;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.kpi {
  padding: 16px 20px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.kpi:last-child { border-right: 0; }
.kpi .lbl {
  font-size: 11px; color: var(--text-3); letter-spacing: 0.01em;
  font-weight: 500;
}
.kpi .val {
  font-size: 26px; font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.kpi .delta {
  font-size: 11px; margin-top: 4px; color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.kpi .delta.ok   { color: var(--ok); }
.kpi .delta.warn { color: var(--warn); }
.kpi .delta.err  { color: var(--err); }

/* ─── Tables ─── */
table.users { width: 100%; border-collapse: collapse; }
table.users th, table.users td {
  text-align: left;
  padding: 11px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
table.users tbody tr:last-child td { border-bottom: 0; }
table.users thead th {
  font-size: 11px; font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  background: var(--bg-soft);
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-grid; place-items: center;
  font-weight: 500; font-size: 11px;
  background: var(--bg-soft); color: var(--text-2);
  border: 1px solid var(--line);
  letter-spacing: 0.01em;
  margin-right: 10px; vertical-align: middle;
}
/* Admin: filled-аватар — главный визуальный сигнал роли, не требует
   отдельного бейджа. */
.avatar.admin {
  background: var(--text);
  color: var(--accent-text);
  border-color: var(--text);
}
/* Ячейка имени пользователя — две строки: имя + (опционально) роль.
   Структура inline-flex column, выравнивается по середине аватара через
   vertical-align: middle. У обычных пользователей вторая строка не
   рендерится — высота ячеек различается на одну мелкую строку, что
   некритично в таблице с большим padding. */
.user-cell {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  line-height: 1.25;
}
.user-cell .user-name { font-weight: 500; color: var(--text); }
.user-cell .user-role {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 1px;
  letter-spacing: -0.005em;
}
.mono { font-family: var(--mono); font-size: 12px; color: var(--text-2); letter-spacing: -0.01em; }
.num  { font-variant-numeric: tabular-nums; }

/* Pill (outline, monochrome) */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 500;
  border: 1px solid var(--line-strong);
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-mute); }
.pill.ok   .dot { background: var(--ok);   }
.pill.info .dot { background: var(--info); }
.pill.warn .dot { background: var(--warn); }
.pill.err  .dot { background: var(--err);  }
.pill.off  { color: var(--text-mute); }

/* Switch — нейтральный чёрный/серый */
.switch {
  display: inline-block; width: 34px; height: 20px;
  background: var(--text);
  border-radius: 999px; position: relative;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 16px;
  width: 16px; height: 16px; border-radius: 50%;
  background: white;
}
.switch.off { background: var(--line-strong); }
.switch.off::after { left: 2px; }

/* ─── Worker tile (фигура «человек за ноутбуком» + метаданные) ───
   Идея: вся фигура нейтрально-серая (в духе v2-палитры), цветной
   только экран ноутбука + статус-точка в углу карточки. Это даёт
   мгновенно сканируемый статус без отступления от монохрома. */
.workers-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
}
.worker {
  background: var(--surface);
  padding: 14px 12px 12px;
  position: relative;
  min-height: 170px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
}
.worker .w-dot {
  position: absolute; top: 10px; right: 10px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-mute);
}
.worker.active  .w-dot {
  background: var(--info);  /* «в работе сейчас» = голубой */
  animation: pulse-ring 1.8s ease-in-out infinite;
}
.worker.idle    .w-dot { background: var(--warn); }
.worker.captcha .w-dot { background: var(--warn); }

.worker .w-figure {
  width: 64px; height: 64px;
  margin: 2px auto 8px;
}
.worker .w-figure svg { width: 100%; height: 100%; display: block; }

/* Фигура всегда монохромная. Статус читается только через точку в углу
   и движение прогресс-бара. Это держит панель в чистой v2-палитре —
   ни одной цветной заливки, кроме небольших статус-точек. */
.fig-skin   { fill: var(--text-2); }
.fig-laptop { fill: var(--text); }
.fig-screen { fill: var(--line-strong); }

/* Активный: только едва заметное покачивание головы — оживляет, но
   не привлекает внимание. */
.worker.active .fig-skin { animation: nod 2.2s ease-in-out infinite; transform-origin: 50px 30px; }

/* Off: вся фигура выцветает в светло-серый. */
.worker.off .fig-skin   { fill: var(--line-strong); }
.worker.off .fig-laptop { fill: var(--text-mute); }
.worker.off .fig-screen { fill: var(--line); }

.worker .w-name {
  font-size: 13px; font-weight: 500; letter-spacing: -0.005em;
  margin-bottom: 2px;
}
.worker.off .w-name { color: var(--text-mute); }
.worker .w-task {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.worker.off .w-task { color: var(--text-mute); }
.worker .w-bar {
  width: 100%;
  height: 2px; background: var(--line); border-radius: 2px;
  margin: 10px 0 8px; overflow: hidden;
}
.worker .w-bar > i {
  display: block; height: 100%;
  background: var(--text); width: 0;
  border-radius: 2px;
}
.worker.active .w-bar > i {
  width: 54%;
  background: var(--info);  /* прогресс-бар активного — голубой, в тон точке */
  animation: bar-march 1.6s linear infinite;
}
.worker .w-meta {
  width: 100%;
  font-size: 11px; color: var(--text-3);
  display: flex; justify-content: space-between;
  font-variant-numeric: tabular-nums;
  margin-top: auto;
}
.worker .w-meta b { color: var(--text); font-weight: 500; }

.worker.add {
  display: grid; place-items: center;
  color: var(--text-3); font-size: 12px;
  background: var(--bg-soft);
  text-align: center;
}
.worker.add .plus { font-size: 22px; line-height: 1; margin-bottom: 2px; color: var(--text-2); }

@keyframes pulse-ring {
  /* голубой ring под --info (#0a84ff = rgb(10,132,255)) */
  0%, 100% { box-shadow: 0 0 0 0 rgba(10,132,255,0.40); }
  50%      { box-shadow: 0 0 0 7px rgba(10,132,255,0);  }
}
@keyframes bar-march {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}
@keyframes nod   { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1px); } }

/* ─── Activity timeline (структура v1: dot + (subtitle / content)) ─── */
.timeline { padding: 6px 4px; }
.tl-item {
  display: flex;
  gap: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.tl-item:hover { background: var(--bg-soft); }
.tl-dot {
  width: 7px; height: 7px; border-radius: 50%;
  margin-top: 6px;
  flex: 0 0 7px;
  background: var(--text-mute);
}
.tl-dot.ok   { background: var(--ok); }
.tl-dot.info { background: var(--info); }
.tl-dot.warn { background: var(--warn); }
.tl-dot.err  { background: var(--err); }
.tl-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
  min-width: 0;
}
.tl-text .t {
  display: block;
  color: var(--text-3);
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: -0.01em;
  margin-bottom: 1px;
}
.tl-text b { color: var(--text); font-weight: 500; }

/* Lock panel */
.lock-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 40px 28px;
  text-align: center;
}
.lock-panel .lock-icon {
  width: 40px; height: 40px; margin: 0 auto 14px;
  display: grid; place-items: center;
}
.lock-panel .lock-icon svg { width: 28px; height: 28px; stroke: var(--text-2); fill: none; stroke-width: 1.4; }
.lock-panel h3 { margin: 0 0 4px; font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }
.lock-panel p  {
  margin: 4px auto 18px; color: var(--text-3); font-size: 13px;
  max-width: 460px; /* чтобы justify работал «по тексту», а не на всю ширину карточки */
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}
.lock-panel .pw { margin: 0 auto; display: flex; gap: 8px; max-width: 380px; }
.lock-panel input {
  flex: 1; padding: 8px 12px; font: 13px var(--font);
  border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text);
  font-family: var(--mono); letter-spacing: 0.05em;
}
.lock-panel input::placeholder { color: var(--text-mute); }
.lock-panel .pw-hint {
  margin: 14px auto 0; color: var(--text-mute); font-size: 11px;
  max-width: 460px;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}
.lock-panel code {
  background: var(--bg-soft); border: 1px solid var(--line);
  padding: 1px 5px; border-radius: 3px;
  font-family: var(--mono); font-size: 11px;
}

/* Two-col layout */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.grid-even { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Аналитика: фильтры + горизонтальные полосы (SVG) */
.filters {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin-bottom: 20px;
}
.filters label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em;
}
/* ─────────── Аналитика: графики ─────────── */
.plot { padding: 16px 18px; overflow-x: auto; }
.plot svg { display: block; width: 100%; height: auto; min-width: 520px; }
.legend {
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  padding: 0 18px 16px; font-size: 13px; color: var(--text-2);
}
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend .sw { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.note { padding: 0 18px 14px; font-size: 13px; color: var(--text-3); }
.note b { color: var(--text-2); }

/* Тултип графиков */
#chart-tip {
  position: fixed; z-index: 60; pointer-events: none; opacity: 0;
  transform: translateY(4px); transition: opacity .12s ease, transform .12s ease;
  background: var(--text); color: var(--bg); border-radius: 6px;
  padding: 8px 11px; font-size: 12.5px; line-height: 1.45;
  box-shadow: 0 6px 20px rgba(0,0,0,.18); max-width: 280px;
}
#chart-tip.on { opacity: 1; transform: translateY(0); }
#chart-tip .t { font-weight: 600; margin-bottom: 3px; }
#chart-tip .r { display: flex; justify-content: space-between; gap: 14px; opacity: .9; }
#chart-tip .r b { font-family: var(--mono); font-weight: 600; }

/* Интерактив: увеличение столбца, точки, сектора */
.col { cursor: pointer; }
.col rect.b { transform-box: fill-box; transform-origin: 50% 100%;
              transition: transform .16s ease, filter .16s ease; }
.col:hover rect.b, .col:focus-visible rect.b { transform: scaleX(1.15) scaleY(1.03); filter: brightness(1.08); }
.col:focus-visible { outline: none; }
.pt { transform-box: fill-box; transform-origin: 50% 50%; transition: transform .16s ease; cursor: pointer; }
.col:hover .pt, .col:focus-visible .pt { transform: scale(1.9); }
.arc { cursor: pointer; transition: stroke-width .18s ease, opacity .18s ease; }
.arc:hover, .arc:focus-visible { stroke-width: 40; outline: none; }
.donut:hover .arc:not(:hover) { opacity: .38; }
@media (prefers-reduced-motion: reduce) {
  .col rect.b, .pt, .arc, #chart-tip { transition: none; }
}

/* Кольцо + боковая панель */
.donut-wrap { display: flex; align-items: center; justify-content: center;
              gap: 26px; padding: 16px 18px; flex-wrap: wrap; }
.donut { max-width: 260px; min-width: 220px; flex: none; }
.donut-detail {
  flex: 1; min-width: 220px; max-width: 300px; min-height: 104px;
  display: flex; flex-direction: column; justify-content: center; gap: 4px;
  border-left: 1px solid var(--line); padding-left: 22px;
}
.donut-detail .d-t { display: flex; align-items: center; gap: 9px;
                     font-size: 14px; font-weight: 600; line-height: 1.35; }
.donut-detail .d-t i { width: 11px; height: 11px; border-radius: 2px; flex: none; }
.donut-detail .d-n { font-family: var(--mono); font-size: 26px; font-weight: 650; }
.donut-detail .d-s { font-size: 12.5px; color: var(--text-3); }
.donut-caption { text-align: center; font-size: 13px; color: var(--text-3); padding: 0 18px 12px; }
.donut-caption b { color: var(--text-2); font-weight: 600; }
@media (max-width: 620px) {
  .donut-detail { border-left: 0; border-top: 1px solid var(--line);
                  padding-left: 0; padding-top: 16px; max-width: none; }
}

/* Чипы-счётчики */
.chips { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 18px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px;
        font-size: 13px; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; }
.chip b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.chip .sw { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* Результат юристов: две колонки-полосы */
.res { padding: 4px 18px 14px; }
.res-row { display: grid; grid-template-columns: 150px 1fr 1fr; gap: 18px;
           align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.res-row:last-child { border-bottom: 0; }
.res-name { font-size: 14px; font-weight: 600; }
.rb-h { display: flex; align-items: baseline; gap: 8px; font-size: 12px; color: var(--text-3); margin-bottom: 5px; }
.rb-h b { margin-left: auto; font-family: var(--mono); font-size: 14px; color: var(--text); }
.rb { height: 16px; background: var(--bg-soft); border: 1px solid var(--line);
      border-radius: 3px; overflow: hidden; }
.rb i { display: block; height: 100%; border-radius: 3px; }
.rb-f { font-size: 11.5px; color: var(--text-mute); font-family: var(--mono); margin-top: 4px; }
@media (max-width: 680px) { .res-row { grid-template-columns: 1fr; gap: 10px; } }

/* Статистика в карточке дела */
table.users tr.row-total td { font-weight: 600; background: var(--bg-soft); }
.stat-note {
  padding: 11px 16px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-2);
}

/* Показатель с явной базой: одна полоса — один процент — одна база.
   Используется и в карточке дела, и на дашборде. */
.case-money { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.step { margin-bottom: 16px; }
.step:last-child { margin-bottom: 0; }
.step-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.step-t { font-size: 13px; color: var(--text-2); }
.step-pct {
  margin-left: auto; font-family: var(--mono); font-size: 18px;
  font-weight: 650; color: var(--ok); font-variant-numeric: tabular-nums;
}
.step-pct.alt { color: var(--info); }
.step-pct.err { color: var(--err); }
.bar {
  height: 24px; background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--radius-sm); overflow: hidden;
}
.bar i { display: block; height: 100%; background: var(--ok); }
.bar i.alt { background: var(--info); }
.bar i.err { background: var(--err); }
.step-f {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 6px; font-size: 12px; color: var(--text-3);
}
.step-f .base { color: var(--text-mute); }

/* Health rows */
.health-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.health-row:first-child { border-top: 0; }
.health-row .h-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok);
}
.health-row.warn .h-dot { background: var(--warn); }
.health-row.err  .h-dot { background: var(--err); }
.health-row .h-name { color: var(--text-2); flex: 1; }
.health-row .h-val  { color: var(--text); font-variant-numeric: tabular-nums; }


/* ─── Search input ─── */
.search {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  color: var(--text-3);
  font-size: 12px;
  min-width: 240px;
}
.search svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.search input {
  border: 0; background: transparent; outline: none;
  font: 12px var(--font); color: var(--text);
  flex: 1; min-width: 0;
}
.search input::placeholder { color: var(--text-mute); }


/* ─── Bar / line charts (inline SVG) ─── */
.chart {
  background: var(--surface);
  padding: 14px 18px 6px;
}
.chart .ch-svg {
  width: 100%; height: 180px; display: block;
}
.chart .ch-svg .grid    { stroke: var(--line); stroke-width: 1; }
.chart .ch-svg .axis    { stroke: var(--line-strong); stroke-width: 1; }
.chart .ch-svg .bar     { fill: var(--text); }
.chart .ch-svg .bar.warn{ fill: var(--warn); }
.chart .ch-svg .bar.ok  { fill: var(--ok); }
.chart .ch-svg .line    { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.chart .ch-svg .area    { fill: rgba(12,10,9,0.06); }
.chart .ch-svg text     { font: 10px var(--font); fill: var(--text-3); }
.chart .ch-svg .label-axis-y { text-anchor: end; }
.chart .ch-svg .label-axis-x { text-anchor: middle; }
.chart .ch-legend {
  font-size: 11px; color: var(--text-3);
  display: flex; gap: 16px; padding: 8px 0 6px;
}
.chart .ch-legend .leg { display: inline-flex; align-items: center; gap: 6px; }
.chart .ch-legend .leg .sw {
  width: 8px; height: 8px; border-radius: 2px; background: var(--text);
}
.chart .ch-legend .leg .sw.warn { background: var(--warn); }
.chart .ch-legend .leg .sw.ok   { background: var(--ok); }


/* ─── Log viewer ─── */
.log-toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.log-filter {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 11px; color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.log-filter.active { background: var(--text); color: var(--accent-text); border-color: var(--text); }
.log-filter .n { color: var(--text-mute); font-size: 10px; }
.log-filter.active .n { color: rgba(255,255,255,0.6); }
.log-view {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
}
.log-line {
  display: grid;
  grid-template-columns: 130px 60px 110px 1fr;
  gap: 12px;
  padding: 5px 16px;
  border-top: 1px solid transparent;
}
.log-line:hover { background: var(--bg-soft); }
.log-line .lg-t   { color: var(--text-mute); }
.log-line .lg-lvl { font-weight: 500; text-transform: uppercase; font-size: 10px; padding-top: 1px; }
.log-line .lg-lvl.info  { color: var(--text-3); }
.log-line .lg-lvl.warn  { color: var(--warn); }
.log-line .lg-lvl.err   { color: var(--err); }
.log-line .lg-src { color: var(--text-3); }
.log-line .lg-msg { color: var(--text-2); word-break: break-word; }
.log-line .lg-msg b { color: var(--text); font-weight: 500; }


/* ─── Forms (settings) ─── */
.form-section {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.form-section:last-child { border-bottom: 0; }
.form-section .sec-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin: 0 0 4px;
  letter-spacing: -0.005em;
}
.form-section .sec-desc {
  font-size: 12px; color: var(--text-3);
  margin: 0 0 12px;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  align-items: center;
}
.form-row:first-of-type { border-top: 0; }
.form-row .lbl {
  display: flex; flex-direction: column; gap: 2px;
}
.form-row .lbl .key { font-weight: 500; font-size: 13px; color: var(--text); }
.form-row .lbl .key code { font-family: var(--mono); font-size: 11px; color: var(--text-3); padding-left: 6px; }
.form-row .lbl .desc {
  color: var(--text-3); font-size: 11.5px; line-height: 1.4;
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}
.form-row .ctrl input,
.form-row .ctrl select {
  width: 100%; padding: 6px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font: 12.5px var(--font);
  font-family: var(--mono);
}
.form-row .ctrl input[type="time"] { font-family: var(--mono); }
.form-row .ctrl.right { display: flex; justify-content: flex-end; }


/* ─── Empty state ─── */
.empty {
  text-align: center; padding: 50px 20px;
  color: var(--text-3);
  font-size: 13px;
}
.empty .e-icon {
  width: 44px; height: 44px; margin: 0 auto 12px;
  display: grid; place-items: center;
  background: var(--bg-soft); border-radius: 50%;
}
.empty .e-icon svg { width: 22px; height: 22px; stroke: var(--text-3); fill: none; stroke-width: 1.4; }
.empty .e-title { color: var(--text); font-weight: 500; font-size: 14px; margin-bottom: 4px; }


/* ─── Kbd (горячие клавиши) ─── */
.kbd {
  display: inline-grid; place-items: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--mono); font-size: 10.5px; color: var(--text-2);
  background: var(--surface);
  vertical-align: 1px;
}


/* ─── Деньги (денежная типографика) ───
   Суммы как деньги: разряды узким пробелом, копейки/₽ приглушены,
   моноширинные tabular-nums, выравнивание вправо в колонках сумм. */
.money { font-family: var(--mono); font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em; white-space: nowrap; color: var(--text); }
.money .kop { color: var(--text-3); }
.money .rub { color: var(--text-3); }
/* Редактируемое денежное поле — ₽-суффикс внутри инпута. */
.money-in { position: relative; display: inline-block; }
.money-in input { text-align: right; padding-right: 26px;
  font-family: var(--mono); font-variant-numeric: tabular-nums; }
.money-in::after { content: "\20bd"; position: absolute; right: 9px; top: 50%;
  transform: translateY(-50%); color: var(--text-3); font-size: 12px; pointer-events: none; }


/* ─── Create-form (карточка создания: претензия и т.п.) ─── */
.form-grid { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
.create-form .fgroup { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.create-form .fgroup:last-of-type { border-bottom: 0; }
.create-form .fgroup-label { font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-mute); font-weight: 600; margin-bottom: 14px; }
.create-form .field { margin-bottom: 16px; }
.create-form .field:last-child { margin-bottom: 0; }
.create-form .field > label { display: block; font-size: 12.5px; font-weight: 500;
  color: var(--text-2); margin-bottom: 5px; }
.create-form .field .hint { font-size: 11.5px; color: var(--text-mute); margin-top: 5px; }
.create-form .row2 { display: grid; grid-template-columns: 1fr 180px; gap: 12px; }
.create-form input, .create-form select { width: 100%; padding: 9px 12px;
  font: 14px var(--font); color: var(--text); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.create-form input::placeholder { color: var(--text-mute); }
.create-form input:focus, .create-form select:focus { border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.create-form input.mono { font-family: var(--mono); font-size: 13px; }
.sel { position: relative; }
.sel select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer; }
.sel::after { content: ""; position: absolute; right: 13px; top: 50%; width: 8px; height: 8px;
  border-right: 1.6px solid var(--text-3); border-bottom: 1.6px solid var(--text-3);
  transform: translateY(-70%) rotate(45deg); pointer-events: none; }
/* Сегмент-переключатель на радиокнопках (без JS). */
.seg-radio { display: inline-flex; width: 100%; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px; gap: 3px; }
.seg-radio label { flex: 1; text-align: center; font: 500 12.5px var(--font);
  padding: 7px 10px; border-radius: 5px; color: var(--text-3);
  border: 1px solid transparent; cursor: pointer; }
.seg-radio input { position: absolute; opacity: 0; pointer-events: none; }
.seg-radio label:has(input:checked) { background: var(--surface);
  border-color: var(--line-strong); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.create-form .form-foot { padding: 16px 20px; background: var(--bg-soft);
  border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.create-form .form-foot .foot-spacer { flex: 1; }
.create-form .form-foot .foot-hint { font-size: 11.5px; color: var(--text-mute); }
/* Сводка справа. */
.rail { border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg-soft); padding: 18px; }
.rail h3 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-mute); font-weight: 600; }
.rail .kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0;
  border-top: 1px solid var(--line); font-size: 13px; }
.rail .kv:first-of-type { border-top: 0; }
.rail .kv .k { color: var(--text-3); }
.rail .kv .v { color: var(--text); font-weight: 500; text-align: right; }


/* ─── Инлайн-редактирование в карточках (договор, срок ответа) ─── */
.inline-in { padding: 5px 9px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font: 13px var(--font); outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease; }
.inline-in::placeholder { color: var(--text-mute); }
.inline-in:focus { border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.inline-in.mono { font-family: var(--mono); font-size: 12.5px; }

/* ─────────── Входящие из КАД ─────────── */
.inbox-loads { padding: 9px 18px; border: 1px solid var(--line); border-radius: var(--radius);
               margin-bottom: 14px; font-size: 12.5px; color: var(--text-3); }
.inbox-loads b { color: var(--text-2); font-weight: 500; }
.inbox-loads b.free { color: var(--ok); }

/* Галочка — одна и та же у группы и у находки */
.chk { width: 16px; height: 16px; border: 1.5px solid var(--line-strong); border-radius: 4px;
       flex: none; cursor: pointer; position: relative; background: transparent; padding: 0; }
.chk[aria-checked="true"], .chk[aria-checked="mixed"] {
  background: var(--accent); border-color: var(--accent); }
.chk[aria-checked="true"]::after { content: "✓"; color: var(--accent-text); font-size: 11px;
  position: absolute; left: 2.5px; top: -2px; }
.chk[aria-checked="mixed"]::after { content: ""; position: absolute; left: 3px; top: 6px;
  width: 8px; height: 2px; background: var(--accent-text); border-radius: 1px; }

.inbox-group .group-head { display: flex; align-items: center; gap: 11px; flex-wrap: wrap;
              padding: 12px 18px; border-top: 1px solid var(--line); background: var(--bg-soft); }
.inbox-group:first-child .group-head { border-top: 0; }
.inbox-group .group-head .name { font-weight: 600; font-size: 14px; }
.inbox-group .group-head .inn { font-size: 12px; color: var(--text-mute); }

.find { border-top: 1px solid var(--line); padding: 12px 18px; display: flex; gap: 11px; }
.find.sel { background: var(--bg-soft); }
.find.focus { box-shadow: inset 2px 0 0 var(--text-3); }
.find .chk { margin-top: 3px; }
.find .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.find .row1 { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.find .num { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.find a.num { color: var(--text); text-decoration: underline;
              text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.find .role { font-size: 12.5px; color: var(--text-3); }
.find .role.unk { color: var(--warn); }
.find .when { font-size: 12.5px; color: var(--text-mute); }
.find .parties { font-size: 13.5px; color: var(--text-2); }
.find .parties .arrow { color: var(--text-mute); margin: 0 5px; }
.find .facts { font-size: 12.5px; color: var(--text-3); }
.find .actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 3px; }

/* Подсказка — справка под выбором юриста: рамка есть, заливки нет */
.tip { margin-top: 5px; border: 1px solid var(--line); border-radius: var(--radius-sm);
       padding: 7px 11px; font-size: 12.5px; color: var(--text-3); }
.tip b { color: var(--text-2); font-weight: 600; }

.bulkbar { display: none; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 18px;
           border: 1px solid var(--line); border-radius: var(--radius);
           background: var(--bg-soft); font-size: 13px; margin-bottom: 14px;
           position: sticky; top: 0; z-index: 5; }
.bulkbar.on { display: flex; }

.done { border-top: 1px solid var(--line); padding: 10px 18px; display: flex;
        align-items: center; gap: 9px; flex-wrap: wrap; font-size: 13px; color: var(--text-3); }
.done .num { font-family: var(--mono); font-size: 13px; color: var(--text-2); }
.done b { color: var(--text-2); font-weight: 600; }
.done .warn { color: var(--warn); }

.inbox-empty { padding: 30px 18px; text-align: center; color: var(--text-3); font-size: 13.5px; }

/* ── Формы входа: узкая карточка по центру, без навигации ── */
body.bare { display:flex; align-items:center; justify-content:center;
            min-height:100vh; margin:0; }
.login-box { width:320px; padding:28px; border:1px solid var(--line);
             border-radius:12px; background:var(--bg-soft); }
.login-box h1 { margin:0 0 4px; font-size:20px; }
.login-sub { margin:0 0 18px; font-size:13px; color:var(--text-3); }
.login-msg { margin-bottom:14px; padding:8px 10px; border-radius:8px;
             background:var(--bg); font-size:13px; line-height:1.4; }
.login-box input { width:100%; margin-bottom:12px; padding:9px 11px;
                   border:1px solid var(--line); border-radius:8px;
                   font-size:15px; box-sizing:border-box; }
.login-box button { width:100%; }
.btn.link { background:none; border:none; color:var(--text-3);
            font-size:12px; margin-top:10px; cursor:pointer; }
.nav-user { padding:2px 12px 8px; font-size:12px; color:var(--text-3); }

/* ─── Подпись и поле ─── */
/* Разметка «<label>Текст<input></label>» без правила лепит поле вплотную к
   подписи. Флажки и переключатели, наоборот, стоят ПЕРЕД текстом и должны
   остаться в строке — их исключаем. */
label > input:not([type="checkbox"]):not([type="radio"]),
label > select,
label > textarea {
  display: block;
  margin-top: 7px;
  width: 100%;
}

/* Подпись над полем — это заголовок поля, а не абзац текста: приглушаем,
   чтобы взгляд шёл по полям, а не по надписям. Флажки не трогаем: там
   подпись и есть содержание строки. */
label:has(> input:not([type="checkbox"]):not([type="radio"])),
label:has(> select),
label:has(> textarea) {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
}

/* Кнопка отправки в форме-сетке растягивалась на всю колонку и читалась как
   полоса. Прижимаем к содержимому. */
form button[type="submit"].btn { justify-self: start; }

/* ─── Переносы в таблицах ─── */
/* Номер дела и статус переносились по слогам, хотя место на странице было:
   ширину съедали соседние колонки с длинными названиями организаций.
   Короткие и опознаваемые значения не переносим, длинные — пусть переносятся. */
table.users td.nowrap,
table.users th.nowrap { white-space: nowrap; }

/* ─── Ссылки на дела ─── */
/* Номер дела — не текстовая ссылка в абзаце: подчёркивание в столбце из
   сотни строк превращает таблицу в частокол. Различимость даёт моноширинный
   шрифт и цвет при наведении. */
table.users a.mono,
table.users a.num { text-decoration: none; }
table.users a.mono:hover,
table.users a.num:hover { color: var(--text); text-decoration: none; }

/* ─── Ширины колонок в списке дел ─── */
/* Без подсказок браузер делит ширину по самому длинному содержимому колонки,
   и колонка контрагента забирала место у названий юрлиц: те переносились на
   три строки при пустом правом крае. Номер, статус и корзина занимают
   столько, сколько нужно тексту (nowrap), остальное делят пополам. */
table.tbl-cases td:nth-child(2), table.tbl-cases th:nth-child(2) { width: 44%; }
table.tbl-cases td:nth-child(3), table.tbl-cases th:nth-child(3) { width: 30%; }

/* ═══════════════════════ Календарь ═══════════════════════ */

/* ── Переключатель вида ── */
.cal-tabs { display: flex; gap: 8px; margin-bottom: 18px; }

/* ── Повестка (список дней) ── */
.agenda-day { margin-bottom: 22px; }
.agenda-day__head {
  display: flex; gap: 10px; align-items: baseline;
  padding-bottom: 7px; margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.agenda-day__date { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; }
.agenda-day__rel { color: var(--text-3); font-size: 12px; }
.agenda-day.is-today .agenda-day__date { color: var(--accent); }

/* Строка заседания. Колонки: время · суть · юрист (для руководителя) · зал.
   grid-template-columns задаётся в разметке через модификатор, чтобы колонка
   юриста появлялась только когда она есть. */
.hearing {
  display: grid; gap: 14px; align-items: center;
  padding: 11px 14px; margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cal-accent, var(--line-strong));
  border-radius: var(--radius-sm);
}
.hearing--plain { grid-template-columns: 72px 1fr auto; }
.hearing--boss  { grid-template-columns: 72px 1fr 130px auto; }
.hearing__time {
  font-family: var(--mono); font-weight: 600; font-size: 13px;
  color: var(--cal-accent, var(--text-3)); white-space: nowrap;
}
.hearing__court { font-weight: 600; letter-spacing: -0.01em; }
.hearing__meta { color: var(--text-3); font-size: 12px; margin-top: 2px; }
.hearing__meta a { color: var(--text-2); text-decoration: none; }
.hearing__meta a:hover { color: var(--text); }
.hearing__lawyer {
  font-size: 12px; color: var(--text-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.hearing__room { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.hearing__conflict { color: var(--err); font-weight: 600; }

/* Срочность красит только левую грань и время — фон остаётся спокойным. */
.hearing.u-conflict { --cal-accent: var(--err); }

/* ── Сетка месяца ── */
.month-nav {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.month-nav h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }

.month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

/* Клетка дня — обособленная карточка (вариант C): крупное число слева, день
   недели в углу, тонкая линия отделяет шапку от дел. .day-cell — внешняя
   ячейка фиксированной высоты (ряды сетки ровные); .day-cell__inner — то, что
   при наведении разворачивается поверх соседей, не смещая сетку. */
.day-cell {
  position: relative;
  height: 118px;
  cursor: pointer;
}
.day-cell__inner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  overflow: hidden;
}
.day-cell.is-weekend .day-cell__inner { background: var(--bg-soft); }
/* Хвост соседнего месяца — пустой слот: место в сетке держит (иначе дни
   съедут по столбцам), но ничего не рисует. */
.day-cell.is-blank { cursor: default; }
.day-cell.is-blank .day-cell__inner { display: none; }

.day-cell__head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 5px; margin-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.day-cell__num {
  font-size: 18px; font-weight: 600; color: var(--text);
  line-height: 1; letter-spacing: -0.01em;
}
.day-cell__dow {
  font-size: 10px; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.day-cell.is-today .day-cell__num { color: var(--accent); }
.day-cell.is-today .day-cell__head { border-bottom-color: var(--line-strong); }
.day-cell__conflict { color: var(--err); margin-left: 5px; font-size: 12px; }
.day-cell__events { display: flex; flex-direction: column; }

/* Свёрнутый вид показывает первые три дела — остальные прячем совсем, а не
   обрезаем: обрезка оставляла бы «огрызок» строки под счётчиком. */
.day-cell__events .mev:nth-child(n+4) { display: none; }

/* Наведение: внутренняя карточка перестаёт обрезать, показывает все дела и
   всплывает над соседями. Сетка при этом не перекраивается — двигается
   только оверлей. */
.day-cell.has-ev:hover { z-index: 40; }
.day-cell.has-ev:hover .day-cell__inner {
  /* bottom:auto снимает нижнюю привязку inset:0 — иначе height:auto не
     действует и коробка держит 118px, а дела вытекают наружу без фона.
     Со снятой привязкой рамка растёт под содержимое и непрозрачно кроет
     соседей. */
  bottom: auto; height: auto; min-height: 118px;
  z-index: 40;
  border-color: var(--line-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}
.day-cell.has-ev:hover .day-cell__events .mev { display: block; }
.day-cell.has-ev:hover .day-cell__more { display: none; }
/* Последний ряд разворачиваем вверх: .content обрезает по низу, и вниз
   развёрнутая клетка ушла бы под обрез. Вверх — всегда есть место соседнего
   ряда. top:auto + bottom:0 растит коробку от низа клетки вверх. */
.day-cell.is-lastrow.has-ev:hover .day-cell__inner { top: auto; bottom: 0; height: auto; }

.mev {
  display: block; font-size: 11px; line-height: 1.4;
  text-decoration: none; color: var(--text-2);
  border-left: 3px solid var(--cal-accent, var(--line-strong));
  padding: 1px 0 1px 6px; margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mev:hover { color: var(--text); }
.mev__time { font-family: var(--mono); color: var(--text-3); }
.mev__lawyer { color: var(--text-3); }
.mev.u-conflict { --cal-accent: var(--err); }
.mev__bang { color: var(--err); font-weight: 700; margin-right: 3px; }
.day-cell__more { font-size: 10px; color: var(--text-3); margin-top: 4px; }

/* ── Карточка дня по клику ── */
.day-modal {
  position: fixed; inset: 0; z-index: 100;
  display: none; align-items: center; justify-content: center;
}
.day-modal.is-open { display: flex; }
.day-modal__bg {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.day-modal__card {
  position: relative; z-index: 2;
  width: 380px; max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px); overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  padding: 18px 20px;
}
.day-modal__x {
  position: absolute; top: 12px; right: 12px;
  border: 0; background: none; cursor: pointer;
  color: var(--text-mute); font-size: 14px; padding: 4px;
}
.day-modal__x:hover { color: var(--text); }
.day-modal__num { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; }
.day-modal__sub { font-size: 12px; color: var(--text-3); margin: 2px 0 14px; }
.dm-row {
  display: grid; grid-template-columns: 54px 1fr auto; gap: 12px;
  align-items: center; padding: 9px 0;
  border-top: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
.dm-row:hover { background: var(--bg-soft); }
.dm-row__time { font-family: var(--mono); font-size: 12px; font-weight: 600; }
.dm-row__case { font-weight: 600; font-size: 13px; letter-spacing: -0.01em; }
.dm-row__court { font-size: 11px; color: var(--text-3); margin-top: 1px; }
.dm-row__lawyer { font-size: 12px; color: var(--text-2); white-space: nowrap; }
/* Судья и зал под судом — вторая строка адреса заседания. */
.dm-row__place { font-size: 11px; color: var(--text-3); margin-top: 2px; }
/* Цветовая шкала срочности убрана: три оттенка по близости даты читались как
   шифр. Остался один знак со смыслом — «!» на конфликте расписания. */
.dm-row__bang { color: var(--err); font-weight: 700; margin-right: 4px; }
.dm-empty { color: var(--text-mute); padding: 12px 0; font-size: 13px; }

/* Узкие экраны (планшет, деление окна пополам на 14–16" ноутбуке): у
   руководителя убираем колонку фамилии из строки, чтобы суть не сжималась. */
@media (max-width: 900px) {
  .hearing--boss { grid-template-columns: 64px 1fr auto; }
  .hearing__lawyer { display: none; }
  .month-grid { gap: 4px; }
  .day-cell { height: 100px; }
}

/* ─────────────────────────────────────────────────────────────
   v3 — Minimal Judicial / рабочая CRM.
   Точный документальный каркас для экранов 14–16". Старые классы
   сохраняются для HTMX-partials; новые правила уточняют систему поверх них.
   ───────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  --surface-raised: #f7f7f5;
  --link: #315b78;
  --focus: #315b78;
  --sidebar-w: 232px;
  --content-max: 1510px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11110f;
  --bg-soft: #161613;
  --surface: #1b1b18;
  --surface-raised: #20201c;
  --line: #30302b;
  --line-strong: #484840;
  --text: #f2f2ed;
  --text-2: #c8c8c0;
  --text-3: #999990;
  --text-mute: #707068;
  --accent: #f2f2ed;
  --accent-text: #11110f;
  --link: #8fb6d2;
  --focus: #8fb6d2;
  --ok: #62b77c;
  --ok-soft: #417e58;
  --ok-bg: #17271c;
  --info: #8fb6d2;
  --info-bg: #17232a;
  --warn: #d4a34c;
  --warn-bg: #2a2316;
  --err: #e07676;
  --err-bg: #2c1818;

  /* Тот же светофор, приглушённый: на тёмном фоне чистые тона выжигают глаз. */
  --prio-high:    #e06666;  --prio-high-bg: #2a1717;
  --prio-mid:     #d4a34c;  --prio-mid-bg:  #2a2316;
  --prio-low:     #62b77c;  --prio-low-bg:  #17271c;
}

html { background: var(--bg); }
body { background: var(--bg); }
a { color: var(--link); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; }
select:not([multiple]) {
  appearance:none;
  -webkit-appearance:none;
  min-height:32px;
  padding-right:30px!important;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-3) 50%),
    linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position:
    calc(100% - 14px) 50%,
    calc(100% - 10px) 50%;
  background-size:4px 4px;
  background-repeat:no-repeat;
}
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.icon-sprite { position:absolute; width:0; height:0; overflow:hidden; }

.window { min-height:100vh; }
.shell { min-height:100vh; grid-template-columns:var(--sidebar-w) minmax(0,1fr); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  padding: 14px 10px 12px;
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.sidebar .brand {
  color:var(--text);
  text-decoration:none;
  padding:5px 10px 17px;
  gap:11px;
}
.brand-logo { width:32px; height:32px; flex:none; fill:none; stroke:currentColor; stroke-width:1.25; }
.sidebar .brand > span { display:flex; flex-direction:column; min-width:0; }
.sidebar .brand b { font-size:13.5px; font-weight:650; line-height:1.25; }
.sidebar .brand small { margin-top:2px; color:var(--text-3); font-size:8px; line-height:1.2; text-transform:uppercase; letter-spacing:.105em; font-weight:650; }
.workspace-switch { margin:0 2px 7px; padding:9px 8px 10px; border-top:1px solid var(--line); border-bottom:1px solid var(--line); }
.workspace-switch label { display:block; margin:0 0 6px; color:var(--text-3); font-size:8px; line-height:1.2; font-weight:650; letter-spacing:.075em; text-transform:uppercase; }
.workspace-switch select { width:100%; min-width:0; min-height:38px; padding:7px 30px 7px 9px!important; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background-color:var(--surface); color:var(--text); box-shadow:none; font-size:10.5px; font-weight:600; text-overflow:ellipsis; }
.sidebar-nav { min-height:0; }
.sidebar .nav-group { padding:15px 10px 5px; font-size:8.5px; font-weight:650; letter-spacing:.12em; }
.sidebar .nav-item { min-height:36px; padding:8px 10px; gap:11px; font-size:12.5px; border:1px solid transparent; }
.sidebar .nav-item:hover { background:var(--surface); }
.sidebar .nav-item.active { position:relative; padding:8px 10px; background:var(--surface); border-color:var(--line); font-weight:650; }
.sidebar .nav-item.active::before { content:""; position:absolute; left:-11px; top:8px; width:2px; height:20px; background:var(--text); }
.sidebar .nav-item .ico, .sidebar .nav-item .ico svg { width:15px; height:15px; }
.sidebar .nav-item .badge { font-family:var(--mono); font-size:9px; }

.nav-search { margin:14px 2px 0; border-top:1px solid var(--line); padding:15px 8px 0; display:grid; grid-template-columns:15px minmax(0,1fr) auto; gap:8px; align-items:center; color:var(--text-3); }
.nav-search svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:1.6; }
.nav-search input { width:100%; min-width:0; border:0; padding:4px 0; background:transparent; color:var(--text); font-size:10.5px; outline:0; }
.nav-search input::placeholder { color:var(--text-3); opacity:1; }
.nav-search span { font:8px var(--mono); color:var(--text-mute); }
.sidebar-foot { margin-top:auto; border-top:1px solid var(--line); padding-top:9px; }
.theme-toggle { width:100%; display:flex; align-items:center; gap:10px; border:0; background:transparent; color:var(--text-3); padding:7px 10px; border-radius:var(--radius-sm); cursor:pointer; font-size:10.5px; }
.theme-toggle:hover { background:var(--surface); color:var(--text); }
.theme-toggle svg, .logout svg { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:1.6; }
.nav-user-card { display:grid; grid-template-columns:32px minmax(0,1fr) 24px; align-items:center; gap:8px; margin-top:5px; padding:8px 8px 2px; }
.nav-user-card .avatar { width:32px; height:32px; margin:0; }
.nav-user-card > span:nth-child(2) { min-width:0; display:flex; flex-direction:column; }
.nav-user-card b { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10.5px; }
.nav-user-card small { color:var(--text-3); font-size:8.5px; }
.nav-user-card form { margin:0; }
.logout { width:24px; height:24px; display:grid; place-items:center; border:0; background:transparent; color:var(--text-3); padding:0; cursor:pointer; }

.content { width:100%; max-width:var(--content-max); min-width:0; padding:24px 32px 40px; overflow:visible; }
.page-head { min-height:66px; display:flex; align-items:flex-start; gap:18px; padding-bottom:16px; margin-bottom:16px; border-bottom:1px solid var(--line); }
.page-head-main { min-width:0; }
.page-title { margin:0; font-size:22px; line-height:1.2; letter-spacing:-.025em; font-weight:650; color:var(--text); }
.page-title .count { margin-left:8px; color:var(--text-3); font:10px var(--mono); font-weight:450; letter-spacing:0; }
.page-subtitle { margin-top:5px; color:var(--text-3); font-size:10.5px; }
.page-actions { margin-left:auto; display:flex; align-items:center; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.toolbar { min-height:54px; padding-bottom:15px; margin-bottom:16px; border-bottom:1px solid var(--line); }
.toolbar h1 { font-size:22px; font-weight:650; }

.btn { min-height:32px; justify-content:center; cursor:pointer; font-size:10.5px; font-weight:600; padding:6px 11px; }
.btn svg { display:block; flex:none; }
.btn.export { background:var(--surface); border-color:var(--line-strong); color:var(--text-2); }
.btn.export:hover { color:var(--text); background:var(--bg-soft); }
.btn-icon { width:14px; height:14px; fill:none; stroke:currentColor; stroke-width:1.7; }
.segmented { box-shadow:none; }
.segmented .seg { display:inline-flex; align-items:center; justify-content:center; min-width:82px; min-height:28px; text-decoration:none; }
.segmented .seg.active { box-shadow:none; }

.filterbar { display:flex; align-items:end; gap:8px; padding:11px 12px; margin-bottom:14px; border:1px solid var(--line); border-radius:var(--radius); background:var(--bg-soft); }
.filterbar .grow { flex:1; min-width:220px; }
.filterbar label { color:var(--text-3); font-size:9px; text-transform:uppercase; letter-spacing:.065em; font-weight:650; }
.filterbar input, .filterbar select, .control { min-height:34px; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--surface); color:var(--text); padding:7px 10px; outline:0; font-size:12px; }
.filterbar > .btn { min-height:34px; font-size:12px; }
.filterbar .result { margin-left:auto; align-self:center; color:var(--text-3); font-size:9.5px; white-space:nowrap; }
.view-switch { display:inline-flex; align-self:flex-end; min-height:34px; border:1px solid var(--line); border-radius:var(--radius-sm); padding:2px; background:var(--bg-soft); }
.view-switch label { position:relative; min-width:72px; min-height:28px; display:grid; place-items:center; border:1px solid transparent; border-radius:4px; color:var(--text-3); cursor:pointer; font-size:11px; text-transform:none; letter-spacing:0; }
.view-switch input { position:absolute; opacity:0; pointer-events:none; }
.view-switch label:has(input:checked) { background:var(--surface); border-color:var(--line-strong); color:var(--text); font-weight:650; }

.registry-card { border:1px solid var(--line); border-radius:var(--radius); overflow:hidden; background:var(--surface); }
.registry-card table.users { table-layout:fixed; }
.registry-card table.users th { padding-top:10px; padding-bottom:10px; font-size:8.5px; font-weight:650; letter-spacing:.06em; }
.registry-card table.users td { padding-top:12px; padding-bottom:12px; font-size:11px; }
.registry-card tbody tr:hover { background:var(--bg-soft); }
.case-link { color:var(--link); font-family:var(--mono); font-weight:650; text-decoration:none; }
.case-link:hover { text-decoration:underline; }
.cell-main { display:block; min-width:0; overflow-wrap:anywhere; font-weight:600; color:var(--text); }
.cell-sub { display:block; margin-top:3px; color:var(--text-3); font-size:9px; overflow-wrap:anywhere; }
.status-mark { display:inline-flex; align-items:center; gap:7px; color:var(--text-2); font-size:9.5px; }
.status-mark::before { content:""; width:6px; height:6px; border-radius:50%; background:var(--text-mute); flex:none; }
.status-mark.ok::before { background:var(--ok); }
.status-mark.warn::before { background:var(--warn); }
.status-mark.err::before { background:var(--err); }

.case-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.case-tile { min-width:0; min-height:238px; display:flex; flex-direction:column; padding:15px; border:1px solid var(--line); border-radius:var(--radius); background:var(--surface); overflow:hidden; }
.case-tile:hover { border-color:var(--line-strong); background:var(--bg-soft); }
.case-tile-top { min-width:0; display:flex; align-items:center; gap:10px; padding-bottom:12px; border-bottom:1px solid var(--line); }
.case-tile-top .case-link { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.case-tile-top .status-mark { margin-left:auto; max-width:42%; text-align:right; }
.case-tile-top form { margin:0; flex:none; }
.case-tile-kicker { margin-top:12px; color:var(--text-3); font-size:8.5px; font-weight:650; text-transform:uppercase; letter-spacing:.06em; }
.case-tile-company { min-width:0; min-height:34px; margin-top:4px; color:var(--text); font-size:11.5px; line-height:1.4; font-weight:650; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; word-break:break-word; }
.case-tile-opponent { min-width:0; min-height:31px; margin-top:7px; color:var(--text-2); font-size:10px; line-height:1.4; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; overflow-wrap:anywhere; word-break:break-word; }
.case-tile-data { margin-top:auto; padding-top:11px; display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:9px 14px; border-top:1px solid var(--line); }
.case-tile-meta { min-width:0; color:var(--text-3); font-size:8.5px; }
.case-tile-meta b { display:block; min-width:0; margin-top:3px; color:var(--text-2); font-size:9.5px; line-height:1.3; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.case-tile-meta .kop, .case-tile-meta .rub { color:var(--text-3); }
.urgent { color:var(--err)!important; }
.row-action { text-align:right; }
.row-action form { display:inline; }
.empty-state { grid-column:1/-1; border:1px dashed var(--line-strong); border-radius:var(--radius); padding:32px; text-align:center; color:var(--text-3); font-size:11px; }

.card { box-shadow:none; }
.card .card-header { min-height:42px; padding:11px 15px; }
.card .card-header h2 { font-size:11.5px; font-weight:650; }
.card .card-body { padding:14px 15px; }
.hint { border:1px solid var(--line); background:var(--bg-soft); color:var(--text-3); border-radius:var(--radius-sm); padding:10px 12px; }

.eyebrow { margin-bottom:5px; color:var(--text-3); font-size:8px; font-weight:650; letter-spacing:.1em; text-transform:uppercase; }
.dossier-alert { margin:-4px 0 16px; }
.case-dossier { display:grid; grid-template-columns:minmax(0,1fr) 276px; gap:16px; align-items:start; }
.case-main { min-width:0; }
.dossier-section { margin-bottom:14px; overflow:hidden; }
.facts-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0; padding:2px 15px 14px; }
.fact { min-width:0; display:flex; flex-direction:column; gap:4px; padding:12px 12px 11px 0; border-bottom:1px solid var(--line); }
.fact:nth-last-child(-n+2) { border-bottom:0; }
.fact > span, .fact > small { color:var(--text-3); font-size:8.5px; }
.fact > span { text-transform:uppercase; letter-spacing:.055em; font-weight:650; }
.fact > b { font-size:11px; line-height:1.45; overflow-wrap:anywhere; }
.control-fact > div { display:flex; flex-direction:column!important; align-items:flex-start!important; gap:5px!important; }
.table-scroll { max-width:100%; overflow-x:auto; }
.case-summary { position:sticky; top:16px; align-self:start; overflow:visible; max-height:none; }
.case-summary .card-header { background:var(--bg-soft); }
.summary-body { padding:4px 15px 15px; }
.summary-control { padding:11px 0; border-bottom:1px solid var(--line); font-size:10px; }
.summary-control > div { display:flex!important; flex-direction:column; align-items:flex-start!important; gap:6px!important; }
.summary-control select { max-width:100%; width:100%; }
.summary-list { margin:0; }
.summary-list > div { padding:11px 0; border-bottom:1px solid var(--line); }
.summary-list dt, .summary-note > span { color:var(--text-3); font-size:8px; text-transform:uppercase; letter-spacing:.055em; }
.summary-list dd { margin:4px 0 0; color:var(--text); font-size:10.5px; font-weight:600; }
.summary-list dd small { display:block; margin-top:3px; color:var(--text-3); font-size:8.5px; font-weight:450; }
.urgency-err { color:var(--err); }.urgency-warn { color:var(--warn); }.urgency-ok { color:var(--ok); }
.summary-money { display:grid; grid-template-columns:1fr auto; gap:8px 10px; padding:12px 0; border-bottom:1px solid var(--line); }
.summary-money span { color:var(--text-3); font-size:9px; }
.summary-money b { font-size:9.5px; font-weight:600; text-align:right; }
.summary-note { display:flex; flex-direction:column; gap:4px; padding-top:12px; }
.summary-note b { font-size:10px; }.summary-note small { color:var(--text-3); font-size:8.5px; line-height:1.4; }
.archive-zone { display:flex; align-items:center; gap:20px; margin-top:18px; padding:15px 16px; border:1px solid var(--line); border-radius:var(--radius); }
.archive-zone > span { display:flex; flex-direction:column; gap:3px; min-width:0; }
.archive-zone b { font-size:10.5px; }.archive-zone small { color:var(--text-3); font-size:9px; }
.archive-zone form { margin-left:auto; }
.danger-soft { border-color:color-mix(in srgb, var(--err) 45%, var(--line)); color:var(--err); background:transparent; }
.danger-soft:hover { background:var(--err-bg); }

.outcome-legend { width:min(620px,calc(100% - 32px)); display:grid; grid-template-columns:minmax(150px,1fr) 54px 48px; gap:8px 14px; align-items:center; margin:6px auto 16px; }
.outcome-legend .label { display:flex; align-items:center; gap:8px; min-width:0; color:var(--text-2); font-size:9.5px; }
.outcome-legend .n, .outcome-legend .pct { text-align:right; font-family:var(--mono); font-variant-numeric:tabular-nums; }
.outcome-legend .n { color:var(--text); font-size:10px; }.outcome-legend .pct { color:var(--text-3); font-size:9px; }
.col:hover .pt, .col:focus-visible .pt { transform:scale(1.55); }
.pt { transform-box:fill-box; transform-origin:center; transition:transform 120ms ease; }
.analytics-filter { flex-wrap:wrap; align-items:end; }
.analytics-filter label { display:grid; gap:5px; min-width:135px; }
.analytics-filter select { max-width:190px; }

/* Справочники и формы */
.form-error { margin-bottom:14px; padding:10px 12px; border:1px solid color-mix(in srgb,var(--err) 45%,var(--line)); border-radius:var(--radius-sm); background:var(--err-bg); color:var(--err); font-size:10px; }
.form-notice { margin-bottom:14px; padding:10px 12px; border:1px solid color-mix(in srgb,var(--ok) 45%,var(--line)); border-radius:var(--radius-sm); background:color-mix(in srgb,var(--ok) 10%,var(--surface)); color:var(--ok); font-size:10px; }
.add-panel { margin-top:16px; }
.entity-form { display:grid; grid-template-columns:minmax(260px,2fr) minmax(150px,1fr) minmax(140px,1fr) auto; gap:10px; align-items:end; padding:14px 15px 16px; }
.entity-form label, .stack-form label, .login-form label, .form-columns label, .inline-action-form label { display:grid; gap:6px; color:var(--text-3); font-size:8.5px; font-weight:650; letter-spacing:.04em; text-transform:uppercase; }
.entity-form input, .stack-form input, .stack-form select, .login-form input, .form-columns input, .form-columns select, .inline-action-form input { width:100%; min-height:36px; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--surface); color:var(--text); padding:8px 10px; text-transform:none; letter-spacing:0; }
.pill { box-shadow:none; }

/* Входящие: каждая компания — отдельное досье, находки — карточки внутри. */
.inbox-groups { display:grid; gap:18px; }
.inbox-company { min-width:0; overflow:hidden; border:1px solid var(--line-strong); border-left:3px solid var(--text); border-radius:var(--radius); background:var(--surface); }
.inbox-company-head { min-height:70px; display:grid; grid-template-columns:22px 36px minmax(0,1fr) auto; gap:11px; align-items:center; padding:12px 15px; border-bottom:1px solid var(--line-strong); background:var(--surface); }
.company-mark { width:36px; height:36px; display:grid; place-items:center; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--bg-soft); color:var(--text-2); font:8px var(--mono); letter-spacing:.08em; }
.group-company { min-width:0; display:flex; flex-direction:column; gap:3px; }
.group-company .group-company-label { color:var(--text-mute); font-size:7px; font-weight:650; letter-spacing:.09em; text-transform:uppercase; }
.group-company b { overflow-wrap:anywhere; font-size:12px; line-height:1.35; }.group-company small { color:var(--text-3); font-size:8.5px; }
.group-count { padding:5px 8px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--bg-soft); color:var(--text-3); font:8.5px var(--mono); white-space:nowrap; }
.inbox-company-items { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:12px; background:var(--bg-soft); }
.inbox-case { min-width:0; min-height:224px; display:grid; grid-template-columns:22px minmax(0,1fr); align-items:start; padding:13px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); }
.inbox-case:hover { border-color:var(--line-strong); }
.inbox-case.sel { background:var(--surface-raised); border-color:var(--line-strong); }
.inbox-case.focus { box-shadow:inset 2px 0 0 var(--text-3); }
.inbox-company-items .done { min-height:62px; padding:13px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); }
.inbox-body { min-width:0; }
.inbox-case .inbox-body { align-self:stretch; }
.inbox-body .row1 { min-width:0; }
.inbox-body .num { color:var(--link); font-family:var(--mono); font-weight:650; }
.inbox-body .parties { display:grid; grid-template-columns:minmax(0,1fr) 18px minmax(0,1fr); gap:8px; align-items:center; margin-top:10px; }
.inbox-body .parties > span:not(.arrow) { min-width:0; display:flex; flex-direction:column; gap:3px; overflow-wrap:anywhere; font-size:10.5px; line-height:1.4; }
.inbox-body .parties small, .item-assignee > span, .bulk-assignee > span { color:var(--text-3); font-size:7.5px; text-transform:uppercase; letter-spacing:.055em; }
.inbox-body .arrow { color:var(--text-mute); text-align:center; }
.inbox-body .facts { margin-top:8px; color:var(--text-3); font-size:9px; }
.inbox-body .actions { margin-top:auto; padding-top:10px; border-top:1px solid var(--line); }
.item-assignee, .bulk-assignee { display:flex; align-items:center; gap:7px; }
.bulkbar { position:sticky; top:0; z-index:20; border-color:var(--line-strong); background:var(--surface); box-shadow:none; }

/* Люди и доступ */
.people-layout { display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:16px; align-items:start; }
.people-registry { min-width:0; overflow-x:auto; }
/* Почта — моношрифт без пробелов: в fixed-таблице длинный адрес не переносится
   и наезжал на колонку роли. Обрезаем многоточием, полный адрес — в title. */
.people-registry td.mono { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.settings-rail { display:grid; gap:12px; position:sticky; top:16px; }
.stack-form { display:grid; gap:12px; padding:14px 15px 16px; }
.stack-form .btn { margin-top:2px; }
.person-cell { display:flex; align-items:center; gap:9px; min-width:0; }
.person-cell .avatar { width:30px; height:30px; margin:0; flex:none; font-size:8px; }
.role-label { color:var(--text-2); font-size:9px; white-space:nowrap; }
.access-status { display:inline-flex; align-items:center; gap:6px; color:var(--text-2); font-size:9px; white-space:nowrap; }
.access-status i { width:6px; height:6px; border-radius:50%; background:var(--ok); flex:none; }
.notify-form { display:flex; align-items:center; gap:9px; }
.notify-form label { display:flex; align-items:center; gap:4px; white-space:nowrap; color:var(--text-2); font-size:8.5px; }
.notify-form .inline-in { width:92px; min-width:0; }
.access-note { display:flex; flex-direction:column; gap:5px; line-height:1.45; }
.privacy-note { display:flex; align-items:baseline; gap:12px; margin:0 0 16px; padding:12px 14px; border:1px solid var(--line); border-radius:var(--radius); background:var(--bg-soft); }
.privacy-note b { flex:none; font-size:10.5px; }
.privacy-note span { color:var(--text-3); font-size:9.5px; line-height:1.5; }

/* Добавление дела и рабочие формы */
.create-layout { display:grid; grid-template-columns:minmax(0,760px) 260px; gap:16px; align-items:start; }
.create-sheet { overflow:hidden; }
.form-section { padding:15px; border-bottom:1px solid var(--line); }
.form-section-title { margin-bottom:11px; color:var(--text-3); font-size:8px; font-weight:650; letter-spacing:.075em; text-transform:uppercase; }
.form-columns { display:grid; grid-template-columns:1fr 1.35fr .75fr; gap:12px; }
.form-columns.two { grid-template-columns:minmax(0,1.5fr) minmax(160px,.65fr); }
.form-columns.two label:last-child:nth-child(3) { grid-column:1/-1; }
.form-actions { display:flex; justify-content:flex-end; gap:8px; padding:14px 15px; }
.form-rail { padding:14px 15px; border:1px solid var(--line); border-radius:var(--radius); background:var(--bg-soft); position:sticky; top:16px; }
.form-rail b { font-size:10.5px; }.form-rail p { margin:7px 0 0; color:var(--text-3); font-size:9.5px; line-height:1.55; }
.inline-action-form { display:flex; align-items:end; gap:10px; padding:14px 15px; }.inline-action-form .grow { flex:1; }.inline-result { padding:0 15px 12px; }

/* Подключение КАД */
.connect-layout { display:grid; grid-template-columns:minmax(0,760px) 260px; gap:16px; align-items:start; }
.connect-card { padding:4px 16px; }
.connect-step { display:grid; grid-template-columns:28px minmax(0,1fr); gap:12px; padding:16px 0; border-bottom:1px solid var(--line); }
.connect-step:last-child { border-bottom:0; }.connect-step > span { width:28px; height:28px; display:grid; place-items:center; border:1px solid var(--line-strong); border-radius:50%; font:9px var(--mono); }
.connect-step b { font-size:11px; }.connect-step p { margin:5px 0 0; color:var(--text-3); font-size:9.5px; line-height:1.5; }
.token-box { margin:10px 0; padding:10px 11px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--bg-soft); overflow-wrap:anywhere; font-size:9px; user-select:all; }
.connect-note { display:flex; flex-direction:column; gap:5px; line-height:1.5; }

/* Вход */
.login-shell { min-height:100vh; display:grid; place-items:center; padding:56px 20px; }
.login-box { width:min(388px,100%); padding:22px; }
.login-brand { display:flex; align-items:center; gap:10px; padding-bottom:18px; border-bottom:1px solid var(--line); }
.login-logo { width:34px; height:34px; display:grid; place-items:center; border:1px solid var(--line-strong); border-radius:50%; font:8px var(--mono); }
.login-brand > span:last-child { display:flex; flex-direction:column; gap:2px; }.login-brand b { font-size:12px; }.login-brand small { color:var(--text-3); font-size:7.5px; text-transform:uppercase; letter-spacing:.09em; }
.login-heading { padding:22px 0 17px; }.login-heading h1 { margin:0; font-size:20px; letter-spacing:-.02em; }.login-heading p { margin:5px 0 0; }
.login-form { display:grid; gap:11px; }.login-form .btn { width:100%; min-height:36px; }
.login-msg { margin:0 0 13px; }
.login-foot { margin:16px 0 0; padding-top:13px; border-top:1px solid var(--line); color:var(--text-mute); font-size:8.5px; line-height:1.45; }
.code-input { text-align:center; letter-spacing:.32em!important; font-size:17px!important; }
.resend-form { margin-top:9px; text-align:center; }

@media (max-width: 1180px) {
  .people-layout { grid-template-columns:1fr; }.settings-rail { position:relative; top:auto; grid-row:1; grid-template-columns:repeat(2,minmax(0,1fr)); }
  .entity-form { grid-template-columns:2fr 1fr 1fr; }.entity-form .btn { grid-column:3; }
  .create-layout, .connect-layout { grid-template-columns:minmax(0,1fr) 230px; }
  .inbox-company-items { grid-template-columns:1fr; }
}
@media (max-width: 900px) {
  .entity-form, .form-columns, .form-columns.two { grid-template-columns:1fr; }.entity-form .btn, .form-columns.two label:last-child:nth-child(3) { grid-column:auto; }
  .settings-rail, .create-layout, .connect-layout { grid-template-columns:1fr; }.form-rail { position:relative; top:auto; grid-row:1; }
  .notify-form { flex-wrap:wrap; }
  .inbox-company-head { grid-template-columns:22px 36px minmax(0,1fr); }.group-count { grid-column:3; justify-self:start; }
  .inbox-body .parties { grid-template-columns:1fr; }.inbox-body .arrow { display:none; }
}

.bare { position:relative; background:var(--bg); color:var(--text); }
.bare-theme { position:fixed; top:18px; right:20px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); color:var(--text-3); padding:6px 10px; cursor:pointer; font-size:10px; }
.login-box { background:var(--surface); border-color:var(--line-strong); box-shadow:none; }

@media (max-width: 1180px) {
  :root { --sidebar-w:210px; }
  .content { padding-left:22px; padding-right:22px; }
  .filterbar { flex-wrap:wrap; }
  .filterbar .result { margin-left:0; }
  .case-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .case-dossier { grid-template-columns:minmax(0,1fr) 248px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns:1fr; grid-template-rows:auto minmax(0,1fr); }
  .sidebar { position:relative; width:100%; height:auto; overflow:visible; border-right:0; border-bottom:1px solid var(--line); }
  .workspace-switch { width:min(420px,calc(100% - 20px)); margin-left:10px; margin-right:10px; }
  .sidebar-nav { display:flex; flex-wrap:wrap; }
  .sidebar .nav-group, .nav-search, .sidebar-foot { display:none; }
  .sidebar .nav-item { width:auto; }
  .content { padding:20px 16px 32px; }
  .page-head { flex-direction:column; }
  .page-actions { margin-left:0; justify-content:flex-start; }
  .case-grid { grid-template-columns:1fr; }
  .case-dossier { grid-template-columns:1fr; }
  .case-summary { position:relative; top:auto; grid-row:1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior:auto!important; animation-duration:.01ms!important; transition-duration:.01ms!important; }
}

/* Карточка дела v4 — документ с закреплённой оперативной сводкой */
:root {
  --event-hearing:#315b78;
  --event-deadline:#a06b22;
  --money-claimed:#78716c;
  --money-awarded:#315b78;
  --money-received:#15803d;
  --overlay:rgba(12,10,9,.34);
}
[data-theme="dark"] {
  --event-hearing:#8fb6d2;
  --event-deadline:#d4a34c;
  --money-claimed:#999990;
  --money-awarded:#8fb6d2;
  --money-received:#62b77c;
  --overlay:rgba(0,0,0,.58);
}

.case-dossier { grid-template-columns:minmax(0,1fr) 374px; gap:18px; align-items:start; }
.case-main { min-width:0; }
.dossier-section { margin-bottom:16px; }
.case-materials { overflow:visible; }
.case-materials > .card-header,
.case-dossier .instances-section > .card-header { min-height:48px; padding:0 18px; }
.case-materials > .card-header h2,
.case-summary > .card-header h2 { font-size:15px; letter-spacing:-.01em; }
.facts-grid { padding:4px 18px 18px; }
.fact { gap:6px; padding:15px 16px 14px 0; }
.fact:nth-child(2n) { padding-left:16px; padding-right:0; }
.fact > span, .fact > small { font-size:10px; line-height:1.35; }
.fact > b { font-size:13px; line-height:1.45; }
.control-fact > div { width:100%; gap:10px!important; }
.proceeding-field { display:flex; flex-direction:column; align-items:stretch; gap:10px; }
.proceeding-field > span { color:var(--text-3); font-size:10px; font-weight:650; letter-spacing:.055em; text-transform:uppercase; }
.proceeding-field .control { width:100%; }

.material-section { border-top:1px solid var(--line); }
.material-section-head { min-height:48px; padding:0 18px; display:flex; align-items:center; justify-content:space-between; gap:16px; background:var(--bg-soft); border-bottom:1px solid var(--line); }
.material-section-head > div:first-child { display:flex; align-items:baseline; gap:10px; min-width:0; }
.material-section-head h3 { margin:0; font-size:13.5px; font-weight:650; }
.material-section-head > div:first-child > span { color:var(--text-3); font-size:11px; }
.claims-table-wrap { max-width:100%; overflow-x:auto; }
.claims-table { width:100%; table-layout:fixed; }
.claims-table th:first-child { width:34%; }
.claims-table th:not(:first-child) { width:22%; text-align:right; }
.claims-table td { padding-top:12px; padding-bottom:12px; font-size:12.5px; }
.claims-table td:first-child b { display:block; font-size:12.5px; }
.claim-note { display:block; margin-top:3px; color:var(--text-3); font-size:10.5px; line-height:1.35; overflow-wrap:anywhere; }
.claim-amount { width:100%; min-width:0; height:36px; padding:7px 25px 7px 8px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--surface); color:var(--text); text-align:right; font:12px var(--mono); }
.claim-amount:hover { border-color:var(--line-strong); }
.claims-totals { display:flex; flex-wrap:wrap; align-items:center; gap:7px 18px; padding:13px 18px 15px; border-top:1px solid var(--line); color:var(--text-3); font-size:11px; line-height:1.5; }
.claims-totals > b { color:var(--text); font-size:12px; }
.claims-totals strong { margin-left:4px; color:var(--text); font-size:11.5px; }
.case-contract-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; padding:14px 18px 17px; }
.case-contract-item { min-width:0; padding:11px 12px; border:1px solid var(--line); border-radius:var(--radius-sm); }
.case-contract-item > span { display:block; font-size:12.5px; font-weight:650; }
.case-contract-item > small { display:block; margin-top:3px; color:var(--text-3); font-size:10px; }
.case-contract-item > p { margin:7px 0 0; color:var(--text-2); font-size:11px; line-height:1.45; overflow-wrap:anywhere; }
.empty-material { grid-column:1/-1; padding:4px 0; color:var(--text-3); font-size:11.5px; }
.instances-table { table-layout:fixed; }
.instances-table th:first-child { width:18%; }
.instances-table th:nth-child(2) { width:30%; }
.instances-table th:nth-child(3) { width:24%; }
.instances-table th:nth-child(4) { width:28%; }
.instances-table td { font-size:12px; line-height:1.45; overflow-wrap:anywhere; }

.case-summary { position:sticky; top:16px; align-self:start; overflow:visible; max-height:none; }
.case-summary > .card-header { min-height:49px; padding:0 15px 0 17px; background:var(--bg-soft); }
.summary-header { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.summary-body { padding:0 17px 17px; }
.summary-controls { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px; padding:15px 0; border-bottom:1px solid var(--line); }
.summary-field { min-width:0; display:flex; flex-direction:column; align-items:stretch; gap:8px; }
.summary-field > span,
.summary-instance > span { color:var(--text-3); font-size:10px; font-weight:650; letter-spacing:.055em; text-transform:uppercase; }
.summary-field .control { width:100%; height:40px; min-height:40px; padding:8px 30px 8px 10px; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background-color:var(--surface); color:var(--text); font-size:13px; font-weight:600; }
.summary-field > b { min-height:40px; display:flex; align-items:center; font-size:13px; }
.summary-instance { min-height:49px; display:flex; align-items:center; justify-content:space-between; gap:12px; border-bottom:1px solid var(--line); }
.summary-instance b { font-size:13px; text-align:right; }

.case-menu-wrap { position:relative; flex:none; }
.menu-dots, .icon-btn { width:32px; height:32px; display:grid; place-items:center; border:1px solid transparent; border-radius:var(--radius-sm); background:transparent; color:var(--text); cursor:pointer; font-size:16px; line-height:1; }
.menu-dots { letter-spacing:2px; padding:0 0 7px 2px; font-weight:700; }
.menu-dots:hover, .menu-dots[aria-expanded="true"], .icon-btn:hover { border-color:var(--line); background:var(--surface); }
.case-menu { position:absolute; top:calc(100% + 6px); right:0; z-index:90; width:max-content; min-width:190px; display:none; padding:5px; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--surface); box-shadow:0 12px 30px rgba(12,10,9,.12); }
.case-menu.is-open { display:grid; }
.case-menu button { min-height:34px; padding:7px 10px; border:0; border-radius:4px; background:transparent; color:var(--text); text-align:left; font-size:12px; cursor:pointer; }
.case-menu button:hover { background:var(--bg-soft); }
.case-menu button:disabled { color:var(--text-mute); cursor:not-allowed; }

.case-mini-calendar { padding:15px 0 16px; border-bottom:1px solid var(--line); }
.mini-calendar-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:12px; }
.mini-calendar-head h3,
.case-money-summary h3 { margin:0; font-size:13.5px; font-weight:650; }
.mini-calendar-nav { display:flex; align-items:center; gap:5px; }
.mini-calendar-nav > span { min-width:112px; color:var(--text-2); text-align:center; font-size:11.5px; font-weight:600; }
.mini-calendar-nav .icon-btn { width:27px; height:27px; font-size:13px; }
.mini-calendar-weekdays,
.mini-calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); }
.mini-calendar-weekdays { margin-bottom:3px; }
.mini-calendar-weekdays span { color:var(--text-mute); text-align:center; font-size:8.5px; font-weight:650; text-transform:uppercase; }
.mini-calendar-grid { gap:2px; overflow:visible; }
.mini-day { position:relative; min-width:0; height:37px; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; padding:2px; border:1px solid transparent; border-radius:var(--radius-sm); background:transparent; color:var(--text-2); font-size:10.5px; cursor:default; }
button.mini-day.has-events { cursor:pointer; }
button.mini-day:hover, button.mini-day:focus-visible { border-color:var(--line); background:var(--bg-soft); }
.mini-day.is-today { font-weight:700; }
.mini-day-number { position:relative; width:23px; height:23px; display:grid; place-items:center; border-radius:50%; isolation:isolate; }
.mini-day.is-today .mini-day-number:not(.has-ring) { box-shadow:inset 0 0 0 1px var(--line-strong); }
.mini-day-number.has-ring::before { content:""; position:absolute; inset:0; z-index:-1; border-radius:50%; background:var(--event-ring); -webkit-mask:radial-gradient(farthest-side,transparent calc(100% - 2px),#000 0); mask:radial-gradient(farthest-side,transparent calc(100% - 2px),#000 0); }
.mini-day-dots { height:4px; display:flex; gap:2px; align-items:center; justify-content:center; }
.event-dot { width:5px; height:5px; display:inline-block; flex:none; border-radius:50%; background:var(--text-mute); }
.event-dot.event-hearing { background:var(--event-hearing); }
.event-dot.event-deadline { background:var(--event-deadline); }
.mini-day-tooltip { position:absolute; left:50%; bottom:calc(100% + 7px); z-index:110; width:max-content; max-width:230px; display:none; padding:8px 9px; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background:var(--surface); color:var(--text); box-shadow:0 10px 28px rgba(12,10,9,.14); transform:translateX(-50%); text-align:left; font-size:10.5px; line-height:1.4; pointer-events:none; }
.mini-day-tooltip::after { content:""; position:absolute; left:50%; top:100%; width:7px; height:7px; border-right:1px solid var(--line-strong); border-bottom:1px solid var(--line-strong); background:var(--surface); transform:translate(-50%,-4px) rotate(45deg); }
.mini-day-tooltip > span { display:flex; align-items:flex-start; gap:6px; }
.mini-day-tooltip > span + span { margin-top:5px; }
.mini-day:hover .mini-day-tooltip,
.mini-day:focus-visible .mini-day-tooltip { display:block; }
.calendar-legend { display:flex; align-items:center; gap:14px; margin-top:10px; color:var(--text-3); font-size:9.5px; }
.calendar-legend span { display:flex; align-items:center; gap:5px; }

.case-money-summary { padding:16px 0 15px; border-bottom:1px solid var(--line); }
.case-stat-rings { position:relative; width:176px; height:176px; display:grid; place-items:center; margin:10px auto 7px; }
.case-stat-rings svg { width:176px; height:176px; overflow:visible; }
.ring-track, .ring-value { fill:none; stroke-width:8; }
.ring-track { stroke:var(--line); }
.ring-value { stroke-linecap:round; }
.ring-value.claimed { stroke:var(--money-claimed); }
.ring-value.awarded { stroke:var(--money-awarded); }
.ring-value.received { stroke:var(--money-received); }
.case-stat-rings > strong { position:absolute; font-size:20px; font-weight:650; letter-spacing:-.03em; }
.summary-money { grid-template-columns:minmax(0,1fr) auto; gap:8px 12px; padding:3px 0 0; border:0; }
.summary-money > span { display:flex; align-items:center; gap:7px; font-size:11px; }
.summary-money > b { display:flex; align-items:baseline; justify-content:flex-end; font-size:11.5px; }
.summary-money > b .kop, .summary-money > b .rub { display:inline; }
.money-key { width:9px; height:2px; display:inline-block; background:var(--text-mute); }
.money-key.claimed { background:var(--money-claimed); }
.money-key.awarded { background:var(--money-awarded); }
.money-key.received { background:var(--money-received); }
.summary-note { gap:6px; padding-top:15px; }
.summary-note > span { font-size:10px; font-weight:650; }
.summary-note b { font-size:12.5px; }
.summary-note small { font-size:10.5px; line-height:1.5; }

.case-dialog { position:fixed; inset:0; z-index:300; display:none; place-items:center; padding:24px; }
.case-dialog.is-open { display:grid; }
.case-dialog-backdrop { position:absolute; inset:0; background:var(--overlay); -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px); }
.case-dialog-panel { position:relative; z-index:1; width:min(620px,calc(100vw - 32px)); max-height:calc(100vh - 48px); overflow:auto; border:1px solid var(--line-strong); border-radius:var(--radius); background:var(--surface); box-shadow:0 24px 70px rgba(12,10,9,.22); }
.compact-dialog { width:min(500px,calc(100vw - 32px)); }
.day-dialog-panel { width:min(560px,calc(100vw - 32px)); }
.case-dialog-head { min-height:66px; display:flex; align-items:center; justify-content:space-between; gap:20px; padding:13px 16px; border-bottom:1px solid var(--line); }
.case-dialog-head h3 { margin:3px 0 0; font-size:16px; }
.case-dialog-fields { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; padding:17px; }
.case-dialog-fields.one-column { grid-template-columns:1fr; }
.case-dialog-fields label { min-width:0; display:flex; flex-direction:column; gap:7px; }
.case-dialog-fields label > span,
.dialog-info > span { color:var(--text-3); font-size:9.5px; font-weight:650; letter-spacing:.055em; text-transform:uppercase; }
.case-dialog-fields .span-two { grid-column:1/-1; }
.case-dialog-fields .control { width:100%; min-height:40px; padding:8px 31px 8px 10px; border:1px solid var(--line-strong); border-radius:var(--radius-sm); background-color:var(--surface); color:var(--text); font-size:13px; }
.case-dialog-fields textarea.control { resize:vertical; }
.dialog-info { display:flex; flex-direction:column; gap:7px; padding:1px 0; }
.dialog-info b { font-size:13px; }
.case-dialog-actions { display:flex; justify-content:flex-end; gap:9px; padding:13px 17px 16px; border-top:1px solid var(--line); }
.dialog-copy { margin:0; padding:16px 17px 4px; color:var(--text-2); font-size:11.5px; line-height:1.55; }
.destructive-list { display:grid; gap:8px; padding:14px 17px 17px; }
.destructive-row { display:flex; align-items:center; gap:14px; padding:11px 12px; border:1px solid var(--line); border-radius:var(--radius-sm); }
.destructive-row > span { min-width:0; display:flex; flex:1; flex-direction:column; gap:3px; }
.destructive-row b { font-size:12px; overflow-wrap:anywhere; }
.destructive-row small { color:var(--text-3); font-size:10px; line-height:1.4; }
.case-dialog-open { overflow:hidden; }
.day-event-list { display:grid; gap:8px; padding:15px 16px 17px; }
.day-event { display:grid; grid-template-columns:7px minmax(0,1fr) auto; gap:10px; align-items:start; padding:11px 12px; border:1px solid var(--line); border-radius:var(--radius-sm); }
.day-event.is-done { opacity:.55; }
.day-event > .event-dot { margin-top:5px; }
.day-event b { display:block; font-size:12.5px; }
.day-event small { display:block; margin-top:4px; color:var(--text-3); font-size:10px; }
.day-event-actions { display:flex; gap:7px; }
.text-action { padding:3px 0; border:0; background:transparent; color:var(--link); font-size:10px; cursor:pointer; }
.text-action.danger { color:var(--err); }

@media (max-width:1280px) {
  .case-dossier { grid-template-columns:minmax(0,1fr) 340px; gap:14px; }
  .summary-body { padding-left:14px; padding-right:14px; }
  .summary-controls { gap:9px; }
}
@media (max-width:1040px) {
  .case-dossier { grid-template-columns:1fr; }
  .case-summary { position:relative; top:auto; grid-row:1; }
  .case-stat-rings { width:164px; height:164px; }
  .case-stat-rings svg { width:164px; height:164px; }
}
@media (max-width:700px) {
  .facts-grid, .summary-controls, .case-dialog-fields { grid-template-columns:1fr; }
  .fact:nth-child(2n) { padding-left:0; }
  .case-contract-list { grid-template-columns:1fr; }
  .claims-table { min-width:650px; }
  .case-dialog-fields .span-two { grid-column:auto; }
  .day-event { grid-template-columns:7px minmax(0,1fr); }
  .day-event-actions { grid-column:2; }
}

/* ─── Важность дела: секции списка и канты ───────────────────────────────── */
.prio-head { display:flex; align-items:center; gap:9px; margin:18px 0 9px; padding:8px 12px; border:1px solid var(--line); border-left-width:3px; border-radius:var(--radius-sm); }
.prio-head:first-of-type { margin-top:0; }
.prio-dot { width:7px; height:7px; border-radius:50%; flex:none; }
.prio-name { font-size:10.5px; font-weight:650; letter-spacing:.02em; }
.prio-sub { color:var(--text-3); font-size:9px; }
.prio-count { margin-left:auto; color:var(--text-3); font-size:10px; font-variant-numeric:tabular-nums; }
.prio-head-high { border-left-color:var(--prio-high); background:var(--prio-high-bg); }
.prio-head-high .prio-dot { background:var(--prio-high); }
.prio-head-medium { border-left-color:var(--prio-mid); background:var(--prio-mid-bg); }
.prio-head-medium .prio-dot { background:var(--prio-mid); }
.prio-head-low { border-left-color:var(--prio-low); background:var(--prio-low-bg); }
.prio-head-low .prio-dot { background:var(--prio-low); }
.case-tile.prio-high   { border-left:3px solid var(--prio-high); }
.case-tile.prio-medium { border-left:3px solid var(--prio-mid); }
.case-tile.prio-low    { border-left:3px solid var(--prio-low); }
/* Кант строки — inset-тенью: у ячеек таблицы border ломает схлопывание рамок. */
.tbl-cases tr.prio-high td:first-child   { box-shadow:inset 3px 0 0 var(--prio-high); }
.tbl-cases tr.prio-medium td:first-child { box-shadow:inset 3px 0 0 var(--prio-mid); }
.tbl-cases tr.prio-low td:first-child    { box-shadow:inset 3px 0 0 var(--prio-low); }
.prio-badge { display:inline-flex; align-items:center; gap:7px; font-size:10px; font-weight:650; }
.prio-badge small { color:var(--text-3); font-weight:400; }
.prio-badge.prio-high   { color:var(--prio-high); }
.prio-badge.prio-medium { color:var(--prio-mid); }
.prio-badge.prio-low    { color:var(--prio-low); }
.prio-badge .prio-dot { background:currentColor; }

/* ─── Трёхпозиционный переключатель важности (по образцу админского .segmented,
   но каждая позиция окрашена в свой цвет уровня) ────────────────────────────── */
.prio-switch { display:inline-flex; gap:2px; padding:2px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--bg-soft); }
.prio-seg { padding:4px 11px; border:1px solid transparent; border-radius:4px; background:transparent; color:var(--text-3); font:500 11.5px var(--font); cursor:pointer; white-space:nowrap; }
.prio-seg:hover { color:var(--text-2); }
.prio-seg.is-active { background:var(--surface); border-color:var(--line-strong); font-weight:650; box-shadow:0 1px 2px rgba(0,0,0,.10); }
.prio-seg-high.is-active   { color:var(--prio-high); border-color:var(--prio-high); background:var(--prio-high-bg); }
.prio-seg-medium.is-active { color:var(--prio-mid);  border-color:var(--prio-mid);  background:var(--prio-mid-bg); }
.prio-seg-low.is-active    { color:var(--prio-low);  border-color:var(--prio-low);  background:var(--prio-low-bg); }
.prio-control { display:flex; flex-direction:column; align-items:flex-end; gap:5px; }
.prio-label { color:var(--text-3); font-size:8.5px; font-weight:650; text-transform:uppercase; letter-spacing:.055em; }
/* Пункт меню, оформленный формой: кнопка внутри должна выглядеть как обычный пункт. */
.case-menu .menu-form { margin:0; display:block; }
.case-menu .menu-form button { width:100%; }
.case-menu button.is-danger { color:var(--err); }

/* ─── Переключатель «Весь отдел / Мои дела» (только у админа) ─────────────── */
.scope-switch { display:flex; gap:2px; margin:0 12px 10px; padding:2px; border:1px solid var(--line); border-radius:var(--radius-sm); background:var(--bg-soft); }
.scope-seg { flex:1; padding:5px 8px; border:1px solid transparent; border-radius:4px; background:transparent; color:var(--text-3); font:500 10.5px var(--font); cursor:pointer; white-space:nowrap; }
.scope-seg:hover { color:var(--text-2); }
.scope-seg.is-active { background:var(--surface); border-color:var(--line-strong); color:var(--text); font-weight:650; }
