/* =========================================================================
   Millesima — Inventaire informatique
   Palette : ardoise profonde, grenat (accent), laiton (dépôt), émeraude (actif)
   ========================================================================= */

:root {
  --ardoise-900: #0f151d;
  --ardoise-800: #131a24;
  --ardoise-700: #1a2330;
  --ardoise-600: #22303f;
  --ardoise-500: #2e3e50;

  --grenat: #b4384f;
  --grenat-clair: #e8657f;
  --laiton: #d9a24a;
  --emeraude: #3fb27f;
  --bleu-froid: #5b8dd6;

  --texte: #e6eaf0;
  --texte-doux: #94a3b8;
  --texte-faible: #64748b;

  --rayon: 10px;
  --rayon-s: 6px;
  --ombre: 0 18px 40px -24px rgba(0, 0, 0, .75);

  --serif: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
  --sans: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

/* Taille de base des pictogrammes — surchargée au cas par cas. */
.ico { width: 18px; height: 18px; flex: none; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ardoise-800);
  color: var(--texte);
  font: 400 15px/1.6 var(--sans);
  letter-spacing: .005em;
}

/* ------------------------------------------------- Fond circuit imprimé */
.circuit {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1100px 620px at 78% -10%, rgba(180, 56, 79, .20), transparent 70%),
    radial-gradient(900px 520px at 8% 100%, rgba(91, 141, 214, .13), transparent 70%);
}
.circuit svg { width: 100%; height: 100%; display: block; }
.circuit .trame circle, .circuit .trame { fill: rgba(148, 163, 184, .14); }
.circuit .traces path {
  fill: none;
  stroke: rgba(148, 163, 184, .18);
  stroke-width: 1.1;
}
.circuit .plots circle {
  fill: var(--ardoise-800);
  stroke: rgba(180, 56, 79, .55);
  stroke-width: 1.2;
}
.circuit .impulsion circle { fill: var(--grenat-clair); filter: drop-shadow(0 0 6px var(--grenat-clair)); }

@media (prefers-reduced-motion: reduce) {
  .circuit .impulsion { display: none; }
}

/* ------------------------------------------------- Ossature */
.evitement {
  position: absolute; left: -9999px; top: 0; z-index: 99;
  background: var(--grenat); color: #fff; padding: .6rem 1rem;
}
.evitement:focus { left: 1rem; top: 1rem; }

.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.vue {
  padding: 2.4rem clamp(1rem, 3vw, 2.8rem) 2rem;
  min-width: 0;
}

/* ------------------------------------------------- Rail de navigation */
.rail {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  padding: 1.6rem 1.1rem;
  background: linear-gradient(180deg, rgba(15, 21, 29, .96), rgba(15, 21, 29, .86));
  border-right: 1px solid var(--ardoise-600);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  height: 100vh;
}

.marque {
  display: flex;
  align-items: center;
  gap: .75rem;
  text-decoration: none;
  color: inherit;
  padding: .35rem .4rem;
}
.marque-puce {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--rayon-s);
  background: var(--grenat);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(232, 101, 127, .4), 0 8px 20px -12px var(--grenat);
}
.marque-puce .ico { width: 21px; height: 21px; }
.marque-txt strong {
  display: block;
  font: 600 1.12rem/1.1 var(--serif);
  letter-spacing: .02em;
}
.marque-txt small {
  display: block;
  color: var(--texte-doux);
  font-size: .74rem;
  letter-spacing: .04em;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .7rem;
  border-radius: var(--rayon-s);
  color: var(--texte-doux);
  text-decoration: none;
  font-size: .9rem;
  border-left: 2px solid transparent;
}
.nav a .ico { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: rgba(148, 163, 184, .08); color: var(--texte); }
.nav a[aria-current="page"] {
  background: rgba(180, 56, 79, .14);
  border-left-color: var(--grenat);
  color: #fff;
  font-weight: 500;
}
.nav a[aria-current="page"] .ico { opacity: 1; color: var(--grenat-clair); }
.nav hr { border: 0; border-top: 1px solid var(--ardoise-600); margin: .7rem .3rem; }

