:root {
  --bg: #070b0a;
  --bg-2: #0b1210;
  --panel: #0d1512;
  --panel-2: #101b17;
  --line: #1b2b25;
  --line-2: #28443a;
  --ink: #e7f2ed;
  --muted: #7e9a8d;
  --muted-2: #547064;
  --green: #3ee08a;
  --green-2: #1fbf6d;
  --green-soft: rgba(62, 224, 138, .10);
  --amber: #f1b45a;
  --red: #ff6b6b;
  --radius: 14px;
  --radius-sm: 9px;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: radial-gradient(1100px 600px at 22% -10%, #0e2119 0%, transparent 58%), var(--bg);
  color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.app { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; padding: 18px 14px;
  border-right: 1px solid var(--line); background: rgba(7, 12, 10, .82);
  backdrop-filter: blur(12px); display: flex; flex-direction: column; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 10px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--green); color: #06100b; display: grid; place-items: center; }
.brand-mark svg { width: 21px; height: 21px; }
.brand strong { display: block; font-size: 14px; letter-spacing: .16em; }
.brand span { display: block; font-size: 11px; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  width: 100%; text-align: left; border: 1px solid transparent; background: transparent; color: var(--muted);
  padding: 9px 10px; border-radius: 9px; display: flex; align-items: center; gap: 9px;
  transition: .16s ease;
}
.nav-item:hover { color: var(--ink); background: rgba(255,255,255,.025); }
.nav-item.active { color: var(--green); background: var(--green-soft); border-color: rgba(62,224,138,.18); }
.nav-ico { width: 16px; text-align: center; font-size: 15px; }
.count { margin-left: auto; font: 11px var(--mono); color: var(--muted-2); background: #0a110e; border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
.rail-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.anc-card { border: 1px solid var(--line); background: linear-gradient(180deg, #0c1511, #09100d); border-radius: 12px; padding: 11px; }
.anc-top { display: flex; align-items: center; gap: 7px; font: 10px var(--mono); letter-spacing: .1em; color: var(--muted); }
.anc-card p { margin: 7px 0 9px; font-size: 11px; color: var(--muted-2); }
.anc-meta { display: flex; justify-content: space-between; font: 10px var(--mono); color: var(--muted-2); }
.badge { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 7px; font: 10px var(--mono); letter-spacing: .06em; color: var(--muted); white-space: nowrap; }
.badge.live { color: var(--green); border-color: rgba(62,224,138,.28); background: rgba(62,224,138,.06); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(62,224,138,.5); animation: pulse 2.2s infinite; }
.operator { display: flex; align-items: center; gap: 9px; padding: 8px 4px 0; border-top: 1px solid var(--line); }
.avatar { width: 31px; height: 31px; border-radius: 50%; display: grid; place-items: center; font: 11px var(--mono); color: var(--green); background: #0e1d16; border: 1px solid var(--line-2); }
.operator strong { display: block; font-size: 12px; }
.operator span { display: block; font-size: 10px; color: var(--muted-2); }
.icon-btn { margin-left: auto; width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: 7px; }
.icon-btn:hover { background: rgba(255,255,255,.05); color: var(--ink); }

.main { min-width: 0; padding: 0 26px 38px; }
.topbar { height: 62px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: rgba(7,11,10,.86); backdrop-filter: blur(10px); z-index: 5; }
.crumbs { font: 11px var(--mono); color: var(--muted-2); letter-spacing: .04em; }
.crumbs strong { color: var(--muted); font-weight: 500; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.engine-pill { display: inline-flex; align-items: center; gap: 6px; font: 10px var(--mono); color: var(--muted); border: 1px solid var(--line); padding: 5px 8px; border-radius: 999px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.dot.amber { background: var(--amber); }
.btn { border: 1px solid var(--line-2); background: #0c1411; color: var(--ink); border-radius: 9px; padding: 8px 12px; transition: .15s ease; }
.btn:hover { border-color: #3f6d5b; background: #101c17; }
.btn.primary { background: var(--green); color: #04120a; border-color: var(--green); font-weight: 650; }
.btn.primary:hover { background: #6af0a8; border-color: #6af0a8; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { padding: 5px 9px; font-size: 11px; }
.view { display: none; animation: fade .22s ease; }
.view.active { display: block; }
.hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 36px 4px 26px; min-height: 255px; }
.eyebrow { font: 10px var(--mono); letter-spacing: .13em; color: var(--green-2); text-transform: uppercase; }
h1 { font-size: clamp(34px, 4vw, 58px); line-height: .98; letter-spacing: -.035em; margin: 12px 0 14px; font-weight: 580; }
h1 em { color: var(--green); font-style: normal; }
.lede { max-width: 580px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.lede.small { font-size: 13px; }
.hero-orb { position: relative; width: 190px; height: 190px; display: grid; place-items: center; flex: 0 0 190px; }
.orb-ring { position: absolute; inset: 9px; border: 1px solid rgba(62,224,138,.25); border-radius: 50%; animation: spin 18s linear infinite; }
.orb-ring:before, .orb-ring:after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--green); top: 8px; left: 50%; box-shadow: 0 0 18px var(--green); }
.orb-ring:after { top: auto; bottom: 8px; left: 28%; background: #9df5c4; }
.orb-ring.r2 { inset: 28px; border-style: dashed; border-color: rgba(62,224,138,.16); animation-direction: reverse; animation-duration: 26s; }
.orb-core { width: 92px; height: 92px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #a3ffd0, #2ecb7a 42%, #0a3a23 100%); color: #03130a; display: grid; place-items: center; font: 22px var(--mono); font-weight: 700; letter-spacing: -.06em; box-shadow: 0 0 45px rgba(62,224,138,.35), inset 0 0 16px rgba(255,255,255,.35); }
.orb-label { position: absolute; bottom: -2px; font: 9px var(--mono); letter-spacing: .16em; color: var(--muted-2); }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.metric { border: 1px solid var(--line); background: linear-gradient(180deg, #0c1511, #0a100e); border-radius: 12px; padding: 13px 14px; }
.metric span { display: block; font: 10px var(--mono); letter-spacing: .08em; color: var(--muted-2); text-transform: uppercase; }
.metric strong { display: block; font-size: 24px; font-weight: 560; margin: 5px 0 3px; letter-spacing: -.03em; }
.metric strong sup { font: 10px var(--mono); color: var(--muted); margin-left: 2px; }
.metric small { color: var(--muted-2); font-size: 10px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 14px; margin-bottom: 14px; }
.panel { border: 1px solid var(--line); background: linear-gradient(180deg, rgba(15,25,20,.86), rgba(10,16,13,.9)); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 3px 0 0; font-size: 14px; font-weight: 580; letter-spacing: -.01em; }
.network-panel { min-height: 366px; display: flex; flex-direction: column; }
.network { position: relative; flex: 1; min-height: 300px; overflow: hidden; }
.network svg { width: 100%; height: 100%; min-height: 300px; display: block; }
.network-foot { display: flex; justify-content: space-between; gap: 10px; padding: 10px 15px; border-top: 1px solid var(--line); font: 10px var(--mono); color: var(--muted-2); }
.network-foot span { display: inline-flex; align-items: center; gap: 6px; }
.console-panel { display: flex; flex-direction: column; min-height: 366px; }
.console-log { flex: 1; padding: 14px; overflow: auto; max-height: 245px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 8px; align-items: flex-start; }
.msg-avatar { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; flex: 0 0 22px; font: 10px var(--mono); color: var(--green); background: rgba(62,224,138,.1); border: 1px solid rgba(62,224,138,.18); }
.msg strong { display: block; font: 10px var(--mono); color: var(--muted); letter-spacing: .06em; margin-bottom: 3px; }
.msg p { margin: 0; color: #c5d8cf; font-size: 12px; line-height: 1.55; }
.msg.user .msg-avatar { color: var(--amber); background: rgba(241,180,90,.08); border-color: rgba(241,180,90,.2); }
.msg.system p { color: var(--muted-2); font-family: var(--mono); font-size: 10px; }
.composer { padding: 12px 14px 14px; border-top: 1px solid var(--line); }
textarea { width: 100%; resize: vertical; border: 1px solid var(--line); border-radius: 9px; background: #080f0c; color: var(--ink); padding: 10px 11px; outline: none; }
textarea:focus, input:focus { border-color: rgba(62,224,138,.55); box-shadow: 0 0 0 3px rgba(62,224,138,.08); }
.composer-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 9px; }
.hint { font: 9px var(--mono); color: var(--muted-2); }
.agents-panel { margin-bottom: 14px; }
.agent-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 14px; }
.agent-grid.full { padding: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.agent-card { border: 1px solid var(--line); border-radius: 11px; padding: 12px; background: #0a120f; transition: .16s ease; min-width: 0; cursor: pointer; }
.agent-card:hover { border-color: rgba(62,224,138,.35); transform: translateY(-1px); background: #0d1712; }
.agent-card.selected { border-color: var(--green); box-shadow: 0 0 0 1px rgba(62,224,138,.18); }
.agent-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.agent-icon { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; font: 12px var(--mono); color: var(--green); background: var(--green-soft); border: 1px solid rgba(62,224,138,.16); }
.agent-name { margin: 8px 0 2px; font-size: 12px; font-weight: 600; }
.agent-role { margin: 0; color: var(--muted-2); font: 10px var(--mono); line-height: 1.4; }
.agent-tools { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.tool { font: 9px var(--mono); color: var(--muted); background: #0c1511; border: 1px solid var(--line); padding: 2px 5px; border-radius: 4px; }
.agent-status { display: flex; justify-content: space-between; align-items: center; margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line); font: 9px var(--mono); color: var(--muted-2); }
.agent-status .online { color: var(--green); }
.agent-status .standby { color: var(--amber); }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; padding: 28px 2px 18px; }
.section-head h1 { font-size: 32px; margin: 6px 0 6px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.event-list { padding: 8px 14px 14px; max-height: 280px; overflow: auto; }
.event { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font: 10px var(--mono); color: var(--muted); }
.event:last-child { border-bottom: 0; }
.event time { color: var(--muted-2); }
.event strong { color: #c7dacf; font-weight: 500; }
.event .ok { color: var(--green); }
.connector-detail { padding: 12px 15px; display: flex; flex-direction: column; gap: 11px; }
.connector-detail div { display: flex; justify-content: space-between; gap: 14px; font: 10px var(--mono); color: var(--muted); }
.connector-detail span { color: var(--muted-2); }
.connector-detail code { color: #c7dacf; font: 10px var(--mono); overflow: hidden; text-overflow: ellipsis; }
.task-list { padding: 10px 15px 15px; }
.empty { color: var(--muted-2); font: 11px var(--mono); padding: 26px 4px; }
.task-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.task-row:last-child { border-bottom: 0; }
.task-row strong { font-size: 12px; font-weight: 550; }
.task-row p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.task-row time { color: var(--muted-2); font: 9px var(--mono); }
.telemetry-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.telemetry-card { padding: 18px; }
.telemetry-card strong { display: block; font-size: 24px; margin: 7px 0 4px; }
.telemetry-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.modal { border: 1px solid var(--line-2); background: #0b130f; color: var(--ink); border-radius: 14px; padding: 0; width: min(480px, calc(100vw - 30px)); box-shadow: 0 24px 80px rgba(0,0,0,.55); }
.modal.wide { width: min(760px, calc(100vw - 30px)); }
.modal::backdrop { background: rgba(0,0,0,.7); backdrop-filter: blur(4px); }
.modal form { padding: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 5px 0 0; font-size: 18px; }
.modal label { display: flex; flex-direction: column; gap: 5px; margin-bottom: 11px; color: var(--muted); font-size: 11px; }
.label-hint { color: var(--muted-2); font: 9px var(--mono); }
.modal input { background: #080f0c; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); padding: 9px 10px; outline: none; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.modal-note { color: var(--muted); font-size: 11px; line-height: 1.6; padding: 0 18px 17px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translate(-50%, 20px); background: #10221a; border: 1px solid rgba(62,224,138,.35); color: var(--ink); padding: 10px 14px; border-radius: 9px; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s ease; z-index: 20; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.network-node { cursor: pointer; }
.network-node text { font-family: var(--mono); fill: var(--muted); font-size: 8px; letter-spacing: .04em; }
.network-node circle { transition: .16s ease; }
.network-node:hover circle { filter: brightness(1.3); }
@media (max-width: 1050px) {
  .app { grid-template-columns: 74px minmax(0,1fr); }
  .rail { padding: 14px 9px; }
  .brand div:not(.brand-mark), .nav-item span:not(.nav-ico):not(.count), .rail-foot .operator div, .anc-card { display: none; }
  .nav-item { justify-content: center; }
  .count { display: none; }
  .operator { justify-content: center; }
  .agent-grid, .agent-grid.full { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 850px) {
  .main { padding: 0 14px 28px; }
  .hero { padding-top: 24px; min-height: auto; }
  .hero-orb { width: 120px; height: 120px; flex-basis: 120px; }
  .orb-core { width: 64px; height: 64px; font-size: 15px; }
  .metrics, .grid-main, .two-col, .telemetry-grid { grid-template-columns: 1fr; }
  .agent-grid, .agent-grid.full { grid-template-columns: 1fr; }
  .engine-pill { display: none; }
  .top-actions .btn.ghost { display: none; }
}
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(62,224,138,.45); } 70% { box-shadow: 0 0 0 8px rgba(62,224,138,0); } 100% { box-shadow: 0 0 0 0 rgba(62,224,138,0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
