/* ============================================================
   PDF-Generator – Stylesheet (Modern)
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-bg: #f0f2f5;
    --color-surface: #ffffff;
    --color-surface-alt: #f7f8fa;
    --color-primary: #2563eb;
    --color-primary-light: #dbeafe;
    --color-primary-hover: #1d4ed8;
    --color-primary-10: rgba(37, 99, 235, .08);
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-text-light: #94a3b8;
    --color-border: #e2e8f0;
    --color-border-hover: #cbd5e1;
    --color-success: #16a34a;
    --color-success-bg: #f0fdf4;
    --color-danger: #ef4444;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,.08);
    --shadow-card: 0 1px 4px rgba(0,0,0,.05), 0 0 0 1px rgba(0,0,0,.03);
    --transition: 180ms cubic-bezier(.4,0,.2,1);
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Scrollbar --- */
.panel-content::-webkit-scrollbar { width: 6px; }
.panel-content::-webkit-scrollbar-track { background: transparent; }
.panel-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.panel-content::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- Homescreen --- */
.homescreen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    min-height: 100vh;
    padding: 0 32px 48px;
    background: var(--color-bg);
}

.homescreen.hidden { display: none; }

.homescreen-inner {
    max-width: 1100px;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: -8vh;
}

.homescreen-logo {
    display: block;
    margin: 48px auto 0;
    height: 56px;
    opacity: .9;
    flex-shrink: 0;
}

.homescreen-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--color-text);
    letter-spacing: -0.03em;
    margin-bottom: 40px;
    text-align: center;
}

.homescreen-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    width: 100%;
}

.template-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 24px 20px 20px;
    cursor: pointer;
    transition: all 220ms cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.template-card:hover {
    border-color: var(--color-primary);
    box-shadow: 0 8px 32px rgba(37, 99, 235, .12), 0 0 0 1px var(--color-primary);
    transform: translateY(-4px);
}

.template-card:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(37, 99, 235, .10);
}

.template-card-thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--color-bg);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.template-card-thumb svg {
    width: 70%;
    height: 70%;
    opacity: .55;
}

.template-card-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    line-height: 1.35;
}

.template-card-desc {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.4;
    margin-top: -8px;
}

/* --- Main Container --- */
.app-container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.app-container.hidden { display: none; }

/* --- Panels --- */
.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-settings {
    width: 480px;
    min-width: 380px;
    border-right: 1px solid var(--color-border);
    background: var(--color-surface);
}

.panel-preview {
    flex: 1;
    background: var(--color-bg);
}

.panel-header {
    padding: 0 24px;
    height: 56px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    background: var(--color-surface);
}

.panel-header h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.preview-header-center h2 {
    font-size: 16px;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 22px 32px;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group > label {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M2.5 4.5L6 8l3.5-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
}

.form-group select:hover {
    border-color: var(--color-border-hover);
}

.form-group select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-10);
}

/* ============================================================
   FILE INPUT BOX
   ============================================================ */
