/* ── LAYOUT ──────────────────────────────────────────────────────────────── */

.pe-body {
    margin: 0;
    overflow: hidden;
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.pe-nav {
    height: 52px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-muted);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 12px;
    flex-shrink: 0;
    z-index: 50;
}

.pe-nav-left  { display: flex; align-items: center; gap: 8px; }
.pe-nav-center { flex: 1; display: flex; justify-content: center; }
.pe-nav-right { display: flex; align-items: center; gap: 8px; }

.pe-nav-brand {
    font-weight: 700;
    font-size: 15px;
    color: #a78bfa;
    letter-spacing: -0.02em;
}

.pe-nav-page {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
}

.pe-nav-sep {
    width: 1px;
    height: 20px;
    background: var(--border-muted);
    flex-shrink: 0;
}

.pe-editor-wrap {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
    /* banner above is flex-shrink:0, so this fills the remaining space correctly */
}

/* ── VIEWPORT / CANVAS ───────────────────────────────────────────────────── */

.pe-viewport {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--bg-dark);
    background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
    background-size: 28px 28px;
    cursor: grab;
    user-select: none;
}

.pe-viewport.pe-panning {
    cursor: grabbing;
}

.pe-canvas {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
}

.pe-arrow-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 8000px;
    height: 8000px;
    pointer-events: none;
    overflow: visible;
}

.pe-arrow {
    fill: none;
    stroke: #3d3d5c;
    stroke-width: 2;
    marker-end: url(#pe-arrowhead);
}

/* ── CANVAS TOOLBAR ──────────────────────────────────────────────────────── */

.pe-canvas-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-muted);
    padding: 6px 12px;
}

.pe-toolbar-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.15s;
    font-family: inherit;
}

.pe-toolbar-btn:hover {
    background: var(--border-muted);
    color: var(--text-main);
}

.pe-toolbar-sep {
    width: 1px;
    height: 14px;
    background: var(--border-muted);
    flex-shrink: 0;
}

.pe-zoom-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    min-width: 36px;
    text-align: right;
}

/* ── NODE CARDS ──────────────────────────────────────────────────────────── */

.pe-node {
    position: absolute;
    width: 280px;
    background: #13111e;
    border: 1px solid var(--border-muted);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    transition: box-shadow 0.15s, border-color 0.15s;
}

.pe-node:hover {
    border-color: var(--border-bright);
    box-shadow: 0 6px 24px rgba(0,0,0,0.6);
}

.pe-node-header {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
    background: #1a1728;
    border-radius: 10px 10px 0 0;
    cursor: grab;
    border-bottom: 1px solid var(--border-muted);
}

.pe-node-header:active {
    cursor: grabbing;
}

.pe-drag-handle {
    color: var(--text-dim);
    font-size: 13px;
    cursor: grab;
    flex-shrink: 0;
    opacity: 0.5;
    padding: 4px 6px;
    margin: -4px -2px;
    border-radius: 3px;
}

.pe-drag-handle:hover {
    opacity: 1;
    background: rgba(255,255,255,0.07);
}

.pe-node-title {
    flex: 1;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    white-space: normal;
    word-break: break-word;
    letter-spacing: -0.01em;
}

.pe-collapse-btn,
.pe-add-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.15s;
    flex-shrink: 0;
}

.pe-collapse-btn {
    color: var(--text-dim);
    font-size: 10px;
}

.pe-collapse-btn:hover {
    background: var(--border-muted);
    color: var(--text-main);
}

.pe-add-btn {
    color: #7c3aed;
    font-size: 16px;
    font-weight: 300;
}

.pe-add-btn:hover {
    background: rgba(124,58,237,0.15);
    color: #a78bfa;
}

.pe-node-body {
    padding: 4px 0;
}

.pe-node-body.pe-collapsed {
    display: none;
}

.pe-node-empty {
    padding: 10px 12px;
    font-size: 11px;
    color: var(--text-dim);
    font-style: italic;
    opacity: 0.6;
}

/* ── SAVE NODE ───────────────────────────────────────────────────────────── */

.pe-node--save {
    border-color: rgba(6,182,212,0.25);
}

.pe-node--save:hover {
    border-color: rgba(6,182,212,0.45);
}

