/* Ticket Tiles SCC : console HUD (Synaxess + Cubik Cloud). Mobile d'abord (390 px), puis elargi.
   Theme sombre par defaut ; clair si <html data-theme="light"> (Reglages > Apparence, voir theme.js).
   Animations : transform et opacity seulement ; toutes coupees par prefers-reduced-motion. */
:root {
  /* Synaxess */
  --fond: #070b14;
  --surface: #0e1626;
  --surface-2: #152134;
  --bord: #1e2d45;
  --bord-vif: #2a4a6e;
  --bord-champ: #52789f;      /* contour des champs : >= 3:1 sur surface et panneau (3,9 / 4,0) */
  --texte: #e8edf5;
  --texte-2: #96a7c0;
  --accent: #4fc3f0;          /* texte et traits (8,9:1 sur surface) */
  --accent-plein: #1fa5dc;    /* fond des boutons principaux */
  --accent-texte: #04101c;    /* texte sur --accent-plein (6,8:1) */
  --accent-doux: #0f2a40;
  --lueur: rgba(79, 195, 240, .35);
  --grille: rgba(79, 195, 240, .045);
  --afaire: #4fc3f0;
  --afaire-fond: #0f2a40;
  --fait: #7fbf9e;            /* vert « eteint » */
  --fait-fond: #10261f;
  --fait-led: #3e8a68;
  --retard: #ff7a70;
  --retard-fond: #3a1518;
  --sur-retard: #0b1020;      /* texte sur fond --retard (7,46:1) */
  --bientot: #e9c46a;         /* Cubik Cloud « chaud » */
  --bientot-fond: #2e2410;
  --toast-fond: #102236;
  --toast-texte: #e8edf5;
  --panneau: #0a1422;         /* modals : panneau holographique */
  --coeur: #08121f;           /* centre du reacteur (toujours sombre) */
  --ombre: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 8px 24px rgba(0, 0, 0, .35);
  --rayon: 6px;
  --titre: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --corps: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Cascadia Code", "SF Mono", "JetBrains Mono", Menlo, Consolas, "Roboto Mono", monospace;
  color-scheme: dark;
}
:root[data-theme="light"] {
  /* Cubik Cloud (navy) */
  --fond: #eef3f9;
  --surface: #ffffff;
  --surface-2: #e6edf6;
  --bord: #c9d6e6;
  --bord-vif: #8fb3d6;
  --bord-champ: #62819f;      /* 4,1:1 sur blanc, 3,7:1 sur le fond */
  --texte: #0b1f33;
  --texte-2: #4a5d75;
  --accent: #0b4a7c;
  --accent-plein: #0b4a7c;
  --accent-texte: #ffffff;
  --accent-doux: #dcebf8;
  --lueur: rgba(27, 127, 196, .25);
  --grille: rgba(11, 74, 124, .05);
  --afaire: #0a5f8f;
  --afaire-fond: #ddf0fa;
  --fait: #17694b;
  --fait-fond: #ddf2e8;
  --fait-led: #1e7f5c;
  --retard: #b42318;
  --retard-fond: #fde6e4;
  --sur-retard: #ffffff;
  --bientot: #7a5000;
  --bientot-fond: #fcefd2;
  --toast-fond: #0b1f33;
  --toast-texte: #ffffff;
  --panneau: #ffffff;
  --ombre: 0 1px 2px rgba(11, 31, 51, .06), 0 4px 14px rgba(11, 31, 51, .07);
  color-scheme: light;
}

* { box-sizing: border-box; }
html {   /* focus et defilement : jamais sous l'en-tete collant (61 px) ni sous la barre « Nouveau billet » */
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(70px + env(safe-area-inset-top)); scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
body {
  margin: 0; background: var(--fond); color: var(--texte);
  font: 16px/1.45 var(--corps);
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}
/* Decor fixe derriere le contenu : grille + halo (body::before), ligne de balayage lente (body::after). */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, var(--lueur), transparent 70%),
    linear-gradient(var(--grille) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grille) 1px, transparent 1px) 0 0 / 32px 32px;
  opacity: .9;
}
body::after {
  content: ""; position: fixed; left: 0; right: 0; top: 0; height: 140px; z-index: -1; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(79, 195, 240, .025) 80%, rgba(79, 195, 240, .14) 98.5%, transparent);
  transform: translateY(-160px); animation: balayage 9s linear infinite; will-change: transform;
}
@keyframes balayage { to { transform: translateY(110vh); } }

