/* ==========================================================================
   Style commun des écrans de l'appli perso (habillage selon la maquette,
   prototype cliquable validé le 30 novembre 2026).

   Comment s'en servir pour un nouvel écran (accueil, capture, notes…)
   -------------------------------------------------------------------
   1. Dans <head> : <link rel="stylesheet" href="/style.css">
      et, en fin de <body>, avant les scripts de la page :
      <script src="/js/menu.js" defer></script>
      (aucune police ni script d'un autre domaine : les règles de sécurité
      des écrans, ecrans/_headers, les bloqueraient).
   2. Recopier le gabarit commun, tel qu'il est dans ecrans/taches.html :
        <body class="avec-menu">
          <a class="aller-au-contenu" href="#contenu">Aller au contenu</a>
          <!-- menu:debut ecran="taches" --> … <!-- menu:fin -->
          <!-- barre:debut --> … <!-- barre:fin -->  (la barre du bas du téléphone, 5 boutons)
          (le menu à six portes et la barre du bas, générés par scripts/menu-ecrans.mjs : « npm run menu »)
          <div class="colonne">
            <header class="barre">compte, déconnexion</header>
            <!-- onglets:debut --> … <!-- onglets:fin -->  (la rangée d'onglets de la porte)
            <main id="contenu" class="large">…</main>
          </div>
        </body>
      Le menu et la rangée d'onglets ne s'écrivent pas à la main : ranger l'écran
      dans une porte de scripts/menu-ecrans.mjs (la seule définition), mettre les
      repères <!-- menu:debut ecran="nom-du-fichier" --> et <!-- onglets:debut -->
      dans la page (le repère <!-- barre:debut --> se pose tout seul), puis lancer « npm run menu ». Le script pose aria-current="page"
      sur l'onglet de l'écran (et aria-current="true" sur sa porte).
   3. Les briques à réutiliser :
      - boutons : <button> (principal), .secondaire, .petit, .discret-bouton ;
      - cartes : <ul class="cartes"><li class="carte">…</li></ul> (grille) ;
        lignes : <ul class="lignes"><li class="carte">…</li></ul> (liste
        dans un seul bloc, comme les tâches de la maquette) ;
      - blocs de l'accueil : <div class="blocs"><section class="bloc">
        <header class="entete-bloc"><h2>…</h2><span class="compte-bloc">3</span>
        </header>…</section></div> ; .bloc.large prend toute la largeur ;
      - étiquettes : .etiquette, et pour l'état : .ok, .attente, .info,
        .alerte, .archivee ;
      - échéances : .retard (en retard), .aujourdhui ;
      - filtres : <form class="filtres"> avec des <label> et <select> ;
        puces de filtre : <button class="puce" aria-pressed="true">.
   4. Les couleurs passent par les variables ci-dessous (thème clair, et
      thème sombre automatique). Pas de couleur en dur dans une page, pas
      d'attribut style= (interdit par les règles de sécurité).
   ========================================================================== */

/* ---------- Polices embarquées (ticket n°291) ----------
   Fichiers du dépôt (ecrans/polices/), servis par l'appli : latin avec accents français,
   licence OFL à côté de chaque fichier. Si un fichier ne se charge pas, le texte s'affiche
   avec la police de l'appareil (font-display: swap et piles de repli de --police et
   --police-titre). */
@font-face {
  font-family: 'Newsreader';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/polices/newsreader-latin-wght-normal.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: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/polices/inter-latin-wght-normal.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;
}

