/* ============================================================
   AnaWajib · moteur de generateurs de documents
   Feuille partagee par /generateur-devis, /generateur-facture
   et /generateur-bon-de-commande.
   L'accent de chaque outil est pilote par les variables
   --tool-accent* definies sur .tool-page dans chaque page.
   ============================================================ */

.tool-page {
  --tool-accent: #2563EB;
  --tool-accent-dark: #1D4ED8;
  --tool-accent-rgb: 37, 99, 235;
  --tool-accent-soft: #EFF6FF;
  --tool-accent-soft-strong: #DBEAFE;
  --tool-accent-border: #BFDBFE;
  --tool-select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235B6B7C' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ============================================
   PAGE LAYOUT
   ============================================ */
.tool-page {
  min-height: 100vh;
  background: var(--color-bg-alt);
}

.tool-header {
  background: #fff;
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
}

.tool-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.tool-header-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-full);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.tool-header-back:hover {
  color: var(--color-text);
  background: var(--color-bg-alt);
  text-decoration: none;
}

.tool-header-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.tool-header-title h1 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-text);
}

.tool-badge {
  background: var(--tool-accent-soft);
  color: var(--tool-accent-dark);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ============================================
   MAIN LAYOUT 2 COLONNES
   ============================================ */
.tool-layout {
  display: grid;
  grid-template-columns: 45% 1fr;
  gap: 0;
  min-height: calc(100vh - 60px);
}

/* ============================================
   COLONNE FORMULAIRE
   ============================================ */
.form-col {
  background: #fff;
  border-right: 1px solid var(--color-border);
  overflow-y: auto;
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.form-col-header {
  margin-bottom: 0.5rem;
}

.form-col-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 0.25rem;
}

.form-col-header p {
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

/* Accordéon */
.accordion {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.1rem;
  background: #fff;
  border: none;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: left;
  transition: background var(--transition-fast);
  gap: 0.75rem;
}

.accordion-header:hover {
  background: var(--color-bg-alt);
}

.accordion-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.accordion-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: var(--tool-accent-soft);
  color: var(--tool-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.accordion-chevron {
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  color: var(--color-text-secondary);
}

.accordion.open .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-body {
  display: none;
  padding: 0 1.1rem 1.1rem;
  border-top: 1px solid var(--color-border);
}

.accordion.open .accordion-body {
  display: block;
}

/* Champs formulaire */
.field-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.field-group.full {
  grid-template-columns: 1fr;
}

.field-group.thirds {
  grid-template-columns: 1fr 1fr 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field.span2 {
  grid-column: span 2;
}

.field label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.field label .req {
  color: var(--color-gold);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.55rem 0.8rem;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.85rem;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}

.field select {
  background-image: var(--tool-select-chevron);
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.field textarea {
  resize: vertical;
  min-height: 70px;
  line-height: 1.5;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--tool-accent);
  box-shadow: 0 0 0 3px rgba(var(--tool-accent-rgb), 0.12);
}

.field input::placeholder,
.field textarea::placeholder {
  color: #B0BAC5;
}

/* Tableau de lignes */
.lines-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 0.9rem;
}

.lines-table th {
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 0 0.4rem 0.4rem;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.lines-table td {
  padding: 0.3rem 0.4rem;
  vertical-align: middle;
}

.lines-table input,
.lines-table select {
  width: 100%;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.78rem;
  background: #fff;
  color: var(--color-text);
  appearance: none;
  -webkit-appearance: none;
}

.lines-table input:focus,
.lines-table select:focus {
  outline: none;
  border-color: var(--tool-accent);
  box-shadow: 0 0 0 2px rgba(var(--tool-accent-rgb), 0.1);
}

.lines-table .col-desc { min-width: 120px; }
.lines-table .col-qty  { width: 55px; }
.lines-table .col-pu   { width: 80px; }
.lines-table .col-tva  { width: 68px; }
.lines-table .col-total{ width: 80px; }
.lines-table .col-del  { width: 32px; }

.col-total input {
  background: #F5F7FA !important;
  color: var(--color-text-secondary) !important;
  cursor: default;
}

.btn-del-line {
  background: none;
  border: none;
  cursor: pointer;
  color: #CBD5E1;
  padding: 0.25rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.btn-del-line:hover {
  color: #E86A5A;
  background: #FFF1F2;
}

.btn-add-line {
  margin-top: 0.6rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--tool-accent);
  background: var(--tool-accent-soft);
  border: 1px dashed var(--tool-accent-border);
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  transition: background var(--transition-fast);
  width: 100%;
  justify-content: center;
}

.btn-add-line:hover {
  background: var(--tool-accent-soft-strong);
}

/* Checkbox mentions légales */
.mention-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
  cursor: pointer;
}

.mention-check input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  margin-top: 0.1rem;
  accent-color: var(--tool-accent);
  cursor: pointer;
}

/* Boutons d'action formulaire */
.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.form-actions-row {
  display: flex;
  gap: 0.6rem;
}

.form-actions-row .btn {
  flex: 1;
}

/* ============================================
   COLONNE APERÇU
   ============================================ */
.preview-col {
  background: #F0F4FF;
  padding: 1.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.preview-col-header h2 {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* Document aperçu */
.doc-preview {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(15, 27, 45, 0.1), 0 1px 4px rgba(15, 27, 45, 0.06);
  padding: 2.5rem;
  min-height: 800px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.doc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--tool-accent);
}

.doc-emetteur-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0D1117;
  margin-bottom: 0.4rem;
}

.doc-emetteur-info {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.doc-title-block {
  text-align: right;
}

.doc-type-label {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--tool-accent);
  letter-spacing: -0.02em;
  display: block;
}

.doc-number {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-top: 0.2rem;
}

.doc-dates {
  font-size: 0.72rem;
  color: var(--color-text-secondary);
  margin-top: 0.4rem;
  line-height: 1.6;
}

.doc-client-block {
  background: #F5F7FA;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.75rem;
}

.doc-client-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
  margin-bottom: 0.4rem;
}

.doc-client-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: #0D1117;
}

