:root {
  --bg: #06090f;
  --panel: rgba(13, 20, 32, 0.72);
  --line: rgba(148, 163, 184, 0.14);
  --txt: #e6edf6;
  --dim: #8b98ab;
  --cyan: #22d3ee;
  --amber: #f59e0b;
  --red: #ef4444;
  --green: #34d399;
  --violet: #a78bfa;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scrollbar-color: #1e293b var(--bg); }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: "Space Grotesk", system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; }
.dim { color: var(--dim); }

.aurora {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 480px at 12% -8%, rgba(34, 211, 238, 0.13), transparent 60%),
    radial-gradient(800px 460px at 88% 4%, rgba(167, 139, 250, 0.12), transparent 60%),
    radial-gradient(700px 600px at 50% 110%, rgba(52, 211, 153, 0.07), transparent 60%);
}

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 28px; border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 10;
  background: rgba(6, 9, 15, 0.75);
}
.brand { display: flex; gap: 14px; align-items: center; }
.logo {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  color: #04121a; box-shadow: 0 0 24px rgba(34, 211, 238, 0.35);
}
.wordmark { font-weight: 700; letter-spacing: 0.22em; font-size: 17px; }
.tagline { color: var(--dim); font-size: 12.5px; margin-top: 2px; }
.topmeta { display: flex; gap: 14px; align-items: center; }
.clock { font-family: "IBM Plex Mono", monospace; font-size: 15px; }
.pill {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.14em;
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line);
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.pill.ok { color: var(--green); border-color: rgba(52, 211, 153, 0.35); }
.pill.bad { color: var(--red); border-color: rgba(239, 68, 68, 0.5); animation: pulse 1s infinite; }
.pill.bad .dot { background: var(--red); box-shadow: 0 0 10px var(--red); }
.pill.warn { color: var(--amber); border-color: rgba(245, 158, 11, 0.4); }
.pill.warn .dot { background: var(--amber); box-shadow: 0 0 10px var(--amber); }
@keyframes pulse { 50% { opacity: 0.55; } }
.ghlink { color: var(--dim); text-decoration: none; font-size: 13px; border: 1px solid var(--line); padding: 8px 14px; border-radius: 999px; }
.ghlink:hover { color: var(--txt); border-color: var(--cyan); }

main { max-width: 1460px; margin: 0 auto; padding: 26px 28px 40px; }
.grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
@media (max-width: 1080px) { .grid { grid-template-columns: 1fr; } }

.channels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 760px) { .channels { grid-template-columns: repeat(2, 1fr); } }
.chan {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 14px 16px 10px; backdrop-filter: blur(10px);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.chan.alarm { border-color: rgba(239, 68, 68, 0.55); box-shadow: 0 0 22px rgba(239, 68, 68, 0.12) inset; }
.chan-head { display: flex; justify-content: space-between; align-items: baseline; }
.chan-name { font-size: 11px; letter-spacing: 0.16em; color: var(--dim); font-weight: 600; }
.chan-val { font-family: "IBM Plex Mono", monospace; font-size: 21px; font-weight: 600; }
.chan-val small { font-size: 12px; color: var(--dim); font-weight: 400; margin-left: 4px; }
.chan canvas { width: 100%; height: 74px; display: block; margin-top: 8px; }
.chan-state { font-size: 10.5px; letter-spacing: 0.1em; margin-top: 6px; color: var(--dim); }
.chan-state.lost { color: var(--red); }

.side { display: flex; flex-direction: column; gap: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px; backdrop-filter: blur(10px);
}
.panel-title { font-size: 11.5px; letter-spacing: 0.18em; font-weight: 600; color: var(--dim); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center;}
.live { color: var(--red); font-size: 10px; display: flex; align-items: center; gap: 6px; }
.blink { width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 1.2s infinite; }
#gauge { width: 100%; height: auto; display: block; }
.gauge-read { text-align: center; font-family: "IBM Plex Mono", monospace; font-size: 40px; font-weight: 600; margin-top: -6px; }
.gauge-read .dim { font-size: 16px; }
.gauge-sub { text-align: center; color: var(--dim); font-size: 12px; margin-top: 2px; }
.layers { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; min-height: 26px; justify-content: center; }
.lchip { font-family: "IBM Plex Mono", monospace; font-size: 10.5px; padding: 4px 10px; border-radius: 6px; letter-spacing: 0.08em;
  background: rgba(239, 68, 68, 0.14); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.4); }
.lchip.ml { background: rgba(34, 211, 238, 0.12); color: var(--cyan); border-color: rgba(34, 211, 238, 0.4); }

.fault-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fault-grid button {
  font-family: inherit; font-size: 12.5px; font-weight: 500; color: var(--txt);
  background: rgba(148, 163, 184, 0.07); border: 1px solid var(--line);
  padding: 10px 8px; border-radius: 10px; cursor: pointer; transition: all 0.15s;
}
.fault-grid button:hover:not(:disabled) { border-color: var(--amber); background: rgba(245, 158, 11, 0.1); transform: translateY(-1px); }
.fault-grid button.danger:hover:not(:disabled) { border-color: var(--red); background: rgba(239, 68, 68, 0.1); }
.fault-grid button:disabled { opacity: 0.35; cursor: default; }
.fault-grid button.armed { border-color: var(--amber); background: rgba(245, 158, 11, 0.16); }
.fault-note { color: var(--dim); font-size: 12px; margin-top: 10px; line-height: 1.5; }

.log-panel { min-height: 220px; }
.log { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.log-empty { color: var(--dim); font-size: 13px; }
.entry { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12.5px; background: rgba(239, 68, 68, 0.05); border-left: 3px solid var(--red); }
.entry.closed { opacity: 0.75; }
.entry .et { font-family: "IBM Plex Mono", monospace; color: var(--dim); font-size: 11px; }
.entry .el { font-weight: 600; margin: 2px 0; }
.entry .ed { color: var(--dim); font-size: 11.5px; }
.entry .tags { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.tag { font-family: "IBM Plex Mono", monospace; font-size: 10px; padding: 2px 8px; border-radius: 5px; background: rgba(148,163,184,0.1); border: 1px solid var(--line); }

.how { margin-top: 20px; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr; } }
.step { display: flex; gap: 12px; font-size: 13.5px; line-height: 1.6; color: #c4cfdd; }
.step .n { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #04121a; background: linear-gradient(135deg, var(--cyan), var(--violet)); }
.step b { color: var(--txt); }

.modelcard { margin-top: 20px; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
.metric { background: rgba(148, 163, 184, 0.05); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.metric .mv { font-family: "IBM Plex Mono", monospace; font-size: 24px; font-weight: 600; color: var(--cyan); }
.metric .mk { font-size: 11px; letter-spacing: 0.12em; color: var(--dim); margin-top: 4px; }
.perfault { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (max-width: 1100px) { .perfault { grid-template-columns: repeat(2, 1fr); } }
.pf { border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 12px; }
.pf .pn { font-weight: 600; margin-bottom: 6px; }
.pf .pr { font-family: "IBM Plex Mono", monospace; color: var(--green); }
.pf .pd { color: var(--dim); margin-top: 4px; }
.pf .pl { font-family: "IBM Plex Mono", monospace; font-size: 10px; color: var(--violet); margin-top: 4px; }

footer { display: flex; justify-content: space-between; padding: 22px 28px 30px; color: var(--dim); font-size: 12.5px; border-top: 1px solid var(--line); max-width: 1460px; margin: 0 auto; }
footer a { color: var(--cyan); text-decoration: none; }
