/* V6.99.108 — Confort visuel : fond moins éblouissant.
   Trois niveaux choisis par l'utilisateur (bouton ☀️ de l'en-tête), mémorisés sur l'appareil :
     standard  : rendu d'origine
     doux      : (défaut) fonds et cartes légèrement grisés, luminosité -3 %
     tres-doux : ambiance tamisée pour les écrans très lumineux, luminosité -8 %
   S'applique uniquement à l'écran : les impressions ne sont jamais modifiées. */

@media screen {
  html[data-confort="doux"] {
    --bg: #e8ece7;          /* fond de page */
    --card: #f6f7f3;        /* cartes, panneaux */
    --gdl-surface: #f6f7f3;
    --gdl-surface-2: #eef1ec;
    --gdl-header: #f1f3ef;
    --gdl-input: #fbfbf8;
    --gdl-line: #d9dfd8;
    --border: #d9dfd8;
    filter: brightness(.97);
    background: #e8ece7;
  }
  html[data-confort="tres-doux"] {
    --bg: #dadfd9;
    --card: #eceee9;
    --gdl-surface: #eceee9;
    --gdl-surface-2: #e3e7e1;
    --gdl-header: #e6e9e3;
    --gdl-input: #f3f4ef;
    --gdl-line: #cbd2ca;
    --border: #cbd2ca;
    filter: brightness(.92);
    background: #dadfd9;
  }

  /* Fond général */
  html[data-confort="doux"] body,
  html[data-confort="tres-doux"] body,
  html[data-confort="doux"] .auth-screen,
  html[data-confort="tres-doux"] .auth-screen {
    background-color: var(--bg) !important;
  }
  html[data-confort="doux"] .module-home,
  html[data-confort="tres-doux"] .module-home,
  html[data-confort="doux"] .site-home,
  html[data-confort="tres-doux"] .site-home,
  html[data-confort="doux"] .auth-screen,
  html[data-confort="tres-doux"] .auth-screen {
    background-image: none !important;
    background-color: var(--bg) !important;
  }

  /* En-tête */
  html[data-confort="doux"] .global-app-header,
  html[data-confort="tres-doux"] .global-app-header,
  html[data-confort="doux"] body > header,
  html[data-confort="tres-doux"] body > header {
    background: var(--gdl-header) !important;
    border-bottom-color: var(--gdl-line) !important;
  }

  /* Cartes, panneaux, fenêtres */
  html[data-confort="doux"] :is(.card, .child-info-card, .docs-card, .smart-panel, .site-home-card, .lock-card,
    .portal-choice, .modal-box, .modalbox, .global-dropdown, .global-site-menu),
  html[data-confort="tres-doux"] :is(.card, .child-info-card, .docs-card, .smart-panel, .site-home-card, .lock-card,
    .portal-choice, .modal-box, .modalbox, .global-dropdown, .global-site-menu) {
    background-color: var(--gdl-surface) !important;
    border-color: var(--gdl-line) !important;
  }
  html[data-confort="doux"] .smart-news-row,
  html[data-confort="tres-doux"] .smart-news-row {
    background-color: var(--gdl-surface-2) !important;
  }

  /* Champs de saisie : restent les plus clairs pour rester lisibles */
  html[data-confort="doux"] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea),
  html[data-confort="tres-doux"] :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]), select, textarea) {
    background-color: var(--gdl-input);
  }

  /* Tableaux : lignes blanches adoucies */
  html[data-confort="doux"] :is(table, tbody, tr, td),
  html[data-confort="tres-doux"] :is(table, tbody, tr, td) {
    border-color: var(--gdl-line);
  }
}

/* Bouton de réglage */
.gdl-confort-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 42px; height: 42px;
  border: 1px solid #dfe6e1; border-radius: 999px; background: transparent; cursor: pointer; font-size: 18px; padding: 0 10px; }
.gdl-confort-btn:hover { background: rgba(47, 133, 90, .08); }
.gdl-confort-btn .gdl-confort-label { font-size: 12px; font-weight: 700; color: #1f4d3a; }
.gdl-confort-float { position: fixed; right: 14px; top: 14px; z-index: 9000; background: rgba(255, 255, 255, .7); }
@media (max-width: 720px) { .gdl-confort-btn .gdl-confort-label { display: none; } }
@media print { .gdl-confort-btn { display: none !important; } }