.doc-client-info {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  margin-top: 0.2rem;
}

/* Tableau doc */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-bottom: 1.5rem;
}

.doc-table thead tr {
  background: var(--tool-accent);
}

.doc-table th {
  color: #fff;
  font-weight: 600;
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.doc-table th:last-child,
.doc-table td:last-child {
  text-align: right;
}

.doc-table tbody tr {
  border-bottom: 1px solid #F0F4F8;
}

.doc-table tbody tr:nth-child(even) {
  background: #FAFBFC;
}

.doc-table td {
  padding: 0.6rem 0.75rem;
  color: var(--color-text-secondary);
  vertical-align: top;
}

.doc-table td:first-child {
  color: #0D1117;
  font-weight: 500;
}

/* Récapitulatif totaux */
.doc-totals {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 1.5rem;
}

.doc-totals-table {
  min-width: 260px;
}

.doc-totals-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  font-size: 0.78rem;
  border-bottom: 1px solid #F0F4F8;
  gap: 2rem;
}

.doc-totals-row:last-child {
  border-bottom: none;
}

.doc-totals-row .label {
  color: var(--color-text-secondary);
}

.doc-totals-row .value {
  font-weight: 600;
  color: #0D1117;
}

.doc-totals-row.ttc {
  background: var(--tool-accent-soft);
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  margin-top: 0.4rem;
  font-size: 0.9rem;
}

.doc-totals-row.ttc .value {
  color: var(--tool-accent);
  font-size: 1.1rem;
  font-weight: 800;
}

/* Notes et conditions */
.doc-notes {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  padding: 0.75rem;
  background: #FFFBEB;
  border-left: 3px solid #F59E0B;
  border-radius: 0 6px 6px 0;
  margin-bottom: 1.5rem;
}

.doc-notes strong {
  color: #92400E;
  font-weight: 600;
}

/* Mentions légales doc */
.doc-mentions {
  font-size: 0.68rem;
  color: #A0AEC0;
  line-height: 1.7;
  padding-top: 1.25rem;
  border-top: 1px solid #E2E8F0;
}

