/* ============================================================
   Gatech ERP — charte graphique du bureau (Frappe v16)
   Thème UNIQUE pour tous les comptes (validé par M. CHAFOUI 14/11).
   Méthode : surcharge des VARIABLES Frappe sur :root + quelques
   règles ciblées (listes, en-têtes, états de validation).
   AUCUNE modification de fonctionnalité : purement visuel.
   ============================================================ */
:root{
  /* ---- Variables réelles de Frappe v16 : on les repeint ---- */
  --desk-sidebar-bg:#243247 !important;   /* menu latéral principal */
  --bg-color:#E4E9F1 !important;          /* fond général */
  --fg-color:#E9EDF4 !important;          /* surfaces/cartes : plus de blanc pur */
  --card-bg:#E9EDF4 !important;
  --subtle-fg:#DDE4EE !important;
  --control-bg:#DFE5EE !important;        /* champs de saisie/recherche */
  --control-bg-on-gray:#DFE5EE !important;
  --disabled-control-bg:#DDE4EE !important;
  --border-color:#CBD5E1 !important;
  --dark-border-color:#CBD5E1 !important;
  --text-color:#172334 !important;        /* texte principal */
  --heading-color:#172334 !important;
  --text-muted:#475569 !important;        /* texte secondaire */
  --text-light:#64748B !important;
  --primary:#2563EB !important;
  --primary-color:#2563EB !important;
  --btn-primary:#2563EB !important;
  --text-on-primary:#ffffff !important;

  /* ---- Jetons de la charte (réutilisables) ---- */
  --gt-sidebar:#243247; --gt-sidebar-active:#31548D;
  --gt-table-bg:#E9EDF4; --gt-row-alt:#DDE4EE; --gt-thead:#D5DEEA;
  --gt-field:#DFE5EE; --gt-border:#CBD5E1;
  --gt-text:#172334; --gt-text2:#475569;
  --gt-btn:#2563EB; --gt-ok:#15803D; --gt-no:#B91C1C;
  /* États de validation */
  --gt-attente-bg:#CFD9E8; --gt-refus-bg:#F3DCDD;
}

/* ============ Police Inter (déjà fournie par Frappe v16) ============ */
body, .page-container, .navbar, .modal, input, select, textarea, button,
.list-row, .form-control{
  font-family:"Inter","Segoe UI",system-ui,-apple-system,Arial,sans-serif !important;
}

