/*
 * =========================================================
 * КОНСТРУКТОР ОБОРУДОВАНИЯ РЗА
 * =========================================================
 */

.eq-root { padding: 10px; font-family: Arial, sans-serif; font-size: 13px; }

.eq-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }

.eq-layout { display: grid; grid-template-columns: 220px 1fr 280px; gap: 12px; align-items: start; }

.eq-side, .eq-main, .eq-tplview { background: #fff; border: 1px solid #ccc; border-radius: 4px; padding: 10px; }

.eq-side select, .eq-side .eq-btn { width: 100%; margin-top: 6px; box-sizing: border-box; }

.eq-title { font-weight: bold; margin-bottom: 8px; }

.eq-hint { color: #666; font-size: 12px; margin: 4px 0; }

.eq-item { padding: 6px 8px; border-radius: 3px; cursor: pointer; }
.eq-item:hover { background: #f0f0f0; }
.eq-item.active { background: #e3f0ff; font-weight: bold; }

.eq-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.eq-row input { flex: 1; padding: 5px; }

.eq-group { border: 1px solid #bbb; border-radius: 4px; padding: 8px; margin-bottom: 10px; background: #fafafa; }
.eq-group-head { display: flex; gap: 8px; margin-bottom: 6px; }
.eq-group-head input { flex: 1; font-weight: bold; padding: 4px; }

.eq-group table { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.eq-group th { text-align: left; font-size: 11px; color: #666; font-weight: normal; }
.eq-group td { padding: 2px; }
.eq-group td input, .eq-group td select { width: 100%; box-sizing: border-box; padding: 3px; }

.eq-w-key { width: 60px; }
.eq-w-unit { width: 40px; }
.eq-w-def { width: 60px; }
.eq-w-sel { width: auto; min-width: 60px; max-width: 120px; }
.eq-invalid { border-color: #d32f2f !important; background: #ffebee !important; color: #b71c1c; }

.eq-code { display: inline-block; min-width: 22px; padding: 2px 4px; border-radius: 10px; color: #fff; font-weight: bold; text-align: center; }

.eq-group td input[readonly], .eq-group td input:disabled { background: #eee; color: #555; }

.eq-btn { padding: 6px 10px; cursor: pointer; }
.eq-out { background: #fff; }

.eq-ok, .eq-no { padding: 6px 8px; margin-top: 6px; border-radius: 3px; }
.eq-ok { background: #e6f4ea; border: 1px solid #9ccc9c; }
.eq-no { background: #fdeaea; border: 1px solid #e0a0a0; color: #7a2a2a; }


/*
 * =========================================================
 * ШАБЛОНЫ ДОКУМЕНТОВ (правая панель вкладки «Оборудование»)
 * =========================================================
 */

.eq-tpl { margin-top: 16px; border-top: 1px solid #ddd; padding-top: 10px; }

.eq-mini { float: right; padding: 0 6px; cursor: pointer; background: #fff; border: 1px solid #ccc; border-radius: 3px; }

.eq-tpl-item { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 3px; cursor: pointer; }
.eq-tpl-item:hover { background: #f0f0f0; }
.eq-tpl-item.open { background: #e3f0ff; font-weight: bold; }
.eq-tpl-item.missing .eq-tpl-name { color: #999; text-decoration: line-through; }

.eq-tpl-arrow { width: 12px; color: #666; flex: none; }
.eq-tpl-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.eq-tpl-badge { flex: none; padding: 0 6px; border-radius: 9px; background: #ddd; color: #555; font-size: 11px; font-weight: normal; }
.eq-tpl-badge.on { background: #2e7d32; color: #fff; }

.eq-tpl-body { margin: 2px 0 8px 12px; padding-left: 8px; border-left: 2px solid #cfe0f5; }

.eq-tc { padding: 6px 0; border-bottom: 1px dashed #ddd; }
.eq-tc:last-child { border-bottom: none; }

.eq-tc-head { display: flex; align-items: center; gap: 6px; }
.eq-tc-head b { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.eq-tc-val { flex: none; color: #777; font-size: 12px; }

/* Точка привязки: пустое кольцо — не привязано, цветная — привязано */
.eq-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; box-sizing: border-box; border: 2px solid #aaa; background: #fff; }

.eq-tc-warn { color: #a33; font-size: 11px; margin-top: 2px; }


/*
 * =========================================================
 * ПЕРЕМЕЩЕНИЕ СТРОК ПАРАМЕТРОВ
 * =========================================================
 */

.eq-group td.eq-move { white-space: nowrap; width: 1%; }

.eq-grip { display: inline-block; padding: 0 4px; color: #999; cursor: grab; user-select: none; letter-spacing: -2px; }
.eq-grip:hover { color: #333; }
.eq-grip:active { cursor: grabbing; }

.eq-move button { width: 20px; padding: 0; cursor: pointer; background: #fff; border: 1px solid #ccc; border-radius: 3px; }
.eq-move button:disabled { opacity: .3; cursor: default; }

.eq-group tr.eq-dragging { opacity: .4; }
.eq-group tr.eq-over-top td { box-shadow: inset 0 2px 0 #1976d2; }
.eq-group tr.eq-over-bottom td { box-shadow: inset 0 -2px 0 #1976d2; }


/*
 * =========================================================
 * ПРЕОБРАЗОВАТЕЛИ «ВХОД -> ВЫХОД»
 * Вход слева, выход справа, формулы пересчёта посередине.
 * =========================================================
 */

.eq-convs { margin: 8px 0; }
.eq-convs-title { font-size: 11px; color: #666; margin-bottom: 4px; }

.eq-conv { position: relative; display: grid; grid-template-columns: 140px minmax(0, 1fr) 140px; gap: 10px; align-items: stretch; margin-bottom: 8px; padding: 8px 14px; background: #fff; border: 1px solid #bbb; border-radius: 4px; }

.eq-conv-pt { position: relative; padding: 4px 6px; border: 1px solid #ddd; border-radius: 4px; background: #fafafa; }
.eq-conv-pt.drv { border-color: #1976d2; box-shadow: inset 0 0 0 1px #1976d2; background: #f2f8ff; }

.eq-conv-cap { font-size: 11px; color: #666; margin-bottom: 3px; }
.eq-conv-pt select { width: 100%; box-sizing: border-box; padding: 3px; margin-bottom: 4px; }

.eq-conv-val { display: flex; align-items: center; gap: 4px; }
.eq-conv-val input { flex: 1; min-width: 0; box-sizing: border-box; padding: 3px; font-weight: bold; }
.eq-conv-val span { flex: none; color: #666; font-size: 12px; }

/* точки на левой и правой границе карточки */
.eq-conv-dot { position: absolute; top: 50%; width: 12px; height: 12px; margin-top: -6px; }
.eq-conv-in .eq-conv-dot { left: -20px; }
.eq-conv-out .eq-conv-dot { right: -20px; }

.eq-conv-mid { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

.eq-conv-f { display: flex; align-items: center; gap: 4px; }
.eq-conv-dir { flex: none; width: 50px; font-size: 11px; color: #666; }
.eq-conv-f > input { flex: 1 1 120px; min-width: 80px; box-sizing: border-box; padding: 3px; font-family: Consolas, monospace; }
.eq-conv-ins { flex: none; width: 46px; padding: 3px; }
.eq-conv-eq { flex: none; font-weight: bold; }
.eq-conv-res { flex: none; min-width: 44px; padding: 2px 6px; background: #eee; border-radius: 3px; text-align: right; font-weight: bold; }
.eq-conv-n { flex: none; font-size: 11px; color: #666; white-space: nowrap; }
.eq-conv-n input { width: 38px; padding: 2px; }

.eq-conv-note { width: 100%; box-sizing: border-box; padding: 3px; color: #444; }

.eq-conv-err { min-height: 14px; font-size: 11px; color: #a33; }

.eq-conv-del { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; padding: 0; line-height: 1; cursor: pointer; background: #fff; border: 1px solid #ccc; border-radius: 3px; }
.eq-conv-del:hover { color: #a33; border-color: #a33; }

.eq-conv-clone { position: absolute; top: 2px; right: 24px; width: 18px; height: 18px; padding: 0; line-height: 1; cursor: pointer; background: #fff; border: 1px solid #ccc; border-radius: 3px; }
.eq-conv-clone:hover { color: #1976d2; border-color: #1976d2; }


/* центральная колонка: устройство, а под ним — шаблон документа */
.eq-center { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.eq-tplview:empty { display: none; }

/* диапазон, зависящий от другого параметра */
.eq-range-dep { display: flex; align-items: center; gap: 3px; margin-top: 3px; font-size: 11px; color: #666; }
.eq-group .eq-range-dep select { flex: 1 1 auto; width: auto; min-width: 0; }
.eq-group .eq-range-dep input { flex: none; width: 46px; }
.eq-group input.eq-range-auto { background: #f1f5f9; color: #1565c0; font-weight: 600; cursor: default; }

/* Рисунок — в правой колонке, выше «Проверки привязки» */
.eq-imgbox { background: #fff; border: 1px solid #ccc; border-radius: 4px; padding: 10px; margin-bottom: 12px; }
.eq-imgbox .eq-btn { width: 100%; margin-top: 6px; box-sizing: border-box; }
.eq-imgframe { display: flex; align-items: center; justify-content: center; min-height: 100px; max-height: 160px; border: 1px solid #ddd; border-radius: 3px; background: #fafafa; overflow: hidden; }
.eq-imgframe img { max-width: 100%; max-height: 160px; object-fit: contain; }
