body {
    font-family: Arial, sans-serif;
    padding: 20px;
    margin: auto;
    background-color: #f5f5f5;
    color: #333;
    max-width: 100%;
    box-sizing: border-box;
}

body.embedded-view {
    padding: 10px;
    margin: 0;
    background-color: transparent;
}

h2,
#total-cost {
    color: #333;
}

h2 {
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

form {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
    background-color: #fff;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    line-height: 1.2;
}

label {
    margin-top: 5px;
    margin-bottom: 5px;
    font-weight: bold;
    cursor: pointer;
}

input[type="text"],
input[type="email"],
input[type="tel"],
select,
input[type="submit"],
.switch {
    padding: 10px;
    margin-top: 5px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
    height: 40px;
}

input[type="submit"] {
    background-color: #333;
    color: #fff;
    border: none;
    cursor: pointer;
    padding: 10px;
}

input[type="submit"]:hover {
    background-color: #555;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
select:focus {
    outline: none;
    border-color: #555;
}

.preview-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 15mm;
    height: 15mm;
    background-color: #f0f0f0;
    overflow: visible; /* Изменено с hidden на visible */
    margin-right: 5px;
    float: left;
    z-index: 0;
}

.preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.delete-button {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(255, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 15px;
    height: 15px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    z-index: 1;
}

.delete-button:hover {
    background: rgba(255, 0, 0, 1);
}

.delete-button::after {
    content: "Удалить";
    position: absolute;
    top: -30px;
    right: 50%;
    transform: translateX(50%);
    background: black;
    color: white;
    padding: 5px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 2;
}

.delete-button:hover::after {
    opacity: 1;
}

.switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
    margin-top: 5px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

input:focus + .slider {
    box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

@media (max-width: 768px) {
    table {
        width: 100%;
        border-collapse: collapse;
        text-align: center;
    }
    th, td {
        border: 1px solid black;
        padding: 8px;
    }
    .hide-mobile {
        display: none;
    }
}

@media (max-width: 600px) {
    body {
        padding: 0;
        margin: 0;
        background-color: #fff;
    }

    input, select {
        font-size: 0.9em;
        padding: 8px;
    }

    .switch {
        width: 50px;
        height: 28px;
    }

    .slider:before {
        height: 22px;
        width: 22px;
    }

    .form-shell {
        padding: 0;
        max-width: 100%;
        width: 100%;
        margin: 0;
    }

    .form-shell form {
        border-radius: 0;
        box-shadow: none;
        padding: 16px;
        width: 100%;
        box-sizing: border-box;
        margin: 0;
    }

    .switch-field {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .switch-field .slider {
        margin-bottom: 4px;
    }

    .form-section,
    .upload-section,
    .multi-size-panel,
    .pricing-section,
    .consent-section,
    .upload-note,
    .multi-size-table-wrapper,
    .multi-size-summary {
        width: 100%;
        padding: 0 16px;
        box-sizing: border-box;
    }

    .form-section {
        grid-template-columns: 1fr;
        justify-content: stretch;
    }

    .upload-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .preview-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        width: 100%;
    }

    .multi-size-panel table,
    .multi-size-panel thead,
    .multi-size-panel tbody,
    .multi-size-panel tr,
    .multi-size-panel th,
    .multi-size-panel td {
        display: block;
        width: 100%;
    }

    .multi-size-panel thead {
        position: absolute;
        height: 0;
        width: 0;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .multi-size-panel tbody tr {
        border: 1px solid #dfe3eb;
        border-radius: 12px;
        padding: 12px;
        margin-bottom: 12px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
        background: #fff;
    }

    .multi-size-panel td {
        border: none;
        padding: 6px 0;
    }

    .multi-size-panel td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.8rem;
        text-transform: uppercase;
        color: #6b7280;
        margin-bottom: 2px;
    }

    .multi-size-summary,
    .upload-note {
        padding: 12px 16px;
    }

    .crop-modal {
        padding: 0;
        align-items: stretch;
    }

    .cropper-shell {
        border-radius: 0;
        max-width: none;
        height: 100vh;
        padding: 12px;
    }

    .cropper-canvas-wrapper {
        flex: 1;
        max-height: none;
        height: calc(100vh - 150px);
    }

    .cropper-actions {
        justify-content: space-between;
    }
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
}

.close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.close:hover,
.close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

body {
    font-family: Arial, sans-serif;
    margin: 20px;
}

h1, h2 {
    color: #333;
}

form {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-top: 10px;
}

input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 8px;
    margin-top: 5px;
    box-sizing: border-box;
}

button {
    margin-top: 10px;
    padding: 10px 20px;
    background-color: #28a745;
    color: white;
    border: none;
    cursor: pointer;
}

button:hover {
    background-color: #218838;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table,
th,
td {
    border: 1px solid #ddd;
}

th,
td {
    padding: 10px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

.action-buttons {
    display: flex;
    gap: 5px;
}

.action-buttons button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
}

.action-buttons button.delete {
    background-color: #dc3545;
}

.action-buttons button:hover {
    opacity: 0.8;
}

.formatted-text {
    font-style: italic;
    font-family: 'Courier New', Courier, monospace;
}

.smart-captcha-holder {
    width: 0;
    height: 0;
    overflow: hidden;
}

.smart-captcha-popup {
    border-radius: 12px !important;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2) !important;
    font-family: inherit !important;
}

.smart-captcha-popup__header {
    background-color: #333 !important;
    color: #fff !important;
    font-family: inherit !important;
}

.smart-captcha-popup__submit {
    background-color: #333 !important;
    border-radius: 6px !important;
}

/* ---------- Новые стили формы печати ---------- */
.form-shell {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
}

.form-shell form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px;
}

.form-title {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
    text-align: center;
}

.form-subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 1.5rem;
}

