/* ==========================================================================
   CV STUDIO - STYLES PRINCIPAUX & MOTEUR DE RENDU A4 SANS PHOTO
   ========================================================================== */

:root {
  /* Thème du Studio (Mode sombre moderne & ergonomique) */
  --app-bg: #0b0f19;
  --app-surface: #131b2e;
  --app-surface-hover: #1c2640;
  --app-card: #182238;
  --app-border: #23324d;
  --app-border-focus: #3b82f6;
  --app-text: #f1f5f9;
  --app-text-muted: #94a3b8;
  --app-primary: #3b82f6;
  --app-primary-hover: #2563eb;
  --app-accent: #06b6d4;
  --app-danger: #ef4444;
  --app-success: #10b981;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.45);

  /* Variables dynamiques du CV (A4) */
  --cv-primary: #1e3a8a;
  --cv-primary-light: rgba(30, 58, 138, 0.08);
  --cv-secondary: #475569;
  --cv-text: #1e293b;
  --cv-text-light: #64748b;
  --cv-bg: #ffffff;
  --cv-font: 'Inter', sans-serif;
  --cv-heading-font: 'Inter', sans-serif;
  --cv-spacing-scale: 1;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--app-bg);
  color: var(--app-text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars personnalisées */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--app-surface);
}
::-webkit-scrollbar-thumb {
  background: var(--app-border);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3b4d6e;
}

/* ==========================================================================
   Header de l'application
   ========================================================================== */
.app-header {
  height: 64px;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 50;
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Bouton Retour au site */
.btn-back-home {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  color: var(--app-text);
  font-size: 0.8rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-back-home:hover {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(96, 165, 250, 0.4);
  color: #60a5fa;
  transform: translateX(-2px);
}

.btn-back-home svg {
  transition: transform 0.2s ease;
}

.btn-back-home:hover svg {
  transform: translateX(-2px);
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--app-border);
  margin: 0 4px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #2563eb, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.brand-text h1 {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-text h1 span {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid rgba(96, 165, 250, 0.25);
  letter-spacing: 0.05em;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--app-text-muted);
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ==========================================================================
   Boutons & Composants d'actions
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  outline: none;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
  font-weight: 600;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--app-card);
  color: var(--app-text);
  border-color: var(--app-border);
}
.btn-secondary:hover {
  background: var(--app-surface-hover);
  border-color: #3b4d6e;
}

.btn-ghost {
  background: transparent;
  color: var(--app-text-muted);
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--app-text);
}

.btn-dashed {
  background: transparent;
  border: 1px dashed var(--app-border);
  color: #60a5fa;
  padding: 10px;
}
.btn-dashed:hover {
  border-color: #60a5fa;
  background: rgba(59, 130, 246, 0.08);
}

.btn-icon {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--app-card);
  border: 1px solid var(--app-border);
  color: var(--app-text);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-icon:hover {
  background: var(--app-surface-hover);
  color: #ffffff;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.78rem;
  border-radius: 4px;
}

.w-100 { width: 100%; }
.w-auto { width: auto; }
.mb-3 { margin-bottom: 12px; }
.mt-3 { margin-top: 12px; }

/* Dropdown */
.dropdown-container {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: 6px;
  min-width: 220px;
  display: none;
  z-index: 100;
  flex-direction: column;
}
.dropdown-menu.show {
  display: flex;
  animation: fadeIn 0.15s ease;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 0.83rem;
  color: var(--app-text);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s;
}
.dropdown-item:hover {
  background: var(--app-surface-hover);
  color: #60a5fa;
}

/* ==========================================================================
   Layout Principal (Split Screen)
   ========================================================================== */
