/* AutoDT-Agentic demonstrator - the AutoDT shell in HTML.
   Every colour is a token from tokens.css (generated from the family's design_tokens.py); the
   objectNames of the desktop shell (#HeaderBar, #StageRail, #StageChip[state], #NextBar, #StepRail,
   #StatusBadge tones, #Banner tones, #EmptyState) are the class / id names here, so the QSS in
   core/autodt_core/ui_shell/theme.py and this file describe the same surfaces. The one dark surface
   is the plant canvas - the family's 3-D field viewer is dark for the same reason (a lit scene). */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--app-bg); color: var(--ink); font-family: var(--font-family); font-size: var(--font-md); }
body { display: flex; flex-direction: column; min-height: 100vh; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
a { color: var(--accent); }
.mono { font-family: var(--font-mono); }
.small { font-size: 12px; }
.hint { color: var(--muted); font-size: var(--font-sm); margin-bottom: 8px; }
.dim { color: var(--muted); font-weight: 500; }
.lbl { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
[hidden] { display: none !important; }

/* ---- header bar (#HeaderBar in theme.py: brand, 54 px) ------------------------------ */
#HeaderBar { background: var(--brand); min-height: 54px; display: flex; align-items: center; gap: 14px; padding: 0 16px; color: var(--surface); flex-wrap: wrap; }
#LogoChip { color: var(--surface); font-weight: 800; font-size: var(--font-lg); letter-spacing: 1.2px; padding: 4px 2px; }
#HeaderTitle { font-size: var(--font-lg); font-weight: 600; }
#HeaderProject { color: var(--brand-on); font-size: 15px; }
#ModeBadge { background: var(--brand-badge); color: var(--surface); border-radius: 11px; padding: 3px 12px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
#ModeBadge[data-mode="live"] { background: var(--tone-ok-text); }
.hdr-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.HeaderBtn { background: transparent; color: var(--surface); border: 1px solid rgba(255,255,255,.45); border-radius: 8px; padding: 6px 12px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.HeaderBtn:hover { background: var(--accent); border-color: var(--accent); }
.hdr-role { display: flex; align-items: center; gap: 6px; color: var(--brand-on); font-size: var(--font-sm); margin: 0; font-weight: 500; }
.hdr-role select { width: auto; background: var(--brand-badge); color: var(--surface); border: 1px solid rgba(255,255,255,.35); border-radius: 6px; padding: 4px 8px; font-weight: 600; margin: 0; }
#conn { border-radius: 11px; padding: 3px 10px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.14); color: var(--surface); }
#conn[data-state="connected"] { background: var(--tone-ok-text); }
#conn[data-state="off"] { background: var(--tone-warn-text); }

/* ---- stage rail (#StageRail / #StageChip[state] / #StageDot / #StageText) ---------- */
#StageRail { background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: stretch; padding: 0 8px; overflow-x: auto; }
.StageChip { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; background: transparent; border-bottom: 3px solid transparent; cursor: pointer; font: inherit; white-space: nowrap; }
.StageChip[state="active"] { border-bottom-color: var(--accent); background: var(--chip-active-bg); }
.StageChip[state="available"]:hover, .StageChip[state="done"]:hover { background: var(--chip-hover-bg); }
.StageChip[state="locked"] { cursor: not-allowed; }
.StageChip:focus-visible { outline: none; background: var(--tone-info-bg); border-bottom-color: var(--accent); }
.StageSep { color: var(--line-strong); align-self: center; padding: 0 2px; }
.StageDot { width: 20px; height: 20px; border-radius: 10px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; background: var(--surface); color: var(--muted); border: 1px solid var(--muted-soft); flex: none; }
.StageChip[state="done"] .StageDot { background: var(--tone-ok-text); color: var(--surface); border-color: transparent; }
.StageChip[state="active"] .StageDot { background: var(--accent); color: var(--surface); border-color: transparent; }
.StageChip[state="skipped"] .StageDot, .StageChip[state="locked"] .StageDot { background: var(--surface-muted); color: var(--muted-soft); border-color: var(--line-strong); }
.StageText { font-size: var(--font-md); font-weight: 600; color: var(--muted); }
.StageChip[state="active"] .StageText { color: var(--brand); font-weight: 700; }
.StageChip[state="done"] .StageText { color: var(--ink); }
.StageChip[state="skipped"] .StageText, .StageChip[state="locked"] .StageText { color: var(--muted-soft); }

/* ---- persistent Next-action bar (#NextBar) ------------------------------------------ */
#NextBar { background: var(--chip-active-bg); border-bottom: 1px solid var(--line); padding: 6px 16px; display: flex; gap: 10px; align-items: center; }
#NextTag { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .04em; }
#NextText { color: var(--brand); font-size: 12px; }

/* ---- shell body: the stage area and the assistant dock ------------------------------ */
.shell { display: grid; grid-template-columns: 1fr; flex: 1; min-height: 0; }
.shell.dock-open { grid-template-columns: 1fr 380px; }
.stage-area { min-width: 0; min-height: 0; display: flex; }
.stage-pane { display: none; flex: 1; min-width: 0; min-height: 0; }
.stage-pane.active { display: grid; grid-template-columns: 212px 1fr; }

/* ---- step rail: the narrow left column inside a stage (#StepRail / #StepItem[state]) - */
.StepRail { background: var(--surface); border-right: 1px solid var(--line); padding: 12px 0; overflow: auto; }
.StepRailHead { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 0 12px 6px 12px; }
.StepItem { display: flex; gap: 9px; padding: 9px 12px; border: 0; border-left: 3px solid transparent; background: transparent; width: 100%; text-align: left; cursor: pointer; font: inherit; }
.StepItem:hover { background: var(--chip-hover-bg); }
.StepItem[state="current"] { border-left-color: var(--accent); background: var(--chip-active-bg); }
.StepMark { color: var(--line-strong); font-size: 13px; font-weight: 700; width: 18px; text-align: center; flex: none; }
.StepItem[state="done"] .StepMark { color: var(--tone-ok-text); }
.StepItem[state="current"] .StepMark { color: var(--accent); }
.StepName { display: block; font-size: var(--font-md); font-weight: 600; color: var(--muted); }
.StepItem[state="current"] .StepName { color: var(--brand); }
.StepItem[state="done"] .StepName { color: var(--ink); }
.StepDesc { display: block; font-size: 11.5px; color: var(--muted-soft); }
.step-panes { min-width: 0; min-height: 0; overflow: auto; padding: 14px 16px 24px; }
.step-pane { display: none; }
.step-pane.active { display: block; }
.step-pane > h2 { color: var(--brand); font-size: var(--font-lg); margin: 0 0 10px; }

/* ---- cards (QGroupBox: hairline edge, uppercase brand title) ------------------------ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px; margin-bottom: 12px; min-width: 0; }
.card > h4, .card .head h4 { color: var(--brand); font-size: 13px; letter-spacing: .4px; text-transform: uppercase; font-weight: 700; margin: 0 0 8px; }
.card.off { opacity: .55; }
.card .head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card .head h4 { margin: 0; }
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cards2 > .card { margin-bottom: 0; }

/* ---- buttons (QPushButton variants: default = secondary, .primary = brand, .danger) - */
button, .btnlike { background: var(--surface); color: var(--brand); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 7px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-block; line-height: 1.2; }
button:hover, .btnlike:hover { background: var(--tone-info-bg); border-color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 1px; }
button:disabled { background: var(--surface-alt); color: var(--disabled-ink); border-color: var(--disabled-border); cursor: default; }
button.primary { background: var(--brand); color: var(--surface); border-color: transparent; }
button.primary:hover { background: var(--accent); }
button.primary:disabled { background: var(--disabled-bg); color: var(--disabled-on); }
button.danger { color: var(--tone-err-text); border-color: var(--tone-err-border); }
button.danger:hover { background: var(--tone-err-bg); border-color: var(--tone-err-text); }
button.small, .btnlike.small { padding: 4px 9px; font-size: 12px; }

/* ---- inputs ------------------------------------------------------------------------- */
select, input[type=text], input[type=number], input[type=file], input:not([type]), textarea { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; font: inherit; font-size: var(--font-sm); width: 100%; }
select:hover, input:hover, textarea:hover { border-color: var(--border-hover); }
select:focus, input:focus, textarea:focus { outline: none; border: 2px solid var(--accent); padding: 5px 7px; }
textarea { font-family: var(--font-mono); resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
label input, label select, label textarea { margin-top: 3px; font-weight: 400; }
input[type=range] { accent-color: var(--accent); width: 140px; }
input[type=checkbox] { accent-color: var(--accent); width: auto; }

/* ---- status badges (#StatusBadge[tone]) and banners (#Banner[tone]) ----------------- */
.badge { border-radius: 11px; padding: 3px 11px; font-size: 12px; font-weight: 600; background: var(--tone-todo-bg); color: var(--muted); white-space: nowrap; }
.badge.model, .badge.live, .badge.ok, .badge.done { background: var(--tone-ok-bg); color: var(--tone-ok-text); }
.badge.rule, .badge.info, .badge.active { background: var(--tone-info-bg); color: var(--accent); }
.badge.builtin, .badge.off, .badge.todo { background: var(--tone-todo-bg); color: var(--muted); }
.badge.warn { background: var(--tone-warn-bg); color: var(--tone-warn-text); }
.badge.err { background: var(--tone-err-bg); color: var(--tone-err-text); }
.banner { border-radius: var(--radius-md); padding: 8px 12px; font-size: var(--font-sm); margin-bottom: 10px; line-height: 1.45; }
.banner.info { background: var(--tone-info-bg); border: 1px solid var(--tone-info-border); color: var(--tone-info-text); }
.banner.ok { background: var(--tone-ok-bg); border: 1px solid var(--tone-ok-border); color: var(--tone-ok-text); }
.banner.warn { background: var(--tone-warn-bg); border: 1px solid var(--tone-warn-border); color: var(--tone-warn-text); }
.banner.err { background: var(--tone-err-bg); border: 1px solid var(--tone-err-border); color: var(--tone-err-text); }
.banner a { color: inherit; font-weight: 600; }
.empty { background: var(--surface-subtle); border: 1.5px dashed var(--line-strong); border-radius: var(--radius-lg); padding: 18px; text-align: center; color: var(--muted); font-size: var(--font-sm); }
.empty b { display: block; color: var(--brand); font-size: 15px; margin-bottom: 4px; }
.warn-text { color: var(--tone-warn-text); }
.fail-text { color: var(--tone-err-text); }
.pass-text { color: var(--tone-ok-text); }

/* ---- tables ------------------------------------------------------------------------- */
.gridwrap { overflow: auto; max-height: 52vh; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); max-width: 100%; }
.grid { border-collapse: collapse; font-size: 12px; white-space: nowrap; min-width: 100%; }
.grid th { position: sticky; top: 0; background: var(--surface-alt); color: var(--header-ink); text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); font-weight: 600; letter-spacing: .3px; }
.grid td { padding: 4px 10px; border-bottom: 1px solid var(--line-soft); max-width: 260px; overflow: hidden; text-overflow: ellipsis; font-family: var(--font-mono); }
.grid tr:nth-child(even) td { background: var(--surface-subtle); }
.grid tr:hover td { background: var(--tone-info-bg); }
.kv, .rolebox table { width: 100%; border-collapse: collapse; font-size: 12px; }
.kv td, .rolebox td { padding: 3px 6px; border-bottom: 1px solid var(--line-soft); vertical-align: top; font-family: var(--font-mono); word-break: break-word; }
.kv td:first-child { color: var(--muted-deep); width: 34%; font-family: var(--font-family); }
.rolebox { font-size: var(--font-sm); line-height: 1.45; }
.light { display: inline-block; width: 16px; height: 16px; border-radius: 50%; vertical-align: middle; margin-right: 8px; background: var(--muted-soft); }
.light.GREEN { background: var(--verdict-green); }
.light.YELLOW { background: var(--verdict-amber); }
.light.RED { background: var(--verdict-red); }

/* ---- lists, json, faults, forms, agents ------------------------------------------ */
.list { display: flex; flex-direction: column; gap: 2px; }
.list .row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 5px 8px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-mono); font-size: 12px; }
.list .row:hover { background: var(--chip-hover-bg); }
.list .row.hot { background: var(--tone-info-bg); color: var(--brand); }
.list .row .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .row .n { color: var(--muted); }
.q-bad, .q-stale { color: var(--tone-err-text); }
.q-uncertain { color: var(--tone-warn-text); }
.json { background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px; font-family: var(--font-mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto; color: var(--ink); margin: 0 0 8px; }
.fault-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.fault-grid button { text-align: left; font-weight: 500; }
.fault-grid button.on { background: var(--tone-err-bg); border-color: var(--tone-err-text); color: var(--tone-err-text); }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; align-items: end; margin-bottom: 8px; }
.row3 button, .row3 a { align-self: end; }
.form .row3 { margin-bottom: 4px; }
.featgrid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 3px 10px; margin-bottom: 8px; }
.featgrid .grp { grid-column: 1 / -1; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; margin-top: 6px; }
.featgrid label { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--ink); margin: 0; font-weight: 400; }
.featgrid input { width: auto; margin: 0; }
.metric { display: inline-block; background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 3px 8px; margin: 2px 6px 2px 0; font-family: var(--font-mono); font-size: 12px; }
.metric b { color: var(--accent); }
.subs .row { display: grid; grid-template-columns: 1fr auto; gap: 6px; font-family: var(--font-mono); font-size: 11px; padding: 2px 0; }
.subs .row.hot .n { color: var(--accent); font-weight: 700; }
.subs .bar { height: 3px; background: var(--line-soft); border-radius: 2px; margin: 1px 0 3px; }
.subs .bar i { display: block; height: 3px; background: var(--accent); border-radius: 2px; }
.feeds { margin: 4px 0 6px 16px; padding: 0; }
.feeds li { font-size: 12px; margin: 0 0 2px 0; }
.knobs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 8px; margin-top: 6px; }
.knobs label { margin: 0; }
.knobs input { padding: 3px 6px; font-size: 12px; }
.toggle { font-size: 12px; display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--tone-ok-text); }
.dot.off { background: var(--muted-soft); }
.dot.err { background: var(--tone-err-text); }
.locations { display: grid; grid-template-columns: 150px 1fr auto; gap: 8px 12px; align-items: center; font-size: var(--font-sm); }
.locations .path { font-family: var(--font-mono); color: var(--muted-deep); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.locations .note { grid-column: 2 / -1; color: var(--muted-soft); font-size: 11.5px; margin-top: -6px; }
.plot { width: 100%; height: 150px; background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-md); }
.plot .line { fill: none; stroke: var(--accent); stroke-width: 1.4; }
.plot .flag { fill: var(--tone-warn-text); }
.plot .axis { stroke: var(--line-strong); }
.plot text { fill: var(--muted); font-family: var(--font-mono); font-size: 9px; }