.doc-footer-legal {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px dashed #E2E8F0;
  font-size: 0.65rem;
  color: #B0BAC5;
  text-align: center;
}

.doc-watermark-brand {
  margin-top: 1.25rem;
  padding: 0.55rem 0.75rem;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.wm-left {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.62rem;
  color: #94A3B8;
  flex-shrink: 0;
}

.wm-left svg { flex-shrink: 0; color: #CBD5E1; }

.wm-left a {
  color: #64748B;
  font-weight: 700;
  text-decoration: none;
}

.wm-cta-btn {
  flex-shrink: 0;
  background: var(--tool-accent);
  color: #fff !important;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  text-decoration: none !important;
  white-space: nowrap;
  transition: background 0.18s ease;
}

.wm-cta-btn:hover { background: var(--tool-accent-dark); }

/* ============================================
   LOGOS TRUST SECTION
   ============================================ */
.logos-trust {
  background: var(--color-bg-alt, #F5F7FA);
  border-top: 1px solid var(--color-border, #E2E8F0);
  padding: 3.5rem 1.5rem 4rem;
}

.logos-trust-inner {
  max-width: 960px;
  margin: 0 auto;
  text-align: center;
}

.logos-trust-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-secondary, #5B6B7C);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2.5rem;
}

.logos-trust-grid {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.logo-trust-card {
  position: relative;
  width: 140px;
  height: 56px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-trust-blur {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: blur(4px) grayscale(0.9);
  opacity: 0.65;
  transition: filter 0.35s ease, opacity 0.35s ease;
  user-select: none;
  pointer-events: none;
}

.logo-trust-card:hover .logo-trust-blur {
  filter: blur(0px) grayscale(0);
  opacity: 0.9;
}

.logo-trust-chip {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.58rem;
  font-weight: 700;
  color: #fff;
  background: rgba(13,17,23,0.82);
  border-radius: 10px;
  padding: 0.3rem 0.5rem;
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

.logo-trust-card:hover .logo-trust-chip {
  opacity: 1;
  transform: scale(1);
}

.logos-trust-sub {
  font-size: 0.82rem;
  color: var(--color-text-secondary, #5B6B7C);
  margin-bottom: 1rem;
}

.logos-trust-cta {
  margin-top: 0.5rem;
}

.logos-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  padding: 0.7rem 1.4rem;
}

@media (max-width: 600px) {
  .logos-trust-grid {
    gap: 1rem;
  }
  .logo-trust-card {
    width: 110px;
    height: 48px;
  }
}

/* ============================================
   RESPONSIVE MOBILE
   ============================================ */
.mobile-tabs {
  display: none;
}

@media (max-width: 900px) {
  .tool-layout {
    grid-template-columns: 1fr;
  }

  .mobile-tabs {
    display: flex;
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .mobile-tab {
    flex: 1;
    padding: 0.75rem;
    background: none;
    border: none;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color var(--transition-fast), border-color var(--transition-fast);
  }

  .mobile-tab.active {
    color: var(--tool-accent);
    border-bottom-color: var(--tool-accent);
  }

  .form-col,
  .preview-col {
    display: none;
  }

  .form-col.mobile-active,
  .preview-col.mobile-active {
    display: flex;
  }

  .preview-col.mobile-active {
    display: block;
  }
}

@media (max-width: 600px) {
  .field-group {
    grid-template-columns: 1fr;
  }

  .field.span2 {
    grid-column: span 1;
  }

  .field-group.thirds {
    grid-template-columns: 1fr 1fr;
  }

  .doc-preview {
    padding: 1.25rem;
  }

  .form-actions-row {
    flex-direction: column;
  }
}

/* ============================================
   PRINT · masque tout sauf le document
   ============================================ */
@media print {
  .tool-header,
  .mobile-tabs,
  .form-col,
  .preview-col-header,
  .form-actions,
  body > *:not(.tool-page) {
    display: none !important;
  }

  .tool-page,
  .tool-layout {
    display: block !important;
    background: #fff !important;
    min-height: unset !important;
  }

  .preview-col {
    display: block !important;
    padding: 0 !important;
    background: #fff !important;
    overflow: visible !important;
  }

  .doc-preview {
    box-shadow: none !important;
    border-radius: 0 !important;
    padding: 1.5cm !important;
    min-height: unset !important;
  }

  @page {
    size: A4;
    margin: 0;
  }
}

/* ============================================
   SEO CONTENT SECTION
   ============================================ */
.seo-content-section {
  background: #ffffff;
  padding: 5rem 0;
  border-top: 1px solid var(--color-border);
}

.seo-content-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}

.seo-intro h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1.25rem;
  line-height: 1.25;
}

.seo-intro p {
  font-size: 1rem;
  color: var(--color-text-secondary);
  line-height: 1.75;
  margin-bottom: 0.75rem;
}

.seo-features h3,
.seo-faq h3 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1.25rem;
}

.seo-features-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.seo-features-list li {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  line-height: 1.6;
  padding-left: 1.5rem;
  position: relative;
}

.seo-features-list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #1840CC;
  font-weight: 700;
}

.seo-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.seo-faq-item {
  border-bottom: 1px solid var(--color-border);
}

.seo-faq-item:last-child {
  border-bottom: none;
}

.seo-faq-item summary {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
  padding: 1.1rem 1.25rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: #fafafa;
  transition: background 0.15s;
}

.seo-faq-item summary::-webkit-details-marker {
  display: none;
}

.seo-faq-item summary::after {
  content: '+';
  font-size: 1.2rem;
  font-weight: 300;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.seo-faq-item[open] summary::after {
  content: '−';
}

.seo-faq-item summary:hover {
  background: var(--tool-accent-soft);
}

.seo-faq-body {
  padding: 1rem 1.25rem 1.25rem;
  background: #ffffff;
}

.seo-faq-body p {
  font-size: 0.92rem;
  color: var(--color-text-secondary);
  line-height: 1.7;
  margin: 0;
}

/* ============================================
   MODE SWITCH + WIZARD + LOGO + MOVE
   ============================================ */

.mode-switcher {
  display: flex;
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  padding: 0.6rem 1rem;
  gap: 0.5rem;
}
.mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-full);
  background: #fff;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.mode-btn:hover { border-color: var(--tool-accent); color: var(--tool-accent); }
.mode-btn.active { background: var(--tool-accent); border-color: var(--tool-accent); color: #fff; }

.wizard-progress {
  display: none;
  padding: 1.25rem 1.5rem 0.5rem;
}
.wizard-steps-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.6rem;
}
.wizard-dot {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  transition: all 0.2s;
}
.wizard-dot.done { background: var(--tool-accent); border-color: var(--tool-accent); color: #fff; }
.wizard-dot.active { border-color: var(--tool-accent); color: var(--tool-accent); box-shadow: 0 0 0 3px rgba(var(--tool-accent-rgb), 0.15); }
.wizard-line {
  flex: 1; height: 2px;
  background: var(--color-border);
  transition: background 0.2s;
}
.wizard-line.done { background: var(--tool-accent); }
.wizard-label { font-size: 0.78rem; color: var(--color-text-secondary); margin: 0; }
.wizard-label strong { color: var(--color-text); }

.wizard-nav {
  display: none;
  padding: 1rem 1.5rem;
  gap: 0.75rem;
  border-top: 1px solid var(--color-border);
}

/* Guided mode rules */
.tool-page[data-mode="guided"] .wizard-progress { display: block; }
.tool-page[data-mode="guided"] .wizard-nav { display: flex; }
.tool-page[data-mode="guided"] .form-col-header { display: none; }
.tool-page[data-mode="guided"] .form-actions { display: none; }
.tool-page[data-mode="guided"] .mobile-tabs { display: none; }
.tool-page[data-mode="guided"] .accordion { display: none; }
.tool-page[data-mode="guided"] .accordion.wizard-active { display: block; }
.tool-page[data-mode="guided"] .accordion.wizard-active .accordion-header { display: none; }
.tool-page[data-mode="guided"] .accordion.wizard-active .accordion-body {
  display: block !important;
  padding: 1rem 1.5rem 1.5rem;
}
.tool-page[data-mode="guided"][data-wizard-step="4"] .form-col { display: none; }
.tool-page[data-mode="guided"][data-wizard-step="4"] .preview-col { display: flex !important; flex-direction: column; }

.wizard-download-bar {
  display: none;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-bg);
  position: sticky;
  bottom: 0;
}
.wizard-download-bar .btn { flex: 1; justify-content: center; }
.tool-page[data-mode="guided"][data-wizard-step="4"] .wizard-download-bar { display: flex; }

/* Logo upload */
.logo-upload-zone {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem; border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-md); margin-bottom: 1rem;
  background: var(--color-bg-alt);
}
.logo-preview-thumb {
  width: 52px; height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.logo-preview-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-upload-info { flex: 1; }
.logo-upload-label { font-size: 0.8rem; font-weight: 600; color: var(--tool-accent); cursor: pointer; display: inline-block; margin-bottom: 0.2rem; }
.logo-upload-label:hover { text-decoration: underline; }
.logo-upload-hint { font-size: 0.7rem; color: var(--color-text-secondary); margin: 0; }
.logo-remove-btn { font-size: 0.7rem; color: #A8443A; background: none; border: none; cursor: pointer; padding: 0; display: none; margin-top: 0.2rem; }
.logo-remove-btn.visible { display: block; }

/* Move line buttons */
.btn-move-line {
  width: 20px; height: 20px;
  border: 1px solid var(--color-border); border-radius: 3px;
  background: #fff; cursor: pointer; font-size: 0.65rem;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--color-text-secondary); padding: 0;
  transition: background 0.1s;
}
.btn-move-line:hover { background: var(--tool-accent-soft); color: var(--tool-accent); border-color: var(--tool-accent); }
.col-del { min-width: 64px; text-align: center; }

/* ============================================================
   Blocs optionnels de l'apercu
   Actives par les pages qui en ont besoin (facture, bon de commande).
   ============================================================ */

.doc-preview {
  position: relative;
  overflow: hidden;
}

/* Filigrane de fond : chaque outil pose --tool-doc-watermark
   (ex. "'ORIGINALE'"). Sans variable, le pseudo-element n'existe pas. */
.doc-preview::before {
  content: var(--tool-doc-watermark, none);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-35deg);
  font-size: 5rem;
  font-weight: 800;
  color: rgba(var(--tool-accent-rgb), 0.04);
  letter-spacing: 0.15em;
  pointer-events: none;
  white-space: nowrap;
  z-index: 0;
}

.doc-preview > * {
  position: relative;
  z-index: 1;
}

/* Encadre secondaire : mode de reglement (facture), livraison (bon de commande) */
.doc-reglement {
  background: var(--tool-accent-soft);
  border: 1px solid var(--tool-accent-border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 1.5rem;
  font-size: 0.75rem;
}

.doc-reglement-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tool-accent-dark);
  margin-bottom: 0.5rem;
}

.doc-reglement-info {
  color: #33414F;
  line-height: 1.7;
}

/* Penalites de retard : rouge semantique, independant de l'accent */
.doc-penalites {
  font-size: 0.72rem;
  color: #991B1B;
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1.25rem;
  line-height: 1.6;
}

@media print {
  .doc-preview::before {
    color: rgba(var(--tool-accent-rgb), 0.06) !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ============================================================
   Bloc d'opt-in email, injecte par le moteur dans .form-actions
   ============================================================ */
.optin-block {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  margin-bottom: 0.9rem;
  background: var(--tool-accent-soft);
  border: 1px solid var(--tool-accent-border);
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.55;
  color: #33414F;
  cursor: pointer;
  text-align: left;
}

.optin-block input[type="checkbox"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 0.12rem;
  accent-color: var(--tool-accent);
  cursor: pointer;
}

.optin-block a {
  color: var(--tool-accent-dark);
  text-decoration: underline;
}
