/* gang-manager — identité « Graphite » (docs/conception.md).

   Chargée après style.css, dont elle redéfinit les jetons et précise les composants.
   Un outil de travail quotidien, lu en quelques secondes :
   - des neutres graphite froids, une seule couleur d'accent (sarcelle) réservée au
     focus, à la sélection et à ce qui est en cours ;
   - l'action principale est un aplat d'encre, les autres boutons sont des contours ;
   - des rayons courts, des filets d'un pixel, presque pas d'ombre : la hiérarchie vient
     de la typographie et de l'espace, pas des effets ;
   - les états se lisent par un point et un mot, jamais par un aplat de couleur ;
   - chaque projet a une teinte stable (projet-c0 à projet-c5, filtre couleur_projet),
     utilisée seulement pour les barres de répartition et le filet des lignes.
   Archivo (largeur normale) est hébergée par l'application : rien n'est chargé ailleurs.

   Comme le socle : toute couleur est un jeton, défini ici pour les deux thèmes. */

/* ------------------------------------------------------------------- police */
@font-face {
  font-family: "Archivo";
  font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
                 U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
                 U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap;
  src: url("../fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304,
                 U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
                 U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ------------------------------------------------------------------- jetons */
/* Clair. Contrastes vérifiés : texte ≥ 4,5:1 sur --bg, --surface et --surface-alt ;
   contours de champ ≥ 3:1 sur --surface ; sarcelle foncée ≥ 4,5:1 sur blanc. */
:root {
  --sans: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --display: var(--sans);

  /* L'encre : action principale, navigation courante. */
  --accent:       #17191c;
  --accent-dark:  #000000;
  --accent-tint:  #eef0f2;
  --accent-line:  #d5d9de;
  --on-accent:    #ffffff;

  /* Le seul accent coloré. */
  --sarcelle:        #0f766e;
  --sarcelle-claire: #14b8a6;
  --sarcelle-tint:   #e6f4f2;
  --accent-ring:     rgba(20, 184, 166, .45);
  /* Les composants du socle qui parlent de « menthe » prennent la sarcelle. */
  --menthe:       var(--sarcelle-claire);
  --menthe-fonce: var(--sarcelle);
  --menthe-tint:  var(--sarcelle-tint);
  --menthe-line:  #b9e3dd;
  --on-menthe:    #062a26;

  --ink:         #17191c;
  --ink-soft:    #464b53;
  --ink-faint:   #626872;
  --line:        #e3e6ea;
  --line-soft:   #eef0f2;
  --line-forte:  #8a919b;
  --bg:          #f6f7f8;
  --surface:     #ffffff;
  --surface-alt: #f1f3f5;
  --surface-sunken: #fafbfc;
  --row-hover:   #f6f7f8;
  --glass:       rgba(255, 255, 255, .92);

  /* États : des points, pas des aplats. */
  --etat-validee:   #15803d;
  --etat-brouillon: #b45309;
  --etat-absence:   #6d28d9;
  --etat-vide:      #9aa1ab;

  /* Teintes de projet : sourdes, distinctes, lisibles en barre de 4 px. */
  --projet-0: #2563eb;
  --projet-1: #0d9488;
  --projet-2: #d97706;
  --projet-3: #db2777;
  --projet-4: #7c3aed;
  --projet-5: #65a30d;

  --radius-sm:   4px;
  --radius:      6px;
  --radius-lg:   10px;
  --shadow:      none;
  --shadow-lift: 0 1px 2px rgba(17, 19, 22, .06), 0 4px 12px rgba(17, 19, 22, .06);
  --shadow-flottant: 0 18px 48px rgba(17, 19, 22, .16), 0 2px 6px rgba(17, 19, 22, .06);
  --shadow-bulle:    0 6px 18px rgba(17, 19, 22, .18), 0 1px 3px rgba(17, 19, 22, .1);
  --shadow-bulle-survol: 0 10px 26px rgba(17, 19, 22, .22), 0 2px 4px rgba(17, 19, 22, .1);

  /* Michel : un disque d'encre, un regard sarcelle. */
  --michel-fond:  #17191c;
  --michel-trait: #ffffff;
  --michel-oeil:  #5eead4;
  --michel-pret:  #f59e0b;
}

:root[data-theme="dark"] {
  --accent:       #f1f3f5;
  --accent-dark:  #ffffff;
  --accent-tint:  #262a30;
  --accent-line:  #3a3f47;
  --on-accent:    #111316;
  --sarcelle:        #5eead4;
  --sarcelle-claire: #2dd4bf;
  --sarcelle-tint:   #11302c;
  --accent-ring:     rgba(45, 212, 191, .5);
  --menthe-line:  #1f4d47;
  --ink:         #eceef1;
  --ink-soft:    #b9bec6;
  --ink-faint:   #959ba5;
  --line:        #2c3036;
  --line-soft:   #23272c;
  --line-forte:  #6b727d;
  --bg:          #111316;
  --surface:     #181b1f;
  --surface-alt: #20242a;
  --surface-sunken: #15181b;
  --row-hover:   #1d2025;
  --glass:       rgba(17, 19, 22, .9);
  --etat-validee:   #4ade80;
  --etat-brouillon: #fbbf24;
  --etat-absence:   #a78bfa;
  --etat-vide:      #6b727d;
  --projet-0: #60a5fa;
  --projet-1: #2dd4bf;
  --projet-2: #fbbf24;
  --projet-3: #f472b6;
  --projet-4: #a78bfa;
  --projet-5: #a3e635;
  --shadow-lift: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .35);
  --michel-fond:  #f1f3f5;
  --michel-trait: #111316;
  --michel-oeil:  #0f766e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent:       #f1f3f5;
    --accent-dark:  #ffffff;
    --accent-tint:  #262a30;
    --accent-line:  #3a3f47;
    --on-accent:    #111316;
    --sarcelle:        #5eead4;
    --sarcelle-claire: #2dd4bf;
    --sarcelle-tint:   #11302c;
    --accent-ring:     rgba(45, 212, 191, .5);
    --menthe-line:  #1f4d47;
    --ink:         #eceef1;
    --ink-soft:    #b9bec6;
    --ink-faint:   #959ba5;
    --line:        #2c3036;
    --line-soft:   #23272c;
    --line-forte:  #6b727d;
    --bg:          #111316;
    --surface:     #181b1f;
    --surface-alt: #20242a;
    --surface-sunken: #15181b;
    --row-hover:   #1d2025;
    --glass:       rgba(17, 19, 22, .9);
    --etat-validee:   #4ade80;
    --etat-brouillon: #fbbf24;
    --etat-absence:   #a78bfa;
    --etat-vide:      #6b727d;
    --projet-0: #60a5fa;
    --projet-1: #2dd4bf;
    --projet-2: #fbbf24;
    --projet-3: #f472b6;
    --projet-4: #a78bfa;
    --projet-5: #a3e635;
    --shadow-lift: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .35);
    --michel-fond:  #f1f3f5;
    --michel-trait: #111316;
    --michel-oeil:  #0f766e;
  }
}

