/* ===========================================================================
   COFFRE-FORT - feuille de style
   Aucune ressource externe : polices systeme uniquement, pour qu'aucune
   requete ne sorte de la machine.
   =========================================================================== */

:root {
  --fond: #080c17;
  --fond-2: #0e1424;
  --fond-3: #151d33;
  --surface: #121a2e;
  --bordure: #24304d;
  --bordure-claire: #32406685;
  --texte: #e8edf9;
  --texte-attenue: #93a1c0;
  --texte-faible: #64718f;
  --accent: #5b8cff;
  --accent-clair: #8fb0ff;
  --accent-sombre: #3a63c9;
  --or: #e0b155;
  --vert: #35c98a;
  --orange: #f0a83c;
  --rouge: #ef5f6b;
  --rayon: 12px;
  --rayon-s: 8px;
  --ombre: 0 18px 50px -12px rgba(0, 0, 0, .7);
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--fond);
  background-image:
    radial-gradient(900px 600px at 15% -10%, #1b2a55 0%, transparent 60%),
    radial-gradient(700px 500px at 100% 0%, #241c46 0%, transparent 55%);
  color: var(--texte);
  font-family: var(--police);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.ecran { height: 100%; }
.ecran--centre {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}
[hidden] { display: none !important; }

button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; }

/* ------------------------------------------------------------- boutons */

.bouton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-s);
  background: var(--fond-3);
  color: var(--texte);
  cursor: pointer;
  font-weight: 550;
  white-space: nowrap;
  transition: background .14s, border-color .14s, transform .08s;
}
.bouton:hover { background: #1d2743; border-color: #3a4a72; }
.bouton:active { transform: translateY(1px); }
.bouton:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.bouton[disabled] { opacity: .45; cursor: not-allowed; }

.bouton--principal {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-sombre) 100%);
  border-color: #4d79e0;
  color: #fff;
}
.bouton--principal:hover { background: linear-gradient(180deg, #6d9aff 0%, #4470d6 100%); }

.bouton--danger { border-color: #5c2b34; background: #2a1620; color: #ffb5bc; }
.bouton--danger:hover { background: #3a1c28; border-color: #7d3a46; }

.bouton--icone { padding: 10px; width: 40px; }
.bouton--icone svg { width: 18px; height: 18px; }

.bouton--mini { padding: 5px 10px; font-size: 13px; border-radius: 6px; }

.bouton--large { width: 100%; padding: 12px; }

.lien {
  background: none; border: none; padding: 4px;
  color: var(--texte-attenue); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
  font-size: 13.5px;
}
.lien:hover { color: var(--accent-clair); }

/* ------------------------------------------------- ecrans verrou/creation */

.carte-verrou {
  width: 100%;
  max-width: 420px;
  padding: 36px 32px 28px;
  background: linear-gradient(180deg, #131c31 0%, #0e1424 100%);
  border: 1px solid var(--bordure);
  border-radius: 18px;
  box-shadow: var(--ombre);
  text-align: center;
}
.carte-verrou--large { max-width: 520px; text-align: left; }

.blason {
  width: 60px; height: 60px;
  margin: 0 auto 18px;
  display: grid; place-items: center;
  border-radius: 16px;
  
  background: linear-gradient(160deg, #24345e, #172445);
  border: 1px solid #35477a;
  color: var(--or);
}
.blason svg { width: 30px; height: 30px; }

.titre-verrou { margin: 0 0 6px; font-size: 25px; letter-spacing: -.02em; }
.carte-verrou--large .titre-verrou { text-align: center; }

.sous-titre { margin: 0 0 22px; color: var(--texte-attenue); font-size: 14px; }
.carte-verrou--large .sous-titre { text-align: center; }

.etiquette {
  display: block;
  margin: 16px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--texte-attenue);
}

/* ------------------------------------------------------ champ mot de passe */

.champ-mdp { position: relative; display: flex; }

input[type="text"], input[type="password"], input[type="search"], input[type="url"], textarea {
  width: 100%;
  padding: 12px 14px;
  background: #0a0f1d;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-s);
  color: var(--texte);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #5b8cff28;
}
input::placeholder, textarea::placeholder { color: var(--texte-faible); }

.champ-mdp input { padding-right: 46px; }

.oeil {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: none; border: none;
  color: var(--texte-faible);
  cursor: pointer;
  border-radius: 6px;
}
.oeil:hover { color: var(--accent-clair); background: #ffffff0d; }
.oeil svg { width: 18px; height: 18px; }
.oeil.actif { color: var(--accent); }

#form-deverrouillage .bouton { width: 100%; margin-top: 14px; padding: 12px; }
#form-creation .bouton--principal { width: 100%; margin-top: 20px; padding: 12px; }

/* -------------------------------------------------------- jauge solidite */

.jauge {
  height: 6px;
  margin-top: 10px;
  background: #0a0f1d;
  border-radius: 99px;
  overflow: hidden;
}
.jauge span {
  display: block; height: 100%; width: 0;
  border-radius: 99px;
  background: var(--rouge);
  transition: width .25s, background .25s;
}
.jauge[data-niveau="1"] span { background: #ef5f6b; }
.jauge[data-niveau="2"] span { background: #f0803c; }
.jauge[data-niveau="3"] span { background: #e0b155; }
.jauge[data-niveau="4"] span { background: #6fc98a; }
.jauge[data-niveau="5"] span { background: #35c98a; }

.ligne-solidite {
  display: flex; justify-content: space-between;
  margin: 7px 0 0; font-size: 12.5px; color: var(--texte-attenue);
}
#solidite-bits { color: var(--texte-faible); font-family: var(--mono); }

/* ----------------------------------------------------------- encadres */

.encadre-conseil {
  margin: 18px 0 4px;
  padding: 14px 16px;
  background: #16223d;
  border: 1px solid var(--bordure);
  border-left: 3px solid var(--or);
  border-radius: var(--rayon-s);
  font-size: 13.5px;
  color: var(--texte-attenue);
}
.encadre-conseil strong { color: var(--texte); }

.ligne-suggestion {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; flex-wrap: wrap;
}
.ligne-suggestion code {
  flex: 1; min-width: 180px;
  padding: 9px 11px;
  background: #0a0f1d;
  border: 1px solid var(--bordure);
  border-radius: 6px;
  font-family: var(--mono); font-size: 13.5px;
  color: var(--accent-clair);
  word-break: break-all;
}
.encadre-conseil small { display: block; margin-top: 8px; color: var(--texte-faible); font-size: 12px; }

.encadre-alerte {
  padding: 13px 15px;
  background: #2a1620;
  border: 1px solid #5c2b34;
  border-radius: var(--rayon-s);
  color: #ffc4c9;
  font-size: 13.5px;
}

.case {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 18px;
  font-size: 13px; color: var(--texte-attenue);
  cursor: pointer;
}
.case input { margin-top: 3px; flex-shrink: 0; accent-color: var(--accent); width: 16px; height: 16px; }

.message { margin: 14px 0 0; font-size: 13.5px; min-height: 20px; }
.message--erreur { color: var(--rouge); }
.message--ok { color: var(--vert); }

.pied-verrou { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--bordure-claire); }

/* --------------------------------------------------------------- barre */

#ecran-coffre { display: flex; flex-direction: column; }

.barre {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: #0c1222e0;
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bordure);
  flex-shrink: 0;
}
.barre__marque {
  display: flex; align-items: center; gap: 9px;
  font-weight: 650; letter-spacing: -.01em;
  color: var(--or);
  flex-shrink: 0;
}
.icone-cadenas { width: 19px; height: 19px; }
.barre__marque span { color: var(--texte); }

.barre__recherche {
  position: relative; flex: 1; max-width: 460px;
  display: flex; align-items: center;
}
.barre__recherche svg {
  position: absolute; left: 12px;
  width: 16px; height: 16px; color: var(--texte-faible);
  pointer-events: none;
}
.barre__recherche input { padding-left: 36px; padding-top: 9px; padding-bottom: 9px; }
.barre__recherche input::-webkit-search-cancel-button { filter: invert(.6); }

.barre__actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.indicateur { font-size: 12.5px; color: var(--texte-faible); min-width: 0; }
.indicateur--ok { color: var(--vert); }
.indicateur--erreur { color: var(--rouge); }

/* --------------------------------------------------------------- corps */

.corps { flex: 1; display: flex; min-height: 0; }

.panneau-lateral {
  width: 208px; flex-shrink: 0;
  display: flex; flex-direction: column;
  padding: 14px 10px;
  border-right: 1px solid var(--bordure);
  overflow-y: auto;
}

.categories { display: flex; flex-direction: column; gap: 2px; }
.categorie {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 11px;
  border: none; background: none;
  border-radius: var(--rayon-s);
  color: var(--texte-attenue);
  cursor: pointer; text-align: left;
  font-size: 14px; width: 100%;
}
.categorie:hover { background: #ffffff0a; color: var(--texte); }
.categorie.active { background: #1e2c4e; color: var(--texte); font-weight: 600; }
.categorie__nombre {
  margin-left: auto;
  font-size: 12px; color: var(--texte-faible);
  font-family: var(--mono);
}
.categorie__puce { width: 7px; height: 7px; border-radius: 99px; background: var(--accent); flex-shrink: 0; }

.lateral__pied { margin-top: auto; padding: 14px 11px 4px; border-top: 1px solid var(--bordure-claire); }
.stat { margin: 0 0 4px; font-size: 12.5px; color: var(--texte-attenue); }
.stat--attenue { color: var(--texte-faible); font-size: 11.5px; }

/* ---------------------------------------------------------- liste entrees */

.zone-liste { flex: 1; overflow-y: auto; padding: 14px; min-width: 0; }

.liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }

.entree {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  cursor: pointer;
  transition: border-color .13s, background .13s;
}
.entree:hover { border-color: #3a4a72; background: #16203a; }
.entree.selectionnee { border-color: var(--accent); background: #17233f; }

.entree__pastille {
  width: 38px; height: 38px; flex-shrink: 0;
  display: grid; place-items: center;
  border-radius: 10px;
  font-weight: 700; font-size: 16px;
  color: #fff;
  text-transform: uppercase;
}

.entree__infos { min-width: 0; flex: 1; }
.entree__titre {
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 7px;
}
.entree__identifiant {
  font-size: 12.5px; color: var(--texte-attenue);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.etoile { color: var(--or); font-size: 13px; }

.entree__outils { display: flex; gap: 4px; opacity: 0; transition: opacity .13s; }
.entree:hover .entree__outils, .entree.selectionnee .entree__outils { opacity: 1; }
.outil {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid transparent; background: none;
  border-radius: 7px; color: var(--texte-attenue); cursor: pointer;
}
.outil:hover { background: #26324f; color: var(--texte); border-color: var(--bordure); }
.outil svg { width: 16px; height: 16px; }

.etat-vide {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 70px 20px; text-align: center;
  color: var(--texte-faible);
}
.etat-vide svg { width: 52px; height: 52px; opacity: .35; }
.etat-vide p { margin: 0; }

/* --------------------------------------------------------------- volet */

.volet {
  width: 380px; flex-shrink: 0;
  border-left: 1px solid var(--bordure);
  background: #0b1120;
  overflow-y: auto;
  padding: 18px;
}

.volet__entete { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 18px; }
.volet__titre { margin: 0; font-size: 19px; letter-spacing: -.01em; word-break: break-word; }
.volet__categorie { font-size: 12.5px; color: var(--texte-attenue); }

.bloc-champ { margin-bottom: 14px; }
.bloc-champ__intitule {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--texte-faible); margin-bottom: 5px; font-weight: 600;
}
.bloc-champ__valeur {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  background: #0a0f1d;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon-s);
  word-break: break-all;
}
.bloc-champ__valeur span { flex: 1; min-width: 0; }
.bloc-champ__valeur .mono { font-family: var(--mono); font-size: 13.5px; }
.valeur-notes { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; }

.volet__actions { display: flex; gap: 8px; margin-top: 20px; }
.volet__actions .bouton { flex: 1; }

.volet__meta {
  margin-top: 18px; padding-top: 14px;
  border-top: 1px solid var(--bordure-claire);
  font-size: 11.5px; color: var(--texte-faible);
}
.volet__meta div { margin-bottom: 3px; }

/* -------------------------------------------------------------- modales */

.voile {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: #04060cdd;
  backdrop-filter: blur(6px);
  overflow-y: auto;
}

.modale {
  width: 100%; max-width: 520px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 24px;
  background: linear-gradient(180deg, #141d33 0%, #0e1424 100%);
  border: 1px solid var(--bordure);
  border-radius: 16px;
  box-shadow: var(--ombre);
}
.modale h2 { margin: 0 0 4px; font-size: 19px; }
.modale > p:first-of-type { margin-top: 0; color: var(--texte-attenue); font-size: 13.5px; }

.grille-form { display: flex; flex-direction: column; }
.grille-form textarea { min-height: 80px; resize: vertical; }

.modale__actions { display: flex; gap: 9px; margin-top: 22px; }
.modale__actions .bouton { flex: 1; }

/* ---------------------------------------------------------- generateur */

.affichage-genere {
  display: flex; align-items: center; gap: 10px;
  padding: 16px;
  background: #0a0f1d;
  border: 1px solid var(--bordure);
  border-radius: var(--rayon);
  margin-bottom: 16px;
}
#texte-genere {
  flex: 1;
  font-family: var(--mono); font-size: 17px;
  color: var(--accent-clair);
  word-break: break-all; line-height: 1.45;
}

.ligne-option {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 0;
  font-size: 14px;
}
.ligne-option label { color: var(--texte-attenue); cursor: pointer; }
.ligne-option input[type="range"] { flex: 1; accent-color: var(--accent); }
.ligne-option input[type="checkbox"] { accent-color: var(--accent); width: 17px; height: 17px; cursor: pointer; }
.valeur-curseur { font-family: var(--mono); min-width: 30px; text-align: right; color: var(--texte); }

.onglets { display: flex; gap: 4px; margin-bottom: 16px; padding: 3px; background: #0a0f1d; border-radius: 9px; }
.onglet {
  flex: 1; padding: 8px; border: none; background: none;
  border-radius: 7px; color: var(--texte-attenue); cursor: pointer; font-size: 13.5px;
}
.onglet.active { background: #25325a; color: var(--texte); font-weight: 600; }

/* ---------------------------------------------------------- notification */

.notification {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(8px);
  z-index: 100;
  padding: 11px 18px;
  background: #1b2744;
  border: 1px solid #3a4a72;
  border-radius: 99px;
  box-shadow: var(--ombre);
  font-size: 13.5px;
  opacity: 0;
  transition: opacity .18s, transform .18s;
}
.notification.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.notification--erreur { background: #2a1620; border-color: #5c2b34; color: #ffc4c9; }
.notification--ok { background: #12301f; border-color: #285c3f; color: #b6f0d0; }

/* -------------------------------------------------------------- travail */

.voile--travail { z-index: 200; }
.travail { text-align: center; color: var(--texte-attenue); max-width: 340px; }
.travail p { margin: 16px 0 6px; color: var(--texte); font-size: 15px; }
.travail small { font-size: 12.5px; color: var(--texte-faible); }

.rotor {
  width: 42px; height: 42px; margin: 0 auto;
  border: 3px solid #ffffff18;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: tourner .8s linear infinite;
}
@keyframes tourner { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------- reactif */

@media (max-width: 960px) {
  .volet {
    position: fixed; inset: 0; z-index: 40;
    width: 100%; border-left: none;
  }
  .panneau-lateral { width: 168px; }
}

@media (max-width: 720px) {
  .barre { flex-wrap: wrap; padding: 10px 14px; gap: 10px; }
  .barre__recherche { order: 3; flex-basis: 100%; max-width: none; }
  .barre__actions { gap: 6px; }
  #btn-nouvelle-entree span + * , #btn-nouvelle-entree { font-size: 14px; padding: 9px 12px; }
  #btn-verrouiller { padding: 9px 12px; }
  .panneau-lateral {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    width: 100%; height: auto; flex-direction: row;
    padding: 8px; gap: 6px; overflow-x: auto;
    border-right: none; border-top: 1px solid var(--bordure);
    background: #0b1120; z-index: 30;
  }
  .categories { flex-direction: row; gap: 6px; }
  .categorie { white-space: nowrap; width: auto; padding: 7px 12px; }
  .lateral__pied { display: none; }
  .zone-liste { padding: 12px 12px 76px; }
  .entree__outils { opacity: 1; }
  .carte-verrou { padding: 28px 20px 22px; }
}