.file-input-box {
    border: 1.5px dashed var(--color-border);
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    background: linear-gradient(135deg, #fafbfd 0%, #f4f6f9 100%);
    transition: all var(--transition);
    text-align: center;
}

.file-input-box:hover {
    border-color: var(--color-primary);
    background: linear-gradient(135deg, #f0f4ff 0%, #eef1fb 100%);
}

.file-input-box input[type="file"] {
    font-size: 13px;
    font-family: inherit;
    color: var(--color-text-muted);
    cursor: pointer;
    width: 100%;
}

.file-input-box input[type="file"]::file-selector-button {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text);
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 6px 14px;
    margin-right: 10px;
    cursor: pointer;
    transition: all var(--transition);
}

.file-input-box input[type="file"]::file-selector-button:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.control-hint {
    display: block;
    margin-top: 5px;
    font-size: 11px;
    color: var(--color-text-light);
    font-style: italic;
}

/* ============================================================
   SETTINGS CARDS
   ============================================================ */
.settings-card {
    background: linear-gradient(135deg, #f0f4ff 0%, #eef1fb 100%);
    border: 1px solid rgba(37, 99, 235, .08);
    border-radius: var(--radius-xl);
    padding: 14px 14px 12px;
    margin-top: 14px;
    box-shadow: 0 1px 4px rgba(37, 99, 235, .04);
    position: relative;
    overflow: hidden;
    animation: cardIn 300ms cubic-bezier(.22, 1, .36, 1) both;
    transition: box-shadow var(--transition), border-color var(--transition);
}

.settings-card:hover {
    box-shadow: 0 4px 16px rgba(37, 99, 235, .06);
    border-color: rgba(37, 99, 235, .14);
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.settings-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 18px;
    letter-spacing: -0.01em;
}

/* ============================================================
   CSV MAPPING
   ============================================================ */
.mapping-row {
    display: flex;
    gap: 10px;
}

.mapping-col {
    flex: 1;
    min-width: 0;
}

.mapping-col label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 5px;
    letter-spacing: 0.02em;
}

.mapping-col select {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface-alt);
    outline: none;
    cursor: pointer;
    transition: all var(--transition);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2364748b' d='M2 3.5L5 7l3-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 10px;
}

.mapping-col select:hover {
    border-color: var(--color-border-hover);
}

.mapping-col select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-10);
    background-color: #fff;
}

.mapping-status {
    margin-top: 12px;
    font-size: 12px;
    line-height: 1.9;
}

.mapping-ok {
    color: var(--color-success);
    font-weight: 600;
}

.mapping-missing {
    color: var(--color-danger);
    font-weight: 500;
}

.mapping-optional {
    color: var(--color-text-light);
}

.status-icon {
    margin-right: 3px;
}

/* ============================================================
   CONTROL LAYOUT
   ============================================================ */
.control-full {
    margin-bottom: 18px;
}

.control-full:last-child {
    margin-bottom: 0;
}

/* Full-width slider controls get the same inner-box treatment */
.control-full:has(.slider-wrap) {
    background: rgba(255, 255, 255, .7);
    border-radius: 10px;
    padding: 10px 12px 8px;
    border: 1px solid rgba(37, 99, 235, .06);
}

.control-full > label,
.slider-col > label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.control-full select {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text);
    background: #fff;
    outline: none;
    cursor: pointer;
    transition: all var(--transition);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2364748b' d='M2 3.5L5 7l3-3.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px;
}

.control-full select:hover {
    border-color: var(--color-border-hover);
    background: #fafbfc;
}

.control-full select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-10);
    background-color: #fff;
}

/* ============================================================
   SLIDER ROWS
   ============================================================ */
.slider-row {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}

.slider-row:last-child {
    margin-bottom: 0;
}

.slider-col {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, .7);
    border-radius: 10px;
    padding: 10px 12px 8px;
    border: 1px solid rgba(37, 99, 235, .06);
}

/* ============================================================
   RANGE SLIDER
   ============================================================ */
.slider-wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.slider-wrap input[type="range"] {
    width: 100%;
    flex: 0 0 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: linear-gradient(90deg, #e2e6ec, #edf0f4);
    border-radius: 100px;
    outline: none;
    cursor: pointer;
    margin: 0;
    padding: 0;
    transition: background var(--transition);
}

.slider-wrap input[type="range"]:hover {
    background: linear-gradient(90deg, #d4d9e2, #e2e6ec);
}

/* WebKit (Chrome, Safari, Edge) */
.slider-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #5b8ef5, var(--color-primary));
    border: 2.5px solid #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .35), 0 0 0 1px rgba(37, 99, 235, .08);
    cursor: pointer;
    margin-top: -7px; /* Center: -(thumbH - trackH) / 2 = -(20 - 6) / 2 */
    transition: transform var(--transition), box-shadow var(--transition);
}

.slider-wrap input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 14px rgba(37, 99, 235, .4), 0 0 0 1px rgba(37, 99, 235, .12);
}

.slider-wrap input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(1.05);
    background: radial-gradient(circle at 35% 35%, #4a7de4, var(--color-primary-hover));
}

