:root {
  --bg: #07080b;
  --bg-2: #0c0e13;
  --panel: #12141b;
  --panel-2: #171a22;
  --line: #232833;
  --line-soft: #1b1f28;
  --text: #eceff4;
  --muted: #8b919d;
  --brand: #e10600;
  --brand-dim: rgba(225, 6, 0, 0.22);
  --ok: #2fbf71;
  --warn: #d59a1a;
  --down: #e24b4b;
  --radius: 16px;
  --nav: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  letter-spacing: 0.01em;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }

.shell {
  display: grid;
  grid-template-columns: var(--nav) 1fr;
  min-height: 100vh;
}

.nav {
  background: var(--bg-2);
  border-right: 1px solid var(--line-soft);
  padding: 22px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 0.92rem;
}
.brand img, .brand .mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #140404;
  border: 1px solid var(--brand);
  object-fit: cover;
}
.brand .mark {
  display: grid;
  place-items: center;
  color: var(--brand);
  font-size: 1rem;
}

.nav a.item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}
.nav a.item.active, .nav a.item:hover {
  background: #161920;
  color: var(--text);
}
.nav a.item .dot {
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--brand);
  box-shadow: 0 0 8px var(--brand);
}

.nav-links { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.status-box {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 12px;
  padding: 12px;
  font-size: 0.78rem;
}
.status-box .k { color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; }
.status-box .v { margin-top: 6px; font-weight: 700; }
.status-box .v.ok { color: var(--ok); }
.status-box .v.warn { color: var(--warn); }
.status-box .v.down { color: var(--down); }

.main { padding: 22px 28px 28px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  gap: 12px;
}
.topbar h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 650;
}
.clock {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.85rem;
}
.menu-btn {
  display: none;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-height: 118px;
}
.card.brand-edge { border-color: var(--brand-dim); box-shadow: inset 0 1px 0 var(--brand); }
.card .label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.card .value {
  margin-top: 14px;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}
.card .hint { margin-top: 8px; color: var(--muted); font-size: 0.78rem; }
.card .value.ok { color: var(--ok); }
.card .value.warn { color: var(--warn); }
.card .value.down { color: var(--down); }

.grid-3 {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 0.9fr;
  gap: 14px;
  margin-bottom: 14px;
}
.grid-2 {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.pulse-svg { width: 100%; height: 148px; display: block; }
.pulse-svg .axis { stroke: var(--line); }
.pulse-svg .req { stroke: var(--brand); fill: none; stroke-width: 2; }
.pulse-svg .okline { stroke: var(--ok); fill: none; stroke-width: 1.5; opacity: 0.85; }
.pulse-svg .n402 { stroke: var(--muted); fill: none; stroke-width: 1.5; stroke-dasharray: 3 4; }

.ring-wrap { display: grid; place-items: center; padding: 8px 0 4px; }
.ring { width: 148px; height: 148px; }
.ring text { fill: var(--text); font-size: 18px; font-weight: 700; text-anchor: middle; }
.ring .track { fill: none; stroke: var(--line); stroke-width: 10; }
.ring .arc { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring .arc.ok { stroke: var(--ok); }
.ring .arc.warn { stroke: var(--warn); }
.ring .arc.down { stroke: var(--down); }
.ring .arc.unknown { stroke: var(--muted); }

.portrait {
  min-height: 220px;
  background: #0a0a0d;
  border-radius: 12px;
  border: 1px dashed var(--line);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
}
.portrait img { width: 100%; height: 220px; object-fit: cover; display: block; }
.portrait-foot { display: flex; justify-content: space-between; align-items: end; margin-top: 12px; }
.portrait-foot .sub { color: var(--muted); font-size: 0.8rem; }
.doc-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--line); display: grid; place-items: center;
  background: var(--panel-2);
}

.feed { list-style: none; margin: 12px 0 0; padding: 0; }
.feed li {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
  font-size: 0.88rem;
}
.feed .dot { width: 8px; height: 8px; border-radius: 99px; background: var(--brand); margin-top: 5px; }
.feed .meta { color: var(--muted); font-size: 0.75rem; }
.feed a { text-decoration: underline; color: var(--muted); }
.empty { color: var(--muted); margin-top: 16px; }