/* ------------------------------------------------------------- typographie */
body { font-family: var(--sans); font-size: .9375rem; background: var(--bg); }
h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; }
h2 { font-weight: 650; }
.eyebrow { font-size: .72rem; font-weight: 600; letter-spacing: .06em; color: var(--ink-faint); }
.lead { font-size: .95rem; }
.num, .tableau td.num, .barre-etat-chiffre, .jour-total, .temps-total, .saisie-duree input {
  font-variant-numeric: tabular-nums;
}
:focus-visible { outline: 2px solid var(--sarcelle-claire); outline-offset: 2px; }

/* ----------------------------------------------------------- barre du haut */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: none; }
.brand { font-weight: 700; letter-spacing: -.01em; font-size: .98rem; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 5px;
  background: var(--accent); color: var(--on-accent);
}
.nav-principale a { font-weight: 550; color: var(--ink-soft); border-radius: var(--radius-sm); }
.nav-principale a:hover { background: var(--surface-alt); color: var(--ink); }
.nav-principale a[aria-current="page"] {
  background: transparent; color: var(--ink);
  box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0;
}
.pastille-non-lus { background: var(--sarcelle); color: #fff; }

/* ---------------------------------------------------------------- boutons */
.btn { border-radius: var(--radius); border-width: 1px; font-weight: 550; box-shadow: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

/* --------------------------------------------------------------- panneaux */
.panneau { border-radius: var(--radius-lg); box-shadow: none; border: 1px solid var(--line); }
.encart { border-radius: var(--radius); background: var(--surface-alt); border-color: transparent; }

/* --------------------------------------------------------- chiffres clés */
/* Une rangée de chiffres, sans cadre : le libellé au-dessus, la valeur en grand. */
.chiffres-cles { display: flex; flex-wrap: wrap; gap: .5rem 2.5rem; margin: 0 0 1.25rem; }
.filtres + .chiffres-cles, .filtres + .flash { margin-top: 1.5rem; }
.chiffres-cles div { display: grid; gap: .1rem; }
.chiffres-cles dt { font-size: .78rem; color: var(--ink-faint); }
.chiffres-cles dd { margin: 0; font-size: 1.35rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.panneau-tete > h2 { margin: 0; font-size: 1rem; }
.sous-titre { margin: 0 0 .25rem; font-size: .8rem; font-weight: 600; color: var(--ink-faint); }
.fil-retour { margin: 0 0 .35rem; font-size: .85rem; }
.fil-retour a { color: var(--ink-faint); text-decoration: none; }
.fil-retour a::before { content: "‹ "; }
.fil-retour a:hover { color: var(--ink); }
.ecran-actions.semainier-tete { gap: .4rem; }

/* ---------------------------------------------------------------- états */
/* Un point de couleur et un mot : la couleur n'est jamais seule porteuse du sens. */
.etat {
  background: transparent; border: 0; padding: 0; border-radius: 0;
  color: var(--ink-soft); font-weight: 550;
}
.etat::before { width: .5rem; height: .5rem; border: 0; background: var(--etat-vide); }
.etat-validee::before { background: var(--etat-validee); }
.etat-brouillon::before { background: var(--etat-brouillon); }
.etat-absence::before { background: var(--etat-absence); }
.etat-a-saisir::before, .etat-manquant::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--etat-vide); }
.etat-validee, .etat-brouillon, .etat-absence, .etat-a-saisir, .etat-manquant,
.etat-proposee, .etat-duree-estimee { background: transparent; border: 0; }
.etat-proposee, .etat-duree-estimee { color: var(--ink-faint); font-style: normal; }

/* ------------------------------------------------------- teintes de projet */
.projet-c0 { --projet: var(--projet-0); }
.projet-c1 { --projet: var(--projet-1); }
.projet-c2 { --projet: var(--projet-2); }
.projet-c3 { --projet: var(--projet-3); }
.projet-c4 { --projet: var(--projet-4); }
.projet-c5 { --projet: var(--projet-5); }
rect[class^="projet-c"] { fill: var(--projet); }
.pastille-projet {
  display: inline-block; width: .55rem; height: .55rem; border-radius: 2px;
  background: var(--projet, var(--etat-vide)); flex: none;
}

/* ------------------------------------------------- semainier (écran Journée) */
.semainier { display: grid; gap: .6rem; margin: 0 0 1.25rem; }
.semainier-tete { display: flex; align-items: center; gap: .5rem; }
.semainier-titre { margin: 0 auto 0 .25rem; display: flex; align-items: baseline; gap: .6rem; }
.semainier-titre strong { font-weight: 650; }
.semainier-titre span { color: var(--ink-faint); font-size: .875rem; }
.semainier-fleche {
  display: inline-grid; place-items: center; width: 2rem; height: 2rem;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-soft);
  background: var(--surface);
}
.semainier-fleche:first-child { order: 0; }
.semainier-fleche:hover { color: var(--ink); border-color: var(--line-forte); }
.semainier-retour { font-size: .85rem; color: var(--sarcelle); font-weight: 550; text-decoration: none; }
.semainier-retour:hover { text-decoration: underline; }
/* Ordre visuel : ‹ titre … [Cette semaine] › — les flèches encadrent. */
.semainier-tete > .semainier-fleche:last-child { order: 3; }
.semainier-tete > .semainier-retour { order: 2; }
.semainier-tete > .semainier-titre { order: 1; }