.app-layout {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Panneau Gauche : Éditeur
   -------------------------------------------------------------------------- */
.editor-panel {
  width: 520px;
  min-width: 440px;
  max-width: 600px;
  background: var(--app-surface);
  border-right: 1px solid var(--app-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100%;
}

.editor-nav {
  display: flex;
  background: var(--app-bg);
  padding: 6px;
  border-bottom: 1px solid var(--app-border);
  gap: 6px;
}

.nav-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--app-text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.nav-tab:hover {
  color: var(--app-text);
}
.nav-tab.active {
  background: var(--app-card);
  color: #60a5fa;
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.tab-contents {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
}

/* Cartes de configuration */
.config-card {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 20px;
}

.config-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--app-text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.config-desc {
  font-size: 0.78rem;
  color: var(--app-text-muted);
  margin-bottom: 14px;
}

/* Sélecteur de Templates */
.template-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.template-card {
  background: var(--app-surface);
  border: 2px solid var(--app-border);
  border-radius: var(--radius-sm);
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.template-card:hover {
  border-color: #3b82f6;
  transform: translateY(-2px);
}
.template-card.active {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  box-shadow: 0 0 0 1px #3b82f6;
}

.template-thumb {
  height: 80px;
  background: #ffffff;
  border-radius: 4px;
  padding: 6px;
  overflow: hidden;
  position: relative;
  display: flex;
  gap: 4px;
}

.thumb-line {
  height: 4px;
  background: #cbd5e1;
  border-radius: 2px;
  margin-bottom: 4px;
}
.thumb-line.w-100 { width: 100%; }
.thumb-line.w-90 { width: 90%; }
.thumb-line.w-85 { width: 85%; }
.thumb-line.w-80 { width: 80%; }
.thumb-line.w-75 { width: 75%; }
.thumb-line.w-70 { width: 70%; }
.thumb-line.w-60 { width: 60%; }
.thumb-line.w-50 { width: 50%; }
.thumb-line.w-40 { width: 40%; }
.thumb-line.center { margin-left: auto; margin-right: auto; }

/* Thumbs spécifiques */
.thumb-modern {
  display: flex;
}
.thumb-modern .thumb-col-left {
  width: 32%;
  background: #e2e8f0;
  border-radius: 2px;
}
.thumb-modern .thumb-col-right {
  width: 68%;
  display: flex;
  flex-direction: column;
  padding-left: 2px;
}

.thumb-ats {
  display: flex;
  flex-direction: column;
}
.thumb-ats .thumb-header {
  height: 8px;
  background: #1e3a8a;
  border-radius: 2px;
  margin-bottom: 4px;
}
.thumb-ats .thumb-divider {
  height: 1px;
  background: #94a3b8;
  margin-bottom: 5px;
}

.thumb-executive {
  display: flex;
  flex-direction: column;
}
.thumb-executive .thumb-topbar {
  height: 5px;
  background: #1e293b;
  margin-bottom: 6px;
}
.thumb-executive .thumb-split {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.thumb-tech {
  display: flex;
  flex-direction: column;
}
.thumb-tech .thumb-header-tech {
  height: 6px;
  width: 50%;
  background: #0284c7;
  margin-bottom: 4px;
}
.thumb-tech .thumb-tags {
  display: flex;
  gap: 2px;
  margin-bottom: 6px;
}
.thumb-tech .thumb-tags .tag {
  height: 5px;
  width: 14px;
  background: #bae6fd;
  border-radius: 2px;
}

.thumb-nordic {
  display: flex;
  flex-direction: column;
}
.thumb-nordic .thumb-sidebar-right {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 25%;
  height: calc(100% - 12px);
  background: #f1f5f9;
  border-radius: 2px;
}

/* Thumbs pour les 10 modèles Comptabilité & Finance */
.thumb-acct-general,
.thumb-accounting {
  display: flex;
  flex-direction: column;
}
.thumb-acct-general .thumb-accounting-banner,
.thumb-accounting .thumb-accounting-banner {
  height: 6px;
  background: #0f2e59;
  border-radius: 2px;
  margin-bottom: 4px;
}
.thumb-accounting-grid {
  display: flex;
  justify-content: space-between;
  gap: 3px;
  margin: 2px 0;
}

.thumb-acct-cabinet {
  display: flex;
  flex-direction: column;
}
.thumb-acct-cabinet .thumb-topbar {
  height: 5px;
  background: #065f46;
  margin-bottom: 4px;
}
.thumb-acct-cabinet .thumb-split {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

.thumb-acct-audit,
.thumb-audit {
  display: flex;
  position: relative;
}
.thumb-acct-audit .thumb-audit-leftbar,
.thumb-audit .thumb-audit-leftbar {
  width: 4px;
  height: 100%;
  background: #0e7490;
  border-radius: 2px;
  margin-right: 4px;
}
.thumb-acct-audit .thumb-audit-main,
.thumb-audit .thumb-audit-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.thumb-acct-fiscal {
  display: flex;
  flex-direction: column;
}

.thumb-acct-gestion {
  display: flex;
  flex-direction: column;
}

.thumb-acct-paie {
  display: flex;
  flex-direction: column;
}

.thumb-acct-tresorerie {
  display: flex;
  flex-direction: column;
}

.thumb-acct-ifrs {
  display: flex;
}

.thumb-acct-analytique {
  display: flex;
  flex-direction: column;
}

.thumb-acct-direction {
  display: flex;
  flex-direction: column;
}

.template-card-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.template-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--app-text);
}
.template-badge {
  font-size: 0.65rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 10px;
  color: var(--app-text-muted);
}
.template-card.active .template-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

/* Palette de couleurs */
.color-palette-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.color-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  outline: none;
}
.color-dot:hover {
  transform: scale(1.15);
}
.color-dot.active {
  box-shadow: 0 0 0 2px var(--app-surface), 0 0 0 4px #3b82f6;
  transform: scale(1.1);
}

/* Formulaires & Champs */
.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.flex-1 {
  flex: 1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.form-group label {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--app-text-muted);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  background: var(--app-bg);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  color: var(--app-text);
  padding: 8px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  border-color: var(--app-border-focus);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-textarea {
  resize: vertical;
  min-height: 75px;
  line-height: 1.4;
}

/* Zone d'upload de photo de profil */
.photo-upload-zone {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--app-surface);
  border: 1px dashed var(--app-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 14px;
  transition: border-color 0.2s;
}
.photo-upload-zone:hover {
  border-color: #3b82f6;
}

.photo-preview-wrapper {
  flex-shrink: 0;
}

.photo-preview-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--app-bg);
  border: 2px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.photo-placeholder-icon {
  color: var(--app-text-muted);
}

.photo-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.photo-controls-wrapper {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.photo-buttons-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.photo-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--app-text);
  cursor: pointer;
  user-select: none;
}
.photo-toggle-label input[type="checkbox"] {
  accent-color: #3b82f6;
  cursor: pointer;
}

.photo-format-hint {
  font-size: 0.68rem;
  color: var(--app-text-muted);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.76rem;
  height: 30px;
}

.text-danger {
  color: #f87171 !important;
}
.text-danger:hover {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
}

/* Accordions */
.accordion-item {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.accordion-item:hover {
  border-color: #334466;
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: transparent;
  border: none;
  color: var(--app-text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.acc-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--app-text);
}
.acc-title svg {
  color: #60a5fa;
}

.badge-count {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 12px;
  color: var(--app-text-muted);
  margin-left: auto;
  margin-right: 12px;
}

.chevron {
  transition: transform 0.25s ease;
  color: var(--app-text-muted);
}
.accordion-item.open .chevron {
  transform: rotate(180deg);
}

.accordion-body {
  display: none;
  padding: 0 16px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}
.accordion-item.open .accordion-body {
  display: block;
}

/* Cartes d'éléments répétables (Expériences, Formations) */
.dynamic-item-card {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  position: relative;
}

.dynamic-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dynamic-item-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: #93c5fd;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dynamic-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-action-sm {
  background: var(--app-card);
  border: 1px solid var(--app-border);
  color: var(--app-text-muted);
  cursor: pointer;
  width: 26px;
  height: 26px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}
.btn-action-sm:hover:not(:disabled) {
  background: var(--app-surface-hover);
  color: #ffffff;
  border-color: #3b82f6;
}
.btn-action-sm:disabled {
  opacity: 0.25;
  cursor: not-allowed;
  border-color: transparent;
}

.btn-remove-item {
  color: #f87171;
}
.btn-remove-item:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
}

/* Gestionnaire d'ordre des sections */
.section-order-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.section-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: border-color 0.2s;
}
.section-order-item:hover {
  border-color: #3b4d6e;
}

.section-order-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--app-text);
}
.section-order-num {
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 7px;
  border-radius: 10px;
  color: #93c5fd;
  font-variant-numeric: tabular-nums;
}

.section-order-btns {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Boutons d'ordonnancement dans l'accordéon header */
.acc-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 8px;
}
.acc-reorder-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--app-border);
  color: var(--app-text-muted);
  cursor: pointer;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
}
.acc-reorder-btn:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border-color: #3b82f6;
}
.acc-reorder-btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