.pe-node--save .pe-node-header {
    background: rgba(6,182,212,0.08);
    border-bottom-color: rgba(6,182,212,0.2);
}

.pe-node--save .pe-node-title {
    color: #67e8f9;
}

.pe-step-row--save {
    cursor: default;
    opacity: 0.75;
}

.pe-step-row--save:hover {
    background: none;
}

/* ── STEP ROWS ───────────────────────────────────────────────────────────── */

.pe-step-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.1s;
}

.pe-step-row:last-child {
    border-bottom: none;
    border-radius: 0 0 9px 9px;
}

.pe-step-row:hover {
    background: rgba(255,255,255,0.04);
}

.pe-step-row.pe-step-row--active {
    background: rgba(124,58,237,0.12);
}

.pe-step-row--sub {
    padding-left: 24px;
    opacity: 0.55;
    position: relative;
}

.pe-step-row--sub::before {
    content: '';
    position: absolute;
    left: 13px;
    top: 50%;
    width: 6px;
    height: 1px;
    background: var(--border-muted);
}

.pe-step-row--sub:hover {
    opacity: 0.8;
}

.pe-step-badge {
    flex-shrink: 0;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 5px;
    border-radius: 3px;
    color: white;
    min-width: 52px;
    text-align: center;
}

.pe-step-title {
    font-size: 11px;
    color: var(--text-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
}

/* ── DETAIL PANEL ────────────────────────────────────────────────────────── */

.pe-detail-panel {
    width: 300px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-left: 1px solid var(--border-muted);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pe-detail-header {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-muted);
    flex-shrink: 0;
    background: #1a1728;
    gap: 8px;
}

.pe-detail-title {
    flex: 1;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
}

.pe-detail-close {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
    transition: all 0.15s;
}

.pe-detail-close:hover {
    background: var(--border-muted);
    color: var(--text-main);
}

.pe-detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pe-detail-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--border-muted);
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ── DETAIL FORM FIELDS ──────────────────────────────────────────────────── */

.pe-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pe-field label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-dim);
}

.pe-field input[type="text"],
.pe-field input[type="number"],
.pe-field input:not([type]),
.pe-field textarea,
.pe-field select {
    background: var(--bg-inset);
    border: 1px solid var(--border-muted);
    border-radius: 6px;
    color: var(--text-main);
    padding: 6px 9px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}

.pe-field input:focus,
.pe-field textarea:focus,
.pe-field select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px var(--accent-purple-glow);
}

.pe-toggle-row {
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.pe-toggle-row label {
    min-width: 80px;
}

.pe-toggle-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-purple);
}

.pe-range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pe-range-inputs input {
    width: 70px !important;
}

.pe-range-sep {
    color: var(--text-dim);
    font-size: 11px;
}

.pe-radio-group {
    display: flex;
    gap: 14px;
    padding: 2px 0;
}

.pe-radio-group label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
}

.pe-radio-group input[type="radio"] {
    accent-color: var(--accent-purple);
}

.pe-hint {
    font-size: 10px;
    color: var(--text-dim);
    opacity: 0.7;
    font-style: italic;
    margin-top: -4px;
}

/* ── TAG EDITOR ──────────────────────────────────────────────────────────── */

.pe-tag-editor {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pe-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 22px;
}

.pe-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(124,58,237,0.15);
    border: 1px solid rgba(124,58,237,0.3);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: #c4b5fd;
    font-family: 'JetBrains Mono', monospace;
}

/* Input key color states */
.pe-tag--green {
    background: rgba(34,197,94,0.12) !important;
    border-color: rgba(34,197,94,0.35) !important;
    color: #86efac !important;
}

.pe-tag--red {
    background: rgba(239,68,68,0.12) !important;
    border-color: rgba(239,68,68,0.35) !important;
    color: #fca5a5 !important;
}

.pe-tag--yellow {
    background: rgba(245,158,11,0.12) !important;
    border-color: rgba(245,158,11,0.35) !important;
    color: #fcd34d !important;
    cursor: pointer;
}

.pe-tag--yellow:hover {
    background: rgba(245,158,11,0.22) !important;
}


.pe-tag-x {
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 10px;
    padding: 0;
    line-height: 1;
    transition: color 0.1s;
}

.pe-tag-x:hover {
    color: #ef4444;
}

