/* Atlas : un instrument de laboratoire, la vibe de ring-0 sans la copier.
   Fond bleu nuit, panneaux à filet fin, barres de titre en capitales, chiffres de télémétrie, accents sourds. */
:root {
  --bg: #0b1324;
  --bg-deep: #070d1a;
  --panel: #0f1a30;
  --panel-2: #13213b;
  --line: #22385a;
  --line-soft: #182a46;
  --text: #c9d5e8;
  --dim: #7186a6;
  --faint: #4a5d7d;
  --green: #86d9a8;   /* persona cohérente */
  --amber: #e5b961;   /* changement de ton */
  --violet: #a796ea;  /* identité */
  --coral: #ee8f78;   /* déviance */
  --cyan: #74c6df;    /* ce qui se clique */
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --r: 3px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  background-image: radial-gradient(ellipse at 70% -10%, #13244a 0%, transparent 55%);
  background-attachment: fixed;
  color: var(--text);
  font: 400 13px/1.55 var(--mono);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: #2b4a78; }

/* ---------- barre du haut ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 28px;
  padding: 0 20px; height: 48px;
  background: rgba(7, 13, 26, .92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: .02em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; color: var(--green); }
.rooms { display: flex; gap: 2px; }
.rooms a {
  padding: 6px 12px; color: var(--dim); border: 1px solid transparent; border-radius: var(--r);
}
.rooms a:hover { color: var(--text); text-decoration: none; background: var(--panel); }
.rooms a[aria-current="page"] { color: var(--text); border-color: var(--line); background: var(--panel); }
.telemetry { margin-left: auto; display: flex; gap: 18px; align-items: center; color: var(--dim); font-size: 12px; }
.telemetry b { color: var(--text); font-weight: 600; }
.live { display: inline-flex; align-items: center; gap: 6px; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.live.on::before { background: var(--green); box-shadow: 0 0 8px var(--green); }
.live.off::before { background: var(--coral); }

main { padding: 16px 20px 40px; outline: none; }

/* ---------- panneaux ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel) 0%, rgba(15, 26, 48, .86) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  min-width: 0;
  display: flex; flex-direction: column;
}
.panel > h2 {
  margin: 0; padding: 7px 12px;
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; gap: 10px; white-space: nowrap;
}
.panel > h2 .aside { margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); }
.panel .body { padding: 12px; min-height: 0; }
.panel .note { margin: 0; padding: 8px 12px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: 11.5px; }

.grid { display: grid; gap: 14px; }
/* la page ne grandit jamais avec le fil : une rangée de la hauteur de l'écran, le fil défile dans son panneau */
.hub { grid-template-columns: minmax(0, 1fr) 380px; grid-template-rows: minmax(0, 1fr); height: calc(100vh - 104px); min-height: 560px; }
.hub > * { min-height: 0; }
.hub .side-col { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: hidden; }
.hub .side-col > .panel { flex: none; }
.hub .side-col > .feed-panel { flex: 1 1 0; min-height: 160px; overflow: hidden; }
.hub .feed-panel .feed { max-height: none; flex: 1 1 0; min-height: 0; overflow-y: auto; }
@media (max-width: 1000px) {
  .hub { grid-template-columns: 1fr; grid-template-rows: auto; height: auto; }
  .hub .stack { height: 70vh; }
  .hub .side-col { overflow: visible; }
  .hub .side-col > .feed-panel { flex: none; }
  .hub .feed-panel .feed { max-height: 50vh; }
}

/* ---------- chiffres ---------- */
.counts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line-soft); }
.counts div { background: var(--panel); padding: 10px 12px; }
.counts .n { display: block; font-size: 22px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.counts .l { color: var(--dim); font-size: 11.5px; }

.bars { display: grid; gap: 5px; }
.bar { display: grid; grid-template-columns: 110px 1fr 54px; gap: 10px; align-items: center; font-size: 12px; }
.bar .track { height: 6px; background: var(--bg-deep); border-radius: 1px; overflow: hidden; }
.bar .fill { height: 100%; background: var(--green); }
.bar .v { text-align: right; color: var(--dim); font-variant-numeric: tabular-nums; }

/* ---------- fil en direct ---------- */
.feed { list-style: none; margin: 0; padding: 0; overflow: auto; max-height: 52vh; }
.feed li { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); display: grid; gap: 3px; }
.feed li.fresh { animation: arrive 1.6s ease-out; }
@keyframes arrive { from { background: rgba(134, 217, 168, .14); } to { background: transparent; } }
.feed .when { color: var(--faint); font-size: 11px; }
.feed .what { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.feed q { color: var(--dim); font-style: italic; quotes: "« " " »"; }
.empty { padding: 18px 12px; color: var(--dim); }
.empty code { color: var(--text); }

.tag { display: inline-block; padding: 0 6px; border: 1px solid currentColor; border-radius: 2px; font-size: 11px; line-height: 17px; }
.tag.green { color: var(--green); } .tag.amber { color: var(--amber); }
.tag.violet { color: var(--violet); } .tag.coral { color: var(--coral); } .tag.dim { color: var(--dim); }
.key { color: var(--text); font-weight: 600; }

/* ---------- 3D ---------- */
.scene { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.scene canvas { display: block; width: 100%; height: 100%; }
.scene .legend {
  position: absolute; left: 12px; top: 10px; display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--dim); pointer-events: none; max-width: 75%;
}
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.tip {
  position: fixed; z-index: 20; pointer-events: none; max-width: 360px;
  padding: 8px 10px; background: rgba(7, 13, 26, .96); border: 1px solid var(--line); border-radius: var(--r);
  font-size: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
}
.tip .key { display: block; margin-bottom: 2px; }
.tip q { color: var(--dim); font-style: italic; }

/* ---------- carte ---------- */
.map { grid-template-columns: 260px minmax(0, 1fr); height: calc(100vh - 104px); min-height: 520px; }
.map .scene-panel { min-height: 0; }
@media (max-width: 900px) { .map { grid-template-columns: 1fr; height: auto; } .map .scene-panel { height: 70vh; } }
.controls { display: grid; gap: 14px; align-content: start; }
.field { display: grid; gap: 5px; }
.field > span { color: var(--dim); font-size: 11.5px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.seg button { background: transparent; border: 0; padding: 5px 10px; color: var(--dim); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--text); }
input[type="text"], input[type="search"], input[type="number"], select, textarea {
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: var(--r); padding: 5px 8px; min-width: 0;
}
input[type="text"], input[type="search"], input[type="number"], select { height: 30px; }
textarea { width: 100%; resize: vertical; min-height: 70px; line-height: 1.5; }
input[type="range"] { accent-color: var(--cyan); width: 100%; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--dim); cursor: pointer; }
.btn {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r); padding: 5px 12px;
  cursor: pointer; color: var(--text);
}
.btn:hover { border-color: var(--cyan); }
.btn[aria-pressed="true"] { border-color: currentColor; }
.btn.green[aria-pressed="true"] { color: var(--green); }
.btn.coral[aria-pressed="true"] { color: var(--coral); }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
th { color: var(--dim); font-weight: 400; font-size: 11.5px; position: sticky; top: 0; background: var(--panel); }
tbody tr:hover { background: rgba(116, 198, 223, .05); }
td.num, th.num { text-align: right; }
td.snip { color: var(--dim); max-width: 520px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; padding: 12px; border-bottom: 1px solid var(--line-soft); }
.pager { display: flex; gap: 10px; align-items: center; padding: 10px 12px; color: var(--dim); }
.sig { display: inline-flex; align-items: center; gap: 8px; }
.sig .track { width: 64px; height: 5px; background: var(--bg-deep); }
.sig .fill { height: 100%; }