.semainier-cadre { overflow: hidden; border-radius: var(--radius-lg); touch-action: pan-y; }
.semainier-jours {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
  touch-action: pan-y; user-select: none;
}
.semainier-jours li { margin: 0; min-width: 0; }
.semainier-jours li + li .jour { border-left: 1px solid var(--line-soft); }
.semainier-jours .jour {
  display: grid; gap: .35rem; padding: .65rem .7rem .7rem; height: 100%;
  color: var(--ink); text-decoration: none; position: relative;
}
.semainier-jours .jour:hover { background: var(--row-hover); }
.semainier-jours li:first-child .jour { border-radius: var(--radius-lg) 0 0 var(--radius-lg); }
.semainier-jours li:last-child .jour { border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
.jour-tete { display: flex; align-items: baseline; gap: .35rem; }
.jour-nom { font-size: .75rem; color: var(--ink-faint); text-transform: capitalize; }
.jour-date { font-weight: 650; font-size: 1rem; }
.est-aujourdhui .jour-date {
  color: var(--sarcelle);
}
.jour-total { font-size: .85rem; color: var(--ink-soft); min-height: 1.2em; }
.jour-barre {
  display: block; width: 100%; height: 4px; border-radius: 2px;
  background: var(--line-soft); overflow: hidden;
}
.jour-etat { font-size: .72rem; color: var(--ink-faint); display: flex; align-items: center; gap: .3rem; min-height: 1.1em; }
.jour-etat:not(:empty)::before {
  content: ""; width: .4rem; height: .4rem; border-radius: 50%; background: var(--etat-vide);
}
.est-validee .jour-etat::before { background: var(--etat-validee); }
.est-brouillon .jour-etat::before { background: var(--etat-brouillon); }
.est-absence .jour-etat::before { background: var(--etat-absence); }
.est-a-saisir .jour-etat::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--etat-vide); }
.est-ferie, .est-non-travaille, .est-futur { color: var(--ink-faint); }
.est-ferie .jour-date, .est-non-travaille .jour-date, .est-futur .jour-date { color: var(--ink-faint); font-weight: 500; }
/* Le jour affiché : un filet d'encre sous la case. */
.semainier-jours .jour[aria-current="date"] { background: var(--surface-alt); }
.semainier-jours .jour[aria-current="date"]::after {
  content: ""; position: absolute; left: .7rem; right: .7rem; bottom: 0; height: 2px;
  background: var(--ink); border-radius: 2px 2px 0 0;
}
/* Le glissement d'une semaine à l'autre (semainier.js). */
.semainier-jours.est-glissee { transition: translate 220ms cubic-bezier(.2, .8, .2, 1), opacity 220ms ease; }
.semainier-jours.est-sortie-gauche { translate: -14% 0; opacity: 0; }
.semainier-jours.est-sortie-droite { translate: 14% 0; opacity: 0; }
.semainier.est-chargement .semainier-jours { opacity: .55; }