/* ---------- Couleurs et typographie (jetons de la maquette) ---------- */
:root {
  color-scheme: light;
  --fond: #f2f1ed;
  --surface: #ffffff;
  --surface-2: #ebeae5;
  --bord: #dddfdd;
  --texte: #1f2733;
  --discret: #5b6573;
  --pale: #5f6977;
  --accent: #2f4a68;
  --accent-texte: #ffffff;
  --accent-doux: #e1e8f0;
  --ok: #2a7849;
  --ok-doux: #e1f0e6;
  --attente: #9a5a08;
  --attente-doux: #f9edd9;
  --erreur: #b12a20;
  --erreur-doux: #fae6e3;
  --ombre: 0 1px 2px rgb(31 39 51 / 0.05), 0 10px 30px rgb(31 39 51 / 0.07);
  --voile: rgb(20 23 28 / 0.38);
  /* Compatibilité avec les premiers écrans */
  --carte: var(--surface);

  --police-titre: 'Newsreader', Georgia, 'Times New Roman', serif;
  --police: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --police-chiffres: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --rayon: 14px;
  --rayon-bloc: 18px;
  /* Espaces (ticket n°290) : plus d'air entre les blocs */
  --espace-s: 0.75rem;
  --espace-m: 1.25rem;
  --espace-l: 2rem;
  /* Agenda : une couleur par source (Google, Outlook, fiche faite dans l'appli). */
  --source-google: #1a6aa8;
  --source-outlook: #7a3fb0;
  --source-appli: #5b6573;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --source-google: #7cb8ec;
    --source-outlook: #c39bea;
    --source-appli: #a3adba;
    --fond: #14171c;
    --surface: #1b1f26;
    --surface-2: #242a33;
    --bord: #323945;
    --texte: #e8eaed;
    --discret: #a3adba;
    --pale: #98a3b1;
    --accent: #b0cbea;
    --accent-texte: #0e1824;
    --accent-doux: #263c58;
    --ok: #63c48d;
    --ok-doux: #163020;
    --attente: #e3a64b;
    --attente-doux: #362813;
    --erreur: #f27c70;
    --erreur-doux: #3a1e1b;
    --ombre: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px rgb(0 0 0 / 0.25);
    --voile: rgb(0 0 0 / 0.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --source-google: #7cb8ec;
  --source-outlook: #c39bea;
  --source-appli: #a3adba;
  --fond: #14171c;
  --surface: #1b1f26;
  --surface-2: #242a33;
  --bord: #323945;
  --texte: #e8eaed;
  --discret: #a3adba;
  --pale: #98a3b1;
  --accent: #b0cbea;
  --accent-texte: #0e1824;
  --accent-doux: #263c58;
  --ok: #63c48d;
  --ok-doux: #163020;
  --attente: #e3a64b;
  --attente-doux: #362813;
  --erreur: #f27c70;
  --erreur-doux: #3a1e1b;
  --ombre: 0 1px 2px rgb(0 0 0 / 0.3), 0 10px 30px rgb(0 0 0 / 0.25);
  --voile: rgb(0 0 0 / 0.55);
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--fond);
  color: var(--texte);
  font: 15px/1.5 var(--police);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 {
  font-family: var(--police-titre);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-wrap: balance;
}
h1 { font-size: clamp(1.6rem, 3.2vw, 2.1rem); margin: 0 0 var(--espace-m); }
h2 { font-size: 1.1rem; }
p { margin: 0 0 0.75rem; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: var(--accent-doux); }

/* Lien d'évitement : visible seulement au clavier */
.aller-au-contenu {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  box-shadow: var(--ombre);
}
.aller-au-contenu:focus { top: 1rem; }

/* ---------- Gabarit : menu à gauche, contenu à droite ---------- */
body.avec-menu {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  column-gap: 32px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
}
.colonne { min-width: 0; padding-bottom: 5rem; }

.menu {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  padding: 20px 0 24px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.marque {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 8px;
  color: var(--texte);
  text-decoration: none;
}
.marque-signe {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--texte);
  color: var(--fond);
  display: grid;
  place-items: center;
  font: 700 15px/1 var(--police-titre);
  flex: none;
}
.marque b { font: 700 17px/1.1 var(--police-titre); display: block; }
.marque small { font-size: 12px; color: var(--pale); }
.menu-groupe { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.menu-titre { margin: 0 0 -14px; padding: 0 10px; font-size: 12px; font-weight: 600; color: var(--pale); } /* sous le titre : l'écart du menu (22 px) se resserre */
.menu-groupe a, .menu-groupe .bientot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--discret);
  text-decoration: none;
  font-weight: 500;
}
.menu-groupe a:hover { background: var(--surface-2); color: var(--texte); }
.menu-groupe a[aria-current] { background: var(--surface); color: var(--texte); box-shadow: var(--ombre); }
.menu-groupe .bientot { color: var(--pale); cursor: default; }
.menu-groupe .bientot small {
  margin-left: auto;
  font-size: 11px;
  border: 1px solid var(--bord);
  border-radius: 99px;
  padding: 0 7px;
}
.icone {
  width: 18px;
  height: 18px;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.menu-pied { margin-top: auto; padding: 0 10px; font-size: 12.5px; color: var(--pale); }

/* Rangée d'onglets en haut de chaque page : les écrans de la porte (ticket n°283).
   Elle défile seule quand elle déborde ; sans script, elle reste une simple liste de liens. */
.onglets-porte {
  margin: 0 0 var(--espace-m);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.onglets-porte ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; width: max-content; min-width: 100%; border-bottom: 1px solid var(--bord); }
.onglets-porte a {
  display: block;
  padding: 8px 12px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  color: var(--discret);
  text-decoration: none;
  font-weight: 500;
}
.onglets-porte a:hover { color: var(--texte); }
/* « Plus » de la rangée (Inertys, ticket n°292) : caché sur ordinateur et sans script, où les sept
   onglets restent en ligne. Sur téléphone avec le script, js/menu.js range trois onglets dans le panneau. */
.rangee-plus, .rangee-plus-panneau { display: none; }
.rangee-plus-bouton {
  padding: 8px 12px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--discret);
  font: 500 15px/1.5 var(--police);
}
.rangee-plus-bouton:hover { filter: none; color: var(--texte); }
.rangee-plus-bouton[aria-current] { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.onglets-porte a[aria-current] { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }

/* Compteurs « à traiter » (ticket n°284) : posés par js/menu.js sur les onglets et les portes. */
.compteur {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--texte);
  color: var(--fond);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
}
.menu-groupe .compteur { margin-left: auto; }
.invisible { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Barre du bas du téléphone : cachée ici ; le bloc « téléphone » plus bas la montre (avec le script). */
.barre-bas { display: none; }

/* Barre du haut : compte, déconnexion (le menu du téléphone est la barre du bas) */
.barre {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--fond);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 3.5rem;
  padding: 12px 0;
}
.barre #compte { margin-left: auto; color: var(--discret); font-size: 0.9rem; overflow-wrap: anywhere; }
.barre #compte:empty { display: none; }
/* Bouton de thème (ticket n°301) : à droite, avant « Se déconnecter » ; caché jusqu'à ce que js/theme.js le montre. */
.barre #theme-bouton { margin-left: auto; }
.barre #compte:not(:empty) + #theme-bouton { margin-left: 0; }

