.template-layout-review-overlay {
    position: fixed;
    inset: 0;
    z-index: 10020;
    display: grid;
    place-items: center;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 24px;
    background: rgba(4, 8, 18, 0.72);
    backdrop-filter: blur(8px);
    -webkit-overflow-scrolling: touch;
}

.template-layout-review-dialog {
    box-sizing: border-box;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: min(920px, 100%);
    height: min(820px, 92vh);
    max-height: min(820px, 92vh);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 18px;
    background: #111827;
    color: #f8fafc;
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}

.template-layout-review-dialog > header,
.template-layout-review-dialog > footer {
    position: static;
    inset: auto;
    z-index: auto;
    width: auto;
    max-width: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px 24px;
    background: transparent;
    backdrop-filter: none;
    box-shadow: none;
}

.template-layout-review-dialog > header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.template-layout-review-dialog > header p,
.template-layout-review-dialog > header h2,
.template-layout-review-dialog > header small {
    margin: 0;
}

.template-layout-review-dialog > header p {
    color: #5eead4;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.template-layout-review-dialog > header h2 {
    margin-top: 4px;
    font-size: 22px;
}

.template-layout-review-dialog > header small,
.template-layout-review-help,
.template-layout-review-copy small {
    color: #94a3b8;
}

.template-layout-review-image {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.template-layout-review-image > span {
    color: var(--text-secondary, #667085);
    font-size: 12px;
}

.template-layout-review-image input {
    font-size: 12px;
    max-width: 260px;
}

.template-layout-review-close {
    flex: 0 0 auto;
    width: 44px;
    min-width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: #cbd5e1;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}

.template-layout-review-body {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 20px 24px;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.template-layout-review-thumbnail {
    display: block;
    width: min(300px, 100%);
    max-height: 220px;
    margin-bottom: 16px;
    object-fit: contain;
    border-radius: 10px;
    background: #f5f6f9;
}

.template-layout-review-help {
    margin: 0 0 16px;
    line-height: 1.5;
}

.template-layout-review-scoring {
    margin: -8px 0 16px;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.4;
}

.template-layout-review-list {
    display: grid;
    gap: 10px;
}

.template-layout-review-row {
    display: grid;
    grid-template-columns: 34px 112px minmax(0, 1fr) minmax(150px, 190px);
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.template-layout-review-preview {
    display: grid;
    place-items: center;
    width: 112px;
    height: 70px;
    overflow: hidden;
    border-radius: 8px;
    background: #f5f6f9;
}

.template-layout-review-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.template-layout-review-preview-empty {
    color: #64748b;
    font-size: 10px;
    text-align: center;
}

.template-layout-review-index {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: rgba(45, 212, 191, 0.14);
    color: #5eead4;
    font-weight: 800;
}

.template-layout-review-copy {
    display: grid;
    min-width: 0;
    gap: 4px;
}

.template-layout-review-recommendation,
.template-layout-review-capacity {
    color: #5eead4;
    font-size: 11px;
    font-weight: 700;
}

.template-layout-review-capacity {
    color: #94a3b8;
    font-weight: 600;
}

.template-layout-review-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.template-layout-review-row select {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    background: #1f2937;
    color: #f8fafc;
}

.template-layout-review-dialog > footer {
    justify-content: flex-end;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.template-layout-review-dialog > footer button {
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 9px;
    font-weight: 800;
    cursor: pointer;
}

.template-layout-review-cancel {
    border: 1px solid rgba(255, 255, 255, 0.16);
    background: transparent;
    color: #cbd5e1;
}

.template-layout-review-confirm {
    border: 0;
    background: #14b8a6;
    color: #042f2e;
}

.template-layout-review-confirm:disabled {
    opacity: 0.6;
    cursor: wait;
}

.template-layout-review-error {
    margin: 14px 0 0;
    color: #fb7185;
}

@media (max-width: 680px) {
    .template-layout-review-overlay {
        align-items: stretch;
        overflow-y: auto;
        padding:
            max(8px, env(safe-area-inset-top))
            max(8px, env(safe-area-inset-right))
            max(8px, env(safe-area-inset-bottom))
            max(8px, env(safe-area-inset-left));
    }

    .template-layout-review-dialog {
        width: 100%;
        height: calc(100vh - 16px);
        height: calc(100dvh - 16px);
        min-height: 0;
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        border-radius: 14px;
    }

    .template-layout-review-dialog > header {
        align-items: flex-start;
        padding: 16px;
        gap: 12px;
    }

    .template-layout-review-dialog > header h2 {
        font-size: 18px;
        line-height: 1.25;
    }

    .template-layout-review-dialog > header small {
        display: block;
        line-height: 1.4;
    }

    .template-layout-review-body {
        padding: 16px;
    }

    .template-layout-review-thumbnail {
        width: 100%;
        max-height: 180px;
        margin-bottom: 12px;
    }

    .template-layout-review-help {
        margin-bottom: 12px;
        font-size: 13px;
    }

    .template-layout-review-dialog > footer {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 14px 16px;
        gap: 10px;
    }

    .template-layout-review-dialog > footer button {
        width: 100%;
    }

    .template-layout-review-row {
        align-items: start;
        grid-template-columns: 30px 96px minmax(0, 1fr);
        gap: 10px;
        padding: 10px;
    }

    .template-layout-review-preview {
        width: 96px;
        height: 60px;
    }

    .template-layout-review-row select {
        grid-column: 1 / -1;
        min-height: 44px;
    }

    .template-layout-review-copy small {
        overflow: visible;
        text-overflow: clip;
        white-space: normal;
        line-height: 1.35;
    }

    .template-layout-review-image {
        align-items: stretch;
        flex-direction: column;
    }

    .template-layout-review-image input {
        width: 100%;
        max-width: none;
        min-height: 44px;
        padding: 8px 0;
        font-size: 13px;
    }
}

@media (max-width: 420px) {
    .template-layout-review-dialog > footer {
        grid-template-columns: 1fr;
    }

    .template-layout-review-cancel {
        order: 2;
    }
}