.rail-pied { margin-top: auto; display: grid; gap: .9rem; }
.compte-mini {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .6rem .7rem;
  border: 1px solid var(--ardoise-600);
  border-radius: var(--rayon-s);
  font-size: .82rem;
}
.compte-mini small { display: block; color: var(--texte-faible); font-size: .72rem; }
.compte-mini a {
  color: var(--texte-doux);
  text-decoration: none;
  font-size: 1.1rem;
  padding: .1rem .35rem;
  border-radius: 4px;
}
.compte-mini a:hover { color: var(--grenat-clair); background: rgba(180, 56, 79, .12); }

/* ------------------------------------------------- Titres */
.titre-page {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 1.8rem;
}
.titre-page h1 {
  margin: 0;
  font: 600 clamp(1.5rem, 2.6vw, 2.05rem)/1.15 var(--serif);
  letter-spacing: -.015em;
}
.titre-page p { margin: .3rem 0 0; color: var(--texte-doux); font-size: .92rem; max-width: 62ch; }

h2 { font: 600 1.12rem/1.3 var(--serif); margin: 0 0 1rem; letter-spacing: -.01em; }

/* ------------------------------------------------- Scission du parc (héros) */
.scission {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
  margin-bottom: 1.1rem;
}
.zone {
  position: relative;
  display: block;
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--ardoise-600);
  border-radius: var(--rayon);
  background: linear-gradient(150deg, rgba(26, 35, 48, .94), rgba(19, 26, 36, .88));
  color: inherit;
  text-decoration: none;
  overflow: hidden;
}
.zone::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--marqueur, var(--grenat));
}
.zone-depot { --marqueur: var(--laiton); }
.zone:hover { border-color: var(--ardoise-500); }
.zone h3 {
  margin: 0;
  font: 500 .88rem/1.4 var(--sans);
  color: var(--texte-doux);
  letter-spacing: .02em;
}
.zone .valeur {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  margin: .35rem 0 .9rem;
  font: 600 3rem/1 var(--serif);
  letter-spacing: -.03em;
}
.zone .valeur span { font: 400 .85rem/1 var(--sans); color: var(--texte-faible); }
.zone .repartition { display: flex; flex-wrap: wrap; gap: .4rem .9rem; font-size: .82rem; color: var(--texte-doux); }
.zone .repartition b { color: var(--texte); font-weight: 500; }

/* ------------------------------------------------- Cartes & grilles */
.panneau {
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--ardoise-600);
  border-radius: var(--rayon);
  background: rgba(26, 35, 48, .82);
  backdrop-filter: blur(6px);
}
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.1rem; }
.grille-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; }

.vignette-type {
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: .85rem 1rem;
  border: 1px solid var(--ardoise-600);
  border-radius: var(--rayon-s);
  background: rgba(15, 21, 29, .5);
  text-decoration: none;
  color: inherit;
}
.vignette-type:hover { border-color: var(--grenat); }
.vignette-type .ico { width: 22px; height: 22px; color: var(--grenat-clair); flex: none; }
.vignette-type b { display: block; font: 500 .9rem/1.3 var(--sans); }
.vignette-type small { color: var(--texte-faible); font-size: .78rem; }
.vignette-type .nb { margin-left: auto; font: 500 1.15rem/1 var(--serif); }

/* ------------------------------------------------- Filtres */
.filtres {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: flex-end;
  padding: 1rem 1.1rem;
  margin-bottom: 1.1rem;
  border: 1px solid var(--ardoise-600);
  border-radius: var(--rayon);
  background: rgba(15, 21, 29, .6);
}
.filtres .champ { flex: 1 1 170px; min-width: 0; }
.filtres .champ.large { flex: 2 1 260px; }

/* ------------------------------------------------- Formulaires */
.champ { display: grid; gap: .3rem; margin-bottom: 1rem; }
.champ > label { font-size: .82rem; color: var(--texte-doux); font-weight: 500; }
.champ .aide { font-size: .76rem; color: var(--texte-faible); }

