/* ==========================================================================
   Plan de Ferme — Compositeur Cartographique & Export PDF
   Format Lettre (8,5 × 11 po) — Modes Portrait & Paysage
   ========================================================================== */

/* Overlay modal d'arrière-plan */
.composer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.composer-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Boîte modale principale plein écran adaptable */
.composer-modal {
  width: 96vw;
  max-width: 1440px;
  height: 92vh;
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.composer-overlay.active .composer-modal {
  transform: scale(1);
}

/* En-tête du compositeur */
.composer-header {
  height: 56px;
  padding: 0 20px;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.composer-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-sans, "Plus Jakarta Sans", sans-serif);
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.composer-header-title svg {
  color: #166534;
}

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

.composer-btn-pdf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #166534 0%, #15803d 100%);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(22, 101, 52, 0.2);
  transition: all 0.15s ease;
}

.composer-btn-pdf:hover {
  background: linear-gradient(135deg, #14532d 0%, #166534 100%);
  box-shadow: 0 4px 8px rgba(22, 101, 52, 0.3);
  transform: translateY(-1px);
}

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

.composer-btn-pdf:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.composer-btn-close {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.composer-btn-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}

/* Corps du compositeur : Panneau de réglages (gauche) + Prévisualisation (droite) */
.composer-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #f8fafc;
}

/* Panneau latéral des paramètres */
.composer-sidebar {
  width: 380px;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-shrink: 0;
}

.composer-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.composer-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #0f172a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.composer-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.composer-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #475569;
}

.composer-input,
.composer-textarea,
.composer-select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 12.5px;
  font-family: inherit;
  color: #0f172a;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.composer-input:focus,
.composer-textarea:focus,
.composer-select:focus {
  outline: none;
  border-color: #166534;
  box-shadow: 0 0 0 2px rgba(22, 101, 52, 0.15);
}

.composer-textarea {
  min-height: 60px;
  resize: vertical;
  line-height: 1.4;
}

/* Contrôle segmenté pour Portrait / Paysage */
.composer-segmented {
  display: flex;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
}

.composer-seg-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.composer-seg-btn:hover {
  color: #0f172a;
}

.composer-seg-btn.active {
  background: #ffffff;
  color: #166534;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Zone d'upload de logo */
.composer-logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.composer-logo-preview {
  width: 52px;
  height: 52px;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.composer-logo-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.composer-logo-preview-empty {
  font-size: 9px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.2;
}

.composer-logo-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.composer-btn-upload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 10px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.composer-btn-upload:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}

.composer-btn-clear-logo {
  background: none;
  border: none;
  color: #dc2626;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  padding: 2px 0;
}

.composer-btn-clear-logo:hover {
  text-decoration: underline;
}

/* Cases à cocher des éléments de carte */
.composer-checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
  color: #334155;
  cursor: pointer;
}

.composer-checkbox-row input[type="checkbox"] {
  accent-color: #166534;
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Ligne d'actions sur les gabarits (JSON, localStorage) */
.composer-template-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 4px;
}

.composer-btn-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.composer-btn-action:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

/* Grille de réglage des dimensions des boîtes */
.composer-size-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}

.composer-size-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.composer-size-field label {
  font-size: 10.5px;
  font-weight: 600;
  color: #475569;
}

.composer-size-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.composer-input-sm {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
}

.composer-input-sm:focus {
  outline: none;
  border-color: #166534;
  box-shadow: 0 0 0 2px rgba(22, 101, 52, 0.15);
}

.composer-unit {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  user-select: none;
}

/* Zone d'aperçu de la feuille de papier (Canvas / WYSIWYG) */
.composer-preview-viewport {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px;
  background: #cbd5e1;
  position: relative;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

/* Conteneur d'échelle dynamique (Auto-Fit & Zoom) */
.composer-sheet-scaler {
  margin: auto;
  position: relative;
  flex-shrink: 0;
}

/* Feuille de papier format Lettre */
.composer-sheet {
  position: absolute;
  top: 0;
  left: 0;
  background: #ffffff;
  box-shadow: 0 12px 30px -6px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-sans, "Plus Jakarta Sans", sans-serif);
  color: #0f172a;
  transform-origin: top left;
  user-select: text;
  flex-shrink: 0;
}

/* Proportions réelles Format Lettre (8.5 × 11 pouces = ratio 1:1.2941) */
/* Échelle Paysage : 880px / 279.4mm = 3.1496 px/mm -> Marges 10mm = 31.5px */
.composer-sheet.landscape {
  width: 880px;
  height: 680px; /* Ratio 1.294 */
  padding: 31.5px;
}

/* Échelle Portrait : 650px / 215.9mm = 3.01065 px/mm -> Marges 10mm = 30px */
.composer-sheet.portrait {
  width: 650px;
  height: 841px; /* Ratio 1.294 */
  padding: 30px;
}

