:root {
  color-scheme: dark;
  --bg: #020711;
  --panel: rgba(7, 17, 34, 0.88);
  --line: rgba(109, 161, 218, 0.18);
  --text: #eaf5ff;
  --muted: #7691aa;
  --cyan: #5de1ff;
  --blue: #3b79ff;
  --green: #54f0b1;
  --amber: #ffc56b;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 45% 25%, rgba(22, 92, 153, .13), transparent 34%),
    linear-gradient(rgba(75, 121, 167, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(75, 121, 167, .025) 1px, transparent 1px), var(--bg);
  background-size: auto, 32px 32px, 32px 32px;
}

.topbar, footer {
  min-height: 70px;
  padding: 0 clamp(18px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(2, 7, 17, .86);
  backdrop-filter: blur(14px);
}
.topbar { position: sticky; top: 0; z-index: 20; }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 34px; height: 34px; border: 1px solid rgba(93,225,255,.45); display: grid; place-items: center; color: var(--cyan); box-shadow: 0 0 24px rgba(93,225,255,.14); }
.brand b, .brand small, .runtime-state small { display: block; letter-spacing: .16em; }
.brand b { font-size: 13px; }
.brand small, .runtime-state small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.runtime-state { display: flex; align-items: center; gap: 10px; text-align: right; }
.runtime-state b { display: block; margin-top: 3px; color: var(--green); font-size: 11px; letter-spacing: .14em; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 14px currentColor; }
.status-dot.online { color: var(--green); background: var(--green); }
.status-dot.stale { color: var(--amber); background: var(--amber); }

.maintenance-notice {
  width: min(1500px, calc(100% - 36px));
  min-height: 64px;
  margin: 14px auto 0;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  border: 1px solid rgba(255, 197, 107, .3);
  background: linear-gradient(90deg, rgba(87, 54, 13, .22), rgba(7, 17, 34, .92));
  box-shadow: inset 3px 0 var(--amber);
}
.maintenance-icon { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid rgba(255,197,107,.48); border-radius: 50%; color: var(--amber); font: 600 13px ui-monospace, monospace; }
.maintenance-notice b { color: var(--amber); font-size: 9px; letter-spacing: .14em; }
.maintenance-notice p { margin: 5px 0 0; color: #8fa8bc; font-size: 10px; line-height: 1.45; }
.maintenance-notice small { color: #607d94; font-size: 7px; letter-spacing: .13em; white-space: nowrap; }

main { width: min(1500px, calc(100% - 36px)); margin: 26px auto 38px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(330px, .72fr); gap: 14px; }
.right-column { display: grid; gap: 14px; }
.panel, .metric {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(10,24,46,.86), rgba(4,12,25,.92));
  box-shadow: inset 0 1px rgba(255,255,255,.025), 0 20px 60px rgba(0,0,0,.16);
}
.panel-head { min-height: 67px; padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.panel-head small, .panel-head > span, .panel-meta span { color: var(--muted); font-size: 8px; letter-spacing: .16em; }
.panel-head h1, .panel-head h2 { margin: 5px 0 0; font-size: 17px; font-weight: 530; letter-spacing: .02em; }
.panel-meta { display: flex; gap: 14px; text-align: right; }
.panel-meta span:first-child { color: var(--cyan); }

.graph-stage { position: relative; height: 470px; overflow: hidden; background: radial-gradient(circle at center, rgba(26,102,160,.14), transparent 55%); }
#knowledge-graph { width: 100%; height: 100%; display: block; }
.graph-core { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 148px; height: 148px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: radial-gradient(circle, rgba(26,105,166,.58), rgba(3,14,31,.96) 68%); border: 1px solid rgba(93,225,255,.7); box-shadow: 0 0 38px rgba(73,181,255,.28), inset 0 0 32px rgba(93,225,255,.18); pointer-events: none; }
.graph-core span { font-size: 16px; letter-spacing: .2em; }
.graph-core small { width: 118px; margin-top: 9px; overflow: hidden; color: var(--cyan); font-size: 9px; letter-spacing: .11em; text-overflow: ellipsis; white-space: nowrap; }
.graph-legend { position: absolute; left: 16px; bottom: 14px; display: flex; gap: 18px; color: var(--muted); font-size: 8px; letter-spacing: .12em; }
.graph-legend i { display: inline-block; width: 15px; height: 1px; margin-right: 7px; vertical-align: middle; background: rgba(93,225,255,.35); }
.graph-legend i.live { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

.focus-card, .cycle-card { min-height: 0; }
.pulse-tag, .shield { padding: 5px 7px; border: 1px solid rgba(84,240,177,.25); color: var(--green) !important; }
.focus-card > p { min-height: 66px; margin: 17px 18px; color: #9cb2c6; font-size: 12px; line-height: 1.65; }
.focus-progress { height: 3px; margin: 0 18px; background: rgba(255,255,255,.06); }
.focus-progress span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); box-shadow: 0 0 10px var(--cyan); transition: width .5s ease; }
.focus-meta { padding: 13px 18px 17px; display: flex; justify-content: space-between; color: var(--muted); font-size: 8px; letter-spacing: .13em; }
.focus-meta b { margin-left: 5px; color: var(--text); }
.cycle-stages { list-style: none; margin: 0; padding: 11px 18px 17px; display: grid; gap: 3px; counter-reset: stage; }
.cycle-stages li { position: relative; min-height: 27px; padding: 6px 8px 6px 28px; color: #718ba2; font-size: 9px; letter-spacing: .11em; counter-increment: stage; }
.cycle-stages li::before { content: counter(stage, decimal-leading-zero); position: absolute; left: 4px; color: #405870; }
.cycle-stages li.done { color: #9fc5d9; }
.cycle-stages li.active { color: var(--cyan); background: rgba(59,121,255,.09); }
.cycle-stages li.active::after { content: ""; position: absolute; right: 8px; top: 11px; width: 5px; height: 5px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }

.metric-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 14px 0; }
.metric { min-width: 0; padding: 16px; }
.metric small, .metric span { display: block; color: var(--muted); font-size: 8px; letter-spacing: .13em; }
.metric strong { display: block; margin: 7px 0 5px; font: 500 clamp(20px, 2vw, 28px)/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.metric span { color: #4e718b; letter-spacing: .04em; }
.metric.warning strong { color: var(--amber); }

.intelligence-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 14px; margin-bottom: 14px; }
.brief-body { min-height: 116px; padding: 20px; display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; }
.brief-index { color: var(--cyan); font: 500 11px ui-monospace, monospace; }
.brief-body b { font-size: 15px; font-weight: 520; }
.brief-body p { max-width: 760px; margin: 10px 0 0; color: #8fa8bc; font-size: 11px; line-height: 1.7; }
.brief-facts { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); }
.brief-facts span { padding: 13px 18px; color: #58738a; font-size: 7px; letter-spacing: .13em; }
.brief-facts span + span { border-left: 1px solid var(--line); }
.brief-facts b { display: block; margin-top: 6px; color: #cbe1ef; font-size: 9px; letter-spacing: .08em; }
.quality-grid { min-height: 167px; padding: 17px; display: grid; grid-template-columns: repeat(4, 1fr); align-items: center; gap: 8px; text-align: center; }
.quality-ring { --quality: 0; width: 66px; height: 66px; margin: auto; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, #071326 57%, transparent 59%), conic-gradient(var(--cyan) calc(var(--quality) * 1%), rgba(92,137,174,.12) 0); box-shadow: 0 0 17px rgba(93,225,255,.07); }
.quality-ring b { font: 500 12px ui-monospace, monospace; }
.quality-grid small { display: block; margin-top: 9px; color: #58738a; font-size: 7px; letter-spacing: .1em; line-height: 1.4; }
.knowledge-flow-panel { margin-bottom: 14px; }
.knowledge-flow { display: grid; grid-template-columns: repeat(5, 1fr); }
.knowledge-flow article { position: relative; min-height: 135px; padding: 18px; }
.knowledge-flow article + article { border-left: 1px solid var(--line); }
.knowledge-flow article:not(:last-child)::after { content: ""; position: absolute; z-index: 2; right: -4px; top: 50%; width: 7px; height: 7px; border-top: 1px solid var(--cyan); border-right: 1px solid var(--cyan); transform: rotate(45deg); background: #071326; }
.knowledge-flow i { color: #36556e; font: normal 8px ui-monospace, monospace; }
.knowledge-flow small, .knowledge-flow span { display: block; color: #58738a; font-size: 7px; letter-spacing: .1em; }
.knowledge-flow small { margin-top: 15px; color: #7d9ab1; }
.knowledge-flow strong { display: block; margin: 7px 0; color: #d9f3ff; font: 500 20px ui-monospace, monospace; }
.knowledge-flow span { letter-spacing: .03em; }

.lower-grid { display: grid; grid-template-columns: 1.05fr 1.25fr .8fr; gap: 14px; }
.domain-list { padding: 14px 18px 17px; display: grid; gap: 9px; }
.domain-row { display: grid; grid-template-columns: 92px 1fr 38px; align-items: center; gap: 10px; color: #93aabe; font-size: 9px; letter-spacing: .08em; }
.domain-bar { height: 3px; background: rgba(255,255,255,.05); }
.domain-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.domain-row b { color: var(--cyan); text-align: right; font: 500 9px ui-monospace, monospace; }
.event-stream { height: 270px; overflow: hidden; padding: 10px 18px; }
.event { display: grid; grid-template-columns: 58px 70px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(109,161,218,.09); font-size: 9px; line-height: 1.45; }
.event time { color: #46647e; font-family: ui-monospace, monospace; }
.event b { color: var(--cyan); font-weight: 500; letter-spacing: .08em; }
.event span { color: #8fa8bc; }
.safety-panel dl { margin: 0; padding: 10px 18px; }
.safety-panel dl div { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(109,161,218,.08); font-size: 9px; }
.safety-panel dt { color: #7c96ab; }
.safety-panel dd { margin: 0; color: var(--green); letter-spacing: .1em; }
.safety-panel p { margin: 6px 18px 18px; color: #57738a; font-size: 9px; line-height: 1.6; }
.layer-panel { margin-top: 14px; }
.layer-grid { display: grid; grid-template-columns: repeat(6, 1fr); }
.layer-grid article { position: relative; min-height: 138px; padding: 18px; }
.layer-grid article + article { border-left: 1px solid var(--line); }
.layer-grid i { display: block; width: 7px; height: 7px; margin-bottom: 15px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.layer-grid b { display: block; font-size: 11px; font-weight: 520; }
.layer-grid span { display: block; min-height: 48px; margin: 8px 0; color: #6f899f; font-size: 8px; line-height: 1.55; }
.layer-grid small { color: var(--green); font-size: 7px; letter-spacing: .13em; }
footer { min-height: 52px; border-top: 1px solid var(--line); border-bottom: 0; color: #405b73; font-size: 8px; letter-spacing: .15em; }

@media (max-width: 1050px) {
  .hero-grid, .lower-grid, .intelligence-grid { grid-template-columns: 1fr; }
  .right-column { grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .layer-grid { grid-template-columns: repeat(3, 1fr); }
  .layer-grid article:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  .layer-grid article:nth-child(n+5) { border-top: 1px solid var(--line); }
}
@media (max-width: 680px) {
  .topbar { min-height: 62px; }
  .brand small, .runtime-state small { display: none; }
  main { width: min(100% - 20px, 1500px); margin-top: 10px; }
  .maintenance-notice { width: calc(100% - 20px); grid-template-columns: auto 1fr; }
  .maintenance-notice small { display: none; }
  .right-column, .metric-grid { grid-template-columns: 1fr 1fr; }
  .graph-stage { height: 390px; }
  .graph-core { width: 128px; height: 128px; }
  .panel-meta { display: none; }
  .lower-grid { grid-template-columns: 1fr; }
  .knowledge-flow { grid-template-columns: 1fr; }
  .knowledge-flow article { min-height: 100px; }
  .knowledge-flow article + article { border-left: 0; border-top: 1px solid var(--line); }
  .knowledge-flow article:not(:last-child)::after { display: none; }
}
@media (max-width: 440px) {
  .right-column, .metric-grid { grid-template-columns: 1fr; }
  .graph-stage { height: 340px; }
  .graph-core { width: 112px; height: 112px; }
  .quality-grid, .brief-facts, .layer-grid { grid-template-columns: repeat(2, 1fr); }
  .brief-facts span:last-child { grid-column: 1 / -1; border-top: 1px solid var(--line); border-left: 0; }
  .layer-grid article:nth-child(odd) { border-left: 0; }
  .layer-grid article:nth-child(n+3) { border-top: 1px solid var(--line); }
  footer span:last-child { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
