:root {
  color-scheme: dark;
  /* daniotech.com "matrix" palette */
  --bg: #050807;
  --bg2: #080c0a;
  --card: #0b100e;
  --card2: #0e1412;
  --line: #18221d;
  --line2: #26332c;
  --grid: rgba(57, 255, 20, .055);
  --text: #e6f1ea;
  --text2: #9cada4;
  --muted: #5e6f68;
  --accent: #39ff14;
  --accent2: #00ffa3;
  --run: #5cc8ff;
  --good: #3fd06a;
  --warn: #e3b341;
  --bad: #ff5c57;
  --idle: #5e6f68;
  --tool: #ff5c57;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 13px/1.5 var(--mono); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid var(--line); }
.brand b { letter-spacing: .12em; font-size: 13px; display: block; }
.brand small { color: var(--muted); font-size: 10px; letter-spacing: .1em; }
.logo svg { width: 22px; height: 22px; fill: none; stroke: var(--bad); stroke-width: 2.2; }
nav { padding: 8px 8px; overflow: auto; flex: 1; }
nav .grp { color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; margin: 14px 8px 6px; }
nav a { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 6px; color: var(--text2); border: 1px solid transparent; }
nav a i { font-style: normal; width: 16px; text-align: center; color: var(--muted); }
nav a:hover { background: var(--card); color: var(--text); }
nav a.on { background: var(--card2); border-color: var(--line2); color: var(--text); }
nav a.on i { color: var(--accent); }
.foot { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); flex: none; }
.dot.warn { background: var(--warn); box-shadow: 0 0 8px var(--warn); }
.dot.bad { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.dot.idle { background: var(--idle); box-shadow: none; }

main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: rgba(7, 11, 20, .85); backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; }
.crumbs { color: var(--muted); }
.crumbs b { color: var(--text); font-weight: 500; }
.spacer { flex: 1; }
.upd { color: var(--muted); font-size: 11px; }
.menu { display: none; background: none; border: 1px solid var(--line2); border-radius: 6px; padding: 2px 8px; }
#view { padding: 22px 24px 60px; }

