/* Second Cerveau COM 64 - charte 2026, memes jetons que Cockpit SEO et
   Mission Board. Feuille reprise de la maquette validee le 2026-08-05,
   augmentee des polices auto-hebergees, de l'ecran de connexion et des
   pop-ups de formulaire. */

/* ---------- Polices auto-hebergees (RGPD) : League Spartan + Quicksand ---------- */
@font-face {
  font-family: "League Spartan"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/league-spartan-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "League Spartan"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/league-spartan-latinext-600.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+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "League Spartan"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/league-spartan-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "League Spartan"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/league-spartan-latinext-700.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+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Quicksand"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/fonts/quicksand-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Quicksand"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("/fonts/quicksand-latinext-500.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+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Quicksand"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/quicksand-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Quicksand"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("/fonts/quicksand-latinext-600.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+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Quicksand"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/quicksand-latin-700.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Quicksand"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/quicksand-latinext-700.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+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

:root {
  /* Charte COM 64 2026 — mêmes jetons que Cockpit SEO et Mission Board */
  --navy-950: #0F172A;
  --navy-900: #16163F;
  --navy-800: #1E2673;
  --navy-700: #2B436D;
  --blue-600: #0901FF;
  --blue-700: #0701CC;
  --icon-blue: #151A4F;
  --mauve-600: #4551BF;
  --gold-700: #8A5D06;
  --bg-main: #EEF1FD;
  --bg-light: #F3F7FE;
  --blue-pale: #E7F6FF;
  --grey-soft: #F3F3F3;
  --border-col: #D1DAE5;
  --placeholder: #64708F;        /* placeholders de champ — 4,93:1 sur blanc */
  --success-600: #0E7A4A; --success-100: #DCF5E8;
  --warning-600: #8A5D06; --warning-100: #F4EDDE;
  --error-600: #C81E3C;   --error-100: #FDE4E9;
  --info-600: #0901FF;    --info-100: #F3F7FE;
  --surface-card: #FFFFFF;
  --text-strong: var(--navy-950);
  --text-body: var(--navy-900);
  --text-muted: var(--navy-700);
  /* Couleurs sur fond inverse navy (WCAG AA verifie sur #16163F) */
  --label-on-inverse: #8A96CC;
  --nav-idle: #B8C2DF;
  --dot-ok: #34D399;
  --error-on-inverse: #FF8DA1;
  --error-700: #A81830;
  --font-display: "League Spartan", "Trebuchet MS", Verdana, sans-serif;
  --font-body: "Quicksand", "Trebuchet MS", Verdana, sans-serif;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(22,22,63,.06), 0 2px 8px rgba(22,22,63,.05);
  --shadow-md: 0 2px 6px rgba(22,22,63,.06), 0 12px 32px rgba(22,22,63,.10);
  --shadow-cta: 0 8px 24px rgba(9,1,255,.28);
  --focus-shadow: 0 0 0 2px #FFFFFF, 0 0 0 4px var(--blue-600);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --duration-fast: 150ms;
}
@media (prefers-reduced-motion: reduce) {
  :root { --duration-fast: 0ms; }
}
* { margin: 0; padding: 0; box-sizing: border-box; }
/* L'attribut hidden doit toujours gagner, même sur un élément dont la classe
   pose un display (la pop-up en display grid, le menu du bouton plus...). */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  font-size: 17px; line-height: 1.65; font-weight: 500;
  color: var(--text-body); background: var(--bg-main);
}
:focus-visible { outline: none; box-shadow: var(--focus-shadow); border-radius: 4px; }
::placeholder { color: var(--placeholder); opacity: 1; }
.app { display: flex; min-height: 100vh; }

/* ---------- Barre latérale ---------- */
.sidebar {
  width: 268px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: var(--navy-900); color: #FFFFFF;
  display: flex; flex-direction: column; padding: 28px 16px 20px;
  overflow-y: auto;
}
.brand { padding: 0 12px 20px; border-bottom: 1px solid rgba(255,255,255,.16); }
.brand-logo { display: block; width: 100%; max-width: 198px; height: auto; }
.brand-sub {
  font-family: var(--font-display); font-weight: 700; font-size: 22px;
  letter-spacing: .06em; text-transform: uppercase; color: #FFFFFF;
  text-align: center; line-height: 1.1; margin-top: 14px;
}
.brand-sub span { color: #9AA8FF; }

/* ---------- Le cerveau qui réfléchit ---------- */
/* Illustration filaire entre le nom de l'application et le séparateur :
   traits de la couleur du mot CERVEAU (#9AA8FF), fond quasi transparent.
   Les impulsions circulent le long des synapses (tirets qui avancent),
   les neurones pulsent en décalé. Décoratif : aria-hidden, et tout
   s'immobilise quand le système demande une interface sans animation. */
.cerveau-anime { display: block; width: 86%; max-width: 204px; height: auto; margin: 14px auto 0; }
.cerveau-trait {
  fill: url(#cerveau-volume); stroke: #9AA8FF; stroke-width: 2.5;
  stroke-linecap: round; stroke-linejoin: round;
  animation: cerveau-respire 5.5s ease-in-out infinite;
}
/* Le bord interieur du dome : une ligne qui double le contour a l'interieur,
   c'est elle qui donne la rondeur. */
.cerveau-fond {
  fill: none; stroke: #9AA8FF; stroke-width: 1.5; opacity: .18;
  stroke-linecap: round;
}
/* Le tronc cerebral (trace ouvert : jamais le remplissage de la masse) */
.cerveau-tronc {
  fill: none; stroke: #9AA8FF; stroke-width: 2.5; stroke-linecap: round;
}
/* Le reflet de lumiere sur le dessus du dome */
.cerveau-reflet {
  fill: none; stroke: #E7EBFF; stroke-width: 4; opacity: .2;
  stroke-linecap: round;
}
/* Les stries paralleles du cervelet */
.cerveau-strie {
  fill: none; stroke: #9AA8FF; stroke-width: 1.8; opacity: .45;
  stroke-linecap: round;
}
.cerveau-pli {
  fill: none; stroke: #9AA8FF; stroke-width: 2; opacity: .5;
  stroke-linecap: round;
}
/* Le flux de pensee : des tirets lumineux qui remontent les circonvolutions
   elles-memes - le cerveau est le reseau, pas un decor pose dessus. */
.synapse {
  fill: none; stroke: #D6DCFF; stroke-width: 1.4; stroke-linecap: round;
  stroke-dasharray: 2.5 19; opacity: .8;
  animation: synapse-flux 4.2s linear infinite;
}
.neurone { fill: #9AA8FF; animation: neurone-pulse 2.8s ease-in-out infinite; }
@keyframes synapse-flux { to { stroke-dashoffset: -72; } }
@keyframes neurone-pulse {
  0%, 100% { opacity: .35; r: 2.6px; }
  50% { opacity: 1; r: 3.6px; }
}
@keyframes cerveau-respire {
  0%, 100% { opacity: .78; }
  50% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .cerveau-trait, .synapse, .neurone { animation: none; }
  .synapse { stroke-dasharray: none; opacity: .3; }
}
.nav { margin-top: 20px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-md);
  color: #B8C2DF; text-decoration: none; font-weight: 600; font-size: 15.5px;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
  cursor: pointer;
}
.nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav a:hover { background: rgba(255,255,255,.08); color: #FFFFFF; }
.nav a.active { background: rgba(255,255,255,.12); color: #FFFFFF; }
/* ---------- Groupes dépliables (design repris du Cockpit SEO) ---------- */
/* L'entrée de groupe se présente comme une entrée simple ; la hiérarchie
   passe par le décalage des entrées filles et leur rail vertical. */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group > summary {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  padding: 11px 14px; border-radius: var(--radius-md);
  color: #B8C2DF; font-weight: 600; font-size: 15.5px;
  transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
  list-style: none;
}
/* Le triangle natif ferait doublon avec le bouton plus */
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::marker { content: ""; }
.nav-group > summary > svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-group-label { flex: 1; min-width: 0; }
.nav-group > summary:hover { background: rgba(255,255,255,.08); color: #FFFFFF; }
.nav-group > summary:focus-visible { box-shadow: var(--focus-shadow); }
.nav-group[open] > summary { color: #FFFFFF; }
/* Le plus pivote de 45 degrés à l'ouverture : il devient une croix, sans
   qu'il faille charger une deuxième icône. */
.nav-group > summary > svg.nav-plus {
  width: 17px; height: 17px; opacity: .7;
  transition: transform var(--duration-fast) var(--ease-out), opacity var(--duration-fast) var(--ease-out);
}
.nav-group > summary:hover .nav-plus { opacity: 1; }
.nav-group[open] .nav-plus { transform: rotate(45deg); opacity: 1; }
/* Entrées filles : décalées et reliées par un rail vertical qui matérialise
   l'appartenance au groupe. */
.nav-group a {
  margin-left: 25px; padding-left: 13px; font-size: 15.5px;
  border-left: 1.5px solid rgba(255,255,255,.16);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.nav-group a svg { width: 18px; height: 18px; }
.nav-group a.active { border-left-color: #9AA8FF; }
@media (prefers-reduced-motion: reduce) {
  .nav-plus { transition: none; }
}
/* Version de l'application (repris du Cockpit SEO) : pied de barre latérale.
   Le numéro vient du package.json via /api/session — jamais écrit en dur. */
.app-version {
  padding: 10px 12px 8px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
}
.app-version .version-label {
  font-family: var(--font-display); font-weight: 600; font-size: 11px;
  letter-spacing: .16em; text-transform: uppercase; color: #B8C2DF;
}
.app-version .version-num {
  font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700;
  color: #FFFFFF; background: rgba(255,255,255,.10);
  border-radius: var(--radius-pill); padding: 2px 10px;
}
.api-status { padding: 14px 12px 0; border-top: 1px solid rgba(255,255,255,.16); }
.api-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #B8C2DF; padding: 3px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #34D399; flex-shrink: 0; }
.dot-off { background: #64708F; }

/* ---------- Zone principale ---------- */
main { flex: 1; min-width: 0; padding: 28px clamp(20px, 3.5vw, 48px) 40px; display: flex; flex-direction: column; }
.view { display: none; }
.view.active { display: block; }
.view-head { margin-bottom: 26px; padding-right: 112px; }
body.sans-sety .view-head { padding-right: 0; }
.overline {
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--blue-600);
}
h1 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(30px, 3vw, 40px);
  line-height: 1.05; letter-spacing: -0.02em; color: var(--text-strong); margin-top: 6px;
}
.view-head p { margin-top: 10px; color: var(--text-muted); }
h2.card-title {
  font-family: var(--font-display); font-weight: 600; font-size: 21px;
  line-height: 1.15; letter-spacing: -0.01em; color: var(--text-strong);
}
/* ---------- Fil d'Ariane (design corrigé de Mission Board) ---------- */
.fil { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-width: 0; }
.fil-lien, .fil-actuel {
  font-family: var(--font-display); font-weight: 600; font-size: 12.5px;
  letter-spacing: .12em; text-transform: uppercase; line-height: 1;
}
.fil-lien {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--blue-600);
  transition: color var(--duration-fast) var(--ease-out);
}
.fil-lien:hover { color: var(--blue-700); text-decoration: underline; text-underline-offset: 3px; }
/* Chevron en gris bleuté : lisible, mais en retrait des deux libellés. */
.fil-sep { display: flex; color: var(--placeholder); flex-shrink: 0; }
.fil-sep svg { width: 14px; height: 14px; }
.fil-actuel {
  color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}

/* ---------- Champs de saisie ---------- */
input[type="search"], input[type="text"], input[type="password"], input[type="date"], select {
  font-family: var(--font-body); font-size: 16px; font-weight: 500; color: var(--text-body);
  background: #FFFFFF; border: 1.5px solid var(--border-col); border-radius: var(--radius-sm);
  padding: 11px 14px; min-width: 0;
}
input:focus, select:focus { outline: none; box-shadow: var(--focus-shadow); border-color: var(--blue-600); }
select {
  appearance: none; -webkit-appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%232B436D' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 44px;
}

/* ---------- Raccourci Séty (repris du Cockpit SEO) ---------- */
.sety-link {
  position: absolute; top: 24px; right: clamp(20px, 3.5vw, 48px); z-index: 5;
  line-height: 0; border-radius: 50%;
  transform: scale(.92); transform-origin: top right;
  transition: transform var(--duration-fast) var(--ease-out);
}
.sety-link img {
  height: 100px; width: auto; display: block;
  filter: drop-shadow(0 4px 8px rgba(15, 23, 42, .14));
  transition: filter var(--duration-fast) var(--ease-out);
}
.sety-link:hover { transform: scale(1) translateY(-2px); }
.sety-link:hover img { filter: drop-shadow(0 7px 12px rgba(15, 23, 42, .19)); }
.sety-link:focus-visible { box-shadow: var(--focus-shadow); }

/* ---------- Cartes ---------- */
.card {
  background: var(--surface-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 24px; margin-bottom: 24px;
}
.card-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-header .count { font-size: 14px; color: var(--text-muted); font-weight: 600; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 20px; margin-bottom: 24px; }
.stat { background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 20px 24px; }
.stat .overline { color: var(--text-muted); font-size: 12px; }
.stat .value {
  font-family: var(--font-display); font-weight: 700; font-size: 32px;
  letter-spacing: -0.02em; color: var(--text-strong); line-height: 1.1; margin-top: 8px;
}
.stat .hint { font-size: 14px; color: var(--text-muted); margin-top: 6px; }

/* ---------- Pastilles et badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13.5px; font-weight: 700; line-height: 1;
  padding: 7px 12px; border-radius: var(--radius-pill);
}
.chip-domaine { background: var(--blue-pale); color: var(--navy-800); }
.chip-nature  { background: var(--navy-900); color: #FFFFFF; }
.chip-mot     { background: transparent; color: var(--text-muted); border: 1.5px solid var(--border-col); }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }

/* ---------- Référentiel : lignes à barres ---------- */
.dom-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.dom-row {
  display: grid; grid-template-columns: 150px 1fr 44px; align-items: center; gap: 14px;
  padding: 6px 10px; margin: 0 -10px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.dom-row:hover { background: var(--bg-light); }
.dom-row:hover .nom { color: var(--blue-600); }
.dom-row .nom small { font-weight: 600; font-size: 12px; color: var(--text-muted); margin-left: 6px; }
/* Les libellés de sujets sont plus longs que les noms de domaines */
.sujet-liste .dom-row { grid-template-columns: 220px 1fr 44px; }
/* Nuage de mots-clés : mêmes pastilles que la recherche, avec le compte */
.nuage { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.nuage .chip {
  background: var(--surface-card); color: var(--navy-800);
  border: 1.5px solid var(--border-col); cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
  font-family: inherit;
}
.nuage .chip:hover { border-color: var(--blue-600); color: var(--blue-600); }
.nuage .chip .nb { font-weight: 600; color: var(--text-muted); }
.dom-row .nom { font-weight: 700; font-size: 15px; color: var(--text-strong); }
.dom-row .barre { height: 10px; border-radius: var(--radius-pill); background: var(--grey-soft); overflow: hidden; }
.dom-row .barre i { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--navy-800); }
.dom-row .nb { text-align: right; font-weight: 700; font-size: 14px; color: var(--text-muted); }

/* ---------- Listes de fiches (dernières / résultats) ---------- */
.fiche-liste { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.fiche-item {
  border: 1.5px solid var(--border-col); border-radius: var(--radius-md);
  padding: 16px 18px; background: var(--surface-card);
  transition: box-shadow var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.fiche-item:hover { border-color: var(--navy-800); box-shadow: var(--shadow-sm); }
.fiche-item h3 {
  font-family: var(--font-display); font-weight: 600; font-size: 18px;
  letter-spacing: -0.01em; color: var(--text-strong); line-height: 1.2;
}
.fiche-item h3 button {
  background: none; border: 0; padding: 0; font: inherit; color: inherit;
  cursor: pointer; text-align: left;
}
.fiche-item h3 button:hover { color: var(--blue-600); }
.fiche-item .essentiel { margin-top: 10px; font-size: 15px; color: var(--text-body); }
.fiche-item .meta-row { margin-top: 10px; }
/* La date vit sur sa propre ligne, en bas de carte : même position dans
   toutes les cartes, aucune différence esthétique entre elles. */
.fiche-item .quand { display: block; margin-top: 8px; font-size: 13px; color: var(--text-muted); font-weight: 600; }
/* Résultats de recherche : cartes en colonnes, la rangée de classement
   calée en bas de carte pour un alignement propre. */
.resultats-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.resultats-grille .fiche-item { display: flex; flex-direction: column; }
.resultats-grille .essentiel { flex: 1; }
/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.page-btn {
  min-width: 40px; height: 40px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border-col); border-radius: var(--radius-pill); background: var(--surface-card);
  font-family: var(--font-display); font-weight: 600; font-size: 14.5px; color: var(--navy-800); cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.page-btn:hover:not(.actif):not(:disabled) { border-color: var(--blue-600); color: var(--blue-600); }
.page-btn.actif { background: var(--navy-900); border-color: var(--navy-900); color: #FFFFFF; cursor: default; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Recherche ---------- */
.search-bar { display: flex; gap: 12px; }
.search-bar input[type="search"] { flex: 1; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: .02em;
  padding: 12px 22px; border-radius: var(--radius-pill); border: 0;
  transition: background var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
}
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--blue-600); color: #FFFFFF; box-shadow: var(--shadow-cta); }
.btn-primary:hover { background: var(--blue-700); }
.btn-ghost { background: transparent; color: var(--navy-800); border: 1.5px solid var(--border-col); }
.btn-ghost:hover { border-color: var(--navy-800); }
/* Les filtres se partagent toute la largeur de la carte : chaque champ
   s'étire à part égale et passe à la ligne sous 180 px. */
.filtres { display: flex; flex-wrap: wrap; gap: 12px 16px; margin-top: 16px; align-items: flex-end; }
.filtres label { flex: 1 1 180px; min-width: 180px; font-size: 14px; font-weight: 700; color: var(--text-body); display: flex; flex-direction: column; gap: 6px; }
.filtres select { width: 100%; }
/* Mots-clés sous la barre : raccourcis directs vers la recherche du mot-clé,
   affichés du plus fourni au moins fourni, avec leur nombre de fiches. */
.mots-cles-filtre { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }
.mots-cles-filtre .chip-mot {
  cursor: pointer; background: var(--surface-card); font-family: inherit;
  transition: border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.mots-cles-filtre .chip-mot:hover { border-color: var(--blue-600); color: var(--blue-600); }
.mots-cles-filtre .chip-mot.actif { border-color: var(--blue-600); color: var(--blue-600); background: var(--bg-light); }
.mots-cles-filtre .chip-mot .nb { font-weight: 600; color: var(--text-muted); }

/* ---------- Fiche ---------- */
/* Bouton d'action de la fiche : ancré en haut à droite, juste à gauche de la
   tête de Séty. Hors flux, comme elle. */
.fiche-actions {
  position: absolute; top: 48px; right: calc(clamp(20px, 3.5vw, 48px) + 116px);
  z-index: 5; display: flex; gap: 10px;
}
.fiche-actions .btn { background: var(--surface-card); }
body.sans-sety .fiche-actions { right: clamp(20px, 3.5vw, 48px); }
/* Le titre s'étend sur la largeur du contenu, en réservant la place du
   bouton Modifier et de la tête de Séty, ancrés en haut à droite. */
.vue-fiche .titres { padding-right: 200px; }
.bloc { margin-bottom: 20px; }
.bloc-titre {
  font-family: var(--font-display); font-weight: 600; font-size: 17px;
  letter-spacing: .02em; text-transform: uppercase; color: var(--navy-800);
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.bloc-titre svg { width: 19px; height: 19px; color: var(--blue-600); }
.bloc .contenu { font-size: 16px; }
.bloc .contenu p + p { margin-top: 10px; }
.bloc .contenu ol, .bloc .contenu ul { margin: 8px 0 8px 22px; display: flex; flex-direction: column; gap: 6px; }
.bloc .contenu a { color: var(--blue-600); font-weight: 700; }
.bloc .contenu code { background: var(--grey-soft); padding: 2px 7px; border-radius: 6px; font-size: 13.5px; }
.bloc .contenu h2, .bloc .contenu h3, .bloc .contenu h4 {
  font-family: var(--font-display); font-weight: 600; color: var(--text-strong);
  line-height: 1.2; margin: 18px 0 8px;
}
.bloc .contenu h2 { font-size: 21px; }
.bloc .contenu h3 { font-size: 18px; }
.bloc .contenu h4 { font-size: 16.5px; }
.bloc .contenu blockquote {
  border-left: 3px solid var(--border-col); padding: 2px 0 2px 14px;
  color: var(--text-muted); margin: 10px 0;
}
.bloc .contenu hr { border: 0; border-top: 1.5px solid var(--border-col); margin: 14px 0; }
.bloc .contenu table {
  border-collapse: collapse; margin: 10px 0; width: 100%; font-size: 14.5px;
  display: block; overflow-x: auto;
}
.bloc .contenu th, .bloc .contenu td {
  border: 1px solid var(--border-col); padding: 7px 11px; text-align: left; vertical-align: top;
}
.bloc .contenu th { background: var(--bg-light); font-weight: 700; }
.bloc .contenu pre {
  background: var(--grey-soft); border-radius: var(--radius-sm); padding: 12px 14px;
  overflow-x: auto; font-size: 13.5px; margin: 10px 0;
}
.card-essentiel { background: var(--bg-light); border: 1.5px solid var(--border-col); }
.card-pincettes { background: var(--warning-100); }
.card-pincettes .bloc-titre, .card-pincettes .bloc-titre svg { color: var(--warning-600); }
.lien-drive {
  display: inline-flex; align-items: center; gap: 10px; margin-top: 8px;
  font-weight: 700; color: var(--blue-600); text-decoration: none;
}
.lien-drive:hover { text-decoration: underline; }
.similaires { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.similaires a {
  display: block; padding: 12px 14px; border: 1.5px solid var(--border-col);
  border-radius: var(--radius-sm); color: var(--text-strong); font-weight: 700;
  font-size: 15px; text-decoration: none; cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out);
}
.similaires a:hover { border-color: var(--blue-600); color: var(--blue-600); }
.similaires .ou { font-size: 13px; color: var(--text-muted); font-weight: 600; display: block; margin-top: 2px; }

/* ---------- Réglages ---------- */
.champ { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 700; color: var(--text-body); }
.champ input, .champ select { width: 100%; min-width: 0; }
/* La ligne de formulaire occupe toute la largeur de la carte : chaque champ
   s'étire à part égale, le bouton suit dans la continuité. */
.form-ligne { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.form-ligne .champ { flex: 1 1 200px; min-width: 200px; }
.form-col { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.ref-groupe { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ref-groupe .chip { background: var(--bg-light); color: var(--navy-800); border: 1.5px solid var(--border-col); }
.ref-groupe .chip .nb { font-weight: 600; color: var(--text-muted); }
.ref-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.note-reglage { font-size: 14px; color: var(--text-muted); margin-top: 12px; }
.note-reglage.note-ok { color: var(--success-600); }
.note-reglage.note-erreur { color: var(--error-600); }
.cle-liste { list-style: none; display: flex; flex-direction: column; }
.cle-liste li {
  display: flex; align-items: center; gap: 14px; padding: 12px 4px;
  border-bottom: 1px solid var(--border-col);
}
.cle-liste li:last-child { border-bottom: 0; }
.cle-liste .qui { font-weight: 700; color: var(--text-strong); min-width: 110px; }
.cle-liste .depuis { font-size: 13.5px; color: var(--text-muted); flex: 1; }
.btn-revoquer {
  background: transparent; border: 1.5px solid var(--border-col); border-radius: var(--radius-pill);
  font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: .02em;
  color: var(--error-600); padding: 7px 14px; cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-out);
}
.btn-revoquer:hover { border-color: var(--error-600); }
.settings-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-col); }
.settings-line .lab { font-weight: 700; font-size: 14px; color: var(--text-muted); }
.settings-line .val { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; }
.sec-title {
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--text-muted); margin: 20px 0 6px;
}
.mini-liste { list-style: none; }
.mini-liste li { padding: 9px 2px; border-bottom: 1px solid var(--border-col); font-size: 14.5px; font-weight: 600; }
.mini-liste li:last-child { border-bottom: 0; }
.mini-liste .ou { font-size: 12.5px; color: var(--text-muted); display: block; margin-top: 1px; }
.link-action { background: none; border: 0; padding: 0; cursor: pointer; font-family: inherit; font-weight: 700; font-size: 14px; color: var(--blue-600); }
.link-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.link-action.link-danger { color: var(--error-600); }
.link-action:disabled { opacity: .5; cursor: not-allowed; text-decoration: none; }
details.acc { border: 1.5px solid var(--border-col); border-radius: var(--radius-md); background: var(--surface-card); margin: 6px 0 16px; }
details.acc summary { cursor: pointer; list-style: none; padding: 14px 18px; font-weight: 700; color: var(--text-strong); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
details.acc summary::-webkit-details-marker { display: none; }
details.acc summary::after { content: "+"; font-weight: 700; color: var(--text-muted); }
details.acc[open] summary::after { content: "–"; }
.acc-body { padding: 0 18px 16px; font-size: 15px; line-height: 1.7; }
.acc-body code { background: var(--grey-soft); padding: 2px 7px; border-radius: 6px; font-size: 13.5px; }

/* Largeur de lecture : une fiche se lit comme un document, pas comme un
   tableau de bord. La colonne principale est bornée à ~70-75 caractères par
   ligne ; l'espace latéral est occupé par les cartes de contexte. */
.vue-fiche .view-head { max-width: 1508px; }
.vue-fiche .barre-edition { max-width: 780px; }
.fiche-grille {
  display: grid; grid-template-columns: minmax(0, 780px) 340px 340px;
  gap: 24px; align-items: start; max-width: 1508px;
}
.fiche-lateral .card { margin-bottom: 20px; }
.fiche-lateral .card:last-child { margin-bottom: 0; }
/* Encart vidéo YouTube : présent seulement si la fiche porte une URL YouTube.
   Il coiffe les deux colonnes de contexte. Dernière rangée en 1fr : elle
   absorbe la hauteur de la colonne de lecture, sinon l'excédent écarte les
   cartes de contexte les unes des autres (défaut invisible sur fiche courte). */
.fiche-grille.avec-video { grid-template-rows: auto auto 1fr; }
.fiche-grille.avec-video .fiche-principal { grid-column: 1; grid-row: 1 / 4; }
.fiche-video { grid-column: 2 / 4; grid-row: 1; }
.fiche-video .card { margin-bottom: 0; }
.fiche-grille.avec-video .fiche-lateral { grid-column: 2; grid-row: 2; }
.fiche-grille.avec-video .fiche-lateral-b { grid-column: 3; grid-row: 2; }
.video-cadre {
  position: relative; aspect-ratio: 16 / 9; margin-top: 4px;
  border-radius: var(--radius-md); overflow: hidden; background: var(--navy-950);
}
.video-cadre iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-apercu { position: absolute; inset: 0; display: block; }
.video-apercu img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #FFFFFF; background: rgba(15,23,42,.18);
  transition: background var(--duration-fast) var(--ease-out);
}
.video-apercu:hover .video-play { background: rgba(15,23,42,.32); }
.video-play svg { width: 62px; height: 62px; filter: drop-shadow(0 4px 10px rgba(15,23,42,.5)); }
.fiche-video .lien-drive { margin-top: 12px; }
/* Paliers : trois colonnes sur grand écran ; sur écran moyen les deux colonnes
   latérales fusionnent en une seule ; sous 1240 px tout repasse sous la lecture. */
@media (max-width: 1620px) {
  .fiche-grille { grid-template-columns: minmax(0, 780px) 340px; }
  .fiche-lateral-b { grid-column: 2; }
  .fiche-video { grid-column: 2; }
  .fiche-grille.avec-video .fiche-lateral-b { grid-column: 2; grid-row: 3; }
  /* Sans encart vidéo, les deux paquets de cartes empilés en colonne 2 doivent
     se suivre : la colonne de lecture s'étend sur les deux rangées. */
  .fiche-grille:not(.avec-video) { grid-template-rows: auto 1fr; }
  .fiche-grille:not(.avec-video) .fiche-principal { grid-column: 1; grid-row: 1 / 3; }
  .fiche-grille:not(.avec-video) .fiche-lateral { grid-column: 2; grid-row: 1; }
  .fiche-grille:not(.avec-video) .fiche-lateral-b { grid-row: 2; }
}
@media (max-width: 1240px) {
  .fiche-grille { grid-template-columns: 1fr; }
  .fiche-lateral-b { grid-column: auto; }
  .fiche-video { grid-column: auto; grid-row: auto; }
  .fiche-grille.avec-video .fiche-principal { grid-column: auto; grid-row: auto; }
  .fiche-grille.avec-video .fiche-lateral { grid-column: auto; grid-row: auto; }
  .fiche-grille.avec-video .fiche-lateral-b { grid-column: auto; grid-row: auto; }
}

/* ---------- Pop-ups (modèle des pop-ups Mission Board) ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.45);
  display: grid; place-items: center; padding: 24px;
}
.modal {
  background: var(--surface-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
  width: min(94vw, 640px); max-height: 90vh; overflow-y: auto; padding: 28px 32px 26px;
}
.modal-etroite { width: min(94vw, 520px); }
.modal-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.form-erreur { color: var(--error-600); font-weight: 600; font-size: 14.5px; margin-top: 10px; min-height: 22px; }
.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px; flex-shrink: 0;
  border-radius: 50%; border: 1.5px solid var(--border-col); background: var(--surface-card);
  cursor: pointer; color: var(--text-muted);
  transition: border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.icon-btn:hover { border-color: var(--navy-800); color: var(--navy-800); }
.icon-btn svg { width: 18px; height: 18px; }
.archive-liste { list-style: none; margin-bottom: 6px; }
.archive-liste li { display: flex; align-items: center; gap: 14px; padding: 12px 2px; border-bottom: 1px solid var(--border-col); }
.archive-liste li:last-child { border-bottom: 0; }
.archive-infos { flex: 1; font-weight: 600; font-size: 15px; }
.archive-infos .ou { display: block; font-size: 12.5px; color: var(--text-muted); margin-top: 1px; }
.archive-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn-petit { padding: 8px 16px; font-size: 13.5px; }
.btn-danger { background: var(--error-600); color: #FFFFFF; }
.btn-danger:hover { background: #A5172F; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.purge-zone { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; flex-wrap: wrap; }
.purge-zone .note-reglage { margin-top: 0; flex: 1; min-width: 240px; }
.empty-note { color: var(--text-muted); font-weight: 600; padding: 12px 2px; }

/* Choix de mots-clés dans la pop-up de création : pastilles à bascule */
.chips-choix { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.chips-choix .chip {
  background: var(--surface-card); color: var(--text-muted);
  border: 1.5px solid var(--border-col); cursor: pointer; font-family: inherit;
  transition: border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.chips-choix .chip:hover { border-color: var(--blue-600); color: var(--blue-600); }
.chips-choix .chip.actif { border-color: var(--blue-600); color: var(--blue-600); background: var(--bg-light); }
/* La clé créée s'affiche UNE fois : encadré à copier immédiatement */
.cle-valeur {
  font-family: ui-monospace, Consolas, monospace; font-size: 14px; font-weight: 600;
  background: var(--bg-light); border: 1.5px solid var(--border-col);
  border-radius: var(--radius-sm); padding: 12px 14px; word-break: break-all;
  user-select: all;
}

/* ---------- Bouton + global (modèle Mission Board, ancré en bas à droite) ---------- */
.fab {
  position: fixed; bottom: 24px; right: 28px; z-index: 40;
  width: 56px; height: 56px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--blue-600); color: #FFFFFF; box-shadow: var(--shadow-cta);
  display: grid; place-items: center;
  transition: background var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
}
.fab:hover { background: var(--blue-700); transform: scale(1.05); }
.fab svg { width: 26px; height: 26px; }
.fab-menu {
  position: fixed; bottom: 90px; right: 28px; z-index: 40;
  background: #FFFFFF; border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  padding: 8px; min-width: 220px;
}
.fab-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: 0; cursor: pointer; text-align: left;
  font-family: inherit; font-size: 15px; font-weight: 700; color: var(--text-body);
  padding: 11px 14px; border-radius: var(--radius-sm);
}
.fab-menu button:hover { background: var(--bg-light); color: var(--blue-600); }
.fab-menu button svg { width: 18px; height: 18px; color: var(--icon-blue); }

/* ---------- Mode édition ---------- */
.barre-edition {
  display: none; position: sticky; top: 12px; z-index: 5;
  background: var(--navy-900); color: #FFFFFF; border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); padding: 10px 14px;
  align-items: center; gap: 8px; margin-bottom: 20px;
}
.fiche-edition .barre-edition { display: flex; }
.barre-edition .outil {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: transparent; border: 0; color: #FFFFFF; cursor: pointer;
  font-family: inherit; font-size: 16px; font-weight: 700;
}
.barre-edition .outil:hover { background: rgba(255,255,255,.14); }
.barre-edition .outil svg { width: 18px; height: 18px; }
.barre-edition .sep { width: 1px; height: 24px; background: rgba(255,255,255,.25); margin: 0 4px; }
.barre-edition .espace { flex: 1; }
.barre-edition .btn { padding: 9px 18px; font-size: 14px; }
.barre-edition .btn-annuler { background: transparent; color: #B8C2DF; border: 1.5px solid rgba(255,255,255,.3); }
.barre-edition .btn-annuler:hover { color: #FFFFFF; border-color: #FFFFFF; }
.fiche-edition .editable {
  outline: 2px dashed var(--mauve-600); outline-offset: 6px; border-radius: 4px;
  cursor: text;
}
.mention-edition { display: none; font-size: 13.5px; font-weight: 700; color: #B8C2DF; }
.fiche-edition .mention-edition { display: inline; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--navy-900); color: #FFFFFF; font-weight: 600; font-size: 15px;
  border-radius: var(--radius-pill); padding: 12px 24px; box-shadow: var(--shadow-md);
}
.toast.toast-erreur { background: var(--error-600); }

/* ---------- Écran de connexion ---------- */
.login-page {
  min-height: 100vh; display: grid; place-items: center;
  background: var(--navy-900); padding: 24px;
}
.login-card {
  background: var(--navy-900); text-align: center; max-width: 380px; width: 100%;
}
.login-card .brand-logo { margin: 0 auto 6px; max-width: 260px; }
.login-card .brand-sub { margin-bottom: 34px; }
.login-card .field { display: flex; flex-direction: column; gap: 6px; }
.login-card input[type="password"] {
  width: 100%; text-align: center; font-size: 17px;
  background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.20); color: #FFFFFF;
}
.login-card input[type="password"]::placeholder { color: #9AA8FF; }
.login-card input[type="password"]:focus { box-shadow: 0 0 0 2px var(--navy-900), 0 0 0 4px #9AA8FF; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 14px; }
.login-error { color: var(--error-on-inverse); font-weight: 600; font-size: 14.5px; margin-top: 12px; min-height: 22px; }

/* ---------- Réactif ---------- */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; padding: 20px 16px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .api-status { display: none; }
  .dom-row { grid-template-columns: 110px 1fr 40px; }
  /* Séty se fixe en haut à droite en cible tactile réduite,
     et le titre récupère toute sa largeur. Le bouton de la fiche
     l'accompagne, à sa gauche. */
  .sety-link { position: fixed; top: 10px; right: 12px; z-index: 40; }
  .sety-link img { height: 56px; }
  .view-head { padding-right: 0; }
  .fiche-actions { position: fixed; top: 14px; right: 80px; z-index: 40; }
  .vue-fiche .titres { padding-right: 0; }
}
