:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --line: #e3e6ea;
  --txt: #1c2126;
  --muted: #7a838d;
  --accent: #f5a524;
  --accent-dark: #d98e0f;
}

* { box-sizing: border-box; margin: 0; }

/* запрет системного overscroll-жеста Chrome (два пальца у края холста = «назад/вперёд»
   в истории): на корне страницы и на всех прокручиваемых контейнерах (холст, модалки) */
html, body { overscroll-behavior-x: none; overscroll-behavior-y: none; }
.ed-canvas-wrap, .pg-modal, .modal-body, .ed-side, .ed-list { overscroll-behavior: contain; }

body {
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--txt);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── шапка ─────────────────────────────── */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 14px 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; gap: 10px; align-items: center; }
.logo { font-size: 28px; }
.brand h1 { font-size: 18px; }
.brand .sub { font-size: 12px; color: var(--muted); }

.tabs { display: flex; gap: 6px; align-items: center; }
.tab {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  cursor: pointer;
  color: var(--txt);
  text-decoration: none;
}
.tab.active { background: #14181d; color: #fff; border-color: #14181d; }
/* действия в шапке (Проекты, Щиты) — акцентные, не переключатели вкладок */
.tab.tab-act { background: #f5a524; color: #14100a; border-color: #f5a524; font-weight: 650; }
.tab.tab-act:hover { filter: brightness(1.06); }

.controls { display: flex; flex-direction: column; gap: 8px; }
#search {
  width: 340px; max-width: 90vw;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  outline: none;
}
#search:focus { border-color: var(--accent); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--txt);
}
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── тулбар библиотеки: бренд + сортировка ─ */
.libbar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin: 0 0 16px;
}
.libbar-field { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.libbar-sel {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--txt);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12.5px;
  outline: none;
  max-width: 260px;
}
.libbar-sel:focus { border-color: var(--accent); }
.libbar-count { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.libbar-count b { color: var(--txt); }

/* ── сетка карточек ────────────────────── */
main { flex: 1; padding: 22px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  align-items: start;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-2px); }

.card .thumb {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 230px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: grab;
}
.card .thumb img { max-height: 210px; max-width: 90%; }
.card .thumb img:active { cursor: grabbing; }

.card .t { font-size: 14px; font-weight: 600; }
.card .s { font-size: 11.5px; color: var(--muted); }

.card .row { display: flex; gap: 6px; align-items: center; }
.icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 13px;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.fav-on { color: var(--accent-dark); border-color: var(--accent); }
.btn-primary {
  flex: 1;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  padding: 7px 0;
  font-size: 12.5px;
  cursor: pointer;
}
.btn-primary:hover { background: var(--accent-dark); }

.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 15px; }
.hidden { display: none !important; }

/* ── футер ─────────────────────────────── */
.foot {
  padding: 10px 22px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  background: var(--card);
}

/* ── модалка ───────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,18,22,.55); }
.modal-body {
  position: relative;
  background: var(--card);
  border-radius: 16px;
  max-width: 860px;
  width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  overflow: auto;
  display: flex;
  gap: 20px;
  padding: 24px;
}
.modal-close {
  position: absolute; top: 10px; right: 12px;
  border: none; background: none; font-size: 26px; cursor: pointer; color: var(--muted);
}
.modal-img {
  flex: 0 0 260px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  padding: 12px;
  height: fit-content;
}
.modal-img img { max-width: 220px; max-height: 70vh; cursor: grab; }
.modal-meta { flex: 1; min-width: 0; }
.modal-meta h2 { font-size: 20px; margin-bottom: 12px; }
.modal-meta h3 { font-size: 14px; margin: 16px 0 8px; color: var(--muted); }
#m-table { border-collapse: collapse; width: 100%; font-size: 13px; }
#m-table td { padding: 5px 8px; border-bottom: 1px solid var(--line); }
#m-table td:first-child { color: var(--muted); width: 130px; }
.modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 9px;
  padding: 8px 13px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  color: var(--txt);
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
#m-json {
  background: #14181d;
  color: #cfe3d0;
  font-size: 11px;
  line-height: 1.45;
  border-radius: 10px;
  padding: 12px;
  overflow: auto;
  max-height: 260px;
  white-space: pre;
}

/* ── тост ──────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  background: #23292f;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  z-index: 60;
}

/* ── выделение клавиатурой ─────────────── */
.card.sel {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

/* ── клавиши в тексте ──────────────────── */
kbd {
  display: inline-block;
  background: #eef0f3;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 0 5px;
  font-size: 11px;
  font-family: inherit;
}

/* ── справка ───────────────────────────── */
.help-body { display: block; max-width: 520px; }
.help-body h2 { margin-bottom: 14px; }
.help-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.help-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.help-table td:first-child { width: 190px; white-space: nowrap; }

/* ── редактор ──────────────────────────── */
#view-editor {
  flex: 1;
  display: flex;
  min-height: 0;
}
#view-editor.hidden, main.hidden { display: none !important; }

