:root {
  --ground: #f6f7fb; --surface: #ffffff; --surface-2: #eef0f7; --border: #e2e6f0;
  --border-strong: #d2d8e6; --ink: #191d2c; --muted: #626b84; --faint: #929ab2;
  --accent: #5560ff; --accent-ink: #ffffff; --accent-soft: rgba(85, 96, 255, .10);
  --ok: #0f9a6c; --ok-soft: rgba(15, 154, 108, .13); --warn: #b3760f;
  --warn-soft: rgba(196, 137, 25, .15); --crit: #d33a58; --crit-soft: rgba(211, 58, 88, .12);
  --shadow: 0 1px 2px rgba(20, 25, 45, .05), 0 10px 26px -14px rgba(20, 25, 45, .16);
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0c0f1a; --surface: #141a2a; --surface-2: #1b2236; --border: #29314c;
    --border-strong: #3a4462; --ink: #e9ecf8; --muted: #8c94ae; --faint: #626b86;
    --accent: #808dff; --accent-ink: #0c0f1a; --accent-soft: rgba(128, 141, 255, .15);
    --ok: #37c692; --ok-soft: rgba(55, 198, 146, .14); --warn: #e0a63c;
    --warn-soft: rgba(224, 166, 60, .15); --crit: #ee5f79; --crit-soft: rgba(238, 95, 121, .15);
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 34px -18px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="light"] {
  --ground: #f6f7fb; --surface: #ffffff; --surface-2: #eef0f7; --border: #e2e6f0;
  --border-strong: #d2d8e6; --ink: #191d2c; --muted: #626b84; --faint: #929ab2;
  --accent: #5560ff; --accent-ink: #ffffff; --accent-soft: rgba(85, 96, 255, .10);
  --ok: #0f9a6c; --ok-soft: rgba(15, 154, 108, .13); --warn: #b3760f;
  --warn-soft: rgba(196, 137, 25, .15); --crit: #d33a58; --crit-soft: rgba(211, 58, 88, .12);
  --shadow: 0 1px 2px rgba(20, 25, 45, .05), 0 10px 26px -14px rgba(20, 25, 45, .16);
}
:root[data-theme="dark"] {
  --ground: #0c0f1a; --surface: #141a2a; --surface-2: #1b2236; --border: #29314c;
  --border-strong: #3a4462; --ink: #e9ecf8; --muted: #8c94ae; --faint: #626b86;
  --accent: #808dff; --accent-ink: #0c0f1a; --accent-soft: rgba(128, 141, 255, .15);
  --ok: #37c692; --ok-soft: rgba(55, 198, 146, .14); --warn: #e0a63c;
  --warn-soft: rgba(224, 166, 60, .15); --crit: #ee5f79; --crit-soft: rgba(238, 95, 121, .15);
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 34px -18px rgba(0, 0, 0, .7);
}

* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--font-ui); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  height: 100vh; display: flex; flex-direction: column; overflow: hidden;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 20px clamp(14px, 3vw, 28px) 56px; }

.topbar { flex: none; display: flex; align-items: center; gap: 14px;
  padding: 11px clamp(14px, 3vw, 24px); border-bottom: 1px solid var(--border); background: var(--surface); }
.brand { display: flex; align-items: center; gap: 11px; }
.glyph { width: 34px; height: 34px; border-radius: 9px; flex: none; background: var(--accent);
  color: var(--accent-ink); display: grid; place-items: center; font-size: 18px; box-shadow: var(--shadow); }
.brand h1 { font-size: 16px; margin: 0; letter-spacing: -.01em; }
.brand .sub { margin: 0; font-size: 11.5px; color: var(--muted); }
.topbar .spacer { flex: 1; }
.tag { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em; text-transform: uppercase;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 4px 9px; border-radius: 999px; }
.theme-btn { font: inherit; font-size: 12.5px; color: var(--muted); cursor: pointer; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 12px; display: inline-flex; align-items: center; gap: 7px; }
.theme-btn:hover { color: var(--ink); border-color: var(--border-strong); }
.theme-btn:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.status { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: 13px; overflow: hidden; box-shadow: var(--shadow); }
.stat { background: var(--surface); padding: 13px 16px; display: flex; flex-direction: column; gap: 3px; }
.stat .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.stat .v { font-size: 19px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; }
.stat .v small { font-size: 12px; font-weight: 500; color: var(--muted); font-family: var(--font-mono); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.live { background: var(--ok); animation: pulse 2.4s infinite; }
.dot.halt { background: var(--crit); }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.killcell { background: var(--surface); display: grid; place-items: center; padding: 10px 16px; }
.kill { font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--crit);
  background: var(--crit-soft); border: 1px solid color-mix(in srgb, var(--crit) 34%, transparent);
  border-radius: 8px; padding: 9px 15px; white-space: nowrap; }