/* Contenu */
main { max-width: 34rem; margin: var(--espace-s) 0 0; }
main.large { max-width: none; }
.etroit { max-width: 28rem; }
section > p:first-child:last-child { margin-bottom: 0; }

/* ---------- Formulaires ---------- */
label { display: block; margin-bottom: 0.3rem; font-size: 0.9rem; font-weight: 500; color: var(--discret); }
input, select, textarea { font: inherit; color: inherit; }
input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
textarea {
  display: block;
  width: 100%;
  padding: 0.55rem 0.7rem;
  margin-bottom: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: 8px;
}
select {
  display: block;
  padding: 0.45rem 0.55rem;
  min-width: 9rem;
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: 8px;
}
input:hover, select:hover, textarea:hover { border-color: var(--pale); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); border-radius: 8px; }
textarea { resize: vertical; line-height: 1.5; }
input[type="color"] { width: 4rem; height: 2.4rem; padding: 0.15rem; margin-bottom: 0.85rem; border: 1px solid var(--bord); border-radius: 8px; background: var(--surface); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
label.case { display: flex; align-items: center; gap: 0.45rem; font-weight: 400; color: var(--texte); padding-bottom: 0.5rem; }
label.case input { width: auto; margin: 0; }

/* ---------- Boutons ---------- */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0.5rem 0.9rem;
  font: 500 14px/1.3 var(--police);
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-texte);
  cursor: pointer;
  white-space: nowrap;
}
button:hover { filter: brightness(1.07); }
button.secondaire { background: var(--surface); border-color: var(--bord); color: var(--texte); }
button.secondaire:hover { filter: none; border-color: var(--pale); }
button.discret-bouton { background: transparent; border-color: transparent; color: var(--discret); }
button.discret-bouton:hover { filter: none; background: var(--surface-2); color: var(--texte); }
button:disabled { opacity: 0.5; cursor: wait; }
.petit { padding: 0.25rem 0.6rem; font-size: 13px; }
.boutons { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Puces de filtre (maquette) */
.puce {
  border: 1px solid var(--bord);
  background: transparent;
  color: var(--discret);
  border-radius: 99px;
  padding: 4px 12px;
  font-size: 13.5px;
}
.puce:hover { filter: none; color: var(--texte); border-color: var(--pale); }
.puce[aria-pressed="true"] { background: var(--texte); border-color: var(--texte); color: var(--fond); }

/* ---------- Messages ---------- */
.discret { color: var(--discret); font-size: 0.9rem; overflow-wrap: anywhere; }
.message { min-height: 1.5rem; margin: 0 0 0.5rem; color: var(--discret); }
.message.erreur { color: var(--erreur); }
#erreur, #refus-retour {
  background: var(--erreur-doux);
  border-radius: var(--rayon);
  padding: 0.9rem 1rem;
}
#lien-envoye, #coupe {
  background: var(--ok-doux);
  border-radius: var(--rayon);
  padding: 0.9rem 1rem;
}
#attente p { color: var(--pale); }

