﻿:root {
    --bg-shapka: url('../Image/Shapka.png');
    --bg-szat-sh1: url('../Image/szat_sh1.png');
    --bg-szat-sh2: url('../Image/szat_sh2.png');
    --bg-convert-sh2: url('../Image/convert_sh2.png');
    --bg-gen-sh1: url('../Image/gen_sh1.png');
    --bg-gen-sh2: url('../Image/gen_sh2.png');
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f7fa;
    color: #2d3748;
    line-height: 1.6;
    padding: 8px 24px 24px;
    max-width: 1080px;
    margin: 0 auto;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,32,44,0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(2px);
}

    .loading-overlay.visible {
        display: flex;
    }

.loading-box {
    background: #fff;
    border-radius: 14px;
    padding: 28px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 240px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e2e8f0;
    border-top-color: #4299e1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: 14px;
    color: #4a5568;
    font-weight: 600;
    text-align: center;
}

.site-header {
    position: relative;
    background-color: #ffffff;
    background-image: var(--bg-shapka);
    background-repeat: no-repeat;
    background-position: right center;
    background-size: contain;
    border-radius: 14px;
    padding: 32px 28px;
    margin-bottom: 20px;
    min-height: 320px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

h1 {
    font-size: 26px;
    margin-bottom: 8px;
    color: #1a202c;
}

.subtitle {
    color: #718096;
    font-size: 15px;
    max-width: 55%;
}

.credits-balance {
    display: inline-flex;
    gap: 16px;
    margin-top: 16px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.92);
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    width: fit-content;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer;
    position: relative;
    z-index: 2;
}

    .credits-balance:hover {
        border-color: #4299e1;
        box-shadow: 0 2px 8px rgba(66,153,225,0.25);
    }

.credits-item {
    white-space: nowrap;
}

/* ===== Верхний бар над шапкой ===== */
.top-bar {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.top-bar-btn {
    text-decoration: none;
}

.top-bar-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.top-bar-btn:hover {
    border-color: #4299e1;
    color: #2b6cb0;
    box-shadow: 0 2px 8px rgba(66,153,225,0.22);
}


#securityBtn.top-bar-btn {
    background: #ed8936;
    border-color: #ed8936;
    color: #fff;
}

    #securityBtn.top-bar-btn:hover {
        background: #dd6b20;
        border-color: #dd6b20;
        color: #fff;
        box-shadow: 0 2px 8px rgba(237,137,54,0.35);
    }








.main-nav {
    display: flex;
    gap: 6px;
    background: #1a202c;
    padding: 8px;
    border-radius: 14px;
    margin-bottom: 24px;
    overflow-x: auto;
    align-items: stretch;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    flex-wrap: nowrap;
    scrollbar-width: thin;
}

.main-nav-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 14px 8px;
    border: none;
    background: transparent;
    color: #cbd5e0;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
    white-space: normal;
    word-break: normal;
    overflow-wrap: break-word;
    text-align: center;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
}

    /* Первая вкладка — шире */
    .main-nav-btn[data-page="compress"] {
        flex: 1.6 1 0;
    }

    /* Конвертер и Генератор — компактнее */
    .main-nav-btn[data-page="converter"],
    .main-nav-btn[data-page="generator"] {
        flex: 0.8 1 0;
    }

    .main-nav-btn:hover {
        color: #fff;
        background: rgba(255,255,255,0.08);
    }

    .main-nav-btn.active {
        background: #4299e1;
        color: #fff;
    }

a.main-nav-btn, .nav-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex: 0 0 auto;
}

.nav-link-btn {
    background: rgba(237,137,54,0.15);
    color: #ed8936;
}

    .nav-link-btn:hover {
        color: #fff;
        background: #ed8936;
    }

.page {
    display: none;
}

    .page.active {
        display: block;
    }

.generator-topbar {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 24px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: #fff;
    color: #4a5568;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

    .tab-btn:hover {
        color: #2b6cb0;
        background: #ebf8ff;
        border-color: #bee3f8;
    }

.step {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
    opacity: 0.5;
    transition: opacity 0.3s;
}

    .step.active {
        opacity: 1;
        border-color: #4299e1;
        box-shadow: 0 0 0 1px #4299e1, 0 4px 12px rgba(66,153,225,0.15);
    }

    .step.done {
        opacity: 1;
        border-color: #48bb78;
    }

    .step:not(.active):not(.done) {
        pointer-events: none;
        user-select: none;
    }

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.step.active .step-number {
    background: #4299e1;
    color: #fff;
}

.step.done .step-number {
    background: #48bb78;
    color: #fff;
}

.step-title {
    font-size: 17px;
    font-weight: 600;
}

.step-desc {
    font-size: 13px;
    color: #718096;
    margin-top: 2px;
}

.drop-zone {
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #f7fafc;
}

    .drop-zone:hover {
        border-color: #4299e1;
        background: #ebf8ff;
    }

    .drop-zone.has-file {
        border-color: #48bb78;
        background: #f0fff4;
        border-style: solid;
    }

    .drop-zone input[type="file"] {
        display: none;
    }

.drop-zone-icon {
    color: rgba(66,153,225,0.45);
    margin-bottom: 14px;
    line-height: 0;
    display: flex;
    justify-content: center;
    transition: color 0.2s, opacity 0.2s;
}

    .drop-zone-icon svg {
        width: 96px;
        height: 72px;
        display: block;
    }

.drop-zone.has-file .drop-zone-icon {
    display: none;
}

.drop-zone.dragover {
    border-color: #ed8936;
    background: #fffaf0;
    box-shadow: 0 0 0 3px rgba(237,137,54,0.25);
}

    .drop-zone.dragover .drop-zone-icon {
        color: #ed8936;
        opacity: 1;
    }

    .drop-zone.dragover .drop-zone-text {
        color: #c05621;
    }

        .drop-zone.dragover .drop-zone-text strong {
            color: #dd6b20;
            text-decoration: underline;
        }

.drop-zone-text {
    font-size: 14px;
    color: #4a5568;
}

    .drop-zone-text strong {
        color: #4299e1;
    }

.file-info {
    margin-top: 12px;
    font-size: 13px;
    color: #48bb78;
    font-weight: 500;
}

.tags-container {
    margin-top: 16px;
    display: none;
}

    .tags-container.visible {
        display: block;
    }

.tags-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #4a5568;
}

.tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, monospace;
    background: #edf2f7;
    color: #2d3748;
    border: 1px solid #e2e8f0;
}

    .tag.matched {
        background: #c6f6d5;
        border-color: #9ae6b4;
        color: #22543d;
    }

    .tag.unmatched {
        background: #fed7d7;
        border-color: #feb2b2;
        color: #742a2a;
    }

.step-columns {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 24px;
    margin-top: 16px;
}

.step-col-left {
    display: flex;
    flex-direction: column;
}

    .step-col-left .actions {
        margin-top: 0;
    }

.step-col-right {
    border-left: 1px solid #e2e8f0;
    padding-left: 24px;
}

.col-title {
    font-size: 15px;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 12px;
}

.col-hint {
    font-size: 12px;
    color: #a0aec0;
    margin-bottom: 12px;
    line-height: 1.5;
}

.config-label {
    font-size: 12px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 3px;
}

.config-empty {
    font-size: 13px;
    color: #a0aec0;
    font-style: italic;
    padding: 12px 0;
}

.filename-config {
    margin-bottom: 16px;
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    display: none;
}

    .filename-config.visible {
        display: block;
    }

        .filename-config.visible ~ .config-empty {
            display: none;
        }

.tags-hint {
    font-weight: 400;
    font-size: 12px;
    color: #a0aec0;
}

.tag-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 14px;
}

.tag-toggle {
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, monospace;
    background: #fff;
    color: #4a5568;
    border: 1.5px solid #cbd5e0;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

    .tag-toggle:hover {
        border-color: #4299e1;
        color: #2b6cb0;
    }

    .tag-toggle.active {
        background: #4299e1;
        border-color: #4299e1;
        color: #fff;
    }

.separator-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.sep-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: #4a5568;
    border: 1.5px solid #cbd5e0;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
    min-width: 40px;
}

    .sep-btn:hover {
        border-color: #4299e1;
        color: #2b6cb0;
    }

    .sep-btn.active {
        background: #4299e1;
        border-color: #4299e1;
        color: #fff;
    }