.kill:hover { background: var(--crit); color: #fff; }
.kill.on { background: var(--crit); color: #fff; }

.cols { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; box-shadow: var(--shadow); }
.phead { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--border); }
.phead h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0; font-weight: 600; }
.phead .count { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.phead .spacer { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 18px; }

.agents { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--border); border-radius: 0 0 13px 13px; overflow: hidden; }
.agent { background: var(--surface); padding: 13px 15px; display: flex; flex-direction: column; gap: 9px; }
.agent .row1 { display: flex; align-items: flex-start; gap: 8px; }
.agent .name { font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; }
.agent .arch { font-size: 11px; color: var(--muted); margin-top: 1px; }
.agent .rung { font-family: var(--font-mono); font-size: 10px; color: var(--faint); margin-top: 6px; letter-spacing: .02em; }
.chip { font-size: 10.5px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.chip.active { color: var(--ok); background: var(--ok-soft); }
.chip.planned { color: var(--muted); background: var(--surface-2); }
.chip.paused { color: var(--warn); background: var(--warn-soft); }
.agent .ctl { display: flex; gap: 6px; margin-top: 2px; }
.mini { font: inherit; font-size: 11px; color: var(--muted); cursor: pointer; background: transparent;
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 9px; }
.mini:hover { color: var(--ink); border-color: var(--border-strong); background: var(--surface-2); }
.mini.on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }

.tscroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 460px; }
th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint);
  font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--border); }
td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td .svc { font-family: var(--font-mono); font-size: 11.5px; }
.pill { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.pill.ok { color: var(--ok); background: var(--ok-soft); }
.pill.sched { color: var(--muted); background: var(--surface-2); }
.pill.fail { color: var(--crit); background: var(--crit-soft); }
.link { color: var(--accent); text-decoration: none; font-weight: 500; cursor: pointer; }
.link:hover { text-decoration: underline; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--muted); }

