/* ═══════════════════════════════════════════════════════════════════════════
   KANALO — système de design « verre clair » (tablette, statistiques, HUB)
   ───────────────────────────────────────────────────────────────────────────
   Charte Équinoxes « CGlight-EQUINOXES-2024 » : bleu de Prusse, menthe, ardoise
   et leurs teintes ; la menthe ne s'écrit jamais sur blanc, le texte posé dessus
   est en Prusse. Polices de la charte : Raleway (titres), Montserrat (texte et
   chiffres), Roboto Condensed (surtitres). Trois polices, aucune italique.

   Le verre : un panneau translucide, un liseré de lumière en haut, une ombre
   douce. Le vrai flou d'arrière-plan (backdrop-filter) coûte cher sur une
   tablette d'entrée de gamme : il est réservé aux éléments flottants peu
   nombreux (.kn-verre-vrai : barre, dock, message, feuille). Les tuiles, qui
   sont nombreuses et posées sur un fond calme, utilisent un verre peint
   (.kn-verre) : même allure, aucun flou à calculer.

   Tout est préfixé .kn- : la même feuille sert dans le HUB sans rien y toucher.
   ═══════════════════════════════════════════════════════════════════════════ */

@font-face { font-family: 'Kanalo Titre'; src: url('polices/raleway.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Kanalo Texte'; src: url('polices/montserrat.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Kanalo Etroit'; src: url('polices/roboto-condensed.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }

.kn {
  /* Charte */
  --kn-prusse: #222339;        --kn-prusse-rgb: 34, 35, 57;
  --kn-prusse-2: #2d2f4a;
  --kn-prusse-3: #3b3d5e;
  --kn-menthe: #3ce65f;        --kn-menthe-rgb: 60, 230, 95;
  --kn-menthe-survol: #31d653;
  --kn-menthe-pale: #e4fce9;
  --kn-menthe-brume: #f1fdf4;
  --kn-ardoise: #757686;       --kn-ardoise-rgb: 117, 118, 134;
  --kn-ardoise-fonce: #5c5d70;
  --kn-ardoise-claire: #9394a3;
  --kn-ardoise-ligne: #e1e1e9;
  --kn-ardoise-pale: #ececf2;
  --kn-ardoise-brume: #f4f4f8;

  /* Rôles */
  --kn-encre: var(--kn-prusse);
  --kn-encre-2: var(--kn-ardoise-fonce);
  --kn-encre-3: var(--kn-ardoise);
  --kn-fond: #f5f6fa;
  --kn-alerte: #b4232a;          /* texte d'erreur sur clair : 6,6:1 */
  --kn-alerte-fond: #fdecec;
  --kn-attente: #8a5a00;         /* texte « en attente » sur clair : 5,9:1 */
  --kn-attente-fond: #fdf3dc;

  /* Verre */
  --kn-verre-fond: linear-gradient(145deg, rgba(255, 255, 255, .95) 0%, rgba(255, 255, 255, .80) 100%);
  --kn-verre-bord: rgba(255, 255, 255, .92);
  --kn-verre-ombre: 0 1px 0 rgba(255, 255, 255, .95) inset, 0 -1px 0 rgba(var(--kn-prusse-rgb), .05) inset,
                    0 1px 2px rgba(var(--kn-prusse-rgb), .05), 0 14px 34px -18px rgba(var(--kn-prusse-rgb), .28);
  --kn-verre-ombre-haute: 0 1px 0 rgba(255, 255, 255, .95) inset, 0 -1px 0 rgba(var(--kn-prusse-rgb), .06) inset,
                    0 2px 4px rgba(var(--kn-prusse-rgb), .06), 0 28px 60px -24px rgba(var(--kn-prusse-rgb), .40);
  --kn-flou: blur(22px) saturate(170%);

  /* Formes et mouvement */
  --kn-r-s: 14px;
  --kn-r-m: 22px;
  --kn-r-l: 30px;
  --kn-ressort: cubic-bezier(.2, .9, .25, 1.18);
  --kn-doux: cubic-bezier(.22, .8, .3, 1);

  /* Polices */
  --kn-titre: 'Kanalo Titre', 'Raleway', system-ui, sans-serif;
  --kn-texte: 'Kanalo Texte', 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --kn-etroit: 'Kanalo Etroit', 'Roboto Condensed', 'Arial Narrow', sans-serif;

  font-family: var(--kn-texte);
  color: var(--kn-encre);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
/* Remises à zéro en :where() : spécificité nulle, pour qu'une simple classe (.kn-tuile, .kn-bouton…) les emporte toujours.
   Écrites en « .kn button », elles annulaient les marges intérieures de toutes les tuiles et de tous les boutons. */
:where(.kn) *, :where(.kn) *::before, :where(.kn) *::after { box-sizing: border-box; }
:where(.kn) button { font: inherit; color: inherit; border: 0; background: none; padding: 0; margin: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:where(.kn) button:disabled { cursor: default; }
.kn :focus-visible { outline: 3px solid rgba(var(--kn-prusse-rgb), .55); outline-offset: 3px; border-radius: 12px; }
.kn [hidden] { display: none !important; }

/* ── Textes ─────────────────────────────────────────────────────────────── */
.kn-surtitre {
  font-family: var(--kn-etroit); font-weight: 600; font-size: 13px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--kn-encre-2); margin: 0;
}
.kn-titre {
  font-family: var(--kn-titre); font-weight: 300; font-size: clamp(30px, 4.2vw, 50px); line-height: 1.08; letter-spacing: -.012em;
  font-feature-settings: 'lnum' 1; margin: 0; color: var(--kn-encre); text-wrap: balance;
}
.kn-titre b, .kn-titre strong { font-weight: 700; }
.kn-sous-titre { font-family: var(--kn-titre); font-weight: 600; font-size: 20px; line-height: 1.2; letter-spacing: -.005em; font-feature-settings: 'lnum' 1; margin: 0; }
.kn-aide { font-size: 15px; color: var(--kn-encre-2); margin: 0; }
.kn-chiffres { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

/* ── Verre ──────────────────────────────────────────────────────────────── */
.kn-verre, .kn-verre-vrai {
  position: relative;
  background: var(--kn-verre-fond);
  border: 1px solid var(--kn-verre-bord);
  box-shadow: var(--kn-verre-ombre);
  border-radius: var(--kn-r-l);
}
/* Le vrai verre : ce qui flotte au-dessus du décor. Sans flou disponible (vieux navigateur), le fond est simplement plus couvrant. */
.kn-verre-vrai { background: rgba(255, 255, 255, .88); }
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .kn-verre-vrai {
    background: linear-gradient(145deg, rgba(255, 255, 255, .70) 0%, rgba(255, 255, 255, .46) 100%);
    -webkit-backdrop-filter: var(--kn-flou); backdrop-filter: var(--kn-flou);
  }
}
/* Reflet : une lame de lumière en haut à gauche, comme sur une vitre bombée. */
.kn-verre::before, .kn-verre-vrai::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(160deg, rgba(255, 255, 255, .75) 0%, rgba(255, 255, 255, 0) 34%);
  opacity: .7;
}
.kn-verre > *, .kn-verre-vrai > * { position: relative; }

/* ── Boutons ────────────────────────────────────────────────────────────── */
.kn-bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 0 28px; border-radius: 999px;
  font-weight: 600; font-size: 17px; letter-spacing: .005em; white-space: nowrap;
  transition: transform .18s var(--kn-ressort), box-shadow .2s var(--kn-doux), background-color .15s, opacity .15s;
  user-select: none; -webkit-user-select: none;
}
.kn-bouton:active { transform: scale(.96); }
.kn-bouton [class^='kn-i-'] { font-size: 22px; }
.kn-bouton-principal {
  background: var(--kn-prusse); color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 12px 26px -12px rgba(var(--kn-prusse-rgb), .65);
}
.kn-bouton-principal [class^='kn-i-'] { color: var(--kn-menthe); }
.kn-bouton-principal:disabled { background: rgba(var(--kn-prusse-rgb), .28); box-shadow: none; }
.kn-bouton-menthe { background: var(--kn-menthe); color: var(--kn-prusse); box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset, 0 12px 26px -12px rgba(var(--kn-menthe-rgb), .9); }
.kn-bouton-verre { background: var(--kn-verre-fond); border: 1px solid var(--kn-verre-bord); box-shadow: var(--kn-verre-ombre); color: var(--kn-encre); }
.kn-bouton-discret { color: var(--kn-encre-2); padding: 0 18px; min-height: 48px; font-weight: 500; }
.kn-bouton-discret:active { background: rgba(var(--kn-prusse-rgb), .06); }
.kn-bouton-petit { min-height: 44px; padding: 0 18px; font-size: 15px; }
.kn-bouton-danger { color: var(--kn-alerte); }

/* Pastille : une information courte, ou un petit bouton. */
.kn-pastille {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px;
  font-weight: 600; font-size: 14.5px; color: var(--kn-encre);
  background: rgba(255, 255, 255, .66); border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 6px 16px -10px rgba(var(--kn-prusse-rgb), .3);
  white-space: nowrap;
}
.kn-pastille [class^='kn-i-'] { font-size: 18px; color: var(--kn-encre-2); }
button.kn-pastille { transition: transform .18s var(--kn-ressort); }
button.kn-pastille:active { transform: scale(.95); }

/* ── Contrôle segmenté ──────────────────────────────────────────────────── */
.kn-segments {
  display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px;
  background: rgba(var(--kn-prusse-rgb), .06); box-shadow: 0 1px 1px rgba(var(--kn-prusse-rgb), .06) inset;
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.kn-segments::-webkit-scrollbar { display: none; }
.kn-segments button {
  min-height: 40px; padding: 0 16px; border-radius: 999px; font-weight: 600; font-size: 14.5px; color: var(--kn-encre-2); white-space: nowrap;
  transition: background-color .18s, color .18s, box-shadow .18s, transform .18s var(--kn-ressort);
}
.kn-segments button:active { transform: scale(.96); }
.kn-segments button[aria-pressed='true'], .kn-segments button.kn-actif {
  background: #fff; color: var(--kn-encre);
  box-shadow: 0 1px 0 #fff inset, 0 1px 2px rgba(var(--kn-prusse-rgb), .10), 0 6px 14px -8px rgba(var(--kn-prusse-rgb), .35);
}

/* ── Champs (HUB) ───────────────────────────────────────────────────────── */
.kn-champ { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kn-champ > span, .kn-libelle { font-family: var(--kn-etroit); font-weight: 600; font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--kn-encre-2); }
.kn-champ input[type='text'], .kn-champ input[type='date'], .kn-champ input[type='number'], .kn-champ select, .kn-entree {
  font: inherit; font-weight: 500; color: var(--kn-encre); min-height: 48px; padding: 0 16px; border-radius: 14px;
  background: rgba(255, 255, 255, .8); border: 1px solid var(--kn-ardoise-ligne); outline: none; width: 100%; min-width: 0;
  box-shadow: 0 1px 2px rgba(var(--kn-prusse-rgb), .04) inset;
  transition: border-color .15s, box-shadow .15s;
}
.kn-champ input:focus, .kn-champ select:focus, .kn-entree:focus { border-color: var(--kn-prusse); box-shadow: 0 0 0 3px rgba(var(--kn-prusse-rgb), .12); }

/* Interrupteur */
.kn-inter { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; min-height: 44px; }
.kn-inter input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.kn-inter i { flex: none; width: 52px; height: 32px; border-radius: 999px; background: rgba(var(--kn-prusse-rgb), .16); position: relative; transition: background-color .2s; box-shadow: 0 1px 2px rgba(var(--kn-prusse-rgb), .12) inset; }
.kn-inter i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(var(--kn-prusse-rgb), .3); transition: transform .22s var(--kn-ressort); }
.kn-inter input:checked + i { background: var(--kn-menthe); }
.kn-inter input:checked + i::after { transform: translateX(20px); }
.kn-inter input:focus-visible + i { outline: 3px solid rgba(var(--kn-prusse-rgb), .55); outline-offset: 3px; }

/* ── Bulle d'icône (canal, réponse) ─────────────────────────────────────── */
.kn-bulle {
  --c: var(--kn-prusse);
  flex: none; width: 56px; height: 56px; border-radius: 18px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--c);
  /* color-mix() n'existe pas sur les tablettes anciennes (Chrome < 111, Safari < 16.2) : une déclaration qui l'emploie est ignorée
     EN ENTIER. Chaque emploi est donc précédé d'une version simple, qui reste en vigueur sur ces appareils. */
  background: rgba(var(--kn-prusse-rgb), .07);
  background: color-mix(in srgb, var(--c) 13%, #fff);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 0 0 1px rgba(var(--kn-prusse-rgb), .08) inset;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .9) inset, 0 0 0 1px color-mix(in srgb, var(--c) 16%, transparent) inset;
  font-size: 28px;
}
.kn-bulle-s { width: 36px; height: 36px; border-radius: 12px; font-size: 19px; }

/* ── Message flottant ───────────────────────────────────────────────────── */
.kn-message {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 18px); z-index: 60;
  transform: translate(-50%, -140%); opacity: 0;
  display: flex; align-items: center; gap: 14px; padding: 10px 12px 10px 18px; border-radius: 999px; max-width: min(92vw, 720px);
  transition: transform .42s var(--kn-ressort), opacity .25s;
  box-shadow: var(--kn-verre-ombre-haute);
}
.kn-message.kn-visible { transform: translate(-50%, 0); opacity: 1; }
.kn-message-coche { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--kn-menthe); color: var(--kn-prusse); display: inline-flex; align-items: center; justify-content: center; font-size: 20px; }
.kn-message-texte { font-weight: 600; font-size: 15.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kn-message-texte small { font-weight: 500; font-size: 14.5px; color: var(--kn-encre-2); margin-left: 8px; }

/* ── Feuille (boîte de dialogue qui monte du bas) ───────────────────────── */
.kn-voile { position: fixed; inset: 0; z-index: 70; background: rgba(var(--kn-prusse-rgb), .28); opacity: 0; transition: opacity .25s; display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.kn-voile.kn-visible { opacity: 1; }
.kn-feuille { width: min(100%, 620px); max-height: min(88vh, 760px); overflow: auto; padding: 28px; border-radius: 34px; transform: translateY(40px) scale(.98); transition: transform .38s var(--kn-ressort); box-shadow: var(--kn-verre-ombre-haute); }
.kn-voile.kn-visible .kn-feuille { transform: none; }
@media (min-width: 720px) and (min-height: 620px) { .kn-voile { align-items: center; } }

/* ── Mouvement réduit ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .kn *, .kn *::before, .kn *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