/* Sélecteur de format Langue dans l'éditeur */
.lang-format-toggle {
  display: flex;
  gap: 4px;
  background: var(--app-bg);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--app-border);
  margin-bottom: 8px;
}
.lang-format-btn {
  flex: 1;
  font-size: 0.74rem;
  padding: 4px 8px;
  background: transparent;
  border: none;
  border-radius: 3px;
  color: var(--app-text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.lang-format-btn.active {
  background: var(--app-card);
  color: #60a5fa;
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}
.slider-group input[type="range"] {
  flex: 1;
  accent-color: #3b82f6;
  cursor: pointer;
}
.slider-val-badge {
  font-size: 0.8rem;
  font-weight: 600;
  color: #93c5fd;
  min-width: 40px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Compétences */
.skill-input-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.skills-suggestions-box {
  background: rgba(15, 23, 42, 0.45);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
}

.skills-suggestions-title {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: #94a3b8;
  margin-bottom: 8px;
}

.skills-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.quick-chip-btn {
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  color: #cbd5e1;
  font-size: 0.72rem;
  padding: 4px 9px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
}

.quick-chip-btn:hover {
  background: rgba(6, 95, 70, 0.25);
  border-color: #10b981;
  color: #34d399;
  transform: translateY(-1px);
}

.skills-tags-wrapper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--app-text);
}
.skill-tag-pill[data-cat="tech"] {
  border-left: 3px solid #3b82f6;
}
.skill-tag-pill[data-cat="tools"] {
  border-left: 3px solid #10b981;
}
.skill-tag-pill[data-cat="soft"] {
  border-left: 3px solid #f59e0b;
}

.pill-category-badge {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.skill-tag-pill .btn-del-tag {
  background: transparent;
  border: none;
  color: var(--app-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 13px;
  line-height: 1;
}
.skill-tag-pill .btn-del-tag:hover {
  color: var(--app-danger);
}

.sub-section-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #93c5fd;
  margin-bottom: 8px;
  margin-top: 4px;
}

/* --------------------------------------------------------------------------
   Panneau Droit : Prévisualisation A4 en Direct
   -------------------------------------------------------------------------- */
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #060913;
  position: relative;
  overflow: hidden;
}

.preview-toolbar {
  height: 48px;
  background: rgba(19, 27, 46, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 20;
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--app-text-muted);
}
.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.preview-template-tag {
  font-size: 0.74rem;
  background: var(--app-card);
  border: 1px solid var(--app-border);
  padding: 2px 10px;
  border-radius: 12px;
  color: #60a5fa;
  font-weight: 500;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.zoom-text {
  font-size: 0.78rem;
  color: var(--app-text-muted);
  width: 42px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.preview-scroll-area {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 30px 20px 60px;
  background: radial-gradient(circle at center, #111828 0%, #060913 100%);
}

/* Conteneur de mise à l'échelle A4 */
.a4-sheet-wrapper {
  transform-origin: top center;
  transition: transform 0.15s ease-out;
  padding-bottom: 40px;
}

/* ==========================================================================
   FEUILLE DE PAPIER A4 (210mm x 297mm)
   ========================================================================== */
.cv-page {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff;
  color: var(--cv-text);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45), 0 2px 10px rgba(0, 0, 0, 0.2);
  font-family: var(--cv-font);
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
}

/* Echelles d'espacement & densité */
.cv-page.density-compact {
  --cv-spacing-scale: 0.85;
  font-size: 12px;
}
.cv-page.density-normal {
  --cv-spacing-scale: 1;
  font-size: 13.5px;
}
.cv-page.density-spacious {
  --cv-spacing-scale: 1.15;
  font-size: 14.5px;
}

/* ==========================================================================
   MODÈLES DE CV (TEMPLATES AVEC OU SANS PHOTO)
   ========================================================================== */

/* Styles pour la photo de profil (Avatar optionnel) */
.tpl-avatar-container {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}

.tpl-avatar-modern,
.tpl-avatar-executive,
.tpl-avatar-tech,
.tpl-avatar-nordic,
.tpl-avatar-ats,
.tpl-avatar-accounting {
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  transform: translateZ(0);
  object-fit: cover;
  object-position: center 20%;
  position: relative;
  z-index: 2;
}

.tpl-avatar-modern {
  width: calc(88px * var(--cv-spacing-scale));
  height: calc(88px * var(--cv-spacing-scale));
  border-radius: 50%;
  border: 3px solid #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  margin-bottom: calc(14px * var(--cv-spacing-scale));
  margin-left: auto;
  margin-right: auto;
  display: block;
}

.tpl-avatar-executive {
  width: calc(72px * var(--cv-spacing-scale));
  height: calc(72px * var(--cv-spacing-scale));
  border-radius: 50%;
  border: 2.5px solid var(--cv-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  margin-right: calc(14px * var(--cv-spacing-scale));
}

.tpl-avatar-tech {
  width: calc(64px * var(--cv-spacing-scale));
  height: calc(64px * var(--cv-spacing-scale));
  border-radius: 8px;
  border: 2px solid var(--cv-primary);
  margin-right: calc(12px * var(--cv-spacing-scale));
}

.tpl-avatar-nordic {
  width: calc(78px * var(--cv-spacing-scale));
  height: calc(78px * var(--cv-spacing-scale));
  border-radius: 50%;
  border: 2.5px solid #cbd5e1;
  margin-bottom: calc(14px * var(--cv-spacing-scale));
  display: block;
}

.tpl-avatar-ats {
  width: calc(65px * var(--cv-spacing-scale));
  height: calc(65px * var(--cv-spacing-scale));
  border-radius: 4px;
  border: 1.5px solid #cbd5e1;
  margin-right: calc(14px * var(--cv-spacing-scale));
}

.tpl-avatar-accounting {
  width: calc(72px * var(--cv-spacing-scale));
  height: calc(72px * var(--cv-spacing-scale));
  border-radius: 50%;
  border: 2.5px solid var(--cv-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  margin-right: calc(14px * var(--cv-spacing-scale));
}

/* --------------------------------------------------------------------------
   MODÈLE 1 : MODERNE ÉPURÉ (2 Colonnes avec Sidebar Latérale Teintée)
   -------------------------------------------------------------------------- */
.tpl-modern {
  display: flex;
  min-height: 297mm;
}

.tpl-modern-sidebar {
  width: 33%;
  background: #f8fafc;
  border-right: 1px solid #e2e8f0;
  padding: calc(26px * var(--cv-spacing-scale)) calc(20px * var(--cv-spacing-scale));
  display: flex;
  flex-direction: column;
  gap: calc(20px * var(--cv-spacing-scale));
}

.tpl-modern-main {
  width: 67%;
  padding: calc(28px * var(--cv-spacing-scale)) calc(28px * var(--cv-spacing-scale));
  display: flex;
  flex-direction: column;
  gap: calc(22px * var(--cv-spacing-scale));
}

/* Header Moderne */
.tpl-modern-header {
  border-bottom: 2px solid var(--cv-primary-light);
  padding-bottom: calc(16px * var(--cv-spacing-scale));
}

.tpl-modern-name {
  font-family: var(--cv-heading-font);
  font-size: calc(26px * var(--cv-spacing-scale));
  font-weight: 800;
  color: var(--cv-primary);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.tpl-modern-title {
  font-size: calc(14px * var(--cv-spacing-scale));
  font-weight: 600;
  color: var(--cv-text-light);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Contact Sidebar */
.tpl-contact-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: calc(10px * var(--cv-spacing-scale));
}

.tpl-contact-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: calc(11.5px * var(--cv-spacing-scale));
  color: var(--cv-text);
  word-break: break-word;
}
.tpl-contact-item svg {
  color: var(--cv-primary);
  flex-shrink: 0;
}

/* Titres de section */
.tpl-section-title {
  font-family: var(--cv-heading-font);
  font-size: calc(13.5px * var(--cv-spacing-scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cv-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: calc(12px * var(--cv-spacing-scale));
  position: relative;
}

.tpl-modern-sidebar .tpl-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #cbd5e1;
}

.tpl-modern-main .tpl-section-title {
  border-bottom: 1.5px solid var(--cv-primary);
  padding-bottom: 4px;
}

/* Items d'expérience & Formation */
.tpl-timeline-item {
  position: relative;
  padding-left: calc(14px * var(--cv-spacing-scale));
  border-left: 2px solid #e2e8f0;
  margin-bottom: calc(16px * var(--cv-spacing-scale));
}
.tpl-timeline-item:last-child {
  margin-bottom: 0;
}
.tpl-timeline-item::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 4px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cv-primary);
}

.tpl-item-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  margin-bottom: 2px;
}

.tpl-item-role {
  font-size: calc(13px * var(--cv-spacing-scale));
  font-weight: 700;
  color: var(--cv-text);
}

.tpl-item-period {
  font-size: calc(11px * var(--cv-spacing-scale));
  color: var(--cv-text-light);
  font-weight: 500;
}

.tpl-item-sub {
  font-size: calc(12px * var(--cv-spacing-scale));
  font-weight: 600;
  color: var(--cv-primary);
  margin-bottom: 4px;
}

.tpl-item-desc {
  font-size: calc(12px * var(--cv-spacing-scale));
  color: #334155;
  line-height: 1.5;
  white-space: pre-line;
}

/* Listes de compétences structurées (Affichage sous forme de liste propre à puces) */
.tpl-skills-subgroup {
  margin-bottom: calc(10px * var(--cv-spacing-scale));
}
.tpl-skills-subgroup:last-child {
  margin-bottom: 0;
}
.tpl-skills-subtitle {
  font-family: var(--cv-heading-font);
  font-size: calc(10.5px * var(--cv-spacing-scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--cv-primary);
  margin-bottom: calc(4px * var(--cv-spacing-scale));
  padding-bottom: 2px;
  border-bottom: 1px dashed rgba(203, 213, 225, 0.7);
}

.tpl-skills-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: calc(5px * var(--cv-spacing-scale));
}
.tpl-skills-list li {
  font-size: calc(11.5px * var(--cv-spacing-scale));
  color: #1e293b;
  line-height: 1.4;
  position: relative;
  padding-left: 14px;
}
.tpl-skills-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--cv-primary);
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
}

.tpl-skills-list-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(5px * var(--cv-spacing-scale)) calc(18px * var(--cv-spacing-scale));
}
.tpl-skills-list-grid li {
  font-size: calc(11.5px * var(--cv-spacing-scale));
  color: #1e293b;
  line-height: 1.4;
  position: relative;
  padding-left: 14px;
}
.tpl-skills-list-grid li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--cv-primary);
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
}

