:root {
  --bg: #070b10; --bg2: #0b1118; --card: #0e151e; --card2: #121b26; --ink: #e6edf3; --muted: #8b9bab; --dim: #4d5d6d;
  --line: #1c2733; --line2: #263443;
  --cyan: #22d3ee; --cyan-soft: rgba(34, 211, 238, .12); --amber: #fbbf24; --amber-soft: rgba(251, 191, 36, .12);
  --green: #34d399; --green-soft: rgba(52, 211, 153, .12); --violet: #a78bfa; --red: #f87171; --red-soft: rgba(248, 113, 113, .12);
  --accent: var(--cyan); --accent-soft: var(--cyan-soft); --warn: var(--amber); --warn-soft: var(--amber-soft);
  --bad: var(--red); --bad-soft: var(--red-soft); --chip: #16212d; --brand: var(--cyan);
  --radius: 12px; --mono: "JetBrains Mono", ui-monospace, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, system-ui, sans-serif;
  background-image: linear-gradient(var(--bg2) 1px, transparent 1px), linear-gradient(90deg, var(--bg2) 1px, transparent 1px);
  background-size: 32px 32px; background-attachment: fixed; }
[hidden] { display: none !important; }
a { color: var(--cyan); }
.mono { font-family: var(--mono); }
.dim { color: var(--dim); }
.muted { color: var(--muted); }
.err { color: var(--red); min-height: 1.5em; }
.eyebrow { color: var(--cyan); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login__box { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line2); border-radius: var(--radius);
  padding: 26px; display: grid; gap: 10px; box-shadow: 0 0 0 1px rgba(34,211,238,.05), 0 20px 60px rgba(0,0,0,.5); }
.login__box h1 { margin: 0; font-size: 1.5rem; }

.top { position: sticky; top: 0; z-index: 5; background: rgba(7, 11, 16, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 16px 0; }
.top__row, .tabs { max-width: 1180px; margin: 0 auto; }
.top__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.top__right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .06em; font-size: .92rem; }
.brand__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.pill { font-size: .72rem; padding: 4px 9px; border-radius: 99px; border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.pill--run { color: var(--cyan); border-color: var(--cyan); animation: glow 1.6s ease-in-out infinite; }
.pill--ok { color: var(--green); border-color: rgba(52,211,153,.4); }
.pill--off { color: var(--muted); }
.pill--bad { color: var(--red); border-color: rgba(248,113,113,.5); }
@keyframes glow { 50% { box-shadow: 0 0 14px rgba(34,211,238,.45); } }
.tabs { display: flex; gap: 2px; overflow-x: auto; margin-top: 8px; scrollbar-width: none; }
.tabs button { flex: none; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 600; font-size: .9rem;
  padding: 8px 10px 10px; border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--cyan); }
.n:not(:empty) { display: inline-block; min-width: 1.5em; padding: 0 6px; border-radius: 99px; background: var(--amber); color: #111;
  font: 700 .72rem/1.5em var(--mono); text-align: center; margin-left: 3px; }
.main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 40px; display: grid; gap: 14px; }
.main--queue { max-width: 760px; }
.foot { text-align: center; padding: 0 16px 32px; }

