/* Automatec Gestion Affaires v7.42
 * Finition de la palette grise et vrais boutons secondaires contextuels.
 * Cette feuille est volontairement chargee APRES les styles des trois themes.
 * Aucun impact sur les couleurs metier (boutons principaux, alertes, badges).
 */

/* Mode gris : fond intermediaire et surfaces grises, sans superposition blanche. */
html[data-theme-variant="gray"] {
  --bg: #c6cfdb;
  --bg-soft: #cbd5e1;
  --surface: #dce3ec;
  --surface-2: #d2dce7;
  --surface-3: #c7d2df;
  --border: #94a3b7;
  --border-soft: #a6b3c5;
  --input: #e6ecf4;
  --panel: #dce3ec;
  --panel-2: #d2dce7;
  --block-head-bg: #cbd6e4;
  --note-bg: #d0dbe8;
  --shadow: 0 3px 10px rgba(26,42,64,.10);
  --secondary: #52677f;
}

/* Specificite renforcee : des composants sont forces en blanc par les
 * correctifs historiques data-theme="light" dont le gris herite. */
html[data-theme="light"][data-theme-variant="gray"] .app-content-shell .app-breadcrumb,
html[data-theme="light"][data-theme-variant="gray"] .card,
html[data-theme="light"][data-theme-variant="gray"] .project-section,
html[data-theme="light"][data-theme-variant="gray"] .quote-kpi-icons .kpi,
html[data-theme="light"][data-theme-variant="gray"] .structure-card,
html[data-theme="light"][data-theme-variant="gray"] .inner-card,
html[data-theme="light"][data-theme-variant="gray"] .collapsible-card {
  background-color: var(--surface) !important;
  border-color: var(--border) !important;
  box-shadow: var(--shadow);
}
html[data-theme="light"][data-theme-variant="gray"] .inner-card {
  background-color: var(--surface-2) !important;
  box-shadow: none;
}
html[data-theme="light"][data-theme-variant="gray"] .app-content-shell .app-breadcrumb,
html[data-theme="light"][data-theme-variant="gray"] .structure-card {
  border-color: var(--border) !important;
}
/* Panneaux d'informations et blocs : conserver l'accent metier mais
 * rendre la separation visible sur fond gris. */
html[data-theme="light"][data-theme-variant="gray"] .quote-options-summary .kpi {
  background: linear-gradient(180deg,#dbd9d6,#d2d9e2) !important;
  border-color: #a99571 !important;
}
html[data-theme="light"][data-theme-variant="gray"] .chapter-workspace-global-totals,
html[data-theme="light"][data-theme-variant="gray"] .chapter-workspace-top-total,
html[data-theme="light"][data-theme-variant="gray"] .chapter-workspace-bottom-total,
html[data-theme="light"][data-theme-variant="gray"] .summary-triple {
  background: var(--surface-2) !important;
  border-color: var(--border) !important;
}
html[data-theme="light"][data-theme-variant="gray"] body.page-theme-chiffrage .readonly-block-head,
html[data-theme="light"][data-theme-variant="gray"] body.page-theme-chiffrage .block-head-form {
  background: #d5cee7 !important;
  border-color: #ab9ac5 !important;
}
html[data-theme="light"][data-theme-variant="gray"] body.page-theme-chiffrage .readonly-chapter-heading,
html[data-theme="light"][data-theme-variant="gray"] body.page-theme-chiffrage .chapter-heading-edit {
  border-color: #9885bc !important;
  box-shadow: 0 2px 7px rgba(65,46,90,.12);
}

/* Boutons secondaires : teintes et contrastes adaptes a chaque theme.
 * Pas de changement des actions principales, rouges, ou des boutons de statut. */
html[data-theme-variant="light"] { --secondary: #dce5ef; }
html[data-theme-variant="gray"]  { --secondary: #52677f; }
html[data-theme-variant="dark"]  { --secondary: #2e4057; }

html[data-theme-variant="light"] :is(a.button.secondary, button.secondary),
html[data-theme-variant="gray"] :is(a.button.secondary, button.secondary),
html[data-theme-variant="dark"] :is(a.button.secondary, button.secondary) {
  background: var(--secondary) !important;
  border: 1px solid transparent;
  transition: background-color .15s ease,border-color .15s ease,color .15s ease;
}
html[data-theme-variant="light"] :is(a.button.secondary, button.secondary) {
  color: #26364c !important;
  border-color: #b6c4d7 !important;
}
html[data-theme-variant="light"] :is(a.button.secondary, button.secondary):hover {
  background: #cbd8e8 !important;
  color: #172a45 !important;
  border-color: #93a8c1 !important;
}
html[data-theme-variant="gray"] :is(a.button.secondary, button.secondary) {
  color: #f8fbff !important;
  border-color: #41546c !important;
}
html[data-theme-variant="gray"] :is(a.button.secondary, button.secondary):hover {
  background: #41546b !important;
  border-color: #36495e !important;
  color: #fff !important;
}
html[data-theme-variant="dark"] :is(a.button.secondary, button.secondary) {
  color: #edf4ff !important;
  border-color: #425673 !important;
}
html[data-theme-variant="dark"] :is(a.button.secondary, button.secondary):hover {
  background: #425774 !important;
  border-color: #59708f !important;
  color: #fff !important;
}
/* Sur les formulaires les actions secondaires peuvent etre des <button>
 * sans classe .button : la regle ci-dessus les couvre egalement. */
html[data-theme-variant] :is(a.button.secondary,button.secondary):focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