/* ---------- Outils (filtres et actions en tête de liste) ---------- */
.outils {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--espace-m);
  margin-bottom: var(--espace-m);
}
.filtres { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--espace-s); }
.filtres label { margin: 0; font-size: 0.85rem; }
.filtres select { margin-top: 0.25rem; min-width: 7.5rem; }
.filtres input[type="date"] { margin: 0.25rem 0 0; padding: 0.4rem; width: auto; }
.filtres label.case { padding-bottom: 0.55rem; }
.filtres [hidden] { display: none; }

/* ---------- Étiquettes et états ---------- */
.etiquette {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  border-radius: 99px;
  padding: 0 8px;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--discret);
}
.etiquette::first-letter { text-transform: uppercase; }
.etiquette.ok { background: var(--ok-doux); color: var(--ok); }
.etiquette.attente { background: var(--attente-doux); color: var(--attente); }
.etiquette.info { background: var(--accent-doux); color: var(--accent); }
.etiquette.alerte { background: var(--erreur-doux); color: var(--erreur); }
.etiquette.archivee { background: transparent; border: 1px dashed var(--pale); font-style: italic; }
.retard { color: var(--erreur); font-weight: 600; }
.aujourdhui { color: var(--attente); font-weight: 600; }
strong.fait { text-decoration: line-through; color: var(--pale); }
.pastille { width: 10px; height: 10px; border-radius: 3px; background: var(--couleur, var(--pale)); flex: none; }

/* ---------- Groupes, cartes, lignes ---------- */
.groupe { margin-bottom: var(--espace-l); }
.entete-groupe { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-bottom: var(--espace-s); }
.entete-groupe h2 { font-size: 1.15rem; margin: 0; }
.entete-groupe .discret { font: 500 12px var(--police); color: var(--pale); }
.entete-groupe .boutons { margin-left: auto; }
.cartes {
  list-style: none;
  padding: 0;
  margin: var(--espace-s) 0 0;
  display: grid;
  gap: var(--espace-m);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr));
}
.carte {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-bloc);
  padding: var(--espace-s) var(--espace-m);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.carte:hover { border-color: var(--pale); }
.carte p { margin: 0; }
.carte strong { font-weight: 600; font-size: 15px; line-height: 1.35; }
.carte .boutons { margin-top: auto; padding-top: 0.35rem; }
.carte.archivee { opacity: 0.7; border-style: dashed; }
.entete-carte { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 0.5rem; }
.prochaine { font-size: 13.5px; background: var(--surface-2); border-radius: 8px; padding: 6px 9px; }
#cartes .discret, .texte-normal { overflow-wrap: anywhere; }

/* Lignes : une liste dans un seul bloc, séparée par des filets (tâches) */
.lignes {
  list-style: none;
  margin: 0;
  padding: 4px 16px;
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-bloc);
  display: flex;
  flex-direction: column;
}
.lignes:empty { display: none; }
.lignes > .carte {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--bord);
  border-radius: 0;
  padding: 14px 0;
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 1rem;
  row-gap: 4px;
}
.lignes > .carte:first-child { border-top: 0; }
.lignes > .carte > * { grid-column: 1; }
.lignes > .carte > .boutons { grid-column: 2; grid-row: 1 / span 3; align-self: center; margin: 0; padding: 0; }
.lignes > .carte.archivee { border-style: solid; }
.infos { display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; font-size: 12.5px; }
.infos span:not(.retard) { color: var(--discret); }

/* ---------- Onglets (contacts, rendez-vous, missions) ---------- */
.onglets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--espace-m);
}
/* Sous-onglets d'une page : des pastilles plus petites, sans soulignement, pour ne pas les
   confondre avec la rangée d'onglets principale au-dessus (ticket n°300). */
.onglet {
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 99px;
  padding: 5px 14px;
  color: var(--discret);
  font-size: 13.5px;
  font-weight: 500;
}
.onglet:hover { filter: none; color: var(--texte); }
.onglet[aria-current="page"] { background: var(--accent-doux); color: var(--accent); font-weight: 600; }
.onglet-lien { align-self: center; margin-left: auto; font-size: 13.5px; padding-bottom: 6px; }