.filename-preview {
    font-size: 13px;
    color: #4a5568;
    font-family: 'SF Mono', Monaco, monospace;
    background: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px dashed #cbd5e0;
    word-break: break-all;
}

    .filename-preview strong {
        color: #2d3748;
        font-weight: 600;
    }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: inherit;
}

    .btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

.btn-success {
    background: #48bb78;
    color: #fff;
}

    .btn-success:hover:not(:disabled) {
        background: #38a169;
    }

.btn-secondary {
    background: #edf2f7;
    color: #4a5568;
}

    .btn-secondary:hover:not(:disabled) {
        background: #e2e8f0;
    }

.btn-small {
    padding: 6px 10px;
    font-size: 13px;
}

/* ===== Бейдж стоимости на кнопках ===== */
.cost-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(255,255,255,0.22);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-left: 6px;
    white-space: nowrap;
    vertical-align: middle;
}

.btn-success .cost-badge {
    color: #fff;
}

.btn-secondary .cost-badge {
    background: #fff;
    color: #2d3748;
    border: 1px solid #cbd5e0;
}

.cost-badge.free {
    background: #f0fff4;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.error-msg {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    color: #c53030;
    font-size: 13px;
    display: none;
    white-space: pre-line;
}

    .error-msg.visible {
        display: block;
    }

.success-msg {
    margin-top: 12px;
    padding: 10px 14px;
    background: #f0fff4;
    border: 1px solid #c6f6d5;
    border-radius: 8px;
    color: #22543d;
    font-size: 13px;
    display: none;
}

    .success-msg.visible {
        display: block;
    }

.progress-msg {
    margin-top: 12px;
    padding: 10px 14px;
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 8px;
    color: #2b6cb0;
    font-size: 13px;
    display: none;
}

    .progress-msg.visible {
        display: block;
    }

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.info-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

    .info-card h2 {
        font-size: 20px;
        margin-bottom: 16px;
        color: #1a202c;
    }

    .info-card h3 {
        font-size: 16px;
        margin-top: 22px;
        margin-bottom: 10px;
        color: #2d3748;
    }

    .info-card p, .info-card li {
        font-size: 14px;
        color: #4a5568;
        line-height: 1.7;
    }

    .info-card ul, .info-card ol {
        margin-left: 22px;
        margin-top: 8px;
        margin-bottom: 8px;
    }

    .info-card li {
        margin-bottom: 6px;
    }

    .info-card code {
        background: #edf2f7;
        padding: 2px 6px;
        border-radius: 4px;
        font-size: 13px;
        font-family: 'SF Mono', Monaco, monospace;
        color: #2d3748;
    }

.check-list {
    list-style: none;
    margin-left: 0 !important;
}

    .check-list li {
        padding-left: 26px;
        position: relative;
        margin-bottom: 8px;
    }

        .check-list li::before {
            content: '✓';
            position: absolute;
            left: 0;
            top: 0;
            color: #48bb78;
            font-weight: 700;
        }

.cross-list {
    list-style: none;
    margin-left: 0 !important;
}

    .cross-list li {
        padding-left: 26px;
        position: relative;
        margin-bottom: 8px;
    }

        .cross-list li::before {
            content: '✕';
            position: absolute;
            left: 0;
            top: 0;
            color: #e53e3e;
            font-weight: 700;
        }

.how-block {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
}

    .how-block:last-child {
        margin-bottom: 0;
        padding-bottom: 0;
        border-bottom: none;
    }

.how-block-img {
    display: block;
    width: 100%;
    height: auto;
    margin-bottom: 16px;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.how-block-text h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 10px;
}

.how-block-text p, .how-block-text li {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.7;
}

.how-block-text ul, .how-block-text ol {
    margin-left: 22px;
    margin-top: 8px;
    margin-bottom: 0;
}

.how-block-text li {
    margin-bottom: 6px;
}

.how-block-text code {
    background: #edf2f7;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, monospace;
    color: #2d3748;
}

.pdf-workarea {
    display: none;
    margin-top: 20px;
}

    .pdf-workarea.visible {
        display: block;
    }

.pdf-tabs {
    display: flex;
    gap: 4px;
    background: #fff;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow-x: auto;
}

.pdf-tab-btn {
    flex: 1;
    padding: 12px 18px;
    border: none;
    background: transparent;
    color: #718096;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

    .pdf-tab-btn:hover:not(:disabled) {
        color: #2d3748;
        background: #f7fafc;
    }

    .pdf-tab-btn.active {
        background: #4299e1;
        color: #fff;
    }

    .pdf-tab-btn.disabled, .pdf-tab-btn:disabled {
        opacity: 0.35;
        cursor: not-allowed;
        pointer-events: none;
    }

.pdf-tab-content {
    display: none;
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

    .pdf-tab-content.active {
        display: block;
    }

.pdf-actions-bottom {
    margin-top: 20px;
    padding: 20px 24px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid #e2e8f0;
}

#pdf-tab-quality .quality-slider {
    max-width: 50%;
}

.merge-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    margin-bottom: 12px;
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #2b6cb0;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
}

    .merge-toggle:hover {
        background: #bee3f8;
        border-color: #90cdf4;
    }

    .merge-toggle input[type="checkbox"] {
        width: 16px;
        height: 16px;
        cursor: pointer;
        accent-color: #4299e1;
        flex-shrink: 0;
    }

.pdf-pages {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #f7fafc;
    overflow-y: auto;
}

#pdf-tab-edit .pdf-pages {
    min-height: 700px;
    max-height: 1000px;
}

.pdf-pages:empty::before {
    content: 'Страницы появятся после загрузки';
    display: block;
    color: #a0aec0;
    font-size: 13px;
    padding: 20px;
    text-align: center;
    grid-column: 1 / -1;
}

.pdf-page {
    position: relative;
    background: #fff;
    border-radius: 6px;
    border: 2px solid #e2e8f0;
    padding: 6px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
    align-self: start;
}

    .pdf-page:hover {
        border-color: #4299e1;
    }

    .pdf-page.dragging {
        opacity: 0.4;
    }

    .pdf-page.drag-over {
        border-color: #48bb78;
        border-style: dashed;
    }

    .pdf-page.selected {
        outline: 3px solid #4299e1;
        outline-offset: 2px;
    }

    .pdf-page::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 4px;
        pointer-events: none;
        z-index: 1;
        background: var(--page-tint, transparent);
        transition: background 0.15s;
    }

    .pdf-page canvas,
    .pdf-page img {
        width: 100%;
        height: auto;
        display: block;
        border-radius: 4px;
        background: #fff;
        position: relative;
        z-index: 2;
    }

    .pdf-page .page-number {
        position: absolute;
        top: 4px;
        left: 4px;
        background: #2d3748;
        color: #fff;
        font-size: 11px;
        padding: 2px 6px;
        border-radius: 4px;
        font-weight: 600;
        z-index: 5;
    }

    .pdf-page .page-tools {
        display: flex;
        gap: 4px;
        margin-top: 6px;
        justify-content: center;
        position: relative;
        z-index: 3;
    }

        .pdf-page .page-tools button {
            border: none;
            background: #edf2f7;
            color: #4a5568;
            width: 26px;
            height: 26px;
            border-radius: 6px;
            cursor: pointer;
            font-size: 13px;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s;
            padding: 0;
        }

            .pdf-page .page-tools button:hover:not(:disabled) {
                background: #4299e1;
                color: #fff;
            }

            .pdf-page .page-tools button:disabled {
                opacity: 0.3;
                cursor: not-allowed;
            }

            .pdf-page .page-tools button.delete:hover {
                background: #e53e3e;
            }

.pdf-edit-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.split-section {
    padding: 16px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
}

.split-bar-wrap {
    margin-top: 4px;
    padding: 4px 0;
}

.split-bar {
    display: flex;
    align-items: stretch;
    height: 46px;
    border-radius: 8px;
    background: #edf2f7;
    user-select: none;
    overflow: hidden;
}

.split-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    white-space: nowrap;
    padding: 0 4px;
    min-width: 0;
    text-shadow: 0 1px 1px rgba(0,0,0,0.25);
}

.split-handle {
    width: 16px;
    cursor: col-resize;
    background: #fff;
    border-left: 2px solid #a0aec0;
    border-right: 2px solid #a0aec0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    z-index: 2;
}

    .split-handle::before {
        content: '';
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #4a5568;
        transition: background 0.15s;
    }

    .split-handle:hover, .split-handle.active {
        background: #4299e1;
        border-color: #3182ce;
    }

        .split-handle:hover::before, .split-handle.active::before {
            background: #fff;
        }