.form-section {
    display: grid;
    grid-template-columns: minmax(280px, 520px);
    justify-content: center;
    justify-items: stretch;
    gap: 6px;
    margin: 0 auto;
    width: 100%;
}

.form-section label {
    margin: 0;
    line-height: 1.1;
}

.form-section input,
.form-section select {
    margin: 0 0 4px;
    height: 36px;
}

.form-section label,
.upload-section label {
    font-weight: 600;
    color: #222;
}

.size-picker-row {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
}

.size-picker-row select {
    flex: 1;
}

.helper-text {
    font-size: 0.92rem;
    color: #555;
    margin: 4px 0 0;
}

.multi-size-toggle {
    display: flex;
    gap: 8px;
    align-items: center;
    font-weight: 500;
    margin-top: 4px;
    cursor: pointer;
}

.multi-size-toggle input {
    width: 20px;
    height: 20px;
}

.ghost-button--small {
    width: auto;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.multi-size-panel {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    background: #fdfdfd;
    display: none;
    flex-direction: column;
    gap: 12px;
}

.multi-size-panel.is-active {
    display: flex;
}

.multi-size-panel[hidden] {
    display: none !important;
}

.multi-size-panel h2 {
    margin: 0;
    font-size: 1.2rem;
    text-align: left;
}

.multi-size-table-wrapper {
    overflow-x: auto;
}

.multi-size-panel table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.multi-size-panel th,
.multi-size-panel td {
    border: 1px solid #e5e7eb;
    padding: 10px;
    text-align: left;
}

.multi-size-panel th {
    background: #f1f5f9;
    font-weight: 600;
}

.multi-size-panel .empty-row td {
    text-align: center;
    color: #6b7280;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-thumb-wrapper {
    flex: 0 0 64px;
    width: 64px;
    height: 64px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    cursor: zoom-in;
    position: relative;
}

.file-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.file-thumb-wrapper:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.file-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-meta strong {
    font-size: 1rem;
}

.file-size-meta {
    font-size: 0.85rem;
    color: #6b7280;
}

.multi-size-summary {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 12px;
    font-size: 0.95rem;
    color: #14532d;
}

.multi-size-summary ul {
    margin: 6px 0 0;
    padding-left: 20px;
}

.multi-size-summary li {
    margin: 2px 0;
}

.crop-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: #15803d;
}