.slider-wrap input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 100px;
}

/* Firefox */
.slider-wrap input[type="range"]::-moz-range-track {
    height: 6px;
    background: linear-gradient(90deg, #e2e6ec, #edf0f4);
    border-radius: 100px;
    border: none;
}

.slider-wrap input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #5b8ef5, var(--color-primary));
    border: 2.5px solid #fff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, .35);
    cursor: pointer;
}

.slider-value {
    display: block;
    width: 100%;
    text-align: right;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-primary);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    margin-top: 10px;
    padding: 0 2px;
    line-height: 1.2;
}

/* ============================================================
   RADIO GROUP – segmented control
   ============================================================ */
.radio-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--color-text-muted);
    margin-bottom: 8px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.radio-group {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, .6);
    border: 1px solid rgba(37, 99, 235, .08);
    border-radius: 10px;
    padding: 3px;
    overflow: hidden;
}

.radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 200ms cubic-bezier(.22, 1, .36, 1);
    text-align: center;
    white-space: nowrap;
}

.radio-option:hover {
    color: var(--color-text);
    background: rgba(255,255,255,.5);
}

.radio-option:has(input:checked) {
    background: #fff;
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(37, 99, 235, .12), 0 0 0 1px rgba(37, 99, 235, .06);
}

.radio-option input[type="radio"] {
    display: none;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    background: var(--color-surface);
    color: var(--color-text);
}

.btn:hover {
    border-color: var(--color-border-hover);
    background: #f8fafc;
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    width: 100%;
    padding: 13px 20px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--radius-lg);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
    letter-spacing: 0.01em;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(37, 99, 235, .2);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 13px;
    border-radius: 8px;
}

/* ============================================================
   PREVIEW AREA
   ============================================================ */
.preview-area {
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    height: 100%;
    background: var(--color-bg);
    overflow: hidden;
}

.preview-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: auto;
    display: block;
    touch-action: pan-x pan-y;
}

.preview-placeholder {
    text-align: center;
    color: var(--color-text-light);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.placeholder-icon {
    font-size: 48px;
    opacity: .4;
}

.preview-placeholder p {
    font-size: 13px;
    max-width: 200px;
    line-height: 1.5;
}

.preview-page {
    width: 100%;
    height: 100%;
    padding: 0;
    position: absolute;
    top: 0;
    left: 0;
}

/* ============================================================
   PREVIEW CONTROLS & PAGINATION
   ============================================================ */
.preview-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-page {
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 18px;
    font-weight: 700;
    border-radius: 8px;
    background: var(--color-primary);
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 1px 4px rgba(37, 99, 235, .2);
}

.btn-page:hover:not(:disabled) {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(37, 99, 235, .3);
}

.btn-page:disabled {
    opacity: .35;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#page-indicator {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text);
    min-width: 90px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    background: var(--color-surface);
    padding: 0 14px;
    border-radius: 8px;
    border: 1.5px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    height: 34px;
    line-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   PREVIEW HEADER LAYOUT
   ============================================================ */
.preview-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    height: 56px;
    box-sizing: border-box;
}

.preview-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-self: start;
}

.preview-header-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: end;
}

/* ============================================================
   ZOOM CONTROLS
   ============================================================ */
.zoom-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--color-surface-alt);
    border: 1.5px solid var(--color-border);
    border-radius: 8px;
    padding: 3px;
}

.btn-icon {
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 16px;
    font-weight: 700;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-icon:hover {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-xs);
    transform: none;
}

.zoom-level {
    font-size: 12px;
    font-weight: 700;
    color: var(--color-text);
    min-width: 42px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   DOWNLOAD BUTTON (in preview header)
   ============================================================ */
.btn-download {
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(37, 99, 235, .25);
    white-space: nowrap;
}

.btn-download:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
    transform: translateY(-1px);
}

.btn-download:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(37, 99, 235, .2);
}

.btn-download:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    opacity: .7;
}