.split-bar-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    color: #a0aec0;
    font-size: 12px;
}

.size-info {
    background: #f7fafc;
    border-radius: 8px;
    padding: 12px 16px;
    border: 1px solid #e2e8f0;
}

.size-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 4px 0;
}

    .size-row strong {
        color: #2d3748;
    }

.target-input {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

    .target-input input {
        flex: 1;
        padding: 8px 12px;
        border: 1.5px solid #cbd5e0;
        border-radius: 8px;
        font-size: 14px;
        font-family: inherit;
        background: #fff;
    }

        .target-input input:focus {
            outline: none;
            border-color: #4299e1;
        }

    .target-input span {
        font-size: 13px;
        color: #4a5568;
    }

.quality-slider {
    display: flex;
    align-items: center;
    gap: 12px;
}

    .quality-slider input[type="range"] {
        flex: 1;
        accent-color: #4299e1;
    }

    .quality-slider span {
        font-size: 13px;
        font-weight: 600;
        color: #2d3748;
        min-width: 40px;
        text-align: right;
    }

    /* ===== Пакетная обработка: селект файла и общий спиннер ===== */
    .quality-header {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 16px;
        padding: 10px 14px;
        background: #f7fafc;
        border: 1px solid #e2e8f0;
        border-radius: 8px;
        flex-wrap: wrap;
    }

    .quality-header-label {
        font-size: 13px;
        font-weight: 600;
        color: #4a5568;
        white-space: nowrap;
    }

    .quality-doc-select {
        flex: 1;
        min-width: 160px;
        padding: 6px 10px;
        border: 1.5px solid #cbd5e0;
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
        background: #fff;
        cursor: pointer;
    }

    .quality-doc-select:focus {
        outline: none;
        border-color: #4299e1;
    }

    .quality-edit-toggle {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 12px;
        font-weight: 600;
        color: #2d3748;
        cursor: pointer;
        user-select: none;
        white-space: nowrap;
        padding: 6px 10px;
        background: #fff;
        border: 1.5px solid #e2e8f0;
        border-radius: 6px;
        transition: border-color 0.15s;
    }

    .quality-edit-toggle:hover {
        border-color: #4299e1;
    }

    .quality-edit-toggle input[type="checkbox"] {
        width: 14px;
        height: 14px;
        cursor: pointer;
        accent-color: #4299e1;
    }

    .quality-master {
        margin-top: 20px;
        max-width: 50%;
    }

    .quality-master-box {
        padding: 16px;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        background: #fff;
    }

    /* Внутри рамки — растягиваем на всю ширину (важно: добавляем #pdf-tab-quality
           для более высокой специфичности, чем правило выше) */
    #pdf-tab-quality .quality-master-box .config-label,
    #pdf-tab-quality .quality-master-box .target-input,
    #pdf-tab-quality .quality-master-box .col-hint,
    #pdf-tab-quality .quality-master-box .quality-slider {
        max-width: 100%;
    }

    @media (max-width: 820px) {
        .quality-master {
            max-width: 100%;
        }
    }

    #pdfTargetSize:disabled,
    #pdfSizeSlider:disabled,
    #clearTargetBtn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

/* Верхняя подсказка на всю ширину вкладки */
.page-top-hint {
    display: block;
    width: 100%;
    padding: 6px 12px;
    margin-bottom: 10px;
    font-size: 11px;
    line-height: 1.3;
    color: #4a5568;
    background: #f7fafc;
    border: 1px dashed #cbd5e0;
    border-radius: 6px;
    text-align: center;
}

/* Заголовок зоны параметров */
.zone-title {
    font-size: 11px;
    font-weight: 700;
    color: #4a5568;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #e2e8f0;
}

/* ============ МАРКИРОВКА ============ */
.markup-layout {
    display: grid;
    grid-template-columns: 25% 1fr;
    gap: 20px;
    align-items: start;
}

.markup-sidebar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    min-width: 0;
}

.markup-param-tabs {
    display: flex;
    gap: 3px;
    background: #fff;
    padding: 3px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.markup-param-tab {
    flex: 1;
    padding: 5px 8px;
    border: none;
    background: transparent;
    color: #718096;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    font-family: inherit;
    transition: all 0.15s;
}

    .markup-param-tab:hover:not(:disabled) {
        color: #2d3748;
        background: #f7fafc;
    }

    .markup-param-tab.active {
        background: #4299e1;
        color: #fff;
    }

    .markup-param-tab:disabled, .markup-param-tab.disabled {
        opacity: 0.35;
        cursor: not-allowed;
        pointer-events: none;
    }

.markup-param-content {
    display: none;
}

    .markup-param-content.active {
        display: block;
    }

.per-page-activate-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #2d3748;
    cursor: pointer;
    user-select: none;
    margin-bottom: 6px;
}

    .per-page-activate-toggle input[type="checkbox"] {
        width: 14px;
        height: 14px;
        cursor: pointer;
        accent-color: #4299e1;
    }

.per-page-content {
    opacity: 1;
    transition: opacity 0.15s;
}

    .per-page-content.disabled {
        opacity: 0.4;
        pointer-events: none;
    }

.markup-types {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-bottom: 6px;
    margin-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
}

.markup-type-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: #2d3748;
    user-select: none;
}

    .markup-type-checkbox input[type="checkbox"] {
        width: 14px;
        height: 14px;
        cursor: pointer;
        accent-color: #4299e1;
    }

.markup-settings {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 6px;
}

    .markup-settings:last-child {
        margin-bottom: 0;
    }

.markup-param-group {
    margin-bottom: 7px;
}

    .markup-param-group:last-child {
        margin-bottom: 0;
    }

.param-main-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 3px;
}

.param-num {
    width: 56px;
    padding: 3px 6px;
    border: 1.5px solid #cbd5e0;
    border-radius: 5px;
    font-size: 12px;
    font-family: inherit;
    background: #fff;
}

    .param-num:focus {
        outline: none;
        border-color: #4299e1;
    }

.param-unit {
    font-size: 11px;
    color: #718096;
}

.param-val {
    font-size: 11px;
    font-weight: 600;
    color: #2d3748;
    margin-left: auto;
}

.param-slider-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

.param-range {
    flex: 1;
    min-width: 50px;
    accent-color: #4299e1;
    height: 16px;
}

.param-step {
    width: 20px;
    height: 20px;
    border: 1px solid #cbd5e0;
    background: #fff;
    color: #4a5568;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1;
}

    .param-step:hover {
        background: #4299e1;
        border-color: #4299e1;
        color: #fff;
    }

    .param-step:active {
        transform: scale(0.92);
    }

.markup-text-input {
    width: 100%;
    padding: 4px 8px;
    border: 1.5px solid #cbd5e0;
    border-radius: 5px;
    font-size: 12px;
    font-family: inherit;
    background: #fff;
}

    .markup-text-input:focus {
        outline: none;
        border-color: #4299e1;
    }

.stamp-upload-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

    .stamp-upload-row input[type="file"] {
        flex: 1;
        min-width: 0;
        font-size: 11px;
        font-family: inherit;
        padding: 2px;
    }

.stamp-preview {
    margin-top: 5px;
    padding: 4px;
    background: #fff;
    border: 1px dashed #cbd5e0;
    border-radius: 5px;
    text-align: center;
}

    .stamp-preview img {
        max-height: 32px;
        max-width: 100%;
        vertical-align: middle;
        border-radius: 4px;
    }

.markup-preview-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 16px;
    min-height: 700px;
    min-width: 0;
}

.markup-page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 6px 0;
}

.markup-nav-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    color: #4a5568;
    padding: 0;
    transition: all 0.15s;
    flex-shrink: 0;
}

    .markup-nav-btn:hover:not(:disabled) {
        background: #4299e1;
        color: #fff;
        border-color: #4299e1;
    }

    .markup-nav-btn:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

.markup-page-slider {
    flex: 1;
    max-width: 400px;
    accent-color: #4299e1;
}

.markup-page-input {
    width: 56px;
    padding: 6px 8px;
    text-align: center;
    border: 1.5px solid #cbd5e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fff;
}

    .markup-page-input:focus {
        outline: none;
        border-color: #4299e1;
    }

.markup-page-total {
    color: #718096;
    font-size: 12px;
    white-space: nowrap;
}

