/* ==========================================================
   NDM ENGINEERING DIALOGS
   ========================================================== */

.engineering-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(0, 0, 0, 0.58);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.16s ease,
        visibility 0.16s ease;
}

.engineering-modal.visible {
    opacity: 1;
    visibility: visible;
}

body.engineering-dialog-open {
    overflow: hidden;
}

.engineering-dialog {
    width: min(680px, 94vw);
    max-height: 90vh;

    overflow-y: auto;

    background: #ffffff;
    color: #18212f;

    border-radius: 14px;

    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.35);

    font-family:
        Inter,
        Arial,
        sans-serif;
}

.dialog-header {
    position: sticky;
    top: 0;
    z-index: 2;

    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    padding: 18px 20px;

    background: #ffffff;

    border-bottom:
        1px solid #e5e7eb;
}

.dialog-title {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
}

.dialog-subtitle {
    margin-top: 4px;

    color: #64748b;

    font-size: 13px;
}

.dialog-close {
    width: 34px;
    height: 34px;

    border: 0;
    border-radius: 8px;

    background: #f1f5f9;

    color: #475569;

    font-size: 23px;
    line-height: 1;

    cursor: pointer;
}

.dialog-close:hover {
    background: #e2e8f0;
}

.dialog-section {
    margin: 14px 18px 0;

    border:
        1px solid #e2e8f0;

    border-radius: 10px;

    overflow: hidden;
}

.dialog-section-title {
    padding: 9px 12px;

    background: #f8fafc;

    border-bottom:
        1px solid #e2e8f0;

    font-size: 13px;
    font-weight: 700;

    color: #334155;
}

.dialog-section-body {
    padding: 8px 12px;
}

.dialog-row {
    display: grid;

    grid-template-columns:
        minmax(140px, 0.8fr)
        minmax(160px, 1.2fr);

    gap: 16px;

    padding: 7px 0;

    border-bottom:
        1px solid #f1f5f9;
}

.dialog-row:last-child {
    border-bottom: 0;
}

.dialog-label {
    color: #64748b;
    font-size: 13px;
}

.dialog-value {
    color: #172033;
    font-size: 13px;
    font-weight: 600;
    word-break: break-word;
}

.dialog-table {
    width: 100%;

    overflow: hidden;

    border:
        1px solid #e2e8f0;

    border-radius: 7px;
}

.dialog-table-head,
.dialog-table-row {
    display: grid;
    grid-template-columns:
        minmax(0, 1fr)
        100px;
}

.dialog-table-head {
    padding: 8px 10px;

    background: #f8fafc;

    color: #64748b;

    font-size: 12px;
    font-weight: 700;
}

.dialog-table-row {
    padding: 8px 10px;

    border-top:
        1px solid #f1f5f9;

    font-size: 13px;
}

.dialog-table-row span:last-child,
.dialog-table-head span:last-child {
    text-align: right;
}

.dialog-simple-list {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(170px, 1fr)
        );

    gap: 6px;
}

.dialog-list-item {
    padding: 7px 9px;

    border:
        1px solid #e2e8f0;

    border-radius: 6px;

    background: #f8fafc;

    font-size: 12px;
}

.dialog-empty {
    padding: 12px;

    color: #64748b;

    background: #f8fafc;

    border-radius: 7px;

    font-size: 13px;
}

.dialog-note {
    padding: 9px 10px;

    background: #f8fafc;

    border-radius: 7px;

    white-space: pre-wrap;

    font-size: 13px;
    line-height: 1.5;
}

.dialog-footer {
    display: flex;
    justify-content: flex-end;

    padding: 16px 18px;
}

.dialog-button {
    min-width: 90px;

    padding: 8px 16px;

    border: 0;
    border-radius: 8px;

    background: #1f2937;
    color: #ffffff;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
}

.dialog-button:hover {
    background: #111827;
}

.viewer-toast {
    position: fixed;

    left: 50%;
    bottom: 24px;

    z-index: 11000;

    transform:
        translate(-50%, 20px);

    opacity: 0;

    padding: 10px 15px;

    border-radius: 8px;

    background: #1f2937;
    color: #ffffff;

    font-size: 13px;

    pointer-events: none;

    transition:
        opacity 0.18s ease,
        transform 0.18s ease;
}

.viewer-toast.visible {
    opacity: 1;

    transform:
        translate(-50%, 0);
}

.viewer-toast.error {
    background: #991b1b;
}

@media (max-width: 620px) {

    .engineering-modal {
        padding: 10px;
    }

    .engineering-dialog {
        width: 100%;
        max-height: 94vh;
    }

    .dialog-row {
        grid-template-columns: 1fr;
        gap: 3px;
    }

    .dialog-table-head,
    .dialog-table-row {
        grid-template-columns:
            minmax(0, 1fr)
            70px;
    }
}