.btn-download:disabled:hover {
    background: #94a3b8;
    box-shadow: none;
    transform: none;
}

.btn-download-icon {
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
}

/* ============================================================
   UTILITY
   ============================================================ */
.hidden {
    display: none !important;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
#type-settings-container {
    animation: fadeIn 200ms ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {

    /* --- Homescreen fix: logo on top, title below --- */
    .homescreen {
        padding: 0 16px 32px;
    }

    .homescreen-logo {
        margin: 32px auto 0;
        height: 44px;
    }

    .homescreen-inner {
        margin-top: 0;
        padding-top: 24px;
        justify-content: flex-start;
    }

    .homescreen-title {
        font-size: 22px;
        margin-bottom: 24px;
    }

    .homescreen-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .template-card {
        padding: 14px 10px 14px;
        gap: 10px;
    }

    .template-card-label {
        font-size: 13px;
    }

    .template-card-desc {
        font-size: 11px;
    }

    /* --- App container: single column flow --- */
    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .panel-settings {
        width: 100%;
        min-width: 0;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        max-height: none;
        overflow: visible;
    }

    .panel-settings .panel-content {
        overflow: visible;
        padding: 16px 16px 24px;
    }

    .settings-card {
        padding: 14px;
    }

    .radio-group {
        flex-direction: column;
    }

    /* --- Preview panel: full width, good height --- */
    .panel-preview {
        min-height: auto;
        flex: none;
    }

    /* Preview header: title row, then controls row */
    .preview-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        padding: 10px 16px;
        height: auto;
        min-height: 48px;
    }

    /* Title "Live-Vorschau" left-aligned */
    .preview-header-center {
        order: 1;
        flex: 1 1 100%;
    }

    .preview-header-center h2 {
        font-size: 15px;
        text-align: left;
    }

    /* Pagination controls */
    .preview-header-left {
        order: 2;
        justify-self: auto;
        flex: 0 0 auto;
    }

    /* Zoom + Download on one row, same height, spaced apart */
    .preview-header-right {
        order: 3;
        justify-self: auto;
        flex: 1 1 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .zoom-controls {
        flex-shrink: 0;
    }

    .btn-download {
        padding: 8px 14px;
        font-size: 12px;
        flex-shrink: 0;
    }

    /* Preview area: no extra padding, let content fill width */
    .preview-area {
        padding: 0;
        min-height: 0;
        height: auto;
        overflow: visible;
    }

    .preview-container {
        height: auto;
        overflow: visible;
        position: relative;
    }

    /* Preview page: static flow, fill width */
    .preview-page {
        position: relative;
        width: 100% !important;
        height: auto !important;
        min-height: 50vh;
        padding: 12px 8px 24px;
        display: flex;
        justify-content: center;
        align-items: flex-start;
    }

    /* Scale the actual page element to fit screen width */
    .preview-page > .aufsteller-page,
    .preview-page > .a5-page,
    .preview-page > .qr-sheet-page,
    .preview-page > .sticker-page {
        transform-origin: top center !important;
        margin: 0 auto !important;
        position: relative !important;
        left: auto !important;
        top: auto !important;
    }
}

/* ============================================================
   EXPORT PROGRESS OVERLAY
   ============================================================ */
.export-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, .6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayIn 200ms ease;
}

.export-overlay.hidden {
    display: none;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.export-modal {
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 40px 48px;
    text-align: center;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .2);
    min-width: 340px;
    max-width: 420px;
    animation: modalIn 300ms cubic-bezier(.22, 1, .36, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(16px) scale(.96); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.export-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.export-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 6px;
}

.export-status {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    margin-bottom: 20px;
}

.export-progress-track {
    width: 100%;
    height: 8px;
    background: var(--color-bg);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 10px;
}

.export-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-primary), #818cf8);
    border-radius: 100px;
    transition: width 120ms ease;
}

.export-percent {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-primary);
    font-variant-numeric: tabular-nums;
}

.btn-cancel-export {
    margin-top: 18px;
    padding: 9px 28px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-cancel-export:hover {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}