.markup-overlay-num {
    position: absolute;
    transform: translate(-50%, -50%);
    font-family: Arial, sans-serif;
    font-weight: 700;
    font-size: 14px;
    color: #000;
    z-index: 3;
    white-space: nowrap;
    touch-action: none;
}

.markup-overlay-stamp-text {
    position: absolute;
    transform: translate(-50%, -50%);
    font-family: Arial, sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: #000;
    z-index: 2;
    white-space: nowrap;
    text-align: center;
    touch-action: none;
}

.markup-overlay-stamp-img {
    position: absolute;
    transform: translate(-50%, -50%);
    z-index: 2;
    max-width: none;
    height: auto;
    touch-action: none;
}

.sidebar-hint {
    display: block;
    width: 100%;
    padding: 5px 8px;
    font-size: 11px;
    line-height: 1.3;
    color: #718096;
    background: #fff;
    border: 1px dashed #cbd5e0;
    border-radius: 6px;
    text-align: center;
}

/* ============ ПОДПИСЬ ============ */
.signature-layout {
    display: grid;
    grid-template-columns: 25% 1fr;
    gap: 20px;
    align-items: start;
}

.signature-sidebar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px;
    min-width: 0;
}

.sig-mode-tab {
    flex: 1;
    padding: 5px 8px;
    border: none;
    background: transparent;
    color: #718096;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    font-family: inherit;
    transition: all 0.15s;
}

    .sig-mode-tab:hover {
        color: #2d3748;
        background: #f7fafc;
    }

    .sig-mode-tab.active {
        background: #4299e1;
        color: #fff;
    }

.sig-panel {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px;
}

#signatureCanvas {
    display: block;
    width: 100%;
    height: auto;
    background: #fff;
    border-radius: 6px;
    cursor: crosshair;
    touch-action: none;
    border: 1px dashed #cbd5e0;
    box-shadow: inset 0 0 0 3px #fff;
}

.sig-color-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sig-color-opt {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #2d3748;
    cursor: pointer;
    user-select: none;
}

    .sig-color-opt input[type="radio"] {
        accent-color: #4299e1;
        cursor: pointer;
    }

.sig-color-swatch {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #cbd5e0;
    vertical-align: middle;
}

.sig-page-info {
    font-size: 12px;
    color: #4a5568;
}

    .sig-page-info strong {
        color: #2d3748;
    }

.signature-preview-area {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    padding: 16px;
    min-height: 700px;
    min-width: 0;
}

.sig-item {
    position: absolute;
    transform: translate(-50%, -50%);
    pointer-events: auto;
    z-index: 5;
    line-height: 0;
}

.sig-item-img {
    display: block;
    width: 100%;
    height: auto;
    cursor: move;
    pointer-events: auto;
    user-select: none;
    border: none;
    border-radius: 0;
    box-sizing: border-box;
    outline: 2px solid transparent;
    outline-offset: 2px;
}

.sig-item.selected .sig-item-img {
    outline-color: #4299e1;
    outline-style: solid;
}

.sig-item.multi-selected .sig-item-img {
    outline-color: #4299e1;
    outline-style: dashed;
}

.sig-controls {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 6;
}

.sig-handle {
    position: absolute;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #4299e1;
    pointer-events: auto;
    box-sizing: border-box;
    z-index: 7;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.sig-handle-tl {
    top: -4px;
    left: -4px;
    cursor: nwse-resize;
}

.sig-handle-tr {
    top: -4px;
    right: -4px;
    cursor: nesw-resize;
}

.sig-handle-bl {
    bottom: -4px;
    left: -4px;
    cursor: nesw-resize;
}

.sig-handle-br {
    bottom: -4px;
    right: -4px;
    cursor: nwse-resize;
}

.sig-color-dot {
    position: absolute;
    top: -10px;
    right: -26px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #cbd5e0, 0 1px 3px rgba(0,0,0,0.25);
    pointer-events: auto;
    cursor: pointer;
    padding: 0;
    z-index: 8;
    transition: transform 0.12s;
}

    .sig-color-dot:hover {
        transform: scale(1.15);
    }

.sig-edit-window {
    max-width: 340px;
}

/* ============ НАВИГАТОР ============ */
.signature-preview-wrap, .markup-preview-wrap {
    position: relative;
    flex: 1;
    min-height: 600px;
    overflow: hidden;
    background: #f7fafc;
    border-radius: 8px;
    display: block;
}

.signature-empty, .markup-preview-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #a0aec0;
    font-size: 14px;
    text-align: center;
    pointer-events: none;
}

.signature-preview-scroll, .markup-preview-scroll {
    position: absolute;
    inset: 0;
    overflow: auto;
    display: flex;
    padding: 12px;
    box-sizing: border-box;
}

.signature-preview-sheet, .markup-preview-sheet {
    position: relative;
    margin: auto;
    flex-shrink: 0;
    background: #fff;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    line-height: 0;
}

    .signature-preview-sheet > canvas, .markup-preview-sheet > canvas, .markup-preview-sheet > img {
        width: 100%;
        height: auto;
        display: block;
        border-radius: 6px;
    }

.preview-nav {
    position: relative;
    width: 100%;
    max-width: 130px;
    margin: 0 auto 4px;
    background: #fff;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 5px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    user-select: none;
}

.preview-nav-toggle {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 16px;
    height: 16px;
    border: none;
    background: rgba(66,153,225,0.15);
    color: #2b6cb0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
    z-index: 5;
    font-family: inherit;
}

    .preview-nav-toggle:hover {
        background: rgba(66,153,225,0.32);
        color: #2c5282;
    }

.preview-nav.collapsed {
    padding: 3px;
}

    .preview-nav.collapsed .preview-nav-body {
        display: none;
    }

    .preview-nav.collapsed .preview-nav-toggle {
        position: static;
        width: 18px;
        height: 18px;
        transform: rotate(180deg);
        margin: 0 auto;
        display: block;
    }

.preview-nav-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    background: #edf2f7;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    margin-top: 16px;
}

.preview-nav.collapsed .preview-nav-thumb {
    display: none;
}

.preview-nav-thumb > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    display: block;
}

.preview-nav-viewport {
    position: absolute;
    border: 2px solid #4299e1;
    background: rgba(66,153,225,0.18);
    box-sizing: border-box;
    border-radius: 2px;
    cursor: move;
    z-index: 2;
    min-width: 6px;
    min-height: 6px;
}

    .preview-nav-viewport:hover {
        background: rgba(66,153,225,0.28);
    }

.preview-nav-scale-label {
    font-size: 9px;
    font-weight: 700;
    color: #718096;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-top: 5px;
    margin-bottom: 2px;
    text-align: left;
}

.preview-nav-slider-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 0;
}

    .preview-nav-slider-row input[type="range"] {
        flex: 1;
        min-width: 0;
        accent-color: #4299e1;
    }

    .preview-nav-slider-row span {
        font-size: 10px;
        font-weight: 700;
        color: #2d3748;
        min-width: 30px;
        text-align: right;
    }

/* ============ КОНВЕРТЕР ============ */
.conv-files {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.conv-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
}

    .conv-file-item .conv-file-name {
        font-weight: 500;
        color: #2d3748;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        flex: 1;
        margin-right: 12px;
    }

    .conv-file-item .conv-file-meta {
        color: #a0aec0;
        font-size: 12px;
        margin-right: 12px;
        white-space: nowrap;
    }

    .conv-file-item .conv-file-remove {
        border: none;
        background: #fed7d7;
        color: #c53030;
        width: 26px;
        height: 26px;
        border-radius: 6px;
        cursor: pointer;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        transition: all 0.15s;
    }

        .conv-file-item .conv-file-remove:hover {
            background: #fc8181;
            color: #fff;
        }