/* ---------- Fiches détaillées et fenêtres ---------- */
.details { display: grid; grid-template-columns: max-content 1fr; gap: 0.3rem 0.9rem; margin: 0 0 1rem; }
.details dt { color: var(--discret); font-size: 0.9rem; }
.details dd { margin: 0; overflow-wrap: anywhere; }
.simple { list-style: none; padding: 0; margin: 0 0 0.75rem; display: grid; gap: 0.4rem; }
dialog {
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  border: 1px solid var(--bord);
  border-radius: 14px;
  background: var(--surface);
  color: var(--texte);
  padding: 1.25rem;
  box-shadow: var(--ombre);
}
dialog::backdrop { background: var(--voile); }
dialog h2 { margin: 0 0 1rem; font-size: 1.3rem; }
dialog h3 { font-size: 1rem; margin: 1rem 0 0.4rem; }
dialog select { width: 100%; margin-bottom: 0.85rem; }
dialog .boutons { padding-top: 0.5rem; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

/* ---------- Agenda ---------- */
.periode { font: 500 14px var(--police); color: var(--discret); margin: 0; }
#jours {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-bloc);
  padding: 4px 16px;
}
#jours:empty { display: none; }
.jour {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--bord);
}
.jour:first-child { border-top: 0; }
.jour h2 { font: 500 12.5px/1.6 var(--police-chiffres); color: var(--discret); margin: 0; letter-spacing: 0; }
.jour h2::first-letter { text-transform: uppercase; }
.jour .simple { margin: 0; gap: 8px; }
.element { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.5rem; min-width: 0; }
.element .etiquette { border-radius: 6px; font-size: 11px; letter-spacing: 0.02em; }
.element.rendez_vous .etiquette { background: var(--accent-doux); color: var(--accent); }
.element.mission .etiquette { background: var(--ok-doux); color: var(--ok); }
.element .discret { font-size: 12.5px; }
/* Agenda, ticket n°34 : une couleur par source, l'heure en chiffres, la légende. */
.element .heure { font: 500 12.5px var(--police-chiffres); color: var(--discret); }
.element.source-google .etiquette, .legende .source-google .etiquette { color: var(--source-google); border: 1px solid var(--source-google); background: transparent; }
.element.source-outlook .etiquette, .legende .source-outlook .etiquette { color: var(--source-outlook); border: 1px solid var(--source-outlook); background: transparent; }
.element.source-appli .etiquette, .legende .source-appli .etiquette { color: var(--source-appli); border: 1px solid var(--source-appli); background: transparent; }
.element.source-google { border-left: 3px solid var(--source-google); padding-left: 6px; }
.element.source-outlook { border-left: 3px solid var(--source-outlook); padding-left: 6px; }
.element.source-appli { border-left: 3px solid var(--source-appli); padding-left: 6px; }
.legende { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 0.75rem; }
.legende .etiquette { border-radius: 6px; font-size: 11px; }

/* ---------- Blocs de l'accueil ---------- */
.blocs { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: var(--espace-m); align-items: start; }
.bloc {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-bloc);
  padding: var(--espace-m);
  display: flex;
  flex-direction: column;
  gap: var(--espace-s);
  min-width: 0;
}
.bloc.large { grid-column: 1 / -1; }
/* Accueil (ticket n°300) : tous les blocs, quelle que soit leur sorte, sont séparés du même espace.
   Les blocs rangés passent à la ligne et se partagent la largeur : le dernier d'une ligne
   incomplète prend la place restante, sans trou à côté de lui. */
#accueil { display: flex; flex-direction: column; gap: var(--espace-m); }
#blocs { display: flex; flex-wrap: wrap; gap: var(--espace-m); align-items: flex-start; }
#blocs > .bloc { flex: 1 1 min(100%, 330px); }
#blocs > .bloc.large { flex-basis: 100%; }
.bloc > p { margin: 0; }
.bloc .elements { margin: 0; }
.bloc .elements:empty { display: none; }
.bloc.masque { opacity: 0.55; border-style: dashed; }
.entete-bloc { display: flex; align-items: center; gap: 8px; }
.entete-bloc h2 { font-size: 17px; margin: 0; }
.compte-bloc { font: 500 12px var(--police); color: var(--pale); }
.entete-bloc .boutons, .entete-bloc > a { margin-left: auto; font-size: 13px; }
.bloc .simple { margin: 0; }
.bloc > a { align-self: flex-start; font-size: 13.5px; }
.bloc.masque .entete-bloc h2 { color: var(--discret); }
.entete-bloc .boutons { gap: 2px; flex-wrap: nowrap; }
#message-accueil:empty { display: none; }
.titre-raccourcis { margin: var(--espace-l) 0 var(--espace-s); }
.raccourcis { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--espace-s); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
.raccourcis a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 15px;
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-bloc);
  color: var(--texte);
  text-decoration: none;
  font-weight: 500;
}
.raccourcis a:hover { border-color: var(--pale); }
.raccourcis .icone { color: var(--accent); }

