* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f0f2f5;
    font-family: "Segoe UI", Arial, sans-serif;
    color: #1f2937;
}

.wrapper {
    display: flex;
    justify-content: center;
    padding: 16px;
}

.card {
    background: #fff;
    width: 100%;
    max-width: 640px;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.card.is-viewer-mode {
    max-width: 920px;
    padding: 14px;
}

.title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 12px;
    text-align: center;
    line-height: 1.3;
}

.status {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #eef6ff;
    color: #0f5ea8;
    font-size: 13px;
    line-height: 1.35;
}

.status.is-error {
    background: #fff1f1;
    color: #b42318;
}

.status.is-hidden {
    display: none;
}

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

.content {
    min-height: 120px;
}

input,
textarea,
select,
.admin-type-select,
.nav-btn,
#finishBtn {
    width: 100%;
    font-size: 14px;
    font-family: inherit;
}

input,
textarea,
.content select,
.admin-type-select {
    margin-bottom: 12px;
    padding: 10px;
    border: 1px solid #d0d5dd;
    border-radius: 6px;
    background: #fff;
    color: inherit;
}

textarea {
    min-height: 88px;
    resize: vertical;
}

.photo-row {
    margin-bottom: 8px;
}

.photo-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.photo-upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #b8dffc;
    border-radius: 6px;
    background: #f5fbff;
    color: #0f5ea8;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.photo-upload-btn:hover {
    background: #e8f6ff;
}

.photo-upload-btn.is-selected {
    background: #ecfaf3;
    border-color: #9bd3b4;
    color: #0c6e40;
}

.file-note {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 12px;
    color: #667085;
    word-break: break-word;
}

.file-note.is-warning {
    color: #b42318;
}

.billing-title {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    background: #f3f7fc;
    color: #1d2939;
    font-size: 14px;
    font-weight: 600;
}

.billing-label {
    margin-bottom: 6px;
    color: #344054;
    font-size: 13px;
    font-weight: 500;
}

.billing-money-row {
    display: grid;
    grid-template-columns: 1fr 150px;
    gap: 8px;
}

.billing-money-row input,
.billing-money-row select {
    margin-bottom: 12px;
}

.nav-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 4px;
}

.nav-btn {
    padding: 10px 12px;
    border: 1px solid #b8dffc;
    border-radius: 6px;
    background: #f5fbff;
    color: #0f5ea8;
    font-weight: 600;
    cursor: pointer;
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

#finishBtn {
    margin-top: 12px;
    padding: 11px 12px;
    background: #2fc6f6;
    border: none;
    border-radius: 6px;
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

#finishBtn:disabled {
    opacity: 0.7;
    cursor: default;
}

.empty-state {
    padding: 14px;
    border: 1px dashed #d0d5dd;
    border-radius: 8px;
    background: #fafafa;
    color: #475467;
    text-align: center;
}

.admin-panel {
    display: grid;
    gap: 14px;
}

.admin-note {
    padding: 10px 12px;
    border-radius: 6px;
    background: #f7f9fc;
    color: #344054;
    font-size: 13px;
    line-height: 1.35;
}

.admin-group {
    padding: 12px;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #fcfcfd;
}

.admin-group-title {
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #1d2939;
}

.admin-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.admin-label {
    display: block;
    margin-top: 6px;
    color: #344054;
    font-size: 13px;
    font-weight: 500;
}

.admin-label:first-child {
    margin-top: 0;
}

.admin-row {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(150px, 1.4fr) 120px 86px 92px;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.admin-row:last-child {
    margin-bottom: 10px;
}

.admin-row input,
.admin-row .admin-type-select {
    margin-bottom: 0;
}

.admin-key-input {
    font-family: "Consolas", "Menlo", monospace;
    font-size: 13px;
}

.admin-small-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    color: #344054;
    font-size: 13px;
    white-space: nowrap;
}

.admin-small-check input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.admin-remove-btn {
    height: 38px;
    border: 1px solid #f1c0c0;
    border-radius: 6px;
    background: #fff5f5;
    color: #b42318;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.admin-remove-btn:hover {
    background: #feecec;
}

.admin-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    color: #344054;
    font-size: 13px;
}

.admin-check input {
    width: 16px;
    height: 16px;
    margin: 0;
}

.admin-btn-inline {
    max-width: 220px;
    margin-top: 2px;
}

.admin-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.admin-save-btn {
    background: #e6f4ff;
    border-color: #87c6f5;
    color: #0f5ea8;
}

.admin-reset-btn {
    background: #f9fafb;
    border-color: #d0d5dd;
    color: #344054;
}

.launcher-search-row {
    display: grid;
    grid-template-columns: 1fr 130px;
    gap: 8px;
    margin-bottom: 10px;
}

.launcher-search-row input {
    margin-bottom: 0;
}

.launcher-row {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 8px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #eaecf0;
}

.launcher-row:first-child {
    border-top: 0;
}