.find { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.find:last-child { border-bottom: none; }
.find.resolved { opacity: .55; }
.sev { width: 3px; border-radius: 3px; flex: none; }
.sev.high { background: var(--crit); }
.sev.med { background: var(--warn); }
.sev.low { background: var(--muted); }
.find .body { flex: 1; min-width: 0; }
.find .ftop { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; flex-wrap: wrap; }
.sevtag { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 2px 6px; border-radius: 5px; }
.sevtag.high { color: var(--crit); background: var(--crit-soft); }
.sevtag.med { color: var(--warn); background: var(--warn-soft); }
.sevtag.low { color: var(--muted); background: var(--surface-2); }
.fid { font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.find .title { font-size: 13px; font-weight: 550; letter-spacing: -.005em; }
.find .src { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 3px; word-break: break-all; }
.find .verify { font-size: 10.5px; color: var(--warn); }
.find .state { font-size: 10.5px; font-weight: 600; }
.find .state.approved { color: var(--ok); }
.find .state.dismissed { color: var(--muted); }
.factions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.guard { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 11px;
  background: var(--crit-soft); border: 1px solid color-mix(in srgb, var(--crit) 26%, transparent); }
.guard .lk { font-size: 15px; }
.guard .txt { font-size: 11.5px; color: var(--ink); }
.guard .txt b { color: var(--crit); }

.stages { padding: 6px 16px 14px; }
.stg { display: flex; gap: 12px; padding: 10px 0; }
.stg .marker { display: flex; flex-direction: column; align-items: center; }
.stg .ball { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); margin-top: 3px; }
.stg.now .ball { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.stg .line { width: 2px; flex: 1; background: var(--border); margin: 4px 0 -14px; }
.stg:last-child .line { display: none; }
.stg .lbl { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.stg .lbl .badge { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--accent); background: var(--accent-soft); padding: 2px 6px; border-radius: 5px; }
.stg .desc { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.stg.todo .lbl { color: var(--muted); }

.log { font-family: var(--font-mono); font-size: 11.5px; line-height: 1.75; padding: 12px 16px; max-height: 232px; overflow: auto; }
.log .ln { display: flex; gap: 10px; white-space: nowrap; }
.log .t { color: var(--faint); }
.log .ag { color: var(--accent); }
.log .ev { color: var(--muted); }
.log .ev.ok { color: var(--ok); }
.log .ev.warn { color: var(--warn); }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: var(--ground); font-size: 12.5px; font-weight: 500; padding: 10px 16px;
  border-radius: 9px; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .22s, transform .22s; z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footnote { margin-top: 22px; font-size: 11.5px; color: var(--faint); text-align: center; }
.empty { padding: 16px; font-size: 12px; color: var(--faint); }

/* ---- expandable agents (own inbox + notif badge) ---- */
.agents { display: flex; flex-direction: column; }
.agent { padding: 0; gap: 0; }
.agent-head { display: flex; align-items: flex-start; gap: 10px; padding: 13px 15px; cursor: pointer; }
.agent-head:hover { background: var(--surface-2); }
.agent-main { flex: 1; min-width: 0; }
.agent-side { display: flex; align-items: center; gap: 8px; flex: none; }
.notif { min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px; background: var(--crit);
  color: #fff; font-size: 10.5px; font-weight: 700; display: inline-grid; place-items: center;
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.caret { color: var(--faint); font-size: 11px; transition: transform .18s; }
.agent.open .caret { transform: rotate(90deg); }
.agent-ctl { display: flex; gap: 6px; padding: 0 15px 12px; }
.agent-inbox { display: none; border-top: 1px solid var(--border); background: var(--surface-2); }
.agent.open .agent-inbox { display: block; }
.agent-inbox .find { background: transparent; }
.frepo { font-size: 10.5px; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 5px; }

/* ---- repos ---- */
.repo-row { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-bottom: 1px solid var(--border); }
.repo-row:last-child { border-bottom: none; }
.repo-main { flex: 1; min-width: 0; }
.repo-name { font-size: 12.5px; font-weight: 600; font-family: var(--font-mono); }
.repo-desc { font-size: 11px; color: var(--muted); margin-top: 1px; }
.repo-tag { font-size: 10px; font-weight: 600; color: var(--ok); background: var(--ok-soft);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.repo-picker { border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 13px 13px; }
.picker-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); padding: 11px 16px 4px; }
.repo-search { display: block; width: calc(100% - 32px); margin: 4px 16px 8px; padding: 8px 11px;
  font: inherit; font-size: 12.5px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 8px; }
.repo-search::placeholder { color: var(--faint); }
.repo-search:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.repo-picker .repo-row:last-child { border-bottom: none; }
.clone-chip { font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.clone-chip.local { color: var(--ok); background: var(--ok-soft); }
.clone-chip.cloning { color: var(--warn); background: var(--warn-soft); }
.clone-chip.remote { color: var(--muted); background: var(--surface-2); }
#refreshReposBtn[disabled] { opacity: .6; cursor: default; }

/* ---- onboarded repo rows: expandable, per-agent permissions ---- */
.repo-item { border-bottom: 1px solid var(--border); }
.repo-item:last-child { border-bottom: none; }
.repo-item .repo-row { border-bottom: none; }
.repo-head { cursor: pointer; }
.repo-head:hover { background: var(--surface-2); }
.asg-chip { font-size: 10px; font-weight: 600; color: var(--accent); background: var(--accent-soft);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.asg-chip.none { color: var(--faint); background: var(--surface-2); }
.repo-tag.prot { color: var(--crit); background: var(--crit-soft); }
.repo-item.open .caret { transform: rotate(90deg); }
.repo-perms { display: none; padding: 8px 16px 12px; background: var(--surface-2); border-top: 1px solid var(--border); }
.repo-item.open .repo-perms { display: block; }
.perm-note { font-size: 10.5px; color: var(--crit); margin: 2px 0 8px; }
.perm-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.perm-agent { flex: 1; font-size: 12px; }
.perm-sel { font: inherit; font-size: 11.5px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.perm-sel:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

@media (max-width: 860px) {
  .cols { grid-template-columns: 1fr; }
  .status { grid-template-columns: repeat(2, 1fr); }
  .killcell { grid-column: 1 / -1; }
  .agents { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- models (rotation roster) ---- */
.mhint { font-size: 11.5px; color: var(--muted); padding: 0 2px 10px; line-height: 1.45; }
.rounds-ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.rounds-n { min-width: 14px; text-align: center; color: var(--ink); font-size: 12.5px; }
.model-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-top: 1px solid var(--border); }
.model-row:first-child { border-top: 0; }
.model-row.on .model-ord { color: var(--accent); }
.model-ord { color: var(--faint); font-size: 11px; width: 12px; text-align: center; }
.model-main { flex: 1; min-width: 0; }
.model-name { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.prov { font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 5px; color: var(--muted); background: var(--surface-2); }
.prov.anthropic { color: var(--accent); background: var(--accent-soft); }
.model-id { font-size: 11px; color: var(--muted); }
.model-actions { display: flex; align-items: center; gap: 5px; flex: none; }
.model-actions .mini { padding: 3px 7px; }
.model-actions .mini:disabled { opacity: .35; cursor: default; }

.rotation { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border-strong);
  display: grid; gap: 12px; }
.rot-block { display: grid; gap: 6px; }
.rot-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); }
.rot-panel { font-size: 12.5px; color: var(--ink); font-family: var(--font-mono); }
.rot-note { font-size: 11.5px; color: var(--warn); }
.rot-round { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.rot-round .rn { font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  background: var(--surface-2); border-radius: 5px; padding: 2px 6px; flex: none; }
.rot-round .role { padding: 2px 8px; border-radius: 6px; font-weight: 500; }
.rot-round .role.coder { color: var(--accent); background: var(--accent-soft); }
.rot-round .role.rev { color: var(--ok); background: var(--ok-soft); }

/* ---- models: credential line + polish (overrides above) ---- */
.model-row { align-items: center; padding: 11px 2px; }
.model-main { display: grid; gap: 4px; }
.model-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.model-id { font: inherit; font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  background: transparent; border: 0; padding: 0; cursor: pointer; }
.model-id:hover { color: var(--ink); text-decoration: underline; }
.cred { font: inherit; font-size: 10px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
  border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; }
.cred .mono { font-size: 9.5px; letter-spacing: .01em; }
.cred.ok { color: var(--ok); background: var(--ok-soft); cursor: default; }
.cred.miss { color: var(--warn); background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 32%, transparent); }
.cred.miss:hover { background: color-mix(in srgb, var(--warn) 22%, transparent); }
.cred.none { color: var(--muted); background: var(--surface-2); }
.cred.none:hover { color: var(--ink); }
.model-actions { gap: 6px; }
.model-actions .arrow { padding: 4px 7px; line-height: 1; color: var(--faint);
  opacity: 0; transition: opacity .12s ease; }
.model-row:hover .arrow, .model-actions .arrow:focus-visible { opacity: 1; }
.model-actions .arrow:not(:disabled):hover { color: var(--ink); }
.model-row:hover { background: var(--surface-2); border-radius: 8px; }
.rotation { margin-bottom: 4px; }
.rounds-ctl .mini { padding: 4px 9px; }

/* ---- cost projection ---- */
.price { font: inherit; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  padding: 2px 8px; border-radius: 6px; border: 1px solid transparent; cursor: pointer;
  color: var(--accent); background: var(--accent-soft); }
.price:hover { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
/* Accounts + spend */
.accounts-wrap { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border-strong); }
.acc-head { display: flex; align-items: center; gap: 10px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--faint); margin-bottom: 8px; }
.acc-head .spacer { flex: 1; }
.acc-head .spend { text-transform: none; letter-spacing: 0; font-size: 11.5px; color: var(--muted); }
.acc-head .spend b { color: var(--ink); font-family: var(--font-mono); }
.acc-head .spend .shadow { color: var(--faint); }
.ahint { font-size: 11.5px; color: var(--muted); padding: 0 2px 8px; line-height: 1.45; }
.acct { display: flex; align-items: center; gap: 9px; padding: 8px 4px; border-radius: 8px;
  font-size: 12.5px; }
.acct:hover { background: var(--surface-2); }
.acct.off { opacity: .5; }
.acct .aname { font-weight: 600; }
.acct .spacer { flex: 1; }
.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.amode { font-size: 9.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; }
.amode.sub { color: var(--ok); background: var(--ok-soft); }
.amode.api { color: var(--accent); background: var(--accent-soft); }
.adef { font-size: 9px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint);
  border: 1px solid var(--border-strong); padding: 1px 6px; border-radius: 999px; }
/* account row action cluster — secondary actions reveal on hover */
.acct-actions { display: inline-flex; align-items: center; gap: 5px; flex: none; }
.acct-actions .mini { padding: 3px 8px; }
.mini.danger { color: var(--faint); }
.mini.danger:hover { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 40%, transparent); background: var(--crit-soft); }
.row-hide { opacity: 0; transition: opacity .12s ease; }
.acct:hover .row-hide, .row-hide:focus-visible { opacity: 1; }
/* inline add-account form */
.acct-form { display: grid; gap: 8px; margin-top: 10px; padding: 12px; border: 1px solid var(--border-strong);
  border-radius: 10px; background: var(--surface-2); }
.af-row { display: flex; gap: 8px; }
.af-in { font: inherit; font-size: 12.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 7px; padding: 7px 9px; min-width: 0; }
.af-in:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.af-in { cursor: pointer; }
.af-grow { flex: 1; }
.af-actions { display: flex; justify-content: flex-end; gap: 8px; }
.af-actions .mini { padding: 6px 12px; }
/* LLM reasoning on a finding */
.fdetail { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 4px 0 2px;
  padding-left: 8px; border-left: 2px solid var(--border-strong); }

/* ===================================================== app shell (routed) */
.layout { flex: 1; display: flex; min-height: 0; }
.side { width: 250px; flex: none; overflow: auto; border-right: 1px solid var(--border);
  background: var(--surface); padding: 14px 12px; display: flex; flex-direction: column; gap: 6px; }
.main { flex: 1; min-width: 0; overflow: auto; padding: 20px clamp(14px, 3vw, 28px) 60px;
  display: flex; flex-direction: column; gap: 18px; }

.side-status { display: flex; align-items: center; gap: 9px; padding: 8px 10px; margin-bottom: 6px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.ss-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--muted); }
.ss-dot.live { background: var(--ok); animation: pulse 2.4s infinite; }
.ss-dot.halt { background: var(--crit); }
.ss-main { flex: 1; display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.ss-main #side-status { font-size: 12.5px; font-weight: 600; }
.ss-main small { font-size: 10.5px; color: var(--faint); font-family: var(--font-mono); }
.side-status .kill { padding: 5px 9px; font-size: 13px; line-height: 1; }

.nav-group { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--faint);
  padding: 12px 10px 4px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
  text-decoration: none; color: var(--muted); font-size: 13px; font-weight: 500; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .ni-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ni-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--muted); }