.conv-options {
    padding: 16px;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.conv-option-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

    .conv-option-row label {
        font-size: 13px;
        font-weight: 600;
        color: #4a5568;
        min-width: 160px;
    }

    .conv-option-row select {
        flex: 1;
        padding: 8px 12px;
        border: 1.5px solid #cbd5e0;
        border-radius: 8px;
        font-size: 14px;
        background: #fff;
        font-family: inherit;
        cursor: pointer;
    }

        .conv-option-row select:focus {
            outline: none;
            border-color: #4299e1;
        }

    .conv-option-row input[type="range"] {
        flex: 1;
        accent-color: #4299e1;
        min-width: 120px;
    }

.conv-estimate {
    display: inline-block;
    box-sizing: border-box;
    width: 130px;
    min-width: 130px;
    padding: 4px 10px;
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 999px;
    color: #2b6cb0;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    visibility: hidden;
}

    .conv-estimate.visible {
        visibility: visible;
    }

.footer {
    text-align: center;
    margin-top: 32px;
    font-size: 12px;
    color: #a0aec0;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    font-size: 12px;
}

    .footer-links a {
        color: #718096;
        text-decoration: none;
        transition: color 0.15s;
    }

        .footer-links a:hover {
            color: #4299e1;
            text-decoration: underline;
        }

.footer-sep {
    color: #cbd5e0;
}

.footer-text {
    font-size: 12px;
    color: #a0aec0;
}

code {
    background: #edf2f7;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

#pdf-tab-quality {
    position: relative;
    overflow: hidden;
    background-color: #ffffff;
}

    #pdf-tab-quality::before {
        content: '';
        position: absolute;
        inset: 0;
        background-image: var(--bg-szat-sh2);
        background-repeat: no-repeat;
        background-position: right center;
        background-size: contain;
        opacity: 0;
        pointer-events: none;
        z-index: 0;
    }

    #pdf-tab-quality.active::before {
        opacity: 1;
        animation: bgFadeIn 0.3s ease;
    }

    #pdf-tab-quality > * {
        position: relative;
        z-index: 1;
    }

#pdf-tab-edit {
    background-image: none;
}

#pdf-tab-quality .size-info, #pdf-tab-quality .config-label, #pdf-tab-quality .target-input, #pdf-tab-quality .col-hint, #pdf-tab-quality .actions {
    max-width: 50%;
}

#convStep2 {
    position: relative;
    overflow: hidden;
    background-color: #ffffff;
    background-image: none;
}

    #convStep2::before {
        content: '';
        position: absolute;
        inset: 0;
        background-image: var(--bg-convert-sh2);
        background-repeat: no-repeat;
        background-position: right center;
        background-size: contain;
        opacity: 0;
        pointer-events: none;
        z-index: 0;
    }

    #convStep2.active::before {
        opacity: 1;
        animation: bgFadeIn 0.3s ease;
    }

    #convStep2 > * {
        position: relative;
        z-index: 1;
    }

    #convStep2:not(.active) {
        display: none;
    }

    #convStep2 #convFiles, #convStep2 #convOptions {
        max-width: 60%;
        margin-left: 0;
        margin-right: auto;
    }

@keyframes bgFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#pdfStep1 {
    background-color: #ffffff;
    background-image: var(--bg-szat-sh1);
    background-repeat: no-repeat;
    background-position: right center;
    background-size: contain;
}

    #pdfStep1 #pdfDropZone {
        width: 50%;
        margin-left: 0;
        margin-right: auto;
        padding: 24px 16px;
    }

#pdfWorkarea {
    background: none;
}

    #pdfWorkarea .pdf-tabs {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        flex-wrap: wrap;
        overflow: visible;
    }

    #pdfWorkarea .pdf-tab-btn {
        padding: 10px 16px;
        font-size: 14px;
        white-space: normal;
        flex: 1 1 auto;
        min-width: 0;
    }

    #pdfWorkarea .pdf-tab-content {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26,32,44,0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    animation: modalFadeIn 0.2s ease;
}

    .modal-overlay.visible {
        display: flex;
    }

.modal-window {
    background: #fff;
    border-radius: 16px;
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.35);
    overflow: hidden;
    animation: modalSlideUp 0.25s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: #ed8936;
    color: #fff;
    flex-shrink: 0;
}

    .modal-header h2 {
        font-size: 20px;
        font-weight: 700;
        margin: 0;
    }

.modal-close {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    font-family: inherit;
    padding: 0;
}

    .modal-close:hover {
        background: rgba(255,255,255,0.38);
    }

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-intro {
    font-size: 15px;
    color: #4a5568;
    line-height: 1.7;
    margin-bottom: 22px;
    padding: 16px 18px;
    background: #fffaf0;
    border-left: 4px solid #ed8936;
    border-radius: 6px;
}

.modal-section {
    margin-bottom: 22px;
}

    .modal-section:last-child {
        margin-bottom: 0;
    }

    .modal-section h3 {
        font-size: 16px;
        font-weight: 700;
        color: #1a202c;
        margin-bottom: 10px;
    }

    .modal-section .check-list li {
        font-size: 14px;
        color: #4a5568;
        margin-bottom: 8px;
        line-height: 1.65;
    }

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes modalSlideUp {
    from {
        transform: translateY(24px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.purchase-window {
    max-width: 520px;
}

.purchase-header {
    background: linear-gradient(135deg, #4299e1, #3182ce);
}

.purchase-intro {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.65;
    margin-bottom: 20px;
}

.purchase-packages {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.pkg-btn {
    padding: 16px 12px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.15s;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
}

    .pkg-btn:hover {
        border-color: #4299e1;
        background: #ebf8ff;
        transform: translateY(-1px);
    }

.pkg-label {
    font-size: 12px;
    color: #718096;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pkg-credits {
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
}

.pkg-bonus {
    font-size: 11px;
    color: #48bb78;
    font-weight: 700;
    background: #f0fff4;
    padding: 2px 8px;
    border-radius: 999px;
    display: inline-block;
    margin: 2px auto;
}

.pkg-price {
    font-size: 16px;
    font-weight: 700;
    color: #ed8936;
    margin-top: 4px;
}

.purchase-legal {
    font-size: 12px;
    color: #a0aec0;
    text-align: center;
    margin-top: 16px;
    line-height: 1.6;
}

    .purchase-legal a {
        color: #4299e1;
        text-decoration: underline;
    }

.purchase-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #cbd5e0;
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    margin-bottom: 16px;
}

    .purchase-input:focus {
        outline: none;
        border-color: #4299e1;
    }

.purchase-submit {
    width: 100%;
    justify-content: center;
}

.purchase-agree {
    margin-top: 14px;
    font-size: 12px;
    color: #718096;
    line-height: 1.6;
    text-align: center;
}

    .purchase-agree a {
        color: #4299e1;
        text-decoration: underline;
    }

.purchase-qr {
    text-align: center;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    margin-bottom: 16px;
}

    .purchase-qr img {
        max-width: 240px;
        width: 100%;
        height: auto;
        display: block;
        margin: 0 auto 12px;
        background: #fff;
        padding: 8px;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
    }

.purchase-qr-sum {
    font-size: 15px;
    color: #2d3748;
}

    .purchase-qr-sum strong {
        color: #ed8936;
        font-size: 17px;
    }

.purchase-back {
    width: 100%;
    justify-content: center;
}

#page-generator #step1 {
    background-color: #ffffff;
    background-image: var(--bg-gen-sh1);
    background-repeat: no-repeat;
    background-position: right center;
    background-size: contain;
    overflow: hidden;
}

#page-generator #step2 {
    background-color: #ffffff;
    background-image: var(--bg-gen-sh2);
    background-repeat: no-repeat;
    background-position: right center;
    background-size: contain;
    overflow: hidden;
}

    #page-generator #step1 #excelDropZone, #page-generator #step2 #wordDropZone, #page-generator #step2 .tags-container {
        width: 50%;
        max-width: 50%;
        margin-left: 0;
        margin-right: auto;
    }

.doc-header {
    min-height: 180px;
    background-image: none;
    background-color: #ffffff;
    padding: 28px 32px;
}

.doc-page {
    max-width: 860px;
    margin: 0 auto;
}

.doc-meta {
    font-size: 13px;
    color: #718096;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: #f7fafc;
    border-left: 3px solid #4299e1;
    border-radius: 6px;
}

    .doc-meta strong {
        color: #2d3748;
    }

.doc-page .info-card {
    padding: 24px 28px;
}

    .doc-page .info-card h2 {
        font-size: 18px;
        font-weight: 700;
        color: #1a202c;
        margin-bottom: 14px;
        padding-bottom: 10px;
        border-bottom: 1px solid #e2e8f0;
    }

    .doc-page .info-card p {
        font-size: 14px;
        color: #4a5568;
        line-height: 1.75;
        margin-bottom: 12px;
    }

        .doc-page .info-card p:last-child {
            margin-bottom: 0;
        }

    .doc-page .info-card strong {
        color: #2d3748;
        font-weight: 600;
    }

.doc-page a {
    color: #4299e1;
    text-decoration: underline;
    transition: color 0.15s;
}

    .doc-page a:hover {
        color: #2b6cb0;
    }

.doc-list {
    list-style: none;
    margin: 12px 0;
    padding-left: 0;
}

    .doc-list li {
        font-size: 14px;
        color: #4a5568;
        line-height: 1.7;
        padding-left: 22px;
        position: relative;
        margin-bottom: 8px;
    }

        .doc-list li::before {
            content: '—';
            position: absolute;
            left: 0;
            top: 0;
            color: #a0aec0;
        }

.price-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

    .price-table thead {
        background: #f7fafc;
    }

    .price-table th {
        padding: 12px 16px;
        text-align: left;
        font-weight: 700;
        color: #4a5568;
        border-bottom: 2px solid #e2e8f0;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .price-table td {
        padding: 14px 16px;
        color: #2d3748;
        border-bottom: 1px solid #edf2f7;
    }

    .price-table tbody tr:last-child td {
        border-bottom: none;
    }

    .price-table tbody tr:hover {
        background: #f7fafc;
    }

    .price-table td strong {
        color: #1a202c;
        font-weight: 700;
    }

/* ============ Кнопка дублирования ============ */
.btn-dup-inline {
    margin-top: 4px;
    padding: 5px 10px;
    font-size: 12px;
    height: auto;
    min-height: 0;
    line-height: 1.3;
}

/* ===== Модалка дублирования ===== */
.dup-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.dup-tree {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}

.dup-file {
    margin-bottom: 4px;
    background: #f7fafc;
    border-radius: 6px;
}

.dup-file-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
}

    .dup-file-header:hover {
        background: #edf2f7;
    }

