/* ==========================================================================
   Crèche Nid d'Anges — couche de design 2027
   Lisibilité, navigation, cohérence des boutons, accessibilité, mobile.

   Ce fichier est chargé en dernier par index.html. Pour revenir exactement à
   l'apparence précédente, il suffit de supprimer la ligne
       <link rel="stylesheet" href="/static/design_2027.css">
   à la fin de index.html. Aucune donnée n'est concernée.
   ========================================================================== */

:root {
  /* Gris secondaire légèrement plus foncé : 6:1 de contraste au lieu de 4,6:1 */
  --muted: #565e6e;
  --text: #262a3a;
  --border: #e4e1f0;
  --focus-ring: 0 0 0 3px rgba(99, 102, 241, 0.45);
  --radius-ctrl: 10px;
}

body {
  font-family: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Chiffres à chasse fixe : les horaires et les totaux s'alignent en colonne */
table, .kpi-val, .week-chip-top, .day-shift-card, input[type="number"], input[type="time"], input[type="date"] {
  font-variant-numeric: tabular-nums;
}

@media screen {

  /* ------------------------------------------------------------------------
     1. LISIBILITÉ — taille plancher des textes
     70 % des textes faisaient moins de 13 px (jusqu'à 9,6 px). Les tailles
     écrites directement dans le HTML sont relevées vers 12,2 à 13,1 px.
     ------------------------------------------------------------------------ */
  [style*="font-size:0.6"], [style*="font-size: 0.6"],
  [style*="font-size:9px"], [style*="font-size:9.5px"], [style*="font-size:10px"] {
    font-size: 0.76rem !important;
  }
  [style*="font-size:0.7rem"], [style*="font-size: 0.7rem"],
  [style*="font-size:0.71"], [style*="font-size:0.72"], [style*="font-size:0.73"],
  [style*="font-size: 0.71"], [style*="font-size: 0.72"], [style*="font-size: 0.73"] {
    font-size: 0.8rem !important;
  }
  [style*="font-size:0.74"], [style*="font-size:0.75"], [style*="font-size:0.76"], [style*="font-size:0.77"],
  [style*="font-size: 0.74"], [style*="font-size: 0.75"], [style*="font-size: 0.76"], [style*="font-size: 0.77"] {
    font-size: 0.82rem !important;
  }

  header p { font-size: 0.85rem; }
  .week-chip-top { font-size: 0.8rem; }
  .week-chip-dates { font-size: 0.72rem; }
  .parity-dot, .dirty-tag { font-size: 0.68rem; }
  .kpi-title { font-size: 0.78rem; }
  .kpi-sub { font-size: 0.84rem; }
  .emp-role-tag { font-size: 0.74rem; }
  .cat-pill { font-size: 0.76rem; }
  .cal-pill { font-size: 0.8rem; }
  .halfday-table { font-size: 0.8rem; }
  .cal-grid-table th, .cal-grid-table td { font-size: 0.76rem; }
  .emp-check-item { font-size: 0.84rem; }
  .shift-dur-sub { font-size: 0.8rem; }
  .table-header { font-size: 0.8rem; }
  /* Planning : étiquettes de section, détails des créneaux, légende, frise */
  .sec-tag { font-size: 0.76rem; }
  .coupure-pill-vivid { font-size: 0.76rem; }
  .legend-item { font-size: 0.82rem; }
  .month-group-title { font-size: 0.76rem; }
  .week-chip-dates { font-size: 0.74rem; }
  td small, td small strong { font-size: 0.78rem; }

  /* ------------------------------------------------------------------------
     2. NAVIGATION — les 13 onglets visibles d'un coup, regroupés, et toujours
     accessibles en faisant défiler la page (barre collante).
     Avant : une seule ligne coupée à droite avec une barre de défilement.
     ------------------------------------------------------------------------ */
  .nav-tabs {
    flex-wrap: wrap;
    overflow-x: visible;
    gap: 0.1rem 0.2rem;
    padding: 0.3rem 1.5rem 0;
    position: sticky;
    top: 0;
    z-index: 60;
    box-shadow: 0 6px 14px -10px rgba(15, 23, 42, 0.25);
  }
  .nav-tab {
    font-size: 0.88rem;
    padding: 0.6rem 0.85rem;
    border-radius: 10px 10px 0 0;
  }
  /* Ordre logique sans toucher au HTML :
     Planning | Équipe & RH | Paie & conformité */
  #tabBtn-planning    { order: 1; }
  #tabBtn-validations { order: 2; }
  #tabBtn-couverture  { order: 3; }
  #tabBtn-calendrier  { order: 4; }
  #tabBtn-enfants     { order: 5; }
  #tabBtn-presences   { order: 6; }
  #tabBtn-salaries    { order: 11; }
  #tabBtn-entretiens  { order: 12; }
  #tabBtn-formations  { order: 13; }
  #tabBtn-dossiers    { order: 14; }
  #tabBtn-bulletins   { order: 21; }
  #tabBtn-factures    { order: 22; }
  #tabBtn-veille      { order: 23; }
  #tabBtn-sauvegardes { order: 24; }
  #tabBtn-historique  { order: 25; }
  #tabBtn-salaries, #tabBtn-bulletins { margin-left: 1rem; position: relative; }
  #tabBtn-salaries::before, #tabBtn-bulletins::before {
    content: ""; position: absolute; left: -0.6rem; top: 25%; height: 50%; width: 1px;
    background: #d4d0e6;
  }

  /* ------------------------------------------------------------------------
     3. BOUTONS ET CHAMPS — une seule famille, cibles cliquables plus larges
     ------------------------------------------------------------------------ */
  .btn {
    min-height: 34px;
    border-radius: var(--radius-ctrl);
    font-size: 0.84rem;
    line-height: 1.2;
  }
  .btn-outline { border-width: 1px; border-color: #c9cdd8; }
  .btn-outline:hover { border-color: #a5a9e8; background: #f7f6ff; }
  select, input[type="text"], input[type="number"], input[type="date"], input[type="time"], input[type="email"], input[type="password"], textarea {
    border-radius: 8px;
    min-height: 32px;
  }

  /* Focus clavier visible partout (accessibilité) */
  :focus-visible { outline: none; box-shadow: var(--focus-ring) !important; }
  select:focus-visible, input:focus-visible, textarea:focus-visible { border-color: #6366f1 !important; }

  /* ------------------------------------------------------------------------
     4. BARRES DE DÉFILEMENT discrètes (frise des semaines, tableaux larges)
     ------------------------------------------------------------------------ */
  * { scrollbar-width: thin; scrollbar-color: #cbc6e6 transparent; }
  ::-webkit-scrollbar { width: 10px; height: 9px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: #d3cfe9; border-radius: 999px;
    border: 2px solid transparent; background-clip: padding-box;
  }
  ::-webkit-scrollbar-thumb:hover { background-color: #aaa4d8; }

  /* ------------------------------------------------------------------------
     5. EN-TÊTE — plus compact, actions alignées
     ------------------------------------------------------------------------ */
  header { padding: 0.7rem 1.5rem; }
  #portalTopSessionBar { gap: 0.4rem !important; }
  .hdr-role-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    padding: 0.38rem 0.8rem; border-radius: 999px; font-size: 0.84rem; font-weight: 800;
    border: 1px solid rgba(0, 0, 0, 0.08); max-width: 320px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .hdr-btn { border-radius: 999px !important; }

  /* ------------------------------------------------------------------------
     6. TABLEAUX — en-têtes lisibles, lignes repérables au survol
     ------------------------------------------------------------------------ */
  #closuresTableBody tr:hover td,
  #calSoldesBody tr:hover td { background: #faf9ff; }
}

/* ------------------------------------------------------------------------
   7. MOBILE — espace salariée et en-tête sur téléphone
   Avant : les 7 rubriques de l'espace salariée étaient empilées sur ~700 px
   avant le premier contenu. Elles deviennent une rangée défilante.
   ------------------------------------------------------------------------ */
@media screen and (max-width: 640px) {
  header { padding: 0.6rem 0.9rem; gap: 0.5rem; }
  header h1 { font-size: 1.1rem; }
  header p { font-size: 0.8rem; }
  .brand-icon { width: 36px; height: 36px; font-size: 1.25rem; }
  .hdr-role-pill { max-width: 100%; font-size: 0.82rem; }
  #portalTopSessionBar .btn { padding: 0.4rem 0.75rem !important; min-height: 38px; }
  .container { padding: 0.75rem 0.75rem 2rem; }

  .emp-portal-nav {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    padding: 0.4rem !important;
    gap: 0.3rem !important;
    position: sticky; top: 0; z-index: 30;
    box-shadow: 0 6px 14px -10px rgba(15, 23, 42, 0.3);
  }
  .emp-tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align: start;
    min-height: 42px;
  }
  .nav-tab { font-size: 0.84rem; padding: 0.55rem 0.7rem; }
  #tabBtn-salaries, #tabBtn-bulletins { margin-left: 0; }
  #tabBtn-salaries::before, #tabBtn-bulletins::before { display: none; }
}

/* Moins d'animations pour les personnes qui l'ont demandé dans leur système */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Module Présences & taux CAF (30/11/2026) */
@media screen and (max-width: 980px) {
  .pres-grid { grid-template-columns: minmax(0, 1fr) !important; }
}