.ni-dot.live { background: var(--ok); }
.ni-dot.warn { background: var(--warn); }
.ni-dot.idle { background: var(--faint); }
.nav-item.flat { padding-left: 10px; }
.nav-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--crit);
  background: var(--crit-soft); border-radius: 999px; padding: 1px 7px; }
.nav-item.active .nav-badge { color: var(--crit); }

/* breadcrumb + hero */
.crumb { font-size: 12px; color: var(--faint); display: flex; gap: 7px; align-items: center; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--accent); }
.crumb b { color: var(--ink); }
.agent-hero { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.ah-main { flex: 1; min-width: 0; }
.ah-title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; display: flex; align-items: center; gap: 9px; }
.ah-sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.ah-ctl { display: flex; gap: 7px; flex: none; }

.phead.sub { border: 0; padding: 2px 2px 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-repo { display: grid; grid-template-columns: 1.5fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 900px) { .grid2, .grid-repo { grid-template-columns: 1fr; } }

/* repo cards on an agent page */
.repo-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.repo-card { position: relative; display: flex; flex-direction: column; gap: 9px; padding: 14px 15px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; text-decoration: none;
  color: inherit; box-shadow: var(--shadow); }
.repo-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.rc-top { display: flex; align-items: center; gap: 7px; }
.rc-name { font-size: 13.5px; font-weight: 600; letter-spacing: -.01em; }
.rc-meta { display: flex; flex-direction: column; gap: 3px; }
.rc-find { font-size: 12px; font-weight: 600; color: var(--muted); }
.rc-find.high { color: var(--crit); }
.rc-find.none { color: var(--faint); font-weight: 500; }
.rc-run { font-size: 11px; color: var(--faint); font-family: var(--font-mono); }
.rc-perm { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; margin-left: auto; }
.rc-caret { position: absolute; top: 13px; right: 14px; color: var(--faint); font-size: 14px; }
.repo-card:hover .rc-caret { color: var(--accent); }

/* findings list wrapper on the repo page */
.find-list { background: var(--surface); border: 1px solid var(--border); border-radius: 13px;
  overflow: hidden; box-shadow: var(--shadow); }
.rrow { cursor: pointer; }
.empty.pad { padding: 22px 16px; }

/* ===================================================== clouds page */
.cloudhint { font-size: 11.5px; color: var(--muted); line-height: 1.5; padding: 0 2px 4px; }
.cloud-card .phead { flex-wrap: wrap; gap: 8px; }
.cloud-card .phead h2 { text-transform: none; letter-spacing: -.01em; font-size: 14px; color: var(--ink); }
.cloud-body { padding: 14px 16px 16px; }
.cloud-status { font-size: 11.5px; font-family: var(--font-mono); padding: 7px 10px; border-radius: 8px;
  margin-bottom: 12px; }
.cloud-status.ok { color: var(--ok); background: var(--ok-soft); }
.cloud-status.warn { color: var(--warn); background: var(--warn-soft); }
.cproj-head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint);
  margin-bottom: 6px; }