a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-family: var(--titre); font-weight: 700; letter-spacing: .01em; }
svg { width: 18px; height: 18px; flex: none; }
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button, input, textarea, select { font: inherit; color: inherit; }
.mono, .compte, time { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.kicker { margin: 0; font: 600 12px/1.3 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--texte-2); }

/* Voyant (LED) : a faire = cyan pulse, retard = rouge, fait = vert eteint */
.led { position: relative; display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.led::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 1px solid currentColor; opacity: 0; }
.led.pulse::after { animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.4); opacity: .8; } 100% { transform: scale(1.6); opacity: 0; } }
.led.eteinte { background: var(--fait-led); color: var(--fait-led); box-shadow: none; }

/* ---------- Boutons et champs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: 4px; border: 1px solid var(--bord-vif);
  background: var(--surface); color: var(--texte); font-weight: 600; cursor: pointer; text-decoration: none;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.btn:hover { background: var(--surface-2); border-color: var(--accent); box-shadow: 0 0 0 1px var(--lueur), 0 0 14px var(--lueur); }
.btn:disabled { opacity: .55; cursor: wait; }
.btn.primaire { background: var(--accent-plein); border-color: var(--accent-plein); color: var(--accent-texte); letter-spacing: .02em; }
.btn.primaire:hover { filter: brightness(1.08); }
.btn.danger { color: var(--retard); }
.btn.lien { border: 0; background: none; color: var(--accent); padding: 8px 4px; min-height: 44px; box-shadow: none; }
.btn.large { width: 100%; min-height: 52px; font-size: 17px; }
.lg-box .btn.large { white-space: nowrap; padding: 8px 12px; }
.icone-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 4px;
  background: none; color: var(--texte-2); cursor: pointer; font-size: 24px; line-height: 1;
}
.icone-btn:hover { background: var(--surface-2); color: var(--accent); }
.icone-btn svg { width: 22px; height: 22px; }

input, textarea, select {
  width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--bord-champ); border-radius: 4px;
  background: var(--surface); font-size: 16px;   /* 16 px : pas de zoom automatique sur iPhone */
}
textarea { resize: vertical; min-height: 70px; }
/* Sites : 3 lignes, largeur du modal (pas de field-sizing : un domaine long elargissait le modal), coupure des mots longs.
   Hauteur maxi 6em pour garder l'etiquette visible clavier ouvert ; au-dela, le champ defile. */
#c-sites { min-height: 4.6em; max-height: 6em; overflow-wrap: anywhere; }
fieldset { min-width: 0; }   /* un fieldset prend la largeur de son contenu (min-content) par defaut */
.champ { min-width: 0; }
::placeholder { color: var(--texte-2); opacity: 1; }   /* >= 4,5:1 en clair et en sombre */
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); box-shadow: 0 0 12px var(--lueur); }
input.mono, textarea.mono { font-family: var(--mono); font-size: 16px; }
label, .etiquette { display: block; font-size: 14px; font-weight: 600; color: var(--texte-2); margin: 0 0 4px; }
.champ { margin-bottom: 14px; }
.grille-champs { display: grid; gap: 0 12px; }
.case { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 16px; color: var(--texte); font-weight: 500; margin: 8px 0; cursor: pointer; }
.case input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent-plein); box-shadow: none; }

.msg { padding: 10px 12px; border-radius: 4px; border-left: 3px solid var(--retard); background: var(--retard-fond); color: var(--retard); font-weight: 500; margin-bottom: 12px; }
.msg.ok { background: var(--fait-fond); color: var(--fait); border-left-color: var(--fait); }
.avis { padding: 10px 12px; border-radius: 4px; border-left: 3px solid var(--accent); background: var(--accent-doux); font-size: 14px; }
.meta { color: var(--texte-2); font-size: 14px; display: inline-flex; align-items: center; gap: 5px; }
p.meta { display: block; margin: 8px 0 0; }
.vide { color: var(--texte-2); text-align: center; padding: 28px 12px; margin: 0; list-style: none; font-family: var(--mono); font-size: 14px; }
.vide.erreur { color: var(--retard); }
.compte { font-weight: 600; color: var(--texte-2); font-size: 13px; }