.h-kicker { color: var(--muted); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; }
.h-title { font-size: 26px; font-weight: 800; letter-spacing: .06em; margin: 2px 0 18px; text-transform: uppercase; }
.sub { color: var(--text2); margin: -10px 0 18px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.kpi .l { color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.kpi .v { font-size: 26px; font-weight: 700; margin-top: 4px; }
.kpi .s { color: var(--text2); font-size: 11px; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-width: 0; }
.card h3 { margin: 0 0 12px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--text2); display: flex; align-items: center; gap: 8px; }
.card h3 .r { margin-left: auto; color: var(--muted); font-weight: 400; letter-spacing: 0; text-transform: none; }

.sites { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.site { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; position: relative; overflow: hidden; cursor: pointer; transition: border-color .2s, transform .2s; }
.site:hover { border-color: var(--line2); transform: translateY(-1px); }
.site::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--c); }
.site .nm { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.site .dm { color: var(--muted); font-size: 11px; }
.site .big { font-size: 22px; font-weight: 700; margin-top: 8px; }
.site .big small { font-size: 11px; color: var(--muted); font-weight: 400; }
.site .meta { color: var(--text2); font-size: 11px; margin-top: 2px; min-height: 17px; }
.site .agents { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 10px; }
.chip { font-size: 10px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line2); color: var(--text2); display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.chip .dot { width: 6px; height: 6px; box-shadow: none; }
.spark { width: 100%; height: 38px; margin-top: 8px; display: block; }

.feed { list-style: none; margin: 0; padding: 0; max-height: 640px; overflow: auto; }
.feed li { display: grid; grid-template-columns: 54px 10px minmax(0, 1fr); gap: 8px; padding: 7px 2px; border-bottom: 1px dashed var(--line); align-items: start; }
.feed li.new { animation: flash 1.6s ease-out; }
@keyframes flash { from { background: rgba(57, 255, 20, .12); } to { background: transparent; } }
.feed time { color: var(--muted); font-size: 11px; }
.feed .sw { width: 8px; height: 8px; border-radius: 2px; margin-top: 5px; background: var(--c, var(--muted)); }
.feed .who { color: var(--text2); font-size: 11px; }
.feed .msg { word-break: break-word; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.feed .lvl-error .msg { color: #ffb4ae; }
.feed .lvl-warn .msg { color: #f2cc60; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.filters button { background: var(--card); border: 1px solid var(--line2); border-radius: 999px; padding: 4px 10px; font-size: 11px; color: var(--text2); display: inline-flex; gap: 6px; align-items: center; }
.filters button.on { border-color: var(--accent); color: var(--text); }
.filters button .sw { width: 8px; height: 8px; border-radius: 2px; background: var(--c); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; font-weight: 500; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--card2); }
.tbl-wrap { overflow-x: auto; }
.st { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.st .dot { width: 7px; height: 7px; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.tag { font-size: 10px; border: 1px solid var(--line2); border-radius: 4px; padding: 1px 6px; color: var(--text2); white-space: nowrap; }
.tag.auto { border-color: #2f6f43; color: #7ee2a0; }
.tag.assist { border-color: #6e5a1e; color: #f2cc60; }
.tag.human { border-color: #6b2f2f; color: #ffb4ae; }

/* engine */
.engine-head { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: end; margin-bottom: 14px; }
.dump { border: 1px solid var(--line2); border-radius: 8px; padding: 10px 14px; color: var(--muted); background: var(--bg2); }
.dump b { color: var(--text2); font-weight: 400; }
.toggles { display: flex; gap: 6px; margin-bottom: 10px; }
.toggles button { background: var(--card); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 10px; font-size: 11px; color: var(--text2); }
.toggles button.on { color: var(--text); border-color: var(--text2); }
.stage { position: relative; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; background:
  radial-gradient(ellipse at 50% 55%, var(--glow, rgba(57, 255, 20, .07)), transparent 60%),
  linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 40px 40px,
  linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 40px 40px, #030504; transition: background .5s; }
.stage svg { display: block; width: 100%; height: min(72vh, 760px); }
.stage .title { position: absolute; top: 14px; left: 0; right: 0; text-align: center; font-weight: 800; letter-spacing: .12em; font-size: 18px; pointer-events: none; }
.stage .tl { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; }
.stage .tl button, .pill button { background: rgba(13, 20, 36, .9); border: 1px solid var(--line2); border-radius: 6px; padding: 3px 10px; font-size: 11px; }
.pill { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; align-items: center; background: rgba(13, 20, 36, .9); border: 1px solid var(--line2); border-radius: 999px; padding: 4px 6px; }
.pill span { min-width: 120px; text-align: center; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.pill button { border-radius: 999px; border: none; }
.legend { position: absolute; right: 12px; top: 12px; background: rgba(13, 20, 36, .9); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font-size: 10px; color: var(--text2); display: grid; gap: 4px; }
.legend span { display: flex; gap: 6px; align-items: center; }

svg text { font-family: var(--mono); fill: var(--text2); }
.n-dept text { font-size: 13px; font-weight: 700; }
.n-hit { cursor: pointer; }
.n-hit:hover .ring { stroke-width: 3; filter: drop-shadow(0 0 6px currentColor); }
.flow { stroke-dasharray: 3 5; animation: flow 1.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -16; } }
.pulse { animation: pulse 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { 50% { opacity: .35; } }
.spin { animation: spin 120s linear infinite; transform-origin: 500px 380px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .flow, .pulse, .spin, .feed li.new { animation: none; } }

/* panel */
.panel { position: fixed; top: 0; right: 0; height: 100vh; width: min(440px, 100vw); background: rgba(11, 17, 32, .97); border-left: 1px solid var(--line2); transform: translateX(100%); transition: transform .25s; z-index: 20; overflow: auto; padding: 16px 18px 40px; box-shadow: -20px 0 40px rgba(0, 0, 0, .4); }
.panel.open { transform: none; }
.panel .bar { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 11px; letter-spacing: .1em; margin-bottom: 12px; }
.panel .bar button { background: none; border: none; color: var(--text2); font-size: 16px; }
.panel h2 { font-size: 16px; margin: 0; }
.panel .sec { margin-top: 18px; }
.panel .sec > .k { color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.box { border: 1px solid var(--line2); border-radius: 6px; padding: 10px 12px; background: var(--bg2); }
.ladder { display: grid; gap: 8px; }
.ladder div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 4px 0 4px 10px; border-left: 2px solid var(--line2); color: var(--muted); font-size: 12px; }
.ladder div.cur { border-left-color: var(--text); color: var(--text); font-weight: 700; }
.ladder b { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.sop { margin: 0; padding: 0; list-style: none; counter-reset: s; }
.sop li { counter-increment: s; display: grid; grid-template-columns: 24px 1fr; padding: 3px 0; }
.sop li::before { content: counter(s, decimal-leading-zero); color: var(--muted); }
.log { font-size: 11px; color: var(--text2); display: grid; gap: 4px; }
.log div { display: grid; grid-template-columns: 48px 1fr; gap: 8px; }
.log .err { color: #ffb4ae; }
.donecard { display: flex; align-items: center; gap: 10px; }
.donecard .ic { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--text); display: grid; place-items: center; font-size: 13px; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.facts div { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.facts .l { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }

.bars { display: grid; gap: 6px; }
.bars .row { display: grid; grid-template-columns: 110px 1fr 60px; gap: 8px; align-items: center; font-size: 11px; }
.bars .trk { height: 8px; background: var(--bg2); border-radius: 4px; overflow: hidden; }
.bars .fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--c); }

.tip { position: fixed; pointer-events: none; background: #0b100e; border: 1px solid var(--line2); border-radius: 6px; padding: 6px 8px; font-size: 11px; z-index: 40; display: none; max-width: 280px; }

@media (max-width: 1100px) { .grid2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; width: 240px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu { display: inline-block; }
  #view { padding: 16px 16px 60px; }
  .top { padding: 10px 16px; }
  .engine-head { grid-template-columns: 1fr; }
  .stage svg { height: 70vh; }
  .legend { display: none; }
}

/* sign-in pages */
body.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; background:
  radial-gradient(ellipse at 50% 40%, rgba(57, 255, 20, .07), transparent 60%),
  linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 40px 40px,
  linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 40px 40px, var(--bg); }
.auth-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--line2); border-radius: 12px; padding: 28px; }
.auth-card h1 { font-size: 22px; letter-spacing: .08em; text-transform: uppercase; margin: 22px 0 6px; }
.btn { width: 100%; margin-top: 16px; padding: 11px 14px; border-radius: 8px; border: 1px solid var(--accent); background: rgba(57, 255, 20, .1); color: var(--text); font-weight: 700; letter-spacing: .04em; }
.btn:hover:not(:disabled) { background: rgba(57, 255, 20, .2); }
.btn:disabled { opacity: .5; cursor: default; }
#msg { min-height: 20px; font-size: 12px; margin: 12px 0 0; }
#msg.ok { color: #7ee2a0; } #msg.warn { color: #f2cc60; } #msg.err { color: #ffb4ae; }
#msg a { color: var(--accent); text-decoration: underline; }
.logout { margin-left: auto; background: none; border: 1px solid var(--line2); border-radius: 6px; padding: 1px 8px; font-size: 10px; color: var(--muted); }
.logout:hover { color: var(--text); }

/* local agent */
.dot.runc { background: var(--run); box-shadow: 0 0 10px var(--run); animation: pulse 1.4s ease-in-out infinite; }
.navdot { margin-left: auto; width: 7px; height: 7px; }
.mute { background: none; border: 1px solid var(--line2); border-radius: 6px; padding: 2px 8px; font-size: 13px; }
.hero-agent .ha-top { display: flex; gap: 14px; align-items: center; }
.hero-agent .ha-top > .dot { width: 14px; height: 14px; }
.ha-state { font-size: 20px; font-weight: 800; letter-spacing: .02em; }
.hero-agent.state-running { border-color: rgba(57, 255, 20, .45); }
.hero-agent.state-limited { border-color: rgba(210, 153, 34, .6); }
.hero-agent.state-offline { border-color: rgba(248, 81, 73, .45); }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.b { background: var(--card2); border: 1px solid var(--line2); border-radius: 7px; padding: 6px 12px; font-size: 12px; color: var(--text); }
.b:hover:not(:disabled) { border-color: var(--text2); }
.b:disabled { opacity: .4; cursor: default; }
.b.primary { border-color: var(--accent); background: rgba(57, 255, 20, .12); font-weight: 700; }
.b.danger { border-color: #8b2f2f; color: #ffb4ae; }
.b.sm { padding: 2px 8px; font-size: 10px; }
.cmd { background: #030504; border: 1px solid var(--line2); border-radius: 6px; padding: 8px 10px; margin: 6px 0; color: #7ee2a0; }
.err-box { border-color: #6b2f2f; color: #ffb4ae; }
.warn-box { border-color: #6e5a1e; color: #f2cc60; margin-bottom: 10px; }
.meter { margin-top: 12px; }
.meter .ml { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; margin-bottom: 5px; flex-wrap: wrap; }
.meter .trk { height: 10px; background: var(--bg2); border-radius: 5px; overflow: hidden; border: 1px solid var(--line); }
.meter .fill { height: 100%; background: var(--accent); border-radius: 0 5px 5px 0; transition: width .6s; }
.meter.warn .fill { background: var(--warn); } .meter.bad .fill { background: var(--bad); }
.meter.warn b { color: #f2cc60; } .meter.bad b { color: #ffb4ae; }
.livelog { background: #030504; border: 1px solid var(--line); border-radius: 8px; padding: 10px; height: 280px; overflow: auto; font-size: 11px; line-height: 1.6; color: var(--text2); }
.livelog div { white-space: pre-wrap; word-break: break-word; }
.jobform { display: grid; gap: 8px; }
.jobform select, .jobform textarea, .composer textarea, .steer textarea { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 7px; color: var(--text); font: inherit; padding: 8px 10px; }
.jobform textarea, .steer textarea { resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chk { display: inline-flex; gap: 6px; align-items: center; color: var(--text2); font-size: 12px; cursor: pointer; }
.jt { font-size: 10px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line2); white-space: nowrap; }
.jt-running { border-color: var(--run); color: var(--run); } .jt-done { border-color: #2f6f43; color: #7ee2a0; }
.jt-failed { border-color: #6b2f2f; color: #ffb4ae; } .jt-queued { border-color: #6e5a1e; color: #f2cc60; } .jt-cancelled { color: var(--muted); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 560px; }
.md pre, .bubble pre { background: #030504; padding: 8px; border-radius: 6px; overflow: auto; white-space: pre-wrap; }
.md code, .bubble code { background: #030504; padding: 1px 4px; border-radius: 4px; }
.checks { margin: 0; padding-left: 4px; list-style: none; display: grid; gap: 7px; font-size: 12px; color: var(--text2); }
.clickable { cursor: pointer; }

/* session view */
.sess { margin-top: 12px; background: #030504; border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 46vh; overflow: auto; font-size: 12px; display: grid; gap: 6px; }
.tx { word-break: break-word; line-height: 1.55; }
.tx-at { color: var(--muted); font-size: 10px; margin-right: 6px; }
.tx-user { border-left: 2px solid var(--accent); padding-left: 8px; }
.tx-tool { color: #7fd9a8; font-size: 11px; }
.tx-result { font-size: 11px; max-height: 70px; overflow: hidden; }
.tx-error { color: #ffb4ae; font-size: 11px; }
.tx-system { font-size: 10px; }
.steer textarea { margin-bottom: 0; }

/* talk */
.talk { display: flex; flex-direction: column; height: calc(100vh - 110px); max-width: 920px; margin: 0 auto; }
.talk-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.talk-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.chatlog { flex: 1; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; flex-direction: column; max-width: 82%; }
.msg.user { align-self: flex-end; align-items: flex-end; }
.msg .bubble { padding: 10px 13px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line2); line-height: 1.6; word-break: break-word; }
.msg.user .bubble { background: rgba(57, 255, 20, .10); border-color: rgba(57, 255, 20, .45); }
.msg.bad .bubble { border-color: #6b2f2f; }
.msg .meta { color: var(--muted); font-size: 10px; margin-top: 3px; }
.sysmsg { text-align: center; color: var(--muted); font-size: 11px; }
.empty { color: var(--muted); margin: auto; text-align: center; max-width: 460px; line-height: 1.7; }
.typing { display: inline-flex; gap: 4px; align-items: center; }
.typing > span:not(.small) { width: 6px; height: 6px; border-radius: 50%; background: var(--text2); animation: blink 1.2s infinite; }
.typing > span:nth-child(2) { animation-delay: .2s; } .typing > span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }
.composer { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.composer textarea { resize: none; min-height: 42px; max-height: 160px; }
.mic { width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line2); background: var(--card2); font-size: 18px; flex: none; }
.mic.on { border-color: var(--bad); background: rgba(248, 81, 73, .18); animation: pulse 1s infinite; }
.composer .b.primary { height: 42px; min-width: 48px; font-size: 16px; }
@media (max-width: 760px) { .row2 { grid-template-columns: 1fr; } .msg { max-width: 94%; } .talk { height: calc(100vh - 90px); } }
@media (prefers-reduced-motion: reduce) { .dot.runc, .mic.on, .typing > span { animation: none; } }

/* local agent tabs */
.strip { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 12px; }
.strip.state-running { border-color: rgba(57, 255, 20, .45); } .strip.state-limited { border-color: rgba(210, 153, 34, .6); } .strip.state-offline { border-color: rgba(248, 81, 73, .45); }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; align-items: flex-end; border-bottom: 1px solid var(--line2); margin-bottom: 16px; }
.tab { background: none; border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; padding: 7px 14px; color: var(--text2); font-size: 12px; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--text); background: var(--card); }
.tab.on { background: var(--card); border-color: var(--line2); color: var(--text); border-bottom: 1px solid var(--card); font-weight: 700; }
.tab .cnt { background: var(--accent); color: #031003; border-radius: 999px; padding: 0 6px; font-size: 10px; font-weight: 800; }
.tabsep { width: 1px; height: 22px; background: var(--line2); margin: 0 6px 6px; }
.stab { padding: 0; }
.stab button { background: none; border: none; color: inherit; font: inherit; padding: 7px 4px 7px 12px; display: inline-flex; gap: 6px; align-items: center; max-width: 220px; white-space: nowrap; overflow: hidden; }
.stab .dot { width: 7px; height: 7px; flex: none; }
.stab .x { padding: 7px 10px 7px 4px; color: var(--muted); font-size: 10px; }
.stab .x:hover { color: var(--bad); }
.mini { padding: 8px 4px; border-bottom: 1px dashed var(--line); }
.mini:hover { background: var(--card2); }
.skills { display: flex; flex-wrap: wrap; gap: 6px; }
.skills .tag { background: var(--bg2); font: inherit; font-size: 11px; }
.skills .tag:hover { border-color: var(--accent); color: var(--text); }
.sess-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.sess.big { max-height: 58vh; min-height: 300px; }
.talk.embed { height: calc(100vh - 290px); min-height: 420px; }
.sess { align-content: start; }
#sessionHost .sec, .tabbody .sec { margin-top: 16px; }
#sessionHost .sec > .k { color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 6px; }

/* VS Code-style conversation tabs */
.tab.plus { font-size: 15px; padding: 4px 12px; color: var(--accent); }
.convo { display: flex; flex-direction: column; height: calc(100vh - 290px); min-height: 460px; background: var(--card); border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.convo-log { flex: 1; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 10px; }
.turn-user { align-self: flex-end; max-width: 80%; display: flex; flex-direction: column; align-items: flex-end; margin-top: 8px; }
.turn-user .bubble { background: rgba(57, 255, 20, .07); border: 1px solid rgba(57, 255, 20, .40); border-radius: 10px; padding: 9px 12px; white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
.turn-agent { display: flex; flex-direction: column; gap: 6px; max-width: 100%; }
.a-text { line-height: 1.65; word-break: break-word; }
.a-err { color: #ffb4ae; font-size: 12px; }
.sysline { color: var(--muted); font-size: 10.5px; }
.turn-user .meta, .turn-agent .meta { color: var(--muted); font-size: 10px; display: flex; gap: 6px; align-items: center; }
.toolcall { border-left: 2px solid var(--line2); padding-left: 10px; font-size: 11.5px; }
.toolcall summary { cursor: pointer; color: #7fd9a8; list-style: none; display: flex; gap: 6px; align-items: baseline; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.toolcall summary::-webkit-details-marker { display: none; }
.toolcall .tc-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); flex: none; transform: translateY(-1px); }
.toolcall.err .tc-dot { background: var(--bad); }
.toolcall[open] summary { white-space: normal; }
.toolcall pre { background: #030504; border: 1px solid var(--line); border-radius: 6px; padding: 8px; margin: 6px 0; max-height: 220px; overflow: auto; white-space: pre-wrap; word-break: break-word; color: var(--text2); }
.composer2 { position: relative; border-top: 1px solid var(--line2); padding: 10px 12px; background: var(--bg2); }
.composer2 textarea { width: 100%; background: transparent; border: 1px solid var(--line2); border-radius: 8px; color: var(--text); font: inherit; padding: 9px 11px; resize: vertical; min-height: 64px; max-height: 260px; }
.composer2 textarea:focus { outline: none; border-color: var(--accent); }
.c-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.c-tools select { background: var(--card); border: 1px solid var(--line2); border-radius: 6px; color: var(--text); font: inherit; font-size: 12px; padding: 4px 8px; }
.slashpop { position: absolute; bottom: 100%; left: 12px; background: #0b100e; border: 1px solid var(--line2); border-radius: 8px; padding: 4px; min-width: 260px; max-width: 420px; box-shadow: 0 -10px 30px rgba(0, 0, 0, .4); z-index: 3; display: grid; }
.slashpop button { text-align: left; background: none; border: none; padding: 6px 10px; border-radius: 5px; color: var(--text2); font-size: 12px; }
.slashpop button.on, .slashpop button:hover { background: var(--card2); color: var(--text); }
.intro { margin: auto; text-align: center; max-width: 620px; padding: 20px 0; }
.intro-logo { font-size: 30px; color: var(--accent); }
.intro h2 { margin: 6px 0; font-size: 18px; letter-spacing: .04em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0; }
.chip { background: var(--card2); border: 1px solid var(--line2); border-radius: 999px; padding: 6px 12px; font-size: 12px; color: var(--text2); }
.chip:hover { border-color: var(--accent); color: var(--text); }
@media (max-width: 760px) { .convo { height: calc(100vh - 250px); } .turn-user { max-width: 92%; } }
.slashpop[hidden] { display: none; }
.b[hidden] { display: none; }
.lbl { display: block; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 18px 0 6px; }
.code { width: 100%; background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; color: var(--text); font: 700 26px/1 var(--mono); letter-spacing: .3em; text-align: center; padding: 12px; }
.code:focus { outline: none; border-color: var(--accent); }

/* matrix touches */
body { background: radial-gradient(1200px 600px at 50% -10%, rgba(57, 255, 20, .06), transparent 60%), var(--bg); }
#matrix { position: fixed; inset: 0; z-index: -1; opacity: .16; pointer-events: none; }
body.auth #matrix { opacity: .32; }
.shell::after { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50; background-image: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .018) 0, rgba(255, 255, 255, .018) 1px, transparent 1px, transparent 3px); }
.side, .top, .card, .kpi, .site, .strip, .convo, .auth-card { background-color: rgba(11, 16, 14, .9); }
.side { background: rgba(8, 12, 10, .94); }
.h-title, .brand b, .ha-state { text-shadow: 0 0 18px rgba(57, 255, 20, .25); }
.h-kicker { color: var(--accent); opacity: .75; }
nav a.on { border-color: rgba(57, 255, 20, .35); box-shadow: inset 2px 0 0 var(--accent); }
.b.primary, .btn { color: #d9ffd0; }
.btn:hover:not(:disabled), .b.primary:hover:not(:disabled) { box-shadow: 0 0 18px rgba(57, 255, 20, .25); }
.logo svg { stroke: var(--accent); filter: drop-shadow(0 0 6px rgba(57, 255, 20, .6)); }
::selection { background: rgba(57, 255, 20, .25); color: #e6f1ea; }

/* ---------- phones & tablets ---------- */
.crumbs { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.upd { white-space: nowrap; }
#graph { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 760px) {
  .top { gap: 8px; }
  .crumbs > span { display: none; }
  .upd { font-size: 10px; }
  .h-title { font-size: 22px; margin-bottom: 14px; }
  .kpi .v { font-size: 22px; }
  .card { padding: 13px; }
  /* tables: keep the columns that matter on a phone */
  .t-agents th:nth-child(n+4), .t-agents td:nth-child(n+4) { display: none; }
  .t-agents th:nth-child(5), .t-agents td:nth-child(5) { display: table-cell; }
  .t-tasks th:nth-child(2), .t-tasks td:nth-child(2), .t-tasks th:nth-child(4), .t-tasks td:nth-child(4), .t-tasks th:nth-child(5), .t-tasks td:nth-child(5) { display: none; }
  .t-pm2 th:nth-child(4), .t-pm2 td:nth-child(4), .t-pm2 th:nth-child(5), .t-pm2 td:nth-child(5) { display: none; }
  .t-hist th:nth-child(3), .t-hist td:nth-child(3), .t-hist th:nth-child(5), .t-hist td:nth-child(5) { display: none; }
  .t-sess th:nth-child(3), .t-sess td:nth-child(3) { display: none; }
  th, td { padding: 8px 6px; }
  /* agent engine: pan the graph sideways instead of shrinking it unreadably */
  #graph svg { min-width: 860px; height: 62vh; }
  .stage .title { font-size: 15px; }
  .engine-head .dump { font-size: 11px; }
  /* local agent */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; padding: 8px 12px; }
  .strip { gap: 6px; padding: 8px 10px; }
  .strip .b.sm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero-agent .ha-state { font-size: 17px; }
  .convo { height: calc(100dvh - 250px); min-height: 380px; }
  .convo-log { padding: 12px; }
  .turn-user { max-width: 92%; }
  .c-tools select { max-width: 52%; }
  .c-tools .muted.small { display: none; }
  .composer2 textarea { min-height: 52px; font-size: 16px; } /* 16px stops iOS zooming into the box */
  .composer textarea, .steer textarea, .code, .jobform textarea, .jobform select { font-size: 16px; }
  .talk { height: calc(100dvh - 100px); }
  .talk-head .h-title { font-size: 22px; }
  .chatlog { padding: 12px; }
  .composer { gap: 6px; }
  .composer .chk.small { display: none; }
  .intro h2 { font-size: 16px; }
  .chips { gap: 6px; }
  .chip { font-size: 11px; padding: 6px 10px; }
  .panel { width: 100vw; padding: 14px 14px 40px; }
  .sess.big { max-height: 50vh; }
}
@media (pointer: coarse) {
  .b, .tab, .chip, nav a, .filters button, .mute, .logout { min-height: 36px; }
  .b.sm { min-height: 32px; }
  .stab .x { min-width: 32px; }
}
.tab.plus { position: sticky; right: 0; background: var(--bg); box-shadow: -10px 0 12px var(--bg); z-index: 1; }
@media (max-width: 760px) {
  #view.v-local > .h-kicker, #view.v-local > .h-title { display: none; }
  #view.v-local { padding-top: 12px; }
  .convo { height: calc(100dvh - 215px); }
  .card h3 { flex-wrap: wrap; }
  .card h3 .r { flex-basis: 100%; margin-left: 0; font-size: 11px; }
  body.menu-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 25; }
  .side { z-index: 30; }
}
@media (max-width: 760px) {
  .convo { height: calc(100dvh - 250px); min-height: 360px; }
  .c-tools { flex-wrap: nowrap; gap: 6px; }
  .c-tools select { flex: 1; min-width: 0; max-width: none; }
  .c-tools .spacer { display: none; }
  .c-tools .lbl-t { display: none; }
  .c-tools .b { flex: none; padding: 6px 10px; }
  .composer2 { padding: 8px; }
  .composer2 textarea { min-height: 46px; }
}
@media (max-width: 760px) { .c-tools #cSend { margin-left: auto; } }
