/*
 * =========================================================
 * ВКЛАДКА «МЕСТО» — ВЛОЖЕННЫЕ БЛОКИ
 * Тип блока отличается цветом и значком, подписей типов нет.
 * =========================================================
 */

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

.pt-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.pt-bar-label { color: #666; }
.pt-status { margin-left: auto; color: #666; font-size: 12px; }
.pt-status.pt-err { color: #a33; }

.pt-btn { padding: 5px 10px; cursor: pointer; }

.pt-add-root { min-width: 44px; font-size: 15px; color: #fff; border: none; border-radius: 4px; }

.pt-box { background: #fff; border: 1px solid #ccc; border-radius: 4px; padding: 10px; min-height: 240px; }
.pt-box.pt-drop-root { outline: 2px dashed #3b82f6; outline-offset: -4px; }

.pt-empty { color: #888; padding: 30px 10px; text-align: center; }

/* ---------- цвета типов ---------- */

.pt-t-group      { --c: #5b6b8c; --bg: #f1f3f8; }
.pt-t-region     { --c: #2e7d6b; --bg: #eef7f4; }
.pt-t-substation { --c: #c27a1a; --bg: #fdf5e8; }
.pt-t-bay        { --c: #7b4fa0; --bg: #f6f0fa; }

.pt-add-root.pt-t-group, .pt-add-root.pt-t-region,
.pt-add-root.pt-t-substation, .pt-add-root.pt-t-bay { background: var(--c); }

/* ---------- блок ---------- */

.pt-block {
    margin: 6px 0;
    border: 1px solid var(--c);
    border-left-width: 5px;
    border-radius: 5px;
    background: var(--bg);
}

.pt-block.pt-moving { opacity: 0.4; }

/* выбранное присоединение (его данные открыты во вкладке «РЗА») */
.pt-block.pt-selected { box-shadow: 0 0 0 3px #3b82f6; background: #e3f0ff; }
.pt-t-bay .pt-head { cursor: pointer; }

.pt-head {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    cursor: grab;
    border-radius: 4px;
    border-top: 3px solid transparent;
    border-bottom: 3px solid transparent;
}

.pt-head:active { cursor: grabbing; }

.pt-toggle { width: 18px; height: 18px; padding: 0; border: none; background: none; cursor: pointer; color: #555; font-size: 11px; }
.pt-toggle.pt-leaf { visibility: hidden; cursor: default; }

.pt-icon { flex: none; width: 22px; text-align: center; color: var(--c); font-size: 17px; line-height: 1; user-select: none; }

.pt-name {
    flex: 1;
    min-width: 80px;
    max-width: 420px;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    font-size: 14px;
    font-weight: bold;
    color: #222;
    cursor: text;
}
.pt-name:hover { border-color: #ccc; }
.pt-name:focus { border-color: #64748b; background: #fff; outline: none; }
.pt-name::placeholder { color: #aaa; font-weight: normal; }

.pt-acts { display: flex; gap: 3px; opacity: 0.35; }
.pt-block:hover > .pt-head .pt-acts, .pt-head:focus-within .pt-acts { opacity: 1; }
.pt-act { padding: 1px 7px; cursor: pointer; font-size: 12px; }
.pt-act.pt-del { color: #a33; }

.pt-children { margin: 0 8px 8px 22px; padding-left: 8px; }

/* ---------- перетаскивание ---------- */

.pt-dragging .pt-children:empty {
    min-height: 26px;
    margin-bottom: 8px;
    border: 1px dashed var(--c);
    border-radius: 4px;
}

.pt-head.pt-drop-before { border-top-color: #3b82f6; }
.pt-head.pt-drop-after  { border-bottom-color: #3b82f6; }
.pt-block.pt-drop-in    { outline: 2px solid #3b82f6; outline-offset: 1px; background: #e3f0ff; }

/* ---------- меню выбора типа ---------- */

.pt-menu { position: absolute; z-index: 1000; min-width: 170px; background: #fff; border: 1px solid #999; border-radius: 4px; box-shadow: 0 3px 10px rgba(0,0,0,0.2); padding: 3px; }
.pt-menu-title { padding: 3px 8px; color: #777; font-size: 11px; }
.pt-menu button { display: block; width: 100%; padding: 6px 10px; border: none; background: none; text-align: left; cursor: pointer; font-size: 13px; }
.pt-menu button:hover { background: #e3f0ff; }