/* ---- the plant canvas: the family's dark viewer surface, with its backdrop switch ---- */
.canvas { background: var(--dark-bg); border-radius: var(--radius-lg); border: 1px solid var(--line); overflow: hidden; position: relative; display: flex; flex-direction: column; }
.canvas .bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: linear-gradient(180deg, var(--scrim), transparent); color: var(--dark-ink); flex-wrap: wrap; }
.canvas .bar .title { font-weight: 700; font-size: var(--font-md); }
.canvas .bar .sub { font-size: 12px; color: var(--dark-muted-soft); }
.canvas .transport { display: flex; align-items: center; gap: 8px; }
.canvas .transport button { background: var(--chip); color: var(--dark-ink); border: 0; padding: 6px 10px; font-size: 12px; }
.canvas .transport button:hover { background: var(--chip-hover); }
.canvas .transport label { margin: 0; color: var(--dark-muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.canvas .transport input[type=range] { width: 110px; }
.canvas .transport .mono { color: var(--dark-ink); }
.canvas .modes { margin-left: auto; display: flex; gap: 6px; background: var(--chip); padding: 4px; border-radius: 10px; }
.canvas .modes button { border: 0; background: transparent; color: var(--dark-muted); font-weight: 600; font-size: 12px; padding: 6px 10px; border-radius: 7px; }
.canvas .modes button:hover { background: var(--chip-hover); }
.canvas .modes button.on { background: var(--accent); color: #fff; }
#scene { width: 100%; height: calc(100vh - 330px); min-height: 420px; display: block; }
.lane { fill: var(--dark-faint); font-family: var(--font-mono); font-size: 11px; letter-spacing: .08em; }
.lane-rule { stroke: var(--dark-faint); stroke-opacity: .5; stroke-dasharray: 4 6; }
.node rect, .node polygon { fill: var(--dark-panel); stroke: var(--dark-muted-soft); stroke-opacity: .55; stroke-width: 1.2; }
.node.agent rect { stroke: var(--dark-link); stroke-opacity: 1; }
.node.agent.rule rect { stroke: var(--point-boundary); stroke-dasharray: 5 3; }
.node.agent.model rect { stroke: var(--dark-link); stroke-dasharray: 5 3; }
.node.agent.off { opacity: .45; }
.node.slot rect { stroke: var(--dark-faint); stroke-dasharray: 6 5; fill: transparent; }
.node.slot text { fill: var(--dark-muted-soft); }
.node.screen rect { stroke: var(--dark-ink-soft); stroke-opacity: .7; }
.node.pool rect { stroke: var(--verdict-green-dark); }
.node:hover rect, .node:hover polygon { stroke: var(--accent); stroke-opacity: 1; cursor: pointer; }
.node.lit rect, .node.lit polygon { stroke: var(--accent); stroke-opacity: 1; stroke-width: 2; filter: drop-shadow(0 0 6px rgba(0,120,200,.7)); }
.node text { fill: var(--dark-ink); font-family: var(--font-family); font-size: 12px; pointer-events: none; }
.node .title { font-weight: 700; font-size: 13px; }
.node .small { fill: var(--dark-muted); font-size: 10.5px; }
.node .mono { font-family: var(--font-mono); }
.hub { fill: var(--dark-field); stroke: var(--accent); stroke-width: 2; }
.ring { fill: none; stroke-width: 3; transition: stroke .15s; }
.ring-label { fill: var(--dark-muted); font-family: var(--font-mono); font-size: 9px; }
.paths path { fill: none; stroke: var(--dark-faint); stroke-width: 1.4; marker-end: url(#arrow); }
.paths path.direct { stroke: var(--dark-link); stroke-dasharray: 5 4; }
.paths path.feedback { stroke: var(--verdict-green-dark); stroke-dasharray: 2 4; }
.paths path.cmd { stroke: var(--verdict-amber-dark); stroke-dasharray: 2 4; }
#arrow path { fill: var(--dark-muted-soft); }
.packet { pointer-events: none; }
.steel { fill: var(--dark-panel); stroke: var(--dark-faint); }
.ram { fill: var(--dark-faint); stroke: var(--dark-muted-soft); }
.tool-upper, .tool-lower { fill: var(--dark-muted-soft); }
.blank { fill: var(--dark-ink-soft); }
.belt { stroke: var(--dark-faint); stroke-width: 3; stroke-dasharray: 6 4; }
.coil { fill: none; stroke: var(--dark-ink-soft); stroke-width: 6; }
.coil-hole { fill: var(--dark-panel); stroke: var(--dark-muted-soft); }
.sensor { fill: var(--dark-link); stroke: var(--marker); stroke-width: 1; }
.led { fill: var(--verdict-green-dark); }
.led.blink { fill: var(--marker); }
.antenna { stroke: var(--dark-link); stroke-width: 1.5; fill: none; }
.cyl { fill: var(--dark-field); stroke: var(--dark-faint); }
.warn { fill: var(--verdict-red-dark); }
.tl-body { fill: var(--dark-field); stroke: var(--dark-faint); }
.tl { fill: var(--dark-field); }
.tl.red.on { fill: var(--verdict-red-dark); filter: drop-shadow(0 0 6px var(--verdict-red-dark)); }
.tl.yellow.on { fill: var(--verdict-amber-dark); filter: drop-shadow(0 0 6px var(--verdict-amber-dark)); }
.tl.green.on { fill: var(--verdict-green-dark); filter: drop-shadow(0 0 6px var(--verdict-green-dark)); }
.gauge-bg { fill: var(--dark-field); }
.gauge { fill: var(--verdict-green-dark); }
.flash { fill: var(--verdict-green-dark); font-weight: 700; }
.wrap { font-size: 10px; }
.agent-health { fill: var(--verdict-green-dark); }
.agent-health.off { fill: var(--dark-faint); }
.agent-health.error { fill: var(--verdict-red-dark); }

/* ---- assistant dock (ChatPanel: title, log, pinned status banner, tall input) -------- */
#AssistantDock { background: var(--surface); border-left: 1px solid var(--line); display: none; flex-direction: column; min-height: 0; min-width: 0; }
.shell.dock-open #AssistantDock { display: flex; }
#AssistantDock .head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--line); }
#AssistantDock .head h2 { color: var(--brand); font-size: var(--font-lg); }
#chat-log { flex: 1; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: var(--font-sm); min-height: 120px; }
.msg { max-width: 94%; padding: 8px 10px; border-radius: 10px; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.msg.user { align-self: flex-end; background: var(--tone-info-bg); color: var(--brand); border: 1px solid var(--tone-info-border); }
.msg.bot { align-self: flex-start; background: var(--surface-alt); border: 1px solid var(--line); color: var(--ink); }
.msg .who { display: block; font-size: 11px; color: var(--muted); margin-bottom: 2px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
#chat-status { margin: 0 12px; }
#chat-input { margin: 8px 12px 0; width: calc(100% - 24px); min-height: 96px; max-height: 150px; font-family: var(--font-family); font-size: var(--font-sm); }
.chat-actions { display: flex; gap: 8px; padding: 8px 12px 10px; align-items: center; }
.chat-actions .hint { margin: 0; flex: 1; font-size: 11.5px; }

/* ---- log strip and status bar ------------------------------------------------------- */
#LogStrip { border-top: 1px solid var(--line); background: var(--surface); display: grid; grid-template-columns: 56px 1fr; }
#LogStrip .LogHead { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .5px; padding: 6px 12px; border-right: 1px solid var(--line); }
.ticker { height: 76px; overflow: hidden; font-family: var(--font-mono); font-size: 12px; color: var(--muted-deep); padding: 4px 10px; line-height: 1.5; }
.ticker div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticker .k { color: var(--accent); }
#StatusBar { background: var(--surface); color: var(--muted); border-top: 1px solid var(--line); padding: 4px 16px; font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
#StatusBar .mono { color: var(--muted-deep); }

/* ---- chip counts (#StageCount), the new-agent kind switch, numbered wizard cards ------ */
.StageCount { font-size: 10px; padding: 1px 7px; border-radius: 9px; background: var(--tone-todo-bg); color: var(--muted); font-weight: 700; margin-left: 2px; }
.StageChip[state="active"] .StageCount { background: var(--tone-info-bg); color: var(--accent); }
.kind-switch { display: inline-flex; gap: 6px; background: var(--surface-muted); padding: 4px; border-radius: 10px; margin-bottom: 12px; }
.kind-switch button { border: 0; background: transparent; color: var(--muted); padding: 6px 14px; border-radius: 7px; }
.kind-switch button:hover { background: var(--chip-hover-bg); }
.kind-switch button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.card.wizard > h4 .wnum { display: inline-flex; width: 20px; height: 20px; border-radius: 10px; background: var(--accent); color: var(--surface); align-items: center; justify-content: center; font-size: 11px; margin-right: 8px; vertical-align: middle; }

/* ---- the who-feeds-whom graph (a diagram on the light chrome, not a lit scene) ------- */
.graph { width: 100%; display: block; background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-md); }
.graph .gnode rect { fill: var(--surface); stroke: var(--line-strong); }
.graph .gnode.agent rect { stroke: var(--accent); }
.graph .gnode.agent.rule rect { stroke: var(--point-boundary); stroke-dasharray: 4 3; }
.graph .gnode.agent.model rect { stroke: var(--accent); stroke-dasharray: 4 3; }
.graph .gnode.endpoint rect { stroke: var(--tone-ok-border); fill: var(--tone-ok-bg); }
.graph .gnode.source rect { fill: var(--surface-muted); }
.graph text { font-size: 12px; fill: var(--ink); font-family: var(--font-family); font-weight: 600; pointer-events: none; }
.graph text.sub { font-size: 10px; fill: var(--muted); font-weight: 400; }
.graph .edge { fill: none; stroke: var(--muted-soft); stroke-width: 1.2; opacity: .8; }
.graph .edge.agent { stroke: var(--accent); stroke-width: 1.8; }
.graph .edge.feed { stroke: var(--tone-ok-text); stroke-dasharray: 4 3; }
.graph-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.graph-legend i { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--muted-soft); vertical-align: middle; margin-right: 6px; }
.graph-legend i.agent { border-top-color: var(--accent); }
.graph-legend i.feed { border-top: 2px dashed var(--tone-ok-text); }

/* ---- decision agents: node, badges, the rules / vote editors ------------------------- */
.node.agent.decision rect { stroke: var(--dark-ink-soft); stroke-dasharray: 2 3; }
.graph .gnode.agent.decision rect { stroke: var(--ink); stroke-dasharray: 2 3; }
.badge.decision { background: var(--surface-muted); color: var(--brand); }
.badge.RELEASE { background: var(--tone-ok-bg); color: var(--tone-ok-text); }
.badge.REVIEW { background: var(--tone-warn-bg); color: var(--tone-warn-text); }
.badge.HOLD { background: var(--tone-err-bg); color: var(--tone-err-text); }
.rule-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; font-size: 12px; color: var(--muted); }
.rule-row select, .rule-row input { width: auto; min-width: 84px; font-size: 12px; padding: 4px 6px; }
.rule-row input.msg { min-width: 200px; flex: 1; }
.rule-row b { color: var(--brand); }
.inputs-table td label { margin: 0; font-weight: 400; display: inline-flex; gap: 4px; align-items: center; }
.inputs-table td select { width: auto; font-size: 12px; padding: 3px 6px; }

/* ---- lean chrome: help dots instead of hint paragraphs (the family's #HelpDot) -------- */
.pane-head { display: flex; align-items: center; gap: 10px; margin: 0 0 10px; position: relative; }
.pane-head h2 { margin: 0; color: var(--brand); font-size: var(--font-lg); }
details.help { display: inline-block; }
details.help > summary { list-style: none; cursor: pointer; width: 20px; height: 20px; border-radius: 10px; background: var(--line-faint); color: var(--muted-deep); font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; user-select: none; }
details.help > summary::-webkit-details-marker { display: none; }
details.help > summary:hover, details.help[open] > summary { background: var(--accent); color: var(--surface); }
details.help > div { position: absolute; left: 0; top: 100%; z-index: 6; max-width: 620px; margin-top: 6px; background: var(--tone-info-bg); border: 1px solid var(--tone-info-border); color: var(--tone-info-text); border-radius: var(--radius-md); padding: 10px 12px; font-size: var(--font-sm); line-height: 1.45; font-weight: 400; box-shadow: 0 6px 18px rgba(0,0,0,.08); }
details.help.inline { display: block; margin-bottom: 10px; }
details.help.inline > div { position: static; margin: 6px 0 0; max-width: none; box-shadow: none; }
details.help a { color: inherit; font-weight: 600; }

/* ---- part ids are links; log lines collapse and open their topic ---------------------- */
a.partlink { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent); font-family: var(--font-mono); }
a.partlink:hover { background: var(--tone-info-bg); }
.ticker div[data-topic] { cursor: pointer; }
.ticker div[data-topic]:hover { color: var(--brand); }
.ticker .rep { color: var(--tone-warn-text); font-weight: 700; margin-left: 6px; }
#NextText a { margin-left: 8px; font-weight: 700; text-decoration: none; }

/* ---- the topic tree ------------------------------------------------------------------ */
.tree details { margin-left: 0; }
.tree details details { margin-left: 16px; }
.tree summary { cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); font-size: var(--font-sm); display: flex; align-items: center; gap: 8px; list-style: none; }
.tree summary::-webkit-details-marker { display: none; }
.tree summary::before { content: "▸"; color: var(--muted-soft); width: 10px; font-size: 11px; }
.tree details[open] > summary::before { content: "▾"; }
.tree summary:hover { background: var(--chip-hover-bg); }
.tree summary b { color: var(--brand); font-weight: 600; }
.tree summary .n { color: var(--muted); font-family: var(--font-mono); font-size: 12px; margin-left: auto; }
.tree .leaf { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 3px 6px 3px 32px; border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-mono); font-size: 12px; }
.tree .leaf:hover { background: var(--chip-hover-bg); }
.tree .leaf.hot { background: var(--tone-info-bg); color: var(--brand); }
.tree .leaf .n { color: var(--muted); }
.tree .branch-tag { font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }

/* ---- canvas legend (filter by branch) and focus on one agent -------------------------- */
.legend-row { display: flex; align-items: center; gap: 10px; padding: 0 14px 8px; flex-wrap: wrap; background: linear-gradient(180deg, var(--scrim), transparent); }
.legend { display: flex; gap: 6px; flex-wrap: wrap; }
.legend button { background: var(--chip); color: var(--dark-ink); border: 0; border-radius: 12px; padding: 3px 10px 3px 8px; font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.legend button i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.legend button.off { opacity: .4; text-decoration: line-through; }
.legend button .n { color: var(--dark-muted); font-weight: 400; font-family: var(--font-mono); }
.focus-chip { margin-left: auto; background: var(--chip); color: var(--dark-ink); border-radius: 12px; padding: 3px 8px 3px 10px; font-size: 11px; display: inline-flex; align-items: center; gap: 8px; }
.focus-chip a { color: var(--dark-link); }
.focus-chip button { background: transparent; border: 0; color: var(--dark-ink); font-size: 13px; padding: 0 2px; }
.node.agent.dim { opacity: .28; }
.node.agent.focus rect { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: none; }
#scene { height: calc(100vh - 366px); }

/* ---- the DEMO view of the live flow (demoview.js) -------------------------------------
   A second view of the same data for an audience: the machines drawn as machines, one part
   followed at human speed. All artwork is ours; every colour is a family token. */
#demo-wrap { position: relative; display: flex; flex-direction: column; min-height: 0; flex: 1; }
#demo-scene { width: 100%; height: calc(100vh - 442px); min-height: 360px; display: block; }
.dm-bg { fill: var(--dark-bg); }
.dm-band { fill: var(--dark-faint); font-family: var(--font-mono); font-size: 13px; letter-spacing: .16em; }
.dm-band.small { font-size: 11px; }
.dm-divider { stroke: var(--dark-faint); stroke-opacity: .45; stroke-dasharray: 3 9; }
.dm-t, .dm-title, .dm-sub, .dm-read, .dm-tag, .dm-stamp, .dm-verdict, .dm-cardtext { font-family: var(--font-family); }
.dm-title { fill: var(--dark-ink); font-size: 14px; font-weight: 700; }
.dm-sub { fill: var(--dark-muted); font-size: 12px; }
.dm-read { fill: var(--dark-muted-soft); font-size: 12px; font-family: var(--font-mono); }
.dm-read.end, .dm-title.mid, .dm-sub.mid, .dm-read.mid { text-anchor: middle; }
.dm-read.end { text-anchor: end; }
.dm-tag { fill: var(--dark-faint); font-size: 11px; font-family: var(--font-mono); letter-spacing: .08em; }
.dm-stamp { fill: var(--dark-faint); font-size: 10px; letter-spacing: .18em; text-anchor: middle; }
.dm-arrowhead { fill: var(--dark-muted-soft); }

/* machine plate: two greys and one hairline, like a machine drawing */
.dm-panel { fill: var(--dark-panel); stroke: var(--dark-muted-soft); stroke-opacity: .45; }
.dm-frame { fill: var(--dark-field); stroke: var(--dark-faint); stroke-opacity: .7; }
.dm-crown, .dm-bed { fill: var(--dark-panel); stroke: var(--dark-muted-soft); stroke-opacity: .55; }
.dm-upright { fill: var(--dark-field); stroke: var(--dark-muted-soft); stroke-opacity: .5; }
/* the moving steel sits between the panel and the faint line; derived, never a literal */
.dm-slide { fill: color-mix(in srgb, var(--dark-panel) 62%, var(--dark-faint)); stroke: var(--dark-muted-soft); stroke-opacity: .8; }
.dm-guide { fill: var(--dark-faint); }
.dm-die { fill: var(--dark-muted-soft); fill-opacity: .85; }
.dm-bolster { fill: color-mix(in srgb, var(--dark-panel) 62%, var(--dark-faint)); stroke: var(--dark-faint); }
.dm-pin { fill: var(--dark-faint); }
.dm-cushion { fill: var(--dark-muted-soft); fill-opacity: .6; }
.dm-motor { fill: var(--dark-field); stroke: var(--dark-faint); }
.dm-flywheel { fill: none; stroke: var(--dark-muted-soft); stroke-width: 3; }
.dm-flywheel.hub { fill: var(--dark-field); stroke-width: 2; }
.dm-spoke { stroke: var(--dark-faint); stroke-width: 2; }
.dm-tie { stroke: var(--dark-faint); stroke-opacity: .6; stroke-width: 2; }
.dm-blank { fill: var(--dark-ink-soft); }
/* the formed part: sheet metal in section, so the audience sees the material gain a shape */
.dm-formed { fill: none; stroke: var(--dark-ink-soft); stroke-width: 5; stroke-linejoin: round; stroke-linecap: round; }
.dm-formed.small { stroke-width: 3.5; }
.dm-coil-mark { stroke: var(--dark-bg); stroke-width: 3; stroke-opacity: .8; }
#dm-coil-spin { transition: transform .5s ease-out; }
#dm-travel { transition: opacity .25s; }
.dm-steel { fill: var(--dark-ink-soft); fill-opacity: .8; }
.dm-grip { fill: var(--dark-muted-soft); }
.dm-neck { fill: none; stroke: var(--dark-bg); stroke-width: 3; }
.dm-cam { fill: var(--dark-field); stroke: var(--dark-link); stroke-opacity: .8; }
.dm-lens { fill: var(--dark-link); }
.dm-ray { stroke: var(--dark-link); stroke-width: 2; }
.dm-conelight { pointer-events: none; opacity: .5; transition: opacity .2s; }
.dm-conelight.flash { opacity: 1; }
.dm-coil { fill: none; stroke: var(--dark-ink-soft); stroke-width: 11; transition: r .6s ease; }
.dm-coil.thin { stroke-width: 5; stroke-opacity: .45; }
.dm-mandrel { fill: var(--dark-field); stroke: var(--dark-muted-soft); stroke-width: 2; }
.dm-mandrel.dot { fill: var(--dark-muted-soft); stroke: none; }
.dm-roller { fill: var(--dark-field); stroke: var(--dark-muted-soft); stroke-opacity: .7; stroke-width: 2; }
.dm-roller.small { stroke-opacity: .4; }
.dm-belt { stroke: var(--dark-faint); stroke-width: 4; stroke-dasharray: 10 7; }
.dm-curtain { stroke: var(--verdict-amber-dark); stroke-opacity: .5; stroke-width: 2; stroke-dasharray: 3 7; }
.dm-heat { transition: opacity .4s; }
.dm-heat.flash { opacity: 1 !important; }
.dm-sensor { fill: var(--dark-link); stroke: var(--marker); stroke-width: 1.5; }
.dm-sensor.bad { fill: var(--verdict-red-dark); }
.dm-trough { fill: var(--dark-field); }
.dm-fill { fill: var(--verdict-amber-dark); transition: width .5s ease; }
.dm-hub { fill: var(--dark-field); stroke: var(--accent); stroke-width: 2.5; transition: filter .2s; }
.dm-hub.lit { filter: drop-shadow(0 0 14px rgba(0,120,200,.85)); }
.dm-led { fill: var(--dark-faint); }
.dm-led.green, .dm-led.GREEN { fill: var(--verdict-green-dark); }
.dm-led.yellow, .dm-led.YELLOW { fill: var(--verdict-amber-dark); }
.dm-led.red, .dm-led.RED { fill: var(--verdict-red-dark); }

/* agents as characters: a lens that opens when the agent is working */
.dm-agentbox { fill: var(--dark-panel); stroke: var(--dark-muted-soft); stroke-opacity: .4; }
.dm-face { fill: var(--dark-field); stroke: var(--dark-muted-soft); stroke-opacity: .7; stroke-width: 2; transition: stroke .25s; }
.dm-pupil { fill: var(--dark-faint); transition: fill .25s, r .25s; }
.dm-agent.awake .dm-face { stroke: var(--accent); }
.dm-agent.awake .dm-pupil { fill: var(--accent); r: 9; }
.dm-agent.awake .dm-agentbox { stroke: var(--accent); stroke-opacity: .9; }

/* the human screens */
.dm-screen { fill: var(--dark-panel); stroke: var(--dark-ink-soft); stroke-opacity: .35; }
.dm-tlbody { fill: var(--dark-bg); stroke: var(--dark-faint); }
.dm-tl { fill: var(--dark-field); }
.dm-tl.red.on { fill: var(--verdict-red-dark); filter: drop-shadow(0 0 10px var(--verdict-red-dark)); }
.dm-tl.yellow.on { fill: var(--verdict-amber-dark); filter: drop-shadow(0 0 10px var(--verdict-amber-dark)); }
.dm-tl.green.on { fill: var(--verdict-green-dark); filter: drop-shadow(0 0 10px var(--verdict-green-dark)); }
.dm-verdict { fill: var(--dark-ink); font-size: 26px; font-weight: 700; }
.dm-verdict.GREEN { fill: var(--verdict-green-dark); }
.dm-verdict.YELLOW { fill: var(--verdict-amber-dark); }
.dm-verdict.RED { fill: var(--verdict-red-dark); }
.dm-verdict.none { fill: var(--dark-faint); }

/* the wires, and the message cards that travel them */
.dm-wire { fill: none; stroke: var(--dark-faint); stroke-opacity: .55; stroke-width: 2; }
.dm-wire.strip { stroke: var(--dark-ink-soft); stroke-opacity: .75; stroke-width: 5; stroke-linecap: round; }
.dm-wire.data { stroke-dasharray: 5 6; }
.dm-wire.feed { stroke: var(--verdict-green-dark); stroke-opacity: .45; stroke-dasharray: 3 6; }
.dm-wire.hot { stroke: var(--accent); stroke-opacity: 1; }
.dm-card { pointer-events: none; }
.dm-cardbox { fill: var(--dark-panel); stroke: var(--accent); stroke-width: 1.5; }
.dm-cardtext { fill: var(--dark-ink); font-size: 12px; font-weight: 600; }
.dm-card.green .dm-cardbox { stroke: var(--verdict-green-dark); }
.dm-card.yellow .dm-cardbox { stroke: var(--verdict-amber-dark); }
.dm-card.red .dm-cardbox { stroke: var(--verdict-red-dark); }
.dm-card.grey .dm-cardbox { stroke: var(--dark-faint); }

/* focus: everything that is not the current stage steps back */
.dm-stage { transition: opacity .4s; }
#demo-scene[data-focus] .dm-stage { opacity: .22; }
#demo-scene[data-focus=""] .dm-stage { opacity: 1; }
#demo-scene[data-focus="coil"] .dm-stage[data-stage="coil"],
#demo-scene[data-focus="coil"] .dm-stage[data-stage="test"],
#demo-scene[data-focus="coil"] .dm-stage[data-stage="straightener"],
#demo-scene[data-focus="press"] .dm-stage[data-stage="press"],
#demo-scene[data-focus="gateway"] .dm-stage[data-stage="gateway"],
#demo-scene[data-focus="gateway"] .dm-stage[data-stage="press"],
#demo-scene[data-focus="broker"] .dm-stage[data-stage="broker"],
#demo-scene[data-focus="broker"] .dm-stage[data-stage="gateway"],
#demo-scene[data-focus="agents"] .dm-stage[data-stage="agents"],
#demo-scene[data-focus="agents"] .dm-stage[data-stage="broker"],
#demo-scene[data-focus="screens"] .dm-stage[data-stage="screens"],
#demo-scene[data-focus="screens"] .dm-stage[data-stage="agents"],
#demo-scene[data-focus="vision"] .dm-stage[data-stage="vision"],
#demo-scene[data-focus="vision"] .dm-stage[data-stage="conveyor"] { opacity: 1; }

/* caption and controls, over the canvas */
/* the caption never overlays the scene: during the data acts the lower band is exactly what matters */
.dm-caption { margin: 8px 16px 0; min-height: 62px; background: var(--dark-panel); border: 1px solid rgba(255,255,255,.14); border-left: 3px solid var(--accent); border-radius: var(--radius-md); padding: 10px 16px; color: var(--dark-ink); opacity: .35; transition: opacity .3s; pointer-events: none; }
.dm-caption.on { opacity: 1; }
.dm-caption b { display: block; font-size: 15px; margin-bottom: 3px; }
.dm-caption span { font-size: 13.5px; color: var(--dark-muted); line-height: 1.45; }
.dm-controls { display: flex; align-items: center; gap: 10px; padding: 10px 16px 12px; }
.dm-controls button { background: var(--chip); color: var(--dark-ink); border: 0; padding: 7px 14px; font-weight: 600; }
.dm-controls button:hover { background: var(--chip-hover); }
.dm-controls button.primary { background: var(--accent); color: #fff; }
.dm-controls .hint { color: var(--dark-muted-soft); margin: 0; font-size: 12px; }
#demo-act { color: var(--dark-muted); font-family: var(--font-mono); font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .dm-card { display: none; } }

/* ---- scrollbars, motion, breakpoints ----------------------------------------------- */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--disabled-bg); border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background-color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .packet { display: none; } }
@media (max-width: 1280px) {
  .shell.dock-open { grid-template-columns: 1fr; }
  .shell.dock-open #AssistantDock { position: fixed; right: 0; top: 0; bottom: 0; width: min(380px, 100vw); z-index: 20; box-shadow: -6px 0 20px rgba(0,0,0,.15); }
}
@media (max-width: 900px) {
  .stage-pane.active { grid-template-columns: 1fr; }
  .StepRail { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 0; }
  .StepRailHead { display: none; }
  .StepItem { width: auto; border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .StepItem[state="current"] { border-bottom-color: var(--accent); }
  .StepDesc { display: none; }
  .row3, .form .row3, .featgrid, .cards2, .knobs, .fault-grid { grid-template-columns: 1fr; }
  #scene { height: 50vh; min-height: 300px; }
  #HeaderProject { display: none; }
  .step-panes { padding: 12px 16px 24px; }
}

/* ---- advisor agents: the live "hears -> reasons -> says" card (same three columns as the explainer film) ---- */
.howit { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-alt); padding: 10px 12px; margin: 8px 0 10px; }
.howit .q { font-weight: 700; color: var(--brand); font-size: 13px; margin-bottom: 8px; line-height: 1.35; }
.howit .q .roles { font-weight: 600; color: var(--accent); font-size: 11px; margin-left: 6px; letter-spacing: .04em; }
.hw3 { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 18px; position: relative; }
.hw3 > .col { min-width: 0; position: relative; }
.hw3 > .col:not(:last-child)::after { content: "\2192"; position: absolute; right: -14px; top: 0; color: var(--accent); font-weight: 700; }
.hw-in { display: grid; grid-template-columns: 1fr auto; gap: 6px; font-size: 11px; padding: 2px 4px; border-radius: 4px; transition: background-color .6s; }
.hw-in .n { font-family: var(--font-mono); color: var(--muted); }
.hw-in.hot { background: var(--tone-info-bg); }
.hw-in.hot .n { color: var(--accent); font-weight: 700; }
.hw-steps { margin: 2px 0 6px 16px; padding: 0; font-size: 11px; color: var(--ink); }
.hw-steps li { margin: 0 0 2px 0; line-height: 1.35; }
.hw-now { display: flex; flex-wrap: wrap; gap: 4px; }
.hw-now span { font-family: var(--font-mono); font-size: 11px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 6px; }
.hw-out { font-size: 11px; color: var(--muted); }
.hw-says { margin-top: 6px; font-size: 12px; line-height: 1.4; border-left: 3px solid var(--line-strong); padding-left: 8px; }
.hw-says.lv-ok { border-left-color: var(--verdict-green); }
.hw-says.lv-info { border-left-color: var(--accent); }
.hw-says.lv-warn { border-left-color: var(--verdict-amber); }
.hw-says.lv-alert { border-left-color: var(--verdict-red); }
.hw-says .act { color: var(--muted-deep); margin-top: 2px; }
.hw-score { margin-top: 6px; font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
@media (max-width: 1100px) { .hw3 { grid-template-columns: 1fr; } .hw3 > .col:not(:last-child)::after { content: "\2193"; right: auto; left: 0; top: auto; bottom: -14px; } }

/* ---- role screens: advisories, filed issues, the report box ----------------------------------------------- */
.adv { display: grid; grid-template-columns: 12px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.adv:last-child { border-bottom: 0; }
.adv .dot { width: 10px; height: 10px; border-radius: 5px; margin-top: 4px; background: var(--muted-soft); }
.adv .dot.lv-ok { background: var(--verdict-green); }
.adv .dot.lv-info { background: var(--accent); }
.adv .dot.lv-warn { background: var(--verdict-amber); }
.adv .dot.lv-alert { background: var(--verdict-red); }
.adv .who { font-size: 11px; color: var(--muted); }
.adv .who a { font-weight: 600; }
.adv .act { color: var(--muted-deep); font-size: 12px; margin-top: 2px; }
.report-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: start; }
.report-row textarea { min-height: 52px; font-family: var(--font-family); font-size: var(--font-sm); }
.report-btns { display: flex; flex-direction: column; gap: 6px; }
#report-voice.rec { background: var(--tone-err-bg); color: var(--tone-err-text); border-color: var(--tone-err-border); }
.issue { font-size: 12px; padding: 5px 0; border-bottom: 1px solid var(--line-soft); }
.issue:last-child { border-bottom: 0; }
.issue .cat { font-weight: 700; color: var(--brand); }
.msg .cites { margin-top: 6px; font-size: 11px; color: var(--muted); }
.msg .cites div { margin: 1px 0; }

/* ---- the agent browser: every agent checked and editable, by level of detail (Agents > All agents) ---------- */
.ab-toolbar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 8px; }
.ab-levels { display: inline-flex; align-items: center; gap: 2px; background: var(--surface-muted); padding: 4px; border-radius: 10px; flex-wrap: wrap; }
.ab-levels .lbl { padding: 0 8px 0 4px; }
.ab-levels button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 7px; font-size: 12.5px; }
.ab-levels button:hover { background: var(--chip-hover-bg); }
.ab-levels button.on { background: var(--accent); color: var(--surface); }
#ab-search { width: 280px; max-width: 100%; }
.ab-toolbar .toggle { margin: 0; }
#agent-filter .n { font-family: var(--font-mono); font-size: 11px; color: var(--muted-soft); margin-left: 2px; }
.ab-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12.5px; margin: 0 0 12px; }
.ab-checks .cs { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; }
.ab-fam { margin-bottom: 14px; }
.ab-fam > h3 { font-size: 13px; color: var(--brand); text-transform: uppercase; letter-spacing: .5px; margin: 6px 0 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ab-fam > h3 .n { font-family: var(--font-mono); color: var(--muted); font-size: 12px; }
.ab-fam > h3 .about { color: var(--muted-soft); text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; }
.ab { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line); border-radius: var(--radius-md); margin-bottom: 6px; transition: box-shadow .3s; }
.ab[data-status="ok"] { border-left-color: var(--verdict-green); }
.ab[data-status="attention"] { border-left-color: var(--verdict-amber); }
.ab[data-status="fault"] { border-left-color: var(--verdict-red); }
.ab.off { opacity: .62; border-left-color: var(--muted-soft); }
.ab.flash { box-shadow: 0 0 0 3px var(--tone-info-border); }
.ab-row { display: grid; grid-template-columns: 10px minmax(150px, 240px) auto minmax(0, 1fr) auto auto auto; gap: 3px 10px; align-items: center; padding: 7px 10px 6px; }
.ab-sub { grid-column: 2 / -1; display: flex; gap: 16px; min-width: 0; }
.ab-sub .ab-q { flex: 1.25 1 0; }
.ab-sub .ab-last { flex: 1 1 0; }
.ab-name { border: 0; background: none; padding: 0; font-weight: 700; color: var(--brand); text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ab-name:hover { background: none; color: var(--accent); text-decoration: underline; }
.ab-q, .ab-last { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ab-q { color: var(--muted-deep); }
.ab-last { border-left: 3px solid var(--line-strong); padding-left: 6px; }
.ab-last.lv-ok { border-left-color: var(--verdict-green); }
.ab-last.lv-info { border-left-color: var(--accent); }
.ab-last.lv-warn { border-left-color: var(--verdict-amber); }
.ab-last.lv-alert { border-left-color: var(--verdict-red); }
.ab-roles { font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge.fam { font-size: 11px; padding: 2px 8px; text-align: center; }
.badge.fam-core { background: var(--surface-muted); color: var(--brand); }
.badge.fam-advisor { background: var(--tone-info-bg); color: var(--accent); }
.badge.fam-oversight { background: var(--tone-warn-bg); color: var(--tone-warn-text); }
.badge.fam-rule, .badge.fam-decision, .badge.fam-learned { background: var(--tone-ok-bg); color: var(--tone-ok-text); }
.ab-lod { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.ab-lod button { border: 0; border-radius: 0; padding: 3px 7px; font-size: 11px; color: var(--muted); background: var(--surface); border-right: 1px solid var(--line-soft); }
.ab-lod button:last-child { border-right: 0; }
.ab-lod button:hover { background: var(--tone-info-bg); }
.ab-lod button.on { background: var(--accent); color: var(--surface); }
.ab .toggle { margin: 0; justify-self: end; }
.st { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; background: var(--verdict-green); }
.st-attention { background: var(--verdict-amber); }
.st-fault { background: var(--verdict-red); }
.st-off { background: var(--muted-soft); }
.st-info { background: var(--accent); }
.grade { font-size: 11px; font-weight: 700; border-radius: 10px; padding: 2px 8px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-production { background: var(--tone-ok-bg); color: var(--tone-ok-text); }
.g-research { background: var(--tone-info-bg); color: var(--accent); }
.g-indicative { background: var(--tone-todo-bg); color: var(--muted); }
.g-meter { border: 1px solid var(--line-strong); color: var(--muted-deep); }
.g-none { color: var(--muted-soft); }
.ab-sec { border-top: 1px dashed var(--line); padding: 10px 12px 12px; }
.ab-sec .howit { margin-top: 6px; }
.ab-tbl { max-height: none; margin-top: 4px; }
.ab-tbl .grid td { white-space: normal; font-family: var(--font-family); max-width: 420px; vertical-align: top; }
.ab-tbl .grid td.mono, .ab-tbl .grid td .mono { font-family: var(--font-mono); font-size: 11.5px; }
.ab-tbl .grid td.r { text-align: right; }
.ab-tbl tr.silent td { color: var(--muted-soft); }
.src, .scr { display: inline-block; font-size: 11px; border-radius: 8px; padding: 0 6px; margin: 1px 2px 1px 0; background: var(--surface-alt); border: 1px solid var(--line); font-family: var(--font-mono); }
.scr { background: var(--tone-info-bg); border-color: var(--tone-info-border); color: var(--tone-info-text); }
.ab-set td.k { white-space: nowrap; }
.ab-set td.h { color: var(--muted-deep); font-size: 12px; min-width: 240px; }
.ab-set td.d { white-space: nowrap; color: var(--muted); }
.ab-set tr.changed td.k .mono { color: var(--accent); font-weight: 700; }
.ab-set tr.pending td { background: var(--tone-warn-bg) !important; }
.ab-set tr.edited td { background: var(--tone-info-bg) !important; }
.ab-set .vin { display: flex; align-items: center; gap: 4px; }
.ab-set .vin input, .ab-set .vin select { width: 110px; padding: 3px 6px; font-size: 12px; }
.ab-set .vin input.wide { width: 260px; font-family: var(--font-mono); }
.ab-set .vin input:focus, .ab-set .vin select:focus { padding: 2px 5px; }
.ab-set .unit { font-size: 11px; color: var(--muted); white-space: nowrap; }
.when { font-size: 11px; font-weight: 600; border-radius: 8px; padding: 1px 7px; white-space: nowrap; }
.w-now { background: var(--tone-ok-bg); color: var(--tone-ok-text); }
.w-restart { background: var(--tone-info-bg); color: var(--accent); }
.w-next-start { background: var(--tone-warn-bg); color: var(--tone-warn-text); }
.ab-aud { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin: 10px 0 2px; }
.ab-aud .chk { display: inline-flex; gap: 4px; align-items: center; margin: 0; color: var(--ink); font-weight: 600; font-size: 12px; }
.ab-feeds { margin: 10px 0 0; }
.ab-feeds textarea { font-family: var(--font-family); font-size: 12px; margin-top: 4px; }
.ab-save { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.ab-save .ab-reason { flex: 1 1 240px; width: auto; }
.ab-msg { flex-basis: 100%; }
.ab-hist { margin-top: 8px; font-size: 12px; }
.ab-hist summary, .ab-doc summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 12px; }
.ab-hist ul { margin: 6px 0 0; padding: 0; list-style: none; }
.ab-hist li { padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.ab-ev2 { display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; }
.checks { margin: 6px 0 0; padding: 0; list-style: none; font-size: 12px; }
.checks li { display: grid; grid-template-columns: 12px minmax(110px, auto) 1fr; gap: 8px; align-items: baseline; padding: 3px 0; border-bottom: 1px solid var(--line-soft); }
.checks li .st { width: 9px; height: 9px; }
.ab-doc { margin-top: 10px; }
#agent-dash.busy { opacity: .72; transition: opacity .15s; }
.ab-ev .dot { width: 8px; height: 8px; margin-right: 3px; background: var(--muted-soft); }
.ab-ev .dot.lv-ok { background: var(--verdict-green); }
.ab-ev .dot.lv-info { background: var(--accent); }
.ab-ev .dot.lv-warn { background: var(--verdict-amber); }
.ab-ev .dot.lv-alert { background: var(--verdict-red); }
.ab-loading { font-style: italic; }
pre.doc { white-space: pre-wrap; font-family: var(--font-family); font-size: 12px; line-height: 1.5; background: var(--surface-alt); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 10px 12px; max-height: 380px; overflow: auto; margin: 6px 0 0; }
@media (max-width: 760px) {
  .ab-row { grid-template-columns: 10px minmax(0, 1fr) auto auto auto; }
  .ab-row .badge.fam, .ab-row .ab-roles { display: none; }
  .ab-sub { flex-direction: column; gap: 2px; }
  .ab-ev2 { grid-template-columns: 1fr; }
  .ab-levels button { padding: 5px 8px; }
}

/* outside agents (automap/federation.py) */
.ab-ext .ab-name { font-weight: 600; padding: 0; }
.ab-ext .ab-sec > div { margin: 2px 0; }
.ab-ext code { font-size: 11px; }
.badge.fam-ext { background: transparent; border: 1px dashed currentColor; }

/* a deployment's sign-in (the server needs a token) */
.signin-veil { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(15, 25, 40, .62); }
.signin { max-width: 440px; width: calc(100% - 32px); padding: 18px 20px; }
.signin input { width: 100%; margin: 8px 0 4px; }
.signin-err { color: var(--tone-err-text); min-height: 1.2em; }