/* ============ Fond général (sans blanc pur) ============ */
body, .main-section, .page-body, .layout-main,
.layout-main-section-wrapper{ background-color:var(--gt-bg,#E4E9F1) !important; }
.layout-main-section, .form-page, .page-form,
.frappe-list .result, .report-wrapper{ background-color:var(--gt-table-bg) !important; }

/* ============ Menu latéral : bleu nuit, texte clair ============ */
.body-sidebar, .body-sidebar *{ color:#D7DEEA !important; --icon-stroke:#D7DEEA !important; }
/* Les icônes « au trait » du menu suivent --icon-stroke (pas la couleur du texte) : on la force en clair.
   Les icônes « pleines » gardent leur propre --icon-stroke (transparent), donc pas de contour parasite. */
.body-sidebar{ --icon-stroke:#D7DEEA !important; }

/* ============ Petite barre d'icônes « dock » (modules, tout à gauche) ============
   Élément SÉPARÉ du menu principal → à thémer à part, sinon icônes illisibles. */
.dock, body.dock-pinned .dock, body.dock-open .dock{
  background:#243247 !important;
  --dock-bg:#243247 !important;
  --dock-ink:#D7DEEA !important;          /* couleur des icônes (via currentColor) */
  --dock-ink-strong:#ffffff !important;   /* logo + icône active */
  --dock-rule:rgba(255,255,255,.15) !important;
  --dock-tile-active:#31548D !important;
}
.dock .dock-item{ color:#D7DEEA !important; }
.dock .dock-item:hover, .dock .dock-item:focus-visible{ background:#2C3F5C !important; color:#ffffff !important; }
.dock .dock-item.active{ background:#31548D !important; color:#ffffff !important; }

/* ============ Menu principal : plus large + lignes aérées (demande 15/11) ============ */
/* Largeur élargie UNIQUEMENT sur écran large (desktop). Sur mobile/tablette (<992px),
   on NE force PAS la largeur : sinon la sidebar reste à 290px et recouvre les options
   sur téléphone (bug signalé 24/11). On laisse Frappe la replier nativement. */
@media (min-width:992px){
  :root, .body-sidebar{ --sidebar-width:290px !important; }
}
/* Mobile (<768px) : Frappe fait de la sidebar un tiroir hors-écran, transparent quand il est fermé.
   Notre fond navy forcé (.body-sidebar) écrasait ce transparent et laissait le tiroir fermé VISIBLE,
   recouvrant les options (bug téléphone 24/11). On rend le tiroir fermé transparent et inerte. */
@media (max-width:767.98px){
  .body-sidebar-container:not(.expanded) .body-sidebar{
    background:transparent !important;
    border-right-color:transparent !important;
    pointer-events:none !important;
  }
}
.body-sidebar .sidebar-items, .body-sidebar .sidebar-item-container{ padding-right:4px; }
.body-sidebar .standard-sidebar-item{ margin-bottom:4px; }
.body-sidebar .standard-sidebar-item .item-anchor{ padding-top:7px !important; padding-bottom:7px !important; min-height:34px; }
.body-sidebar .sidebar-item-label{ line-height:1.3 !important; white-space:normal !important; }
.body-sidebar .sidebar-group-title, .body-sidebar .standard-sidebar-section{ margin-top:6px; }
.body-sidebar{ background:var(--gt-sidebar) !important; }
/* Icônes du menu : lisibles (blanc cassé) SANS effacer les icônes « pleines ».
   On ne force PLUS fill:none (c'était ça qui rendait les icônes invisibles). */
.body-sidebar svg, .body-sidebar svg *, .body-sidebar .es-icon, .body-sidebar .icon,
.standard-sidebar svg, .standard-sidebar svg *, .standard-sidebar .es-icon, .standard-sidebar .icon,
.list-sidebar svg, .list-sidebar svg *{
  color:#D7DEEA !important;
}
.body-sidebar [fill]:not([fill="none"]),
.standard-sidebar [fill]:not([fill="none"]),
.list-sidebar [fill]:not([fill="none"]){ fill:#D7DEEA !important; }
.body-sidebar [stroke]:not([stroke="none"]),
.standard-sidebar [stroke]:not([stroke="none"]),
.list-sidebar [stroke]:not([stroke="none"]){ stroke:#D7DEEA !important; }
/* Élément actif / survol */
.body-sidebar .standard-sidebar-item.active-sidebar,
.body-sidebar .standard-sidebar-item.active-sidebar > .item-anchor{
  background-color:var(--gt-sidebar-active) !important; color:#fff !important; border-radius:8px;
}
.body-sidebar .standard-sidebar-item:hover,
.body-sidebar .standard-sidebar-item:not(.active-sidebar):has(a:not(.section-break)):hover{
  background-color:#2C3F5C !important; color:#fff !important; border-radius:8px;
}
.body-sidebar .app-logo, .body-sidebar .navbar-brand img{ height:26px; width:auto; }

/* Titres de module longs : afficher en entier + ne pas couper */
.body-sidebar .sidebar-item-label,
.body-sidebar .standard-sidebar-item .sidebar-item-label{
  white-space:normal !important; overflow:visible !important; text-overflow:clip !important;
  line-height:1.25; word-break:break-word; font-size:14px; font-weight:500;
}
.body-sidebar .standard-sidebar-item,
.body-sidebar .standard-sidebar-item .item-anchor{
  height:auto !important; min-height:28px; align-items:center;
}

/* ============ Barre du haut (navbar) ============ */
.navbar{ background-color:#EDF1F7 !important; border-bottom:1px solid var(--gt-border) !important; }

/* ============ Titres ============ */
.page-head .title-text, .page-title .title-text, h1.ellipsis{
  font-size:22px !important; font-weight:600 !important; color:var(--gt-text) !important;
}
.form-section .section-head, .section-head{ font-size:18px !important; font-weight:600 !important; }

/* ============ Champs & filtres : gris, jamais blanc ============ */
.form-control, .input-with-feedback, .like-disabled-input,
.awesomplete input, .frappe-control input, .form-control:focus{
  background-color:var(--gt-field) !important; border:1px solid var(--gt-border) !important;
  color:var(--gt-text) !important; border-radius:7px !important;
}
.filter-box .form-control, .standard-filter-section .form-control{
  background-color:var(--gt-field) !important;
}

/* ============ Boutons ============ */
.btn{ font-size:14px !important; font-weight:600 !important; border-radius:7px !important; }
.btn-primary, .btn.btn-primary, .primary-action{
  background-color:var(--gt-btn) !important; border-color:var(--gt-btn) !important; color:#fff !important;
}
.btn-primary:hover, .btn-primary:focus, .primary-action:hover{
  background-color:#1D4ED8 !important; border-color:#1D4ED8 !important;
}
.btn-default, .btn-secondary{
  background-color:var(--gt-field) !important; border:1px solid var(--gt-border) !important; color:var(--gt-text) !important;
}
.btn-default:hover, .btn-secondary:hover{ background-color:#D2DCEA !important; }

/* ============ Listes & tableaux ============ */
.list-row-head, .report-wrapper .dt-row-header, .dt-header{
  background-color:var(--gt-thead) !important; color:var(--gt-text) !important;
  font-size:14px !important; font-weight:600 !important; border-bottom:1px solid var(--gt-border) !important;
}
.frappe-list .list-row-container{ border-bottom:1px solid var(--gt-border) !important; }
.list-row, .frappe-list .list-row{
  background-color:var(--gt-table-bg) !important; min-height:40px; font-size:14px !important;
  color:var(--gt-text2) !important;
}
.frappe-list .list-row-container:nth-child(even) .list-row{
  background-color:var(--gt-row-alt) !important;
}
.frappe-list .list-row-container:hover .list-row{
  background-color:#D2DCEA !important;
}
.list-row .level-left .list-subject, .list-row .bold, .list-subject .ellipsis{
  font-weight:600 !important; color:var(--gt-text) !important;
}
/* Datatable (rapports) : lignes espacées, en-têtes clairs */
.dt-cell{ background-color:var(--gt-table-bg) !important; }
.dt-row:nth-child(even) .dt-cell{ background-color:var(--gt-row-alt) !important; }

/* ============ Indicateurs / statuts (libellé TOUJOURS visible) ============ */
.indicator-pill, .indicator-pill span{ font-size:13px !important; font-weight:500 !important; }

/* ============ ÉTATS DE VALIDATION (lignes tagguées par le JS) ============
   Règle : priorité visuelle à ce qui demande une action.
   - À valider / en attente  -> plus foncé, gras (pastille orange)
   - Anomalie / refusé        -> fond légèrement rouge
   - Validé                   -> apparence normale (déjà traité, discret) */
.list-row-container.fl-attente .list-row{ background-color:var(--gt-attente-bg) !important; }
.list-row-container.fl-attente .list-subject .ellipsis,
.list-row-container.fl-attente .bold{ font-weight:600 !important; color:var(--gt-text) !important; }
.list-row-container.fl-refus .list-row{ background-color:var(--gt-refus-bg) !important; }
.list-row-container.fl-refus .list-subject .ellipsis{ color:var(--gt-text) !important; }
/* Variante tableau de rapport */
.dt-row.fl-attente .dt-cell{ background-color:var(--gt-attente-bg) !important; }
.dt-row.fl-refus .dt-cell{ background-color:var(--gt-refus-bg) !important; }