.pe-tag-input {
    background: var(--bg-inset) !important;
    border: 1px dashed var(--border-bright) !important;
    border-radius: 6px;
    color: var(--text-main) !important;
    padding: 5px 8px !important;
    font-size: 11px !important;
    font-family: 'JetBrains Mono', monospace;
    width: 100% !important;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}

.pe-tag-input:focus {
    border-color: var(--accent-purple) !important;
    border-style: solid !important;
}

/* ── MAPPING ROWS ────────────────────────────────────────────────────────── */

#pef-mapping {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pe-map-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pe-map-row input {
    flex: 1;
    background: var(--bg-inset);
    border: 1px solid var(--border-muted);
    border-radius: 5px;
    color: var(--text-main);
    padding: 4px 7px;
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    outline: none;
    transition: border-color 0.15s;
}

.pe-map-row input:focus {
    border-color: var(--accent-purple);
}

.pe-map-arrow {
    color: var(--text-dim);
    font-size: 12px;
    flex-shrink: 0;
}

.pe-map-del {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 13px;
    padding: 2px 4px;
    border-radius: 3px;
    line-height: 1;
    transition: all 0.1s;
    flex-shrink: 0;
}

.pe-map-del:hover {
    background: rgba(239,68,68,0.15);
    color: #ef4444;
}

.pe-small-btn {
    background: none;
    border: 1px dashed var(--border-muted);
    border-radius: 5px;
    color: var(--text-dim);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.15s;
    width: 100%;
    font-family: inherit;
    text-align: left;
    margin-top: 2px;
}

.pe-small-btn:hover {
    border-color: var(--accent-purple);
    color: var(--text-main);
}

/* ── TYPE MODAL ──────────────────────────────────────────────────────────── */

.pe-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 200;
    backdrop-filter: blur(2px);
}

.pe-type-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-bright);
    border-radius: 12px;
    padding: 20px;
    z-index: 201;
    width: 480px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}

.pe-type-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.pe-type-modal-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.pe-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.pe-type-card {
    background: var(--bg-dark);
    border: 1px solid var(--border-muted);
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.pe-type-card:hover {
    border-color: var(--accent-purple);
    background: rgba(124,58,237,0.08);
}

.pe-type-card-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.pe-type-card-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
    font-family: 'JetBrains Mono', monospace;
}

.pe-type-card-desc {
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1.4;
}

/* ── TOAST ───────────────────────────────────────────────────────────────── */

.pe-toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 9999;
    pointer-events: none;
}

.pe-toast {
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    animation: pe-toast-in 0.2s ease;
    pointer-events: none;
}