.launcher-title {
    color: #101828;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.launcher-meta {
    margin-top: 2px;
    color: #667085;
    font-size: 12px;
}

.launcher-open-btn {
    margin: 0;
}

.launcher-more-btn {
    margin-top: 10px;
}

.viewer-panel {
    display: grid;
    gap: 12px;
}

.viewer-note {
    padding: 10px 12px;
    border-radius: 6px;
    background: #eef6ff;
    color: #0f5ea8;
    font-size: 13px;
    line-height: 1.35;
}

.viewer-card {
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #fcfcfd;
    padding: 10px 12px;
}

.viewer-card-title {
    margin-bottom: 4px;
    color: #1d2939;
    font-size: 14px;
    font-weight: 700;
}

.viewer-card-product {
    margin-bottom: 8px;
    color: #344054;
    font-size: 15px;
    font-weight: 600;
}

.viewer-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 12px;
    align-items: start;
}

.viewer-fields {
    display: grid;
    gap: 6px;
}

.viewer-field {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 8px;
    align-items: baseline;
}

.viewer-field-label {
    color: #475467;
    font-size: 13px;
    font-weight: 600;
}

.viewer-field-value {
    color: #1d2939;
    font-size: 13px;
    line-height: 1.35;
    word-break: break-word;
}

.viewer-field-value a {
    color: #0f5ea8;
    text-decoration: underline;
}

.viewer-field-plain {
    color: #1d2939;
    font-size: 13px;
    line-height: 1.35;
    word-break: break-word;
}

.viewer-photo-pane {
    border: 1px solid #dce2ea;
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}

.viewer-photo-link {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
    text-align: left;
    appearance: none;
    -webkit-appearance: none;
}

.viewer-photo-link:focus-visible {
    outline: 2px solid #0f5ea8;
    outline-offset: 2px;
}

.viewer-photo-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 270px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eef2f6;
    background: #f8fafc;
}

.viewer-photo-meta {
    margin-top: 6px;
    font-size: 12px;
    color: #667085;
    word-break: break-word;
}

.viewer-photo-empty {
    padding: 12px 8px;
    text-align: center;
    color: #667085;
    font-size: 13px;
    border: 1px dashed #d0d5dd;
    border-radius: 6px;
    background: #fafafa;
}

.viewer-raw {
    margin: 0;
    padding: 12px;
    border: 1px dashed #d0d5dd;
    border-radius: 8px;
    background: #fafafa;
    color: #344054;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

.photo-viewer-open {
    overflow: hidden;
}

.photo-viewer-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.photo-viewer-modal.is-open {
    display: flex;
}

.photo-viewer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 23, 0.78);
}

.photo-viewer-dialog {
    position: relative;
    z-index: 1;
    width: min(96vw, 1080px);
    height: min(92vh, 820px);
    border-radius: 12px;
    overflow: hidden;
    background: #0b1220;
    display: grid;
    grid-template-rows: auto 1fr;
    box-shadow: 0 18px 44px rgba(2, 6, 23, 0.48);
}

.photo-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: #111827;
    color: #f8fafc;
}

.photo-viewer-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
}

.photo-viewer-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.photo-viewer-btn,
.photo-viewer-close {
    min-width: 36px;
    height: 34px;
    padding: 0 10px;
    border: 1px solid #344054;
    border-radius: 8px;
    background: #1f2937;
    color: #f8fafc;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.photo-viewer-btn:hover,
.photo-viewer-close:hover {
    background: #253247;
}

.photo-viewer-stage {
    position: relative;
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: #020617;
    touch-action: none;
}

.photo-viewer-image {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(2, 6, 23, 0.45);
    transform-origin: center center;
    transition: transform 120ms ease;
    user-select: none;
    -webkit-user-drag: none;
}

@media (max-width: 640px) {
    .wrapper {
        padding: 8px;
    }

    .card {
        padding: 14px;
        border-radius: 8px;
        box-shadow: none;
    }

    .title {
        font-size: 16px;
    }

    .nav-row {
        gap: 8px;
    }

    .admin-row {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .admin-actions {
        grid-template-columns: 1fr;
    }

    .admin-btn-inline {
        max-width: none;
    }

    .launcher-search-row {
        grid-template-columns: 1fr;
    }

    .launcher-row {
        grid-template-columns: 1fr;
    }

    .billing-money-row {
        grid-template-columns: 1fr;
    }

    .card.is-viewer-mode {
        max-width: 100%;
        padding: 12px;
    }

    .viewer-card-body {
        grid-template-columns: 1fr;
    }

    .viewer-field {
        grid-template-columns: 1fr;
        gap: 2px;
    }

    .photo-viewer-dialog {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .photo-viewer-header {
        padding: 8px 10px;
    }

    .photo-viewer-title {
        font-size: 13px;
    }

    .photo-viewer-btn,
    .photo-viewer-close {
        min-width: 34px;
        height: 32px;
        padding: 0 8px;
    }

    .photo-viewer-stage {
        padding: 8px;
    }
}