/* Barre d'outils de Zoom flottante */
.composer-zoom-toolbar {
  position: absolute;
  bottom: 16px;
  right: 18px;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  padding: 4px 8px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.composer-zoom-btn {
  background: transparent;
  border: none;
  color: #e2e8f0;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all 0.12s ease;
}

.composer-zoom-btn:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.composer-zoom-btn.active {
  background: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.composer-zoom-level {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 10.5px;
  font-weight: 700;
  color: #94a3b8;
  min-width: 36px;
  text-align: center;
  padding: 0 2px;
}

/* En-tête / Cartouche sur la feuille */
.sheet-cartouche {
  border: 1.5px solid #0f172a;
  border-radius: 4px;
  background: #ffffff;
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9.5px;
  gap: 12px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.sheet-cartouche-main {
  flex: 1;
  min-width: 0;
}

.sheet-title {
  font-family: var(--font-serif, "Newsreader", "Cinzel", Georgia, serif);
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.01em;
  outline: none;
  border-radius: 3px;
  padding: 1px 3px;
}

.sheet-title:focus {
  background: #fef08a;
}

.sheet-subtitle {
  font-size: 10.5px;
  font-weight: 600;
  color: #166534;
  margin-top: 2px;
  line-height: 1.15;
  outline: none;
  border-radius: 3px;
  padding: 1px 3px;
}

.sheet-subtitle:focus {
  background: #fef08a;
}

.sheet-cartouche-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 9.5px;
  color: #475569;
  text-align: right;
  border-left: 1px solid #cbd5e1;
  padding-left: 10px;
  flex-shrink: 0;
}

.sheet-cartouche-meta strong {
  color: #0f172a;
}

.sheet-logo-container {
  height: 38px;
  max-width: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sheet-logo-container img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
}

/* Zone centrale : Cadre de carte et panneau latéral (Légende / Rose des vents) */
.sheet-content-row {
  display: flex;
  flex: 1;
  gap: 12.5px;
  min-height: 0;
  position: relative;
}

/* En mode Portrait, disposition verticale */
.composer-sheet.portrait .sheet-content-row {
  flex-direction: column;
  gap: 9px;
}

/* Colonne carte + profil éventuel */
.sheet-map-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-height: 0;
  min-width: 0;
}

/* Cadre de carte MapLibre */
.sheet-map-frame {
  flex: 1;
  border: 1.5px solid #0f172a;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  min-width: 0;
}

.sheet-map-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #e2e8f0;
}

/* Bloc Profil Topographique MNT sur la feuille */
.sheet-profile-block {
  border: 1.5px solid #0f172a;
  border-radius: 4px;
  background: #ffffff;
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 130px;
  flex-shrink: 0;
}

.composer-sheet.portrait .sheet-profile-block {
  height: 110px;
}

.sheet-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 3px;
  gap: 8px;
}

.sheet-profile-title {
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #0f172a;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.sheet-profile-chips {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.sheet-profile-chip {
  font-size: 7.5px;
  padding: 1px 4px;
  background: #f1f5f9;
  border-radius: 3px;
  color: #334155;
  white-space: nowrap;
}

.sheet-profile-chip strong {
  color: #0f172a;
}

.sheet-profile-chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
}

.sheet-profile-chart-wrap svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* Panneau latéral de la feuille (Paysage) ou section basse (Portrait) */
.sheet-side-panel {
  width: 189px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  box-sizing: border-box;
}

.composer-sheet.portrait .sheet-side-panel {
  width: 100%;
  flex-direction: row;
  height: 165px;
  min-height: 165px;
  max-height: 165px;
  gap: 9px;
}

/* Bloc Rose des vents et échelle */
.sheet-nav-block {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 8px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  box-sizing: border-box;
}

.composer-sheet.portrait .sheet-nav-block {
  width: 126px;
  min-width: 126px;
  flex-shrink: 0;
}

/* Rose des vents SVG */
.sheet-compass-wrap {
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.sheet-compass-svg {
  width: 100%;
  height: 100%;
}

/* Échelle graphique & ratio */
.sheet-scale-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 100%;
}

.sheet-scale-bar {
  display: flex;
  height: 6px;
  width: 110px;
  border: 1px solid #0f172a;
  background: #ffffff;
}

.sheet-scale-bar-seg {
  flex: 1;
  background: #0f172a;
}

.sheet-scale-bar-seg:nth-child(even) {
  background: #ffffff;
}

.sheet-scale-labels {
  display: flex;
  justify-content: space-between;
  width: 110px;
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 8px;
  color: #334155;
  font-weight: 600;
}

.sheet-scale-ratio {
  font-family: var(--font-mono, "JetBrains Mono", monospace);
  font-size: 8.5px;
  font-weight: 600;
  color: #0f172a;
  margin-top: 1px;
}

/* Légende cartographique dynamique sur la feuille */
.sheet-legend-block {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 8px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 9px;
  flex: 1;
  overflow: hidden;
}

.sheet-legend-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 9px;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 3px;
}