.pe-toast-success { background: #065f46; color: #6ee7b7; border: 1px solid #059669; }
.pe-toast-error   { background: #7f1d1d; color: #fca5a5; border: 1px solid #dc2626; }
.pe-toast-info    { background: #1e1b4b; color: #a5b4fc; border: 1px solid #4f46e5; }

@keyframes pe-toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── DIRTY SAVE BUTTON ───────────────────────────────────────────────────── */

#pe-save-btn.dirty {
    background-color: #4c1d95 !important;
    border-color: #7c3aed !important;
    box-shadow: 0 0 12px rgba(124,58,237,0.4) !important;
}

/* ── UTILITY ─────────────────────────────────────────────────────────────── */

/* ── READ-ONLY BANNER ────────────────────────────────────────────────────── */

.pe-readonly-banner {
    background: rgba(120, 53, 15, 0.5);
    border-bottom: 1px solid rgba(180, 83, 9, 0.4);
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #fcd34d;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.pe-readonly-dupe-btn {
    background: rgba(180, 83, 9, 0.4);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 5px;
    color: #fde68a;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}

.pe-readonly-dupe-btn:hover {
    background: rgba(180, 83, 9, 0.7);
    color: white;
}

/* ── NODE TITLE CLICK TARGET ─────────────────────────────────────────────── */

.pe-node-title {
    cursor: pointer;
}

.pe-node-title:hover {
    text-decoration: underline;
    text-decoration-style: dotted;
}

/* ── PROMPT TEXTAREA ─────────────────────────────────────────────────────── */

.pe-prompt-textarea {
    width: 100%;
    box-sizing: border-box;
    background: #1a1a2e;
    color: #e0e0f0;
    border: 1px solid #3a3a5c;
    border-radius: 4px;
    padding: 8px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    min-height: 160px;
}

.pe-prompt-textarea:focus {
    outline: none;
    border-color: #7c3aed;
}

/* ── FORMAT STEP ─────────────────────────────────────────────────────────── */

.pe-fmt-key-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.pe-fmt-key {
    cursor: pointer;
    user-select: none;
}

.pe-fmt-key:hover {
    filter: brightness(1.2);
}

.pe-fmt-textarea {
    width: 100%;
    box-sizing: border-box;
    background: #1a1a2e;
    color: #e0e0f0;
    border: 1px solid var(--border-muted);
    border-radius: 5px;
    padding: 8px;
    font-family: monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    min-height: 60px;
}

.pe-fmt-textarea:focus {
    outline: none;
    border-color: #7c3aed;
}

/* ── POOL PICKER ─────────────────────────────────────────────────────────── */

.pe-pool-picker-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pe-pool-trigger {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-dark);
    border: 1px solid var(--border-muted);
    border-radius: 6px;
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    color: var(--text-main);
    text-align: left;
    transition: border-color 0.15s;
    min-width: 0;
}

.pe-pool-trigger:hover {
    border-color: var(--border-bright);
}

.pe-pool-trigger-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pe-pool-trigger-arrow {
    color: var(--text-dim);
    font-size: 10px;
    flex-shrink: 0;
}

.pe-pool-source-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
    letter-spacing: 0.04em;
}

.pe-pool-source-ootb     { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.pe-pool-source-pipeline { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.pe-pool-source-global   { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }

.pe-pool-edit-btn {
    background: var(--bg-dark);
    border: 1px solid var(--border-muted);
    border-radius: 5px;
    color: var(--text-dim);
    font-size: 13px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    flex-shrink: 0;
}

.pe-pool-edit-btn:hover {
    color: var(--text-main);
    border-color: var(--border-bright);
}

/* ── POOL DROPDOWN ───────────────────────────────────────────────────────── */

.pe-pool-dropdown {
    position: fixed;
    background: var(--bg-surface);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    z-index: 500;
    max-height: 340px;
    overflow-y: auto;
    padding: 4px 0;
}

.pe-pool-section {
    padding: 4px 0;
}

.pe-pool-section + .pe-pool-section {
    border-top: 1px solid var(--border-muted);
}

.pe-pool-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
    padding: 6px 12px 2px;
}

.pe-pool-entry {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.1s;
}

.pe-pool-entry:hover {
    background: rgba(255,255,255,0.05);
}

.pe-pool-entry--active {
    background: rgba(124, 58, 237, 0.2);
    color: #c4b5fd;
}

.pe-pool-entry-name {
    flex: 1;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pe-pool-entry-count {
    font-size: 11px;
    color: var(--text-dim);
    flex-shrink: 0;
}

.pe-pool-entry-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.1s;
}

.pe-pool-entry:hover .pe-pool-entry-actions {
    opacity: 1;
}

.pe-pool-action-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 12px;
    font-family: inherit;
    transition: all 0.1s;
}

.pe-pool-action-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-main);
}

.pe-pool-del-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.pe-pool-empty {
    font-size: 11px;
    color: var(--text-dim);
    padding: 4px 12px;
    font-style: italic;
}

.pe-pool-new-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    cursor: pointer;
    font-family: inherit;
    transition: color 0.1s;
}

.pe-pool-new-btn:hover {
    color: var(--text-main);
}

/* ── POOL MODAL ──────────────────────────────────────────────────────────── */

.pe-pool-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    z-index: 600;
    backdrop-filter: blur(2px);
}

.pe-pool-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-bright);
    border-radius: 12px;
    z-index: 601;
    width: 520px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}

.pe-pool-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border-muted);
    flex-shrink: 0;
}

.pe-pool-modal-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.pe-pool-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pe-pool-modal-name-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg-dark);
    border: 1px solid var(--border-muted);
    border-radius: 5px;
    padding: 6px 8px;
    font-size: 12px;
    color: var(--text-main);
    font-family: inherit;
}

.pe-pool-modal-name-input:focus {
    outline: none;
    border-color: #7c3aed;
}