select, input, textarea { font: inherit; color: var(--ink); background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 9px 11px; width: 100%; }
select { width: auto; max-width: 46vw; padding: 6px 8px; font-size: .85rem; }
textarea { min-height: 9em; resize: vertical; line-height: 1.5; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
label { font-weight: 600; font-size: .88rem; }

.btn { font: inherit; font-weight: 600; font-size: .92rem; border-radius: 9px; padding: 9px 14px; border: 1px solid var(--line2); background: var(--card2);
  color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; }
.btn:hover { border-color: var(--dim); }
.btn--primary { background: var(--cyan); border-color: var(--cyan); color: #04212a; }
.btn--primary:hover { border-color: #fff; }
.btn--bad { color: var(--red); }
.btn:disabled { opacity: .5; cursor: wait; }
.link { background: none; border: 0; color: var(--muted); font: inherit; text-decoration: underline; cursor: pointer; padding: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.card__head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip { font: 500 .72rem/1.4 var(--mono); padding: 3px 8px; border-radius: 6px; background: var(--chip); color: var(--muted); }
.chip--ch { background: var(--cyan-soft); color: var(--cyan); }
.chip--link { background: var(--green-soft); color: var(--green); }
.chip--warn { background: var(--amber-soft); color: var(--amber); }
.card h2 { margin: 0; font-size: 1.05rem; line-height: 1.35; }
.why { margin: 0; color: var(--muted); font-size: .92rem; }
.target { display: block; padding: 10px 12px; border-radius: 9px; background: var(--chip); text-decoration: none; color: var(--ink); font-size: .92rem; overflow-wrap: anywhere; border: 1px solid var(--line2); }
.target small { display: block; color: var(--muted); }
.note { font-size: .87rem; padding: 10px 12px; border-radius: 9px; background: var(--amber-soft); color: var(--amber); }
.note--bad { background: var(--red-soft); color: var(--red); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions .btn--primary { flex: 1 1 140px; }
.count { font: .75rem var(--mono); color: var(--muted); text-align: right; }
.count--over { color: var(--red); font-weight: 700; }
.tweet { display: grid; gap: 4px; }
.tweet textarea { min-height: 6em; }
.reasons { display: flex; flex-wrap: wrap; gap: 6px; }
.reasons button { font: inherit; font-size: .84rem; padding: 6px 11px; border-radius: 99px; border: 1px solid var(--line2); background: var(--card2); color: var(--ink); cursor: pointer; }
.reasons button[aria-pressed="true"] { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.posted-box { display: grid; gap: 8px; }
.slides { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.slides canvas { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); display: block; }
.guide-frame { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
details summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.script { white-space: pre-wrap; font: .85rem/1.55 var(--mono); background: var(--bg2); border: 1px solid var(--line); border-radius: 9px; padding: 12px; margin: 0; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 1.1rem; margin-bottom: 6px; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font: 500 .72rem var(--mono); text-transform: uppercase; letter-spacing: .05em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--mono); }
.tablewrap { overflow-x: auto; }
.report { white-space: pre-wrap; font-size: .93rem; margin: 0; }
.done-row { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px;
  border-radius: 10px; font-size: .92rem; max-width: calc(100% - 32px); z-index: 20; display: flex; gap: 12px; align-items: center; }
.toast button { background: none; border: 0; color: var(--bg); text-decoration: underline; font: inherit; font-weight: 700; cursor: pointer; }

/* ---------- control room ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; text-align: left;
  color: inherit; font: inherit; }
button.stat { cursor: pointer; }
button.stat:hover { border-color: var(--line2); }
.stat__k { font: 500 .68rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.stat__v { font: 700 1.7rem/1.2 var(--mono); margin-top: 4px; }
.stat__s { font-size: .8rem; color: var(--muted); }
.stat--amber .stat__v { color: var(--amber); } .stat--cyan .stat__v { color: var(--cyan); } .stat--green .stat__v { color: var(--green); }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.panel__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel__h h2 { margin: 0; font: 700 .78rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.stack { display: grid; gap: 14px; min-width: 0; }

.hub { position: relative; }
.hub svg { width: 100%; height: auto; display: block; }
.hub .node { cursor: pointer; }
.hub .node:focus { outline: none; }
.hub .node:focus-visible .node__ring, .hub .node:hover .node__ring { stroke: #fff; }
.node__ring { fill: var(--card2); stroke-width: 2; transition: stroke .15s; }
.node__txt { font: 700 17px var(--mono); text-anchor: middle; dominant-baseline: central; }
.node__label { font: 600 13.5px Inter, sans-serif; fill: var(--ink); text-anchor: middle; }
.node__sub { font: 500 11px var(--mono); text-anchor: middle; }
.node--sel .node__ring { stroke-width: 3.5; filter: drop-shadow(0 0 8px currentColor); }
.wire { fill: none; stroke-width: 2; }
.wire--auto { stroke: var(--cyan); stroke-dasharray: 7 9; animation: flow 1.1s linear infinite; }
.wire--assist { stroke: var(--amber); stroke-dasharray: 7 9; animation: flow 2.2s linear infinite; opacity: .85; }
.wire--off, .wire--planned { stroke: var(--line2); stroke-dasharray: 2 7; }
@keyframes flow { to { stroke-dashoffset: -32; } }
.c-auto { color: var(--cyan); stroke: var(--cyan); } .c-assist { color: var(--amber); stroke: var(--amber); }
.c-off, .c-planned { color: var(--dim); stroke: var(--line2); }
.core__ring { fill: #0a1a22; stroke: var(--cyan); stroke-width: 2.5; }
.core__pulse { fill: none; stroke: var(--cyan); stroke-width: 2; opacity: 0; }
.core--run .core__pulse { animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { r: 80; opacity: .6; } 100% { r: 130; opacity: 0; } }
.core__name { font: 800 24px Inter, sans-serif; fill: var(--ink); text-anchor: middle; }
.core__sub { font: 500 12px var(--mono); fill: var(--cyan); text-anchor: middle; }
.badge { fill: var(--amber); } .badge__t { font: 700 12px var(--mono); fill: #111; text-anchor: middle; dominant-baseline: central; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font: .74rem var(--mono); color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 22px; height: 0; border-top: 2px dashed; vertical-align: middle; margin-right: 6px; }

.agent { display: grid; gap: 10px; }
.agent__state { display: flex; align-items: center; gap: 10px; font: 600 .95rem var(--mono); }
.led { width: 11px; height: 11px; border-radius: 50%; background: var(--dim); flex: none; }
.led--run { background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: blink 1s infinite; }
.led--ok { background: var(--green); box-shadow: 0 0 8px var(--green); }
.led--bad { background: var(--red); box-shadow: 0 0 8px var(--red); }
@keyframes blink { 50% { opacity: .35; } }
.agent__task { font: .85rem/1.5 var(--mono); color: var(--cyan); background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .85rem; }
.kv dt { color: var(--muted); font-family: var(--mono); font-size: .76rem; padding-top: 2px; }
.kv dd { margin: 0; }

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.lane { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-width: 0; display: grid; gap: 6px; align-content: start; }
.lane__h { font: 700 .72rem var(--mono); text-transform: uppercase; letter-spacing: .07em; display: flex; justify-content: space-between; }
.lane--pend .lane__h { color: var(--amber); } .lane--prog .lane__h { color: var(--cyan); } .lane--done .lane__h { color: var(--green); }
.task { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--dim); border-radius: 7px; padding: 7px 9px; font-size: .83rem;
  line-height: 1.35; overflow-wrap: anywhere; text-align: left; color: inherit; font-family: inherit; width: 100%; }
button.task { cursor: pointer; }
.task small { display: block; font: .68rem var(--mono); color: var(--muted); margin-bottom: 2px; text-transform: uppercase; }
.lane--pend .task { border-left-color: var(--amber); } .lane--prog .task { border-left-color: var(--cyan); } .lane--done .task { border-left-color: var(--green); }
.lane__empty { font-size: .8rem; color: var(--dim); font-family: var(--mono); }

.detail { display: grid; gap: 12px; }
.detail__top { display: flex; align-items: center; gap: 12px; }
.detail__icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font: 700 1rem var(--mono); border: 2px solid currentColor; flex: none; }
.detail h3 { margin: 0; font-size: 1.1rem; }
.lvl { font: 700 .68rem var(--mono); text-transform: uppercase; letter-spacing: .06em; padding: 3px 7px; border-radius: 5px; }
.lvl--auto { background: var(--cyan-soft); color: var(--cyan); } .lvl--assist { background: var(--amber-soft); color: var(--amber); }
.lvl--off, .lvl--planned { background: var(--chip); color: var(--muted); }
.minis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mini { background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; }
.mini b { display: block; font: 700 1.1rem var(--mono); } .mini span { font: .66rem var(--mono); color: var(--muted); text-transform: uppercase; }
.ctl { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.ctl__l { font-size: .88rem; } .ctl__l small { display: block; color: var(--muted); font-size: .78rem; }
.switch { position: relative; width: 50px; height: 28px; border-radius: 99px; border: 1px solid var(--line2); background: var(--bg2); cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--dim); transition: .15s; }
.switch[aria-checked="true"] { background: var(--cyan-soft); border-color: var(--cyan); }
.switch[aria-checked="true"]::after { left: 25px; background: var(--cyan); }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line2); background: var(--card2); color: var(--ink); font: 700 1rem var(--mono); cursor: pointer; }
.stepper output { min-width: 28px; text-align: center; font: 700 1rem var(--mono); }
.checklist { margin: 0; padding-left: 18px; font-size: .86rem; color: var(--muted); }

.auto-map { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.am { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--bg2); min-width: 0; }
.am h3 { margin: 0 0 4px; font: 700 .78rem var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.am p { margin: 0 0 8px; font-size: .82rem; color: var(--muted); }
.am ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.am li { font-size: .85rem; line-height: 1.4; }
.am li b { display: block; }
.am li span { color: var(--muted); font-size: .8rem; }
.am--auto { border-top: 3px solid var(--cyan); } .am--auto h3 { color: var(--cyan); }
.am--assist { border-top: 3px solid var(--amber); } .am--assist h3 { color: var(--amber); }
.am--never { border-top: 3px solid var(--red); } .am--never h3 { color: var(--red); }

.log { font: .78rem/1.55 var(--mono); max-height: 300px; overflow-y: auto; display: grid; gap: 3px; }
.log div { display: grid; grid-template-columns: 82px 58px 1fr; gap: 8px; }
.log time { color: var(--dim); } .log .k { text-transform: uppercase; }
.k--agent { color: var(--cyan); } .k--you { color: var(--violet); } .k--auto { color: var(--green); } .k--error { color: var(--red); }
.cmdrow { display: flex; flex-wrap: wrap; gap: 8px; }
.cmdrow .btn { flex: 1 1 auto; font-size: .85rem; min-height: 38px; padding: 7px 10px; }

@media (max-width: 900px) {
  .grid2 { grid-template-columns: minmax(0, 1fr); }
  .auto-map { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board { grid-template-columns: minmax(0, 1fr); }
  .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .log div { grid-template-columns: 70px 1fr; } .log .k { display: none; }
  .stat__v { font-size: 1.4rem; }
}
@media (prefers-reduced-motion: reduce) { .wire, .led--run, .pill--run, .core__pulse { animation: none !important; } }

/* ---------- connect ---------- */
.btn--sm { min-height: 34px; padding: 5px 11px; font-size: .84rem; justify-self: start; }
.note--info { background: var(--cyan-soft); color: var(--cyan); }
.bar { height: 6px; border-radius: 99px; background: var(--bg2); border: 1px solid var(--line); overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); border-radius: 99px; transition: width .3s; }
.bar--sm { height: 4px; margin-top: 6px; display: block; }
.cx-intro .why { margin-top: 10px; }
.cx { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 14px; align-items: start; }
.cx-list { display: grid; gap: 8px; position: sticky; top: 112px; }
.cx-card { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; width: 100%;
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--line2); border-radius: 10px; padding: 10px 12px; color: var(--ink); font: inherit; cursor: pointer; }
.cx-card:hover { border-color: var(--line2); }
.cx-card--sel { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.cx--ok { border-left-color: var(--green); } .cx--prog { border-left-color: var(--amber); } .cx--bad { border-left-color: var(--red); }
.cx-ico { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--bg2); border: 1px solid var(--line2); font-weight: 700; font-size: .85rem; }
.cx--ok .cx-ico { color: var(--green); border-color: var(--green); }
.cx-mid { min-width: 0; } .cx-mid b { display: block; font-size: .92rem; } .cx-mid small { color: var(--muted); font: .72rem var(--mono); }
.flow { display: grid; gap: 12px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; counter-reset: s; }
.step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); position: relative; }
.step__n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line2); color: var(--muted); font-size: .82rem; font-weight: 700; background: var(--bg2); }
.step--done .step__n { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.step--next .step__n { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 10px rgba(251,191,36,.35); }
.step--done .step__t { color: var(--muted); }
.step__b { display: grid; gap: 8px; min-width: 0; }
.step__t { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copyrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 8px; align-items: center; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.copyrow small { grid-column: 1 / -1; font: .68rem var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.copyrow code { font: .82rem/1.45 var(--mono); color: var(--ink); overflow-wrap: anywhere; }
.inrow { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inrow input { flex: 1 1 200px; width: auto; }
.inrow code { font-size: .8rem; color: var(--green); }
.tick { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; cursor: pointer; justify-self: start; }
.tick input { width: 20px; height: 20px; accent-color: var(--green); }
.connected { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
@media (max-width: 900px) { .cx { grid-template-columns: minmax(0, 1fr); } .cx-list { position: static; } }