@container page (max-width: 640px) {
  .semainier-jours .jour { padding: .5rem .3rem .55rem; text-align: center; justify-items: center; }
  .jour-tete { flex-direction: column; align-items: center; gap: 0; }
  .jour-total { font-size: .72rem; }
  .jour-etat { font-size: 0; gap: 0; }
  .semainier-titre span { display: none; }
}

/* ------------------------------------------------ lignes d'une journée */
.saisie tr.saisie-ligne > :first-child { box-shadow: inset 3px 0 0 var(--projet, transparent); }
.saisie tr.est-invalide > :first-child,
.saisie tr.saisie-message > :first-child { box-shadow: inset 3px 0 0 var(--red); }
.saisie thead th { font-size: .74rem; font-weight: 600; letter-spacing: .04em; color: var(--ink-faint); }
.saisie-note { padding: .75rem 1.25rem 1rem; border-top: 1px solid var(--line-soft); }
.saisie-note summary { cursor: pointer; color: var(--ink-soft); font-size: .875rem; font-weight: 550; }
.saisie-note[open] summary { margin-bottom: .6rem; }

/* ------------------------------------------------- barre d'enregistrement */
.barre-etat {
  background: var(--glass); backdrop-filter: blur(8px);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
}
.barre-etat-chiffre { font-weight: 650; font-size: 1rem; }
.barre-etat.est-modifiee { border-color: var(--etat-brouillon); }

/* ------------------------------------------------ Michel, dans l'identité */
.assistant-fenetre-tete { background: var(--surface); border-bottom: 1px solid var(--line); }
.est-moi .assistant-message-texte { background: var(--accent); color: var(--on-accent); }
.assistant-envoyer { background: var(--accent); color: var(--on-accent); }
.assistant-idee { border-radius: var(--radius); }
.assistant-idee:hover { background: var(--surface-alt); }

@media (prefers-reduced-motion: reduce) {
  .semainier-jours.est-glissee { transition: none; }
}
@media print {
  body { background: #fff; }
  .semainier-tete a { display: none; }
}