.ed-side {
  width: 280px;
  border-right: 1px solid var(--line);
  background: var(--card);
  display: flex;
  flex-direction: column;
}
#ed-search {
  margin: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
}
#ed-search:focus { border-color: var(--accent); }
.ed-list { flex: 1; overflow-y: auto; padding: 0 10px 10px; }

/* дерево библиотеки: категория → бренд → серия → элементы */
.tr-branch:not(.open) > .tr-kids { display: none; }
.tr-head {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 6px; margin: 1px 0;
  border-radius: 6px; cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 600; color: var(--ink, #1c2126);
}
.tr-head:hover { background: rgba(42, 125, 225, .10); }
.tr-branch.open > .tr-head .tr-tw { transform: rotate(90deg); }
.tr-tw { display: inline-block; width: 12px; font-size: 11px; color: #8a93a0; transition: transform .12s; flex: none; }
.tr-lb { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-ct { font-size: 11px; font-weight: 400; color: #8a93a0; flex: none; }
.tr-kids { margin-left: 14px; }
.tr-kids .tr-head { font-weight: 500; font-size: 12.5px; }
.ed-sub { margin-left: auto; font-size: 10.5px; color: #8a93a0; text-align: right; flex: none; }

.ed-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 12px;
  background: var(--card);
}
/* состояние сохранения в тулбаре редактора */
.savestate { font-size: 12px; padding: 4px 10px; border-radius: 7px; cursor: default;
  border: 1px solid transparent; white-space: nowrap; user-select: none; }
.savestate.ok { color: #2e7d43; background: #e7f5ec; border-color: #bfe3cc; }
.savestate.saving { color: #9a6b00; background: #fdf3dd; border-color: #eed9a8; }
.savestate.err { color: #c0392b; background: #fdecea; border-color: #f5c6c0; cursor: pointer; }
.savestate.readonly { color: var(--muted); background: var(--panel); white-space: normal; max-width: 650px; line-height: 1.4; }
.savestate.view { color: var(--muted); }
.ed-item:hover { border-color: var(--accent); background: #fffaf0; }
.ed-item img { height: 44px; max-width: 34px; object-fit: contain; }
.ed-none { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0; }

.ed-main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ed-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tbtn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 14px;
  cursor: pointer;
}
.tbtn:hover { border-color: var(--accent); }
.tbtn.danger { color: #d33; }
.tbtn.rec-active { background: #e43c3c; color: #fff; border-color: #e43c3c; animation: recblink 1.2s infinite; }
@keyframes recblink { 50% { opacity: .75; } }
.tsep { width: 1px; height: 22px; background: var(--line); }
.tlabel { font-size: 12.5px; color: var(--muted); display: flex; gap: 5px; align-items: center; }
.tstat { font-size: 12.5px; color: var(--muted); margin-left: auto; }

.ed-hint {
  padding: 7px 12px;
  font-size: 12.5px;
  color: var(--muted);
  background: #fdf6e9;
  border-bottom: 1px solid var(--line);
}
.ed-hint kbd { font-size: 10.5px; }
.ed-hint:empty { display: none; }

.ed-canvas-wrap {
  position: relative;   /* якорь плавающей панели провода */
  flex: 1;
  min-height: 0;
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(0,0,0,.045) 1px, transparent 1px),
    linear-gradient(rgba(0,0,0,.045) 1px, transparent 1px);
  background-size: 20px 20px;
  background-color: #fbfcfd;
}
#ed-svg { display: block; touch-action: none; user-select: none; }

/* фигуры и клеммы */
.elnode { cursor: grab; }
.elnode:active { cursor: grabbing; }
.elnode .selrect { fill: none; stroke: transparent; stroke-width: 2.5; }
.elnode.sel .selrect { stroke: var(--accent); }
.port { cursor: crosshair; fill: #a9b4bf; stroke: #fff; stroke-width: 2; }
/* цвет точки — класс напряжения порта/линии (u), а не сторона:
   AC — красный, DC — синий, AC/DC — фиолетовый, тип не указан — бирюзовый */
.port-u-in { fill: #2f6fd6; }     /* вход питания — синий */
.port-u-out { fill: #e05252; }    /* выход источника — красный */
.port-u-sig { fill: #16a34a; }    /* сигнальный/пассивный контакт — зелёный */
.port.cand-bad { fill: #f6d7d7; stroke: #e05252 !important; stroke-width: 2.5; stroke-dasharray: 2.5 2; cursor: not-allowed; }
.port:hover, .port.hi { r: 9; stroke: #ffb020; stroke-width: 3; }
.porthit { fill: transparent; stroke: none; }
.porthit.hi { fill: rgba(255, 176, 32, .45); stroke: #ffb020; stroke-width: 2; }
/* кандидаты при протяжке провода: статичная зелёная обводка (без бесконечной
   анимации — она мешает скриншот-инструментам и гоняет композитор);
   !important — инлайн-стили жил внешних линий */
.port.cand { stroke: #3fa66a !important; stroke-width: 3; r: 8; }
.port.src { stroke: #ffb020 !important; stroke-width: 3; r: 9; }

/* провода рисуются ПОВЕРХ элементов (как в electric2d), кликается только линия */
.wire { pointer-events: stroke; cursor: pointer; stroke-linecap: round; }
.wire:hover { filter: brightness(1.3); }
.wire.sel { filter: drop-shadow(0 0 4px rgba(228, 60, 60, .95)); }
/* невидимая широкая дорожка под проводом — за неё удобно хватать мышью (наведение = голубое гало) */
.wirehit {
  stroke: transparent; fill: none; pointer-events: stroke;
  cursor: grab; stroke-linecap: round;
}
.wirehit:hover { stroke: rgba(42, 125, 225, .18); }
.wiremark {
  font-size: 15px;
  fill: #333;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  pointer-events: none;
  font-weight: 600;
}
.tempwire { stroke-dasharray: 7 6; stroke-width: 2.5; }
body.labels-hidden .wiremark, body.labels-hidden .eltext { display: none; }

/* текстовые подписи */
.eltext { cursor: grab; user-select: none; }

/* фикс высоты в режиме редактора */
body.editor-mode { height: 100vh; overflow: hidden; }
.ed-canvas-wrap { min-height: 0; }

.lockmark { pointer-events: none; }

/* ── Рейка: галерея щитов ── */
.topbar .logo.rlogo, .brand .logo { display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; border-radius:9px; background:#f5a524; color:#14100a;
  font-weight:800; font-size:1.15rem; }
.pg-back { position:fixed; inset:0; background:rgba(8,10,14,.6); backdrop-filter:blur(3px);
  display:flex; align-items:flex-start; justify-content:center; z-index:800; padding:5vh 16px; }
.pg-modal { background:#171c26; border:1px solid #2d3546; border-radius:14px; max-width:860px; width:100%;
  max-height:86vh; display:flex; flex-direction:column; box-shadow:0 10px 30px rgba(0,0,0,.45);
  color:#e8edf4; }   /* R12: явная пара foreground/background — унаследованный тёмный текст темы был нечитаем */
.pg-head { display:flex; justify-content:space-between; align-items:center; padding:14px 18px; border-bottom:1px solid #2d3546; }
.pg-head h3 { margin:0; font-size:1.05rem; color:#f4f7fb; }
.pg-list { overflow:auto; padding:12px; display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:8px; }
.pg-item { background:#1b202b; border:1px solid #2d3546; border-radius:9px; padding:9px 11px; cursor:pointer; position:relative; }
.pg-item:hover { border-color:#f5a524; }
.pg-item .nm { font-size:.86rem; font-weight:650; line-height:1.25; }
.pg-item .ct { font-size:.72rem; color:#8d99ab; margin-top:2px; }
.pg-x { background:none; border:none; color:#8d99ab; font-size:1.2rem; cursor:pointer; }
/* DIN-рейки */
.elnode.rail-bad image { filter: drop-shadow(0 0 4px rgba(239,68,68,.9)); }
/* оверлей первичной загрузки проекта (ввод заблокирован) */
.pg-back.pg-loading { cursor: wait; }
/* проекты */
.pg-actions { display:flex; gap:8px; padding:10px 12px; border-bottom:1px solid #2d3546; }
.pg-btn { background:#232b3a; color:#dfe6f1; border:1px solid #3a4457; border-radius:8px; padding:7px 11px; font-size:.8rem; cursor:pointer; }
.pg-btn:hover { border-color:#f5a524; color:#fff; }
.pg-item.cur { border-color:#f5a524; }
.pg-item .curtag { font-size:.66rem; color:#f5a524; font-weight:600; }
.pg-del { position:absolute; right:8px; top:50%; transform:translateY(-50%); background:none; border:none; cursor:pointer; font-size:.95rem; opacity:.35; padding:4px; }
.pg-item:hover .pg-del { opacity:1; }
.pg-del:hover { opacity:1; filter:drop-shadow(0 0 4px rgba(239,68,68,.8)); }

/* переключатель языка (TASK-013) — правый край шапки, рядом с пользователем */
.lang-switch { display: inline-flex; border: 1px solid var(--border, #d7dbe1); border-radius: 8px; overflow: hidden; flex: none; }
.topbar .lang-switch { margin: 0 0 0 4px; }
.lang-switch button { border: 0; background: transparent; padding: 5px 9px; font-size: 12px; cursor: pointer; color: inherit; font-weight: 600; text-decoration: none; }
.lang-switch button.on { background: #f5a524; color: #14100a; }

/* название проекта и шестерёнка настроек в шапке (режим редактора) */
.proj-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.proj-head.hidden { display: none; }
.proj-name { font-weight: 650; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 34vw; }
.proj-gear {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--txt); font-size: 16px; cursor: pointer; flex: none;
}
.proj-gear:hover { border-color: var(--accent); }

/* онбординг-подсказка редактора: показывается один раз, закрывается крестиком */
.ed-onboard {
  position: relative;
  margin: 10px 12px 0;
  padding: 10px 34px 10px 14px;
  border: 1px solid #e3d5ae;
  background: #fdf6e9;
  border-radius: 10px;
  font-size: 12.5px;
  color: #5a5347;
}
.ed-onboard.hidden { display: none; }
.ed-onboard-title { font-weight: 650; margin-bottom: 4px; color: #4a4436; }
.ed-onboard ol { margin: 0; padding-left: 18px; display: grid; gap: 2px; }
.ed-onboard kbd { font-size: 10.5px; }
.ed-onboard-close {
  position: absolute; right: 6px; top: 6px;
  width: 22px; height: 22px; border-radius: 6px;
  border: none; background: transparent; color: #8a7f66;
  font-size: 13px; cursor: pointer; line-height: 1;
}
.ed-onboard-close:hover { background: rgba(0,0,0,.06); color: #4a4436; }

/* контролы зума — правый нижний угол холста */
.ed-main { position: relative; }
.zoomctl {
  position: absolute; right: 14px; bottom: 56px; z-index: 40;
}
.zoomctl {
  display: flex; gap: 4px;
  background: var(--card, #fff);
  border: 1px solid var(--line, #d7dbe1);
  border-radius: 10px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(20,24,29,.08);
}

/* фасетные фильтры каталога (TASK-004) */
.ed-facets { border-bottom: 1px solid var(--ed-border, #3a4457); padding: 8px 10px 6px; }
.ed-facets-head { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; cursor: pointer; user-select: none; }
.ed-facets.collapsed .ed-facets-head { margin-bottom: 0; }
.ed-facets.collapsed .ed-facets-body { display: none; }
.ed-facets-tw { width: 12px; color: var(--ed-sec, #8b95a3); font-size: .72rem; }
.ed-facets-title { font-size: .8rem; font-weight: 650; color: var(--ed-sec, #8b95a3); }
.ed-facets-n {
  font-size: .68rem; font-weight: 650; color: #dcecff;
  background: #2f6fb8; border-radius: 999px; padding: 1px 7px;
}
.ed-fcount { font-size: .74rem; color: var(--ed-sec, #8b95a3); margin-left: auto; margin-top: 0; }
.ed-freset { border: 0; background: none; color: #4f9cf9; font-size: .76rem; cursor: pointer; padding: 0; }
.ed-freset:hover { text-decoration: underline; }
.ed-frow { display: flex; align-items: center; gap: 8px; margin: 4px 0; font-size: .78rem; }
.ed-flabel { color: var(--ed-sec, #8b95a3); min-width: 52px; }
.ed-fsel { flex: 1; min-width: 0; border: 1px solid #3a4457; background: #232b3a; color: #e8edf4; border-radius: 6px; padding: 3px 6px; font-size: .78rem; }
.ed-fchecks { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-fchecks label { display: inline-flex; align-items: center; gap: 3px; cursor: pointer; }
.ed-fcount { font-size: .74rem; color: var(--ed-sec, #8b95a3); margin-top: 4px; }
.ed-more { display: block; width: 100%; border: 1px dashed #3a4457; background: none; color: #4f9cf9; border-radius: 8px; padding: 8px; font-size: .8rem; cursor: pointer; margin: 6px 0; }
.ed-more:hover { border-color: #4f9cf9; }

/* обозначение под аппаратом + таблица линий (TASK-005) */
text.eltag { font: 600 12px -apple-system, Inter, sans-serif; fill: #1c2126; }
.lines-tbl { width: 100%; border-collapse: collapse; font-size: .8rem; }
.lines-tbl th { text-align: left; color: #8b95a3; font-weight: 600; padding: 4px 6px; border-bottom: 1px solid #3a4457; }
.lines-tbl td { padding: 3px 6px; border-bottom: 1px solid #2a3342; }
.lines-tbl input { width: 100%; min-width: 60px; border: 1px solid #3a4457; background: #232b3a; color: #e8edf4; border-radius: 6px; padding: 5px 7px; font-size: .8rem; }

/* спецификация и CSV (TASK-006) */
.spec-tbl { width: 100%; border-collapse: collapse; font-size: .8rem; }
.spec-tbl th { text-align: left; color: #8b95a3; font-weight: 600; padding: 4px 6px; border-bottom: 1px solid #3a4457; white-space: nowrap; }
.spec-tbl td { padding: 3px 6px; border-bottom: 1px solid #2a3342; }
.spec-tbl td.num, .spec-tbl th.num { text-align: right; white-space: nowrap; }
.spec-tbl input, .spec-tbl select { border: 1px solid #3a4457; background: #232b3a; color: #e8edf4; border-radius: 6px; padding: 4px 6px; font-size: .8rem; }
.spec-tbl .price-inp { width: 96px; text-align: right; }
.spec-tbl select:disabled { opacity: .45; }
.spec-unknown { color: #687783; }
.spec-tbl .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid #3a4457; }
.spec-section-h { color: #8b95a3; font-weight: 600; padding: 12px 18px 0; font-size: .8rem; }
.spec-totals { padding: 10px 18px 0; font-size: .84rem; display: grid; gap: 4px; }
.spec-totals .warn { color: #d99a2b; }
.spec-note { color: #687783; font-size: .74rem; padding: 6px 18px 0; }

/* выбор каталога/рынка (TASK-014) */
.ed-catalog { border-bottom: 1px solid var(--ed-border, #3a4457); padding: 8px 10px 6px; }
.cat-meta { font-size: .72rem; color: var(--ed-sec, #8b95a3); margin-top: 4px; line-height: 1.5; }
.cat-meta .warn { color: #d99a2b; }
g.cat-unavail .selrect { stroke: #d9a441; }

/* R4 (review-04 TASK-008): карточка пользовательского шаблона в тёмной модалке —
   цвета модальные (.pg-modal #171c26), не светлые переменные галереи (.card).
   tpl-nm #e8edf4 / фон #1f2635 ≈ 12.6:1; tpl-ct #a7b3c6 / #1f2635 ≈ 6.4:1 (≥4.5:1) */
.tpl-card { background:#1f2635; border:1px solid #2d3546; border-radius:10px; padding:10px 12px; margin:6px 0; display:flex; flex-direction:column; gap:6px; }
.tpl-nm { font-size:.88rem; font-weight:650; color:#e8edf4; line-height:1.25; }
.tpl-ct { font-size:.74rem; color:#a7b3c6; }

/* TASK-030: админ-блок — служебное меню справа внизу */
.admin-fab {
  position: fixed; right: 14px; bottom: 14px; z-index: 60;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line); color: var(--muted);
  font-size: 17px; display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: .5; transition: opacity .15s; user-select: none;
}
.admin-fab:hover { opacity: 1; border-color: var(--accent); color: var(--text); }
.admin-menu {
  position: fixed; right: 14px; bottom: 56px; z-index: 60;
  display: flex; flex-direction: column; gap: 2px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); min-width: 190px;
}
.admin-menu.hidden { display: none; }
.admin-menu .ami {
  border: 0; background: transparent; text-align: left; padding: 7px 10px;
  font-size: 13px; border-radius: 7px; cursor: pointer; color: inherit; white-space: nowrap;
}
.admin-menu .ami:hover { background: rgba(46, 167, 255, .12); }
.admin-menu .ami.rec-active { color: #fff; background: #e43c3c; animation: recblink 1.2s infinite; }
.admin-menu .amisection {
  font-size: 10.5px; color: var(--muted); padding: 5px 10px 2px;
  text-transform: uppercase; letter-spacing: .4px;
}

/* TASK-012: drag-and-drop из каталога */
.ed-drag-ghost {
  position: fixed; z-index: 100; pointer-events: none;
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--accent); border-radius: 8px;
  padding: 6px 10px; font-size: 12.5px; color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25); opacity: .95; max-width: 240px; white-space: nowrap; overflow: hidden;
}
.ed-drag-ghost img { width: 22px; height: 22px; object-fit: contain; }
.ed-canvas-wrap.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; }

/* ── плавающие панели выделенного (Miro-style): провод + объект (элемент/подпись/линия) ── */
#ed-wirebar, #ed-objbar {
  position: absolute; z-index: 60; display: flex; align-items: center; gap: 2px;
  background: #fff; border: 1px solid #d7dbe1; border-radius: 12px; padding: 4px 6px;
  box-shadow: 0 6px 18px rgba(12,16,22,.14);
}
#ed-wirebar.hidden, #ed-wbpal.hidden, #ed-objbar.hidden, #ed-obpal.hidden { display: none; }
#ed-wirebar .wbtn, #ed-objbar .wbtn {
  border: 0; background: transparent; border-radius: 8px; min-width: 28px; height: 28px;
  font-size: 14px; cursor: pointer; color: #1c2126; padding: 0 4px; line-height: 1;
}
#ed-wirebar .wbtn:hover, #ed-objbar .wbtn:hover { background: #f1f3f6; }
.wb-dot { display: block; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid #fff; box-shadow: 0 0 0 1px #c8cfd8; }
.wb-group { display: flex; align-items: center; gap: 2px; }
.wb-w { min-width: 14px; text-align: center; font-size: 13px; color: #1c2126; }
.wb-sep { width: 1px; height: 20px; background: #e3e6ea; margin: 0 4px; }
#ed-wbpal, #ed-obpal {
  position: absolute; z-index: 61; background: #fff; border: 1px solid #d7dbe1;
  border-radius: 12px; padding: 10px; box-shadow: 0 8px 22px rgba(12,16,22,.16);
  width: 190px;
}
#ed-obpal { display: flex; gap: 2px; width: auto; }
#ed-obpal.hidden { display: none; }
.wbp-wrap { position: relative; }
.wbp-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.wbp-sw {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid rgba(0,0,0,.15);
  cursor: pointer; padding: 0;
}
.wbp-sw.cur { outline: 2px solid #f5a524; outline-offset: 1px; }
.wbp-add {
  width: 22px; height: 22px; border-radius: 6px; border: 1px dashed #b9c1cb;
  background: #fff; color: #5b6673; font-size: 14px; line-height: 1; cursor: pointer; padding: 0;
}
.wbp-add:hover { border-color: #f5a524; color: #1c2126; }

/* выделенный бейдж внешней линии (панель объектов) */
.lineentry.sel rect { stroke: #1c5db8; stroke-width: 2; }

/* /eledit: невалидная грамматика напряжения у порта */
#ptBody input.bad { border-color: #e05252; background: #fdf0f0; }

/* конфликт синхронизации: неблокирующий баннер поверх холста (модалка глухо
   перехватывала ввод при любом расхождении ревизий) */
#ed-conflict {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  z-index: 60; max-width: min(760px, 94vw);
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: #fdf3df; border: 1px solid #d9a441; color: #6b5314;
  border-radius: 10px; padding: 10px 14px; font-size: .8rem; line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .14);
}
#ed-conflict .cb-text { flex: 1 1 320px; min-width: 220px; }
#ed-conflict .cb-actions { display: flex; gap: 8px; align-items: center; }
#ed-conflict .pg-btn { margin: 0; white-space: nowrap; }
#ed-conflict .cb-close {
  border: none; background: none; color: #9a7b2e; font-size: 15px;
  cursor: pointer; padding: 2px 6px; line-height: 1;
}
#ed-conflict .cb-close:hover { color: #6b5314; }