.sheet-legend-items {
  display: flex;
  flex-direction: column;
  gap: 3.5px;
  overflow-y: auto;
}

.sheet-legend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 8.5px;
  color: #334155;
  padding: 1px 2px;
  border-radius: 3px;
  position: relative;
  transition: background 0.12s ease;
}

.sheet-legend-item:hover {
  background: #f1f5f9;
}

.sheet-legend-item-left {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex: 1;
}

.sheet-legend-remove-btn {
  opacity: 0;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 13px;
  line-height: 1;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.12s ease;
  flex-shrink: 0;
  padding: 0;
}

.sheet-legend-item:hover .sheet-legend-remove-btn {
  opacity: 1;
}

.sheet-legend-remove-btn:hover {
  background: #fee2e2;
  color: #dc2626;
}

.sheet-legend-group-header {
  font-size: 7.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.35px;
  color: #475569;
  margin-top: 4px;
  padding-top: 2px;
  border-top: 1px dashed #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sheet-legend-gradient-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  margin: 2px 0 4px 0;
}

.sheet-legend-gradient-bar {
  height: 7px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  background: linear-gradient(to right, #7c3aed, #0284c7, #22c55e, #eab308, #dc2626);
  width: 100%;
}

.sheet-legend-gradient-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono, monospace);
  font-size: 7px;
  color: #64748b;
  font-weight: 600;
}

.sheet-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.sheet-legend-line {
  width: 12px;
  height: 2px;
  flex-shrink: 0;
  border-radius: 1px;
}

/* Personnalisation des éléments de légende dans la barre latérale */
.composer-legend-customizer {
  margin-top: 6px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.composer-legend-customizer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #334155;
}

.composer-btn-mini-reset {
  background: transparent;
  border: none;
  color: #166534;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 4px;
  text-decoration: underline;
}

.composer-btn-mini-reset:hover {
  background: #dcfce7;
}

.composer-legend-checklist {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 140px;
  overflow-y: auto;
}

.composer-legend-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #334155;
  cursor: pointer;
  user-select: none;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.12s ease;
}

.composer-legend-check-item:hover {
  background: #f1f5f9;
}

.composer-legend-check-item input[type="checkbox"] {
  accent-color: #166534;
  cursor: pointer;
}

.composer-legend-check-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid rgba(0, 0, 0, 0.2);
  flex-shrink: 0;
}

/* Bloc des notes de terrain sur la feuille */
.sheet-notes-block {
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  padding: 8px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 8.5px;
  color: #475569;
}

.composer-sheet.portrait .sheet-notes-block {
  flex: 1;
}

.sheet-notes-title {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 8.5px;
  color: #0f172a;
}

.sheet-notes-text {
  line-height: 1.35;
  outline: none;
  white-space: pre-line;
}

.sheet-notes-text:focus {
  background: #fef08a;
  border-radius: 2px;
}

/* Pied de page de la feuille */
.sheet-footer {
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 8px;
  color: #64748b;
  border-top: 1px solid #e2e8f0;
  padding-top: 4px;
  flex-shrink: 0;
}

/* Barre d'onglets pour mobile (Réglages vs Aperçu) */
.composer-mobile-nav {
  display: none;
}

/* Responsiveness pour écrans mobiles et étroits (Mode Onglets Réglages / Aperçu) */
@media (max-width: 900px) {
  .composer-overlay {
    padding: 0;
  }
  .composer-modal {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }
  .composer-header {
    padding: 8px 12px;
  }
  .composer-header-title span {
    font-size: 13px;
  }
  .composer-mobile-nav {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 6px 12px;
    gap: 8px;
    flex-shrink: 0;
  }
  .composer-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    background: #ffffff;
    color: #475569;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .composer-tab-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
  }
  .composer-tab-btn.active {
    background: #0f172a;
    color: #ffffff;
    border-color: #0f172a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
  }
  .composer-body {
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* Onglet Réglages actif : la barre latérale prend 100% de la hauteur */
  .composer-body[data-active-tab="settings"] .composer-sidebar {
    display: flex !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    flex: 1 !important;
    border-right: none;
    border-bottom: none;
    overflow-y: auto;
  }
  .composer-body[data-active-tab="settings"] .composer-preview-viewport {
    display: none !important;
  }

  /* Onglet Aperçu actif : la feuille et le zoom prennent 100% de la hauteur */
  .composer-body[data-active-tab="preview"] .composer-sidebar {
    display: none !important;
  }
  .composer-body[data-active-tab="preview"] .composer-preview-viewport {
    display: flex !important;
    width: 100% !important;
    flex: 1 !important;
    padding: 12px;
    overflow: auto;
    align-items: center;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
  }

  .composer-zoom-toolbar {
    bottom: 12px;
    right: 12px;
    padding: 3px 6px;
    gap: 2px;
  }
  .composer-zoom-btn {
    padding: 3px 6px;
    font-size: 10px;
  }
  .composer-zoom-level {
    font-size: 9.5px;
    min-width: 30px;
  }
}
