/* DEC Web — современная тема (light + тёмная боковая панель) */
:root {
  --bg: #f1f5f9;            /* рабочая область */
  --bg-work: #fcfdff;       /* холст схемы (чуть светлее) */
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-soft-2: #dbeafe;
  --text: #0f172a;
  --muted: #64748b;
  --rail: #0f172a;          /* тёмная навигация слева */
  --rail-2: #1e293b;
  --rail-text: #94a3b8;
  --rail-active: #3b82f6;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .10), 0 2px 4px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .18);
  --radius: 10px;
  --radius-sm: 7px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* --- вход --- */
.login-screen {
  position: fixed; inset: 0; z-index: 5000;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #0f172a 0%, #1e3a5f 55%, #2563eb 100%);
}
.login-screen.login-screen--off {
  display: none !important;
  pointer-events: none !important;
}
.login-card {
  width: min(360px, 92vw); background: var(--panel); border-radius: var(--radius);
  padding: 28px 28px 22px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; gap: 10px;
}
.login-card h1 { margin: 0 0 4px; font-size: 20px; }
.login-card label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.login-card input {
  padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); font-size: 14px;
}
.login-error { color: var(--danger); font-size: 12px; min-height: 18px; margin: 0; }
.login-submit { margin-top: 6px; padding: 10px; }
.login-hint { font-size: 11px; margin: 8px 0 0; text-align: center; }
.login-reset {
  margin-top: 4px; padding: 8px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline;
}
.login-reset:hover { color: var(--text); }