/* ---------- fiche ---------- */
.spec { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1000px) { .spec { grid-template-columns: 1fr; } }
.spec-head { display: flex; gap: 18px; align-items: baseline; flex-wrap: wrap; margin-bottom: 14px; }
.spec-head h1 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.spec-head .sub { color: var(--dim); }
.z-rows { display: grid; gap: 6px; }
.z-row { display: grid; grid-template-columns: 96px 1fr 44px; gap: 10px; align-items: center; font-size: 12px; }
.z-axis { position: relative; height: 12px; background: var(--bg-deep); }
.z-axis .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--line); }
.z-axis .gate { position: absolute; top: 0; bottom: 0; border-left: 1px dashed var(--faint); }
.z-axis .val { position: absolute; top: 2px; bottom: 2px; }
.z-row .v { text-align: right; color: var(--dim); }
.doses { display: flex; gap: 6px; flex-wrap: wrap; }
.answers { display: grid; gap: 14px; }
.qa { border: 1px solid var(--line-soft); border-radius: var(--r); }
.qa h3 { margin: 0; padding: 7px 10px; font-size: 12.5px; font-weight: 600; border-bottom: 1px solid var(--line-soft); }
.qa .pair { display: grid; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .qa .pair { grid-template-columns: 1fr; } }
.qa .side { padding: 10px; min-width: 0; }
.qa .side + .side { border-left: 1px solid var(--line-soft); }
.qa .meta { color: var(--faint); font-size: 11px; margin-bottom: 4px; }
.qa pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; }
.qa .pushed pre { color: #e6edf7; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
dl.kv dt { color: var(--dim); }
dl.kv dd { margin: 0; }

.gpu { display: grid; gap: 8px; }
.gpu .row { display: grid; grid-template-columns: 40px 1fr 128px; gap: 10px; align-items: center; font-size: 12px; }
.jobs { margin: 8px 0 0; padding: 0; list-style: none; color: var(--dim); font-size: 11.5px; }
.jobs li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.layer-grid td.cell { min-width: 120px; }
.mini { height: 5px; background: var(--bg-deep); margin-top: 4px; }
.mini > div { height: 100%; background: var(--cyan); }

.err { color: var(--coral); padding: 12px; }

@media (prefers-reduced-motion: reduce) {
  .feed li.fresh { animation: none; }
}

/* ---------- téléphone ---------- */
@media (max-width: 700px) {
  .top { gap: 12px; padding: 0 16px; }
  .telemetry { display: none; }
  .rooms { overflow-x: auto; min-width: 0; }
  .rooms a { padding: 6px 9px; white-space: nowrap; }
  main { padding: 12px 16px 32px; }
  .panel > h2 .aside { display: none; }
  .bar { grid-template-columns: 90px 1fr 44px; }
}

details.panel > summary::marker { color: var(--faint); }

input:disabled, select:disabled { opacity: .45; cursor: not-allowed; }
mark { background: rgba(229, 185, 97, .28); color: #fff3d6; border-radius: 2px; padding: 0 1px; }