.tpl-skills-list-grid-3col {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: calc(4px * var(--cv-spacing-scale)) calc(14px * var(--cv-spacing-scale));
}
.tpl-skills-list-grid-3col li {
  font-size: calc(11px * var(--cv-spacing-scale));
  color: #1e293b;
  line-height: 1.35;
  position: relative;
  padding-left: 12px;
}
.tpl-skills-list-grid-3col li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--cv-primary);
  font-weight: 800;
  font-size: 13px;
  line-height: 1;
}

/* Anciens tags (conservés pour rétrocompatibilité) */
.tpl-skill-pill {
  display: inline-block;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: calc(11px * var(--cv-spacing-scale));
  color: #334155;
  font-weight: 500;
  margin: 0 4px 6px 0;
}

.tpl-lang-item {
  display: flex;
  justify-content: space-between;
  font-size: calc(12px * var(--cv-spacing-scale));
  padding-bottom: 4px;
  border-bottom: 1px dashed #e2e8f0;
  margin-bottom: 6px;
}
/* Langues (Affichage compact sans étirement) */
.tpl-languages-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: flex-start;
}

.tpl-lang-item {
  display: flex;
  justify-content: space-between;
  font-size: calc(12px * var(--cv-spacing-scale));
  padding-bottom: 4px;
  border-bottom: 1px dashed #e2e8f0;
  margin-bottom: 6px;
}
.tpl-lang-name {
  font-weight: 600;
  font-size: calc(12px * var(--cv-spacing-scale));
  color: var(--cv-text);
  line-height: 1.2;
}
.tpl-lang-level {
  color: var(--cv-text-light);
  font-size: calc(11px * var(--cv-spacing-scale));
}

/* Langue avec barre de progression élégante et compacte (jamais étirée) */
.tpl-lang-progress-item {
  width: 100%;
  max-width: 220px;
  margin-bottom: calc(8px * var(--cv-spacing-scale));
}
.tpl-languages-grid .tpl-lang-progress-item {
  flex: 0 0 200px;
  max-width: 220px;
  margin-bottom: 0;
}
.tpl-languages-grid .tpl-lang-item {
  flex: 0 0 200px;
  max-width: 220px;
  margin-bottom: 0;
}

.tpl-progress-track {
  width: 100%;
  max-width: 220px;
  height: 5px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
  margin-top: 4px;
}
.tpl-progress-fill {
  height: 100%;
  background: var(--cv-primary);
  border-radius: 3px;
  transition: width 0.3s ease;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

/* --------------------------------------------------------------------------
   MODÈLE 2 : ATS CLASSIQUE (1 Colonne, 100% Optimisé Parsers ATS)
   -------------------------------------------------------------------------- */
.tpl-ats {
  padding: calc(34px * var(--cv-spacing-scale)) calc(36px * var(--cv-spacing-scale));
  display: flex;
  flex-direction: column;
  gap: calc(18px * var(--cv-spacing-scale));
}

.tpl-ats-header {
  text-align: center;
  border-bottom: 2px solid var(--cv-primary);
  padding-bottom: calc(14px * var(--cv-spacing-scale));
}

.tpl-ats-name {
  font-family: var(--cv-heading-font);
  font-size: calc(28px * var(--cv-spacing-scale));
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--cv-primary);
  margin-bottom: 4px;
}