/* Segments (filtres, priorite, theme) */
.segments { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border: 1px solid var(--bord-champ); border-radius: 6px; }
.segments .seg, .segments label {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; margin: 0;
  min-height: 44px; border: 1px solid transparent; border-radius: 4px; background: none; cursor: pointer;
  font-size: 15px; font-weight: 600; color: var(--texte-2); white-space: nowrap;
}
.segments .seg[aria-pressed="true"], .segments label:has(input:checked) {
  background: var(--surface); color: var(--texte); border-color: var(--accent); box-shadow: 0 0 10px var(--lueur);
}
.segments label { position: relative; }   /* sinon la radio masquee se place sous le modal et le focus le fait defiler */
.segments label input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; min-height: 0; margin: 0; pointer-events: none; box-shadow: none; }
.segments label:has(input:focus-visible) { outline: 3px solid var(--accent); }
.seg .compte { background: var(--surface); border-radius: 3px; padding: 0 6px; }
.seg[aria-pressed="true"] .compte { background: var(--accent-doux); color: var(--accent); }

/* ---------- Reacteur (decor) ---------- */

.reacteur { position: absolute; inset: 0; color: var(--accent); pointer-events: none; }
.reacteur svg, .reacteur .r-tourne, .reacteur .r-contre { position: absolute; inset: 0; width: 100%; height: 100%; }
.r-tourne { animation: tourne 24s linear infinite; }
.r-contre { animation: tourne 40s linear infinite reverse; }
.r-tourne svg { opacity: .8; }
.r-lueur {
  position: absolute; inset: 8%; border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 195, 240, .55) 0%, rgba(79, 195, 240, .18) 45%, transparent 70%);
  animation: respire 4s ease-in-out infinite;
}
.r-coeur {
  position: absolute; inset: 22%; border-radius: 50%; background: var(--coeur);
  box-shadow: 0 0 0 2px rgba(79, 195, 240, .7), 0 0 18px rgba(79, 195, 240, .55), inset 0 0 14px rgba(79, 195, 240, .35);
}
@keyframes tourne { to { transform: rotate(360deg); } }
@keyframes respire { 0%, 100% { opacity: .55; transform: scale(.94); } 50% { opacity: 1; transform: scale(1.04); } }
.alerte .reacteur { color: var(--retard-hud, #ff7a70); }
.alerte .r-lueur { background: radial-gradient(circle, rgba(255, 122, 112, .5) 0%, rgba(255, 122, 112, .16) 45%, transparent 70%); }
.alerte .r-coeur { box-shadow: 0 0 0 2px rgba(255, 122, 112, .75), 0 0 18px rgba(255, 122, 112, .5), inset 0 0 14px rgba(255, 122, 112, .3); }

/* ---------- Connexion ---------- */

body.login { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 16px; }
.lg-box {
  position: relative; width: 100%; max-width: 400px; background: var(--panneau); border: 1px solid var(--bord-vif);
  border-radius: var(--rayon); padding: 24px 20px 28px; box-shadow: 0 0 0 1px var(--lueur), 0 0 40px rgba(79, 195, 240, .12); text-align: center;
}
.lg-reacteur { position: relative; width: 120px; height: 120px; margin: 0 auto 6px; display: grid; place-items: center; }
.lg-logo { position: relative; border-radius: 10px; }
.lg-box h1 { font-size: 26px; margin: 4px 0 4px; }
.lg-sous { color: var(--texte-2); margin: 0 0 20px; }
.lg-box .btn svg { width: 22px; height: 22px; }
.aide { color: var(--texte-2); font-size: 14px; margin: 8px 0 0; }
.lg-invit { margin-top: 22px; text-align: left; border-top: 1px solid var(--bord); padding-top: 14px; }
.lg-invit summary { cursor: pointer; font-weight: 600; color: var(--accent); min-height: 44px; display: flex; align-items: center; }
.lg-invit form { display: grid; gap: 4px; }
.lg-invit label { margin-top: 10px; }
.lg-invit .btn { margin-top: 14px; }
.lg-box .msg { text-align: left; }

/* Crochets de coin (tuiles, panneaux) : deux pseudo-elements, couleur --c */
.crochets { position: relative; }
.crochets::before, .crochets::after {
  content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; border: 0 solid var(--c, var(--accent));
}
.crochets::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.crochets::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.lg-box::before, .lg-box::after { content: ""; position: absolute; width: 18px; height: 18px; border: 0 solid var(--accent); pointer-events: none; }
.lg-box::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.lg-box::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }

/* ---------- En-tete ---------- */

.barre .icone-btn { flex: none; }
.barre {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px;
  padding: 8px 8px 8px 16px; padding-top: calc(8px + env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--bord);
  box-shadow: 0 1px 0 var(--lueur);
}
.marque { display: flex; align-items: center; gap: 8px; min-width: 44px; min-height: 44px; color: var(--texte); text-decoration: none; font: 700 17px/1 var(--titre); letter-spacing: .12em; text-transform: uppercase; margin-right: auto; }
.marque img { border-radius: 5px; }
.marque span { display: none; }
.nav { display: flex; gap: 2px; }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 4px; color: var(--texte-2); text-decoration: none; font-weight: 600; font-size: 15px; border-bottom: 2px solid transparent; }
.nav a:hover { background: var(--surface-2); color: var(--texte); }
.nav a[aria-current="page"] { color: var(--accent); background: var(--accent-doux); border-bottom-color: var(--accent); }

