/* ═══════════════════════════════════════════════════════════════
   INLINE EDIT — Pencil Button
═══════════════════════════════════════════════════════════════ */

.ie-pencil-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 1.5px solid transparent;
    background: transparent;
    color: #94a3b8;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    padding: 0;
    /* hidden by default */
    opacity: 0;
    pointer-events: none;
}

/* ── Show on hover of ANY of these parent containers ── */
.ie-pencil-parent:hover .ie-pencil-btn,
.pane-header:hover .ie-pencil-btn,
.proc-card-top:hover .ie-pencil-btn {
    opacity: 1;
    pointer-events: auto;
}

/* Object mini-card: always slightly visible, full opacity on hover */
.obj-mini-card {
    position: relative;
    /* needed for pencil btn stacking */
}

.obj-mini-card .ie-pencil-btn {
    opacity: 0.45;
    pointer-events: auto;
    width: 18px;
    height: 18px;
    font-size: 9px;
}

.obj-mini-card:hover .ie-pencil-btn {
    opacity: 1;
}

/* ── Hover colour variants ── */
.ie-pencil-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #475569;
    transform: scale(1.1);
}

.ie-pencil-btn.ie-pencil-green:hover {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #047857;
}

.ie-pencil-btn.ie-pencil-indigo:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
    color: #4338ca;
}

.ie-pencil-btn.ie-pencil-amber:hover {
    background: #fef3c7;
    border-color: #fcd34d;
    color: #b45309;
}

.ie-pencil-btn.ie-pencil-blue:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

.ie-pencil-btn.ie-pencil-purple:hover {
    background: #f3e8ff;
    border-color: #c4b5fd;
    color: #6d28d9;
}

.ie-pencil-btn:active {
    transform: scale(0.93);
}


/* ═══════════════════════════════════════════════════════════════
   MODAL BACKDROP
═══════════════════════════════════════════════════════════════ */

.ie-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: ie-fade-in 0.15s ease both;
}

@keyframes ie-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}


/* ═══════════════════════════════════════════════════════════════
   MODAL BOX
═══════════════════════════════════════════════════════════════ */

.ie-modal {
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18), 0 4px 16px rgba(0, 0, 0, 0.08);
    width: 100%;
    max-width: 520px;
    max-height: 86vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* entry animation */
    transform: translateY(14px) scale(0.97);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.15s ease;
}

.ie-modal.ie-modal-in {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.ie-modal-list {
    max-width: 440px;
}

/* ── Header ── */
.ie-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 14px;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.ie-modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ie-modal-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.ie-modal-title {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
}

.ie-modal-subtitle {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
    font-weight: 500;
}

.ie-close-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: none;
    background: #f8fafc;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    flex-shrink: 0;
}

.ie-close-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* ── Body ── */
.ie-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(33, 191, 117, 0.15) transparent;
}

.ie-modal-body::-webkit-scrollbar {
    width: 4px;
}

.ie-modal-body::-webkit-scrollbar-thumb {
    background: rgba(33, 191, 117, 0.2);
    border-radius: 4px;
}

/* ── Fields ── */
.ie-field-group {
    margin-bottom: 14px;
}

.ie-field-group:last-child {
    margin-bottom: 0;
}

.ie-label {
    display: block;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #64748b;
    margin-bottom: 6px;
    font-family: 'JetBrains Mono', monospace;
}

.ie-inp {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    font-size: 13px;
    color: #1e293b;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.ie-inp:focus {
    border-color: var(--ie-color, #21bf75);
    background: #ffffff;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ie-color, #21bf75) 14%, transparent);
}

.ie-inp[readonly] {
    opacity: 0.45;
    cursor: not-allowed;
    background: #f1f5f9;
}

.ie-inp-lg {
    font-size: 14px;
    font-weight: 700;
    padding: 10px 14px;
}

.ie-textarea {
    resize: vertical;
    min-height: 62px;
    line-height: 1.5;
}

/* ── Attribute rows ── */
.ie-attrs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.ie-attr-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    background: #f1f5f9;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    color: #64748b;
    margin-left: 5px;
}

.ie-col-labels {
    display: flex;
    gap: 8px;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
}

.ie-col-labels span {
    flex: 1;
    text-align: center;
}

.ie-attrs-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ie-attr-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    transition: background 0.12s;
}

.ie-attr-row:hover {
    background: #f0fdf4;
    border-color: #d1fae5;
}

.ie-attr-num {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    background: #e2e8f0;
    color: #64748b;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}

.ie-attr-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.ie-attr-fields .ie-inp {
    padding: 6px 8px;
    font-size: 11px;
}

.ie-pk-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: 800;
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}

/* ── List rows ── */
.ie-list-rows {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ie-list-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ie-list-num {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #64748b;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}

.ie-list-inp {
    flex: 1;
    padding: 8px 11px;
}

.ie-lock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #94a3b8;
    font-size: 9px;
    flex-shrink: 0;
}

.ie-empty {
    text-align: center;
    padding: 16px;
    font-size: 12px;
    color: #94a3b8;
    font-style: italic;
}

/* ── Footer ── */
.ie-modal-footer {
    padding: 14px 20px;
    border-top: 1px solid #f1f5f9;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
    background: #fafafa;
    border-radius: 0 0 18px 18px;
}

.ie-btn-cancel {
    padding: 8px 18px;
    border-radius: 9px;
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.ie-btn-cancel:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

.ie-btn-save {
    padding: 8px 20px;
    border-radius: 9px;
    border: none;
    background: #21bf75;
    color: white;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    box-shadow: 0 2px 8px rgba(33, 191, 117, 0.3);
}

.ie-btn-save:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33, 191, 117, 0.4);
}

.ie-btn-save:active {
    transform: translateY(0);
    filter: brightness(0.96);
}

/* ── Responsive ── */
@media (max-width: 540px) {
    .ie-modal {
        border-radius: 14px;
        max-height: 92vh;
    }

    .ie-modal-header {
        padding: 14px 14px 12px;
    }

    .ie-modal-body {
        padding: 14px;
    }

    .ie-modal-footer {
        padding: 12px 14px;
    }

    .ie-attr-fields {
        grid-template-columns: 1fr;
    }

    .ie-col-labels {
        display: none;
    }
}