:root {
  --fond: #05070d;
  --fond-2: #0b0f1a;
  --fond-3: #111827;
  --ligne: rgba(148, 163, 184, 0.14);
  --texte: #e5e9f2;
  --texte-2: #9aa5b8;
  --texte-3: #66718a;
  --cyan: #35d0ff;
  --violet: #7c5cff;
  --or: #ffd166;
  --rose: #ff3366;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--fond);
  color: var(--texte);
  font: 13px/1.45 var(--sans);
  display: grid;
  grid-template-columns: 236px 1fr 360px;
  grid-template-rows: 56px 1fr 30px;
  grid-template-areas: "barre barre barre" "filtres graphe fiche" "legende legende legende";
  overflow: hidden;
}
body.avec-activite { grid-template-columns: 236px 1fr 400px; }
button { font: inherit; color: inherit; background: none; border: 1px solid var(--ligne); border-radius: 8px; padding: 5px 10px; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
button:hover { background: rgba(255,255,255,.05); border-color: rgba(148,163,184,.35); }
button.actif { background: rgba(53,208,255,.12); border-color: rgba(53,208,255,.5); color: #d9f4ff; }
button.lien { border: 0; padding: 0 4px; color: var(--texte-3); font-size: 11px; }
button.lien:hover { color: var(--cyan); background: none; }
h3 { margin: 0 0 8px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--texte-3); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(148,163,184,.18); border-radius: 8px; }

/* barre */
.barre { grid-area: barre; display: flex; align-items: center; gap: 18px; padding: 0 16px; background: linear-gradient(180deg, rgba(17,24,39,.9), rgba(11,15,26,.9)); border-bottom: 1px solid var(--ligne); backdrop-filter: blur(8px); z-index: 5; }
.marque { display: flex; align-items: center; gap: 10px; min-width: 250px; }
.orbe { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 40% 40%, #fff, var(--cyan) 35%, var(--violet) 70%, transparent 72%); box-shadow: 0 0 18px rgba(53,208,255,.6), 0 0 40px rgba(124,92,255,.35); animation: respire 4s ease-in-out infinite; }
.orbe.grande { width: 56px; height: 56px; margin: 0 auto 14px; }
@keyframes respire { 0%,100% { transform: scale(1); box-shadow: 0 0 18px rgba(53,208,255,.6), 0 0 40px rgba(124,92,255,.35);} 50% { transform: scale(1.08); box-shadow: 0 0 26px rgba(53,208,255,.85), 0 0 60px rgba(124,92,255,.5);} }
.titre { font-weight: 650; font-size: 15px; letter-spacing: .01em; }
.sous { font-size: 11px; color: var(--texte-3); }
.vues { display: flex; gap: 4px; background: rgba(255,255,255,.03); padding: 3px; border-radius: 10px; border: 1px solid var(--ligne); }
.vues button { border: 0; padding: 6px 14px; border-radius: 8px; color: var(--texte-2); }
.vues button.actif { background: linear-gradient(135deg, rgba(53,208,255,.22), rgba(124,92,255,.22)); color: #fff; box-shadow: inset 0 0 0 1px rgba(53,208,255,.35); }
.recherche { position: relative; flex: 1; max-width: 420px; }
.recherche input { width: 100%; background: rgba(255,255,255,.04); border: 1px solid var(--ligne); border-radius: 10px; padding: 8px 12px; color: var(--texte); outline: none; font: inherit; }
.recherche input:focus { border-color: rgba(53,208,255,.5); box-shadow: 0 0 0 3px rgba(53,208,255,.12); }
#resultats { position: absolute; top: 40px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none; background: var(--fond-3); border: 1px solid var(--ligne); border-radius: 10px; max-height: 360px; overflow: auto; z-index: 20; box-shadow: 0 20px 50px rgba(0,0,0,.5); }
#resultats li { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
#resultats li:hover, #resultats li.actif { background: rgba(255,255,255,.06); }
#resultats .type { font-size: 10px; color: var(--texte-3); margin-left: auto; text-transform: uppercase; letter-spacing: .08em; }
.actions { display: flex; gap: 6px; margin-left: auto; align-items: center; }
#presentation.actif { background: rgba(255,209,102,.14); border-color: rgba(255,209,102,.6); color: #ffe7a8; }

/* filtres */
.filtres { grid-area: filtres; background: var(--fond-2); border-right: 1px solid var(--ligne); padding: 14px 12px; overflow: auto; display: flex; flex-direction: column; gap: 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--ligne); font-size: 11.5px; cursor: pointer; user-select: none; color: var(--texte-2); background: rgba(255,255,255,.02); }
.chip .pastille { width: 8px; height: 8px; border-radius: 50%; background: var(--c, #888); box-shadow: 0 0 8px var(--c, #888); }
.chip.actif { color: var(--texte); border-color: color-mix(in srgb, var(--c, #888) 60%, transparent); background: color-mix(in srgb, var(--c, #888) 14%, transparent); }
.chip.inactif { opacity: .45; }
.chip .n { color: var(--texte-3); font-size: 10px; }
.chip.entreprise.actif { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }
.stats { margin-top: auto; font-size: 11px; color: var(--texte-3); line-height: 1.6; }
.stats b { color: var(--texte-2); font-weight: 600; }

/* graphe */
#graphe { grid-area: graphe; position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #0d1224 0%, var(--fond) 65%); }
#canevas { position: absolute; inset: 0; }
#etiquette-vue { position: absolute; left: 16px; top: 12px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--texte-3); pointer-events: none; }
#bandeau-presentation { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: rgba(255,209,102,.12); border: 1px solid rgba(255,209,102,.5); color: #ffe7a8; padding: 5px 12px; border-radius: 999px; font-size: 11.5px; z-index: 3; }
#focus-barre { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(11,15,26,.9); border: 1px solid var(--ligne); border-radius: 12px; padding: 8px 12px; display: flex; gap: 8px; align-items: center; font-size: 12px; z-index: 3; backdrop-filter: blur(6px); }
#visite-panneau { position: absolute; left: 20px; bottom: 20px; width: 380px; background: rgba(11,15,26,.94); border: 1px solid rgba(53,208,255,.35); border-radius: 14px; padding: 16px 18px; z-index: 4; box-shadow: 0 20px 60px rgba(0,0,0,.55), 0 0 40px rgba(53,208,255,.08); backdrop-filter: blur(8px); }
.visite-etape { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--cyan); margin-bottom: 6px; }
.visite-texte { font-size: 13.5px; line-height: 1.5; }
.visite-texte b { color: #fff; }
.visite-boutons { display: flex; gap: 6px; margin-top: 12px; }
.visite-boutons #visite-fermer { margin-left: auto; color: var(--texte-3); border: 0; }

/* fiche */
.fiche { grid-area: fiche; background: var(--fond-2); border-left: 1px solid var(--ligne); overflow: auto; padding: 16px; }
.fiche-vide { color: var(--texte-3); text-align: center; padding-top: 80px; font-size: 12.5px; }
.fiche-vide .petit { font-size: 11px; }
.fiche .entete { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--ligne); margin-bottom: 12px; }
.fiche .type-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--texte-2); }
.fiche .type-badge .pastille { width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
.fiche h2 { margin: 0; font-size: 17px; font-weight: 650; line-height: 1.25; }
.fiche .statut { font-size: 12px; color: var(--or); }
.fiche .chips { margin-top: 4px; }
.fiche .chip { cursor: pointer; }
.fiche dl { display: grid; grid-template-columns: 96px 1fr; gap: 5px 10px; margin: 0 0 12px; font-size: 12px; }
.fiche dt { color: var(--texte-3); }
.fiche dd { margin: 0; }
.fiche .desc { font-size: 12.5px; line-height: 1.55; color: #cfd6e4; margin: 0 0 12px; }
.fiche code, .fiche .mono { font-family: var(--mono); font-size: 11px; color: #a5b4fc; word-break: break-all; }
.fiche .boutons { display: flex; gap: 6px; margin-bottom: 14px; }
.fiche h4 { margin: 14px 0 6px; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--texte-3); font-weight: 600; }
.fiche ul.relations { list-style: none; margin: 0; padding: 0; }
.fiche ul.relations li { display: flex; align-items: center; gap: 7px; padding: 4px 6px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.fiche ul.relations li:hover { background: rgba(255,255,255,.05); }
.fiche ul.relations .pastille { width: 7px; height: 7px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); flex: none; }
.fiche ul.relations .nom { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mode { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; border: 1px solid; flex: none; }
.mode.configure { color: #7dd3fc; border-color: rgba(125,211,252,.4); }
.mode.observe { color: #ff6b8f; border-color: rgba(255,107,143,.5); }
.mode.documente { color: #a3a9b8; border-color: rgba(163,169,184,.35); }
.mode.potentiel { color: #8b93a7; border-color: rgba(139,147,167,.3); border-style: dashed; }
.fiche .memoire-liste { columns: 1; font-size: 11px; color: var(--texte-2); max-height: 220px; overflow: auto; padding-left: 16px; margin: 0; }
.fiche .signal { border-left: 2px solid var(--rose); padding: 4px 8px; margin: 6px 0; font-size: 12px; }
.fiche .signal .quand { color: var(--texte-3); font-size: 11px; }
.gravite { display: inline-block; min-width: 18px; text-align: center; font-size: 10px; font-weight: 700; border-radius: 4px; padding: 1px 4px; }
.gravite-1 { background: rgba(255,51,102,.25); color: #ff8fab; }
.gravite-2 { background: rgba(255,209,102,.2); color: #ffe08a; }
.gravite-3 { background: rgba(53,208,255,.15); color: #9be7ff; }

/* activité */
.activite { grid-area: fiche; background: var(--fond-2); border-left: 1px solid var(--ligne); overflow: auto; padding: 14px 16px; }
.activite header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.activite header h3 { margin: 0; }
.fenetre { display: flex; gap: 3px; }
.fenetre button { padding: 3px 8px; font-size: 11px; }
.note { font-size: 11.5px; color: var(--texte-3); margin: 0 0 10px; line-height: 1.45; }
#evenements { list-style: none; margin: 0 0 18px; padding: 0; }
#evenements li { padding: 8px 10px; border-radius: 8px; border: 1px solid var(--ligne); margin-bottom: 6px; cursor: pointer; background: rgba(255,255,255,.015); }
#evenements li:hover { border-color: rgba(148,163,184,.35); }
#evenements .ligne1 { display: flex; gap: 8px; align-items: center; font-size: 12px; }
#evenements .agent { font-weight: 600; }
#evenements .quand { color: var(--texte-3); font-size: 11px; margin-left: auto; white-space: nowrap; }
#evenements .sujet { font-size: 12px; color: #cfd6e4; margin-top: 3px; line-height: 1.4; }
#evenements .passage { color: var(--texte-2); }
#evenements .genre { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; }
#evenements .genre.signal { background: rgba(255,51,102,.18); color: #ff8fab; }
#evenements .genre.passage { background: rgba(148,163,184,.14); color: var(--texte-2); }
#evenements .genre.blanc { background: rgba(255,209,102,.14); color: #ffe08a; }
#horloge { width: 100%; max-width: 260px; display: block; margin: 0 auto 8px; }
#horloge-liste { list-style: none; margin: 0; padding: 0; font-size: 11.5px; color: var(--texte-2); }
#horloge-liste li { display: flex; gap: 8px; padding: 2px 0; }
#horloge-liste .h { font-family: var(--mono); color: var(--or); min-width: 88px; }

/* légende */
.legende { grid-area: legende; display: flex; align-items: center; gap: 14px; padding: 0 16px; border-top: 1px solid var(--ligne); font-size: 11px; color: var(--texte-3); background: var(--fond-2); overflow: hidden; white-space: nowrap; }
.legende .item { display: inline-flex; align-items: center; gap: 5px; }
.legende .trait { width: 22px; height: 0; border-top: 2px solid; }
.legende .trait.documente { border-top-style: dashed; }
.legende .trait.potentiel { border-top-style: dotted; }

/* présentation */
body.presentation .filtres { display: none; }
body.presentation { grid-template-columns: 0 1fr 380px; }
body.presentation .fiche .mono, body.presentation .fiche code { filter: blur(0); }
body.presentation .fiche .confidentiel { display: none; }
body.presentation .titre { font-size: 17px; }

@media (max-width: 1100px) {
  body, body.avec-activite, body.presentation { grid-template-columns: 200px 1fr 320px; }
}