.cproj-list { display: flex; flex-direction: column; }
.cproj { display: flex; align-items: center; gap: 10px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.cproj:last-child { border-bottom: 0; }
.cproj.target { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.ptoggle { font: inherit; font-size: 15px; line-height: 1; cursor: pointer; background: none; border: 0;
  color: var(--faint); padding: 0 2px; }
.cproj.target .ptoggle { color: var(--accent); }
.cp-ref { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.cp-name { font-size: 12px; color: var(--muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cp-region { font-size: 11px; color: var(--faint); }
.cp-env { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 6px; color: var(--muted); background: var(--surface-2); }
.cp-env.env-prod { color: var(--crit); background: var(--crit-soft); }
.cp-env.env-staging { color: var(--warn); background: var(--warn-soft); }
.cp-env.env-test, .cp-env.env-dev { color: var(--ok); background: var(--ok-soft); }

/* ---- auth + RBAC (login, setup, accept-invite, admin) ---- */
.userbox { display: inline-flex; align-items: center; gap: 10px; }
.user-chip { display: inline-flex; flex-direction: column; line-height: 1.15;
  font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; }
.user-chip small { font-weight: 500; font-size: 11px; color: var(--faint);
  text-transform: none; letter-spacing: 0; }

.auth-wrap { min-height: 60vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 16px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { margin: 0 0 4px; }
.auth-sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px;
  font-weight: 600; color: var(--muted); }
.auth-form label small { font-weight: 500; color: var(--faint); }
.auth-form input { padding: 9px 11px; border: 1px solid var(--border-strong);
  border-radius: 8px; background: var(--surface); color: var(--ink);
  font-size: 14px; font-family: var(--font-ui); }
.auth-form input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.mini.wide, button.wide { width: 100%; justify-content: center; padding: 9px; margin-top: 4px;
  text-align: center; }
.auth-err { display: block; color: var(--crit); background: var(--crit-soft);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; font-weight: 600; }

/* admin */
.admin-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px;
  border-bottom: 1px solid var(--border); font-size: 13px; }
.admin-row:last-child { border-bottom: 0; }
.ar-main { display: inline-flex; flex-direction: column; line-height: 1.2; min-width: 180px; }
.ar-main small { color: var(--faint); font-weight: 500; }
.ar-roles { color: var(--muted); font-size: 12px; margin-left: auto; }
.admin-row .mini { flex: none; }
.role-block { padding: 10px 0; border-bottom: 1px solid var(--border); }
.role-block:last-child { border-bottom: 0; }
.role-head { display: flex; align-items: center; gap: 8px; }
.role-desc { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
.role-perms { display: flex; flex-wrap: wrap; gap: 5px; }
.perm-chip { font-family: var(--font-mono); font-size: 11px; padding: 2px 7px;
  border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.invite-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.invite-form input[type=email] { flex: 1; min-width: 200px; padding: 8px 11px;
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface);
  color: var(--ink); font-size: 14px; }
.role-picks { display: inline-flex; flex-wrap: wrap; gap: 10px; }
.rp { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.invite-link { margin-top: 12px; font-size: 12px; color: var(--muted); }
.link-input { width: 100%; margin-top: 6px; padding: 8px 10px; font-family: var(--font-mono);
  font-size: 12px; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--accent-soft); color: var(--ink); }