.crop-status::before {
    content: '✔';
    font-size: 0.9rem;
}

.crop-modal {
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.crop-modal[aria-hidden="false"],
.crop-modal.open {
    display: flex;
}

.cropper-shell {
    background: #fff;
    padding: 20px;
    border-radius: 12px;
    max-width: 720px;
    width: 100%;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cropper-header h2 {
    margin: 0;
}

.cropper-canvas-wrapper {
    width: 100%;
    max-height: 60vh;
    overflow: hidden;
}

.cropper-canvas-wrapper img {
    max-width: 100%;
    display: block;
}

.cropper-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.primary-button {
    background: #1d4ed8;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    cursor: pointer;
}

.primary-button:hover {
    background: #1e40af;
}

.upload-section input[type="file"] {
    margin-top: 8px;
}

.upload-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upload-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.95rem;
    color: #555;
}

.ghost-button {
    border: 1px dashed #999;
    background: transparent;
    color: #333;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
}

.ghost-button:disabled,
.ghost-button[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
}

.ghost-button:not(:disabled):hover {
    border-color: #555;
    color: #000;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    justify-items: center;
}

.preview-card {
    position: relative;
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    overflow: hidden;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 200px;
    min-width: 140px;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.08);
    padding: 10px;
}

.preview-image-wrapper {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.preview-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: zoom-in;
    display: block;
}

.preview-meta {
    position: absolute;
    bottom: 6px;
    left: 8px;
    padding: 2px 6px;
    font-size: 0.75rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 999px;
}

.delete-button {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 16px;
}

.upload-progress {
    border: 1px solid #e1e1e1;
    border-radius: 12px;
    padding: 12px 16px;
    background: #fff7ec;
}

.progress-label {
    font-weight: 600;
    margin-bottom: 6px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #f1f1f1;
    overflow: hidden;
}

.progress-fill {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #ff9f43, #ff6b6b);
    transition: width 0.2s ease;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    margin-top: 6px;
    color: #555;
}

.pricing-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    background: #f8f9fb;
    border-radius: 12px;
    padding: 16px;
}

.pricing-section div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 0.95rem;
}

.pricing-section strong {
    font-size: 1.2rem;
    color: #111;
}

.consent-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.switch-field {
    display: flex;
    align-items: center;
    gap: 16px;
}

.switch-field input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-field .slider {
    position: relative;
    width: 56px;
    height: 30px;
    background: #d9d9de;
    border-radius: 999px;
    transition: background 0.3s ease, box-shadow 0.2s ease;
    box-shadow: inset 0 0 0 2px #b0b0b8;
}

.switch-field .slider:before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    transition: transform 0.3s ease;
}

.switch-field input:checked + .slider {
    background: #2f80ed;
    box-shadow: inset 0 0 0 2px #1e64c8;
}

.switch-field input:checked + .slider:before {
    transform: translateX(26px);
}

.switch-field input:focus-visible + .slider,
.switch-field input:focus + .slider {
    box-shadow: inset 0 0 0 2px #1e64c8, 0 0 0 2px rgba(47, 128, 237, 0.35);
}

.consent-text {
    font-weight: 600;
}

.consent-hint {
    margin: 0;
    color: #666;
    font-size: 0.9rem;
}

.upload-note {
    font-size: 0.95rem;
    color: #555;
    background: #f1f8ff;
    border-left: 4px solid #2f80ed;
    padding: 12px;
    border-radius: 8px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

@media (max-width: 640px) {
    .upload-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .pricing-section {
        grid-template-columns: 1fr;
    }
}