.pe-pool-modal-meta {
    font-size: 11px;
    color: var(--text-dim);
    padding: 2px 0 4px;
}

.pe-pool-modal-textarea {
    width: 100%;
    box-sizing: border-box;
    background: #1a1a2e;
    color: #e0e0f0;
    border: 1px solid var(--border-muted);
    border-radius: 5px;
    padding: 8px;
    font-family: monospace;
    font-size: 11px;
    line-height: 1.5;
    resize: vertical;
    min-height: 200px;
    max-height: 40vh;
}

.pe-pool-modal-textarea:focus {
    outline: none;
    border-color: #7c3aed;
}

.pe-pool-preview {
    background: #1a1a2e;
    border: 1px solid var(--border-muted);
    border-radius: 5px;
    padding: 8px;
    font-family: monospace;
    font-size: 11px;
    line-height: 1.5;
    color: #a0a0c0;
    white-space: pre;
    overflow-x: auto;
    max-height: 160px;
    overflow-y: auto;
}

.pe-pool-modal-file-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-top: 4px;
}

.pe-pool-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 10px 16px;
    border-top: 1px solid var(--border-muted);
    flex-shrink: 0;
}

/* ── UTILITY ─────────────────────────────────────────────────────────────── */

.pe-hidden {
    display: none !important;
}

/* ── VIEW TABS ───────────────────────────────────────────────────────────── */

.pe-view-tab {
    height: 28px;
    padding: 0 14px;
    border-radius: 6px;
    border: 1px solid var(--border-muted);
    background: transparent;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pe-view-tab:hover {
    background: var(--bg-raised);
    color: var(--text-main);
}
.pe-view-tab--active {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}
.pe-view-tab--active:hover {
    background: #6d28d9;
}

/* Shared input/select styles usable outside .pe-field */
.pe-input,
.pe-select {
    background: var(--bg-inset);
    border: 1px solid var(--border-muted);
    border-radius: 6px;
    color: var(--text-main);
    font-size: 12px;
    padding: 5px 8px;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.15s;
}
.pe-input:focus,
.pe-select:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 2px var(--accent-purple-glow);
}

/* ── DISPLAY EDITOR PANEL ────────────────────────────────────────────────── */

.pe-display-panel {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    background: var(--bg-dark);
    min-height: 0;
}

.pe-display-body {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 24px 48px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.pe-display-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-muted);
    border-radius: 10px;
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pe-display-section-title {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-dim);
    margin-bottom: 2px;
}

.pe-display-section-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
}
.pe-display-section-toggle:hover {
    color: var(--text-main);
}

.pe-display-chevron {
    font-size: 10px;
    color: var(--text-dim);
}

.pe-display-key-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pe-display-key-pill {
    background: var(--bg-raised);
    border: 1px solid var(--border-muted);
    border-radius: 4px;
    padding: 2px 8px;
    font-family: monospace;
    font-size: 11px;
    color: var(--text-main);
}

.pe-display-key-pill--image {
    border-color: #f97316;
    color: #f97316;
}

.pe-display-hint {
    font-size: 12px;
    color: var(--text-dim);
    font-style: italic;
}

.pe-display-field-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.pe-display-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    min-width: 110px;
    padding-top: 7px;
    flex-shrink: 0;
}

.pe-display-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #7c3aed;
}

/* Modal section items */
.pe-display-modal-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-muted);
}
.pe-display-modal-item:last-child {
    border-bottom: none;
}

.pe-display-item-label {
    flex: 1.5;
    min-width: 0;
}

.pe-display-item-key,
.pe-display-item-style {
    flex: 1;
    min-width: 0;
}

.pe-display-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.pe-display-modal-group {
    background: var(--bg-raised);
    border: 1px solid #7c3aed44;
    border-left: 3px solid #7c3aed;
    border-radius: 6px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 4px;
}

.pe-display-modal-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.pe-display-add-sub {
    align-self: flex-start;
    margin-top: 4px;
    font-size: 11px;
}

.pe-display-add-row {
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-muted);
    margin-top: 4px;
}

.pe-btn-danger {
    color: #ef4444 !important;
}
.pe-btn-danger:hover {
    background: #ef444422 !important;
}
