/* CONSOLE — salle de contrôle MYRACL.
 * Système d'instrument : nuit profonde, couleurs de STATUT porteuses de sens,
 * Bricolage pour les noms, monospace pour les données. Servi en local, CSP-safe. */
@font-face {
  font-family: 'Bricolage';
  src: url('/bricolage-grotesque-latin.woff2') format('woff2');
  font-weight: 200 800; font-display: swap;
}

:root {
  color-scheme: dark;
  --nuit: #0d0f14;
  --panneau: #141821;
  --panneau-haut: #1a1f2b;
  --trait: #232a37;
  --trait-clair: #2f3746;
  --texte: #e8ebf2;
  --doux: #8b95a7;
  --faible: #5c6472;
  --iris: #7c86ff;
  --iris-fonce: #5b63d6;
  /* statuts — la couleur est une information, pas une décoration */
  --st-brouillon: #64748b;
  --st-a-valider: #f0a835;
  --st-valide: #34d399;
  --st-publie: #5b9dff;
  --st-rejete: #f2585b;
  --rayon: 12px;
  --rayon-s: 8px;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;
  --ombre: 0 12px 32px -12px rgba(0,0,0,.6);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--nuit); color: var(--texte);
  font-family: 'Bricolage', system-ui, sans-serif;
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
button { font: inherit; cursor: pointer; }
a { color: var(--iris); }
::selection { background: color-mix(in srgb, var(--iris) 40%, transparent); }

/* étiquette / donnée en mono — la signature */
.mono { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--doux); }

/* ===================== CONNEXION / ACCUEIL ===================== */
.centre { min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.carte-auth {
  background: linear-gradient(180deg, var(--panneau-haut), var(--panneau));
  border: 1px solid var(--trait); border-radius: 16px; padding: 2rem 1.75rem;
  width: min(30rem, 100%); box-shadow: var(--ombre);
}
.marque { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.4rem; }
.marque .anneau { width: 30px; height: 30px; color: var(--iris); }
.marque .anneau svg { width: 100%; height: 100%; }
.btn.mini { padding: .2rem .5rem; font-size: 12px; }
.mt-s { margin-top: .4rem; }
.m0 { margin-top: 0; }
.marque h1 { margin: 0; font-size: 1.15rem; letter-spacing: .18em; font-weight: 700; }
.carte-auth h2 { margin: 0 0 .3rem; font-size: 1.3rem; font-weight: 600; }
.carte-auth .aide { color: var(--doux); font-size: .9rem; margin: 0 0 1rem; }
label { display: block; margin: .85rem 0 .35rem; }
label .mono { color: var(--doux); }
input, textarea, select {
  width: 100%; padding: .62rem .7rem; background: #0b0e14; color: var(--texte);
  border: 1px solid var(--trait); border-radius: var(--rayon-s); font: inherit;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 5rem; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--iris);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--iris) 28%, transparent);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .6rem 1rem; border: 0; border-radius: var(--rayon-s);
  background: var(--iris); color: #0b1020; font-weight: 600;
  transition: filter .15s, transform .05s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.large { width: 100%; margin-top: 1.1rem; padding: .7rem; }
.btn.fantome { background: transparent; color: var(--doux); border: 1px solid var(--trait); }
.btn.fantome:hover { color: var(--texte); border-color: var(--trait-clair); filter: none; }
.btn.danger { background: transparent; color: var(--st-rejete); border: 1px solid color-mix(in srgb, var(--st-rejete) 45%, var(--trait)); }
.btn:focus-visible, a:focus-visible, .rail-btn:focus-visible, .icone-btn:focus-visible { outline: 2px solid var(--iris); outline-offset: 2px; }
.erreur { color: var(--st-rejete); margin-top: .6rem; min-height: 1.2em; font-size: .9rem; }
.secret {
  font-family: var(--mono); font-size: 1rem; letter-spacing: .12em; text-align: center;
  background: #0b0e14; border: 1px dashed var(--trait-clair); border-radius: var(--rayon-s);
  padding: .7rem; word-break: break-all; color: var(--st-valide);
}

/* ===================== COQUILLE APPLICATIVE ===================== */
.app { display: grid; grid-template-columns: 64px 1fr; min-height: 100dvh; }

/* rail d'instruments */
.rail {
  background: #0a0c11; border-right: 1px solid var(--trait);
  display: flex; flex-direction: column; align-items: center; gap: .35rem; padding: .9rem 0;
  position: sticky; top: 0; height: 100dvh;
}
.rail .logo { width: 34px; height: 34px; margin-bottom: .8rem; color: var(--iris); }
.rail .logo svg { width: 100%; height: 100%; }
.rail-btn {
  width: 42px; height: 42px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 10px; color: var(--faible);
  position: relative; transition: color .15s, background .15s;
}
.rail-btn svg { width: 20px; height: 20px; }
.rail-btn:hover { color: var(--doux); background: rgba(255,255,255,.04); }
.rail-btn.actif { color: var(--texte); background: rgba(124,134,255,.14); }
.rail-btn.actif::before {
  content: ''; position: absolute; left: -0px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 3px; background: var(--iris);
  box-shadow: 0 0 10px var(--iris);
}
.rail-espace { flex: 1; }
.rail-btn.plus { background: var(--iris); color: #0b1020; }
.rail-btn.plus:hover { filter: brightness(1.08); background: var(--iris); color: #0b1020; }
.rail .avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panneau-haut); border: 1px solid var(--trait); color: var(--doux);
  font-size: 13px; font-weight: 700; text-transform: uppercase;
}
.infobulle { /* petit label au survol du rail */ position: absolute; left: 52px; white-space: nowrap;
  background: #0b0e14; border: 1px solid var(--trait); color: var(--texte); padding: .25rem .5rem;
  border-radius: 6px; font-size: 12px; opacity: 0; pointer-events: none; transform: translateX(-4px);
  transition: opacity .12s, transform .12s; z-index: 5; }