.dup-expand {
    width: 14px;
    text-align: center;
    transition: transform 0.15s;
    color: #718096;
    font-size: 10px;
}

.dup-file.expanded .dup-expand {
    transform: rotate(90deg);
}

.dup-pages {
    display: none;
    padding: 6px 0 8px 28px;
    flex-wrap: wrap;
    gap: 6px;
}

.dup-file.expanded .dup-pages {
    display: flex;
}

.dup-page {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 12px;
    color: #2d3748;
    cursor: pointer;
    user-select: none;
    transition: all 0.15s;
}

    .dup-page.checked {
        background: #ebf8ff;
        border-color: #bee3f8;
    }

    .dup-page input {
        margin: 0;
        cursor: pointer;
        accent-color: #4299e1;
    }

/* ===== Контекстное меню ===== */
.sig-ctx-menu {
    position: fixed;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    padding: 4px;
    z-index: 3000;
    min-width: 180px;
}

    .sig-ctx-menu button {
        display: block;
        width: 100%;
        text-align: left;
        padding: 8px 14px;
        border: none;
        background: transparent;
        color: #2d3748;
        font-size: 13px;
        font-family: inherit;
        border-radius: 6px;
        cursor: pointer;
    }

        .sig-ctx-menu button:hover {
            background: #edf2f7;
        }

/* ============ СРАВНЕНИЕ ДОГОВОРОВ ============ */
.cmp-drop-zone-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 16px;
}

.cmp-drop-col {
    min-width: 0;
}

.cmp-col-label {
    font-size: 13px;
    font-weight: 700;
    color: #4a5568;
    margin-bottom: 8px;
}

.cmp-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px 14px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.cmp-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #2d3748;
    cursor: pointer;
    user-select: none;
}

.cmp-toggle input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #4299e1;
}

.cmp-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    color: #4a5568;
}

.cmp-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.cmp-legend-swatch {
    display: inline-block;
    width: 16px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid #cbd5e0;
}