.tpl-ats-title {
  font-size: calc(14px * var(--cv-spacing-scale));
  font-weight: 600;
  color: var(--cv-text);
  margin-bottom: 8px;
}

.tpl-ats-contacts {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: calc(11.5px * var(--cv-spacing-scale));
  color: var(--cv-text-light);
}
.tpl-ats-contacts span:not(:last-child)::after {
  content: "•";
  margin-left: 12px;
  color: #cbd5e1;
}

.tpl-ats-section {
  margin-bottom: calc(6px * var(--cv-spacing-scale));
}

.tpl-ats-section .tpl-section-title {
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 3px;
  margin-bottom: 8px;
}

.tpl-ats-entry {
  margin-bottom: calc(12px * var(--cv-spacing-scale));
}

/* --------------------------------------------------------------------------
   MODÈLE 3 : CADRE EXÉCUTIF (Bandeau de tête & Touches Raffinées)
   -------------------------------------------------------------------------- */
.tpl-executive {
  padding: calc(30px * var(--cv-spacing-scale)) calc(32px * var(--cv-spacing-scale));
  display: flex;
  flex-direction: column;
  gap: calc(18px * var(--cv-spacing-scale));
  position: relative;
}

.tpl-executive::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  background: var(--cv-primary);
}

.tpl-executive-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px solid #0f172a;
  padding-bottom: calc(14px * var(--cv-spacing-scale));
}

.tpl-executive-name {
  font-family: var(--cv-heading-font);
  font-size: calc(27px * var(--cv-spacing-scale));
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}

.tpl-executive-title {
  font-size: calc(13.5px * var(--cv-spacing-scale));
  font-weight: 600;
  color: var(--cv-primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

.tpl-executive-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: calc(24px * var(--cv-spacing-scale));
}

/* --------------------------------------------------------------------------
   MODÈLE 4 : TECH & PROJETS (Focus Métriques & Badges)
   -------------------------------------------------------------------------- */
.tpl-tech {
  padding: calc(26px * var(--cv-spacing-scale)) calc(28px * var(--cv-spacing-scale));
  display: flex;
  flex-direction: column;
  gap: calc(16px * var(--cv-spacing-scale));
}

.tpl-tech-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-left: 5px solid var(--cv-primary);
  padding: calc(14px * var(--cv-spacing-scale)) calc(18px * var(--cv-spacing-scale));
  border-radius: 6px;
}

.tpl-tech-name {
  font-family: var(--cv-heading-font);
  font-size: calc(24px * var(--cv-spacing-scale));
  font-weight: 800;
  color: var(--cv-primary);
}

.tpl-tech-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tpl-tech-badge {
  background: var(--cv-primary-light);
  color: var(--cv-primary);
  font-size: calc(11px * var(--cv-spacing-scale));
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   MODÈLE 5 : ÉLÉGANCE NORDIQUE (Style Contemporain & Typographie Aérée)
   -------------------------------------------------------------------------- */
.tpl-nordic {
  padding: calc(34px * var(--cv-spacing-scale)) calc(34px * var(--cv-spacing-scale));
  display: grid;
  grid-template-columns: 65% 35%;
  gap: calc(26px * var(--cv-spacing-scale));
}

.tpl-nordic-left {
  display: flex;
  flex-direction: column;
  gap: calc(20px * var(--cv-spacing-scale));
}

.tpl-nordic-right {
  display: flex;
  flex-direction: column;
  gap: calc(18px * var(--cv-spacing-scale));
  border-left: 1px solid #e2e8f0;
  padding-left: calc(20px * var(--cv-spacing-scale));
}

.tpl-nordic-name {
  font-family: var(--cv-heading-font);
  font-size: calc(29px * var(--cv-spacing-scale));
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0f172a;
}
.tpl-nordic-name span {
  color: var(--cv-primary);
}

/* ==========================================================================
   Toast de Notification
   ========================================================================== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--app-card);
  border: 1px solid var(--app-border-focus);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.85rem;
  font-weight: 500;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* --------------------------------------------------------------------------
   MODÈLE 6 : EXPERTISE COMPTABLE (Fiduciaire, Sobre & Rigoureux)
   -------------------------------------------------------------------------- */
.tpl-accounting {
  padding: 0;
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  background: #ffffff;
}

.tpl-accounting-top-banner {
  background: #f8fafc;
  border-top: 6px solid var(--cv-primary);
  border-bottom: 1.5px solid #cbd5e1;
  padding: calc(22px * var(--cv-spacing-scale)) calc(32px * var(--cv-spacing-scale)) calc(16px * var(--cv-spacing-scale));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: calc(16px * var(--cv-spacing-scale));
}

.tpl-accounting-name {
  font-family: var(--cv-heading-font);
  font-size: calc(23px * var(--cv-spacing-scale));
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.1;
}

.tpl-accounting-title {
  font-size: calc(13px * var(--cv-spacing-scale));
  font-weight: 700;
  color: var(--cv-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.tpl-accounting-contacts {
  text-align: right;
  font-size: calc(10.5px * var(--cv-spacing-scale));
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tpl-accounting-contacts span,
.tpl-audit-contacts span,
.tpl-acct-direction-contacts span {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.tpl-accounting-body {
  padding: 0 calc(32px * var(--cv-spacing-scale)) calc(24px * var(--cv-spacing-scale));
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--cv-spacing-scale));
}

.tpl-accounting-section-title {
  font-size: calc(12px * var(--cv-spacing-scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cv-primary);
  border-bottom: 1.5px solid var(--cv-primary);
  padding-bottom: 3px;
  margin-bottom: calc(8px * var(--cv-spacing-scale));
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tpl-accounting-entry {
  margin-bottom: calc(10px * var(--cv-spacing-scale));
  page-break-inside: avoid;
}

.tpl-accounting-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: calc(12.5px * var(--cv-spacing-scale));
  font-weight: 700;
  color: #0f172a;
}

.tpl-accounting-entry-period {
  font-size: calc(11px * var(--cv-spacing-scale));
  font-weight: 500;
  color: #64748b;
  white-space: nowrap;
}

.tpl-accounting-entry-sub {
  font-size: calc(11.5px * var(--cv-spacing-scale));
  color: var(--cv-primary);
  font-weight: 600;
  margin-bottom: 3px;
}

.tpl-accounting-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(14px * var(--cv-spacing-scale));
}

.tpl-accounting-skill-badge {
  display: inline-block;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #1e293b;
  font-size: calc(10.5px * var(--cv-spacing-scale));
  font-weight: 600;
  padding: calc(3px * var(--cv-spacing-scale)) calc(8px * var(--cv-spacing-scale));
  border-radius: 3px;
  margin: 2px 4px 2px 0;
}

/* --------------------------------------------------------------------------
   MODÈLE 7 : AUDIT & FINANCE (Corporate, Analytique & Structure Nette)
   -------------------------------------------------------------------------- */
.tpl-audit {
  padding: calc(26px * var(--cv-spacing-scale)) calc(30px * var(--cv-spacing-scale));
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  border-left: 6px solid var(--cv-primary);
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--cv-spacing-scale));
  background: #ffffff;
}

.tpl-audit-header {
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: calc(12px * var(--cv-spacing-scale));
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.tpl-audit-name {
  font-family: var(--cv-heading-font);
  font-size: calc(24px * var(--cv-spacing-scale));
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.1;
}

.tpl-audit-title {
  font-size: calc(13px * var(--cv-spacing-scale));
  font-weight: 700;
  color: var(--cv-primary);
  letter-spacing: 0.02em;
  margin-top: 3px;
}

.tpl-audit-contacts {
  font-size: calc(10.5px * var(--cv-spacing-scale));
  color: #475569;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
}

/* ==========================================================================
   LES 10 MODÈLES SPÉCIALISÉS SECTEUR COMPTABILITÉ & FINANCE
   ========================================================================== */

/* 1. COMPTABILITÉ GÉNÉRALE */
.tpl-acct-general,
.tpl-accounting {
  padding: 0;
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  background: #ffffff;
}
.tpl-acct-general .tpl-acct-banner,
.tpl-accounting .tpl-accounting-top-banner {
  background: #f8fafc;
  border-top: 6px solid var(--cv-primary);
  border-bottom: 1.5px solid #cbd5e1;
  padding: calc(20px * var(--cv-spacing-scale)) calc(32px * var(--cv-spacing-scale)) calc(16px * var(--cv-spacing-scale));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: calc(16px * var(--cv-spacing-scale));
}
.tpl-acct-body {
  padding: 0 calc(32px * var(--cv-spacing-scale)) calc(24px * var(--cv-spacing-scale));
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--cv-spacing-scale));
}

