/* Automatec Gestion Affaires v7.29 — corrections exclusives au mode clair.
   Aucun sélecteur ne s'applique à html[data-theme="dark"].
   La navigation latérale et la barre haute conservent volontairement leur
   apparence sombre dans le thème clair, comme dans les versions antérieures. */

html[data-theme="light"] {
  /* Certaines vues historiques utilisent --panel / --panel-2 sans les déclarer.
     Le navigateur retombait alors sur des fonds bleu nuit (#111827/#172236),
     tandis que les textes prenaient les couleurs du thème clair. */
  --panel: #fff;
  --panel-2: #f1f5f9;
}

/* Fil d'Ariane lisible sur toutes les pages, y compris Devis et Fournisseurs. */
html[data-theme="light"] .app-content-shell .app-breadcrumb {
  background: #f8fafc;
  border-color: #cbd5e1;
}
html[data-theme="light"] .app-content-shell .app-breadcrumb a {
  color: #475569;
}
html[data-theme="light"] .app-content-shell .app-breadcrumb > span:last-child {
  color: #172033;
}
html[data-theme="light"] .app-content-shell .app-breadcrumb .crumb-sep {
  color: #64748b;
  opacity: 1;
}

/* Les statuts héritaient d'un fond foncé et du texte sombre des tags clairs. */
html[data-theme="light"] .tag.status-brouillon {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}
html[data-theme="light"] .tag.status-active {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}
html[data-theme="light"] .tag.status-obsolete {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}
html[data-theme="light"] .tag.status-wait {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Chiffrage : en mode clair les bandeaux de chapitres doivent être CLAIRS.
   On ne touche pas aux couleurs violet foncé du mode sombre. */
html[data-theme="light"] body.page-theme-chiffrage {
  --chapter-bg-start: #ede9fe;
  --chapter-bg-end: #ddd6fe;
  --chapter-border: #a78bfa;
  --block-head-bg: #f5f3ff;
}
html[data-theme="light"] body.page-theme-chiffrage .readonly-chapter-heading,
html[data-theme="light"] body.page-theme-chiffrage .chapter-heading-edit {
  color: #312e81 !important;
  border-color: #c4b5fd !important;
  box-shadow: 0 2px 8px rgba(91,33,182,.08);
}
html[data-theme="light"] body.page-theme-chiffrage .readonly-chapter-heading h2,
html[data-theme="light"] body.page-theme-chiffrage .chapter-heading-edit h2,
html[data-theme="light"] body.page-theme-chiffrage .chapter-heading-edit .chapter-number,
html[data-theme="light"] body.page-theme-chiffrage .chapter-heading-edit .chapter-subtotal,
html[data-theme="light"] body.page-theme-chiffrage .chapter-heading-edit .chapter-option-check {
  color: #312e81 !important;
}
html[data-theme="light"] body.page-theme-chiffrage .chapter-heading-edit .chapter-title-input {
  background: #fff !important;
  border-color: #c4b5fd !important;
  color: #312e81 !important;
}

/* Les chapitres Option utilisent une autre couleur : ambre clair + texte foncé. */
html[data-theme="light"] body.page-theme-chiffrage .option-chapter .readonly-chapter-heading,
html[data-theme="light"] body.page-theme-chiffrage .option-chapter .chapter-heading-edit {
  background: linear-gradient(90deg,#fef3c7,#fde68a) !important;
  border-color: #f59e0b !important;
  color: #78350f !important;
}
html[data-theme="light"] body.page-theme-chiffrage .option-chapter .readonly-chapter-heading h2,
html[data-theme="light"] body.page-theme-chiffrage .option-chapter .chapter-heading-edit .chapter-number,
html[data-theme="light"] body.page-theme-chiffrage .option-chapter .chapter-heading-edit .chapter-subtotal,
html[data-theme="light"] body.page-theme-chiffrage .option-chapter .chapter-option-check {
  color: #78350f !important;
}

/* Totaux des blocs/chapitres et récapitulatif dans la popup.
   Les anciens fallback #172236 étaient illisibles en thème clair. */
html[data-theme="light"] .summary-triple,
html[data-theme="light"] .chapter-workspace-global-totals,
html[data-theme="light"] .chapter-workspace-top-total,
html[data-theme="light"] .chapter-workspace-bottom-total {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #172033;
}
html[data-theme="light"] .summary-triple > div,
html[data-theme="light"] .chapter-workspace-global-totals > div {
  border-color: #d5dce6;
}
html[data-theme="light"] .summary-triple span,
html[data-theme="light"] .chapter-workspace-global-totals span,
html[data-theme="light"] .chapter-workspace-top-total span,
html[data-theme="light"] .chapter-workspace-bottom-total span {
  color: #475569;
}
html[data-theme="light"] .summary-triple b,
html[data-theme="light"] .chapter-workspace-global-totals b,
html[data-theme="light"] .chapter-workspace-top-total b,
html[data-theme="light"] .chapter-workspace-bottom-total b {
  color: #0f172a;
}
html[data-theme="light"] .summary-triple .summary-grand,
html[data-theme="light"] .chapter-workspace-global-totals .quote-grand-total {
  background: #e9d5ff;
}
html[data-theme="light"] .summary-triple .summary-grand b,
html[data-theme="light"] .chapter-workspace-global-totals .quote-grand-total b {
  color: #581c87;
}

/* Champ Option, titre et tableaux dans l'éditeur des devis. */
html[data-theme="light"] .chapter-workspace-option-form .check {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}
html[data-theme="light"] body.page-theme-chiffrage .readonly-block-head,
html[data-theme="light"] body.page-theme-chiffrage .block-head-form {
  background: #f5f3ff !important;
  border-color: #e9d5ff;
}
html[data-theme="light"] body.page-theme-chiffrage .readonly-block-head h3,
html[data-theme="light"] body.page-theme-chiffrage .block-number,
html[data-theme="light"] body.page-theme-chiffrage .block-total {
  color: #1e1b4b !important;
}

/* Lisibilité des résultats de recherche, tableaux et badges de sections. */
html[data-theme="light"] .activity-category-bl,
html[data-theme="light"] .activity-category-fin_chantier {
  color: #334155;
}
html[data-theme="light"] .match.exact { color: #1d4ed8; }
html[data-theme="light"] .match.normalized { color: #6d28d9; }
html[data-theme="light"] .compare-badge.added { color: #166534; }
html[data-theme="light"] .compare-badge.changed { color: #1d4ed8; }
html[data-theme="light"] .compare-badge.removed { color: #b91c1c; }
html[data-theme="light"] .delta-positive { color: #15803d; }
html[data-theme="light"] .delta-negative { color: #b91c1c; }
html[data-theme="light"] .article-status-badge.active,
html[data-theme="light"] .supplier-import-state.ok { color: #166534; }
html[data-theme="light"] .quote-file-context-menu .context-danger { color: #b91c1c; }
html[data-theme="light"] .client-form-modal .contact-modal-error { color: #b91c1c; }

/* Exception volontaire : le sous-menu latéral reste foncé car ses libellés
   sont blancs et il prolonge une barre latérale foncée, même en mode clair. */
html[data-theme="light"] .sidebar-flyout {
  background: #101827;
  border-color: #334155;
}

/* Les valeurs KPI du devis sont imbriquées dans un <span> héritant de la teinte
   secondaire : augmenter le contraste des chiffres sans foncer les libellés. */
html[data-theme="light"] .quote-kpi-grid .quote-kpi-copy > b {
  color: #172033;
}
html[data-theme="light"] .quote-kpi-grid .quote-kpi-copy > span,
html[data-theme="light"] .quote-kpi-grid .quote-kpi-copy > small {
  color: #475569;
}