.rail-btn:hover .infobulle { opacity: 1; transform: translateX(0); }

/* zone principale */
.vue { padding: 1.6rem 2rem 3rem; max-width: 1400px; }
.entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.entete h1 { margin: 0; font-size: 1.7rem; font-weight: 700; letter-spacing: -.01em; }
.entete .compteur { margin-top: .25rem; }
.entete .compteur b { color: var(--texte); font-family: var(--mono); font-weight: 700; }
.outils { display: flex; align-items: center; gap: .5rem; }
.recherche { position: relative; }
.recherche input { width: 190px; padding-left: 2rem; }
.recherche svg { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faible); }
.icone-btn { width: 38px; height: 38px; display: grid; place-items: center; background: var(--panneau); border: 1px solid var(--trait); border-radius: var(--rayon-s); color: var(--doux); }
.icone-btn:hover { color: var(--texte); border-color: var(--trait-clair); }

/* filtres segmentés */
.segments { display: flex; gap: .35rem; margin-bottom: 1.2rem; flex-wrap: wrap; }
.segment { padding: .32rem .7rem; border-radius: 999px; border: 1px solid var(--trait); background: transparent; color: var(--doux); font-size: 12px; letter-spacing: .03em; }
.segment.actif { background: var(--panneau-haut); color: var(--texte); border-color: var(--trait-clair); }
.segment .pastille { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: .4rem; vertical-align: middle; }

/* grille de cartes */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.fiche {
  position: relative; background: var(--panneau); border: 1px solid var(--trait);
  border-radius: var(--rayon); padding: 1.05rem 1rem .95rem; min-height: 130px;
  display: flex; flex-direction: column; overflow: hidden; text-align: left; width: 100%;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.fiche:hover { border-color: var(--trait-clair); transform: translateY(-2px); box-shadow: var(--ombre); }
.fiche .rail-statut { position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--st-brouillon); }
.fiche .haut { display: flex; align-items: center; justify-content: space-between; margin-bottom: auto; }
.fiche .cat { font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--doux); }
.fiche .menu { color: var(--faible); font-size: 18px; line-height: 1; letter-spacing: .05em; }
.fiche .titre { font-size: 1.05rem; font-weight: 700; margin-top: 1.2rem; }
.fiche .surtitre { color: var(--doux); font-weight: 400; font-size: .92rem; }
.fiche .sous { margin-top: .35rem; color: var(--faible); font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vide { color: var(--doux); padding: 3rem 0; text-align: center; }
.vide .btn { margin-top: 1rem; }

/* apparition douce */
@media (prefers-reduced-motion: no-preference) {
  .fiche { animation: monte .32s both; }
  .fiche:nth-child(2){animation-delay:.03s}.fiche:nth-child(3){animation-delay:.06s}
  .fiche:nth-child(4){animation-delay:.09s}.fiche:nth-child(5){animation-delay:.12s}
  .fiche:nth-child(6){animation-delay:.15s}.fiche:nth-child(n+7){animation-delay:.18s}
  @keyframes monte { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* ===================== MODALE ===================== */
dialog {
  border: 1px solid var(--trait); border-radius: 16px; padding: 0; color: var(--texte);
  background: linear-gradient(180deg, var(--panneau-haut), var(--panneau));
  width: min(34rem, 92vw); box-shadow: var(--ombre);
}
dialog::backdrop { background: rgba(6,8,12,.62); backdrop-filter: blur(3px); }
.modale-tete { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--trait); }
.modale-tete h3 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.modale-corps { padding: 1.1rem 1.25rem; max-height: 68vh; overflow: auto; }
.modale-pied { display: flex; justify-content: flex-end; gap: .6rem; padding: 1rem 1.25rem; border-top: 1px solid var(--trait); flex-wrap: wrap; }
.fermer { background: transparent; border: 0; color: var(--doux); font-size: 20px; line-height: 1; width: 32px; height: 32px; border-radius: 8px; }
.fermer:hover { color: var(--texte); background: rgba(255,255,255,.05); }
.transitions { display: flex; gap: .5rem; flex-wrap: wrap; margin-right: auto; }
.badge-statut { display: inline-flex; align-items: center; gap: .4rem; font-family: var(--mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--doux); }
.badge-statut .pastille { width: 8px; height: 8px; border-radius: 50%; }

/* toast */
.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panneau-haut); border: 1px solid var(--trait-clair); color: var(--texte);
  padding: .7rem 1.1rem; border-radius: 999px; box-shadow: var(--ombre); opacity: 0;
  transition: opacity .2s, transform .2s; z-index: 50; font-size: .92rem; }
.toast.montre { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { border-color: color-mix(in srgb, var(--st-rejete) 55%, var(--trait)); }

/* responsive */
@media (max-width: 640px) {
  .app { grid-template-columns: 56px 1fr; }
  .vue { padding: 1.1rem 1rem 3rem; }
  .recherche input { width: 130px; }
  .entete h1 { font-size: 1.4rem; }
}
