:root {
  --bg: #ffffff;
  --panel: #f7f8fa;
  --border: #e6e8eb;
  --text: #16191f;
  --dim: #5f6b7a;
  --sre: #2f6feb;      /* SRE Agent (blue) */
  --sre-bg: #eef4ff;
  --devops: #e8830c;   /* AWS DevOps Agent (orange) */
  --devops-bg: #fff4e6;
  --ok: #1a9e5f;
  --warn: #e8830c;
  --err: #d6336c;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
.hidden { display: none !important; }

.app { display: grid; grid-template-columns: 248px 1fr; height: 100vh; height: 100dvh; overflow: hidden; }

/* Mobile-only chrome (hidden on desktop) */
.menu-btn { display: none; background: none; border: none; font-size: 20px; line-height: 1;
  cursor: pointer; color: var(--text); padding: 4px 8px; margin-right: 2px; border-radius: 8px; }
.menu-btn:hover { background: var(--panel); }
.backdrop { display: none; }

/* Sidebar (fixed; only its list scrolls) */
.sidebar {
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 12px;
  background: #fcfcfd;
  height: 100vh; height: 100dvh; overflow: hidden;
}
.new-chat {
  width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff; cursor: pointer; font-size: 14px;
}
.new-chat:hover { background: var(--panel); }
.side-section { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--dim); padding: 4px 8px; }
.side-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }

/* Scroll wrapper holding Examples + Investigations (each content-sized) */
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.side-scroll .side-list { flex: 0 0 auto; overflow: visible; }