/* 2. CABINET & FIDUCIAIRE (Layout 2 Colonnes Spécialisé) */
.tpl-acct-cabinet {
  display: flex;
  min-height: 297mm;
  font-family: var(--cv-font);
  background: #ffffff;
}
.tpl-acct-cabinet-sidebar {
  width: 33%;
  background: #f1f5f9;
  border-right: 1.5px solid #cbd5e1;
  padding: calc(26px * var(--cv-spacing-scale)) calc(20px * var(--cv-spacing-scale));
  display: flex;
  flex-direction: column;
  gap: calc(18px * var(--cv-spacing-scale));
}
.tpl-acct-cabinet-main {
  width: 67%;
  padding: calc(26px * var(--cv-spacing-scale)) calc(26px * var(--cv-spacing-scale));
  display: flex;
  flex-direction: column;
  gap: calc(18px * var(--cv-spacing-scale));
}
.tpl-acct-cabinet-header {
  border-bottom: 2px solid var(--cv-primary);
  padding-bottom: calc(14px * var(--cv-spacing-scale));
}

/* 3. AUDIT & COMMISSARIAT AUX COMPTES */
.tpl-acct-audit,
.tpl-audit {
  padding: calc(26px * var(--cv-spacing-scale)) calc(30px * var(--cv-spacing-scale));
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  border-left: 6px solid var(--cv-primary);
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--cv-spacing-scale));
  background: #ffffff;
}

/* 4. FISCALITÉ & DÉCLARATIONS (Cadre Formel & Rigoureux) */
.tpl-acct-fiscal {
  padding: calc(24px * var(--cv-spacing-scale)) calc(28px * var(--cv-spacing-scale));
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--cv-spacing-scale));
  position: relative;
}
.tpl-acct-fiscal-header {
  border: 1.5px solid var(--cv-primary);
  border-radius: 4px;
  padding: calc(14px * var(--cv-spacing-scale)) calc(18px * var(--cv-spacing-scale));
  background: #fdf2f8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.tpl-acct-fiscal-badge {
  display: inline-block;
  font-size: calc(10px * var(--cv-spacing-scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--cv-primary);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 2px;
  margin-top: 4px;
}

/* 5. CONTRÔLE DE GESTION & PERFORMANCE */
.tpl-acct-gestion {
  padding: calc(26px * var(--cv-spacing-scale)) calc(30px * var(--cv-spacing-scale));
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--cv-spacing-scale));
}
.tpl-acct-gestion-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 2px dashed #94a3b8;
  padding-bottom: calc(12px * var(--cv-spacing-scale));
}
.tpl-acct-kpi-bar {
  display: flex;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: calc(10.5px * var(--cv-spacing-scale));
  font-weight: 600;
  color: #334155;
}