.cmp-legend-swatch.same { background: #ffffff; }
.cmp-legend-swatch.removed { background: #fff5f5; border-color: #feb2b2; }
.cmp-legend-swatch.added { background: #f0fff4; border-color: #9ae6b4; }
.cmp-legend-swatch.changed { background: #fffaf0; border-color: #fbd38d; }
.cmp-legend-swatch.danger { background: #fff5f5; border-color: #e53e3e; }

.cmp-result-head {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #1a202c;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border-radius: 10px 10px 0 0;
    overflow: hidden;
}

.cmp-result-head-cell {
    padding: 8px 12px;
}

.cmp-result-head-cell:first-child {
    border-right: 1px solid #2d3748;
}

.cmp-result {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 10px 10px;
    overflow: hidden;
    max-height: 800px;
    overflow-y: auto;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
    font-size: 12px;
    line-height: 1.55;
    background: #fff;
}

.cmp-cell {
    padding: 2px 10px;
    border-bottom: 1px solid #f0f4f8;
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 20px;
    box-sizing: border-box;
}

.cmp-cell.left {
    border-right: 1px solid #e2e8f0;
}

.cmp-cell.right {
    background: #fafcff;
}

.cmp-cell.empty {
    background: #f7fafc;
    background-image: linear-gradient(45deg, transparent 49%, #e2e8f0 49%, #e2e8f0 51%, transparent 51%);
    background-size: 8px 8px;
}

.cmp-cell.removed {
    background: #fff5f5;
    color: #742a2a;
}

.cmp-cell.added {
    background: #f0fff4;
    color: #22543d;
}

.cmp-cell.changed-old {
    background: #fffaf0;
    color: #7b341e;
}

.cmp-cell.changed-new {
    background: #fffbeb;
    color: #744210;
}

.cmp-cell .cmp-word-removed {
    background: #fed7d7;
    color: #742a2a;
    border-radius: 2px;
    padding: 0 2px;
}

.cmp-cell .cmp-word-added {
    background: #c6f6d5;
    color: #22543d;
    border-radius: 2px;
    padding: 0 2px;
}

.cmp-cell .cmp-danger {
    background: #feb2b2;
    color: #742a2a;
    font-weight: 700;
    border-radius: 2px;
    padding: 0 3px;
    box-shadow: 0 0 0 1px #e53e3e;
}

.cmp-hidden {
    display: none !important;
}

/* ============ РЕЖИМЫ СРАВНЕНИЯ ============ */
.cmp-mode-tabs {
    display: flex;
    gap: 4px;
    background: #fff;
    padding: 4px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.cmp-mode-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: #718096;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 7px;
    font-family: inherit;
    transition: all 0.15s;
}

.cmp-mode-tab:hover {
    background: #f7fafc;
    color: #2d3748;
}

.cmp-mode-tab.active {
    background: #4299e1;
    color: #fff;
}

/* ============ СТРУКТУРНЫЙ DIFF ============ */
.cmp-summary-bar {
    padding: 12px 16px;
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #2b6cb0;
    margin-bottom: 12px;
}

.cmp-struct-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 800px;
    overflow-y: auto;
    padding-right: 4px;
}

.cmp-struct-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.cmp-struct-item-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}

.cmp-struct-item-head:hover {
    background: #edf2f7;
}

.cmp-struct-num {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 13px;
    font-weight: 700;
    color: #2d3748;
    min-width: 60px;
}

.cmp-struct-type {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.cmp-struct-type.changed {
    background: #fffaf0;
    color: #7b341e;
    border: 1px solid #fbd38d;
}

.cmp-struct-type.added {
    background: #f0fff4;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.cmp-struct-type.removed {
    background: #fff5f5;
    color: #742a2a;
    border: 1px solid #feb2b2;
}

.cmp-struct-preview {
    flex: 1;
    min-width: 0;
    font-size: 12px;
    color: #4a5568;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.cmp-struct-expand {
    color: #a0aec0;
    font-size: 11px;
    transition: transform 0.15s;
}

.cmp-struct-item.expanded .cmp-struct-expand {
    transform: rotate(90deg);
}

.cmp-struct-body {
    display: none;
    padding: 12px 14px;
}

.cmp-struct-item.expanded .cmp-struct-body {
    display: block;
}

.cmp-struct-cell {
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 8px;
}

.cmp-struct-cell:last-child {
    margin-bottom: 0;
}

.cmp-struct-cell.a {
    background: #fff5f5;
    border-left: 3px solid #feb2b2;
    color: #742a2a;
}

.cmp-struct-cell.b {
    background: #f0fff4;
    border-left: 3px solid #9ae6b4;
    color: #22543d;
}

.cmp-struct-cell .cmp-cell-label {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 4px;
    opacity: 0.7;
}

.cmp-struct-cell .cmp-danger {
    background: #feb2b2;
    color: #742a2a;
    font-weight: 700;
    border-radius: 2px;
    padding: 0 3px;
    box-shadow: 0 0 0 1px #e53e3e;
}

.cmp-struct-empty {
    padding: 20px;
    text-align: center;
    color: #a0aec0;
    font-size: 13px;
    font-style: italic;
}

/* ============ АНАЛИЗ РИСКОВ ============ */
.cmp-risks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 800px;
    overflow-y: auto;
    padding-right: 4px;
}

.cmp-risk-item {
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    background: #fff;
    overflow: hidden;
    transition: box-shadow 0.15s;
}

.cmp-risk-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.cmp-risk-item.high {
    border-left: 4px solid #e53e3e;
}

.cmp-risk-item.medium {
    border-left: 4px solid #ed8936;
}

.cmp-risk-item.low {
    border-left: 4px solid #4299e1;
}

.cmp-risk-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f7fafc;
    border-bottom: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.cmp-risk-category {
    font-size: 13px;
    font-weight: 700;
    color: #2d3748;
}

.cmp-risk-severity {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.cmp-risk-severity.high {
    background: #fed7d7;
    color: #742a2a;
}

.cmp-risk-severity.medium {
    background: #feebc8;
    color: #7b341e;
}

.cmp-risk-severity.low {
    background: #bee3f8;
    color: #2c5282;
}

.cmp-risk-where {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 999px;
    background: #edf2f7;
    color: #4a5568;
}

.cmp-risk-where.both {
    background: #e9d8fd;
    color: #553c9a;
}

.cmp-risk-where.a {
    background: #fed7d7;
    color: #742a2a;
}

.cmp-risk-where.b {
    background: #c6f6d5;
    color: #22543d;
}

.cmp-risk-body {
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.65;
    color: #4a5568;
}

.cmp-risk-quote {
    display: block;
    padding: 10px 14px;
    background: #fffaf0;
    border-left: 3px solid #ed8936;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    color: #7b341e;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.cmp-risk-hint {
    font-size: 13px;
    color: #2d3748;
    padding: 8px 12px;
    background: #ebf8ff;
    border-radius: 6px;
    border-left: 3px solid #4299e1;
}

.cmp-risk-hint strong {
    color: #2b6cb0;
}

.cmp-risks-empty {
    padding: 40px 20px;
    text-align: center;
    color: #48bb78;
    font-size: 14px;
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    border-radius: 10px;
}

.cmp-risks-empty strong {
    color: #22543d;
    font-size: 16px;
    display: block;
    margin-bottom: 6px;
}

@media (max-width: 820px) {
    body {
        padding: 16px;
    }

    .top-bar {
        justify-content: center;
        flex-direction: column;
    }

    .site-header {
        min-height: 240px;
        padding: 24px;
        background-size: 50% auto;
        background-position: right bottom;
    }

    .subtitle {
        max-width: 100%;
    }

    .credits-balance {
        font-size: 13px;
        gap: 12px;
        padding: 6px 12px;
        margin-top: 12px;
    }

    .drop-zone-icon svg {
        width: 72px;
        height: 54px;
    }

    .step-columns {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .step-col-right {
        border-left: none;
        border-top: 1px solid #e2e8f0;
        padding-left: 0;
        padding-top: 16px;
    }

    .conv-option-row label {
        min-width: 0;
        width: 100%;
    }

    .conv-option-row input[type="range"] {
        min-width: 0;
    }

    #pdf-tab-edit .pdf-pages {
        min-height: 500px;
        max-height: 700px;
    }

    .pdf-pages {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    #pdfStep1 {
        background-position: right bottom;
        background-size: 60% auto;
    }

        #pdfStep1 #pdfDropZone {
            width: 100%;
        }

    #pdf-tab-quality::before {
        background-position: right bottom;
        background-size: 60% auto;
    }

    #pdf-tab-quality .size-info, #pdf-tab-quality .config-label, #pdf-tab-quality .target-input, #pdf-tab-quality .col-hint, #pdf-tab-quality .actions {
        max-width: 100%;
    }

    #pdf-tab-quality .quality-slider {
        max-width: 100%;
    }

    #convStep2::before {
        background-position: right bottom;
        background-size: 60% auto;
    }

    #convStep2 #convFiles, #convStep2 #convOptions {
        max-width: 100%;
    }

    #page-generator #step1, #page-generator #step2 {
        background-position: right bottom;
        background-size: 60% auto;
    }

        #page-generator #step1 #excelDropZone, #page-generator #step2 #wordDropZone, #page-generator #step2 .tags-container {
            width: 100%;
            max-width: 100%;
        }

    .main-nav {
        padding: 6px;
        flex-wrap: nowrap;
    }

    .main-nav-btn {
        padding: 10px 5px;
        font-size: 14px;
        min-height: 48px;
    }

    .generator-topbar {
        margin-bottom: 16px;
    }

    .modal-overlay {
        padding: 12px;
    }

    .modal-window {
        max-height: 92vh;
        border-radius: 12px;
    }

    .modal-header {
        padding: 16px 18px;
    }

        .modal-header h2 {
            font-size: 17px;
        }

    .modal-body {
        padding: 18px;
    }

    .modal-intro {
        font-size: 14px;
        padding: 12px 14px;
    }

    .modal-section h3 {
        font-size: 15px;
    }

    .modal-section .check-list li {
        font-size: 13px;
    }

    .how-block-text h3 {
        font-size: 15px;
    }

    .purchase-packages {
        grid-template-columns: 1fr;
    }

    .doc-header {
        min-height: 120px;
        padding: 20px;
    }

    .doc-page .info-card {
        padding: 18px 20px;
    }

        .doc-page .info-card h2 {
            font-size: 16px;
        }

        .doc-page .info-card p, .doc-list li {
            font-size: 13px;
        }

    .price-table {
        font-size: 13px;
    }

        .price-table th, .price-table td {
            padding: 10px 8px;
        }

    .markup-layout {
        grid-template-columns: 1fr;
    }

    .markup-preview-area {
        min-height: 460px;
    }

    .markup-preview-wrap {
        min-height: 400px;
    }

    .signature-layout {
        grid-template-columns: 1fr;
    }

    .signature-preview-wrap {
        min-height: 420px;
    }

    .preview-nav {
        max-width: 110px;
    }

    .quality-edit-toggle.full-width {
        width: 100%;
        justify-content: center;
    }

    .cmp-drop-zone-wrap {
        grid-template-columns: 1fr;
    }

    .cmp-result-head,
    .cmp-result {
        grid-template-columns: 1fr;
    }

    .cmp-result-head-cell:first-child {
        border-right: none;
        border-bottom: 1px solid #2d3748;
    }
}

/* ===== Текст пункта в карточке риска ===== */
.cmp-risk-clause {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    background: #4299e1;
    color: #fff;
    border-radius: 4px;
    margin-right: 4px;
    white-space: nowrap;
}

.cmp-risk-clause-text {
    padding: 10px 14px;
    background: #f7fafc;
    border-left: 3px solid #cbd5e0;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.6;
    color: #2d3748;
    margin-bottom: 10px;
    white-space: pre-wrap;
    word-break: break-word;
}

.cmp-risk-clause-text .cmp-danger {
    background: #feb2b2;
    color: #742a2a;
    font-weight: 700;
    border-radius: 2px;
    padding: 1px 3px;
    box-shadow: 0 0 0 1px #e53e3e;
}

/* ===== Дуга вращения элемента ===== */
.sig-rotate-arc {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #4299e1;
    cursor: grab;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 9;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, background 0.15s;
}

    .sig-rotate-arc::before {
        content: '';
        display: block;
        width: 12px;
        height: 12px;
        border: 2px solid #4299e1;
        border-radius: 50%;
        border-color: #4299e1 transparent #4299e1 #4299e1;
        transform: rotate(-45deg);
    }

    .sig-rotate-arc:hover {
        background: #ebf8ff;
        transform: translateX(-50%) scale(1.15);
    }

    .sig-rotate-arc:active {
        cursor: grabbing;
        transform: translateX(-50%) scale(0.95);
    }

/* ===== Кружок межбуквенного расстояния ===== */
.sig-letter-spacing {
    position: absolute;
    top: -30px;
    left: calc(50% + 32px);
    transform: translateX(-50%);
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #ed8936;
    cursor: ew-resize;
    pointer-events: auto;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    z-index: 9;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, background 0.15s;
}

    .sig-letter-spacing::before {
        content: '↔';
        font-size: 11px;
        line-height: 1;
        color: #ed8936;
        font-weight: 700;
    }

    .sig-letter-spacing:hover {
        background: #fffaf0;
        transform: translateX(-50%) scale(1.15);
    }

    .sig-letter-spacing:active {
        cursor: ew-resize;
        transform: translateX(-50%) scale(0.95);
    }