/* Inline investigations history */
.inv-head { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; overflow: hidden; }
.inv-head > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-count {
  flex: none; background: var(--panel); color: var(--dim); border-radius: 999px;
  font-size: 10px; font-weight: 700; padding: 1px 7px; line-height: 1.6;
}
.inv-viewall {
  margin-left: auto; flex: none; white-space: nowrap; border: none; background: none;
  color: var(--sre); font-size: 11px; cursor: pointer; text-transform: none;
  letter-spacing: 0; padding: 0;
}
.inv-viewall:hover { text-decoration: underline; }
.inv-list { gap: 1px; }
.inv-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  border: none; background: none; cursor: pointer; padding: 7px 8px; border-radius: 8px;
  font-size: 12.5px; color: var(--text);
}
.inv-item:hover { background: var(--panel); }
.inv-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--dim); }
.inv-dot.state-completed { background: var(--ok); }
.inv-dot.state-working, .inv-dot.state-submitted { background: var(--sre); animation: pulse-dot 1.2s ease-in-out infinite; }
.inv-dot.state-failed, .inv-dot.state-canceled, .inv-dot.state-rejected { background: var(--err); }
.inv-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inv-time { flex: none; color: var(--dim); font-size: 11px; }
.inv-empty { color: var(--dim); font-size: 12px; padding: 6px 8px; line-height: 1.5; }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.side-item {
  text-align: left; padding: 8px 10px; border-radius: 8px; border: none; background: none;
  cursor: pointer; font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-item:hover { background: var(--panel); }
.side-foot { border-top: 1px solid var(--border); padding-top: 10px; font-size: 12px; }
.conn { color: var(--dim); }
.conn.ok { color: var(--ok); }
.conn.err { color: var(--err); }
.conn.demo { color: var(--warn); }

/* Main — fixed header + scrolling middle + fixed composer */
.main { display: flex; flex-direction: column; min-width: 0; height: 100vh; height: 100dvh; overflow: hidden; }

/* Fixed header */
.topbar {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: #fff;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px; display: inline-flex;
  align-items: center; justify-content: center; color: #fff; font-size: 12px;
  background: linear-gradient(135deg, var(--sre), var(--devops));
}
.topbar-right { font-size: 12px; color: var(--dim); }

/* Welcome (scrolls if needed) */
.welcome { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; align-items: center; justify-content: center; padding: 24px; }
.hero { max-width: 640px; text-align: center; }
.hero-mark {
  width: 44px; height: 44px; margin: 0 auto 18px; border-radius: 12px;
  background: linear-gradient(135deg, var(--sre), var(--devops));
  color: #fff; font-size: 22px; display: flex; align-items: center; justify-content: center;
}
.hero h1 { font-size: 25px; font-weight: 600; margin: 0 0 10px; }
.hero-sub { color: var(--dim); font-size: 14px; line-height: 1.55; margin: 0 0 16px; max-width: 560px; margin-left: auto; margin-right: auto; }
/* First-run "how it works" strip */
.how {
  list-style: none; margin: 0 auto 22px; padding: 0; max-width: 640px;
  display: flex; flex-direction: column; gap: 8px; text-align: left;
}
.how li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--dim); }
.how li b { color: var(--text); }
.how-n {
  flex: none; width: 20px; height: 20px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 11px; font-weight: 700;
  background: var(--panel); color: var(--dim);
}
.how-n.sre { background: var(--sre-bg); color: var(--sre); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  border: 1px solid var(--border); background: #fff; border-radius: 999px;
  padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--text);
}
.chip:hover { background: var(--panel); border-color: #cfd4da; }

.tag { font-size: 12px; padding: 1px 7px; border-radius: 6px; font-weight: 600; }
.tag.sre { color: var(--sre); background: var(--sre-bg); }
.tag.devops { color: var(--devops); background: var(--devops-bg); }

/* Thread — the only scrolling region */
.thread { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 24px 0 8px; }
.thread-inner, .msg-row { max-width: 780px; margin: 0 auto; padding: 0 24px; }

.msg { margin: 0 auto 18px; max-width: 780px; padding: 0 24px; }
.msg.user .bubble {
  margin-left: auto; background: var(--sre); color: #fff; border-radius: 14px 14px 4px 14px;
  padding: 10px 14px; max-width: 80%; width: fit-content; font-size: 14px;
}
.msg.user { display: flex; }

/* Agent activity card */
.activity {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: #fff;
}
.activity-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: #fcfcfd; font-size: 13px;
}
.who-dot { width: 8px; height: 8px; border-radius: 50%; }
.who-dot.sre { background: var(--sre); }
.who-dot.devops { background: var(--devops); }
.who-name { font-weight: 600; }
.who-name.sre { color: var(--sre); }
.who-name.devops { color: var(--devops); }
.elapsed { margin-left: auto; font-size: 12px; color: var(--dim); font-variant-numeric: tabular-nums; }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border);
  border-top-color: var(--sre); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.stop-btn {
  border: 1px solid var(--border); background: #fff; color: var(--dim); cursor: pointer;
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
}
.stop-btn:hover { border-color: var(--err); color: var(--err); }

/* Progress rail — agent-attributed pipeline stepper */
.rail {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fff;
}
.rail-node { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; }
.rn-dot {
  width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--border);
  background: #fff; flex: none; position: relative;
}
.rn-label { color: var(--dim); white-space: nowrap; }
.rail-conn { width: 18px; height: 2px; background: var(--border); flex: none; }
/* pending (default): muted. active: filled + pulse. done: filled + check. */
.rail-node.active .rn-label { color: var(--text); font-weight: 700; }
.rail-node.active.sre .rn-dot { border-color: var(--sre); background: var(--sre); box-shadow: 0 0 0 3px var(--sre-bg); animation: pulse 1.2s ease-in-out infinite; }
.rail-node.active.devops .rn-dot { border-color: var(--devops); background: var(--devops); box-shadow: 0 0 0 3px var(--devops-bg); animation: pulse 1.2s ease-in-out infinite; }
.rail-node.done .rn-label { color: var(--text); }
.rail-node.done.sre .rn-dot { border-color: var(--sre); background: var(--sre); }
.rail-node.done.devops .rn-dot { border-color: var(--devops); background: var(--devops); }
.rail-node.done .rn-dot::after {
  content: "\2713"; position: absolute; inset: 0; color: #fff; font-size: 8px;
  display: flex; align-items: center; justify-content: center; font-weight: 700;
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 2px transparent; } 50% { box-shadow: 0 0 0 4px var(--sre-bg); } }
.activity.act-failed .rail { opacity: .7; }