/* Ligne « console » sous l'en-tete : etat reseau, horloge, utilisateur */
.console {
  display: flex; align-items: center; gap: 14px; max-width: 1280px; margin: 0 auto; padding: 8px 16px 0;
  font: 600 12px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--texte-2);
}
.c-etat { display: inline-flex; align-items: center; gap: 7px; color: var(--fait); }
.c-etat .led { color: var(--fait); }
.c-etat.hors-ligne, .c-etat.hors-ligne .led { color: var(--retard); }
.c-heure { margin-left: auto; color: var(--accent); }
.c-moi { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }

.vue { max-width: 1280px; margin: 0 auto; padding: 12px 16px; outline: none; }
.titre-vue { font-size: 24px; margin: 4px 0 12px; text-transform: uppercase; letter-spacing: .08em; }

/* ---------- Bandeau de stats (accueil) ---------- */

.stats {
  /* toujours sombre (instrument), meme en theme clair */
  --texte: #e8edf5; --texte-2: #96a7c0; --accent: #4fc3f0; --retard-hud: #ff7a70; --bientot-hud: #e9c46a;
  display: grid; grid-template-columns: 124px 1fr; align-items: center; gap: 14px;
  margin: 0 0 14px; padding: 12px 14px; border: 1px solid #1e2d45; border-radius: var(--rayon);
  background: linear-gradient(135deg, #0b1a2e, #070b14 70%); color: var(--texte);
  --c: #4fc3f0;
}
.r-bloc { position: relative; width: 124px; height: 124px; display: grid; place-items: center; }
.r-valeur { position: relative; display: grid; justify-items: center; line-height: 1; }
.r-n { font: 700 28px/1 var(--mono); color: #e8edf5; }
.r-l { font: 600 12px/1.2 var(--mono); letter-spacing: 0; color: #96a7c0; margin-top: 3px; }   /* minuscules : tient dans le coeur a 320 px */
.alerte .r-n { color: var(--retard-hud); }
.stats-l { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.stats-l li { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed #1e2d45; }
.stats-l li:last-child { border-bottom: 0; }
.stats-l .s-ouverts { display: none; }   /* seulement en bandeau compact (petit ecran bas) */
.s-l { font: 600 12px/1.3 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: #96a7c0; }
.s-n { font: 700 20px/1 var(--mono); color: #e8edf5; }
.s-n.retard { color: var(--retard-hud); }
.s-n.ok { color: #7fbf9e; }

/* ---------- Outils (recherche + filtres) ---------- */

.outils { display: grid; gap: 10px; margin-bottom: 14px; }
.recherche { position: relative; }
.recherche svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--accent); pointer-events: none; }
.recherche input { padding-left: 40px; }

/* ---------- Tuiles ---------- */

.grille { display: grid; grid-template-columns: 1fr; gap: 10px; }
.tuile {
  --c: var(--afaire);
  position: relative; display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left; cursor: pointer;
  padding: 14px; border-radius: var(--rayon); border: 1px solid var(--bord);
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 60%); box-shadow: var(--ombre); color: var(--texte);
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.tuile::before, .tuile::after { content: ""; position: absolute; width: 14px; height: 14px; pointer-events: none; border: 0 solid var(--c); }
.tuile::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; border-top-left-radius: var(--rayon); }
.tuile::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; border-bottom-right-radius: var(--rayon); }
.tuile:hover { border-color: var(--c); box-shadow: 0 0 0 1px var(--lueur), 0 0 18px var(--lueur); transform: translateY(-1px); }
.tuile.est-fait { --c: var(--fait-led); }
.tuile.est-fait .tuile-sujet, .tuile.est-fait .tuile-client { color: var(--texte-2); }
.tuile.est-retard { --c: var(--retard); }
.tuile.entre { animation: entree .32s cubic-bezier(.2, .7, .3, 1) both; animation-delay: calc(min(var(--i, 0), 12) * 35ms); }
@keyframes entree { from { opacity: 0; transform: translateY(10px); } }
.tuile-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.tuile-client { font-weight: 700; font-size: 16px; overflow-wrap: anywhere; }
.tuile-num { font: 700 14px/1.4 var(--mono); color: var(--texte-2); }
.tuile-sujet { font-size: 15px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tuile-p { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 2px; }
.tuile-p svg, .detail-h svg { width: 15px; height: 15px; }
.tuile-p .meta { font-family: var(--mono); font-size: 13px; }
.tuile-id { margin-left: auto; font: 600 13px/1 var(--mono); color: var(--texte-2); }

.badge {
  flex: none; display: inline-flex; align-items: center; gap: 6px; font: 700 12px/1.2 var(--mono);
  padding: 4px 8px; border-radius: 3px; white-space: nowrap; text-transform: uppercase; letter-spacing: .08em; border: 1px solid transparent;
}
.badge.afaire { background: var(--afaire-fond); color: var(--afaire); border-color: color-mix(in srgb, var(--afaire) 35%, transparent); }
.est-retard .badge.afaire { background: var(--retard-fond); color: var(--retard); border-color: color-mix(in srgb, var(--retard) 35%, transparent); }
.badge.fait { background: var(--fait-fond); color: var(--fait); }
.echeance { display: inline-flex; align-items: center; gap: 4px; font: 600 13px/1.4 var(--mono); padding: 2px 8px; border-radius: 3px; background: var(--surface-2); color: var(--texte-2); }
.echeance.retard { background: var(--retard-fond); color: var(--retard); }
.echeance.bientot { background: var(--bientot-fond); color: var(--bientot); }
.prio { font-size: 13px; font-weight: 600; padding: 2px 8px; border-radius: 3px; background: var(--surface-2); color: var(--texte-2); }
.prio.haute { background: var(--retard-fond); color: var(--retard); }

/* Hebergement : utilisateur cPanel (mono), voyant SSH */
.cpanel { display: inline-flex; align-items: center; gap: 6px; font: 600 13px/1.4 var(--mono); color: var(--accent); padding: 2px 8px; border: 1px solid var(--bord-vif); border-radius: 3px; background: var(--accent-doux); overflow-wrap: anywhere; }
.cpanel-l { color: var(--texte-2); font-weight: 600; letter-spacing: .04em; }
.ssh { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--fait); }
.ssh .led { color: var(--fait); }
.ssh.non { color: var(--texte-2); }
.ssh.non .led { color: var(--texte-2); background: transparent; border: 1px solid currentColor; box-shadow: none; }

/* ---------- Bouton Nouveau billet (pouce) ---------- */

.fab {
  position: fixed; z-index: 20; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 58px; border: 1px solid var(--accent); border-radius: 6px; background: var(--accent-plein); color: var(--accent-texte);
  font: 700 18px/1 var(--titre); letter-spacing: .06em; text-transform: uppercase; cursor: pointer;
  box-shadow: 0 0 0 1px var(--lueur), 0 8px 28px rgba(31, 165, 220, .4);
}
.fab svg { width: 24px; height: 24px; }
.fab:hover { filter: brightness(1.08); }
@media (max-width: 639px) { body.en-saisie .fab { display: none; } }   /* clavier ouvert : la barre ne cache pas le champ */

/* ---------- Modals (panneau holographique) ---------- */

dialog.modal {
  width: 100%; max-width: 100%; max-height: var(--vvh, 100%); height: var(--vvh, 100%); margin: 0; padding: 0; border: 0;
  inset: var(--vvt, 0px) 0 auto 0;   /* suit la zone visible quand le clavier est ouvert */
  background: var(--panneau); color: var(--texte);
}
dialog.modal[open] { display: flex; flex-direction: column; overflow: hidden; animation: apparait .2s ease-out; }   /* seul .modal-b defile */
@keyframes apparait { from { opacity: 0; } }
dialog.modal::before {   /* trait lumineux qui balaie le panneau a l'ouverture */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; z-index: 2; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: 0;
}
dialog.modal[open]::before { animation: trait .6s ease-out; }
@keyframes trait { 0% { opacity: .9; transform: translateY(0); } 100% { opacity: 0; transform: translateY(260px); } }
dialog.modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
dialog.modal::backdrop { background: rgba(4, 8, 16, .72); }
:root[data-theme="light"] dialog.modal::backdrop { background: rgba(11, 31, 51, .5); }
.modal-h {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none;
  padding: 8px 8px 8px 16px; padding-top: calc(8px + env(safe-area-inset-top)); border-bottom: 1px solid var(--bord);
  background: linear-gradient(90deg, var(--accent-doux), transparent 80%);
}
.modal-h h2 { font-size: 18px; text-transform: uppercase; letter-spacing: .08em; }
.modal-h h2::before { content: "// "; content: "// " / ""; color: var(--accent); font-family: var(--mono); }   /* decor, non lu */
.modal-b { padding: 16px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.modal-p {
  display: flex; gap: 10px; justify-content: flex-end; flex: none; padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--bord); background: var(--panneau);
}
.modal-p .btn { flex: 1; }
.modal-p .btn.primaire { flex: 2; }
body:has(dialog[open]) { overflow: hidden; }

fieldset.bloc-client, fieldset.bloc-heb { position: relative; border: 1px solid var(--bord); border-radius: var(--rayon); padding: 10px 12px 12px; margin: 0 0 14px; }
fieldset.bloc-client legend, fieldset.bloc-heb legend { font: 700 12px/1.3 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); padding: 0 6px; }
.cl-res { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.cl-res:empty { display: none; }
.cl-opt {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 48px; padding: 8px 12px;
  border: 1px solid var(--bord); border-radius: 4px; background: var(--surface-2); text-align: left; cursor: pointer;
}
.cl-opt span { font-size: 14px; color: var(--texte-2); }
.cl-opt:hover, .cl-opt:focus-visible { border-color: var(--accent); }
.cl-opt.nouveau { flex-direction: row; align-items: center; gap: 8px; color: var(--accent); background: var(--accent-doux); border-color: transparent; }
.cl-opt.nouveau span { color: var(--accent); font-size: 15px; }
.cl-choisi { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 2px; }
.cl-choisi[hidden], #cl-nouveau[hidden] { display: none; }
.cl-choisi > div { min-width: 0; overflow-wrap: anywhere; }
.cl-choisi .meta { display: block; }   /* coordonnees sous le nom, pas collees */
.cl-choisi .btn { flex: none; }
#cl-nouveau .btn.lien { justify-self: start; }

/* Detail d'un billet */
.detail-h { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.detail-sujet { font-size: 21px; margin: 12px 0 6px; overflow-wrap: anywhere; }
.detail-desc { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0 0 14px; }
.carte { position: relative; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; margin-bottom: 14px; }
.carte h2 { font-size: 15px; margin-bottom: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }
.client-mini { background: var(--surface-2); border-color: var(--bord); margin-top: 14px; }
.cm-nom { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.cm-heb { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-top: 6px; }
.coords { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 6px 0 2px; }
.coord { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; text-decoration: none; font-weight: 600; overflow-wrap: anywhere; }
.infos { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: 15px; }
.infos dt { color: var(--texte-2); font: 600 12px/1.9 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.infos dd { margin: 0; font-family: var(--mono); font-size: 14px; line-height: 1.7; }
.actions { display: flex; gap: 10px; margin-bottom: 20px; }
.actions .btn { flex: 1; min-height: 50px; }
.sous-titre { font-size: 14px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); }

/* Notes */
.f-note { display: grid; gap: 8px; margin-bottom: 12px; }
.f-note-p { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.f-note-p select { flex: 1 1 200px; }
.liste-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.note { background: var(--surface-2); border-left: 2px solid var(--accent); border-radius: 4px; padding: 10px 12px; }
.note p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note.evenement { background: none; border: 1px dashed var(--bord-vif); padding: 6px 12px; }
.note.evenement p { color: var(--texte-2); font-size: 14px; margin: 0; }
.note-h { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; }
.note-h time { color: var(--texte-2); }
.note-billet { border: 1px solid var(--bord-vif); background: var(--accent-doux); color: var(--accent); border-radius: 3px; padding: 2px 10px; font: 700 14px/1 var(--mono); cursor: pointer; min-height: 44px; min-width: 44px; }

/* Clients */
.liste-clients { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ligne-client {
  --c: var(--bord-vif);
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 12px 14px; border-radius: var(--rayon);
  background: var(--surface); border: 1px solid var(--bord); color: var(--texte); text-decoration: none;
}
.ligne-client:hover { border-color: var(--accent); box-shadow: 0 0 14px var(--lueur); }
.lc-nom { font-weight: 700; overflow-wrap: anywhere; }
.lc-info { grid-column: 1; color: var(--texte-2); font-size: 14px; overflow-wrap: anywhere; }
.lc-info .cpanel { margin-top: 4px; }
.lc-nb { grid-column: 2; grid-row: 1 / 3; align-self: center; font: 600 13px/1.3 var(--mono); color: var(--texte-2); white-space: nowrap; }
.lc-nb.actif { color: var(--afaire); }
.retour { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; text-decoration: none; font-weight: 600; margin-bottom: 6px; }
.fiche { --c: var(--accent); }
.fiche::before, .fiche::after { content: ""; position: absolute; width: 16px; height: 16px; border: 0 solid var(--c); pointer-events: none; }
.fiche::before { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.fiche::after { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.fiche-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.fiche-h h1 { font-size: 22px; overflow-wrap: anywhere; }
.heb { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--bord-vif); }
.heb-g { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 8px 0 0; align-items: baseline; }
.heb-g dt { font: 600 12px/1.6 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--texte-2); }
.heb-g dd { margin: 0; min-width: 0; font-family: var(--mono); font-size: 14px; overflow-wrap: anywhere; }
.heb-sites { display: flex; flex-wrap: wrap; gap: 0 12px; }
.heb-sites a { display: inline-flex; align-items: center; min-height: 44px; font-family: var(--mono); font-size: 14px; }
.section { margin: 20px 0; }
.section-h { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-h h2 { font-size: 16px; text-transform: uppercase; letter-spacing: .1em; }

/* Reglages */
.destinataires { display: grid; gap: 8px; }
.dest { display: flex; gap: 6px; align-items: center; }
.dest .icone-btn { flex: none; }
.f-p { display: flex; justify-content: flex-end; margin-top: 12px; }
.liste-cles { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.liste-cles li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--bord); }
.liste-cles .badge { margin-left: 8px; }

/* Notification (popover : couche du dessus, au-dessus d'un dialog ouvert) */
.toast {
  /* annuler les styles par defaut du popover (inset: 0, margin: auto, bordure) */
  position: fixed; z-index: 100; inset: auto 16px calc(86px + env(safe-area-inset-bottom)) 16px;
  margin: 0; border: 1px solid var(--accent); width: auto; height: auto; overflow: visible;
  padding: 12px 16px; border-radius: 4px; background: var(--toast-fond); color: var(--toast-texte); font-weight: 600; text-align: center;
  box-shadow: 0 0 0 1px var(--lueur), 0 8px 24px rgba(0, 0, 0, .35);
  pointer-events: none;   /* message seul : ne bloque jamais un toucher sur les boutons dessous */
}
.toast:popover-open { animation: apparait .18s ease-out; }
.banniere {
  flex: none; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top));
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
  background: var(--retard); color: var(--sur-retard); font-weight: 600; text-align: center;
}
.banniere .btn { background: var(--sur-retard); color: var(--retard); border-color: var(--sur-retard); box-shadow: none; }
.banniere .btn:focus-visible { outline: 3px solid var(--sur-retard); outline-offset: 3px; }   /* l'accent se perd sur le rouge */
.toast.erreur { background: var(--retard); color: var(--sur-retard); border-color: var(--retard); }
.toast[hidden] { display: none; }

/* ---------- Plus large ---------- */

@media (max-width: 359px) {
  .nav a { padding: 0 7px; font-size: 14px; } .barre { padding-left: 10px; }
  .stats { grid-template-columns: 112px 1fr; gap: 10px; padding: 10px; } .r-bloc { width: 112px; height: 112px; } .r-n { font-size: 24px; }
  .console { gap: 10px; letter-spacing: .06em; }
}
@media (min-width: 420px) { .marque span { display: inline; } }
/* Petit ecran bas (iPhone SE 320x568) : bandeau compact, reacteur reduit sans etiquette, « Ouverts » dans la liste. */
@media (max-width: 639px) and (max-height: 600px) {
  .stats { grid-template-columns: 64px 1fr; gap: 12px; padding: 8px 12px; margin-bottom: 10px; }
  .r-bloc { width: 64px; height: 64px; }
  .r-n { font-size: 18px; }
  .r-l { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .stats-l { gap: 0; }
  .stats-l .s-ouverts { display: flex; }
  .stats-l li { padding: 1px 0; }
  .s-l { font-size: 12px; letter-spacing: .04em; }
  .s-n { font-size: 15px; }
}
@media (min-width: 640px) {
  .grille { grid-template-columns: repeat(2, 1fr); }
  .outils { grid-template-columns: 1fr minmax(280px, auto); align-items: center; }
  .grille-champs { grid-template-columns: 1fr 1fr; }
  #cl-nouveau .champ:first-child { grid-column: 1 / -1; }
  dialog.modal {
    width: min(640px, calc(100% - 48px)); height: fit-content; max-height: calc(100% - 48px); margin: auto;
    border: 1px solid var(--bord-vif); border-radius: var(--rayon);
    box-shadow: 0 0 0 1px var(--lueur), 0 0 50px rgba(79, 195, 240, .16), 0 24px 60px rgba(0, 0, 0, .45);
    inset: 0;
  }
  dialog.modal.petit { width: min(460px, calc(100% - 48px)); }
  dialog.modal > form, .modal-b { flex: 0 1 auto; }   /* hauteur selon le contenu, defilement si trop haut */
  .modal-h { padding-top: 8px; }
  .modal-p { padding-bottom: 12px; }
  .modal-p .btn { flex: 0 0 auto; min-width: 120px; }
  .fab { left: auto; right: 24px; bottom: 24px; padding: 0 24px; }
  .toast { left: 50%; right: auto; transform: translateX(-50%); bottom: 96px; max-width: 480px; width: max-content; }
  dialog.modal .toast { top: 12px; bottom: auto; }   /* modal centre : ne pas couvrir ses boutons d'action */
  .vue { padding: 16px 24px; }
  .console { padding: 10px 24px 0; }
  .stats { grid-template-columns: 140px 1fr; padding: 14px 20px; gap: 22px; }
  .r-bloc { width: 140px; height: 140px; }
  .r-n { font-size: 34px; }
  .stats-l { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .stats-l li { flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 12px; border: 1px solid #1e2d45; border-radius: 4px; background: rgba(14, 22, 38, .6); }
  .stats-l li:last-child { border: 1px solid #1e2d45; }
  .s-n { font-size: 28px; }
}
@media (min-width: 960px) { .grille { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1240px) { .grille { grid-template-columns: repeat(4, 1fr); } }

/* Mouvement reduit : aucune animation ni transition, pas de ligne de balayage. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, dialog::backdrop { animation: none !important; transition: none !important; }
  body::after { display: none; }
  .tuile:hover { transform: none; }
}
