* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    overscroll-behavior: none;
}

img,
svg,
canvas,
video {
    max-width: 100%;
}

button,
input,
select,
textarea {
    font: inherit;
}

:root {
    --primary: #2c3e50;
    --accent: #3498db;
    --accent-dark: #2980b9;
    --light-bg: #ecf0f1;
    --border: #bdc3c7;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --app-bg-radial: radial-gradient(circle at top left, rgba(99, 102, 241, 0.16), transparent 34%);
    --app-bg-linear: linear-gradient(135deg, #eef2ff 0%, #f8fafc 42%, #eef2f7 100%);
    --panel-border: rgba(226, 232, 240, 0.92);
    --desktop-preview-width: 794px;
    --desktop-preview-height: 1123px;
    --desktop-column-offset: 12px;
    --desktop-column-height: calc(100vh - (var(--desktop-column-offset) * 2));
    --desktop-toolbar-offset: 88px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    overscroll-behavior: none;
}

.products-hero {
    width: min(1500px, calc(100% - 32px));
    margin: 24px auto 0;
    padding: 22px;
    display: grid;
    grid-template-columns: minmax(260px, 0.55fr) 1.45fr;
    gap: 22px;
    align-items: center;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--panel-border);
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.16);
    color: #0f172a;
}

.products-hero-content {
    display: grid;
    gap: 16px;
}

.products-kicker {
    color: #4f46e5;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.products-hero h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1.02;
}

.products-hero-content > p:not(.products-kicker) {
    color: #64748b;
    font-size: clamp(15px, 1.5vw, 18px);
    line-height: 1.6;
}

.products-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

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