/* ============ БЛОГ ============ */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.blog-card {
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    text-decoration: none;
    color: #2d3748;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.blog-card:hover {
    border-color: #4299e1;
    box-shadow: 0 4px 20px rgba(66,153,225,0.15);
    transform: translateY(-2px);
}

.blog-card-emoji {
    font-size: 36px;
    line-height: 1;
    margin-bottom: 14px;
}

.blog-card-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 10px;
    line-height: 1.35;
}

.blog-card-desc {
    font-size: 14px;
    color: #4a5568;
    line-height: 1.6;
    flex: 1;
    margin-bottom: 14px;
}

.blog-card-more {
    font-size: 13px;
    font-weight: 700;
    color: #4299e1;
}

/* ===== Страница статьи ===== */
.article-page {
    max-width: 780px;
    margin: 0 auto;
}

.article-header {
    min-height: 160px;
    background-color: #fff;
    padding: 32px 28px;
    border-radius: 14px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.article-header h1 {
    font-size: 28px;
    line-height: 1.3;
    margin-bottom: 10px;
    color: #1a202c;
}

.article-meta {
    font-size: 13px;
    color: #718096;
}

.article-meta a {
    color: #4299e1;
    text-decoration: none;
}

.article-meta a:hover {
    text-decoration: underline;
}

.article-body {
    background: #fff;
    border-radius: 12px;
    padding: 32px 36px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
    font-size: 15px;
    line-height: 1.75;
    color: #2d3748;
}

.article-body h2 {
    font-size: 21px;
    font-weight: 700;
    color: #1a202c;
    margin-top: 32px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e2e8f0;
}

.article-body h2:first-child {
    margin-top: 0;
}

.article-body h3 {
    font-size: 17px;
    font-weight: 700;
    color: #2d3748;
    margin-top: 24px;
    margin-bottom: 10px;
}

.article-body p {
    margin-bottom: 14px;
}

.article-body ul,
.article-body ol {
    margin: 12px 0 18px 24px;
}

.article-body li {
    margin-bottom: 8px;
}

.article-body a {
    color: #4299e1;
    text-decoration: underline;
}

.article-body a:hover {
    color: #2b6cb0;
}

.article-body code {
    background: #edf2f7;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', Monaco, monospace;
}

.article-body blockquote {
    padding: 12px 18px;
    background: #ebf8ff;
    border-left: 4px solid #4299e1;
    border-radius: 6px;
    margin: 20px 0;
    font-size: 14px;
    color: #2c5282;
}

.article-figure {
    margin: 24px 0;
    text-align: center;
}

.article-figure img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.article-figure figcaption {
    font-size: 13px;
    color: #718096;
    margin-top: 8px;
    font-style: italic;
}

.article-cta {
    display: block;
    margin: 32px 0 0;
    padding: 22px 24px;
    background: linear-gradient(135deg, #ebf8ff, #f0fff4);
    border: 1px solid #bee3f8;
    border-radius: 12px;
    text-align: center;
}

.article-cta p {
    font-size: 15px;
    color: #2d3748;
    margin-bottom: 14px;
}

.article-cta .btn {
    display: inline-flex;
}

.article-back {
    display: inline-block;
    margin-top: 28px;
    font-size: 14px;
    color: #718096;
    text-decoration: none;
}

.article-back:hover {
    color: #4299e1;
}

@media (max-width: 820px) {
    .blog-grid {
        grid-template-columns: 1fr;
    }
    .article-body {
        padding: 22px 20px;
    }
    .article-header {
        padding: 22px 20px;
    }
    .article-header h1 {
        font-size: 22px;
    }
    .article-body h2 {
        font-size: 18px;
    }
}

/* ===== Подсказка «Как это работает» в первом шаге ===== */
.step {
    position: relative;
}

.step-help {
    position: absolute;
    top: 14px;
    right: 14px;
    display: inline-flex;
    align-items: center;
    height: 36px;
    border-radius: 18px;
    background: #4299e1;
    color: #fff;
    overflow: hidden;
    text-decoration: none;
    z-index: 10;
    font-family: inherit;
    transition: background 0.15s ease;
    cursor: pointer;
}

.step-help:hover {
    background: #2b6cb0;
}

.step-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    transition: width 0.25s ease, opacity 0.15s ease;
    user-select: none;
}

.step-help:hover .step-help-icon {
    width: 0;
    opacity: 0;
}

.step-help-text {
    display: inline-block;
    max-width: 0;
    overflow: hidden;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    opacity: 0;
    padding: 0;
    transition: max-width 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
    user-select: none;
}

.step-help:hover .step-help-text {
    max-width: 220px;
    opacity: 1;
    padding: 0 16px;
}

@media (max-width: 820px) {
    .step-help {
        top: 10px;
        right: 10px;
        height: 32px;
        border-radius: 16px;
    }
    .step-help-icon {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    .step-help:hover .step-help-text {
        max-width: 170px;
        font-size: 13px;
        padding: 0 12px;
    }
}

/* ===== Модалка порядка объединения ===== */
.merge-order-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 55vh;
    overflow-y: auto;
    padding: 4px 2px;
}

.merge-order-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

    .merge-order-item:hover {
        border-color: #4299e1;
        box-shadow: 0 1px 4px rgba(66,153,225,0.15);
    }

.merge-order-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #4299e1;
    color: #fff;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.merge-order-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #2d3748;
    font-weight: 500;
}

.merge-order-pages {
    color: #a0aec0;
    font-size: 12px;
    white-space: nowrap;
    margin-right: 6px;
}

.merge-order-btns {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

    .merge-order-btns button {
        width: 28px;
        height: 28px;
        border: 1px solid #cbd5e0;
        background: #fff;
        color: #4a5568;
        border-radius: 6px;
        cursor: pointer;
        font-size: 12px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        transition: all 0.15s;
        font-family: inherit;
    }

        .merge-order-btns button:hover:not(:disabled) {
            background: #4299e1;
            color: #fff;
            border-color: #4299e1;
        }

        .merge-order-btns button:disabled {
            opacity: 0.3;
            cursor: not-allowed;
        }

.merge-order-empty {
    padding: 30px 20px;
    text-align: center;
    color: #a0aec0;
    font-size: 13px;
    font-style: italic;
    border: 1px dashed #cbd5e0;
    border-radius: 8px;
}

/* ===== Режим работы PDF ===== */
.pdf-mode-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    margin-bottom: 14px;
}

    .pdf-mode-bar label {
        font-size: 13px;
        color: #4a5568;
        font-weight: 500;
    }

    .pdf-mode-bar select {
        padding: 6px 12px;
        border: 1px solid #cbd5e0;
        border-radius: 6px;
        font-size: 13px;
        background: #fff;
        cursor: pointer;
        min-width: 280px;
    }

/* ===== Простой режим: объединение ===== */
.pdf-merge-simple {
    padding: 0 2px;
}

.merge-layout {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.merge-left {
    flex: 1;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    min-width: 0;
}

.merge-right {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px;
}

.merge-info {
    padding: 0 0 12px;
    color: #718096;
    font-size: 12px;
    text-align: center;
    line-height: 1.5;
}

.merge-files-list {
    list-style: none;
    margin: 0;
    padding: 6px;
    max-height: 520px;
    overflow: auto;
}

    .merge-files-list li {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 10px;
        margin-bottom: 4px;
        background: #f7fafc;
        border: 1px solid #e2e8f0;
        border-radius: 6px;
        cursor: grab;
        user-select: none;
        font-size: 13px;
        transition: border-color 0.1s, background 0.1s;
    }

        .merge-files-list li:active {
            cursor: grabbing;
        }

        .merge-files-list li.dragging {
            opacity: 0.4;
        }

        .merge-files-list li.dragover {
            border-color: #48bb78;
            background: #f0fff4;
        }

    .merge-files-list .mf-num {
        font-weight: 700;
        color: #4299e1;
        width: 22px;
        text-align: center;
        flex-shrink: 0;
    }

    .merge-files-list .mf-name {
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .merge-files-list .mf-meta {
        color: #a0aec0;
        font-size: 11px;
        flex-shrink: 0;
    }

.merge-right .btn-deploy {
    width: 100%;
    min-height: 44px;
    font-size: 14px;
}