input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%;
  padding: .62rem .7rem;
  background: var(--ardoise-900);
  border: 1px solid var(--ardoise-600);
  border-radius: var(--rayon-s);
  color: var(--texte);
  font: 400 .92rem var(--sans);
}
input[name="numero_serie"], input[name*="serie"] { font-family: var(--mono); letter-spacing: .02em; }
textarea { min-height: 96px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--texte-doux) 50%), linear-gradient(135deg, var(--texte-doux) 50%, transparent 50%); background-position: right 1rem center, right .72rem center; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible {
  outline: 2px solid var(--grenat-clair);
  outline-offset: 2px;
  border-color: var(--grenat-clair);
}
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }

/* Choix de catégorie en segments */
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.segments label {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem .85rem;
  border: 1px solid var(--ardoise-600);
  border-radius: var(--rayon-s);
  cursor: pointer;
  font-size: .88rem;
}
.segments input { accent-color: var(--grenat); }
.segments label:has(input:checked) { border-color: var(--grenat); background: rgba(180, 56, 79, .12); }

/* ------------------------------------------------- Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .58rem 1.05rem;
  border: 1px solid var(--ardoise-500);
  border-radius: var(--rayon-s);
  background: var(--ardoise-700);
  color: var(--texte);
  font: 500 .88rem var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--ardoise-600); }
.btn-primaire { background: var(--grenat); border-color: var(--grenat); color: #fff; }
.btn-primaire:hover { background: #c94159; border-color: #c94159; }
.btn-danger { color: var(--grenat-clair); border-color: rgba(180, 56, 79, .5); background: transparent; }
.btn-danger:hover { background: rgba(180, 56, 79, .16); }
.btn-petit { padding: .34rem .6rem; font-size: .8rem; }
.bloc { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: 1.4rem; }

/* ------------------------------------------------- Tableau */
.enveloppe-table {
  border: 1px solid var(--ardoise-600);
  border-radius: var(--rayon);
  background: rgba(26, 35, 48, .8);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; min-width: 880px; }
thead th {
  text-align: left;
  padding: .8rem 1rem;
  font: 500 .78rem var(--sans);
  color: var(--texte-doux);
  background: rgba(15, 21, 29, .6);
  border-bottom: 1px solid var(--ardoise-600);
  white-space: nowrap;
}
tbody td { padding: .8rem 1rem; border-bottom: 1px solid rgba(46, 62, 80, .5); vertical-align: middle; font-size: .9rem; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(148, 163, 184, .05); }
td.serie { font-family: var(--mono); font-size: .84rem; color: var(--texte-doux); }
td .nom-mat { display: flex; align-items: center; gap: .6rem; }
td .nom-mat .ico { width: 18px; height: 18px; color: var(--texte-doux); flex: none; }
td .nom-mat b { font-weight: 500; }
td .nom-mat small { display: block; color: var(--texte-faible); font-size: .78rem; }
td.outils { text-align: right; white-space: nowrap; }
td.outils a, td.outils button { margin-left: .3rem; }

/* ------------------------------------------------- Pastilles d'état */
.pastille {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .22rem .6rem;
  border-radius: 99px;
  font-size: .78rem;
  border: 1px solid;
  white-space: nowrap;
}
.pastille::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.etat-en_service  { color: var(--emeraude);  border-color: rgba(63, 178, 127, .35); background: rgba(63, 178, 127, .1); }
.etat-en_stock    { color: var(--bleu-froid); border-color: rgba(91, 141, 214, .35); background: rgba(91, 141, 214, .1); }
.etat-maintenance { color: var(--laiton);    border-color: rgba(217, 162, 74, .35); background: rgba(217, 162, 74, .1); }
.etat-reforme     { color: var(--texte-faible); border-color: rgba(100, 116, 139, .4); background: rgba(100, 116, 139, .1); }

.marque-cat { font-size: .8rem; color: var(--texte-doux); }
.marque-cat::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 2px; margin-right: .45rem; background: var(--grenat); vertical-align: 1px; }
.marque-cat.depot::before { background: var(--laiton); }