.product-card {
    display: grid;
    gap: 4px;
    padding: 13px;
    min-height: 104px;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    color: #0f172a;
    cursor: pointer;
    text-align: left;
    backdrop-filter: blur(14px);
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover,
.product-card:focus-visible,
.product-card.is-active {
    transform: translateY(-3px);
    border-color: #818cf8;
    background: linear-gradient(180deg, #eef2ff, #ffffff);
    box-shadow: 0 14px 28px rgba(79, 70, 229, 0.16);
    outline: none;
}

.product-card span {
    color: #4f46e5;
    font-size: 12px;
    font-weight: 900;
}

.product-card strong {
    font-size: 15px;
    line-height: 1.15;
}

.product-card small {
    color: #64748b;
    font-size: 12px;
    line-height: 1.35;
}

@media (max-width: 1180px) {
    .products-hero {
        grid-template-columns: 1fr;
    }

    .products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
    }
}

/* Form Section */
.form-section {
    background: white;
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    max-height: 100vh;
    overflow-y: auto;
}

.form-group {
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.form-group:last-child {
    border-bottom: none;
}

.form-group legend {
    font-size: 1.3em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 20px;
    display: block;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row-full {
    margin-bottom: 20px;
}

.description-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 10px;
    padding: 8px;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
}

.description-toolbar-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 3px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}

.description-toolbar button {
    min-width: 42px;
    min-height: 30px;
    padding: 6px 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.1;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.description-toolbar button:hover,
.description-toolbar button:focus-visible {
    background: #eff6ff;
    color: #1d4ed8;
    transform: translateY(-1px);
    outline: none;
}

.description-toolbar button.is-active {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    color: #ffffff;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.2);
}

.photo-shape-options {
    display: grid;
    gap: 6px;
    margin-top: 10px;
}

.btn-clear-photo {
    width: 100%;
    border: 1px solid #fecaca;
    background: #fff1f2;
    color: #b91c1c;
    border-radius: 8px;
    padding: 9px 12px;
    font-weight: 700;
    cursor: pointer;
}

.btn-clear-photo:hover {
    background: #ffe4e6;
    border-color: #fb7185;
}

.photo-shape-circle {
    border-radius: 50%;
}

.photo-shape-rounded {
    border-radius: 12px;
}

.photo-shape-square {
    border-radius: 0;
}

.site-footer {
    width: min(1500px, calc(100% - 32px));
    margin: 24px auto 0;
    padding: 22px 28px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    color: #ffffff;
    background: rgba(15, 23, 42, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.site-footer p {
    margin: 4px 0 0;
    color: rgba(255, 255, 255, 0.86);
}

.site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.site-footer a {
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 768px) {
    .site-footer {
        width: 100%;
        margin-top: 10px;
        padding: 18px 14px;
        flex-direction: column;
        align-items: flex-start;
    }
}

.model-choice-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.model-choice-heading label {
    margin-bottom: 0;
}

.model-gallery-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: linear-gradient(135deg, #eff6ff, #eef2ff);
    color: #1d4ed8;
    cursor: pointer;
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(59, 130, 246, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.model-gallery-plus:hover,
.model-gallery-plus:focus-visible {
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.18);
    outline: none;
}

.visually-hidden-select {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.form-col {
    display: flex;
    flex-direction: column;
}

.form-col-full {
    display: flex;
    flex-direction: column;
}

label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.char-count {
    font-size: 0.85em;
    color: #999;
    font-weight: normal;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
textarea,
select {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
    font-family: inherit;
}

/* Uniformiser les polices des niveaux dans le formulaire */
.comp-niveau,
.langue-niveau {
    font-size: 1em;
}

.form-section select.comp-niveau,
.form-section select.langue-niveau {
    font-family: inherit;
    font-size: 1em;
    font-style: normal;
    font-weight: 400;
    color: #333;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
}

.colors-editor {
    display: grid;
    gap: 12px;
}

.color-group {
    display: grid;
    gap: 8px;
}

.color-group-title {
    font-size: 0.9em;
    font-weight: 600;
    color: #555;
}

.color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.titles-editor {
    display: grid;
    gap: 10px;
}

.color-row {
    width: 42px;
    height: 42px;
}

.color-row input[type="color"] {
    width: 42px;
    height: 42px;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    padding: 2px;
    background: #fff;
    cursor: pointer;
}

.color-label {
    font-size: 0.9em;
    color: #555;
    word-break: break-word;
}

.colors-empty {
    color: #777;
    font-size: 0.95em;
}

.title-row {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
}

.title-row label {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 0;
    font-size: 0.9em;
    color: #555;
}

.title-count {
    color: #777;
    font-size: 0.9em;
    white-space: nowrap;
}

.titles-empty {
    color: #777;
    font-size: 0.95em;
}

.font-size-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 360px;
}

.font-size-controls input[type="range"] {
    flex: 1;
    accent-color: #667eea;
}

.download-status {
    width: 100%;
    margin: 6px 0 0;
    font-size: 0.9em;
    font-weight: 600;
    color: #b00020;
}

.btn-primary.download-blocked {
    background: #b00020;
    border-color: #b00020;
    cursor: not-allowed;
    opacity: 0.9;
    pointer-events: none;
}

.cv-overflow-notification {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    padding: 14px 18px;
    border-radius: 10px;
    background: #b00020;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.22);
    opacity: 0;
    transform: translateY(12px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.cv-overflow-notification.visible {
    opacity: 1;
    transform: translateY(0);
}

#taillePoliceModeleLabel {
    min-width: 34px;
    text-align: center;
    font-weight: 600;
    color: #555;
}

textarea {
    resize: vertical;
    min-height: 80px;
    overflow-y: hidden;
}

textarea[id="description"],
textarea.exp-description,
textarea.projet-description {
    min-height: 150px;
}

/* Entrées dynamiques */
.dynamic-entry {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    border: 2px solid #e0e0e0;
    position: relative;
}

.exp-logo {
    max-width: 220px;
    font-size: 0.9em;
}

.dynamic-entry .form-row {
    margin-bottom: 15px;
}

.btn-remove {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.btn-remove:hover {
    background: #c0392b;
}

/* Boutons */
.btn-add {
    background: #f0f0f0;
    color: #667eea;
    border: 2px solid #667eea;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    width: 100%;
    margin-top: 10px;
}

.btn-add:hover {
    background: #667eea;
    color: white;
}

.form-actions {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
    margin-top: 30px;
}

@media (max-width: 768px) {
    .form-actions {
        grid-template-columns: 1fr;
    }
}

.btn-primary,
.btn-secondary,
.btn-preview {
    padding: 14px 28px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-compact {
    min-width: auto;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 800;
}

.btn-compact-primary {
    border: 1px solid #bfdbfe;
    background: linear-gradient(135deg, #eff6ff, #eef2ff);
    color: #1d4ed8;
}

.btn-compact-primary:hover {
    background: linear-gradient(135deg, #dbeafe, #e0e7ff);
}

.import-data-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Photo Upload */
.photo-upload-area {
    border: 2px dashed #667eea;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    background: #f8f9ff;
    transition: all 0.3s;
    cursor: pointer;
    position: relative;
    min-height: 150px;
}

.photo-upload-area:hover {
    background: #f0f2ff;
    border-color: #5568d3;
}

.photo-upload-area.drag-over {
    background: #e8ebff;
    border-color: #667eea;
}

.photo-upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.photo-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.photo-upload-area p {
    font-weight: 600;
    color: #667eea;
    margin: 10px 0;
}

.photo-upload-area small {
    color: #999;
    display: block;
    margin: 10px 0;
}

.photo-link {
    color: #667eea;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 600;
}

.photo-preview {
    position: relative;
    display: inline-flex;
    width: 150px;
    height: 150px;
    overflow: hidden;
    border: 2px solid #667eea;
    background: #eef2ff;
    align-items: center;
    justify-content: center;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
}

.btn-remove-photo {
    position: absolute;
    top: -10px;
    right: -10px;
    background: #e74c3c;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-photo:hover {
    background: #c0392b;
}

/* Preview Section - Taille A4 fixe */
.preview-section {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    width: 210mm;              /* Largeur A4 */
    min-height: 297mm;         /* Hauteur minimale A4 */
    max-height: 297mm;         /* Hauteur maximale A4 */
    overflow: hidden;          /* Cache le débordement pour le calcul JS */
    font-size: 7pt;
    line-height: 1.4;
    box-sizing: border-box;
}

/* CV Container */
.cv-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.cv-header {
    display: flex;
    flex-direction: row;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 3px solid var(--accent);
}

.photo-container {
    flex-shrink: 0;
}

.cv-photo {
    width: 140px;
    height: 140px;
    border-radius: 10px;
    border: 3px solid var(--accent);
    object-fit: cover;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.cv-header-content {
    flex: 1;
}

.cv-title {
    font-size: 27pt;
    color: var(--primary);
    margin-bottom: 8px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.cv-role {
    font-size: 20pt;
    color: var(--accent-dark);
    font-weight: 700;
    margin-bottom: 10px;
}

.cv-description {
    color: var(--text-light);
    font-size: 20pt;
    line-height: 1.5;
    margin-bottom: 15px;
    font-style: italic;
}

.cv-contact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 15px;
    color: var(--text-light);
    font-size: 13pt;
}

.cv-contact span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/*------------------------------------------------------------------------------CV Sections----------------------------------------------*/
.cv-section {
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.section-frame {
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    page-break-inside: avoid;
}

.section-title {
    font-size: 21pt;
    color: var(--primary);
    margin-bottom: 2px; /*Modifiable (au dessus des postes)*/
    padding-bottom: 2px; /*Modifiable (en dessous des gros titres de section)*/
    border-bottom: 2px solid var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.section-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 1px;
}

.cv-item {
    padding-bottom: 2px;
}

.cv-item:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.cv-item-title {
    font-weight: 700;
    color: var(--primary);
    font-size: 20pt;
}

.cv-item-subtitle {
    color: var(--accent-dark);
    font-weight: 700;
    margin: 4px 0;
    font-size: 20pt;
}

.cv-item-text {
    color: var(--text-dark);
    line-height: 1.4;
    font-size: 16pt;
}

.cv-item-period {
    color: var(--text-light);
    margin: 2px 0;
    font-size: 13pt;
}

/* Compétences */
.competence-tag {
    display: flex;
    background-color: #2980b9;
    color: white;
    padding: 5px 10px; /*Modifiable*/
    border-radius: 18px;
    font-size: 13pt;
    font-weight: 600;
}

/* Langues */
.langue-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 16pt;
}

.langue-item .langue-nom {
    font-weight: 700;
    color: var(--primary);
}

.langue-item .langue-niveau {
    color: var(--text-light);
    font-style: italic;
    font-size: 16pt;
}

/* Centres d'intérêts */
.interet-item {
    display: inline-block;
    background-color: #2980b9;
    color: white;
    padding: 5px 10px; /*Modifiable*/
    border-radius: 18px;
    font-size: 13pt;
    font-weight: 600;
}

/* Modèles CV importés intelligemment depuis le dossier CV */
.modele-cv-1,
.modele-cv-2 {
    padding: 0;
    border: #000000 1px solid;
    box-shadow: none;
    background: white;
    display: flex !important;
    align-items: flex-start;
    justify-content: flex-start;
    width: 730px;
    height: 1032px;
    min-height: 1032px;
    max-height: 1032px;
    overflow: hidden;
}

.template-cv1 {
    display: flex;
    flex-direction: row;
    --template-scale: 1;
    --template-gap-scale: 1;
    width: 730px;
    height: 1032px;
    min-width: 730px;
    max-width: 730px;
    min-height: 1032px;
    max-height: 1032px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    flex: 0 0 730px;
    flex-shrink: 0;
}

.template-cv1 * {
    margin: 0;
    padding: 0;
    box-sizing: content-box;
}

.template-cv1-gauche,
.template-cv1-milieu,
.template-cv1-droite,
.template-cv1-haut-gauche,
.template-cv1-milieu-gauche,
.template-cv1-bas-gauche,
.template-cv1-haut-droite,
.template-cv1-milieu-droite,
.template-cv1-bas-droite,
.template-cv1-image,
.template-cv1-profil,
.template-cv1-projets,
.template-cv1-contact,
.template-cv1-nom,
.template-cv1-education,
.template-cv1-langue,
.template-cv1-competences,
.template-cv1-experiences,
.template-cv1-rectangle,
.template-cv1-carre,
.template-cv1-rectangleblanc {
    display: flex;
}

.template-cv1-gauche,
.template-cv1-milieu,
.template-cv1-droite {
    flex-direction: column;
    flex-shrink: 0;
}

.template-cv1-gauche {
    width: 39px;
    min-width: 39px;
    max-width: 39px;
    height: 1032px;
    min-height: 1032px;
    max-height: 1032px;
    flex: 0 0 39px;
}

.template-cv1-droite {
    width: 425px;
    min-width: 425px;
    max-width: 425px;
    height: 1032px;
    min-height: 1032px;
    max-height: 1032px;
    flex: 0 0 425px;
    overflow: hidden;
}

.template-cv1-milieu-droite,
.template-cv1-bas-droite,
.template-cv1-nom,
.template-cv1-education,
.template-cv1-langue,
.template-cv1-competences,
.template-cv1-experiences,
.template-cv1-profil,
.template-cv1-projets,
.template-cv1-contact {
    flex-direction: column;
}

.template-cv1-haut-gauche {
    background-color: #ffffff;
    width: 39px;
    height: 49px;
    flex: 0 0 49px;
}

.template-cv1-milieu-gauche {
    background-color: #ebcbbc;
    width: 39px;
    height: 238px;
    flex: 0 0 238px;
}

.template-cv1-bas-gauche {
    background-color: #ffffff;
    width: 39px;
    height: 745px;
    flex: 0 0 745px;
}

.template-cv1-haut-droite {
    background-color: #ffffff;
    width: 425px;
    height: 49px;
    flex: 0 0 49px;
}

.template-cv1-milieu-droite {
    background-color: #ebcbbc;
    width: 425px;
    height: 238px;
    flex: 0 0 238px;
}

.template-cv1-bas-droite {
    background-color: #ffffff;
    width: 425px;
    height: 745px;
    flex: 0 0 745px;
    overflow: hidden;
}

.template-cv1-image {
    margin-top: 49px;
    background-color: #000000;
    width: 230px;
    height: 230px;
    border-radius: 50%;
    border: #ffffff 3px solid;
    margin-left: 18px;
    overflow: hidden;
    flex: 0 0 230px;
    min-width: 230px;
    max-width: 230px;
    min-height: 230px;
    max-height: 230px;
}

.template-cv1-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.template-cv1-milieu {
    width: 266px;
    height: 1032px;
    min-width: 266px;
    max-width: 266px;
    min-height: 1032px;
    max-height: 1032px;
    background-color: #6C9A9A;
    color: #ffffff;
    flex: 0 0 266px;
    overflow: hidden;
}

.template-cv1-carre {
    background-color: #6C9A9A;
    width: 25px;
    height: 21px;
    min-width: 25px;
    max-width: 25px;
    min-height: 21px;
    max-height: 21px;
    flex: 0 0 25px;
}

.template-cv1-rectangle {
    height: 21px;
    gap: 10px;
    align-items: center;
    flex: 0 0 21px;
}

.template-cv1-education,
.template-cv1-langue,
.template-cv1-competences,
.template-cv1-experiences {
    margin-left: 30px;
    gap: calc(10px * var(--template-gap-scale));
    width: 365px;
    max-width: 365px;
    flex-shrink: 0;
    overflow: hidden;
}

.template-cv1-profil {
    margin-top: calc(45px * var(--template-gap-scale));
}

.template-cv1-projets {
    margin-top: calc(55px * var(--template-gap-scale));
}

.template-cv1-contact {
    margin-top: calc(65px * var(--template-gap-scale));
}

.template-cv1-profil,
.template-cv1-projets,
.template-cv1-contact {
    margin-left: 30px;
    gap: calc(10px * var(--template-gap-scale));
    width: 205px;
    max-width: 205px;
    flex-shrink: 0;
    overflow: hidden;
}

.template-cv1-rectangleblanc {
    height: 21px;
    gap: 10px;
    align-items: center;
    flex: 0 0 21px;
}

.template-cv1-carreblanc {
    background-color: #ffffff;
    width: 25px;
    height: 21px;
    min-width: 25px;
    max-width: 25px;
    min-height: 21px;
    max-height: 21px;
    flex: 0 0 25px;
}

.template-cv1-nom {
    margin-top: 94px;
    margin-left: 30px;
    width: 365px;
    max-width: 365px;
    height: 100px;
    overflow: hidden;
}

.template-cv1-nom h1 {
    font-size: 27px;
    font-family: "Roboto", sans-serif;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.template-cv1 h3 {
    font-size: calc(20px * var(--template-scale));
    font-family: "Roboto", sans-serif;
}

.template-cv1 p {
    font-size: calc(14px * var(--template-scale));
    font-family: "Roboto", sans-serif;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.template-cv1-education {
    margin-top: calc(45px * var(--template-gap-scale));
}

.template-cv1-langue {
    margin-top: calc(45px * var(--template-gap-scale));
}

.template-cv1-competences {
    margin-top: calc(45px * var(--template-gap-scale));
}

.template-cv1-experiences {
    margin-top: calc(55px * var(--template-gap-scale));
}

.template-cv1.template-light p {
    font-size: calc(15px * var(--template-scale));
    line-height: 1.35;
}

.template-cv1.template-light .template-cv1-projets {
    margin-top: calc(80px * var(--template-gap-scale));
}

.template-cv1.template-light .template-cv1-contact {
    margin-top: calc(95px * var(--template-gap-scale));
}

.template-cv1.template-light .template-cv1-education,
.template-cv1.template-light .template-cv1-langue,
.template-cv1.template-light .template-cv1-competences {
    margin-top: calc(65px * var(--template-gap-scale));
}

.template-cv1.template-light .template-cv1-experiences {
    margin-top: calc(85px * var(--template-gap-scale));
}

.template-cv1.template-dense p {
    font-size: calc(11px * var(--template-scale));
    line-height: 1.12;
}

.template-cv1.template-dense h3 {
    font-size: calc(17px * var(--template-scale));
}

.template-cv1.template-dense .template-cv1-profil {
    margin-top: calc(28px * var(--template-gap-scale));
}

.template-cv1.template-dense .template-cv1-projets {
    margin-top: calc(25px * var(--template-gap-scale));
}

.template-cv1.template-dense .template-cv1-contact {
    margin-top: calc(30px * var(--template-gap-scale));
}

.template-cv1.template-dense .template-cv1-education,
.template-cv1.template-dense .template-cv1-langue,
.template-cv1.template-dense .template-cv1-competences {
    margin-top: calc(25px * var(--template-gap-scale));
}

.template-cv1.template-dense .template-cv1-experiences {
    margin-top: calc(30px * var(--template-gap-scale));
}

.template-cv2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    --template-scale: 1;
    --template-gap-scale: 1;
    width: 730px;
    height: 1032px;
    min-width: 730px;
    max-width: 730px;
    min-height: 1032px;
    max-height: 1032px;
    gap: calc(28px * var(--template-gap-scale));
    margin: 0;
    padding: 0;
    overflow: hidden;
    flex: 0 0 730px;
    flex-shrink: 0;
}

.template-cv2 * {
    margin: 0;
    padding: 0;
    box-sizing: content-box;
}

.template-cv2-nom-prenom,
.template-cv2-contact,
.template-cv2-profil,
.template-cv2-experiences,
.template-cv2-education,
.template-cv2-projets,
.template-cv2-competences,
.template-cv2-langue,
.template-cv2 h3,
.template-cv2-description {
    display: flex;
    flex-direction: column;
}

.template-cv2-ligne {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    height: 18px;
    width: 659px;
    min-width: 659px;
    max-width: 659px;
    min-height: 18px;
    max-height: 18px;
    flex: 0 0 18px;
}

.template-cv2-carregris {
    display: flex;
    background-color: #D9D9D9;
    width: 659px;
    height: 39px;
    min-width: 659px;
    max-width: 659px;
    min-height: 39px;
    max-height: 39px;
    align-items: center;
    flex: 0 0 39px;
}

.template-cv2-contact {
    justify-content: center;
    align-items: center;
}

.template-cv2-profil,
.template-cv2-projets,
.template-cv2-haut,
.template-cv2-education,
.template-cv2-langue,
.template-cv2-competences,
.template-cv2-experiences,
.template-cv2-nom-prenom {
    font-size: calc(14px * var(--template-scale));
    font-family: "Roboto", sans-serif;
    font-weight: 400;
    gap: calc(10px * var(--template-gap-scale));
    width: 659px;
    min-width: 659px;
    max-width: 659px;
    flex-shrink: 0;
}

.template-cv2-haut {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 32px;
    text-align: center;
}

.template-cv2 h1,
.template-cv2 h2,
.template-cv2 h3,
.template-cv2 p {
    font-family: "Roboto", sans-serif;
    overflow-wrap: anywhere;
}

.template-cv2-nom-prenom {
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 730px;
    min-width: 730px;
    max-width: 730px;
}

.template-cv2-nom-prenom h1 {
    width: 100%;
    text-align: center;
}

.template-cv2-description {
    gap: calc(5px * var(--template-gap-scale));
    overflow: hidden;
}

.template-cv2 p {
    font-size: calc(14px * var(--template-scale));
    line-height: 1.25;
}

.template-cv2.template-light {
    gap: calc(36px * var(--template-gap-scale));
}

.template-cv2.template-light p {
    font-size: calc(15px * var(--template-scale));
    line-height: 1.35;
}

.template-cv2.template-dense {
    gap: calc(16px * var(--template-gap-scale));
}

.template-cv2.template-dense .template-cv2-haut {
    margin-top: calc(22px * var(--template-gap-scale));
}

.template-cv2.template-dense .template-cv2-carregris {
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    flex: 0 0 32px;
}

.template-cv2.template-dense h1 {
    font-size: calc(25px * var(--template-scale));
}

.template-cv2.template-dense h2 {
    font-size: calc(19px * var(--template-scale));
}

.template-cv2.template-dense p {
    font-size: calc(11px * var(--template-scale));
    line-height: 1.12;
}

.template-cv2.template-dense .template-cv2-description {
    gap: 3px;
}

/*--------------------------------------------------------------------------------------------------------------------------------*/

/* Scrollbar personnalisée */
.form-section::-webkit-scrollbar,
.preview-section::-webkit-scrollbar {
    width: 8px;
}

.form-section::-webkit-scrollbar-track,
.preview-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.form-section::-webkit-scrollbar-thumb,
.preview-section::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

.form-section::-webkit-scrollbar-thumb:hover,
.preview-section::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dark);
}

/* Responsive */
@media (max-width: 768px) {
    .preview-section {
        padding: 25px;
        font-size: 9pt;
    }

    .cv-contact {
        grid-template-columns: 1fr;
    }

    .cv-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .cv-header-content {
        width: 100%;
    }

    .cv-photo {
        width: 100px;
        height: 100px;
    }
}

/* Print Styles - Une seule page A4 centrée */
@media print {
    body {
        background: white;
        margin: 0;
        padding: 0;
    }

    .container {
        max-width: none;
        padding: 0;
        margin: 0;
    }

    .header,
    .form-section,
    .form-actions,
    .btn-add,
    .btn-remove,
    .btn-remove-photo,
    .main-content {
        display: none;
    }

    /* Afficher seulement la section preview, centrée */
    .preview-section {
        display: block !important;
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        box-shadow: none;
        padding: 40px;
        width: 210mm;
        height: 297mm;
        min-height: 297mm;
        max-height: 297mm;
        overflow: hidden;
        border-radius: 0;
        box-sizing: border-box;
        page-break-after: avoid;
        page-break-before: avoid;
        page-break-inside: avoid;
    }

    /* Forcer tout sur une seule page */
    * {
        page-break-after: avoid !important;
        page-break-before: avoid !important;
    }

    .cv-container {
        width: 100%;
        height: 100%;
    }

    .section-frame {
        page-break-inside: avoid;
    }
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dynamic-entry {
    animation: slideIn 0.3s ease;
}

/* Message feedback */
.message {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 6px;
    display: none;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.preview-section {
    width: auto;
    min-height: auto;
    max-height: none;
    padding: 20px;
    overflow: visible;
}

.preview-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 16px;
}

.data-toolbar {
    padding-top: 14px;
    border-top: 1px solid #e2e8f0;
}

.data-export-button {
    border: 1px solid #bfdbfe;
    cursor: pointer;
}

.preview-toolbar p {
    color: var(--text-light);
    font-weight: 600;
    margin-bottom: 4px;
}

.preview-toolbar h2 {
    color: var(--primary);
    margin-bottom: 4px;
}

.catalog-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

#cvPreview {
    width: 100%;
    height: 78vh;
    min-height: 720px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #f5f5f5;
}

/* Interface compacte professionnelle */
body {
    line-height: 1.35;
    background:
        var(--app-bg-radial),
        var(--app-bg-linear);
    color: #0f172a;
}

.container {
    max-width: 1760px;
    padding: 12px 16px;
}

.header {
    margin-bottom: 12px;
    padding: 9px 12px;
    border: 1px solid rgba(226, 232, 240, 0.82);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    backdrop-filter: blur(14px);
}

.header h1 {
    font-size: 1.18em;
    margin-bottom: 2px;
    color: #111827;
    letter-spacing: -0.035em;
}

.header p {
    font-size: 0.76em;
    color: #64748b;
}

.main-content {
    grid-template-columns: minmax(360px, 1fr) auto minmax(360px, 1fr);
    gap: 14px;
    margin-bottom: 0;
    align-items: stretch;
    min-height: calc(100vh - 88px);
}

.form-section,
.preview-section {
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.78);
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
    backdrop-filter: blur(16px);
}

.form-section {
    display: contents;
    padding: 16px;
    min-height: calc(100vh - 88px);
    max-height: none;
    overflow: visible;
}

#cvForm {
    display: grid;
    grid-column: 1 / -1;
    grid-row: 1;
    grid-template-columns: minmax(360px, 1fr) auto minmax(360px, 1fr);
    gap: 12px;
    align-content: start;
}

.form-group {
    margin-bottom: 0;
    padding: 12px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfcff 100%);
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.055);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.form-group:hover {
    border-color: #c7d2fe;
    box-shadow: 0 12px 26px rgba(79, 70, 229, 0.08);
}

.form-group:last-child {
    border-bottom: 1px solid #e6e8f0;
}

.form-group legend {
    font-size: 0.78em;
    margin-bottom: 8px;
    padding: 4px 9px;
    color: #4338ca;
    background: linear-gradient(135deg, #eef2ff, #f5f3ff);
    border: 1px solid #e0e7ff;
    border-radius: 999px;
    letter-spacing: 0.015em;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.08);
}

.form-row {
    gap: 8px;
    margin-bottom: 8px;
}

.form-row-full {
    margin-bottom: 8px;
}

label {
    margin-bottom: 4px;
    font-size: 0.78em;
    color: #475569;
    font-weight: 700;
    justify-content: flex-start;
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
    line-height: 1.15;
}

.char-count {
    font-size: 0.76em;
    display: block;
    line-height: 1.1;
    color: #64748b;
    font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
textarea,
select {
    padding: 8px 10px;
    border: 1px solid #dbe3ef;
    border-radius: 10px;
    font-size: 0.86em;
    background: #fff;
    color: #0f172a;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.035);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="tel"]::placeholder,
textarea::placeholder {
    color: #94a3b8;
}

textarea {
    min-height: 54px;
}

.photo-upload-area {
    min-height: 76px;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border-color: #dbeafe;
}

.photo-icon {
    font-size: 1.45em;
    margin-bottom: 2px;
}

.photo-upload-area p,
.photo-upload-area small {
    margin: 2px 0;
    font-size: 0.82em;
}

.photo-link {
    font-size: 0.82em;
}

.photo-preview img {
    max-width: 74px;
    max-height: 74px;
}

.dynamic-entry {
    padding: 10px;
    padding-top: 34px;
    margin-bottom: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    box-shadow: inset 3px 0 0 #c7d2fe;
}

.dynamic-entry .form-row {
    margin-bottom: 8px;
}

.btn-remove {
    top: 8px;
    right: 8px;
    padding: 4px 8px;
    font-size: 0.72em;
    border-radius: 999px;
}

.btn-add {
    padding: 7px 10px;
    margin-top: 4px;
    border-width: 1px;
    border-radius: 8px;
    font-size: 0.82em;
    color: #4338ca;
    background: #f8fafc;
    border-color: #c7d2fe;
    font-weight: 700;
}

.btn-add:hover {
    background: #eef2ff;
    border-color: #818cf8;
}

.form-actions {
    grid-column: 1 / -1;
    gap: 8px;
    margin-top: 0;
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.055);
}

.btn-primary,
.btn-secondary,
.btn-preview {
    padding: 9px 13px;
    border-radius: 10px;
    font-size: 0.86em;
    font-weight: 800;
    letter-spacing: -0.01em;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-preview:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
}

.colors-editor,
.titles-editor {
    display: grid;
    gap: 6px;
}

.titles-editor {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    max-width: 100%;
    overflow: hidden;
}

.colors-editor {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.color-grid {
    gap: 5px;
}

.color-row,
.color-row input[type="color"] {
    width: 28px;
    height: 28px;
}

.title-row {
    gap: 4px;
    padding: 4px;
    border-radius: 8px;
    min-width: 0;
    overflow: hidden;
}

.title-row label {
    gap: 1px;
    font-size: 0.78em;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    margin-bottom: 4px;
    color: #475569;
    font-weight: 700;
}

.title-row input {
    width: 100%;
    min-width: 0;
    padding: 6px 7px;
    font-size: 0.78em;
}

.title-count {
    display: block;
    font-size: 0.76em;
    color: #64748b;
    font-weight: 600;
}

.font-size-controls {
    gap: 8px;
    max-width: none;
}

.preview-section {
    padding: 14px;
    height: calc(100vh - 88px);
    width: min(100%, calc((100vh - 88px) * 0.707 + 24px));
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-self: center;
    grid-column: 2;
    grid-row: 1 / span 8;
    position: sticky;
    top: 12px;
    z-index: 2;
}

.preview-toolbar {
    width: 100%;
    margin-bottom: 10px;
    padding: 7px 9px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
}

.preview-toolbar p,
.preview-toolbar span {
    font-size: 0.68em;
    color: #64748b;
}

.preview-toolbar h2 {
    font-size: 0.84em;
    color: #111827;
    letter-spacing: -0.025em;
}

.preview-toolbar .catalog-actions {
    gap: 6px;
}

.preview-toolbar .btn-primary,
.preview-toolbar .btn-secondary {
    padding: 6px 8px;
    font-size: 0.72em;
}

#cvPreview {
    width: min(100%, calc((100vh - 152px) * 0.707));
    height: calc(100vh - 152px);
    aspect-ratio: 210 / 297;
    min-height: 0;
    flex: 0 0 auto;
    border: 1px solid #dbe3ef;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
}

@media (min-width: 1201px) {
    .form-group:nth-of-type(1) {
        grid-column: 1;
        grid-row: 1;
    }

    .form-group:nth-of-type(2) {
        grid-column: 1;
        grid-row: 2;
    }

    .form-group:nth-of-type(3) {
        grid-column: 1;
        grid-row: 3;
    }

    .form-group:nth-of-type(4) {
        grid-column: 3;
        grid-row: 1;
    }

    .form-group:nth-of-type(5) {
        grid-column: 3;
        grid-row: 2;
    }

    .form-group:nth-of-type(6) {
        grid-column: 3;
        grid-row: 3;
    }

    .form-group:nth-of-type(7) {
        grid-column: 1;
        grid-row: 4;
    }

    .form-group:nth-of-type(8) {
        grid-column: 3;
        grid-row: 4;
    }

    .form-group:nth-of-type(9) {
        grid-column: 1;
        grid-row: 5;
    }

    .form-group:nth-of-type(10) {
        grid-column: 3;
        grid-row: 5;
    }

    .form-actions {
        grid-column: 1 / -1;
        grid-row: 6;
    }

    .form-group:nth-of-type(1) {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px 12px;
    }

    .form-group:nth-of-type(1) legend {
        grid-column: 1 / -1;
    }

    .form-group:nth-of-type(1) .form-row-full:nth-of-type(1) {
        grid-column: 1;
        grid-row: auto;
    }

    .form-group:nth-of-type(1) .form-row-full:nth-of-type(2) {
        grid-column: 1;
        grid-row: auto;
    }

    .form-group:nth-of-type(1) .form-row-full:nth-of-type(3) {
        grid-column: 1;
        grid-row: auto;
    }

    .form-group:nth-of-type(1) .form-row-full:nth-of-type(4) {
        grid-column: 1;
        grid-row: auto;
    }

    .form-group:nth-of-type(1) .font-size-controls,
    .form-group:nth-of-type(1) #stylePoliceModele {
        width: 100%;
    }

    .form-group:nth-of-type(1) .font-size-controls {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
    }

    .form-group:nth-of-type(4) {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: repeat(8, auto);
        gap: 6px 8px;
    }

    .form-group:nth-of-type(4) legend {
        grid-column: 1 / -1;
    }

    .form-group:nth-of-type(4) .form-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-column: 1 / -1;
        gap: 8px;
        margin-bottom: 0;
    }

    .form-group:nth-of-type(4) .form-row-full {
        display: grid;
        gap: 4px;
        grid-column: 1 / -1;
        margin-bottom: 0;
    }

    .form-group:nth-of-type(4) .form-col {
        min-width: 0;
    }

    .form-group:nth-of-type(4) .form-row-full > input {
        width: 100%;
    }

    .form-group:nth-of-type(4) .personal-description {
        display: grid;
        grid-column: 1 / -1;
        grid-row: span 3;
        gap: 4px;
    }

    .form-group:nth-of-type(4) .personal-description label {
        display: flex;
    }

    .form-group:nth-of-type(4) .personal-description textarea {
        width: 100%;
        min-height: 118px;
    }

    .form-group:nth-of-type(3) .photo-upload-area {
        min-height: 92px;
        padding: 8px;
    }

    .form-group:nth-of-type(3) .photo-icon {
        font-size: 1.15em;
    }

    .form-group:nth-of-type(5),
    .form-group:nth-of-type(6),
    .form-group:nth-of-type(7),
    .form-group:nth-of-type(8),
    .form-group:nth-of-type(9),
    .form-group:nth-of-type(10) {
        min-width: 0;
        padding: 10px;
    }

    .form-group:nth-of-type(5) legend,
    .form-group:nth-of-type(6) legend,
    .form-group:nth-of-type(7) legend,
    .form-group:nth-of-type(8) legend,
    .form-group:nth-of-type(9) legend,
    .form-group:nth-of-type(10) legend {
        font-size: 0.74em;
        padding: 3px 6px;
    }
}

@media (max-width: 1200px) {
    #cvForm {
        grid-template-columns: 1fr;
    }

    .form-section {
        max-height: none;
    }
}

/* Finitions visuelles premium */
.form-section label,
.title-row label {
    color: #334155;
}

.title-row {
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.color-group {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.color-row {
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border: 0;
    color: #ffffff;
}

.btn-secondary {
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #334155;
}

.btn-preview {
    border: 1px solid #bfdbfe;
    background: linear-gradient(135deg, #eff6ff, #eef2ff);
    color: #1d4ed8;
}

.btn-remove {
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
}

.catalog-actions {
    gap: 8px;
}

.download-status {
    color: #64748b;
    font-weight: 700;
}

.download-blocked,
.btn-primary.download-blocked,
.btn-secondary.download-blocked {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    color: #ffffff;
    border-color: #dc2626;
    box-shadow: 0 10px 20px rgba(220, 38, 38, 0.22);
}

input[type="range"] {
    accent-color: #4f46e5;
}

select {
    cursor: pointer;
}

iframe#cvPreview {
    overflow: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

iframe#cvPreview::-webkit-scrollbar {
    display: none;
}

/* Aperçu direct, statique et entièrement visible */
.preview-section {
    height: calc(100vh - var(--desktop-toolbar-offset));
    width: min(var(--desktop-preview-width), 46vw);
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    backdrop-filter: none;
    /* overflow:visible : le clip CSS est basé sur le layout AVANT transform.
       Avec transform-origin:top left + marginLeft explicite depuis JS,
       l'iframe ne déborde jamais du layout box → overflow:visible est sans effet
       et évite le rognage parasites des bords du CV mis à l'échelle. */
    overflow: visible;
    position: sticky;
    top: 12px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* align-items:flex-start : l'iframe part du bord gauche de la section ;
       JS calcule marginLeft pour le centrage exact sans débordement. */
    align-items: flex-start;
}

.preview-toolbar {
    width: 100%;
    margin-bottom: 8px;
}

#cvPreview {
    width: var(--desktop-preview-width);
    height: var(--desktop-preview-height);
    min-height: 0;
    aspect-ratio: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: block;
    /* Base avant que JS calcule l'échelle exacte.
       transform-origin:top left correspond à la valeur que JS utilisera. */
    transform-origin: top left;
}

/* Layout final : bandes formulaire gauche/droite + aperçu central */
@media (min-width: 1201px) {
    :root {
        --app-column-offset: var(--desktop-column-offset);
        --app-column-height: var(--desktop-column-height);
        --top-card-width: min(100%, 360px);
    }

    .main-content {
        display: grid;
        grid-template-columns: minmax(380px, 1fr) auto minmax(380px, 1fr);
        align-items: start;
    }

    #cvForm {
        display: contents;
    }

    .preview-column {
        display: contents;
    }

    .preview-section {
        grid-column: 2;
        grid-row: 1;
        z-index: 3;
        width: 100%;
        max-width: var(--desktop-preview-width);
        justify-self: center;
        height: var(--app-column-height);
        min-height: 0;
        box-sizing: border-box;
        top: var(--app-column-offset);
    }

    .form-panel {
        display: grid;
        gap: 12px;
        align-content: start;
        font-size: 0.92rem;
        min-height: 0;
        max-height: none;
        height: var(--app-column-height);
        box-sizing: border-box;
        padding: 14px;
        border: 1px solid rgba(226, 232, 240, 0.92);
        border-radius: 20px;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(248, 250, 252, 0.9) 100%);
        box-shadow: 0 18px 42px rgba(15, 23, 42, 0.12);
        backdrop-filter: blur(16px);
    }

    .form-panel-left {
        grid-column: 1;
        grid-row: 1;
        overflow-y: auto;
        scrollbar-width: none;
        gap: 8px;
        padding: 12px;
    }

    .form-panel-left::-webkit-scrollbar {
        display: none;
    }

    .form-panel-right {
        grid-column: 3;
        grid-row: 1;
        overflow-y: auto;
        scrollbar-width: none;
    }

    .form-panel-right::-webkit-scrollbar {
        display: none;
    }

    .form-panel .form-group {
        width: 100%;
        min-width: 0;
        grid-column: 1 / -1;
    }

    .form-panel input,
    .form-panel textarea,
    .form-panel select,
    .form-panel button {
        font-size: 0.82em;
    }

    .form-panel label {
        font-size: 0.74em;
    }

    .form-panel legend {
        font-size: 0.74em;
    }

    .form-panel-left > .header {
        padding: 7px 10px;
        margin-bottom: 0;
    }

    .form-panel-left > .header h1 {
        font-size: 1.08em;
        margin-bottom: 1px;
    }

    .form-panel-left > .header p {
        font-size: 0.7em;
    }

    .form-panel-left > .form-group {
        padding: 10px;
    }

    .form-panel-left > .form-group legend {
        margin-bottom: 6px;
        padding: 3px 7px;
    }

    .form-panel-left .form-row,
    .form-panel-left .form-row-full {
        gap: 6px;
        margin-bottom: 6px;
    }

    .form-panel-left .colors-editor,
    .form-panel-left .titles-editor {
        gap: 6px;
    }

    .form-panel-left .color-group {
        gap: 4px;
    }

    .form-panel-left .title-row {
        gap: 4px;
    }

    .form-panel-left .font-size-controls {
        gap: 6px;
    }

    .form-panel-right > .form-group,
    .form-panel-left > .form-group {
        display: block;
        grid-column: auto;
        grid-row: auto;
        margin: 0;
    }

    .form-panel-left > .header,
    .preview-toolbar {
        width: var(--top-card-width);
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        margin: 0;
    }

    .form-panel-left > .header {
        justify-self: start;
    }

    .preview-toolbar {
        align-self: start;
    }

    .form-panel-right > .form-group .dynamic-entry,
    .form-panel-left > .form-group .dynamic-entry {
        width: 100%;
    }

    .form-panel .form-row {
        display: flex;
    }

    .form-panel .form-row-full {
        display: block;
    }

    .form-panel .personal-description {
        display: block;
    }

    .form-panel-right .form-group:first-child {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .form-panel-right .form-group:first-child legend {
        grid-column: 1 / -1;
    }

    .form-panel-right .form-group:first-child .form-row {
        display: contents;
    }

    .form-panel-right .form-group:first-child .form-row-full {
        display: grid;
        grid-column: auto;
        gap: 4px;
        margin-bottom: 0;
    }

    .form-panel-right .form-group:first-child .form-col {
        min-width: 0;
    }

    .form-panel-right .form-group:first-child .personal-description {
        display: grid;
        grid-column: 1;
        gap: 4px;
    }

    .form-panel-right .form-group:first-child .personal-description textarea {
        min-height: 116px;
    }

    .form-panel-right .form-group:first-child .personal-photo {
        display: grid;
        grid-column: 2;
        gap: 4px;
    }

    .form-panel-right .form-group:first-child .personal-photo .photo-upload-area {
        min-height: 116px;
        padding: 8px;
    }

    .form-panel-right .form-group:first-child .personal-photo .photo-icon {
        font-size: 1.15em;
    }

    .form-panel .titles-editor {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    #downloadCvStatus {
        grid-column: 3;
        grid-row: 1;
        align-self: end;
        z-index: 5;
    }
}

@media (min-width: 1201px) {
    .main-content {
        grid-template-columns: minmax(300px, 1fr) minmax(320px, min(46vw, var(--desktop-preview-width))) minmax(300px, 1fr);
        width: 100%;
        overflow: visible;
    }

    .preview-column {
        width: 100%;
        max-width: var(--desktop-preview-width);
    }

    .preview-section {
        width: 100%;
        max-width: var(--desktop-preview-width);
    }

    .preview-toolbar {
        min-width: 0;
    }

    #selectedCvPath {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100%;
    }

    .catalog-actions {
        flex-shrink: 0;
    }
}

@media (max-width: 1500px) and (min-width: 1201px) {
    .container {
        padding-inline: 10px;
    }

    .main-content {
        grid-template-columns: minmax(260px, 1fr) minmax(300px, 44vw) minmax(260px, 1fr);
        gap: 10px;
    }

    .form-panel {
        padding: 10px;
        border-radius: 16px;
    }

    .preview-toolbar {
        gap: 8px;
        padding: 8px;
    }

    .preview-toolbar h2 {
        font-size: 0.94em;
    }

    .btn-primary,
    .btn-secondary,
    .btn-preview {
        padding: 8px 10px;
        font-size: 0.8em;
    }
}

@media (max-width: 1200px) {
    :root {
        --mobile-ui-scale: clamp(0.78, calc(100vw / 430), 1);
    }

    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    body {
        font-size: calc(16px * var(--mobile-ui-scale));
        background:
            var(--app-bg-radial),
            var(--app-bg-linear);
        background-attachment: scroll;
    }

    .container {
        max-width: 100%;
        padding: calc(10px * var(--mobile-ui-scale));
        overflow-x: hidden;
    }

    .main-content {
        display: flex;
        flex-direction: column;
        min-height: auto;
        width: 100%;
        margin-inline: auto;
        overflow-x: hidden;
    }

    .form-section {
        display: block;
        min-height: auto;
        width: 100%;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        backdrop-filter: none;
        overflow-x: hidden;
    }

    #cvForm {
        display: grid;
        grid-template-columns: 1fr;
        gap: calc(12px * var(--mobile-ui-scale));
        width: 100%;
        justify-items: center;
        box-sizing: border-box;
    }

    .form-panel {
        display: grid;
        gap: calc(16px * var(--mobile-ui-scale));
        width: 100%;
        max-width: 100%;
        min-height: auto;
        max-height: none;
        overflow: hidden;
        padding: calc(12px * var(--mobile-ui-scale));
        border: 1px solid rgba(226, 232, 240, 0.92);
        border-radius: calc(18px * var(--mobile-ui-scale));
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 12px 30px rgba(15, 23, 42, 0.1);
        background-clip: padding-box;
        box-sizing: border-box;
    }

    .header,
    .form-group,
    .dynamic-entry,
    .photo-upload-area,
    .preview-toolbar,
    .btn-primary,
    .btn-secondary,
    .btn-preview,
    .btn-add,
    input,
    textarea,
    select {
        background-clip: padding-box;
    }

    .header,
    .form-group,
    .dynamic-entry,
    .photo-upload-area,
    .preview-toolbar {
        overflow: hidden;
        max-width: 100%;
        box-sizing: border-box;
    }

    .header {
        display: block;
        width: 100%;
        margin: 0;
        text-align: center;
        word-break: normal;
        overflow-wrap: anywhere;
    }

    .header h1,
    .header p,
    .preview-toolbar p,
    .preview-toolbar h2,
    .preview-toolbar span {
        max-width: 100%;
        overflow-wrap: anywhere;
        word-break: normal;
    }

    .form-group {
        width: 100%;
        margin: 0;
    }

    .preview-column {
        width: 100%;
        max-width: min(var(--desktop-preview-width), calc(100vw - (20px * var(--mobile-ui-scale))));
        margin: 0 auto calc(14px * var(--mobile-ui-scale));
        border-radius: calc(18px * var(--mobile-ui-scale));
        overflow: hidden;
    }

    .preview-section {
        position: static;
        width: 100%;
        max-width: var(--desktop-preview-width);
        height: auto;
        min-height: auto;
        margin: 0 auto;
        align-items: flex-start;
        overflow: hidden;
        border-radius: 0;
        background: transparent;
    }

    .preview-toolbar {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        max-width: 100%;
        padding: calc(9px * var(--mobile-ui-scale));
        gap: calc(8px * var(--mobile-ui-scale));
        overflow: hidden;
        background-clip: padding-box;
        box-sizing: border-box;
    }

    .catalog-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: calc(8px * var(--mobile-ui-scale));
        justify-content: stretch;
        width: 100%;
        min-width: 0;
    }

    .catalog-actions > * {
        min-width: 0;
        width: 100%;
        text-align: center;
        white-space: normal;
    }

    #cvPreview {
        width: var(--desktop-preview-width);
        max-width: none;
        height: var(--desktop-preview-height);
        aspect-ratio: auto;
        transform-origin: top left;
    }
}

@media (max-width: 768px) {
    .header {
        padding: calc(10px * var(--mobile-ui-scale));
        width: 100%;
        max-width: 100%;
    }

    .header h1 {
        font-size: clamp(1.05em, 5.2vw, 1.25em);
    }

    .header p {
        font-size: clamp(0.72em, 3.4vw, 0.9em);
    }

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

    .colors-editor,
    .titles-editor {
        grid-template-columns: 1fr;
    }

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

    .preview-section {
        max-width: 100%;
    }

    textarea[id="description"],
    textarea.exp-description,
    textarea.projet-description {
        min-height: 180px;
    }
}

label {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    width: 100%;
    flex-wrap: nowrap;
}

label > .char-count,
label > .title-count {
    margin-left: auto;
    text-align: right;
}

.char-count,
.title-count {
    display: inline;
    flex: 0 0 auto;
    white-space: nowrap;
}

.title-row label,
.form-section label {
    flex-direction: row;
    align-items: baseline;
}

.form-col,
.form-col-full,
.form-row-full,
.dynamic-entry .form-col,
.dynamic-entry .form-row-full {
    min-width: 0;
}

.form-row-full {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    width: 100%;
}

.form-col {
    width: 100%;
}

.form-row,
.dynamic-entry .form-row {
    align-items: end;
}

.form-col > input,
.form-col > select,
.form-col > textarea,
.form-row-full > input,
.form-row-full > select,
.form-row-full > textarea,
.dynamic-entry input,
.dynamic-entry select,
.dynamic-entry textarea {
    width: 100%;
}

input[type="date"] {
    display: block;
    width: 100%;
    min-width: 100%;
    box-sizing: border-box;
    min-height: 38px;
    height: 38px;
    line-height: 1.2;
    appearance: none;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
select {
    height: 38px;
}

.comp-niveau,
.langue-niveau {
    height: 38px;
}

.dynamic-entry .form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}

.dynamic-entry .form-col {
    display: grid;
    grid-template-rows: auto 38px;
    align-content: end;
}

.dynamic-entry {
    display: grid;
    gap: 10px;
    padding: 10px;
}

.dynamic-entry .form-row,
.dynamic-entry .form-row-full {
    margin-bottom: 0;
}

.dynamic-entry .btn-remove {
    justify-self: end;
    position: static;
    width: fit-content;
    margin: 0;
    transform: none;
}

.colors-editor {
    grid-template-columns: 1fr;
    align-items: start;
}

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

.color-group-title {
    display: block;
    width: 100%;
}

.color-grid {
    justify-content: flex-start;
}

.exp-logo,
input[type="file"] {
    width: 100%;
    max-width: 100%;
}

.photo-upload-area,
.photo-upload-content {
    width: 100%;
}

@media (max-width: 768px) {
    .form-group {
        padding: 12px;
    }

    .form-row,
    .dynamic-entry .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    label {
        flex-direction: row;
        align-items: baseline;
    }

    .dynamic-entry {
        padding: 10px;
    }

    .dynamic-entry .btn-remove {
        width: 100%;
        justify-self: stretch;
        text-align: center;
    }
}

@media (max-width: 380px) {
    .catalog-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #cvForm,
    .form-panel,
    .form-panel-left,
    .form-panel-right,
    .colors-editor,
    .titles-editor {
        gap: 14px;
    }

    .header,
    .preview-toolbar,
    .form-group,
    .dynamic-entry,
    .photo-upload-area {
        width: 100%;
        max-width: 100%;
        margin-inline: 0;
        box-sizing: border-box;
    }

    .header,
    .preview-toolbar {
        padding: 12px;
    }

    .header h1,
    .header p,
    .preview-toolbar p,
    .preview-toolbar h2,
    .preview-toolbar span {
        display: block;
        width: 100%;
        min-width: 0;
        line-height: 1.25;
    }

    .preview-toolbar > div {
        width: 100%;
        min-width: 0;
    }

    .catalog-actions {
        margin-top: 4px;
    }

    .form-panel-left,
    .form-panel-right,
    .form-panel-left > .header,
    .form-panel-right > .preview-toolbar,
    .form-panel-left > .form-group,
    .form-panel-right > .form-group {
        border-radius: 0;
    }
}

.form-panel-left,
.form-panel-right,
.form-panel-left > .header,
.form-panel-right > .preview-toolbar,
.form-panel-left > .form-group,
.form-panel-right > .form-group {
    border-radius: 0;
}

@media (max-width: 1200px) {
    .preview-column {
        background: #eef2ff;
    }
}

@media (max-width: 768px) {
    body {
        margin: 0;
    }

    .container {
        padding-top: 0;
        padding-bottom: 0;
    }

    #cvForm,
    .form-panel-left,
    .form-panel-right {
        gap: 0;
    }

    .form-panel {
        gap: 10px;
    }

    .preview-column {
        margin: 0 auto;
    }

    .form-panel-left {
        padding-top: 0;
    }

    .form-panel-right {
        padding-bottom: 0;
    }

    .form-panel-left > .header {
        margin-top: 0;
    }

    .form-panel-right > .form-group:last-of-type {
        margin-bottom: 0;
    }

    .form-panel-left > .header {
        box-shadow: none;
        text-shadow: none;
    }

    .form-panel-left > .header h1,
    .form-panel-left > .header p {
        text-shadow: none;
    }

    .form-panel-left > .form-group,
    .form-panel-right > .form-group,
    .dynamic-entry,
    .title-row,
    .color-group,
    .form-row-full,
    .form-row,
    .form-col {
        background: #ffffff;
    }

    .form-panel-left > .form-group legend,
    .form-panel-right > .form-group legend {
        background: #ffffff;
        border-color: #e2e8f0;
    }
}

.payment-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.payment-modal.is-visible {
    display: flex;
}

.payment-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(8px);
}

.payment-modal__panel {
    position: relative;
    width: min(440px, 100%);
    padding: 28px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
}

.payment-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    background: #f1f5f9;
    color: #334155;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
}