.thesis p { line-height: 1.45; color: #d5d9e2; font-size: 0.92rem; }
.facts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 14px; }
.facts div {
  background: var(--panel-2);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.8rem;
}
.facts .k { color: var(--muted); display: block; margin-bottom: 4px; }

.ask {
  margin-top: 8px;
  border: 1px solid var(--brand);
  background: #140808;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.ask input {
  background: transparent;
  border: 0;
  outline: 0;
  width: 100%;
  padding: 8px;
}
.ask button {
  background: var(--brand);
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  cursor: pointer;
}
.ask-out {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.85rem;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.ask-out.err { color: var(--down); }

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.card-head a { color: var(--muted); font-size: 0.78rem; }

.table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.table th { color: var(--muted); font-weight: 500; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; }

.pending { color: var(--muted); }
.lede { color: #d5d9e2; line-height: 1.45; margin: 0 0 16px; font-size: 0.95rem; }

.cortex-card { margin-bottom: 14px; min-height: 0; }
.cortex-net { width: 100%; height: auto; display: block; }
.cortex-net .link { stroke: #2a3140; stroke-width: 1.4; fill: none; }
.cortex-net .core { fill: #140404; stroke: var(--brand); stroke-width: 2; }
.cortex-net .core-pulse { fill: none; stroke: var(--brand); stroke-width: 1; opacity: 0.45; }
.cortex-net .node { fill: var(--panel-2); stroke: var(--line); stroke-width: 1.4; }
.cortex-net .node.health.ok { stroke: var(--ok); }
.cortex-net .node.health.warn { stroke: var(--warn); }
.cortex-net .node.health.down { stroke: var(--down); }
.cortex-net .node.flash { stroke: var(--brand); }
.cortex-net .lbl { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.cortex-net .core-lbl { fill: var(--text); font-size: 12px; font-weight: 700; text-anchor: middle; }
.cortex-net .particle { fill: var(--brand); }
.cortex-net .pay-label { fill: var(--muted); font-size: 11px; }
.cortex-ticker { list-style: none; margin: 10px 0 0; padding: 0; font-size: 0.8rem; color: var(--muted); }
.cortex-ticker li { padding: 4px 0; border-top: 1px solid var(--line-soft); }
.cortex-ticker a { text-decoration: underline; }

.bars { display: flex; align-items: flex-end; gap: 3px; height: 140px; margin-top: 16px; }
.bars .bar {
  flex: 1;
  background: var(--brand);
  opacity: 0.85;
  min-height: 0;
  border-radius: 2px 2px 0 0;
  align-self: flex-end;
}
.bars .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; }
.bars .col .track { flex: 1; display: flex; align-items: flex-end; }

.alloc {
  display: flex;
  height: 12px;
  border-radius: 99px;
  overflow: hidden;
  background: var(--panel-2);
  margin-top: 16px;
}
.alloc span { display: block; height: 100%; }
.alloc .brand { background: var(--brand); }
.alloc .gray { background: #6b7280; }
.alloc .amber { background: var(--warn); }
.alloc-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 10px; color: var(--muted); font-size: 0.75rem; }
.alloc-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 99px; margin-right: 6px; }
.alloc-legend .brand { background: var(--brand); }
.alloc-legend .gray { background: #6b7280; }
.alloc-legend .amber { background: var(--warn); }

.move-in .dot { background: var(--brand); }
.move-out .dot { background: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  .cortex-net .core-pulse { display: none; }
  .cortex-net .particle { display: none; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .nav {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: min(80vw, 280px);
    z-index: 20;
  }
  .nav.open { display: flex; }
  .menu-btn { display: inline-flex; }
  .metrics, .grid-3, .grid-2, .facts { grid-template-columns: 1fr; }
  .ask { grid-template-columns: 1fr; }
  .main { padding: 16px; }
  .cortex-net { max-height: 220px; }
}