/* ------------------------------------------------- Messages & vides */
.flash {
  margin: 0 0 1.2rem;
  padding: .75rem 1rem;
  border-radius: var(--rayon-s);
  border-left: 3px solid var(--emeraude);
  background: rgba(63, 178, 127, .1);
  font-size: .9rem;
}
.flash-erreur { border-left-color: var(--grenat); background: rgba(180, 56, 79, .12); }
.flash-info { border-left-color: var(--bleu-froid); background: rgba(91, 141, 214, .1); }

.vide { padding: 3rem 1.5rem; text-align: center; color: var(--texte-doux); }
.vide h3 { font: 500 1.05rem var(--serif); color: var(--texte); margin: 0 0 .4rem; }
.vide p { margin: 0 0 1.2rem; font-size: .9rem; }

.erreurs { margin: 0 0 1.2rem; padding: .85rem 1rem .85rem 2.2rem; border-left: 3px solid var(--grenat); background: rgba(180, 56, 79, .1); border-radius: var(--rayon-s); font-size: .88rem; }
.erreurs li { margin: .15rem 0; }

/* ------------------------------------------------- Pagination */
.pagination { display: flex; gap: .4rem; align-items: center; justify-content: center; margin-top: 1.3rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: .38rem .7rem;
  border: 1px solid var(--ardoise-600);
  border-radius: var(--rayon-s);
  text-decoration: none;
  color: var(--texte-doux);
  font-size: .85rem;
}
.pagination .courant { background: var(--grenat); border-color: var(--grenat); color: #fff; }

.compteur { color: var(--texte-doux); font-size: .85rem; }

/* ------------------------------------------------- Journal */
.journal { list-style: none; margin: 0; padding: 0; }
.journal li { display: flex; gap: .8rem; padding: .6rem 0; border-bottom: 1px solid rgba(46, 62, 80, .5); font-size: .88rem; }
.journal time { font-family: var(--mono); font-size: .78rem; color: var(--texte-faible); flex: none; width: 128px; }

/* ------------------------------------------------- Connexion */
.page-connexion {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.carte-connexion {
  width: min(420px, 100%);
  padding: 2.2rem;
  border: 1px solid var(--ardoise-600);
  border-radius: 14px;
  background: rgba(19, 26, 36, .92);
  box-shadow: var(--ombre);
  backdrop-filter: blur(10px);
}
.carte-connexion .marque { margin-bottom: 1.6rem; padding: 0; }
.carte-connexion h1 { font: 600 1.35rem/1.2 var(--serif); margin: 0 0 .3rem; }
.carte-connexion .intro { color: var(--texte-doux); font-size: .9rem; margin: 0 0 1.6rem; }
.identifiants { margin-top: 1.5rem; padding-top: 1.1rem; border-top: 1px solid var(--ardoise-600); font-size: .8rem; color: var(--texte-faible); }
.identifiants code { font-family: var(--mono); color: var(--texte-doux); }

.pied { margin-top: 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--ardoise-600); color: var(--texte-faible); font-size: .8rem; }

/* ------------------------------------------------- Responsive */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: column; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav hr { display: none; }
  .nav a { flex: 1 1 auto; }
  .rail-pied { margin-top: .4rem; }
  .duo { grid-template-columns: 1fr; }
  .vue { padding-top: 1.4rem; }
}

/* Lignes de liste : le libellé garde la priorité sur les pictogrammes. */
.journal li > span { min-width: 0; }
.journal li b { overflow-wrap: anywhere; }
.journal li .ico { color: var(--texte-doux); margin-top: .15rem; }

/* Table : la colonne du matériel respire, les marqueurs ne se coupent pas. */
.marque-cat { white-space: nowrap; }
thead th:first-child, tbody td:first-child { min-width: 230px; }


/* Liens dans le contenu : lisibles sur fond sombre. */
.vue a:not(.btn):not(.zone):not(.vignette-type):not(.nav a) { color: var(--grenat-clair); }
.vue a:not(.btn):hover { color: #f28ba0; }

@media (max-width: 900px) {
  /* Le bouton du rail ferait doublon avec celui du titre de page. */
  .rail-pied .btn-primaire { display: none; }
}