.payment-modal__eyebrow {
    margin-bottom: 8px;
    color: #4f46e5;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.payment-modal__panel h2 {
    margin-bottom: 10px;
    color: #0f172a;
    font-size: 24px;
    line-height: 1.15;
}

.payment-modal__text {
    margin-bottom: 20px;
    color: #64748b;
}

.payment-modal__actions {
    display: grid;
    gap: 12px;
}

.payment-button {
    width: 100%;
    border: 0;
    padding: 14px 16px;
    color: #ffffff;
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.payment-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}

.payment-button:disabled {
    cursor: wait;
    opacity: 0.68;
    transform: none;
}

.payment-button--stripe {
    background: linear-gradient(135deg, #635bff, #7c3aed);
}

.payment-button--paypal {
    background: linear-gradient(135deg, #003087, #009cde);
}

.payment-modal__status {
    min-height: 20px;
    margin-top: 14px;
    color: #475569;
    font-size: 13px;
}

.no-account-section {
    width: min(1200px, calc(100% - 32px));
    margin: 28px auto;
    padding: 28px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.no-account-header {
    max-width: 760px;
    margin: 0 auto 22px;
    text-align: center;
}

.no-account-header h2 {
    margin-bottom: 8px;
    color: #0f172a;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.1;
}

.no-account-header p:last-child {
    color: #64748b;
}

.no-account-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.no-account-grid article {
    padding: 18px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
}

.no-account-grid h3 {
    margin-bottom: 8px;
    color: #0f172a;
    font-size: 16px;
}

.no-account-grid p {
    color: #64748b;
    font-size: 14px;
}

.templates-gallery-section {
    width: min(1500px, calc(100% - 32px));
    margin: 28px auto;
    padding: 28px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.templates-gallery-header {
    margin-bottom: 22px;
    text-align: center;
}

.templates-gallery-kicker {
    margin-bottom: 6px;
    color: #4f46e5;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.templates-gallery-header h2 {
    margin-bottom: 8px;
    color: #0f172a;
    font-size: clamp(24px, 3vw, 36px);
    line-height: 1.1;
}

.templates-gallery-header p:last-child {
    color: #64748b;
}

.templates-gallery {
    display: grid;
    gap: 30px;
}

.templates-gallery-group {
    display: grid;
    gap: 16px;
}

.templates-gallery-group-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e2e8f0;
}

.templates-gallery-group-heading h3 {
    margin: 0;
    color: #0f172a;
    font-size: 22px;
}

.templates-gallery-group-heading span {
    color: #64748b;
    font-size: 13px;
    font-weight: 700;
}

.templates-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.template-preview-card {
    display: block;
    width: 100%;
    padding: 12px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.template-preview-card:hover,
.template-preview-card:focus-visible {
    border-color: #4f46e5;
    box-shadow: 0 14px 34px rgba(79, 70, 229, 0.18);
    transform: translateY(-3px);
    outline: none;
}

.template-preview-title {
    display: block;
    margin-bottom: 10px;
    color: #0f172a;
    font-size: 14px;
    font-weight: 800;
}

.template-preview-category {
    display: inline-flex;
    margin-bottom: 8px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4f46e5;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.template-preview-frame-wrap {
    display: block;
    position: relative;
    height: 310px;
    overflow: hidden;
    background: #e5e7eb;
    border: 1px solid #cbd5e1;
}

.template-preview-frame {
    width: var(--template-source-width, 794px);
    height: var(--template-source-height, 1123px);
    border: 0;
    position: absolute;
    top: 0;
    left: max(0px, calc((100% - (var(--template-source-width, 794px) * var(--template-preview-scale))) / 2));
    pointer-events: none;
    transform: scale(var(--template-preview-scale));
    transform-origin: top left;
}

.template-preview-card--diapo .template-preview-frame-wrap,
.template-preview-card--reseauSocial .template-preview-frame-wrap,
.template-preview-card--maquette .template-preview-frame-wrap,
.template-preview-card--portfolio .template-preview-frame-wrap,
.template-preview-card--schema .template-preview-frame-wrap {
    height: 310px;
    overflow: hidden;
    scrollbar-width: none;
}

.template-preview-card--diapo .template-preview-frame-wrap::-webkit-scrollbar,
.template-preview-card--reseauSocial .template-preview-frame-wrap::-webkit-scrollbar,
.template-preview-card--maquette .template-preview-frame-wrap::-webkit-scrollbar,
.template-preview-card--portfolio .template-preview-frame-wrap::-webkit-scrollbar,
.template-preview-card--schema .template-preview-frame-wrap::-webkit-scrollbar {
    display: none;
}

@media (max-width: 768px) {
    .products-hero {
        width: 100%;
        margin: 0;
        padding: 22px 14px;
        grid-template-columns: 1fr;
        border-radius: 0 0 28px 28px;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .product-card {
        min-height: auto;
        padding: 16px;
    }

    .no-account-section {
        width: 100%;
        margin: 10px 0;
        padding: 18px 12px;
        border-left: 0;
        border-right: 0;
    }

    .no-account-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .templates-gallery-section {
        width: 100%;
        margin: 10px 0 0;
        padding: 18px 12px;
        border-left: 0;
        border-right: 0;
    }

    .templates-gallery {
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
        gap: 12px;
    }

    .template-preview-frame-wrap {
        height: 240px;
    }
}
