/* NEURAX dashboards — shared system. The network is shown as a live instrument. */
:root {
  --alu: #E7ECF0;
  --alu-2: #DCE3E9;
  --paper: #F7F9FA;
  --ink: #13202C;
  --line: #C5CFD8;
  --mute: #6E7C89;
  --ok: #138A5A;
  --bad: #C8322B;
  --warn: #B26B00;
  --acc: #2846FF;          /* overridden per site */
  --acc-soft: rgba(40, 70, 255, .10);
  --r: 6px;
  --font: "Avenir Next", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--alu);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-size: 15px; line-height: 1.5; min-height: 100vh; }
a { color: var(--acc); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; margin: 0; }
h1 { font-size: 34px; font-weight: 600; line-height: 1.1; }
h2 { font-size: 21px; font-weight: 600; margin: 34px 0 12px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
p { max-width: 68ch; }
.num { font-variant-numeric: tabular-nums; }
.mute { color: var(--mute); }
.small { font-size: 13px; }

/* ---- frame ---- */
.top { display: flex; align-items: center; gap: 20px; padding: 14px 28px; border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 4; }
.mark { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--ink); }
.mark b { font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: .12em; }
.mark span { color: var(--acc); font-weight: 600; }
.top .grow { flex: 1; }
.purse { text-align: right; line-height: 1.15; }
.purse .v { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.purse .l { font-size: 12px; color: var(--mute); }
.frame { display: grid; grid-template-columns: 236px 1fr; min-height: calc(100vh - 62px); }
.rail { border-right: 1px solid var(--line); padding: 22px 0; background: var(--alu-2); }
.rail a { display: block; padding: 9px 26px; color: var(--ink); text-decoration: none; border-left: 3px solid transparent; }
.rail a:hover { background: rgba(255,255,255,.5); }
.rail a[aria-current="page"] { border-left-color: var(--acc); background: var(--paper); font-weight: 600; }
.rail .sep { height: 1px; background: var(--line); margin: 14px 26px; }
main { padding: 0 34px 60px; min-width: 0; }
@media (max-width: 860px) {
  .frame { grid-template-columns: 1fr; }
  .rail { display: flex; overflow-x: auto; padding: 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail a { white-space: nowrap; border-left: 0; border-bottom: 3px solid transparent; padding: 12px 16px; }
  .rail a[aria-current="page"] { border-bottom-color: var(--acc); }
  .rail .sep { display: none; }
  main { padding: 0 16px 50px; }
  .top { padding: 12px 16px; }
  .purse { display: none; }
}

/* ---- the instrument: live network trace ---- */
.instrument { margin: 0 -34px 6px; background: var(--ink); color: #E7ECF0; position: relative; }
.instrument canvas { display: block; width: 100%; height: 150px; }
.meters { display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid rgba(231,236,240,.12); }
.meter { padding: 12px 34px 14px; border-right: 1px solid rgba(231,236,240,.12); }
.meter .v { font-family: var(--font-display); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.1; }
.meter .l { font-size: 12.5px; color: #9FB0C0; }
.meter.hot .v { color: var(--acc-on-ink, #8FA2FF); }
.instrument .status { position: absolute; top: 12px; right: 18px; font-size: 12.5px; color: #9FB0C0; }
.instrument .status i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #2BD38A; margin-right: 6px; vertical-align: 0; }
.instrument .status.off i { background: #E5534B; }
@media (max-width: 860px) { .instrument { margin: 0 -16px 6px; } .meter { padding: 10px 16px; } .meter .v { font-size: 22px; } }

/* ---- content ---- */
.head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 30px 0 16px; flex-wrap: wrap; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 1000px) { .split { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--mute); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--alu-2); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--acc-soft); }
.scroll { overflow-x: auto; }
.empty { padding: 26px; text-align: center; color: var(--mute); }

.state { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mute); }
.state.ok::before { background: var(--ok); }
.state.run::before { background: var(--acc); animation: pulse 1.2s ease-in-out infinite; }
.state.bad::before { background: var(--bad); }
.state.wait::before { background: var(--warn); }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .state.run::before { animation: none; } }

/* ---- forms ---- */
label { display: block; font-size: 13px; color: var(--mute); margin: 12px 0 5px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 9px 11px; }
textarea { font-size: 13px; min-height: 120px; }
input[type="checkbox"], input[type="range"] { width: auto; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--ink); font-size: 14px; }
.check input { margin-top: 4px; }
.btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-weight: 600; border: 0; border-radius: var(--r); padding: 10px 18px; cursor: pointer; background: var(--acc); color: #fff; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.quiet { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--bad); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.msg { font-size: 14px; margin-top: 10px; min-height: 1em; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--ok); }
.choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 8px; }
.choice button { text-align: left; font: inherit; background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; cursor: pointer; color: var(--ink); }
.choice button[aria-pressed="true"] { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); }
.choice button b { display: block; }
.choice button span { font-size: 13px; color: var(--mute); }
.quote { display: flex; align-items: baseline; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.quote .v { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
pre, code.block { display: block; background: var(--ink); color: #DDE6EE; border-radius: var(--r); padding: 14px; overflow: auto; font-size: 12.5px; white-space: pre-wrap; word-break: break-all; font-family: ui-monospace, Menlo, Consolas, monospace; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; word-break: break-all; }
.big { font-family: var(--font-display); font-size: 44px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.note { border-left: 3px solid var(--acc); padding: 10px 14px; background: var(--acc-soft); border-radius: 0 var(--r) var(--r) 0; font-size: 14px; max-width: 76ch; }

/* ---- auth ---- */
.gate { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.gate .side { background: var(--ink); color: #E7ECF0; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.gate .side h1 { font-size: 44px; max-width: 14ch; }
.gate .side p { color: #AFC0CF; font-size: 17px; }
.gate .side canvas { width: 100%; height: 170px; display: block; margin: 20px 0; }
.gate .form { padding: 48px; display: flex; align-items: center; justify-content: center; }
.gate .form > div { width: 100%; max-width: 400px; }
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs button { font: inherit; background: none; border: 0; padding: 10px 2px; margin-right: 18px; color: var(--mute); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--acc); font-weight: 600; }
@media (max-width: 860px) { .gate { grid-template-columns: 1fr; } .gate .side, .gate .form { padding: 26px 18px; } .gate .side h1 { font-size: 32px; } }
.hidden { display: none !important; }
.railname { display: block; padding: 0 26px; }
.mt { margin-top: 18px; }
.mt0 { margin-top: 0; }
.fill { flex: 1; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
.gate .side .mark { color: #E7ECF0; }
input[type="range"], input[type="checkbox"] { accent-color: var(--acc); }
.instrument .status { background: rgba(19,32,44,.85); padding: 2px 8px; border-radius: 4px; }