/* 6. GESTIONNAIRE DE PAIE & SOCIAL */
.tpl-acct-paie {
  padding: calc(24px * var(--cv-spacing-scale)) calc(28px * var(--cv-spacing-scale));
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--cv-spacing-scale));
}
.tpl-acct-paie-header {
  background: linear-gradient(135deg, #fef3c7 0%, #ffffff 100%);
  border-left: 5px solid #d97706;
  border-bottom: 1px solid #fde68a;
  padding: calc(14px * var(--cv-spacing-scale)) calc(18px * var(--cv-spacing-scale));
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0 4px 4px 0;
}

/* 7. TRÉSORERIE & CASH MANAGEMENT */
.tpl-acct-tresorerie {
  padding: calc(24px * var(--cv-spacing-scale)) calc(30px * var(--cv-spacing-scale));
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: calc(13px * var(--cv-spacing-scale));
}
.tpl-acct-tresorerie-header {
  border-top: 3px double var(--cv-primary);
  border-bottom: 3px double var(--cv-primary);
  padding: calc(12px * var(--cv-spacing-scale)) 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 8. NORMES IFRS & CONSOLIDATION GROUPE */
.tpl-acct-ifrs {
  padding: calc(26px * var(--cv-spacing-scale)) calc(32px * var(--cv-spacing-scale));
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: calc(14px * var(--cv-spacing-scale));
}
.tpl-acct-ifrs-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 3px solid var(--cv-primary);
  padding-bottom: calc(14px * var(--cv-spacing-scale));
}
.tpl-acct-ifrs-tag {
  font-size: calc(10px * var(--cv-spacing-scale));
  font-weight: 700;
  color: var(--cv-primary);
  border: 1px solid var(--cv-primary);
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
}

/* 9. COMPTABILITÉ ANALYTIQUE & COÛTS */
.tpl-acct-analytique {
  padding: calc(24px * var(--cv-spacing-scale)) calc(30px * var(--cv-spacing-scale));
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: calc(13px * var(--cv-spacing-scale));
}
.tpl-acct-analytique-header {
  background: #f0fdf4;
  border-left: 5px solid #10b981;
  border-bottom: 1px solid #d1fae5;
  padding: calc(14px * var(--cv-spacing-scale)) calc(18px * var(--cv-spacing-scale));
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 10. DIRECTION FINANCIÈRE (DAF) */
.tpl-acct-direction {
  padding: 0;
  font-family: var(--cv-font);
  color: var(--cv-text);
  line-height: 1.5;
  background: #ffffff;
}
.tpl-acct-direction-banner {
  background: #0f172a;
  color: #ffffff;
  padding: calc(24px * var(--cv-spacing-scale)) calc(32px * var(--cv-spacing-scale)) calc(18px * var(--cv-spacing-scale));
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 4px solid #b45309;
}
.tpl-acct-direction-name {
  font-family: var(--cv-heading-font);
  font-size: calc(25px * var(--cv-spacing-scale));
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.01em;
  margin: 0;
}
.tpl-acct-direction-title {
  font-size: calc(13.5px * var(--cv-spacing-scale));
  font-weight: 600;
  color: #fbbf24;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 4px;
}
.tpl-acct-direction-contacts {
  font-size: calc(10.5px * var(--cv-spacing-scale));
  color: #cbd5e1;
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tpl-acct-direction-contacts a,
.tpl-acct-direction-contacts span {
  color: #cbd5e1;
}
.tpl-acct-direction-body {
  padding: calc(20px * var(--cv-spacing-scale)) calc(32px * var(--cv-spacing-scale)) calc(24px * var(--cv-spacing-scale));
  display: flex;
  flex-direction: column;
  gap: calc(15px * var(--cv-spacing-scale));
}

/* Styles communs pour les titres de section comptables */
.tpl-acct-sec-title {
  font-size: calc(12.5px * var(--cv-spacing-scale));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--cv-primary);
  border-bottom: 1.5px solid var(--cv-primary);
  padding-bottom: 3px;
  margin-bottom: calc(8px * var(--cv-spacing-scale));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.tpl-acct-sec-title.subtle {
  background: #f8fafc;
  border-left: 3.5px solid var(--cv-primary);
  border-bottom: none;
  padding: 3px 8px;
}

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

/* ==========================================================================
   OPTIMISATION MOBILE & TABLETTE (RESPONSIVE DESIGN)
   ========================================================================== */

/* Éléments mobile masqués par défaut sur Desktop (> 960px) */
.mobile-bottom-nav,
.mobile-fab-preview,
.header-btn-text-pdf-short {
  display: none;
}
.header-btn-text-pdf {
  display: inline;
}

/* --------------------------------------------------------------------------
   Tablettes & Mobiles (<= 960px) : Bascule de vues & Navigation tactile
   -------------------------------------------------------------------------- */
@media screen and (max-width: 960px) {
  body {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    position: relative;
  }

  /* En-tête compacte */
  .app-header {
    height: 56px;
    padding: 0 14px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand-text h1 {
    font-size: 1.05rem;
  }

  .brand-text h1 span {
    font-size: 0.65rem;
    padding: 1px 6px;
  }

  .brand-subtitle {
    display: none;
  }

  .header-actions {
    gap: 8px;
  }

  /* Disposition générale : Pleine largeur pour le panneau actif */
  .app-layout {
    flex: 1 !important;
    min-height: 0 !important;
    height: auto !important;
    position: relative;
    overflow: hidden;
  }

  /* Par défaut ou en mode éditeur : Afficher l'éditeur et masquer l'aperçu */
  body:not(.mobile-view-preview) .editor-panel {
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: calc(100% - 60px) !important;
    border-right: none;
  }

  body:not(.mobile-view-preview) .preview-panel {
    display: none !important;
  }

  /* En mode Aperçu : Masquer l'éditeur et afficher l'aperçu plein écran */
  body.mobile-view-preview .editor-panel {
    display: none !important;
  }

  body.mobile-view-preview .preview-panel {
    display: flex !important;
    width: 100% !important;
    height: calc(100% - 60px) !important;
  }

  /* Barre de Navigation Mobile Inférieure */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(19, 27, 46, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--app-border);
    z-index: 1000;
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.45);
  }

  .mobile-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--app-text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-nav-item svg {
    transition: transform 0.2s, color 0.2s;
  }

  .mobile-nav-item.active {
    color: #60a5fa;
    font-weight: 600;
  }

  .mobile-nav-item.active svg {
    color: #60a5fa;
    transform: scale(1.1);
  }

  .mobile-nav-preview-item .mobile-nav-preview-badge {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4);
    margin-bottom: 1px;
    transition: transform 0.2s, box-shadow 0.2s;
  }

  .mobile-nav-preview-item.active .mobile-nav-preview-badge {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4), 0 4px 14px rgba(37, 99, 235, 0.6);
    transform: scale(1.08);
  }

  /* Bouton Flottant (FAB) d'accès direct à l'aperçu */
  .mobile-fab-preview {
    display: inline-flex;
    position: fixed;
    right: 16px;
    bottom: 74px;
    z-index: 900;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    color: #ffffff;
    border: none;
    border-radius: 28px;
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    align-items: center;
    gap: 8px;
    box-shadow: 0 6px 22px rgba(37, 99, 235, 0.5);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-fab-preview:active {
    transform: scale(0.95);
  }

  body.mobile-view-preview .mobile-fab-preview {
    display: none !important;
  }

  /* Ajustement des formulaires & padding pour la barre basse */
  .tab-contents {
    padding: 16px 14px 84px 14px;
  }

  .config-card {
    padding: 14px;
    margin-bottom: 16px;
  }

  .preview-scroll-area {
    padding: 14px 6px 84px 6px;
  }
}

/* --------------------------------------------------------------------------
   Smartphones (<= 680px) : Optimisations tactiles & champs pleine largeur
   -------------------------------------------------------------------------- */
@media screen and (max-width: 680px) {
  /* En-tête épurée : Masquer les textes des boutons secondaires */
  .header-actions {
    gap: 4px;
  }

  .header-btn-text {
    display: none !important;
  }

  .header-btn-text-pdf {
    display: none !important;
  }

  .header-btn-text-pdf-short {
    display: inline !important;
    font-weight: 700;
    font-size: 0.82rem;
  }

  .btn {
    padding: 6px 8px;
    font-size: 0.8rem;
  }

  /* Bouton retour compact */
  .btn-back-home {
    padding: 6px 8px;
  }

  .btn-back-text {
    display: none !important;
  }

  .brand-divider {
    display: none !important;
  }

  .dropdown-menu {
    right: -6px;
    min-width: 200px;
    max-width: 90vw;
  }

  /* Formulaires en colonne unique pour confort de frappe */
  .form-row {
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
  }

  /* Prévention du zoom automatique gênant sur iPhone Safari */
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px !important;
    min-height: 42px;
    padding: 9px 12px;
  }

  /* Zone d'import de photo */
  .photo-upload-zone {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .photo-buttons-row {
    width: 100%;
    justify-content: flex-start;
  }

  .photo-toggle-row {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Grille des modèles : 2 colonnes adaptées */
  .template-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .template-card {
    padding: 8px;
  }

  .template-thumb {
    height: 70px;
  }

  /* Nuancier de couleurs */
  .color-picker-grid {
    gap: 8px;
  }

  .color-dot {
    width: 32px;
    height: 32px;
  }

  /* Accordéons tactiles */
  .accordion-header {
    padding: 12px 14px;
  }

  .accordion-reorder-btn {
    padding: 6px 10px;
    min-height: 36px;
    min-width: 36px;
  }

  /* Barre d'outils de prévisualisation */
  .preview-toolbar {
    padding: 8px 10px;
    gap: 8px;
  }

  .preview-template-tag {
    display: none;
  }

  .preview-badge {
    font-size: 0.72rem;
  }

  .btn-icon {
    width: 30px;
    height: 30px;
  }

  .zoom-text {
    width: 36px;
    font-size: 0.74rem;
  }
}

/* Écrans très étroits (<= 380px) */
@media screen and (max-width: 380px) {
  .brand-logo {
    width: 30px;
    height: 30px;
  }

  .brand-text h1 {
    font-size: 0.95rem;
  }

  .btn {
    padding: 5px 6px;
  }
}

/* ==========================================================================
   RÈGLES D'IMPRESSION HAUTE FIDÉLITÉ (PDF A4 EXPORT)
   ========================================================================== */
@page {
  size: A4 portrait;
  margin: 0mm;
}

@media print {
  /* Forcer le rendu exact des arrière-plans et couleurs */
  *, *::before, *::after {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: static !important;
  }

  /* Masquer TOUS les éléments hors CV */
  .app-header,
  .editor-panel,
  .preview-toolbar,
  .toast,
  .mobile-bottom-nav,
  .mobile-fab-preview,
  .btn-back-home,
  .brand-divider,
  .dropdown-menu,
  .ad-wrapper,
  .ad-slot,
  .ad-label {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
  }

  /* Forcer l'éditeur masqué quel que soit l'état du body */
  body .editor-panel,
  body:not(.mobile-view-preview) .editor-panel,
  body.mobile-view-preview .editor-panel {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
  }

  /* Conteneur principal A4 */
  .app-layout {
    display: block !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    position: static !important;
  }

  /* Panneau d'aperçu : toujours affiché en pleine page A4 */
  body .preview-panel,
  body:not(.mobile-view-preview) .preview-panel,
  body.mobile-view-preview .preview-panel,
  .preview-panel {
    display: block !important;
    visibility: visible !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    min-width: 210mm !important;
    max-width: 210mm !important;
    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;
    overflow: hidden !important;
    position: static !important;
  }

  .preview-scroll-area {
    display: block !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    overflow: hidden !important;
  }

  .a4-sheet-wrapper {
    display: block !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    transform: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
  }

  /* La page de CV A4 stricte (1 seule page sans débordement) */
  .cv-page {
    width: 210mm !important;
    height: 297mm !important;
    min-height: 297mm !important;
    max-height: 297mm !important;
    box-sizing: border-box !important;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
    page-break-before: avoid !important;
    break-before: avoid !important;
    overflow: hidden !important;
  }

  /* Éviter les coupures disgracieuses d'éléments */
  .tpl-timeline-item,
  .tpl-ats-entry,
  .tpl-section-title {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}

/* ==========================================================================
   Espaces Publicitaires AdSense (App Studio)
   ========================================================================== */

/* 1. Bandeau supérieur (Top Ad Bar) */
.app-ad-banner-top {
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
  padding: 6px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 25;
  height: 80px;
  overflow: hidden;
}

.app-ad-banner-top .ad-wrapper {
  max-width: 728px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(11, 15, 25, 0.45);
  border: 1px dashed rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
}

.app-ad-banner-top .ad-slot {
  height: 52px;
  max-height: 52px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 2. Carte publicitaire dans le panneau éditeur (Sidebar) */
.editor-ad-card {
  background: var(--app-card);
  border: 1px dashed var(--app-border);
  border-radius: var(--radius-md);
  padding: 12px 10px;
  margin: 18px 0;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.editor-ad-card:hover {
  border-color: rgba(96, 165, 250, 0.35);
}

.editor-ad-card .ad-slot {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 3. Zone publicitaire sous l'aperçu A4 (Preview Panel) */
.preview-ad-zone {
  margin-top: 24px;
  width: 100%;
  max-width: 728px;
  text-align: center;
  flex-shrink: 0;
}

.preview-ad-zone .ad-wrapper {
  background: rgba(19, 27, 46, 0.75);
  border: 1px dashed var(--app-border);
  border-radius: var(--radius-md);
  padding: 10px;
}

.preview-ad-zone .ad-slot {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Éléments de structure AdSense */
.ad-wrapper {
  position: relative;
  text-align: center;
  overflow: hidden;
}

.ad-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--app-text-muted);
  margin-bottom: 2px;
  user-select: none;
}

.ad-slot {
  margin: 0 auto;
  width: 100%;
}

.ad-slot:empty::before {
  content: 'Espace Publicitaire AdSense';
  display: block;
  font-size: 0.72rem;
  color: #475569;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 500;
  opacity: 0.8;
}

/* Adaptations mobiles pour les bannières publicitaires */
@media screen and (max-width: 960px) {
  .app-ad-banner-top {
    height: 52px;
    padding: 3px 8px;
  }
  .app-ad-banner-top .ad-wrapper {
    max-width: 320px;
    padding: 2px 6px;
  }
  .app-ad-banner-top .ad-slot {
    height: 32px;
    max-height: 32px;
  }
  .app-ad-banner-top .ad-label {
    font-size: 0.58rem;
    margin-bottom: 1px;
  }
  .app-ad-banner-top .ad-slot:empty::before {
    font-size: 0.62rem;
  }
}

/* Sécurité impression : aucune pub ne doit JAMAIS apparaître sur le PDF généré */
@media print {
  .app-ad-banner-top,
  .editor-ad-card,
  .preview-ad-zone,
  .ad-wrapper,
  .ad-slot,
  .ad-label,
  ins.adsbygoogle {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}