/* Аварийный сброс — поверх всего, если интерфейс «завис» */
.auth-emergency {
  position: fixed; right: 14px; bottom: 14px; z-index: 10001;
  padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: #fff;
  box-shadow: var(--shadow-md); cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--danger);
}
.auth-emergency:hover { background: #fef2f2; }

.header-user {
  display: flex; align-items: center; gap: 6px; flex: none;
}
.user-badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.user-badge.user-readonly { background: #fef3c7; color: #b45309; }
.presence-dialog { width: min(760px, 94vw); max-height: 80vh; overflow: auto; border: 1px solid var(--border); border-radius: 14px; padding: 24px; box-shadow: var(--shadow-lg); }
.presence-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.presence-dialog h2 { margin: 0 0 8px; font-size: 20px; }
.presence-note { color: var(--muted, #64748b); font-size: 13px; margin-bottom: 20px; }
.presence-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.presence-table th, .presence-table td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.presence-table th { color: var(--muted, #64748b); font-weight: 500; }
.presence-table small { display: block; margin-top: 4px; color: var(--muted, #64748b); }
.presence-dialog form { display: flex; justify-content: flex-end; margin-top: 20px; }
.btn-logout { padding: 4px 9px; font-size: 11px; }

/* --- режим просмотра --- */
.editor-readonly .palette { opacity: .45; pointer-events: none; }
.app-readonly .sheet-actions { opacity: .45; pointer-events: none; }
button { font-family: inherit; }

/* --- шапка --- */
.app-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 30;
  flex-wrap: nowrap;
  min-width: 0;
}
/* Единая компактная линия: лого → меню → (распор) → поиск → БД/версия → пользователь */
.app-title    { order: 0; }
.menubar      { order: 1; }
.header-user  { order: 4; margin-left: auto; }
/* БД/Версия убраны с экрана — дублируют «Управление версиями» (остаются в DOM для JS) */
.header-project { display: none !important; }

.app-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 650;
  white-space: nowrap;
  padding-right: 8px;
  border-right: 1px solid var(--border);
  flex: none;
}

.app-logo {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  box-shadow: 0 2px 6px rgba(59, 130, 246, .3);
  flex: none;
}
.app-logo svg { width: 16px; height: 16px; }
.app-name { font-size: 14px; font-weight: 700; letter-spacing: .3px; }
.app-version {
  font-size: 11px; font-weight: 600; color: var(--muted);
  padding: 1px 6px; border: 1px solid var(--border); border-radius: 999px;
  white-space: nowrap;
}
.app-version:empty { display: none; }

.menubar { display: flex; gap: 1px; position: relative; flex: none; }
.menu-item { position: relative; }

.menu-btn {
  padding: 5px 9px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.menu-btn:hover, .menu-item:focus-within .menu-btn {
  background: var(--accent-soft);
  color: var(--accent-hover);
}
.menu-fullscreen { white-space: nowrap; flex: none; }
.menu-fullscreen.active { background: var(--accent); color: #fff; }

/* Режим «На весь экран»: скрыть левое (палитра + рейка) — холст шире.
   Панель атрибутов справа остаётся видимой. */
.scheme-fullscreen .nav-rail,
.scheme-fullscreen .palette { display: none !important; }

.menu-drop {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 230px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  padding: 6px;
}
.menu-drop.open { display: block; animation: pop .12s ease; }
.menu-drop-wide { min-width: 300px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.menu-drop button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  border-radius: var(--radius-sm);
}
.menu-drop button:hover { background: var(--accent-soft); color: var(--accent-hover); }
.menu-drop kbd {
  color: var(--muted);
  font-size: 11px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }

.header-project { display: flex; align-items: center; gap: 5px; flex: none; }
.header-project label { color: var(--muted); font-size: 11px; font-weight: 500; }

.header-project select {
  min-width: 96px;
  max-width: 170px;
  padding: 4px 7px;
  font-size: 12px;
}
.header-project select, .topbar select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s;
}
.topbar select { padding: 6px 10px; font-size: 13px; min-width: 150px; max-width: 230px; }
.header-project select:focus, .topbar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}

.search-box { position: relative; display: flex; gap: 5px; align-items: center; flex: none; }
.search-box input {
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  font-size: 12px;
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
#search-attr { width: 88px; }
#search-value { width: 150px; }

.btn-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.btn-icon:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

#search-results {
  display: none;
  position: absolute;
  top: 42px; right: 0;
  width: 400px;
  max-height: 420px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  padding: 4px;
}
#search-results.open { display: block; }
.search-item { padding: 9px 12px; border-radius: var(--radius-sm); cursor: pointer; }
.search-item:hover { background: var(--accent-soft); }

/* --- тело --- */
.app-body { flex: 1; display: flex; min-height: 0; }

.nav-rail {
  width: 78px;
  background: linear-gradient(180deg, var(--rail-2), var(--rail));
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
  gap: 4px;
  flex-shrink: 0;
}

.nav-rail button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 11px 4px;
  border: none;
  background: transparent;
  color: var(--rail-text);
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 500;
  border-radius: var(--radius);
  transition: background .14s, color .14s, transform .08s;
}
.nav-ico { display: grid; place-items: center; }
.nav-ico svg { width: 23px; height: 23px; }
.nav-rail button small { letter-spacing: .2px; }

.nav-rail button:hover { background: rgba(255, 255, 255, .07); color: #e2e8f0; }
.nav-rail button:active { transform: scale(.95); }
.nav-rail button.active {
  background: rgba(59, 130, 246, .16);
  color: #fff;
}
.nav-rail button.active::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 26px;
  border-radius: 0 4px 4px 0;
  background: var(--rail-active);
}

.workspace { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }

main { flex: 1; min-height: 0; display: flex; padding: 0; }
.page { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }

/* --- листы СНИЗУ --- */
.sheet-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 6px 10px;
  box-shadow: 0 -1px 2px rgba(15, 23, 42, .04);
}
.sheet-tabs { display: flex; gap: 6px; overflow-x: auto; flex: 1; padding-bottom: 2px; }
.sheet-tabs::-webkit-scrollbar { height: 6px; }

.sheet-tabs button {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 500;
  transition: background .12s, color .12s, border-color .12s;
}
.sheet-tabs button:hover { background: var(--accent-soft); color: var(--accent-hover); }
.sheet-tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 6px rgba(37, 99, 235, .3);
}
.sheet-tabs button.excluded {
  font-style: italic; opacity: 0.75; color: var(--muted);
  text-decoration: line-through; border-style: dashed;
}

/* Стрелки прокрутки вкладок листов — видны только когда вкладки не влезают */
.sheet-scroll {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 24px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sheet-scroll:hover { background: var(--accent-soft); color: var(--accent-hover); }
.sheet-scroll:disabled { opacity: .35; cursor: default; background: var(--panel-2); color: var(--muted); }

.sheet-actions { display: flex; gap: 4px; order: -1; }
.sheet-actions button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.sheet-actions button:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.statusbar {
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel);
  border-top: 1px solid var(--border);
}

/* --- схема --- */
.scheme-wrap { flex: 1; display: flex; min-height: 0; }

.palette {
  width: 214px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.palette-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 10px 9px 14px;
  font-weight: 650;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.palette-toggle {
  flex: none; width: 22px; height: 22px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--muted); cursor: pointer;
  font-size: 15px; line-height: 1;
}
.palette-toggle:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }

/* Свёрнутая библиотека — тонкая полоса со стрелкой разворота. */
.palette.collapsed { width: 30px; }
.palette.collapsed .palette-title,
.palette.collapsed .palette-filter,
.palette.collapsed .palette-items { display: none; }
.palette.collapsed .palette-head { justify-content: center; padding: 9px 0; }
.palette-filter {
  margin: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.palette-filter:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.palette-items { overflow-y: auto; display: flex; flex-direction: column; padding: 4px 8px 8px; gap: 2px; }
.palette-items button {
  text-align: left;
  padding: 7px 10px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
}
.palette-items button:hover { background: var(--accent-soft); }
.palette-items button.active { background: var(--accent); color: #fff; }

.palette-group { display: flex; flex-direction: column; }
.palette-group-head {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 8px 5px; margin-top: 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .03em; color: var(--muted);
  cursor: pointer; user-select: none;
  border-bottom: 1px solid var(--border);
}
.palette-group-head:hover { color: var(--text); }
.palette-group-caret { font-size: 9px; transition: transform .12s ease; }
.palette-group.collapsed .palette-group-caret { transform: rotate(-90deg); }
.palette-group-body { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.palette-group.collapsed .palette-group-body { display: none; }
/* Подкатегории библиотеки (напр. подгруппы «Нагрузки») — с отступом и без верхней линии. */
.palette-sub { margin-left: 8px; }
.palette-sub > .palette-group-head {
  font-size: 10px; text-transform: none; letter-spacing: 0;
  border-bottom: none; padding: 5px 8px 3px; margin-top: 2px;
}

/* --- мастер РУ --- */
.ru-modal-overlay {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; z-index: 2000;
}
.ru-modal {
  width: min(640px, 92vw); max-height: 86vh; display: flex; flex-direction: column;
  background: var(--panel); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.3);
  overflow: hidden;
}
.ru-modal-head { padding: 14px 18px; font-weight: 650; font-size: 15px; border-bottom: 1px solid var(--border); }
.ru-modal-form { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; }
.ru-modal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.ru-modal-form input { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.ru-autofill { align-self: flex-start; padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--accent-soft); cursor: pointer; }
.ru-table-wrap { overflow-y: auto; padding: 0 18px; flex: 1; }
.ru-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ru-table th { text-align: left; padding: 6px 8px; position: sticky; top: 0; background: var(--panel); border-bottom: 1px solid var(--border); }
.ru-table td { padding: 3px 8px; }
.ru-table input, .ru-table select { width: 100%; padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.ru-modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--border); }
.ru-modal-actions button { padding: 8px 18px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; background: var(--panel); }
.ru-ok { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; }

/* --- выбор режима вставки (Ctrl+V): «с атрибутами» / «без связей» --- */
.paste-modal { width: min(560px, 92vw); }
.paste-modal-body { display: flex; flex-direction: column; gap: 10px; padding: 14px 18px; }
.paste-opt {
  display: flex; flex-direction: column; gap: 5px; width: 100%;
  padding: 12px 14px; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.paste-opt:hover, .paste-opt:focus-visible {
  border-color: var(--accent); background: var(--accent-soft); outline: none;
}
.paste-opt-title { font-weight: 650; font-size: 14px; }
.paste-opt-hint { font-size: 12px; line-height: 1.45; color: var(--muted); }

.canvas-host {
  flex: 1; min-width: 0; position: relative; overflow: hidden; background: var(--bg-work);
  /* запрет нативного выделения текста — иначе при перетаскивании подписи синеют */
  user-select: none; -webkit-user-select: none; -moz-user-select: none;
}

.scheme-minimap {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 12;
  box-shadow: 0 4px 18px rgba(15, 23, 42, .18);
  border-radius: 6px;
  cursor: crosshair;
  pointer-events: auto;
}
.scheme-minimap.hidden { display: none; }
.scheme-minimap canvas { display: block; border-radius: 6px; }
.scheme-svg text { user-select: none; -webkit-user-select: none; }
/* Подпись KKS не перетаскивается мышью — только авто-позиция или TextPosX/Y в атрибутах */
.scheme-svg .el-label { pointer-events: none; }

/* Низкая детализация при сильном уменьшении: прячем подписи (кроме РУ/щитов) и порты. */
.scheme-svg.low-detail g.element:not(.kks-keep) .el-label { display: none; }
.scheme-svg.low-detail .port { display: none; }
/* Во время пан/зум — меньше декора, быстрее композитор. */
/* Подписи скрываются на время pan/zoom только при большом числе видимых элементов
   (класс interacting-heavy ставится по флагу от редактора) — на крупном масштабе
   с десятками элементов подписи не мигают. Порты/хиты — как раньше, всегда. */
.scheme-svg.interacting-heavy g.element:not(.kks-keep) .el-label { display: none; }
.scheme-svg.interacting .port { display: none; }
.scheme-svg.interacting .connection-hit { display: none; }
/* призрак вставки следует за курсором (как в desktop) */
.paste-ghost { opacity: .5; pointer-events: none; }
.paste-ghost .hit { display: none; }
.scheme-svg {
  width: 100%;
  height: 100%;
  display: block;
  background: var(--bg-work);
  overflow: visible;           /* содержимое (сетка) покрывает весь холст; обрезает .canvas-host */
  transform-origin: 0 0;       /* CSS-трансформ во время жеста зума/панорамы */
  backface-visibility: hidden; /* стимулирует GPU-слой */
}
/* Холст принимает клавиатуру для Ctrl+C/V, но браузерная рамка фокуса
   не должна масштабироваться вместе с SVG при зуме/панораме. */
.scheme-svg:focus { outline: none; }

/* Растровый слой обзора (волна 3 плана ускорения): лежит поверх SVG, прозрачен,
   событий не принимает — клики, панорама и зум достаются SVG под ним. */
.scheme-raster {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  display: none;
  transform-origin: 0 0;
}
.scheme-raster.active { display: block; }

.element { cursor: move; }
.element.selected .hit { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 3; }

.port { fill: #93c5fd; stroke: #fff; stroke-width: 0.8; cursor: crosshair; }
.port:hover { fill: var(--accent); r: 5; }
.port-active { fill: #f59e0b; }
/* предпросмотр рисуемой связи */
.marquee { fill: rgba(59, 130, 246, .12); stroke: var(--accent); stroke-width: 1; stroke-dasharray: 4 3; pointer-events: none; vector-effect: non-scaling-stroke; }
.connect-preview { stroke: var(--accent); stroke-width: 1.5; stroke-dasharray: 5 3; fill: none; pointer-events: none; }
.port-target { fill: none; stroke: #f59e0b; stroke-width: 2; pointer-events: none; }

.connection { cursor: pointer; }
.connection.selected { stroke: var(--accent) !important; filter: drop-shadow(0 0 2px rgba(37, 99, 235, .6)); }

.bend-handle { fill: #f59e0b; stroke: #fff; stroke-width: 1.5; cursor: grab; }
.bend-handle:hover { fill: #d97706; r: 8; }

/* --- атрибуты --- */
.attr-panel {
  width: 316px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.attr-tabs {
  display: flex; flex-shrink: 0; border-bottom: 1px solid var(--border);
}
.attr-tab {
  flex: 1; padding: 8px 4px; border: none; background: transparent;
  font-size: 11px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent;
}
.attr-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.attr-tab-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.attr-tab-body.hidden { display: none; }

.attr-global-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.attr-global-title { font-weight: 650; font-size: 13px; }
.btn-global-add, .btn-closure-stmt, .btn-closure-ta {
  padding: 6px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; font-size: 12px;
}
.attr-global-list {
  list-style: none; margin: 0; padding: 8px 0; overflow-y: auto; flex: 1;
}
.attr-global-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; border-bottom: 1px solid var(--border); font-size: 12px;
}
.attr-global-del {
  border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1;
}
.attr-global-del:hover { color: #dc2626; }
.attr-global-hint { padding: 8px 12px; font-size: 11px; margin: 0; }

.attr-closure-block { padding: 10px 12px; border-bottom: 1px solid var(--border); }
.attr-closure-title { font-weight: 650; font-size: 12px; margin-bottom: 6px; }
.attr-closure-table-wrap { max-height: 140px; overflow: auto; margin-bottom: 8px; }
.attr-closure-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.attr-closure-table th, .attr-closure-table td { border-bottom: 1px solid var(--border); padding: 4px 6px; text-align: left; }
.attr-closure-table tbody tr { cursor: pointer; }
.attr-closure-table tbody tr.selected { background: var(--accent-soft); }
.attr-closure-table tbody tr:hover { background: #f8fafc; }

.attr-detail-modal { width: min(1100px, 96vw); max-height: 88vh; display: flex; flex-direction: column; }
.attr-detail-scroll { overflow: auto; padding: 0 12px 12px; flex: 1; }
.attr-detail-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.attr-detail-table th, .attr-detail-table td { border: 1px solid var(--border); padding: 4px 6px; }

.analysis-toolbar { margin-bottom: 8px; }

.attr-empty { padding: 20px; color: var(--muted); }
/* Заголовок панели + кнопка «+ атрибут» рядом с именем элемента (наверху) */
.attr-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px; border-bottom: 1px solid var(--border); }
.attr-title { font-weight: 650; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attr-title-row .btn-add-attr { flex: 0 0 auto; padding: 3px 10px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); cursor: pointer; background: var(--panel); font-size: 11px; line-height: 1.15; }
.attr-title-row .btn-add-attr:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
/* длинный код элемента (ID) скрыт — поднимаем атрибуты выше */
.attr-id { display: none; }
.attr-table-wrap { flex: 1; overflow-y: auto; padding: 4px 0 6px; }
.attr-table { width: 100%; border-collapse: collapse; font-size: 11px; }
/* Зазор между колонками названий и значений сокращён — освободившееся место
   отдано полям ввода значений (правая колонка шире). */
.attr-table td { padding: 2px 3px; vertical-align: middle; border: none; }
.attr-table td:first-child {
  width: 37%; color: var(--muted); font-size: 10px; font-weight: 500;
  padding-left: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attr-table td:last-child { padding-right: 8px; }
.attr-table input, .attr-table select, .attr-table textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 4px 7px;
  font-size: 10px;
  background: var(--panel-2);
  color: var(--text);
}
.attr-table textarea.attr-multiline {
  font-family: inherit; resize: vertical; line-height: 1.25; min-height: 22px;
}
.attr-table input:hover, .attr-table select:hover { border-color: var(--border-strong); }
.attr-table input:focus, .attr-table select:focus {
  border-color: var(--accent);
  outline: none;
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}
/* Подсветка элементов с РД */
.scheme-svg g.element.rd-highlight { filter: drop-shadow(0 0 3px #16a34a) drop-shadow(0 0 7px #16a34a); }
/* Подсветка по ID ПНР */
.scheme-svg g.element.pnr-highlight { filter: drop-shadow(0 0 3px #dc2626) drop-shadow(0 0 8px #dc2626); }
.scheme-svg path.connection.pnr-highlight { stroke: #dc2626 !important; stroke-width: 4 !important; }
/* Подсветка из модуля «Анализ» */
.scheme-svg g.element.analysis-highlight { filter: drop-shadow(0 0 3px #f59e0b) drop-shadow(0 0 8px #f59e0b); }
.scheme-svg path.connection.analysis-highlight { stroke: #f59e0b !important; stroke-width: 4 !important; }
/* Двухцветная подсветка проверки «Заполнено»: зелёный=Да, красный=Нет */
.scheme-svg g.element.analysis-hl-green { filter: drop-shadow(0 0 3px #16a34a) drop-shadow(0 0 8px #16a34a); }
.scheme-svg g.element.analysis-hl-red { filter: drop-shadow(0 0 3px #dc2626) drop-shadow(0 0 8px #dc2626); }
/* Наложенные элементы (overlap_marked, п. 22) */
.scheme-svg g.element.overlap-marked > rect.hit {
  fill: rgba(255, 90, 90, 0.35);
  stroke: #ff5a5a;
  stroke-width: 2;
}
.menu-drop button.menu-toggle.active { background: #ff5a5a; color: #fff; border-color: #ff5a5a; }
.context-menu button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Спец-поля атрибутов: РД, Этапка, Тип_марка */
.attr-rd, .attr-stage, .attr-tm, .attr-pnr { display: flex; gap: 3px; align-items: center; }
.attr-rd input, .attr-stage input, .attr-tm input, .attr-pnr input { flex: 1; min-width: 0; }
.attr-readonly { background: var(--panel-2); color: var(--text); }
.attr-rd button, .attr-stage button, .attr-pnr button {
  flex: none; padding: 3px 6px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; white-space: nowrap; font-size: 11px;
}
.attr-rd button:hover, .attr-stage button:hover, .attr-pnr button:hover { background: var(--accent-soft); border-color: var(--accent); }
.attr-rd .attr-rd-hl.active { background: #16a34a; color: #fff; border-color: #16a34a; }
.attr-pnr .attr-pnr-hl.active { background: #dc2626; color: #fff; border-color: #dc2626; }
/* Компактные П/P и узкие отступы кнопок ID ПНР — максимум ширины полю ввода. */
.attr-pnr-pick, .attr-pnr-apply { min-width: 24px; font-weight: 700; }
.attr-pnr button { padding: 3px 4px; }

.pnr-modal { width: min(720px, 94vw); max-height: 80vh; }
.pnr-list { overflow-y: auto; padding: 8px 18px; flex: 1; max-height: 50vh; }
.pnr-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-bottom: 1px solid var(--border); cursor: pointer; font-size: 13px; }
.pnr-row input { flex: none; margin-top: 3px; }
/* Полноценная таблица привязки работ (кнопка «P» у ID ПНР).
   Высота фиксированная: при фильтрации диалог не «скачет» — таблица остаётся
   той же высоты, просто снизу пусто. */
.pnr-modal-wide { width: min(1200px, 96vw); height: 88vh; max-height: 88vh; }
.pnr-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.pnr-search { flex: 0 0 340px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; }
.pnr-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.pnr-table-wrap { flex: 1; min-height: 0; overflow: auto; padding: 0; }
.pnr-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.pnr-table th, .pnr-table td { border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); padding: 4px 8px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 340px; }
.pnr-table thead th { position: sticky; background: var(--panel-2); z-index: 1; }
.pnr-table thead tr:first-child th { top: 0; font-weight: 600; }
.pnr-table tr.pnr-filters th { top: 27px; padding: 2px 4px; }
.pnr-cf { width: 100%; padding: 3px 6px; border: 1px solid var(--border-strong); border-radius: 4px; font-size: 11px; font-weight: 400; }
.pnr-cbcol { width: 34px; text-align: center; }
.pnr-trow { cursor: default; }
.pnr-trow:hover td { background: var(--accent-soft); }
.pnr-trow.pnr-checked td { background: #eaf3ff; }
.pnr-count { font-size: 12px; }
.pnr-id { font-weight: 600; min-width: 100px; color: var(--accent); }
.pnr-name { color: var(--muted); flex: 1; }

.attr-color { display: flex; gap: 6px; align-items: center; }
.attr-color input[type="color"] { width: 28px; height: 24px; padding: 0; border: 1px solid var(--border-strong); border-radius: 4px; cursor: pointer; flex: none; }
.attr-color input[data-key] { flex: 1; min-width: 0; }

.attr-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 6px 12px; border-top: 1px solid var(--border); background: var(--panel);
}
.attr-actions button {
  padding: 3px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  cursor: pointer; background: var(--panel); font-size: 11px; line-height: 1.15; min-height: 24px;
}
.attr-actions button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
/* Место под сообщение «сохранено N изменений» всегда зарезервировано —
   кнопки (в т.ч. «Сохранить») не прыгают при появлении/исчезновении текста. */
.attr-hint { min-height: 30px; padding: 4px 12px 6px; font-size: 11px; line-height: 1.3; color: var(--muted); }
.btn-save-attrs {
  grid-column: 1 / -1; background: var(--accent) !important; color: #fff !important;
  border-color: var(--accent) !important; font-weight: 600;
}
.btn-save-attrs:hover { background: var(--accent-hover) !important; }

.attr-portnav { padding: 8px 12px; border-bottom: 1px solid var(--border); }
.btn-goto-port {
  width: 100%; padding: 8px 10px; cursor: pointer;
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
.btn-goto-port:hover { background: var(--accent); color: #fff; }

/* --- вкладки модулей --- */
.sub-tabs { display: flex; gap: 6px; padding: 3px 12px 0; background: var(--panel); border-bottom: 1px solid var(--border); }
.sub-tabs button {
  padding: 5px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.sub-tabs button:hover { color: var(--accent-hover); }
.sub-tabs button.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.module-toolbar { padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn-primary, .btn-secondary {
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background .12s, box-shadow .12s;
}
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 2px 8px rgba(37, 99, 235, .3); }
.btn-secondary { background: var(--panel); color: var(--text); }
.btn-secondary:hover { background: var(--panel-2); }

/* --- таблицы --- */
.dt-toolbar { display: flex; align-items: center; gap: 8px; padding: 5px 12px; background: var(--panel); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.dt-toolbar button { padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; font-size: 12px; }
.dt-toolbar button:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
.dt-toolbar input { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 12.5px; }
.dt-toolbar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.dt-count { color: var(--muted); font-size: 12px; }
/* overflow-x: auto + ограничение высоты вьюпортом → горизонтальный ползунок всегда
   виден внизу экрана (хост таблицы — не flex, поэтому flex:1 не ограничивает высоту,
   и иначе ползунок уходит за нижний край длинной таблицы). */
.dt-scroll { flex: 1; overflow: auto; min-height: 0; max-height: calc(100vh - 178px); background: var(--panel); }

/* «Колонки» — выпадающий список видимости колонок (как меню в desktop) */
.dt-cols-wrap { position: relative; display: inline-block; }
.dt-cols-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 30;
  max-height: 320px; overflow-y: auto; min-width: 220px;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
  padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.dt-cols-menu.hidden { display: none; }
.dt-cols-menu label {
  display: flex; align-items: center; gap: 8px; padding: 4px 8px;
  font-size: 12.5px; cursor: pointer; border-radius: 4px; white-space: nowrap;
}
.dt-cols-menu label:hover { background: var(--accent-soft); }
.dt-cols-menu .dt-cols-all { margin-bottom: 4px; }

/* Глобальное присваивание из Excel */
.assign-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.assign-row label { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.assign-row input[type="text"], .assign-row input:not([type]), .assign-row select {
  padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 12.5px; min-width: 180px;
}
.as-result { flex: 1; min-height: 0; display: flex; flex-direction: column; }
/* Присваивание: сводка «файл → схема», галочки выбора строк, режимы отчёта */
.as-sum { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; padding: 2px 2px 6px; }
.as-sum b { font-weight: 600; }
.as-ok { color: var(--ok); font-weight: 600; }
.as-missing summary { cursor: pointer; font-size: 12.5px; }
.as-missing-list {
  max-height: 160px; overflow: auto; margin: 6px 0 2px; padding: 6px 10px; font-size: 12px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--mono, monospace);
}
.as-missing-host {
  margin: 6px 0 2px; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
/* Высота скролла таблицы ненайденных ограничена: она внутри спойлера в сводке,
 * а не на весь экран. !important — перебивает инлайн-стиль от _fitScrollHeight. */
.as-missing-host .dt-scroll { max-height: 340px !important; }
.as-missing-host .dt-toolbar { padding: 4px 8px; }
.as-cb-cell { text-align: center; }
.as-row-cb { cursor: pointer; }
.as-link-type { color: var(--muted); font-style: italic; }
.dt-toolbar .as-mode { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; white-space: nowrap; }
.dt-toolbar .as-sel-all, .dt-toolbar .as-sel-none { font-size: 12px; }
.as-loose-lbl { display: inline-flex; align-items: center; gap: 5px; }

/* Сравнение: свод по исполнителям */
.comparison-host { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.comparison-summary { border-top: 2px solid var(--border-strong); background: var(--panel); padding: 10px 14px; max-height: 220px; overflow-y: auto; }
.cmp-summary-title { font-weight: 600; font-size: 12.5px; margin-bottom: 6px; }
.cmp-summary-table { width: auto; min-width: 420px; }
.cmp-summary-table td, .cmp-summary-table th { padding: 4px 12px; }
.cmp-summary-total { font-weight: 600; font-size: 12.5px; margin-top: 6px; color: var(--text); }

/* Окно выбора кабеля из проектного КЖ (кнопка «К»): стартовый размер ~2250×76vh
   (не шире экрана), растягивается за угол и разворачивается на весь экран (⤢);
   все колонки видны без горизонтальной прокрутки, текст переносится
   (table-layout: fixed + colgroup в cablepicker.js, границы колонок тянутся мышью).
   Статусы строк: зелёный — свободен, синий — эта линия, серый — занят другой линией. */
.cable-modal {
  width: min(2250px, 98vw); height: 76vh;
  min-width: 640px; min-height: 360px; max-width: 100vw; max-height: 100vh;
  resize: both;
}
.cable-modal.cable-modal-max { width: 100vw !important; height: 100vh !important; border-radius: 0; resize: none; }
.cable-modal .ru-modal-head { display: flex; align-items: center; gap: 10px; }
.cable-modal .ru-modal-head .cable-max-btn {
  margin-left: auto; padding: 3px 10px; font-size: 16px; line-height: 1; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); color: var(--text);
}
.cable-modal .ru-modal-head .cable-max-btn:hover { background: var(--accent-soft); }
.cable-modal-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 18px 6px; }
.cable-modal-tools .cable-filter { flex: 1; min-width: 240px; padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.cable-modal-tools .cable-filter:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.cable-status-filter { display: flex; flex-wrap: wrap; gap: 4px; }
.cable-status-filter button {
  padding: 5px 10px; font-size: 12px; cursor: pointer; background: var(--panel);
  border: 1px solid var(--border-strong); border-radius: 999px; color: var(--text);
}
.cable-status-filter button b { font-weight: 600; margin-left: 3px; }
.cable-status-filter button.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cable-status-filter button.cst-free:not(.active) { border-color: #86d9a1; color: #166534; }
.cable-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 0 18px 8px; font-size: 11.5px; }
.cable-legend-chip { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-left: 8px; border: 1px solid var(--border-strong); }
.cable-legend-chip:first-child { margin-left: 0; }
.cable-legend-chip.cst-free { background: #ecfdf3; border-color: #86efac; }
.cable-legend-chip.cst-mine { background: #dbeafe; border-color: #60a5fa; }
.cable-legend-chip.cst-busy { background: #f1f5f9; border-color: #cbd5e1; }
.cable-legend-warn { color: var(--danger); margin-left: 10px; }
.cable-table-wrap { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; margin: 0 18px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.dt.cable-table { table-layout: fixed; width: 100%; min-width: 0; }
table.dt.cable-table td, table.dt.cable-table th { white-space: normal; overflow-wrap: anywhere; overflow: hidden; font-size: 12px; padding: 4px 6px; vertical-align: top; }
table.dt.cable-table th { font-size: 11px; position: sticky; top: 0; z-index: 1; vertical-align: bottom; }
table.dt.cable-table th .cable-col-resize {
  position: absolute; top: 0; right: -3px; width: 7px; height: 100%; cursor: col-resize; z-index: 2;
}
table.dt.cable-table th .cable-col-resize:hover, table.dt.cable-table th .cable-col-resize.active { background: var(--accent); opacity: .5; }
table.dt.cable-table td:first-child { text-align: center; }
table.dt.cable-table tr.cst-free td { background: #f3fcf6; }
table.dt.cable-table tr.cst-free td:first-child { box-shadow: inset 4px 0 0 #86efac; }
table.dt.cable-table tr.cst-free:hover td { background: #e2f7e9; }
table.dt.cable-table tr.cst-free .cst-cell { color: #166534; font-weight: 600; }
table.dt.cable-table tr.cst-mine td { background: #dbeafe; font-weight: 600; }
table.dt.cable-table tr.cst-mine td:first-child { box-shadow: inset 4px 0 0 #2563eb; }
table.dt.cable-table tr.cst-busy td { background: #f8fafc; color: #94a3b8; }
table.dt.cable-table tr.cst-conflict td { background: #fee2e2; }
table.dt.cable-table tr.cst-conflict .cst-cell { color: #b91c1c; font-weight: 600; }
.cable-count { padding: 6px 18px; font-size: 12px; }

/* Кабели → «Статистика» (modules/cableStats.js): плитки/фильтры — общие .vst-*,
   здесь ужаты (шрифты/отступы), чтобы всё помещалось плотнее. */
.cst-stats { padding: 8px 10px; gap: 8px; }
.cst-stats .vst-filters { gap: 6px 8px; padding: 6px 8px; }
.cst-stats .vst-filter { gap: 1px; font-size: 10.5px; }
.cst-stats .vst-filter select, .cst-stats .vst-filter input { padding: 2px 6px; font-size: 11.5px; min-width: 100px; max-width: 200px; }
.cst-stats .vst-search input { min-width: 180px; }
.cst-stats .vst-reset { padding: 3px 10px; font-size: 11.5px; }
.cst-stats .vst-tiles { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 6px; }
.cst-stats .vst-tile { padding: 5px 10px; }
.cst-stats .vst-tile-label { font-size: 10.5px; gap: 5px; }
.cst-stats .vst-dot { width: 7px; height: 7px; }
.cst-stats .vst-tile-value { font-size: 19px; margin-top: 0; }
.cst-stats .vst-tile-of { font-size: 12px; margin-left: 4px; }
.cst-stats .vst-tile-sub { font-size: 10.5px; }
.cst-stats .vst-card { padding: 6px 10px 4px; }
.cst-stats .vst-card-head { gap: 10px; margin-bottom: 4px; font-size: 11px; }
.cst-stats .vst-card-title { font-size: 12px; }
.cst-stats .cst-note { margin: 0 2px; font-size: 10.5px; line-height: 1.35; }
.cst-warn { color: var(--warn); font-weight: 600; }
.cst-error { color: var(--danger); }
.cst-tile-free { border-left: 4px solid #22c55e; }
.cst-tile-bad { border-left: 4px solid var(--danger); }
.cst-progress { height: 6px; border-radius: 999px; background: #dcfce7; overflow: hidden; border: 1px solid var(--border); }
.cst-progress-bar { height: 100%; background: #2563eb; transition: width .2s ease; }
.cst-group-wrap { max-height: 420px; overflow: auto; }
table.dt.cst-group-table { width: 100%; }
table.dt.cst-group-table td, table.dt.cst-group-table th { padding: 2px 6px; font-size: 11.5px; }
table.dt.cst-group-table th { position: sticky; top: 0; z-index: 1; }
table.dt.cst-group-table td:nth-child(n+2):nth-child(-n+5), table.dt.cst-group-table th:nth-child(n+2):nth-child(-n+5) { text-align: right; white-space: nowrap; }
table.dt.cst-group-table tbody tr { cursor: pointer; }
table.dt.cst-group-table tbody tr:hover td { background: var(--accent-soft-2); }
.cst-mini { position: relative; width: 140px; height: 12px; border-radius: 3px; background: #dcfce7; overflow: hidden; }
.cst-mini-bar { height: 100%; background: #60a5fa; }
.cst-mini span { position: absolute; inset: 0; font-size: 10px; line-height: 12px; text-align: center; color: var(--text); }
.cst-txt-free { color: #15803d; font-weight: 600; }
.cst-txt-bound { color: #1d4ed8; font-weight: 600; }
.cst-txt-conflict { color: #b91c1c; font-weight: 600; }
.cst-conflicts { max-height: 300px; overflow: auto; }
table.dt.cst-conflict-table td, table.dt.cst-conflict-table th { padding: 2px 6px; font-size: 11.5px; }
.cst-focus { padding: 1px 6px; font-size: 10.5px; margin: 0; }
.cst-group-hint { font-size: 10.5px; }
.cst-groupby { flex-direction: row; align-items: center; gap: 6px; }
.cst-detail table.dt td, .cst-detail table.dt th { padding: 2px 6px; font-size: 11.5px; }
.cst-detail .dt-toolbar { padding: 3px 8px; }
table.dt.cable-table .cable-pick-btn:disabled { border-color: var(--border-strong); color: var(--muted); background: transparent; cursor: not-allowed; }
table.dt.cable-table .cable-pick-btn.cable-pick-mine { background: #2563eb; color: #fff; border-color: #2563eb; }

/* Окно привязки рабочей документации (п. 91a) — оформление как у «Поиск по схеме»:
   фикс. стартовый размер (высота 70vh, как у окна поиска) + растягивание за угол;
   все колонки видны без горизонтальной прокрутки (table-layout: fixed, ширины —
   colgroup в rdpicker.js, обрезка — ellipsis, полный текст ячейки — в title). */
.rd-modal {
  width: min(1800px, 94vw); height: 70vh;
  min-width: 520px; min-height: 340px; max-width: 98vw; max-height: 96vh;
  resize: both;
}
.rd-modal .ru-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rd-modal-x { width: 28px; height: 28px; font-size: 18px; line-height: 1; }
.rd-modal-filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 10px 18px; border-bottom: 1px solid var(--border);
}
.rd-modal-filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); flex: 1; min-width: 140px; }
.rd-modal-filters input { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; }
.rd-modal-filters input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.rd-modal-filters .rd-f-clear { padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; }
.rd-table-wrap { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; margin: 10px 18px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.dt.rd-table { table-layout: fixed; width: 100%; min-width: 0; }
table.dt.rd-table td, table.dt.rd-table th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; padding: 4px 8px; }
table.dt.rd-table th { font-size: 10.5px; white-space: normal; }   /* шапка переносится, как в окне поиска */
table.dt.rd-table th:first-child, table.dt.rd-table td:first-child { text-align: center; }
.rd-modal-count { padding: 6px 18px; font-size: 12px; }
.rd-linked-actions { flex-wrap: wrap; justify-content: flex-start; }
.rd-linked-actions .ru-cancel { margin-left: auto; }
.btn-rd-green { background: #28a745 !important; color: #fff !important; border-color: #28a745 !important; font-weight: 600; }
.btn-rd-red { background: #dc3545 !important; color: #fff !important; border-color: #dc3545 !important; font-weight: 600; }
.rd-view { padding: 3px 8px; font-size: 11px; cursor: pointer; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel); }
.rd-already { color: #28a745; font-weight: 700; }

/* Окно «Убрать связь» (modules/unlinkTypeMark.js) — стиль окна поиска, чекбоксы разрыва связи. */
.unlink-modal {
  width: min(1500px, 94vw); height: 72vh;
  min-width: 560px; min-height: 360px; max-width: 98vw; max-height: 96vh;
  resize: both;
}
.unlink-modal .ru-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.unlink-x { width: 28px; height: 28px; font-size: 18px; line-height: 1; }
.unlink-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.unlink-search { flex: 1; min-width: 220px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; }
.unlink-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.unlink-clear-f { padding: 7px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; }
.unlink-count { font-size: 12px; margin-left: auto; }
.unlink-table-wrap { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; margin: 10px 18px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.dt.unlink-table { table-layout: fixed; width: 100%; min-width: 0; }
table.dt.unlink-table td, table.dt.unlink-table th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; padding: 4px 8px; vertical-align: top; }
table.dt.unlink-table th { font-size: 10.5px; white-space: normal; }
table.dt.unlink-table th.unlink-cbh, table.dt.unlink-table td.unlink-cbc { text-align: center; overflow: visible; }
table.dt.unlink-table th .unlink-cf { display: block; width: 100%; box-sizing: border-box; margin-top: 3px; padding: 2px 5px; font-size: 10px; font-weight: 400; border: 1px solid var(--border); border-radius: 3px; }
.unlink-modal .ru-modal-actions { justify-content: flex-start; flex-wrap: wrap; align-items: center; }
.unlink-modal .ru-cancel { margin-left: auto; }
/* Первичная кнопка: .ru-modal-actions button (0,1,1) перебивает .btn-primary — задаём явно с !important. */
.unlink-do { background: var(--accent) !important; color: #fff !important; border-color: var(--accent) !important; font-weight: 600; }
.unlink-do:disabled { opacity: .5; cursor: default; }
.unlink-all-project { background: #fff4f4 !important; color: #b3261e !important; border-color: #f3b4ad !important; font-weight: 600; }
.unlink-msg { font-size: 12px; }
.cable-pick-btn { padding: 2px 10px; border: 1px solid var(--accent); color: var(--accent); background: var(--panel); border-radius: 4px; cursor: pointer; }
.cable-pick-btn:hover { background: var(--accent-soft); }
.attr-cable { display: flex; gap: 4px; }
.attr-cable input { flex: 1; min-width: 0; }

/* Секция-разделитель в панели атрибутов («— Кабель —») */
.attr-table tr.attr-section td {
  font-weight: 700; font-size: 10px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--muted);
  background: transparent; padding: 12px 12px 4px;
  border-top: 1px solid var(--border);
}
.attr-table tr.attr-section .attr-rd-cable {
  float: right; margin-top: -3px; font-size: 11px; padding: 3px 8px;
  text-transform: none; letter-spacing: 0; font-weight: 500;
  border: 1px solid var(--accent); color: var(--accent); background: var(--panel); border-radius: var(--radius-sm); cursor: pointer;
}
.attr-table tr.attr-section .attr-rd-cable:hover { background: var(--accent); color: #fff; }
.attr-table tr.attr-ports-head { cursor: pointer; }
.attr-table tr.attr-ports-head:hover td { color: var(--accent); }
.attr-ports-caret { display: inline-block; width: 12px; color: var(--accent); }
/* Кнопки портов: «+ Слева/+ Справа» и под ними «− Слева/− Справа», компактные */
.attr-port-btns { float: right; display: flex; flex-direction: column; gap: 3px; margin: -3px 0 2px 8px; }
.attr-port-btnrow { display: flex; gap: 4px; justify-content: flex-end; }
.attr-port-btnrow .attr-port-add, .attr-port-btnrow .attr-port-del {
  font-size: 10.5px; line-height: 1.4; padding: 1px 7px; min-height: 0;
  text-transform: none; letter-spacing: 0; font-weight: 500;
}

table.dt, .data-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
  width: max-content;
  min-width: 100%;
}
table.dt th, .data-table th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  border-bottom: 2px solid var(--border-strong);
  border-right: 1px solid var(--border);
  padding: 5px 9px;
  z-index: 2;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  /* Заголовок можно ужать уже текста — текст обрезается, а не распирает колонку. */
  overflow: hidden;
  text-overflow: ellipsis;
}
.th-name { cursor: pointer; }
/* перетаскиваемая граница колонки (ресайз ширины) */
.dt-resizer {
  position: absolute; top: 0; right: 0; width: 6px; height: 100%;
  cursor: col-resize; user-select: none; touch-action: none; z-index: 3;
}
.dt-resizer:hover { background: var(--accent-soft-2); }
/* Чекбокс-фильтр колонки (selectFilterCols в DataTable) */
table.dt th:has(.dt-msel) { overflow: visible; }   /* меню не клипается th (overflow:hidden) */
.dt-msel { position: relative; margin-top: 5px; }
.dt-msel-btn {
  width: 100%; padding: 5px 8px; text-align: left; cursor: pointer;
  border: 1px solid var(--border-strong); border-radius: 0; background: var(--panel);
  font-size: 11px; font-weight: 400; color: var(--muted);
}
.dt-msel-btn.dt-msel-active { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.dt-msel-menu {
  position: absolute; top: 100%; left: 0; z-index: 40;
  min-width: 210px; max-height: 260px; overflow: auto;
  display: flex; flex-direction: column; gap: 2px; padding: 6px;
  background: var(--panel); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-md);
}
.dt-msel-menu.hidden { display: none; }
.dt-msel-menu label {
  display: flex; gap: 6px; align-items: center; cursor: pointer;
  font-size: 11.5px; font-weight: 400; white-space: nowrap;
}
.dt-msel-menu .dt-msel-clear {
  padding: 3px 6px; margin-bottom: 4px; cursor: pointer; font-size: 10.5px;
  border: 1px solid var(--border); border-radius: 4px; background: var(--panel-2);
}
.dt-msel-empty { color: var(--muted); font-size: 11px; }
/* Фильтры колонок — прямоугольные рамки (без скругления). */
.col-filter {
  width: 100%; margin-top: 5px; padding: 6px 10px;
  border: 1px solid var(--border-strong); border-radius: 0;
  font-size: 12.5px; font-weight: 400; background: var(--panel);
}
.col-filter:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
/* Плейсхолдер «фильтр» во всех таблицах — чуть светлее и на 1pt мельче поля */
.col-filter::placeholder { color: #b4bcc8; opacity: 1; font-size: 11.5px; }

table.dt td, .data-table td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 5px 9px;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}
table.dt tbody tr:nth-child(even), .data-table tbody tr:nth-child(even) { background: var(--panel-2); }
table.dt tbody tr:hover, .data-table tbody tr:hover { background: var(--accent-soft); }

/* Окно БД — мелкий шрифт и плотность как в окне «Поиск по схеме» */
#page-database table.dt { font-size: 11px; }
#page-database table.dt th { font-size: 10.5px; padding: 4px 8px; }
#page-database table.dt td { padding: 4px 8px; }
/* данные БД одинаковы во всех колонках (как в «Тип»): редактируемые ячейки тем же размером/шрифтом */
#page-database table.dt .dt-edit { font-size: 11px; font-family: inherit; }
/* РД: единый размер шрифта во всех колонках (как «KKS объекта» = 11px), … */
#page-docs table.dt td, #page-docs table.dt .dt-edit { font-size: 11px; }
/* … кроме «KKS оборудования» — она на 2pt мельче (9px), как раньше. */
#page-docs table.dt td[data-col="KKS оборудования"] { font-size: 9px; }
/* РД: подсветка выбранной строки — цветом кнопки «Сохранить» (акцент), а не тёмно-синим */
#page-docs table.dt tbody tr.dt-row-selected td { background: var(--accent) !important; }
/* РД: «Просмотр» — зелёная, «Редактировать» — жёлтая (как «Добавить документ» зелёная) */
#page-docs .row-actions { white-space: nowrap; }
.row-actions .docs-view-btn { background: #e9f7ef; color: #15803d; border-color: #bfe6cf; }
.row-actions .docs-view-btn:hover { background: #d6f0e0; }
.row-actions .docs-edit-btn { background: #fef9e7; color: #a16207; border-color: #f0e2a6; }
.row-actions .docs-edit-btn:hover { background: #fbf1c9; }
/* БД/Кабельный журнал: скроллит сам .dt-scroll (липкие заголовки + видимый гор. ползунок),
   как в РД — внешний .sub-page не должен перехватывать прокрутку */
#page-database .sub-page[data-sub="grid"],
#page-cables .sub-page[data-sub="project"] { overflow: hidden; }

/* Меньше отступ в ячейках с полем ввода (обводом) — БД/РД и пр. */
table.dt td:has(.dt-edit) { padding: 1px 3px; }
table.dt td:has(.dt-edit) .dt-edit { padding: 3px 6px; }

/* «Сохранить» в панели таблицы — синий (иначе .dt-toolbar button делал белый текст на белом) */
.dt-toolbar .dt-save { background: var(--accent); color: #fff; border-color: var(--accent); }
.dt-toolbar .dt-save:hover { background: var(--accent-hover); }
/* «Загрузить ВОР (Excel)» в тулбаре вкладки «Ведомость» — та же готча, что у .dt-save */
.dt-toolbar .vor-import-btn { background: var(--accent); color: #fff; border-color: var(--accent); }
.dt-toolbar .vor-import-btn:hover { background: var(--accent-hover); }

/* --- РД: кнопки и встроенная панель таблицы --- */
.docs-toolbar .btn-secondary { padding-top: 4px; padding-bottom: 4px; }
.docs-add { background: #e9f7ef; color: #15803d; border-color: #bfe6cf; }
.docs-add:hover { background: #d6f0e0; }
.docs-del:not([disabled]) { background: #fdecec; color: #b91c1c; border-color: #f3cccc; }
.docs-del:not([disabled]):hover { background: #fbdcdc; }
/* панель таблицы (Строк/стрелки/CSV/Excel) встроена в линию кнопок — без своей рамки/паддингов */
.docs-dt-toolbar { display: inline-flex; align-items: center; }
.docs-dt-toolbar .dt-toolbar { padding: 0; border: none; background: transparent; }
/* РД: колонки вмещаются в ширину экрана без гор. прокрутки (fixed-раскладка, ellipsis) */
#page-docs table.dt, #page-docs .data-table { table-layout: fixed; width: 100%; min-width: 0; }
/* РД: данные ещё мельче (10px), ниже строки, плотные ячейки ввода (верх/низ как лево/право) */
#page-docs table.dt td { font-size: 10px; padding: 2px 9px; }
#page-docs table.dt td:has(.dt-edit) { padding: 1px 3px; }
#page-docs table.dt td:has(.dt-edit) .dt-edit { padding: 1px 6px; }
table.dt tbody tr.clickable { cursor: pointer; }
/* выбранная строка (клик) — тёмно-синяя, поверх hover */
table.dt tbody tr.dt-row-selected td, .data-table tbody tr.dt-row-selected td {
  background: #1e3a8a !important; color: #fff;
}
table.dt tbody tr.dt-row-selected .dt-edit { color: #fff; }
.row-actions button { margin-right: 6px; padding: 4px 10px; font-size: 11px; cursor: pointer; border: 1px solid var(--border-strong); border-radius: 5px; background: var(--panel); }
.row-actions button:hover { background: var(--accent-soft); }
/* Ячейки ввода не выделяются обводом: прозрачные, как обычные. Курсор — текстовый (не «рука»).
   Обвод появляется только при наведении (как было), при фокусе — акцент. */
.dt-edit {
  width: 100%; border: 1px solid transparent; border-radius: 5px;
  padding: 4px 6px; font-size: 12px; background: transparent; color: inherit; cursor: text;
}
.dt-edit:hover { border-color: var(--border-strong); background: var(--panel); }
.dt-edit:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft-2); }

/* --- документация --- */
.docs-wrap { flex: 1; display: flex; min-height: 0; }
.docs-table { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.docs-viewer { width: 0; border-left: 1px solid var(--border); display: flex; flex-direction: column; transition: width .2s; overflow: hidden; }
.docs-viewer.open { width: 45%; }
.docs-viewer-head { padding: 8px 12px; background: var(--panel-2); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.docs-frame { flex: 1; border: none; }
.docs-inner-tabs { border-top: none; padding-top: 0; }
.docs-filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 5px 12px; background: var(--panel); border-bottom: 1px solid var(--border); }
.docs-filters input {
  flex: 1 1 100px; font-size: 12.5px; padding: 6px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel);
}
.docs-filters input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
/* Окно добавления/редактирования документа — как типовые окна сайта (.app-dialog) */
.docs-dialog { border: none; border-radius: 14px; padding: 0; min-width: 440px; max-width: min(640px, 96vw); width: 96%; box-shadow: var(--shadow-lg); }
.docs-dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.docs-form { padding: 22px 24px; }
.docs-form-title { margin: 0 0 8px; font-size: 16px; }
.docs-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0; }
.docs-form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
.docs-form-grid input { padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; }
.docs-form-grid input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.docs-file-label { display: block; margin: 4px 0 0; font-size: 13px; color: var(--muted); }
/* --- Диалог «Выбор Тип_марка» --- */
.attr-tm { display: flex; gap: 4px; align-items: center; }
.attr-tm-pick { flex: 0 0 auto; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: 5px;
  background: var(--panel); cursor: pointer; font-weight: 700; line-height: 1; }
.attr-tm-pick:hover { background: var(--accent-soft); }
.tmp-dialog { border: none; border-radius: 12px; padding: 0; width: min(1500px, 96vw); height: min(900px, 94vh);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
  resize: both; min-width: 640px; min-height: 440px; max-width: 99vw; max-height: 98vh; }
.tmp-dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.tmp-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px;
  border-bottom: 1px solid var(--border); }
.tmp-title { font-weight: 600; font-size: 15px; }
.tmp-close { background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.tmp-top { display: grid; grid-template-columns: 3fr 2fr 2fr; gap: 8px; padding: 8px 12px; }
.tmp-top > div { padding: 8px 10px; border-radius: 6px; font-size: 11px; overflow: auto; max-height: 130px; }
.tmp-desc { background: #f0f8ff; border: 1px solid #a0d0ff; }
.tmp-selected { background: #f8f9fa; border: 1px solid var(--border); }
.tmp-labor { background: #e9f7ef; border: 1px solid #c3e6cb; }
.tmp-filters { display: flex; gap: 8px; align-items: center; padding: 4px 12px; }
.tmp-filters select, .tmp-filters input { padding: 5px 8px; border: 1px solid var(--border-strong);
  border-radius: 5px; font-size: 12px; }
.tmp-body { flex: 1; display: flex; gap: 0; padding: 8px 12px 4px; min-height: 0; }
.tmp-left { flex: 0 0 520px; overflow: auto; border: 1px solid var(--border); border-radius: 6px; }
.tmp-right { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.tmp-rates { flex: 3; display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: 6px; }
.tmp-tests { flex: 2; display: flex; flex-direction: column; min-height: 0; border: 1px solid var(--border); border-radius: 6px; }
.tmp-splitter-v { flex: 0 0 8px; cursor: col-resize; align-self: stretch; }
.tmp-splitter-h { flex: 0 0 8px; cursor: row-resize; }
.tmp-splitter-v:hover, .tmp-splitter-h:hover { background: var(--accent-soft-2); border-radius: 3px; }
.tmp-col-grip { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; user-select: none; touch-action: none; }
.tmp-col-grip:hover { background: var(--accent-soft-2); }
.tmp-rates-toolbar, .tmp-tests-head { display: flex; gap: 8px; align-items: center; padding: 6px 8px;
  border-bottom: 1px solid var(--border); background: var(--panel-2); font-size: 12px; }
.tmp-rates-toolbar button { padding: 3px 10px; border: 1px solid var(--border-strong); border-radius: 5px;
  background: var(--panel); cursor: pointer; font-size: 11px; }
.tmp-rates-host, .tmp-tests-host { flex: 1; overflow: auto; }
.tmp-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.tmp-table th, .tmp-table td { border: 1px solid var(--border); padding: 2px 5px; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tmp-table thead th { position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
.tmp-row { cursor: pointer; }
.tmp-row:hover { background: var(--accent-soft); }
.tmp-row.tmp-active { background: #c7dbfe; }
.tmp-cb, .tmp-qty { text-align: center; }
.tmp-qty input { width: 48px; text-align: center; padding: 1px 3px; }
.tmp-rc { width: 100%; min-width: 60px; border: 1px solid transparent; background: transparent; padding: 1px 3px; font-size: 11px; }
.tmp-rc:focus { border-color: var(--accent); background: #fff; outline: none; }
.tmp-rates-table tr.tmp-active td { background: #eef4ff; }
.tmp-total { text-align: right; font-variant-numeric: tabular-nums; background: var(--panel-2); }
.tmp-actions { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--border); }
.tmp-clear { padding: 8px 18px; border: none; border-radius: 6px; background: #fd7e14; color: #fff; font-weight: 600; cursor: pointer; }
.tmp-ok { padding: 8px 26px; }
.tmp-cancel { padding: 8px 18px; }
/* Просмотр архива: список вложенных файлов */
.docs-archive-dialog { border: none; border-radius: 14px; padding: 0; min-width: 460px; max-width: min(720px, 96vw); width: 96%; box-shadow: var(--shadow-lg); }
.docs-archive-dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.docs-archive-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.docs-archive-title { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs-archive-close { background: none; border: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--muted); }
.docs-archive-body { padding: 8px 18px 18px; max-height: 60vh; overflow: auto; }
.docs-archive-table { width: 100%; border-collapse: collapse; }
.docs-archive-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); font-size: 13px; }
.docs-archive-table td.ar-name { word-break: break-all; }
.docs-archive-table td.ar-size { color: var(--muted); white-space: nowrap; text-align: right; }
.docs-archive-table .ar-view { padding: 3px 12px; border-radius: 5px; border: 1px solid #bfe6cf; cursor: pointer; background: #e9f7ef; color: #15803d; }
.docs-archive-table .ar-view:hover { background: #d6f0e0; }
.docs-form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
/* Линия прогресса загрузки файла на сервер (форма РД; переиспользуется в слотах РПК) */
.docs-upload-progress { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.docs-upload-bar { flex: 1; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.docs-upload-bar-fill { height: 100%; width: 0; background: #2563eb; border-radius: 4px; transition: width .15s linear; }
.docs-upload-pct { font-size: 12px; color: var(--muted); min-width: 130px; text-align: right; white-space: nowrap; }
.pnd-inner-tabs { border-top: none; padding-top: 0; }
tr.row-ok td { background: #eefaf0; }
.ana-report-dialog { border: 1px solid var(--border); border-radius: 8px; padding: 0; max-width: 900px; width: 96%; }
.ana-report-dialog::backdrop { background: rgba(0,0,0,.35); }
.ana-report-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--panel-2); }
.ana-report-body { margin: 0; padding: 16px; max-height: 60vh; overflow: auto; white-space: pre-wrap; font-size: 13px; line-height: 1.45; }

/* --- версии схемы --- */
.ver-dialog { max-width: 960px; width: 96%; padding: 0; }
.ver-dialog::backdrop { background: rgba(0,0,0,.35); }
.ver-dialog-inner { padding: 16px 20px 20px; }
.ver-dialog-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ver-dialog-head h3 { margin: 0; font-size: 1.05rem; }
.ver-hint { font-size: 12px; margin: 0 0 8px; }
.ver-table-wrap { max-height: 42vh; overflow: auto; border: 1px solid var(--border); border-radius: 6px; margin: 8px 0; }
.ver-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
/* Сводка последней операции (удаление/восстановление): статус-бар главного окна
   скрыт за модалкой, поэтому результат показываем прямо в диалоге. */
.ver-status {
  margin: 0 0 8px; padding: 8px 10px; font-size: 12.5px;
  border-radius: var(--radius-sm, 6px); border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 88%, #16a34a 12%);
}
.ver-status.hidden { display: none; }
.ver-restore { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.ver-restore select { flex: 1 1 200px; min-width: 180px; }
/* Вкладки окна версий («Версии» / «Диск») */
.ver-tabs { display: flex; gap: 4px; margin: 0 0 10px; border-bottom: 1px solid var(--border); }
.ver-tab { border: none; background: none; padding: 6px 14px; cursor: pointer;
  color: var(--muted); border-bottom: 2px solid transparent; font-size: 13px; }
.ver-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.ver-pane.hidden { display: none; }
/* Вкладка «Диск» */
.ver-pane-disk { max-height: 62vh; overflow: auto; }
.disk-summary { margin: 4px 0 6px; }
.disk-summary.disk-warn { color: #c62828; font-weight: 600; }
.disk-bar { height: 8px; border-radius: 4px; background: var(--border); overflow: hidden; margin: 0 0 10px; }
.disk-bar-fill { height: 100%; background: var(--accent); }
.disk-bar-fill.warn { background: #c62828; }
.disk-cat { margin: 12px 0; }
.disk-cat h4 { margin: 0 0 6px; font-size: 13px; }
.disk-table { width: 100%; }
.disk-table td, .disk-table th { padding: 3px 8px; }
.disk-num { white-space: nowrap; text-align: right; }
.disk-del-backup { padding: 2px 8px; font-size: 12px; }
.search-item.conn { border-left: 3px solid var(--accent); }

/* --- детальная панель --- */
.detail-panel { border-top: 2px solid var(--accent); max-height: 45%; display: flex; flex-direction: column; background: var(--panel); }
.detail-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--panel-2); border-bottom: 1px solid var(--border); }
.detail-title { flex: 1; font-weight: 650; }
.detail-body { flex: 1; overflow: auto; min-height: 120px; }

/* --- деревья отчётов --- */
.tree-table tr.tree-pnr { background: var(--accent-soft-2); font-weight: 600; }
.tree-table tr.tree-pnr:hover { background: #c7dbfe; }
.tree-table tr.tree-child td:first-child { padding-left: 26px; }
.tree-host { overflow: auto; padding: 12px; }
.tree-toolbar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 10px; padding: 0 4px;
}
.tree-scroll { overflow: auto; max-height: calc(100vh - 220px); }
.tree-table tr.tree-filters th { padding: 4px 6px; background: var(--bg-2); }
.tree-table .tree-filter {
  width: 100%; min-width: 48px; font-size: 12px; padding: 4px 6px;
  border: 1px solid var(--border); border-radius: 4px;
}
.tree-table .tree-toggle {
  display: inline-block; width: 14px; cursor: pointer;
  transition: transform .15s; font-size: 10px;
}
.tree-table .tree-toggle.collapsed { transform: rotate(-90deg); }
.tree-table tr.tree-pnr { cursor: pointer; }

/* Реестр подтипов — split-панели */
.reg-split {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(260px, 2fr);
  gap: 12px;
  padding: 0 12px 12px;
  min-height: 360px;
}
.reg-split.reg-tests { grid-template-columns: minmax(280px, 1fr) minmax(400px, 3fr); }
.reg-split-col { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; }
.reg-split-wide { min-width: 0; }
.reg-split-head {
  padding: 8px 10px; font-weight: 600; background: var(--bg-2);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.reg-list { list-style: none; margin: 0; padding: 4px; overflow: auto; flex: 1; max-height: 420px; }
.reg-list li {
  padding: 6px 8px; border-radius: 4px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
}
.reg-list li:hover { background: var(--accent-soft-2); }
.reg-list li.active { background: #c7dbfe; font-weight: 600; }
.reg-li-actions button { border: none; background: none; cursor: pointer; padding: 2px 4px; opacity: .7; }
.reg-li-actions button:hover { opacity: 1; }
.reg-registry-view { padding: 8px; overflow: auto; flex: 1; max-height: 420px; font-size: 13px; }
.reg-kind { margin-bottom: 10px; }
.reg-kind ul { margin: 4px 0 0 16px; }
.test-marks tr.active { background: #c7dbfe; }
@media (max-width: 900px) {
  .reg-split { grid-template-columns: 1fr; }
}

.analysis-wrap { padding: 16px; overflow: auto; }
.muted { color: var(--muted); font-size: 12px; }
.sub-page, #page-project .sub-page { flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: auto; }

/* --- контекстное меню (схема) --- */
.context-menu {
  position: fixed;
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 400;
  padding: 6px;
}
.context-menu button {
  display: flex;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  border-radius: var(--radius-sm);
  color: var(--text);
}
.context-menu button:hover { background: var(--accent-soft); color: var(--accent-hover); }
.context-menu button[disabled] { color: var(--border-strong); cursor: default; }
.context-menu button[disabled]:hover { background: transparent; color: var(--border-strong); }
.context-menu .menu-sep { margin: 5px 4px; }
.context-menu kbd { color: var(--muted); font-size: 11px; }
.context-menu button.danger:hover { background: #ff5a5a; color: #fff; }

/* --- индикатор загрузки --- */
.dt-loading, .module-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 28px;
  color: var(--muted);
  font-size: 13px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--accent-soft-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- диалоги --- */
.app-dialog {
  border: none;
  border-radius: 14px;
  padding: 0;
  min-width: 440px;
  box-shadow: var(--shadow-lg);
}
.app-dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
/* Контроль качества → очистка «потеряшек»: отчёт «что удалится» + кнопка удаления */
.drc-rule-head .drc-clean { margin-left: 12px; font-size: 12px; font-weight: 400; }
.drc-clean-dlg { width: min(1080px, 94vw); max-height: 88vh; overflow: auto; }
.drc-clean-dlg h3 { display: flex; align-items: center; gap: 10px; margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 15px; }
.drc-clean-dlg h3 .dlg-close { margin-left: auto; background: none; border: none; font-size: 16px; cursor: pointer; color: var(--muted); }
.drc-clean-dlg h4 { margin: 14px 0 6px; font-size: 12.5px; }
.drc-clean-body { padding: 14px 20px 20px; font-size: 13px; }
.drc-clean-facts { margin: 8px 0 4px; padding-left: 20px; line-height: 1.7; }
.drc-clean-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.drc-clean-cols .cl-hist td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.drc-clean-samples { margin-top: 4px; font-size: 11.5px; }
.drc-clean-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.drc-clean-actions label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.dialog-form { padding: 22px 24px; }
.dialog-form h3 { margin: 0 0 8px; font-size: 16px; }
.dialog-form label { display: block; margin: 14px 0 5px; font-size: 12px; color: var(--muted); font-weight: 500; }
.dialog-form input, .dialog-form textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
}
.dialog-form input:focus, .dialog-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* --- диалог поиска (вынесен из шапки) --- */
/* фикс. стартовый размер (окно не «прыгает» при перелистывании) + растягивание за угол */
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog {
  width: min(1800px, 94vw); height: 70vh;
  min-width: 520px; min-height: 340px; max-width: 98vw; max-height: 96vh;
  resize: both; overflow: hidden;
}
.search-dialog .dialog-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.search-dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.search-dlg-head h3 { margin: 0; }
.search-dlg-x { width: 28px; height: 28px; font-size: 18px; line-height: 1; }
.search-dlg-controls { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 14px 0 12px; }
.search-dlg-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.search-dlg-value-wrap { flex: 1; min-width: 220px; }
.search-dlg-controls select, .search-dlg-controls input {
  padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel); font-size: 13px; min-width: 200px;
}
.search-dlg-controls select:focus, .search-dlg-controls input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2);
}
.search-dlg-controls .btn-primary { flex: none; }
/* область результатов растёт вместе с окном; ширины колонок — перетаскиванием (storageKey) */
.search-dlg-results { flex: 1; min-height: 0; overflow: hidden; }
/* height (не max-height): при фильтрации таблица не сжимается под 2 строки —
   высота стабильна, оставшееся место просто пустое. */
.search-dlg-results .dt-scroll { height: 100%; max-height: 100%; }
.search-dlg-results table.dt { font-size: 11px; }
.search-dlg-results table.dt th { font-size: 10.5px; padding: 4px 8px; white-space: normal; }
.search-dlg-results table.dt td { padding: 4px 8px; }
/* строка итога над таблицей: «Найдено: N · … мс» или «Поиск…» при повторном поиске */
.search-dlg-summary {
  display: flex; align-items: center; gap: 6px; flex: none;
  margin: -4px 0 6px; font-size: 12px; color: var(--muted);
}
.search-dlg-summary:empty { display: none; }
.search-dlg-summary .spinner { width: 12px; height: 12px; border-width: 2px; }
/* подсветка совпадения: полупрозрачная — текст читается на любом фоне строки */
.search-dlg-results mark { background: rgba(250, 204, 21, .38); color: inherit; border-radius: 2px; }

#page-cables { padding: 0; }
#page-docs, #page-statements, #page-acts, #page-registry { display: flex; flex-direction: column; }

.cj-hint { margin: 8px 12px 4px; font-size: 12px; }
.cj-sheets-toolbar { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 12px 6px; }
.cj-sheets-panel { max-height: 150px; overflow: auto; margin: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.cj-sheets-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.cj-sheets-table th, .cj-sheets-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.cj-sheets-table tr.sheet-excluded td:last-child { font-style: italic; text-decoration: line-through; color: var(--muted); }
.cj-sheets-summary, .cj-scheme-summary { margin: 4px 12px; font-size: 12px; }
.cj-scheme-summary { background: #f4f6f8; padding: 6px 8px; border-radius: 4px; }
.cj-scheme-table { padding: 0 8px 8px; }

.analysis-subhead { margin: 16px 12px 6px; font-size: 14px; }
.ctrl-summary, .analysis-cable-rd, .analysis-fill, .analysis-form { padding: 0 12px 12px; }
.fill-badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; margin-right: 4px; }
.fill-badge.fill-ok { background: #dcfce7; color: #166534; }
.fill-badge.fill-bad { background: #fee2e2; color: #991b1b; }
.ctrl-summary .cmp-summary-table { margin-top: 8px; }
/* Контроль (перенесён в «Ведомости»): текст −1pt, KKS оборудования −2pt,
   перенос строк только в KKS оборудования, остальные — в одну строку */
.ctrl-host table.dt, .ctrl-host table.dt .dt-edit { font-size: 11.5px; }
.ctrl-host table.dt td, .ctrl-host table.dt th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctrl-host table.dt td[data-col="KKS оборудования"] { white-space: normal; overflow: visible; font-size: 10.5px; }
.analysis-cable-rd .dt-scroll { max-height: 280px; }

.cj-prestats-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 12px; }
.cj-prestats-split { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(320px, 2fr); gap: 12px; padding: 0 12px 12px; min-height: 360px; }
.cj-prestats-left, .cj-prestats-right { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ps-filters { display: flex; flex-direction: column; gap: 4px; }
.ps-filters input { font-size: 12px; padding: 4px 8px; }
.ps-journals { flex: 1; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 420px; }
.ps-journals-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.ps-journals-table th, .ps-journals-table td { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: left; }
.ps-summary { background: #f4f6f8; padding: 8px; border-radius: 4px; font-size: 13px; white-space: pre-wrap; }
.ps-mode0-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; }
.ps-mode0-list li { padding: 6px 8px; border-radius: 4px; margin-bottom: 4px; font-size: 12px; }
.ps-st-full { background: #d1e7dd; color: #0f5132; }
.ps-st-partial { background: #fff3cd; color: #664d03; }
.ps-st-none { background: #f8d7da; color: #842029; }
.ps-st-empty { background: #f8f9fa; color: #6c757d; }
.dt tr.row-linked td { background: #d1e7dd !important; }
.dt tr.row-warn td { background: #fff3cd !important; }
.dt tr.row-danger td { background: #f8d7da !important; color: #842029; }

@media (max-width: 900px) {
  .cj-prestats-split { grid-template-columns: 1fr; }
}

/* --- ведомости (StatementDialog) --- */
/* Блок формирования растянут по высоте окна (левая панель поиска ПНР — во всю высоту).
   Высота фиксирована по вьюпорту: кнопки «Сформировать»/«Записать в базу» всегда внизу
   без прокрутки страницы (списки скроллятся внутри своих обёрток). */
.stmt-form-layout { display: grid; grid-template-columns: minmax(340px, 560px) 1fr; gap: 0; height: max(420px, calc(100vh - 205px)); }
.stmt-form-side { padding: 12px; border-right: 1px solid var(--border); background: var(--panel); display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.stmt-filters { display: flex; flex-wrap: wrap; gap: 4px; }
.stmt-filters input { flex: 1 1 80px; min-width: 70px; font-size: 12px; padding: 4px 6px; }
.stmt-hist-table { width: 100%; border-collapse: collapse; font-size: 12px; }
/* ПНР-таблица выбора растягивается на всю высоту панели и скроллится внутри обёртки. */
.stmt-pnr-wrap { flex: 1; min-height: 140px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.stmt-pnr-table { width: 100%; min-width: 525px; border-collapse: collapse; font-size: 11px; table-layout: fixed; }
.stmt-pnr-table th { position: relative; }              /* якорь для .col-resizer */
.stmt-pnr-table thead th { position: sticky; top: 0; z-index: 1; background: var(--panel-2); }
.stmt-pnr-table th, .stmt-pnr-table td { border-right: 1px solid var(--border); }
.stmt-pnr-table th:last-child, .stmt-pnr-table td:last-child { border-right: none; }
.stmt-pnr-table th, .stmt-pnr-table td, .stmt-hist-table th, .stmt-hist-table td {
  padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: left;
}
/* Текст в строках не переносится: одна строка + многоточие (полный текст — в подсказке title). */
.stmt-pnr-table td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stmt-pnr-table tr { cursor: pointer; }
.stmt-pnr-table tr.selected, .stmt-hist-table tr.selected { background: #e8f4ff; }
/* Позиции без элемента с подтипом — сформировать нельзя: тусклые, не выбираются. */
.stmt-pnr-table tr.stmt-pnr-disabled { cursor: default; color: var(--muted); opacity: .55; }
.stmt-pnr-table tr.stmt-pnr-disabled:hover { background: transparent; }
/* Перетаскиваемая граница колонки (ресайз ширины) в ПНР-таблице. */
.col-resizer { position: absolute; top: 0; right: 0; width: 6px; height: 100%; cursor: col-resize; user-select: none; touch-action: none; z-index: 2; }
.col-resizer:hover { background: var(--accent-soft-2); }
.stmt-form-side .btn-primary, .stmt-form-side .btn-secondary { width: 100%; flex-shrink: 0; }
.stmt-form-side .stmt-selected { flex-shrink: 0; }
.stmt-form-table { padding: 12px; overflow: auto; min-height: 0; }
/* Вкладки результата формирования (СВОД / Подробно / Оборудование) */
.stmt-res-tabs { margin-bottom: 8px; }
/* Формирование ВОР — размер текста как в таблице «Общее» (= «Рабочая документация») */
.stmt-form-table table.dt td { font-size: 10px; padding: 2px 9px; }
/* Не переносить текст в ячейках правой таблицы: одна строка + многоточие (полный текст — title). */
.stmt-form-table table.dt td, .stmt-form-table table.dt th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* История: таблица выбранной ведомости — то же оформление, что на «Ведомости» */
.stmt-history-detail table.dt { font-size: 11.5px; }
.stmt-history-detail table.dt td, .stmt-history-detail table.dt th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Справочная сумма трудозатрат в панели таблицы (правее Excel) */
.stmt-labor-sum { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stmt-labor-sum b { color: var(--text); }
/* Реестр подтипов — компактные строки записей: шрифт ещё на 1pt мельче (10.5px)
   и ниже высота; заголовки-группы Тип_марка остаются прежнего размера. */
.vol-host table.dt, .vol-host table.dt .dt-edit { font-size: 10.5px; }
.vol-host table.dt th .th-name { font-size: 11px; }
.vol-host table.dt td { padding: 2px 6px; }
.vol-host table.dt td:has(.dt-edit) { padding: 0 3px; }
.vol-host table.dt .dt-edit { height: 100%; min-height: 20px; box-sizing: border-box; padding: 2px 6px; }
.vol-host table.dt tr.dt-group-head td { font-size: 11.5px; padding: 5px 9px; }
/* Сворачиваемые заголовки-группы в таблице (DataTable groupBy) */
/* Заголовок-группа: обычный (не жирный) шрифт на еле-заметном синем фоне. */
table.dt tr.dt-group-head { cursor: pointer; background: #eff5ff; }
table.dt tr.dt-group-head:hover td { color: var(--accent); }
table.dt tr.dt-group-head td { font-weight: 400; border-top: 1px solid var(--border-strong); white-space: nowrap; }
.dt-group-caret { display: inline-block; width: 14px; color: var(--accent); }
.dt-group-count { color: var(--muted); font-weight: 400; }
/* Реестр подтипов — трёхуровневые заголовки (Вид → Тип → Тип_марка). Иерархия читается
   нейтральной заливкой (не «плоский синий») + левым акцентным баром (inset box-shadow) +
   весом/размером/отступом. Цвет несут только акцентный бар и каретка. */
.vol-host table.dt tr.dt-group-lvl0 td { background: #f3f4f6; font-weight: 700; font-size: 12.5px; color: #111827; border-top: 2px solid #e5e7eb; letter-spacing: .2px; }
.vol-host table.dt tr.dt-group-lvl1 td { background: #f8f9fb; font-weight: 600; font-size: 11.5px; color: #1f2937; border-top: 1px solid #eef1f5; }
.vol-host table.dt tr.dt-group-deep td { background: #fcfdfe; font-weight: 500; font-size: 11px; color: #374151; border-top: 1px solid #f1f3f6; }
/* Левый акцентный бар уровня (только на первой ячейке заголовка). */
.vol-host table.dt tr.dt-group-lvl0 td:first-child { box-shadow: inset 4px 0 0 0 var(--accent); }
.vol-host table.dt tr.dt-group-lvl1 td:first-child { box-shadow: inset 3px 0 0 0 #93b4e8; }
.vol-host table.dt tr.dt-group-deep td:first-child { box-shadow: inset 3px 0 0 0 #d1d5db; }
/* Ховер-подсветка заголовка — после per-level правил (та же специфичность), чтобы срабатывала. */
.vol-host table.dt tr.dt-group-head:hover td { color: var(--accent); }
/* «+» на заголовке Тип_марка — добавляет расценку прямо в этот подтип (только значок). */
.vol-host .dt-group-add { margin-left: 8px; padding: 0 7px; font-size: 13px; font-weight: 600;
  line-height: 1.4; color: var(--accent); background: #fff; border: 1px solid var(--accent-soft-2);
  border-radius: 6px; cursor: pointer; vertical-align: middle; }
.vol-host .dt-group-add:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
/* Описание подтипа на заголовке Тип_марка: «| …» тем же шрифтом, приглушённым цветом. */
.vol-host .dt-group-desc { margin-left: 10px; font-weight: 400; color: var(--muted); }
/* Ячейка-подпись заголовка — не переносится, длинное описание обрезается многоточием
   (полностью — в тултипе title, см. _groupHeadHtml). */
.vol-host table.dt tr.dt-group-head td.dt-group-label { overflow: hidden; text-overflow: ellipsis; }
/* «KKS оборудования» на заголовке Тип_марка — мелкий шрифт как в РД, в одну строку:
   без переноса (высота строки не растёт), лишнее обрезается многоточием, полный
   список — в нативном тултипе (атрибут title, см. _groupHeadHtml в tables.js). */
.vol-host table.dt tr.dt-group-deep td.dt-group-tail {
  font-size: 9px; line-height: 1.3; font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--muted); vertical-align: middle;
}
/* Пустые ячейки «KKS оборудования» на строках-расценках — тот же мелкий шрифт. */
.vol-host table.dt td[data-col="KKS оборудования"] { font-size: 9px; }
.stmt-history-filters { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--border); }
.stmt-history-filters input { flex: 1 1 100px; font-size: 12px; padding: 4px 6px; }
.stmt-history-list { max-height: 200px; overflow: auto; padding: 0 12px; }
.stmt-history-detail { padding: 12px; border-top: 1px solid var(--border); }
/* --- ВОР: «Общее» / «Ведомость» / карточка / «Обновление» (vorPanes.js) --- */
/* Размер текста — как в таблице «Рабочая документация» (#page-docs). */
.stmt-pane[data-stmt="overview"] table.dt td,
.stmt-pane[data-stmt="history"] table.dt td { font-size: 10px; padding: 2px 9px; }
.stmt-pane[data-stmt="overview"] table.dt td, .stmt-pane[data-stmt="overview"] table.dt th,
.stmt-pane[data-stmt="history"] table.dt td, .stmt-pane[data-stmt="history"] table.dt th {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Шапка с чекбокс-фильтром: меню не должно клипаться overflow:hidden выше. */
.stmt-pane[data-stmt="overview"] table.dt th:has(.dt-msel),
.stmt-pane[data-stmt="history"] table.dt th:has(.dt-msel) { overflow: visible; }
.vor-list-wrap .vor-table-host { min-height: 120px; }
.vor-del-row:hover:not(:disabled) { background: #f8d7da; border-color: #dc3545; }
.vor-del-row:disabled { opacity: .55; cursor: not-allowed; }
/* «Работы» → «Перечень»: размер текста — как на вкладке «Общее» ведомостей. */
#page-registry .sub-page[data-sub="works"] table.dt td { font-size: 10px; padding: 2px 9px; }
#page-registry .sub-page[data-sub="works"] table.dt th { font-size: 10.5px; padding: 4px 8px; }
#page-registry .sub-page[data-sub="works"] table.dt .dt-edit { font-size: 10px; }
/* Заливка ячейки «Статус ВОР» (!important — чтобы не перебивалась rowClass row-warn) */
table.dt td.cell-vor-ok { background: #d1e7dd !important; }
table.dt td.cell-vor-warn { background: #fff6bf !important; }   /* светло-жёлтый */
table.dt td.cell-vor-bad { background: #f8d7da !important; }
/* ID ВОР: ссылка = карточка доступна, серый = документа нет */
.vor-link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.vor-link:hover { color: var(--accent-hover); }
.vor-nolink { color: var(--muted); }
/* Бейджи файлов в колонке «Документ» */
.doc-badge {
  display: inline-block; padding: 1px 6px; border-radius: 999px; cursor: pointer;
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  background: #d7e8d0; color: #1d5c2f; border: 1px solid #b5d3ab;
}
.doc-badge.doc-pdf { background: #f6d9d7; color: #8a2a24; border-color: #ecc0bd; }
.doc-badge:hover { filter: brightness(.94); }
/* Кнопки «+XLS»/«+PDF»/«✕» в колонке действий — компактные */
.row-actions .vor-up, .row-actions .vor-del {
  padding: 1px 5px; font-size: 9.5px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--panel); cursor: pointer;
}
.row-actions .vor-up:hover { background: var(--accent-soft); border-color: var(--accent); }
.row-actions .vor-del:hover { background: #f8d7da; border-color: #dc3545; }
/* Карточка ВОР — «погружение» внутри вкладки */
.vor-card-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 12px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.vor-card-title { font-weight: 650; font-size: 13px; }
.vor-card-meta { font-size: 11px; }
.vor-card-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.vor-card-body { padding: 12px; }
.vor-card-body table.dt td, .vor-card-body table.dt th {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Вкладка «Статистика» ВОР: KPI-тайлы + колонки по статусам */
/* --- Раздел «Закрытие» -------------------------------------------------- */
.closure-wrap { display: flex; flex-direction: column; height: 100%; }
.cl-pane { padding: 12px 14px; overflow: auto; }
.cl-toolbar { margin-bottom: 8px; }
.cl-num { text-align: right; font-variant-numeric: tabular-nums; }
/* Шкала закрытия (как data-bar в Excel): зелёная заливка + % поверх */
.cl-bar {
  position: relative; height: 18px; min-width: 90px; border-radius: 4px;
  background: var(--panel-2); border: 1px solid var(--border); overflow: hidden;
}
.cl-bar-fill { position: absolute; inset: 0 auto 0 0; background: #16a34a; opacity: .82; }
.cl-bar-txt {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums;
}
.cl-bar-lg { height: 12px; margin-top: 6px; }
/* Компактный ряд статистики: цифры-плитки | закрытие% + % по исполнителям | круговая */
.cl-srow { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; margin-bottom: 12px; }
.cl-srow > .cl-stat-tiles { flex: 1 1 250px; min-width: 0; }
.cl-srow > .cl-mid-col { flex: 1 1 230px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.cl-srow > .cl-fin-card { flex: 1 1 360px; min-width: 0; }
/* Плитки-цифры: компактная 2-колоночная сетка */
.cl-stat-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-content: start; }
.cl-tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
.cl-tile-l { font-size: 11px; color: var(--muted); }
.cl-tile-v { font-size: 20px; font-weight: 600; line-height: 1.15; }
.cl-tile-s { font-size: 10.5px; color: var(--muted); }
/* Дельты «±N к прошлой загрузке»: плитки узкие — длинной строке разрешаем перенос;
   подпись-источник дельт занимает всю ширину сетки плиток */
.cl-stat-tiles .vst-tile-delta, .cl-closure-box .vst-tile-delta { white-space: normal; }
.cl-delta-info { grid-column: 1 / -1; font-size: 11px; }
/* Блок «Закрытие по проекту» — крупный % */
.cl-closure-box { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.cl-closure-pct { font-size: 32px; font-weight: 700; line-height: 1.1; }
/* Блок «% закрытия по исполнителям» (компактно, узкая колонка) */
.cl-exec-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 12px; flex: 1; }
.cl-exec-title { font-size: 12px; font-weight: 600; margin-bottom: 6px; }
.cl-exec-total { margin-bottom: 3px; padding-bottom: 3px; border-bottom: 1px solid var(--border); font-weight: 600; }
.cl-exec-row { display: grid; grid-template-columns: 1fr 46px 38px; gap: 8px; align-items: center; font-size: 11.5px; padding: 2px 0; }
.cl-exec-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 5px; }
.cl-exec-pctval { text-align: right; font-variant-numeric: tabular-nums; }
.cl-bar-sm { height: 10px; min-width: 0; }
/* Таблица статистики — мельче, как «Общее» */
.cl-small table { font-size: 11.5px; }
.cl-small th { font-size: 11px; }
.cl-update { max-width: 760px; padding: 4px 2px; }
.cl-up-row { display: flex; gap: 10px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.cl-up-result { min-height: 20px; margin: 6px 0; }
.cl-ok { color: var(--ok); font-weight: 600; }
.cl-err { color: var(--danger); font-weight: 600; }
.cl-hist { border-collapse: collapse; width: 100%; font-size: 12px; }
.cl-hist th, .cl-hist td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.cl-hist th { background: var(--panel-2); color: var(--muted); font-weight: 600; }

.vor-stats { position: relative; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.vst-filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  padding: 10px 12px; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.vst-filter { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.vst-filter select, .vst-filter input {
  padding: 5px 8px; font-size: 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--panel); min-width: 120px; max-width: 190px;
}
.vst-search input { min-width: 220px; }
.vst-reset { align-self: flex-end; }
.vst-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.vst-tile {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.vst-tile-label { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.vst-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.vst-tile-value { font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.vst-tile-sub { font-size: 11px; color: var(--muted); }
.vst-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px 8px; }
.vst-card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.vst-card-title { font-size: 12.5px; font-weight: 600; }
.vst-nostatus { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; cursor: pointer; }
/* Колонки: рост от общей базовой линии, торец скруглён (4px), у базы — квадрат */
.vst-bars {
  display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap;
  min-height: 230px; padding: 0 6px; border-bottom: 1px solid var(--border-strong);
}
.vst-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1 1 90px; max-width: 150px; cursor: default; }
.vst-col-value { font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.vst-col-bar { width: 24px; border-radius: 4px 4px 0 0; transition: filter .1s ease; }
.vst-col:hover .vst-col-bar { filter: brightness(.92); }
.vst-col-label {
  font-size: 10.5px; color: var(--muted); text-align: center; line-height: 1.25;
  margin: 6px 0 4px; min-height: 27px; max-width: 140px;
}
.vst-tooltip {
  position: absolute; z-index: 5; pointer-events: none;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 4px 9px; font-size: 11.5px; white-space: nowrap;
}
.vst-col { cursor: pointer; }
.vst-hint { font-size: 10.5px; margin: 6px 0 2px; }
/* --- Статистика по сметам: заголовок секции, деньги, финансовый бублик --- */
.vst-section-title {
  font-size: 13px; font-weight: 700; margin: 8px 0 -2px;
  padding-top: 6px; border-top: 1px solid var(--border-strong);
}
/* ВОР: сводные плитки (слева) и столбики (справа) — в один ряд; на узком — стопкой */
.vst-vor-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.vst-vor-row > .vst-vor-tiles { flex: 1 1 300px; min-width: 0; align-content: start; }
.vst-vor-row > .vst-vor-bars-card { flex: 2 1 460px; min-width: 0; }
/* Столбики (слева) и круговая (справа) — в один ряд, пополам; на узком — стопкой */
.vst-smeta-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.vst-smeta-row > .vst-card { flex: 1 1 460px; min-width: 0; }
.vst-money { font-size: 20px; }   /* суммы длиннее — мельче базового 28px тайла */
.vst-tile-of { font-size: 15px; font-weight: 500; color: var(--muted); margin-left: 6px; }
.vst-fin-total { font-size: 11.5px; }
.vst-fin-wrap { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.vst-fin-chart { position: relative; width: 220px; height: 220px; flex: 0 0 auto; }
.vst-donut { width: 220px; height: 220px; display: block; }
.vst-slice { transition: filter .1s ease; }
.vst-slice:hover { filter: brightness(1.08); }
.vst-donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none; gap: 1px;
}
.vst-donut-center b { font-size: 15px; font-weight: 700; }
.vst-donut-center span { font-size: 10.5px; color: var(--muted); }
.vst-fin-legend { flex: 1 1 280px; min-width: 250px; display: flex; flex-direction: column; gap: 1px; }
.vst-leg-row {
  display: grid; grid-template-columns: 14px 1fr auto auto; gap: 9px; align-items: center;
  padding: 4px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px;
}
.vst-leg-row:hover { background: var(--accent-soft); }
.vst-leg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vst-leg-pct { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }
.vst-leg-money { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 104px; text-align: right; }
/* Мультивыбор в фильтрах статистики (чекбоксы в выпадающем меню) */
.vst-msel { position: relative; }
.vst-msel-btn {
  padding: 5px 10px; font-size: 12px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--panel); cursor: pointer;
  min-width: 120px; max-width: 190px; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.vst-msel-btn.vst-msel-active { border-color: var(--accent); color: var(--accent-hover); font-weight: 600; }
.vst-msel-menu {
  position: absolute; top: 100%; left: 0; z-index: 30; margin-top: 3px;
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 6px; min-width: 220px; max-width: 340px;
  max-height: 300px; overflow: auto;
}
.vst-msel-menu.hidden { display: none; }
.vst-msel-menu label {
  display: flex; align-items: center; gap: 6px; padding: 3px 6px; font-size: 12px;
  color: var(--text); cursor: pointer; border-radius: 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.vst-msel-menu label:hover { background: var(--accent-soft); }
.vst-msel-clear {
  width: 100%; margin-bottom: 4px; padding: 4px 8px; font-size: 11.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel); cursor: pointer;
}
/* Дельты «к прошлой загрузке» (+N / −N) на тайлах и столбиках статистики ВОР */
.vst-delta { font-size: 11px; font-weight: 700; vertical-align: middle; white-space: nowrap; }
.vst-delta-up { color: #1d5c2f; }
.vst-delta-down { color: #8a2a24; }
.vst-delta-n { color: var(--muted); }
.vst-delta-info { font-size: 11px; }
/* Строка «±N к прошлой загрузке» под значением плитки (как дельты в РПК) */
.vst-tile-delta { font-size: 11px; font-weight: 600; white-space: nowrap; }
.vst-tile-delta.vst-delta-n { font-weight: 400; }
/* Всплывающий перечень ведомостей статуса: компактно, без прокрутки вправо */
/* Окно «клик по столбику» — оформление как у диалога «Поиск» (app-dialog):
   фикс. стартовый размер, растягивание за угол, шапка h3 + ✕. */
.vst-dialog[open] { display: flex; flex-direction: column; }
.vst-dialog {
  width: min(1320px, 96vw); height: 72vh;
  min-width: 520px; min-height: 320px; max-width: 98vw; max-height: 96vh;
  resize: both; overflow: hidden;
}
.vst-dialog .dialog-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.vst-dialog h3 .vst-dlg-count { font-size: 12px; font-weight: 400; margin-left: 8px; }
/* область таблицы растёт вместе с окном (как search-dlg-results);
   таблица — DataTable (фильтры/ресайз/CSV/Excel), компактный текст */
.vst-dlg-results { flex: 1; min-height: 0; overflow: hidden; margin-top: 12px; display: flex; flex-direction: column; }
.vst-dlg-results .dt-scroll { flex: 1; min-height: 0; max-height: none; }
.vst-dlg-results table.dt td { font-size: 10.5px; padding: 3px 7px; }
.vst-dlg-results table.dt td, .vst-dlg-results table.dt th {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vst-dlg-results table.dt th:has(.dt-msel) { overflow: visible; }

/* Вкладка «Обновление» */
.vor-update { padding: 12px; }
.upd-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; margin-bottom: 12px; }
.upd-form label { display: flex; align-items: center; gap: 6px; }
.upd-form select { padding: 6px 10px; font-size: 12.5px; }
.upd-report-box {
  margin: 12px 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: #f2f9f2; font-size: 12.5px;
}
.upd-report-box.upd-report-err { background: #fdf1f1; }
.upd-report-box details { margin-top: 6px; }
.upd-report-box summary { cursor: pointer; color: var(--accent); }
.upd-report-box ul { margin: 4px 0 4px 18px; max-height: 180px; overflow: auto; }
.upd-orphans { margin-top: 6px; color: #8a6d00; }
.upd-added { color: #1d5c2f; font-weight: 600; }
.upd-changed { color: #8a6d00; font-weight: 600; }
.upd-removed { color: #8a2a24; font-weight: 600; }
.upd-kept { color: #2a5f86; font-weight: 600; }   /* реестр подтипов: сохранены, нет в файле */
.upd-hist-title { margin: 14px 0 8px; font-size: 13px; }
.upd-hist-hint { font-size: 11px; margin: 0 0 6px; }
/* Всплывающий отчёт обновления (клик по строке истории) */
.upd-dlg {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md); padding: 0; width: min(760px, 92vw); max-height: 84vh;
}
.upd-dlg::backdrop { background: rgba(15, 23, 42, .35); }
.upd-dlg-head {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  border-bottom: 1px solid var(--border); background: var(--panel);
}
.upd-dlg-head .upd-dlg-close { margin-left: auto; }
.upd-dlg-body { padding: 4px 16px 14px; overflow: auto; max-height: calc(84vh - 54px); }
.upd-dlg-body .upd-report-box { margin: 10px 0 0; }

/* --- Шаблон ВОР (xlsx): Excel-подобный предпросмотр --------------------------- */
.stmt-template2 { padding: 4px 0 12px; }
.tplx-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); margin: 6px 0 8px; }
.tplx-key { display: inline-block; width: 14px; height: 14px; border-radius: 3px;
  border: 1px solid var(--border-strong); vertical-align: -2px; }
.tplx-key-ph { background: #fff3bf; }
.tplx-key-data { background: #e3f3e3; margin-left: 14px; }
.tplx-scroll { overflow: auto; max-height: calc(100vh - 330px); min-height: 220px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; padding: 14px; }
.tplx-grid { border-collapse: collapse; table-layout: fixed;
  font-family: 'Times New Roman', serif; font-size: 12px; color: #1a1a1a; }
.tplx-grid td { padding: 2px 5px; vertical-align: middle; overflow: hidden;
  word-break: break-word; border: 1px solid #f0eee9; /* лёгкая «сетка Excel» */ }
.tplx-grid td.tplx-bd { border: 1px solid #8a8a8a; }
.tplx-grid td.tplx-bold { font-weight: 700; }
.tplx-grid td.tplx-ph { background: #fff3bf; }
.tplx-grid td.tplx-data { background: #e3f3e3; }
.tplx-ph-tag { background: #ffe066; border-radius: 3px; padding: 0 3px;
  font-family: Consolas, monospace; font-size: 11px; white-space: nowrap; }
.tplx-ph-list { margin-top: 10px; font-size: 13px; }
.tplx-ph-list summary { cursor: pointer; color: var(--accent); }
.tplx-ph-table { border-collapse: collapse; margin: 8px 0 4px; font-size: 12.5px; }
.tplx-ph-table th, .tplx-ph-table td { border: 1px solid var(--border);
  padding: 4px 10px; text-align: left; }
.tplx-ph-table th { background: var(--panel-2); font-size: 11.5px; color: var(--muted); }
.tplx-ph-table code { background: #f6f3ee; padding: 0 4px; border-radius: 3px; }
.tplx-ph-unused td { color: var(--muted); }
@media (max-width: 900px) {
  .stmt-form-layout { grid-template-columns: 1fr; }
}

/* --- тех. акты (TechnicalActsDialog) --- */
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-right: auto; }
.detail-panel-fullscreen {
  position: fixed; inset: 0; z-index: 2000;
  display: flex !important; flex-direction: column;
  background: var(--bg); margin: 0; max-height: none;
}
.detail-panel-fullscreen .detail-body { flex: 1; overflow: auto; }
.ta-tree-wrap { overflow: auto; max-height: 60vh; }
.detail-panel-fullscreen .ta-tree-wrap { max-height: none; flex: 1; }
.ta-tree { width: 100%; border-collapse: collapse; font-size: 12px; }
.ta-tree th, .ta-tree td { padding: 4px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
/* Шапка таблицы ТА закреплена при прокрутке (большие акты в «Добавить» и т.д.). */
.ta-tree thead th { position: sticky; top: 0; z-index: 2; background: var(--panel-2); }
/* Тулбар редактора ТА: поиск по KKS/подтипу + свернуть/развернуть все. */
.ta-editor-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.ta-editor-toolbar .ta-filter { padding: 5px 9px; font-size: 12.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); min-width: 240px; }
.ta-editor-toolbar button { padding: 3px 10px; font-size: 11.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; }
.ta-editor-toolbar button:hover { background: var(--accent-soft); }
.ta-tree .ta-row-kks td { background: #eef4fb; font-weight: 600; }
.ta-tree .ta-row-subtype td { background: #f5f8fc; }
.ta-tree .ta-row-leaf:nth-child(even) td { background: #fafbfc; }
.ta-tree .ta-stage { width: 56px; font-size: 12px; padding: 2px 4px; }
/* История: заполненные (>0) этапы ПНД…Отчёт — жирным и с заливкой #F3EFFF
   (селектор сильнее зебры .ta-row-leaf:nth-child(even)). */
.ta-tree .ta-row-leaf td.ta-stage-set { font-weight: 700; background: #F3EFFF; }
.ta-pct-done { background: #90ee90 !important; }
.ta-pct-part { background: #ffe4c4 !important; }
.tree-toggle { cursor: pointer; user-select: none; display: inline-block; width: 14px; }
.tree-toggle.collapsed { transform: rotate(-90deg); }

/* --- стартовый экран (п. 131) --- */
.start-screen {
  position: absolute; inset: 0; z-index: 20; overflow: auto;
  background: var(--bg); display: flex; justify-content: center;
}
.start-screen.hidden { display: none; }
.start-inner { width: 100%; max-width: 920px; padding: 34px 28px; }
.start-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.start-head h2 { margin: 0 0 2px; font-size: 20px; }
.start-create { padding: 9px 16px; font-size: 13px; }
.start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.start-card {
  display: flex; flex-direction: column; gap: 6px; align-items: flex-start;
  padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: 12px;
  background: var(--panel); cursor: pointer; text-align: left;
  transition: border-color .12s, box-shadow .12s, transform .08s;
}
.start-card:hover { border-color: var(--accent); box-shadow: 0 6px 18px rgba(37, 99, 235, .14); transform: translateY(-1px); }
.start-card.start-recent { border-left: 3px solid var(--accent); }
.start-card-name { font-weight: 650; font-size: 14px; word-break: break-word; }
.start-card-meta { font-size: 11.5px; color: var(--muted); }
.start-empty { color: var(--muted); padding: 20px; }

/* --- индикатор долгих операций (п. 148) --- */
/* Это <dialog> (showModal): только top layer рисуется поверх модальных окон
   вроде «Версий схемы»; div с любым z-index оставался ПОД ними, и прогресс
   операций, запущенных из модалки, был невидим. Гасим UA-стили диалога. */
.busy-overlay {
  position: fixed; inset: 0; z-index: 6000;
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; border: 0; padding: 0; outline: none;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .28); backdrop-filter: blur(1px);
}
.busy-overlay.hidden, dialog.busy-overlay:not([open]) { display: none; }
.busy-overlay::backdrop { background: transparent; }
.busy-card {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 24px; background: var(--panel); border-radius: 12px;
  box-shadow: var(--shadow-lg); font-size: 14px; color: var(--text);
}
.busy-card .spinner { width: 22px; height: 22px; }

/* --- настройки (п. 145) --- */
/* Чекбоксы/радио в диалогах не должны растягиваться на всю ширину (.dialog-form input{width:100%}). */
.dialog-form input[type="checkbox"], .dialog-form input[type="radio"] { width: auto; flex: none; margin: 0; padding: 0; }
.canvas-host.minimap-off .scheme-minimap { display: none !important; }
.settings-dialog { min-width: 440px; }
.settings-group { margin: 12px 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.settings-sub { font-weight: 600; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.settings-check { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 0; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; padding: 5px 0; }
.settings-row select { padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); min-width: 150px; }

/* --- горячие клавиши (п. 142) --- */
.hotkeys-dialog { min-width: 520px; }
.hk-table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 13px; }
.hk-table th { text-align: left; padding: 4px 8px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
.hk-table td { padding: 4px 8px; }
.hk-table .hk-key { width: 64px; }
.hk-table select { padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; }
.hk-table .hk-cmd { width: 100%; }
.hk-del { border: none; background: transparent; cursor: pointer; color: var(--muted); font-size: 14px; padding: 2px 6px; }
.hk-del:hover { color: #dc3545; }
.hk-controls { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0 4px; }
.hk-controls button { padding: 5px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; font-size: 12.5px; }
.hk-controls button:hover { background: var(--accent-soft); border-color: var(--accent); }

/* --- тосты / дружелюбные ошибки (п. 149) --- */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 5000;
  display: flex; flex-direction: column; gap: 10px; max-width: 380px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 12px 11px 14px; border-radius: 10px; font-size: 13px; line-height: 1.4;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border-strong); border-left: 4px solid var(--accent);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .16);
  white-space: pre-line; animation: toast-in .18s ease-out;
}
.toast-hide { animation: toast-out .2s ease-in forwards; }
.toast-error { border-left-color: #dc3545; }
.toast-success { border-left-color: #198754; }
.toast-info { border-left-color: var(--accent); }
.toast-msg { flex: 1; min-width: 0; word-break: break-word; }
.toast-close {
  border: none; background: transparent; cursor: pointer; font-size: 18px; line-height: 1;
  color: var(--muted); padding: 0 2px; margin-top: -1px;
}
.toast-close:hover { color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }

/* --- экспорт PDF (п. 108) --- */
.pdf-export-form select { width: 100%; padding: 7px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; }
.pdf-sheets { margin: 14px 0 4px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; }
.pdf-sheets legend { font-size: 12px; color: var(--muted); padding: 0 4px; }
.pdf-all { font-weight: 600; display: block; margin-bottom: 4px; }
.pdf-sheet-list { max-height: 220px; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.pdf-sheet-list label, .pdf-all { font-size: 12.5px; display: flex; align-items: center; gap: 6px; }

/* --- Доп функционал (п. 144) --- */
.extra-wrap { display: flex; height: 100%; min-height: 0; }
.extra-list { list-style: none; margin: 0; padding: 8px; width: 300px; flex: 0 0 300px;
  border-right: 1px solid var(--border); overflow: auto; background: var(--panel); }
.extra-list li { padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
  margin-bottom: 4px; border: 1px solid transparent; }
.extra-list li:hover { background: var(--accent-soft); }
.extra-list li.active { background: var(--accent-soft-2); border-color: var(--accent); color: var(--accent-hover); font-weight: 600; }
.extra-page { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 14px 18px; overflow: auto; }
.extra-page h3 { margin: 0 0 6px; font-size: 15px; }
.extra-hint { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }
.extra-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.extra-controls label { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.extra-controls select { padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.extra-controls button { padding: 6px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel); cursor: pointer; font-size: 12.5px; }
.extra-controls button:hover:not(:disabled) { background: var(--accent-soft); border-color: var(--accent); }
.extra-controls button:disabled { opacity: .5; cursor: default; }
.extra-summary { font-size: 12.5px; color: #495057; margin: 6px 0; }
.ds-field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); margin: 8px 0; }
.ds-field textarea { padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font: inherit; resize: vertical; color: var(--text); }
.ds-pre { white-space: pre-wrap; word-break: break-word; background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; margin: 6px 0; max-height: 360px; overflow: auto; }
.ds-answer details summary { cursor: pointer; font-size: 12px; color: var(--muted); margin: 4px 0; }
.extra-table, .extra-ru-table { flex: 1; min-height: 120px; display: flex; flex-direction: column; }
.ck-toolbar { display: flex; align-items: center; gap: 10px; padding: 6px 0; flex-wrap: wrap; }
.ck-toolbar button { padding: 5px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel); cursor: pointer; font-size: 12px; }
.ck-toolbar input { padding: 5px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 12px; }
.ck-count { color: #495057; font-size: 12px; }
.ck-scroll { flex: 1; overflow: auto; min-height: 0; max-height: calc(100vh - 270px); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ck-col { width: 34px; text-align: center; }

/* --- скроллбары --- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
::-webkit-scrollbar-track { background: transparent; }

/* Мягкие блокировки (Фаза 2 многопольз.): баннер «занято» в панели атрибутов. */
.attr-lock-banner {
  background: #fff7ed; color: #b26a00; border: 1px solid #f0b97d;
  border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; font-size: 13px; font-weight: 600;
}
.attr-locked input, .attr-locked select, .attr-locked textarea {
  pointer-events: none; background: #f3f4f6; color: #6b7280;
}

/* --- Трекер задач (Jira-подобный, меню «Задачи») --- */
.tasks-dialog { width: min(1280px, 96vw); max-width: 96vw; height: min(860px, 94vh); padding: 0; border: none; border-radius: var(--radius); }
.tasks-dialog::backdrop { background: rgba(15, 23, 42, .45); }
.tasks-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; }
.tasks-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--panel); }
.tasks-head h3 { margin: 0; font-size: 16px; white-space: nowrap; }
.tasks-head .tsk-search { flex: 1; min-width: 120px; padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.tsk-view-switch { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.tsk-view-switch button { padding: 6px 12px; border: none; background: var(--panel); cursor: pointer; font-size: 12.5px; }
.tsk-view-switch button.active { background: var(--accent); color: #fff; }
.tasks-head .tsk-close { font-size: 20px; line-height: 1; }
.tasks-body { flex: 1; min-height: 0; overflow: auto; padding: 12px 16px; background: var(--panel-2); }

/* Доска */
.tsk-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; min-height: 100%; }
.tsk-col { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); display: flex; flex-direction: column; min-height: 160px; }
.tsk-col.tsk-dropover { outline: 2px dashed var(--accent); outline-offset: -2px; }
.tsk-col-head { padding: 8px 12px; font-weight: 600; font-size: 12.5px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; }
.tsk-col-count { color: var(--muted); font-weight: 400; }
.tsk-col-cards { padding: 8px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.tsk-empty { color: var(--muted); text-align: center; padding: 12px 0; }
.tsk-card { background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 8px 10px; cursor: pointer; box-shadow: 0 1px 2px rgba(15,23,42,.06); }
.tsk-card:hover { border-color: var(--accent); }
.tsk-card.tsk-dragging { opacity: .5; }
.tsk-card-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.tsk-key { font-size: 11px; font-weight: 700; color: var(--accent); }
.tsk-type { font-size: 13px; }
.tsk-prio { font-size: 10.5px; padding: 1px 7px; border-radius: 9px; margin-left: auto; white-space: nowrap; }
.tsk-prio-low  { background: #e2e8f0; color: #475569; }
.tsk-prio-mid  { background: #dbeafe; color: #1d4ed8; }
.tsk-prio-high { background: #ffedd5; color: #c2410c; }
.tsk-prio-crit { background: #fee2e2; color: #b91c1c; font-weight: 700; }
.tsk-title { font-size: 12.5px; line-height: 1.35; }
.tsk-card-foot { display: flex; gap: 10px; margin-top: 6px; font-size: 11px; color: var(--muted); }
.tsk-cancelled { color: #b91c1c; font-weight: 600; }

/* Список */
.tsk-list-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: auto; }
.tsk-list td, .tsk-list th { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tsk-list .tsk-list-title { max-width: 420px; }

/* Деталка (правая панель поверх) */
.tasks-detail { position: absolute; top: 0; right: 0; width: min(560px, 92%); height: 100%; background: var(--panel); border-left: 1px solid var(--border-strong); box-shadow: -8px 0 22px rgba(15,23,42,.14); padding: 14px 16px; overflow: auto; display: flex; flex-direction: column; gap: 8px; z-index: 3; }
.tasks-detail.hidden { display: none; }
.tsk-detail-head { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.tsk-detail-head .tsk-detail-close { margin-left: auto; font-size: 20px; line-height: 1; }
.tasks-detail label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.tasks-detail input, .tasks-detail select, .tasks-detail textarea { padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; color: var(--text); }
.tsk-detail-row { display: flex; gap: 10px; }
.tsk-detail-row label { flex: 1; min-width: 0; }
.tsk-detail-actions { display: flex; gap: 8px; }
.tsk-detail-section { font-weight: 700; font-size: 12.5px; margin-top: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.tsk-comments-list { display: flex; flex-direction: column; gap: 8px; }
.tsk-comment { background: var(--panel-2); border-radius: var(--radius-sm); padding: 7px 10px; }
.tsk-comment-meta { font-size: 11.5px; margin-bottom: 2px; }
.tsk-comment-text { font-size: 12.5px; white-space: pre-wrap; }
.tsk-comment-add { display: flex; gap: 8px; align-items: flex-end; }
.tsk-comment-add textarea { flex: 1; }
.tsk-events { display: flex; flex-direction: column; gap: 4px; font-size: 11.5px; max-height: 180px; overflow: auto; }
.tsk-meta-line { font-size: 11px; margin-top: 4px; }
@media (max-width: 1000px) { .tsk-board { grid-template-columns: repeat(2, 1fr); } }

/* --- Приборы: модальная форма добавления/правки --- */
.instr-modal { width: min(720px, 94vw); }
.instr-modal-body { padding: 12px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; max-height: 64vh; overflow: auto; }
.instr-f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.instr-f input { padding: 6px 9px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; color: var(--text); }
.instr-f-row { flex-direction: row; align-items: center; gap: 6px; }
.instr-verify-head { grid-column: 1 / -1; font-weight: 600; font-size: 12px; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 2px; }

/* --- Статистика РПК: цепочка Э-47 → протоколы → Э-49 (modules/rpk.js) --- */
#page-rpk { display: flex; flex-direction: column; overflow: hidden; }
/* overflow-anchor: браузерное якорение прокрутки сбивает восстановление scrollTop
   при возврате из карточки-«погружения» (display-переключение list/detail). */
#page-rpk .rpk-body { flex: 1; overflow: auto; padding: 12px 16px; overflow-anchor: none; }
.rpk-h { margin: 16px 0 8px; font-size: 13.5px; }
.rpk-note { font-size: 12px; margin: 6px 0; }
.rpk-empty { padding: 40px; text-align: center; }
.rpk-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px; }
.rpk-toolbar input[type="search"] { padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); min-width: 280px; }
.rpk-toolbar select { padding: 6px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.rpk-dir-toggle { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; margin-left: auto; }

/* Плитки-счётчики (клик → перечень KKS) */
.rpk-tiles { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.rpk-tile { min-width: 150px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); }
.rpk-tile:hover { border-color: var(--accent); }
.rpk-tile-label { font-size: 12px; color: var(--muted); }
.rpk-tile-value { font-size: 23px; font-weight: 650; color: var(--text); }
.rpk-share { font-size: 12px; font-weight: 400; margin-left: 6px; }
.rpk-tile-warn .rpk-tile-value { color: #b26a00; }
.rpk-delta { font-size: 11px; }
.rpk-delta-up { color: #006300; }
.rpk-delta-down { color: #c62828; }

.rpk-row2 { display: grid; grid-template-columns: minmax(320px, 480px) minmax(360px, 1fr); gap: 14px; align-items: start; }
@media (max-width: 1000px) { .rpk-row2 { grid-template-columns: 1fr; } }

/* «Для справки»: одна линия из двух панелей с плитками; ширины пропорциональны
   числу плиток (слева 3 — «Дополнение по актам», справа 2 — «В целом по проекту»),
   у каждой свой фон, чтобы группы читались раздельно. */
.rpk-refrow { display: grid; grid-template-columns: 3fr 2fr; gap: 14px; align-items: stretch; margin: 4px 0 10px; }
@media (max-width: 1000px) { .rpk-refrow { grid-template-columns: 1fr; } }
.rpk-ref-title { font-size: 12px; font-weight: 650; margin: 6px 0 8px; }
.rpk-ref-title .muted { font-weight: 400; }
.rpk-refrow .rpk-tiles { margin-bottom: 4px; }
.rpk-refrow .rpk-tile { flex: 1 1 150px; }
/* Специфичность выше .rpk-panel (он объявлен ниже и задаёт var(--panel)) */
.rpk-refrow .rpk-ref-acts { background: var(--accent-soft); }
.rpk-refrow .rpk-ref-global { background: #fbf8ef; }
.rpk-panel { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); padding: 4px 14px 10px; }

/* Воронка: тонкие столбики, значение на торце, подпись под осью */
.rpk-funnel { display: flex; align-items: flex-end; gap: 8px; padding: 8px 4px 0; }
.rpk-fcol { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; background: none; border: none; cursor: pointer; padding: 0; flex: 1 1 0; min-width: 0; }
.rpk-fbar { width: 24px; border-radius: 4px 4px 0 0; display: block; }
.rpk-fcol:hover .rpk-fbar { filter: brightness(1.12); }
.rpk-fval { font-size: 12.5px; font-weight: 600; color: var(--text); }
.rpk-flabel { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.25; border-top: 1px solid var(--border-strong); padding-top: 4px; width: 100%; }

/* Ряд фильтров-разрезов (один ряд — все виджеты считаются в этом срезе) */
.rpk-filters { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; margin: 6px 0 4px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); }
.rpk-flt { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); }
.rpk-flt select { padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 12px; max-width: 250px; color: var(--text); }
.rpk-upinfo { margin: 2px 0 10px; }

/* Большие карточки сводки: ряд по документам + ряд в разрезе оборудования */
.rpk-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 10px; }
.rpk-card { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); padding: 10px 14px 12px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; align-items: flex-start; gap: 3px; }
.rpk-card-name { font-size: 12.5px; font-weight: 650; margin-bottom: 2px; }
.rpk-big { background: none; border: none; padding: 0; cursor: pointer; font-size: 13px; color: var(--text); text-align: left; }
.rpk-big b { font-size: 27px; font-weight: 700; }
.rpk-big:hover b { color: var(--accent); }
.rpk-sub { background: none; border: none; padding: 0; cursor: pointer; font-size: 12px; color: var(--muted); text-align: left; }
.rpk-sub b { color: var(--text); }
.rpk-sub:hover b { color: var(--accent); }
.rpk-ref { font-size: 11px; margin-top: 4px; }
/* Строка «показатель + линия процента» на карточках оборудования */
.rpk-eqline { background: none; border: none; padding: 0; cursor: pointer; font-size: 12px; color: var(--muted); text-align: left; display: flex; flex-direction: column; gap: 3px; width: 100%; margin-top: 4px; }
.rpk-eqline b { color: var(--text); }
.rpk-eqline:hover b { color: var(--accent); }
.rpk-meter-wide { width: 100%; max-width: 260px; height: 9px; margin: 2px 0; }

/* Таблица «Исполнители ПНР» — главный управленческий разрез */
.rpk-org-head, .rpk-org-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) 100px 160px 160px 150px; gap: 10px; align-items: center; }
.rpk-org-head { font-size: 11px; color: var(--muted); padding: 2px 10px 6px; }
.rpk-org-row { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); padding: 7px 10px; cursor: pointer; text-align: left; margin-bottom: 5px; width: 100%; }
.rpk-org-row:hover { border-color: var(--accent); background: var(--accent-soft); }
.rpk-org-lag { border-left: 4px solid #fab219; }
.rpk-org-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.rpk-org-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpk-org-docs { font-size: 12px; }
.rpk-org-rej { font-style: normal; color: #c62828; font-size: 11px; }
.rpk-org-m { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }

/* Заголовок перечня актов Э-47 (те же колонки, что .rpk-act-row) */
.rpk-act-head { display: grid; grid-template-columns: 300px minmax(200px, 1fr) 70px 190px 190px; gap: 12px; padding: 2px 12px 6px; font-size: 11px; color: var(--muted); }
@media (max-width: 1100px) { .rpk-act-head { display: none; } }

/* Перечень актов Э-47 */
.rpk-e47-list { display: flex; flex-direction: column; gap: 6px; padding-bottom: 20px; }
.rpk-act-row { display: grid; grid-template-columns: 300px minmax(200px, 1fr) 70px 190px 190px; gap: 12px; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; text-align: left; }
.rpk-act-row:hover { border-color: var(--accent); background: var(--accent-soft); }
.rpk-act-code { font-weight: 600; font-size: 12px; display: flex; align-items: center; gap: 6px; word-break: break-all; }
.rpk-state-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.rpk-act-title { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rpk-act-unit { font-size: 11.5px; }
.rpk-act-m { display: flex; align-items: center; gap: 6px; font-size: 11.5px; }
.rpk-act-m small { color: var(--muted); min-width: 62px; }
.rpk-meter { width: 64px; height: 8px; border-radius: 4px; background: #cde2fb; overflow: hidden; display: inline-block; }
.rpk-meter i { display: block; height: 100%; background: #2a78d6; border-radius: 4px; }
.rpk-meter.rpk-m-e49 { background: #d3f2d3; }
.rpk-meter.rpk-m-e49 i { background: #0ca30c; }
.rpk-meter-num { font-variant-numeric: tabular-nums; min-width: 58px; }
@media (max-width: 1100px) { .rpk-act-row { grid-template-columns: 1fr; gap: 4px; } }

/* Детализация-«погружение» и таблицы документов */
.rpk-detail-wrap { flex: 1; overflow: auto; padding: 12px 16px; display: flex; flex-direction: column; }
.rpk-card-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.rpk-card-title { font-weight: 650; font-size: 13.5px; }
.rpk-table-host { flex: 1; min-height: 200px; margin-top: 8px; }
.rpk-docs-table { border-collapse: collapse; width: 100%; font-size: 12px; margin-bottom: 8px; }
.rpk-docs-table th, .rpk-docs-table td { border: 1px solid var(--border); padding: 4px 8px; text-align: left; }
.rpk-docs-table th { background: var(--panel-2); font-weight: 600; }

/* Обновление данных: отдельный слот загрузки на каждый файл */
.rpk-upslots { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 12px; margin: 6px 0 10px; }
.rpk-upslot { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); padding: 10px 14px 12px; box-shadow: var(--shadow-sm); }
.rpk-upslot-title { font-size: 12.5px; font-weight: 650; }
.rpk-upslot-hint { font-size: 11px; margin: 2px 0 8px; }
.rpk-upslot-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rpk-upslot-row input[type="file"] { font-size: 12px; max-width: 100%; }
.rpk-upslot-rep:not(:empty) { margin-top: 8px; }
.rpk-upslot-rep .rpk-rep { margin: 0; }
.rpk-upslot-rep .docs-upload-progress { margin-top: 4px; }

/* Обновление данных */
.rpk-rep { border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius-sm); padding: 8px 12px; margin: 6px 0; font-size: 12.5px; background: var(--panel); }
.rpk-rep-ok { border-left-color: #0ca30c; }
.rpk-rep-err { border-left-color: #d03b3b; }
.rpk-history { margin-bottom: 10px; }

/* РПК: баннеры и карточки состояния данных (вкладка «Обновление данных») */
.rpk-banner { border: 1px solid var(--border); border-left-width: 4px; border-radius: var(--radius-sm); background: var(--panel); padding: 9px 14px; margin: 8px 0; font-size: 12.5px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rpk-banner-warn { border-left-color: #fab219; background: #fffaf0; }
.rpk-banner-info { border-left-color: #2a78d6; background: var(--accent-soft); }
.rpk-scard-row { display: flex; gap: 12px; flex-wrap: wrap; }
.rpk-scard { min-width: 280px; flex: 0 1 340px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); padding: 10px 14px; box-shadow: var(--shadow-sm); }
.rpk-scard-title { font-size: 12px; color: var(--muted); }
.rpk-scard-state { font-size: 15px; font-weight: 650; margin: 2px 0; }
.rpk-scard-ok .rpk-scard-state { color: #006300; }
.rpk-scard-missing { border-left: 4px solid #d03b3b; }
.rpk-scard-missing .rpk-scard-state { color: #c62828; }
.rpk-pct { color: var(--muted); font-weight: 400; }
.rpk-big .rpk-pct { font-size: 12px; }

/* ---- Протоколы: длительность согласования ПНР ---- */
.rpk-flt-days input.dur-f-days { padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 12px; width: 90px; color: var(--text); background: var(--panel); }

/* «Где лежат сейчас» — компактные строки; Аккую выделена */
.dur-holder-row { display: grid; grid-template-columns: minmax(0, 1fr) 30px minmax(96px, auto); gap: 8px; align-items: baseline; font-size: 12px; padding: 3px 8px; border-radius: 4px; }
.dur-holder-row.is-akkuyu { background: #f6f3ff; box-shadow: inset 3px 0 0 #7c4dff; }
.dur-holder-n { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.dur-holder-sub { color: var(--muted); font-size: 11px; text-align: right; white-space: nowrap; }

/* Полоса-заголовок списка + селектор среза в один ряд */
.dur-list-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.dur-list-bar .rpk-h { margin: 8px 0 6px; }
.dur-list-bar select { padding: 5px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 12px; margin-left: auto; }
.dur-list-host { min-height: 52vh; min-width: 0; }
/* Список прокручивается вместе со страницей (.rpk-body); гасим ИНЛАЙНОВЫЙ
   max-height, который DataTable ставит по позиции (tables.js) — из-за него,
   когда список низко на странице, он схлопывался до 160px и «обрывался на
   середине», не показывая вторую половину при смене фильтра. !important —
   чтобы перебить инлайн-стиль. Горизонтальный скролл таблицы сохраняется. */
.dur-list-host .dt-scroll { max-height: none !important; }
/* Широкую таблицу списка нельзя давать растягивать блок-контейнер шире вьюпорта —
   иначе fitWidth меряет распухшую ширину и не ужимает. Ограничиваем обёртку. */
.rpk-dash-wrap { max-width: 100%; min-width: 0; }

.dur-grp-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dur-over { color: #c62828; font-weight: 650; }

/* ---- Слайд «Протоколы» (стилистика дашборда РПК) ---- */
.dur2-row2 { margin-bottom: 12px; }
.dur2-left { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
/* Акцент-карточка «Просрочено в Аккую»: главная тревожная метрика слайда */
.dur2-card-alert { background: #fff5f5; border-left: 4px solid #d03b3b; }
.dur2-card-alert .rpk-big b { color: #c62828; font-size: 32px; }
.dur2-card-alert .rpk-big:hover b { color: #8f1f1f; }
.dur2-card-ok { border-left: 4px solid #0ca30c; }   /* просрочки нет — зелёный кант */
.dur2-card-ok .rpk-big b { color: #0ca30c; }
/* Столбики возраста: клик — срез списка; пустой диапазон отключён */
.dur2-fcol:disabled { cursor: default; }
.dur2-fcol:disabled .rpk-fval { color: var(--muted); }
.dur2-fcol-active .rpk-fbar { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.dur2-fcol-active .rpk-flabel { color: var(--accent); font-weight: 650; }
.dur2-fbar-zero { height: 2px; background: var(--border-strong); }  /* пустой диапазон */
.dur2-types-panel { margin-bottom: 4px; }
/* Разрез: имя | утв./оформлено | метр доли | на согл./просроч. | ср. согл. */
.dur2-head { font-size: 11px; color: var(--muted); padding: 2px 10px 6px; }
.dur2-head, .rpk-org-row.dur2-row { display: grid; grid-template-columns: minmax(150px, 1.4fr) 110px minmax(130px, 170px) 110px 84px; gap: 10px; align-items: center; }
/* Виды протоколов: длинный список — внутренняя прокрутка с липкой шапкой */
.dur2-types { max-height: 330px; overflow-y: auto; min-width: 0; }
.dur2-types .dur2-head { position: sticky; top: 0; background: var(--panel); z-index: 1; }
table.dt tr.dur-row-over td { background: #fff2f2; }
table.dt tr.dur-row-over td.cell-vor-bad { background: #f8d7da !important; }

/* --- Панель администратора: учётные записи, временные пароли, допуски --- */
.ua-wrap { padding: 16px 20px 24px; max-width: 1280px; margin: 0 auto; overflow-y: auto; height: 100%; }
.ua-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.ua-head h2 { margin: 0 0 4px; }
.ua-head .muted { max-width: 640px; margin: 0; }
.ua-head-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.ua-error { color: var(--danger); font-weight: 600; }
.ua-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.ua-kpi { border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--panel); padding: 8px 12px; box-shadow: var(--shadow-sm); }
.ua-kpi-val { font-size: 24px; font-weight: 700; line-height: 1.05; }
.ua-kpi-lbl { font-size: 11px; color: var(--muted); }
.ua-kpi-ok { border-left-color: var(--ok); }
.ua-kpi-warn { border-left-color: var(--warn); }
.ua-kpi-bad { border-left-color: var(--danger); }
.ua-table-scroll { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel); box-shadow: var(--shadow-sm); }
.ua-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ua-table th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; text-transform: uppercase;
  letter-spacing: .02em; padding: 8px 10px; border-bottom: 1px solid var(--border-strong); background: var(--panel-2);
  position: sticky; top: 0; }
.ua-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ua-table tbody tr:hover td { background: var(--accent-soft); }
.ua-row-off td { opacity: .55; }
.ua-num { text-align: right; font-variant-numeric: tabular-nums; }
.ua-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.ua-badge-ok { background: #e9f7ef; color: #15803d; border-color: #bfe6cf; }
.ua-badge-warn { background: #fef3c7; color: #b45309; border-color: #f0e2a6; }
.ua-badge-bad { background: #fdecec; color: var(--danger); border-color: #f5c6c6; }
.ua-badge-admin { background: var(--accent-soft-2); color: var(--accent-hover); border-color: #bcd4fb; }
.ua-perm-full { color: var(--accent-hover); font-weight: 600; }
.ua-perm-read { color: var(--muted); }
.ua-perm-custom { font-variant-numeric: tabular-nums; }
.ua-temp { margin-left: 6px; white-space: nowrap; }
.ua-temp code, .ua-cred code { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 6px; font-size: 12px; user-select: all; }
.ua-copy { border: 1px solid var(--border-strong); background: var(--panel); border-radius: 4px; cursor: pointer;
  padding: 1px 6px; margin-left: 3px; font-size: 12px; }
.ua-copy:hover { background: var(--accent-soft); border-color: var(--accent); }
.ua-actions { white-space: nowrap; }
.ua-actions button { border: 1px solid var(--border-strong); background: var(--panel); border-radius: 5px;
  padding: 3px 8px; margin-right: 4px; cursor: pointer; font-size: 11.5px; }
.ua-actions button:hover { background: var(--accent-soft); border-color: var(--accent); }
.ua-actions .ua-danger { color: var(--danger); }
.ua-actions .ua-danger:hover { background: #fdecec; border-color: var(--danger); }
.ua-footnote { margin-top: 10px; font-size: 11.5px; }
/* Диалоги панели */
.ua-dialog { width: min(720px, 94vw); }
.ua-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.ua-form-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.ua-form-grid input, .ua-form-grid select { padding: 7px 9px; border: 1px solid var(--border-strong);
  border-radius: 6px; font-size: 13px; color: var(--text); }
.ua-check { grid-column: 1 / -1; flex-direction: row !important; align-items: center; gap: 6px !important; }
.ua-perms-fs { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px 10px; }
.ua-perms-fs legend { font-size: 12px; font-weight: 600; padding: 0 4px; }
.ua-pg-presets { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; flex-wrap: wrap; }
.ua-pg-presets button { padding: 3px 9px; font-size: 11.5px; }
.ua-pg-scroll { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; }
.ua-pg { width: 100%; border-collapse: collapse; font-size: 12px; }
.ua-pg th { position: sticky; top: 0; background: var(--panel-2); font-size: 11px; color: var(--muted);
  padding: 5px 8px; text-align: center; border-bottom: 1px solid var(--border-strong); }
.ua-pg th:first-child { text-align: left; }
.ua-pg td { padding: 4px 8px; border-bottom: 1px solid var(--border); }
.ua-pg tbody tr:hover td { background: var(--accent-soft); }
.ua-pg-label { min-width: 220px; }
.ua-pg-cell { text-align: center; }
.ua-pg-cell label { display: block; cursor: pointer; }
.ua-pg-hint { margin: 6px 0 0; font-size: 11px; }
.ua-form-error { color: var(--danger); min-height: 16px; margin: 8px 0 0; font-size: 12.5px; }
.ua-cred { display: flex; flex-direction: column; gap: 8px; margin: 10px 0 4px; font-size: 14px; }

/* --- Технические акты: тип/статус, значки источников и корректировок ----------- */
.ta-src-badge { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 10.5px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border); }
.ta-src-ext { background: #fdeede; color: #b26a00; border-color: #e8c9a0; }
.ta-status-badge { display: inline-block; padding: 1px 7px; border-radius: 9px; font-size: 10.5px; border: 1px solid var(--border); }
.ta-st-draft { background: #f1f3f5; color: #5c636a; }
.ta-st-review { background: #fff7db; color: #8a6d00; border-color: #e8d99a; }
.ta-st-approved { background: #e2f5e2; color: #1c7a1c; border-color: #b5dfb5; }
.ta-badge { display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 7px; font-size: 10px;
  line-height: 15px; vertical-align: middle; cursor: help; }
.ta-badge-src { background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border); }
.ta-badge-corr { background: #fdeede; color: #b26a00; border: 1px solid #e8c9a0; }
.ta-cell-act { cursor: pointer; }
.ta-cell-act:hover { background: var(--accent-soft); }
.ta-cell-info { background: #fffaf0; }
.ta-file-mark { margin-left: 6px; font-size: 11px; cursor: help; }
.ta-mode-tabs { display: inline-flex; margin-right: 10px; }

/* --- Карточка работы (история ТА по ID ПНР + принятые цифры) ------------------- */
.ta-work-layout { display: flex; gap: 12px; align-items: flex-start; padding: 4px 0; }
.ta-work-side { flex: 0 0 300px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel); display: flex; flex-direction: column; max-height: 74vh; }
.ta-work-search { margin: 8px; width: calc(100% - 16px); padding: 6px 9px; font-size: 12.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.ta-work-pnr-list { overflow: auto; padding: 0 8px 8px; }
.ta-work-pnr { padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12.5px;
  border: 1px solid transparent; }
.ta-work-pnr:hover { background: #f8fafc; }
.ta-work-pnr.active { background: var(--accent-soft); border-color: var(--accent); }
.ta-work-pnr .muted { font-size: 11px; line-height: 1.25; }
.ta-work-main { flex: 1; min-width: 0; }
.ta-work-head { padding: 4px 2px 8px; font-size: 13px; }
.ta-work-acts { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--panel);
  margin-bottom: 8px; }
.ta-work-acts-head { padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.ta-work-act { display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px;
  border-bottom: 1px solid var(--border); font-size: 12.5px; }
.ta-work-act:last-child { border-bottom: none; }
.ta-work-act input[type="checkbox"] { margin-top: 3px; }
.ta-act-info { flex: 1; min-width: 0; }
.ta-act-note { font-style: italic; }
.ta-act-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.ta-act-actions button { padding: 2px 8px; font-size: 11.5px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; }
.ta-act-actions button:hover { background: var(--accent-soft); }
.ta-work-toolbar { display: flex; gap: 10px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.ta-work-kks { padding: 5px 9px; font-size: 12.5px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); min-width: 220px; }
.ta-work-totals { font-size: 11.5px; }
.ta-work-merged .ta-tree-wrap { max-height: 52vh; border: 1px solid var(--border); border-radius: var(--radius-sm); }

/* --- Диалоги ТА (создание, свойства, корректировки) ---------------------------- */
.ta-modal-wide { width: min(680px, 94vw); }
/* «Добавить» и «История» — практически во весь экран (перебивает ta-modal-wide).
   Размер меняется своим уголком и кнопкой «во весь экран» (нативный resize не
   используется — с флекс-центрированием он схлопывает окно при растягивании). */
.ta-add-modal { width: min(1780px, 98vw); height: 96vh; max-height: none;
  min-width: 760px; min-height: 420px; position: relative; }
.ta-add-modal.ta-maximized { width: 100vw !important; height: 100vh !important;
  min-width: 0; min-height: 0; border-radius: 0; }
.ta-add-modal .ru-modal-head { display: flex; align-items: center; gap: 10px; }
.ru-max { margin-left: auto; padding: 2px 9px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; font-size: 13px; }
.ru-max:hover { background: var(--accent-soft); }
.ta-resize-grip { position: absolute; right: 1px; bottom: 1px; width: 16px; height: 16px;
  cursor: nwse-resize; z-index: 5;
  background: linear-gradient(135deg, transparent 0 45%, var(--border-strong) 45% 55%,
    transparent 55% 65%, var(--border-strong) 65% 75%, transparent 75%); }
.ta-add-modal .ru-modal-form { overflow: auto; flex: 1; }
/* Таблицы «Добавить»/«История» тянутся по высоте окна (не обрезаются половиной
   экрана при растягивании): view/editor — flex, wrap занимает остаток. */
.ta-add-modal .ta-add-editor, .ta-add-modal .ta-hist-view {
  flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ta-add-modal .ta-add-editor .ta-tree-wrap, .ta-add-modal .ta-hist-view .ta-tree-wrap {
  flex: 1; max-height: none; }
.ta-add-modal .ta-hist-list { max-height: 26vh; }
/* Таблицы в этих окнах — строго по ширине окна, без прокрутки влево-вправо:
   fixed-раскладка, длинные тексты обрезаются многоточием (полностью — в title). */
.ta-add-modal .ta-tree-wrap { overflow-x: hidden; overflow-y: auto; }
.ta-add-modal table.ta-tree { width: 100%; table-layout: fixed; }
.ta-add-modal .ta-tree th, .ta-add-modal .ta-tree td { overflow: hidden; text-overflow: ellipsis; }
.ta-add-modal .ta-tree th:nth-child(1) { width: 26px; }
.ta-add-modal .ta-tree th:nth-child(2) { width: 64px; }
.ta-add-modal .ta-tree th:nth-child(3) { width: 84px; }
.ta-add-modal .ta-tree th:nth-child(4) { width: 110px; }
.ta-add-modal .ta-tree th:nth-child(5) { width: 92px; }
.ta-add-modal .ta-tree th:nth-child(7) { width: 76px; }
.ta-add-modal .ta-tree th:nth-child(8) { width: 56px; }
.ta-add-modal .ta-tree th:nth-child(9) { width: 56px; }
.ta-add-modal .ta-tree th:nth-child(10) { width: 80px; }
.ta-add-modal .ta-tree th:nth-child(n+11):nth-child(-n+15) { width: 52px; }
.ta-add-modal .ta-tree th:nth-child(16) { width: 58px; }
.ta-add-modal .ta-tree th:nth-child(17) { width: 58px; }
/* инпут этапа занимает свою колонку целиком */
.ta-add-modal .ta-tree .ta-stage { width: 100%; box-sizing: border-box; }
.ta-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ta-radio-row { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; }
.ta-radio-row label { display: flex; gap: 6px; align-items: center; color: var(--text); }
.ta-new-file, .ta-grid2 input, .ta-grid2 select { padding: 6px 9px; font-size: 12.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.ta-file-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ta-corr-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow: auto; }
.ta-corr-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px;
  font-size: 12.5px; background: var(--panel); }
.ta-corr-old { text-decoration: line-through; color: var(--muted); }
.ta-corr-del { margin-left: 8px; padding: 1px 8px; font-size: 11px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; }
.ta-corr-del:hover { background: #fdecec; border-color: var(--danger); color: var(--danger); }

/* --- Модалка «Принятые цифры» из атрибутной панели ------------------------------ */
.ta-figures-modal { width: min(1100px, 96vw); max-height: 92vh; display: flex; flex-direction: column; }
.ta-figures-modal .ru-modal-form { overflow: auto; flex: 1; }
.ta-figures-host .ta-work-layout { padding: 0; }
.ta-figures-host .ta-work-main { flex: 1; }

/* --- Вкладка «Закрытие»: кнопки и файлы ТА -------------------------------------- */
.attr-closure-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.attr-closure-actions button { padding: 4px 10px; font-size: 11.5px; }
.ta-cl-file { border: none; background: none; cursor: pointer; font-size: 12px; padding: 0 3px; }
.ta-cl-file:hover { color: var(--accent); }

/* --- Список ТА (верхняя таблица): текст без переноса --------------------------- */
.acts-list-host table.dt td { white-space: nowrap; }
/* Общая таблица «Список ТА»: работы без ТА — серые и неактивные (как в «Формировании»). */
.acts-list-host tr.ta-pnr-disabled td { color: var(--muted); }
.acts-list-host tr.ta-pnr-disabled { opacity: .55; }
/* Колонка «ТА»: ссылки ТА№k (дата) — клик открывает акт. */
.ta-num-link { border: none; background: none; color: var(--accent); cursor: pointer;
  font-size: 12px; padding: 0 2px; }
.ta-num-link:hover { text-decoration: underline; }
.ta-sep { color: var(--muted); }

/* Дерево ТА (подробности, «Добавить», «История»): ячейки без переноса строк. */
.ta-tree td { white-space: nowrap; }

/* --- Добавление к ТА (скан + описание/примечание + цифры ПНД…Отчёт) ------------ */
.ta-add-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; align-items: start; }
.ta-add-fields label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.ta-add-fields input, .ta-add-fields textarea { padding: 6px 9px; font-size: 12.5px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-family: inherit; }
.ta-add-datetime { align-self: end; font-size: 12px; padding-bottom: 4px; }
.ta-add-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ta-add-editor .ta-tree-wrap { max-height: 42vh; border: 1px solid var(--border);
  border-radius: var(--radius-sm); }

/* --- История добавлений ТА ------------------------------------------------------ */
.ta-hist-list { border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel); max-height: 28vh; overflow: auto; }
.ta-hist-head { padding: 7px 10px; border-bottom: 1px solid var(--border); font-size: 12.5px;
  position: sticky; top: 0; background: var(--panel-2); z-index: 1; }
.ta-hist-item { display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px;
  border-bottom: 1px solid var(--border); font-size: 12.5px; }
.ta-hist-item:last-child { border-bottom: none; }
.ta-hist-item input[type="checkbox"] { margin-top: 3px; }
.ta-hist-sub { background: #fafbfc; padding-left: 26px; }
.ta-hist-info { flex: 1; min-width: 0; }
.ta-hist-actions { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; }
.ta-hist-view .ta-tree-wrap { max-height: 38vh; border: 1px solid var(--border);
  border-radius: var(--radius-sm); }
.ta-hist-view > .muted { padding: 6px 2px; }

/* Работы: все колонки в пределах экрана, шрифт данных на 1 pt меньше. */
.work-doc-table { width: 100%; max-width: 100%; min-width: 0; }
.work-doc-table .dt-scroll { width: 100%; min-width: 0; overflow-x: hidden; }
.work-doc-table table.dt { table-layout: fixed; width: 100%; min-width: 0; }
.work-doc-table table.dt td { font-size: calc(12.5px - 1pt); }
.work-doc-table table.dt th, .work-doc-table table.dt td {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding-left: 3px; padding-right: 3px; min-width: 0;
}
.work-doc-table .col-filter { min-width: 0; padding-left: 2px; padding-right: 2px; }
.work-doc-table .th-name { overflow: hidden; text-overflow: ellipsis; }
.work-doc-table .dt-actions { white-space: nowrap; }
.work-doc-file-status {
  padding: 0; border: 0; background: transparent; font: inherit;
  font-weight: 600; cursor: pointer; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.work-doc-file-status.is-loaded { color: #21833b; }
.work-doc-file-status.is-missing { color: #99602f; }
button.work-doc-file-status:hover { text-decoration: underline; }
.work-doc-dialog { min-width: min(520px, 96vw); }
table.dt tbody tr td.cell-vor-uploaded { background: #d8f0de !important; color: #174c2a !important; }
table.dt tbody tr td.cell-vor-formed { background: #d9edfc !important; color: #154b75 !important; }
.vor-card-link { border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0; }
.vor-card-link:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.work-doc-dialog .dialog-form { overflow: hidden; }
.work-doc-dialog-body { flex: 1; min-height: 0; overflow: auto; padding-top: 12px; }
.work-doc-card-fields {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 20px;
}
.work-doc-card-fields label { margin: 0; min-width: 0; }
.work-doc-card-fields input, .work-doc-card-fields select { display: block; margin-top: 5px; width: 100%; }
.work-doc-documents-title { margin: 22px 0 12px; padding-top: 16px; border-top: 1px solid var(--border); }
.work-doc-card-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.work-doc-card-file {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel-2); min-width: 0;
}
.work-doc-card-file > strong { width: 100%; }
.work-doc-card-file select { max-width: 100%; min-width: 0; padding: 8px; }
.work-doc-card-file .work-doc-upload-label { margin: 0; cursor: pointer; color: var(--text); }
.work-doc-document-preview { display: block; width: 100%; height: 100%; min-height: 45vh; border: 0; }