.steps { padding: 6px 0; }
.step {
  display: flex; gap: 10px; padding: 7px 14px; font-size: 13px; line-height: 1.5;
  border-left: 3px solid transparent;
}
.step.sre { border-left-color: var(--sre); background: linear-gradient(90deg, var(--sre-bg), transparent 60%); }
.step.devops { border-left-color: var(--devops); background: linear-gradient(90deg, var(--devops-bg), transparent 60%); }
.step .who { font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.step.sre .who { color: var(--sre); }
.step.devops .who { color: var(--devops); }
.step .txt { color: var(--text); flex: 1; min-width: 0; word-break: break-word; }

/* Click-to-expand long steps (mirrors .det-row.collapsible in the detail modal) */
.step.collapsible { cursor: pointer; position: relative; padding-right: 28px; transition: filter .12s; }
.step.collapsible::after {
  content: "\25B8"; position: absolute; right: 12px; top: 8px; color: var(--dim);
  font-size: 11px; transition: transform .15s ease;
}
.step.collapsible:hover { filter: brightness(.985); }
.step.collapsible:focus-visible { outline: 2px solid var(--sre); outline-offset: 1px; }
.step.collapsible.expanded { cursor: default; }
.step.collapsible.expanded::after { transform: rotate(90deg); }
.step .step-more { color: var(--sre); font-weight: 600; margin-left: 6px; white-space: nowrap; }
.step.devops .step-more { color: var(--devops); }
.step .step-full { display: none; }
.step.collapsible.expanded .step-preview { display: none; }
.step.collapsible.expanded .step-full { display: block; }
/* Markdown inside an expanded step: tighter, matches .det-row-full */
.step .step-full.md { font-size: 13px; line-height: 1.55; }
.step .step-full.md h4, .step .step-full.md h5, .step .step-full.md h6 { margin: 8px 0 4px; font-size: 13px; }
.step .step-full.md p { margin: 5px 0; }
.step .step-full.md ul, .step .step-full.md ol { margin: 5px 0 5px 18px; }
.step .step-full.md pre.codeblock { margin: 6px 0; }
.step .step-full.md hr { margin: 8px 0; border: 0; border-top: 1px solid var(--border); }

/* Handoff — a prominent divider row marking the SRE ↔ AWS DevOps Agent handoff */
.handoff { display: flex; align-items: center; gap: 10px; margin: 14px 14px; }
.handoff .hline { flex: 1; height: 1px; background: var(--border); }
.handoff-body {
  display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 12px; border-radius: 999px; background: #fff;
  border: 1px solid var(--border); font-size: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.handoff .agent { font-weight: 700; }
.handoff .agent.sre { color: var(--sre); }
.handoff .agent.devops { color: var(--devops); }
.handoff .arrow { color: var(--dim); font-weight: 700; font-size: 14px; }
.handoff .handoff-note { color: var(--dim); font-weight: 400; border-left: 1px solid var(--border); padding-left: 8px; }
/* Tint the pill by direction: orange when delegating to DevOps, blue when returning */
.handoff.to-devops .handoff-body { border-color: rgba(232,131,12,.45); background: var(--devops-bg); }
.handoff.to-sre .handoff-body { border-color: rgba(47,111,235,.4); background: var(--sre-bg); }

/* Final answer */
.answer { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; background: #fff; margin-top: 14px; }
.answer.result-low { border-color: rgba(232,131,12,.4); background: #fffdf8; }
.answer.result-error { border-color: rgba(214,69,69,.45); background: #fffafa; }
.answer .err-mark { color: var(--err); font-size: 15px; }
.answer .err-msg { font-size: 13px; color: var(--text); margin: 4px 0 10px; line-height: 1.5; }
.retry-btn {
  border: 1px solid var(--sre); background: var(--sre); color: #fff; cursor: pointer;
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 8px;
}
.retry-btn:hover { filter: brightness(1.05); }
/* Confidence, explained */
.conf-why { font-size: 12px; color: var(--dim); margin: -2px 0 10px; line-height: 1.5; }
.conf-why b { color: var(--text); }
.answer-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.answer-head .badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; text-transform: uppercase; }
.badge.high { background: #e6f7ee; color: var(--ok); }
.badge.medium { background: var(--devops-bg); color: var(--devops); }
.badge.low { background: #fdecec; color: var(--err); }
.md { font-size: 13.5px; line-height: 1.6; color: var(--text); }
.md p { margin: 6px 0; }
.md h4, .md h5, .md h6 { margin: 12px 0 4px; font-weight: 700; }
.md h4 { font-size: 15px; } .md h5 { font-size: 13.5px; }
.md h6 { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--dim); }
.md ul, .md ol { margin: 6px 0; padding-left: 20px; } .md li { margin: 3px 0; }
.md code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
/* Fenced code blocks: dark, horizontally scrollable, monospace */
.md pre.codeblock, pre.codeblock {
  background: #1e2430; color: #e8eaed; border-radius: 8px; padding: 12px 14px;
  overflow-x: auto; margin: 10px 0; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
}
.md table, .md .md-table {
  border-collapse: collapse; margin: 8px 0; font-size: 12px; width: 100%;
  display: block; overflow-x: auto;
}
.md th, .md td { border: 1px solid var(--border); padding: 5px 8px; text-align: left; vertical-align: top; }
.md th { background: var(--panel); font-weight: 700; white-space: nowrap; }
.md pre.codeblock code, pre.codeblock code {
  background: none; color: inherit; padding: 0; font-size: 12px; white-space: pre;
  font-family: inherit;
}
.md hr { border: 0; border-top: 1px solid var(--border); margin: 10px 0; }
.evidence { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 12.5px; }
.evidence th, .evidence td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.evidence th { color: var(--dim); font-weight: 600; }
.evidence .match { color: var(--ok); } .evidence .nomatch { color: var(--err); }

/* Composer — fixed footer */
.composer-wrap { flex: 0 0 auto; padding: 12px 24px 18px; border-top: 1px solid var(--border); background: #fff; }
.composer { max-width: 780px; margin: 0 auto; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 14px; padding: 6px 6px 6px 14px; box-shadow: 0 1px 2px rgba(0,0,0,.03); }
.composer:focus-within { border-color: var(--sre); }
.prompt { flex: 1; border: none; outline: none; font-size: 14px; padding: 8px 0; background: transparent; }
.send { width: 34px; height: 34px; border-radius: 10px; border: none; cursor: pointer;
  background: var(--sre); color: #fff; font-size: 14px; }
.send:disabled { background: #c7cdd6; cursor: not-allowed; }
.composer-hint { max-width: 780px; margin: 8px auto 0; text-align: center; font-size: 11px; color: var(--dim); }

/* Quick / Deep mode toggle */
.mode-row { max-width: 780px; margin: 0 auto 8px; display: flex; align-items: center; gap: 10px; }
.mode-hint { font-size: 11px; color: var(--dim); }

/* ============================================================
   Mobile / narrow viewports
   ============================================================ */
@media (max-width: 768px) {
  /* Single column; the sidebar becomes an off-canvas drawer */
  .app { grid-template-columns: 1fr; }

  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }

  .sidebar {
    position: fixed; top: 0; left: 0; z-index: 50;
    width: 82%; max-width: 300px; height: 100vh; height: 100dvh;
    transform: translateX(-100%); transition: transform .25s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,.18);
  }
  .sidebar.open { transform: none; }

  .backdrop.show {
    display: block; position: fixed; inset: 0; z-index: 40;
    background: rgba(0,0,0,.4);
  }

  /* Tighter chrome */
  .topbar { padding: 10px 14px; }
  .topbar-right { display: none; }           /* too verbose for a phone */
  .brand { font-size: 15px; }

  .welcome { padding: 16px; }
  .hero h1 { font-size: 21px; }
  .hero-sub { font-size: 13px; }
  .chip { padding: 8px 12px; font-size: 12.5px; }

  /* Content gutters shrink from 24px -> 14px */
  .thread { padding-top: 16px; }
  .thread-inner, .msg-row, .msg { padding: 0 14px; }
  .msg.user .bubble { max-width: 90%; }

  .composer-wrap { padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
  .composer, .composer-hint, .mode-row { max-width: 100%; }
  .mode-hint { display: none; }               /* keep the toggle row compact */

  /* Wide evidence tables scroll instead of overflowing the screen */
  .answer { overflow-x: auto; }
  .evidence { font-size: 11.5px; }
  .step { padding-left: 12px; padding-right: 12px; }
}

/* Very small phones */
@media (max-width: 380px) {
  .hero h1 { font-size: 19px; }
}

/* ============================================================
   Investigations button + modal (AWS DevOps Agent A2A tasks)
   ============================================================ */
.new-chat.secondary { color: var(--dim); font-size: 13px; margin-bottom: 4px; }

.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal.hidden { display: none; }
.modal-card {
  background: #fff; border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 880px; height: min(78vh, 640px);
  display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.22);
}
.modal-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: #fcfcfd;
}
.modal-title { font-weight: 700; font-size: 14px; flex: 1; }
.modal-toggle { font-size: 12px; color: var(--dim); display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.modal-toggle input { cursor: pointer; }
.modal-btn {
  border: 1px solid var(--border); background: #fff; border-radius: 8px;
  padding: 5px 10px; font-size: 12.5px; cursor: pointer; color: var(--text);
}
.modal-btn:hover { background: var(--panel); }
.modal-close {
  border: none; background: none; font-size: 16px; cursor: pointer; color: var(--dim);
  padding: 4px 8px; border-radius: 8px;
}
.modal-close:hover { background: var(--panel); }

.modal-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px 1fr; }
.tasks-list { border-right: 1px solid var(--border); overflow-y: auto; padding: 8px; font-size: 13px; }
.task-detail { overflow-y: auto; padding: 16px 18px; font-size: 13px; line-height: 1.6; color: var(--text); }

/* Investigation detail — sectioned by actor */
.det-head { border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 6px; }
.det-title { font-size: 15px; font-weight: 700; line-height: 1.35; }
.det-meta { margin-top: 7px; display: flex; gap: 8px; align-items: center; }
.det-section { margin: 14px 0; }
.det-shead {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: 7px;
}
.det-shead.sre { color: var(--sre); }
.det-shead.devops { color: var(--devops); }
.det-row {
  font-size: 12.5px; line-height: 1.5; padding: 7px 10px; margin-bottom: 5px;
  border-left: 3px solid transparent; border-radius: 0 6px 6px 0; word-break: break-word;
}
.det-row.sre { border-left-color: var(--sre); background: linear-gradient(90deg, var(--sre-bg), transparent 75%); }
.det-row.devops { border-left-color: var(--devops); background: linear-gradient(90deg, var(--devops-bg), transparent 75%); }

/* Click-to-expand finding rows */
.det-row.collapsible { cursor: pointer; position: relative; padding-right: 28px; transition: background .12s; }
.det-row.collapsible::after {
  content: "\25B8"; position: absolute; right: 11px; top: 8px; color: var(--dim);
  font-size: 11px; transition: transform .15s ease;
}
.det-row.collapsible:hover { filter: brightness(.98); }
.det-row.collapsible:focus-visible { outline: 2px solid var(--sre); outline-offset: 1px; }
.det-row.collapsible.expanded { cursor: default; padding-right: 28px; }
.det-row.collapsible.expanded::after { transform: rotate(90deg); }
.det-row-full { display: none; }
.det-row.expanded .det-row-preview { display: none; }
.det-row.expanded .det-row-full { display: block; }
/* Markdown inside an expanded row: tighter than the standalone .md block */
.det-row-full.md { font-size: 12.5px; line-height: 1.55; }
.det-row-full.md h4, .det-row-full.md h5, .det-row-full.md h6 { margin: 8px 0 4px; font-size: 12.5px; }
.det-row-full.md p { margin: 5px 0; }
.det-row-full.md ul, .det-row-full.md ol { margin: 5px 0 5px 18px; }
.det-row-full.md pre.codeblock { margin: 6px 0; }
.det-row-full.md hr { margin: 8px 0; border: 0; border-top: 1px solid var(--border); }

.det-md { background: #fcfcfd; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; }

/* DevOps findings grouped by investigation phase (content-classified labels) */
.det-phases { display: flex; flex-direction: column; gap: 12px; }
.det-phase { border-left: 2px dashed var(--devops); padding-left: 10px; }
.det-phead {
  font-size: 11.5px; font-weight: 700; color: var(--devops); margin-bottom: 6px;
  display: flex; align-items: center; gap: 7px;
}
.det-phead .phase-step {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 999px; font-size: 11px;
  background: var(--devops-bg); color: var(--devops);
}

.task-item {
  padding: 9px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent;
  display: flex; flex-direction: column; gap: 3px;
}
.task-item:hover { background: var(--panel); }
.task-item.active { background: var(--sre-bg); border-color: rgba(47,111,235,.3); }
.task-item .ttitle { font-size: 13px; color: var(--text); font-weight: 500; line-height: 1.35; }
.task-item .tid { font-size: 11.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-item .meta { display: flex; align-items: center; gap: 8px; }
.state-badge { font-size: 10.5px; font-weight: 700; padding: 1px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .02em; }
.state-completed { background: #e6f7ee; color: var(--ok); }
.state-working, .state-submitted { background: var(--sre-bg); color: var(--sre); }
.state-failed, .state-canceled, .state-rejected { background: #fdecec; color: var(--err); }
.state-unknown, .state-empty { background: var(--panel); color: var(--dim); }
.task-time { font-size: 11px; color: var(--dim); }

@media (max-width: 768px) {
  .modal { padding: 0; }
  .modal-card { max-width: 100%; height: 100dvh; border-radius: 0; border: none; }
  .modal-body { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  .tasks-list { border-right: none; border-bottom: 1px solid var(--border); }
}

/* ============================================================
   A2A skills learn panel
   ============================================================ */
.skills-btn {
  border: 1px solid var(--border); background: #fff; color: var(--sre);
  border-radius: 999px; padding: 5px 11px; font-size: 12px; cursor: pointer;
  font-weight: 600; white-space: nowrap;
}
.skills-btn:hover { background: var(--sre-bg); border-color: rgba(47,111,235,.35); }

.skills-body { overflow-y: auto; padding: 16px 18px; }
.skills-caption { font-size: 12px; line-height: 1.55; color: var(--dim); margin: 10px 2px 14px; }

/* Current-mode summary line */
.mode-now {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px;
  background: var(--sre-bg); border: 1px solid rgba(47,111,235,.25); border-radius: 10px;
  padding: 10px 12px; margin: 14px 0; font-size: 12.5px;
}
.mode-now-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--sre); font-weight: 700; }
.mode-now-name { font-weight: 700; }
.mode-now-meta { font-size: 11.5px; color: var(--dim); }
.mode-now-meta code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mode-now-desc { flex-basis: 100%; color: var(--dim); line-height: 1.45; }

/* Who-does-what: one panel per agent (separation of concerns) */
.agent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .agent-grid { grid-template-columns: 1fr; } }
.agent-panel { border: 1px solid var(--border); border-top-width: 3px; border-radius: 10px; padding: 12px; background: #fff; min-width: 0; }
.agent-panel.sre { border-top-color: var(--sre); }
.agent-panel.devops { border-top-color: var(--devops); }
.ap-head { display: flex; align-items: center; gap: 7px; font-size: 14px; margin-bottom: 4px; }
.agent-panel.sre .ap-dot, .agent-panel.sre .ap-head b { color: var(--sre); }
.agent-panel.devops .ap-dot, .agent-panel.devops .ap-head b { color: var(--devops); }
.ap-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; color: var(--dim); background: var(--panel); border-radius: 999px; padding: 1px 7px; }
.ap-role { font-size: 12.5px; line-height: 1.55; color: var(--text); margin: 6px 0 10px; }
.ap-skills-label { font-size: 11px; color: var(--dim); margin-bottom: 7px; font-weight: 600; line-height: 1.4; }
.ap-role code, .ap-skills-label code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* Visual A2A round-trip flow (themed: SRE blue, DevOps orange) */
.a2a-flow { display: flex; flex-direction: column; align-items: stretch; }
.fnode {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-left-width: 4px; border-radius: 10px; background: #fff;
}
.fnode .fdot { font-size: 15px; width: 20px; text-align: center; flex: 0 0 auto; }
.fnode .ftext { display: flex; flex-direction: column; line-height: 1.3; }
.fnode .ftext b { font-size: 13px; }
.fnode .ftext small { font-size: 11.5px; color: var(--dim); margin-top: 1px; }
.fnode.you { border-left-color: #9aa4b2; }
.fnode.sre { border-left-color: var(--sre); background: var(--sre-bg); }
.fnode.sre .fdot, .fnode.sre .ftext b { color: var(--sre); }
.fnode.devops { border-left-color: var(--devops); background: var(--devops-bg); }
.fnode.devops .fdot, .fnode.devops .ftext b { color: var(--devops); }
.fnode.result { border-left-color: var(--ok); background: #e9f9f0; }
.fnode.result .fdot, .fnode.result .ftext b { color: var(--ok); }
.farrow { display: flex; justify-content: center; padding: 4px 0; position: relative; }
.farrow::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: var(--border); }
.flabel {
  position: relative; z-index: 1; background: #fff; border: 1px solid var(--border);
  border-radius: 999px; font-size: 10.5px; color: var(--dim); padding: 2px 10px; white-space: nowrap;
}
.flabel.a2a { color: var(--devops); border-color: rgba(232,131,12,.4); background: var(--devops-bg); font-weight: 700; }
.skills-sec { margin: 16px 0; }
.skills-shead {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--dim); margin-bottom: 8px;
}
.skills-shead.devops { color: var(--devops); }
.skills-shead.sre { color: var(--sre); }

.skill-card {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px;
  background: #fff;
}
.skill-card.mode.active { border-color: rgba(47,111,235,.45); background: var(--sre-bg); }
.sc-name { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sc-name code { font-size: 11.5px; font-weight: 600; background: rgba(0,0,0,.06); padding: 1px 6px; border-radius: 5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sc-cur { font-size: 10px; font-weight: 700; color: #fff; background: var(--sre); padding: 1px 7px; border-radius: 999px; text-transform: uppercase; }
.sc-desc { font-size: 12.5px; color: var(--text); line-height: 1.5; margin-top: 4px; }
.sc-meta { font-size: 11.5px; color: var(--dim); margin-top: 6px; }
.sc-meta code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.sc-ex { font-size: 11.5px; color: var(--dim); margin-top: 5px; font-style: italic; }

/* Discovered agent card (the live A2A discovery artifact) */
.disc-card { border: 1px dashed rgba(232,131,12,.5); border-radius: 10px; padding: 10px 12px; margin-top: 10px; background: var(--devops-bg); min-width: 0; }
.disc-card.disc-missing { font-size: 12px; color: var(--dim); line-height: 1.5; font-style: italic; background: var(--panel); border-style: dashed; border-color: var(--border); }
.disc-card.disc-missing code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.disc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.disc-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--devops); }
.disc-badge { font-size: 10px; font-weight: 700; border-radius: 999px; padding: 2px 8px; text-transform: uppercase; letter-spacing: .02em; }
.disc-badge.live { color: #fff; background: var(--ok); }
.disc-badge.demo { color: var(--dim); background: #fff; border: 1px solid var(--border); }
.disc-desc { font-size: 12px; color: var(--text); line-height: 1.5; margin: 7px 0 9px; }
.disc-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; }
@media (max-width: 480px) { .disc-facts { grid-template-columns: 1fr; } }
.disc-fact { display: flex; flex-direction: column; font-size: 11.5px; line-height: 1.4; padding: 3px 0; }
.disc-fact .dk { color: var(--dim); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .02em; }
.disc-fact .dv { color: var(--text); word-break: break-all; }
.disc-fact .dv code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.disc-raw { margin-top: 10px; }
.disc-raw summary { cursor: pointer; font-size: 11.5px; font-weight: 600; color: var(--devops); user-select: none; }
.disc-raw summary:hover { text-decoration: underline; }
.disc-raw pre {
  margin: 8px 0 0; padding: 10px 12px; background: #0f172a; color: #e2e8f0; border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; line-height: 1.5;
  overflow-x: auto; white-space: pre; max-height: 320px; overflow-y: auto; max-width: 100%;
}
.disc-explain { font-size: 11.5px; color: var(--text); line-height: 1.5; margin: 6px 0 4px; }
.disc-fact .dk { cursor: help; }

/* Live A2A wire — annotated protocol traffic (learning tool) */
.wire-sec { margin-top: 16px; }
.wire-intro { font-size: 12px; color: var(--text); line-height: 1.55; margin-bottom: 10px; }
.wire-intro code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.wire-body { margin-top: 10px; }
.wire-empty { font-size: 12px; color: var(--dim); font-style: italic; padding: 8px 0; line-height: 1.5; }
.wire-primer { font-size: 12px; color: var(--text); line-height: 1.6; background: var(--sre-bg); border: 1px solid rgba(47,111,235,.25); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.wire-primer code { background: rgba(0,0,0,.06); padding: 1px 5px; border-radius: 4px; font-size: 11px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.wire-phase { margin: 14px 0; }
.wire-phase-head { font-size: 12px; font-weight: 700; color: var(--sre); text-transform: uppercase; letter-spacing: .03em; }
.wire-phase-desc { font-size: 11.5px; color: var(--dim); line-height: 1.45; margin: 3px 0 6px; }
.wire-prim { display: inline-block; font-size: 10px; font-weight: 700; color: var(--devops); background: var(--devops-bg); border: 1px solid rgba(232,131,12,.35); border-radius: 999px; padding: 0 7px; margin-right: 6px; text-transform: uppercase; letter-spacing: .02em; }
.wire-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.wire-row:last-child { border-bottom: none; }
.wire-dir { flex: 0 0 auto; width: 20px; text-align: center; font-weight: 700; font-size: 14px; line-height: 1.5; }
.wire-row.out .wire-dir { color: var(--sre); }
.wire-row.in .wire-dir { color: var(--devops); }
.wire-row.note .wire-dir { color: var(--dim); }
.wire-main { min-width: 0; flex: 1; }
.wire-sum { font-size: 12.5px; color: var(--text); line-height: 1.45; word-break: break-word; }
.wire-time { font-size: 10.5px; color: var(--dim); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; margin-right: 6px; }
.wire-note { font-size: 11.5px; color: var(--dim); line-height: 1.45; margin-top: 3px; }
.wire-raw { margin-top: 6px; }
.wire-raw summary { cursor: pointer; font-size: 11px; font-weight: 600; color: var(--devops); user-select: none; }
.wire-raw pre {
  margin: 6px 0 0; padding: 9px 11px; background: #0f172a; color: #e2e8f0; border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10.5px; line-height: 1.5;
  overflow-x: auto; white-space: pre; max-height: 260px; overflow-y: auto; max-width: 100%;
}
.wire-raw.text pre { white-space: pre-wrap; word-break: break-word; }