/* Écran sans menu (autorisation de Claude) : une carte centrée */
body.page-seule main {
  max-width: 30rem;
  margin: 12vh auto 3rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: 14px;
  box-shadow: var(--ombre);
}
body.page-seule { padding: 0 16px; }

/* Capture rapide (bouton de la barre du haut, fenêtre d'une ligne) */
.capture-bouton { margin-left: 0; }

/* Accès de Claude */
#autorisations { padding-left: 1.2rem; }

/* ---------- Téléphone : la barre du bas remplace le menu (ticket n°284) ---------- */
@media (max-width: 860px) {
  body.avec-menu { display: block; }
  /* Sans script, le menu reste en haut de page, en ligne ; la barre du bas reste cachée */
  .menu { position: static; height: auto; padding: 12px 0 0; gap: 10px; }
  .menu-groupe { flex-direction: row; flex-wrap: wrap; }
  .menu-titre, .menu-pied { display: none; }

  /* Avec le script : le menu du haut disparaît, la barre du bas le remplace */
  .menu-js .menu { display: none; }
  .menu-js .colonne { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)); }
  .menu-js .barre-bas {
    display: block;
    position: fixed;
    z-index: 42;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 4px max(8px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: var(--fond);
    border-top: 1px solid var(--bord);
    box-shadow: var(--ombre);
  }
  .barre-bas > ul { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; margin: 0; padding: 0; list-style: none; }
  .barre-bas li { min-width: 0; position: relative; }
  .barre-bas a, .barre-bas button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 100%;
    min-width: 44px;
    min-height: 44px;
    padding: 4px 2px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--discret);
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 500;
    line-height: 1.2;
    text-decoration: none;
    position: relative;
  }
  .barre-bas span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .barre-bas [aria-current] { color: var(--texte); font-weight: 700; background: var(--surface-2); box-shadow: inset 0 2px 0 var(--texte); }
  .barre-bas .compteur { position: absolute; top: 0; right: 14%; margin: 0; font-size: 10.5px; }
  .barre-bas .plus-panneau {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    width: max-content;
    max-width: calc(100vw - 16px);
    margin: 0;
    padding: 6px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--bord);
    border-radius: 12px;
    box-shadow: var(--ombre);
  }
  .barre-bas .plus-panneau[hidden] { display: none; }
  .barre-bas .plus-panneau a { flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 44px; padding: 8px 12px; font-size: 15px; white-space: nowrap; }
  .barre-bas .plus-panneau a .compteur { position: static; margin-left: auto; }
  .onglets-porte a { min-height: 44px; display: flex; align-items: center; }
  .onglets-porte { scrollbar-width: none; }
  .onglets-porte::-webkit-scrollbar { display: none; }
  .onglet { min-height: 44px; }
  /* Inertys : quatre onglets et « Plus » (le script range les trois autres dans le panneau) */
  .menu-js .rangee-plus { display: block; }
  .rangee-plus-bouton { min-height: 44px; }
  .menu-js .rangee-plus-panneau:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: auto;
    min-width: 0;
    margin: 4px 0 8px;
    padding: 6px;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--bord);
    border-radius: var(--rayon);
    box-shadow: var(--ombre);
  }
  .rangee-plus-panneau a { min-height: 44px; border-bottom: 0; margin: 0; padding: 8px 12px; border-radius: 8px; }
  .rangee-plus-panneau a[aria-current] { background: var(--surface-2); }

  .outils { flex-direction: column; align-items: stretch; }
  .lignes > .carte { grid-template-columns: minmax(0, 1fr); }
  .lignes > .carte > .boutons { grid-column: 1; grid-row: auto; padding-top: 4px; }
}
@media (max-width: 560px) {
  .jour { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .deux { grid-template-columns: 1fr; gap: 0; }
  .barre #compte { display: none; }
  .barre #deconnexion { margin-left: auto; }

  /* Cibles cliquables : 44 px de haut au moins (critère 7, ticket n°290) */
  #theme-bouton,
  button,
  .puce,
  .petit,
  select,
  input:not([type="checkbox"]):not([type="radio"]):not([type="color"]) {
    min-height: 44px;
  }
  .menu-groupe a,
  .resultats a,
  .liens-fiche a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  .menu-groupe a { display: flex; }
  .tableau .tri {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  label.case {
    display: flex;
    align-items: center;
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Écran « Notes » (ticket n°13) */
.texte-note { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Recherche partout (Ctrl K) et page « fiche » avec ses liens (ticket n°16).
   Le bouton « Chercher » est posé par js/barre-recherche.js dans la barre du haut,
   juste avant le compte : il pousse le compte et la déconnexion à droite. */
.barre { flex-wrap: wrap; }
.barre .bouton-recherche { margin-left: auto; }
.barre .bouton-recherche ~ #compte,
.barre .bouton-recherche ~ #deconnexion { margin-left: 0; }
.resultats a, .liens-fiche a { text-decoration: none; }
.resultats a:focus, .resultats a:hover, .liens-fiche a:hover { text-decoration: underline; }
.resultats li { padding: 0.2rem 0; }
.lien-fiche { align-self: center; font-size: 0.9rem; }
#candidats { margin-top: 0.25rem; }
#fiche h1 { margin-top: 0.4rem; }
/* ---------- Onglets d'une fiche (Fiche / Historique) ---------- */
.onglet[aria-selected="true"] { background: var(--accent-doux); color: var(--accent); font-weight: 600; }
#panneau-historique .lignes { margin-bottom: 0.75rem; }
#panneau-historique .simple,
#lots .simple { font-size: 13.5px; margin: 0.25rem 0 0; overflow-wrap: anywhere; }
#lots .simple ul { margin: 0.15rem 0 0; padding-left: 1.1rem; font-size: 12.5px; }

/* ---------- Capture et automatisations (écran « À trier ») ---------- */
/* Un libellé qui ouvre un champ caché (l'appareil photo) a l'air d'un bouton. */
label.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 0;
  padding: 0.5rem 0.9rem;
  font: 500 14px/1.3 var(--police);
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-texte);
  cursor: pointer;
  white-space: nowrap;
}
label.bouton:hover { filter: brightness(1.07); }
label.bouton.secondaire { background: var(--surface); border-color: var(--bord); color: var(--texte); }
.visuellement-cache:focus-visible + label.bouton,
label.bouton:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.visuellement-cache {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.photo-trier { width: 100%; max-height: 260px; object-fit: contain; border-radius: var(--rayon); background: var(--surface-2); }
.proposition { margin: 0.5rem 0; padding: 0.5rem 0.75rem; border-left: 3px solid var(--attente); background: var(--attente-doux); border-radius: 6px; }
.proposition p { margin: 0.15rem 0; }
/* ---------- Vie perso et famille (page /perso) ----------
   La liste de courses au magasin (ticket n°78) : une ligne entière par article, assez
   haute pour le pouce ; un geste coche ou décoche. */
.rayon-courses h3 { margin: 1rem 0 0.35rem; font-size: 0.95rem; color: var(--discret); }
.article-course {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; min-height: 48px;
  padding: 0.6rem 0.8rem; text-align: left; background: var(--surface); color: var(--texte);
  border: 1px solid var(--bord); border-radius: 10px; margin-bottom: 0.4rem;
}
.article-course::before {
  content: ""; flex: none; width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--pale);
}
.article-course[aria-pressed="true"] { color: var(--discret); text-decoration: line-through; }
.article-course[aria-pressed="true"]::before { background: var(--ok); border-color: var(--ok); }
.article-course .quantite { margin-left: auto; color: var(--discret); font-size: 0.9rem; }
.repas-menu { display: grid; grid-template-columns: 7rem 1fr 1fr; gap: 0.25rem 0.75rem; }
/* La comparaison des destinations (ticket n°81) : sur téléphone, le tableau défile seul,
   jamais la page. */
.tableau-defilant { overflow-x: auto; max-width: 100%; }
.tableau-defilant table { border-collapse: collapse; min-width: 100%; font-size: 0.95rem; }
.tableau-defilant th, .tableau-defilant td { padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--bord); text-align: left; white-space: nowrap; }
.tableau-defilant thead th { color: var(--discret); font-weight: 600; }

/* ---------- CRM et facturation : le tableau des prospects (quatre colonnes) ---------- */
.colonnes-crm { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); margin-bottom: var(--espace-l); }
.colonnes-crm .simple .carte { padding: 10px 12px; }
.colonnes-crm .entete-bloc { flex-wrap: wrap; }

/* ---------- CRM et facturation : les devis ---------- */
.lignes-devis { display: grid; gap: 0.4rem; margin-bottom: 0.5rem; }
.ligne-devis { display: grid; grid-template-columns: minmax(0, 1fr) 5rem 7rem auto; gap: 0.4rem; align-items: center; }
.ligne-devis input { margin: 0; }
.totaux { font: 500 14px var(--police-chiffres); color: var(--texte); margin: 0.5rem 0 0.85rem; }

/* La page du devis, à imprimer ou enregistrer en PDF */
body.page-imprimable { padding: 0 16px; }
body.page-imprimable main { max-width: 52rem; margin: 2rem auto 3rem; }
.barre-impression { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; justify-content: space-between; margin-bottom: 1.25rem; }
.devis-imprime { background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; padding: 2rem; }
.devis-entete { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1.5rem; margin-bottom: 2rem; }
.devis-entete p { margin: 0 0 0.2rem; }
.devis-emetteur { font-weight: 700; font-size: 1.1rem; }
.devis-client { min-width: 14rem; }
.devis-lignes { width: 100%; border-collapse: collapse; margin: 1.25rem 0; font-size: 0.95rem; }
.devis-lignes th, .devis-lignes td { padding: 0.45rem 0.5rem; border-bottom: 1px solid var(--bord); text-align: left; }
.devis-lignes td:not(:first-child), .devis-lignes thead th:not(:first-child), .devis-lignes tfoot td { text-align: right; white-space: nowrap; }
.devis-lignes tfoot th { text-align: right; font-weight: 500; }
.devis-lignes tfoot tr:last-child { font-weight: 700; }
.devis-accord { margin-top: 2.5rem; min-height: 6rem; border-top: 1px dashed var(--bord); padding-top: 0.75rem; }
@media print {
  :root { color-scheme: light; --fond: #fff; --surface: #fff; --texte: #000; --discret: #333; --bord: #999; }
  body.page-imprimable { padding: 0; background: #fff; }
  body.page-imprimable main { margin: 0; max-width: none; }
  .ne-pas-imprimer { display: none !important; }
  .devis-imprime { border: 0; border-radius: 0; padding: 0; box-shadow: none; }
}
/* ---------- Écran « Finances » ---------- */
/* Tableau de chiffres : <div class="defile"><table class="tableau">…</table></div>.
   Les montants (.montant) sont alignés à droite, en chiffres de même largeur. */
.defile { overflow-x: auto; margin-bottom: 1rem; }
/* Tableaux (ticket n°294) : une seule définition. En-têtes discrets (petits, gris, jamais en gras
   plein), lignes plus hautes au doigt (44 px au moins), un fond doux au survol. Les cellules ne
   passent pas à la ligne : le tableau défile seul dans son enveloppe, jamais la page. */
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
.tableau th, .tableau td { padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: top; white-space: nowrap; }
.tableau th { color: var(--discret); font-weight: 600; font-size: 12.5px; }
.tableau tbody tr:hover { background: var(--surface-2); }
.tableau tfoot td, .tableau tfoot th { font-weight: 700; border-bottom: none; }
.tableau .montant { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.negatif { color: var(--erreur); }
.navigation-mois { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 1rem; }
.navigation-mois h2 { margin: 0; min-width: 10rem; text-align: center; }
.bandeau { padding: 0.6rem 0.8rem; border-radius: 10px; background: var(--attente-doux); color: var(--attente); margin-bottom: 1rem; }
.chiffre { font: 600 1.5rem/1.2 var(--police-chiffres); margin: 0.25rem 0; }

/* ---------- Tableau de comparaison (écran « Entretiens », ticket n°46) ----------
   <div class="defilement"><table class="tableau">…</table></div> : le tableau défile
   seul sur téléphone, la page ne déborde pas. Les en-têtes triables sont des boutons
   (.tri) ; aria-sort dit le sens. Les chiffres du haut : <dl class="chiffres">. */
.defilement { overflow-x: auto; margin: 0.5rem 0 1rem; }
.tableau .tri { background: none; border: 0; padding: 0; color: inherit; font: inherit; cursor: pointer; }
.tableau .tri:hover { filter: none; color: var(--texte); }
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 0.75rem; margin: 0.5rem 0 1rem; }
.chiffres div { background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; padding: 0.6rem 0.8rem; }
.chiffres dt { color: var(--discret); font-size: 13px; }
.chiffres dd { margin: 0.2rem 0 0; font-size: 1.15rem; font-weight: 600; }
