/* PM Kick-off Console. Layout: an app bar, the project status strip, then three columns: choose a command (left),
   the run and its result (middle), and the project assistant (right). Below 1360px the assistant is a drawer that
   slides over from the right; below 860px everything stacks. */
:root {
  --bg: #f3f5f8;
  --paper: #ffffff;
  --sunk: #f7f8fa;
  --fg: #1b2230;
  --muted: #5d6676;
  --line: #dde2e9;
  --accent: #2f6f8f;
  --accent-strong: #245a75;
  --accent-tint: #e4eff5;
  --ok: #26734a;
  --ok-tint: #e2f2e8;
  --warn: #a35a09;
  --warn-tint: #fdf1e2;
  --bad: #b3261e;
  --bad-tint: #fbe8e6;
  --shadow: 0 1px 2px rgba(20, 30, 45, 0.06), 0 4px 16px rgba(20, 30, 45, 0.05);
  --on-accent: #ffffff;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
}
/* Dark theme: from the system setting, unless a page theme is chosen (data-theme), which wins both ways. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11151c; --paper: #192029; --sunk: #141a22; --fg: #e4e8ef; --muted: #9aa3b2; --line: #2e3744;
    --accent: #6fb3d3; --accent-strong: #8cc4de; --accent-tint: #16303c;
    --ok: #6fcf97; --ok-tint: #163325; --warn: #f0a95a; --warn-tint: #33261a; --bad: #f2948a; --bad-tint: #3a1c1a;
    --shadow: none; --on-accent: #0d1a22;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11151c; --paper: #192029; --sunk: #141a22; --fg: #e4e8ef; --muted: #9aa3b2; --line: #2e3744;
  --accent: #6fb3d3; --accent-strong: #8cc4de; --accent-tint: #16303c;
  --ok: #6fcf97; --ok-tint: #163325; --warn: #f0a95a; --warn-tint: #33261a; --bad: #f2948a; --bad-tint: #3a1c1a;
  --shadow: none; --on-accent: #0d1a22;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 14.5px/1.55 var(--font); }
h1, h2, p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hint { color: var(--muted); font-size: 12.5px; font-weight: 400; }
code { font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }

/* App bar */
.appbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 12px; align-items: center; }
.mark { width: 36px; height: 36px; border-radius: 9px; background: var(--accent); color: var(--on-accent); display: grid; place-items: center;
  font-weight: 700; font-size: 13px; letter-spacing: 0.02em; }
.brand-name { font-size: 16px; font-weight: 700; }
.brand-sub { font-size: 12.5px; color: var(--muted); }
.status-strip { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px;
  border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--ok); background: var(--ok-tint); border-color: transparent; }
.pill.off { color: var(--muted); }
.pill.mock { color: var(--warn); background: var(--warn-tint); border-color: transparent; }
.pill:empty { display: none; }
.appbar-right { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.assistant-toggle .toggle-mark { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 800; color: var(--accent); background: var(--accent-tint); }
body.assistant-open .assistant-toggle { border-color: var(--accent); color: var(--accent); }

/* Project status strip: the 11 steps, the last analysis, what is running */
.health { background: var(--paper); border-bottom: 1px solid var(--line); }
.health-inner { max-width: 1720px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.health-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.health-name { font-weight: 700; font-size: 14px; }
.health-steps { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.health-steps li.group-start { margin-left: 6px; padding-left: 12px; border-left: 1px solid var(--line); }
.hstep { position: relative; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line); background: var(--sunk);
  color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; display: grid; place-items: center;
  font-variant-numeric: tabular-nums; padding: 0; }
.hstep:hover { border-color: var(--accent); color: var(--accent); }
.hstep.done { background: var(--ok-tint); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.hstep.waiting, .hstep.needs { background: var(--warn-tint); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.hstep.failed { background: var(--bad-tint); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.hstep::after { position: absolute; top: -4px; right: -4px; width: 14px; height: 14px; border-radius: 50%; display: grid;
  place-items: center; font-size: 9px; font-weight: 800; line-height: 1; color: var(--on-accent); }
.hstep.done::after { content: "✓"; background: var(--ok); }
.hstep.needs::after { content: "!"; background: var(--warn); }
.hstep.waiting::after { content: "…"; background: var(--warn); }
.hstep.failed::after { content: "×"; background: var(--bad); }
.health-side { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.health-analysis { font: inherit; font-size: 12.5px; color: var(--muted); background: none; border: 1px solid transparent; border-radius: 8px;
  padding: 4px 8px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.health-analysis:hover { border-color: var(--line); background: var(--sunk); }
.ha-time { font-weight: 600; }
.health-running { font-size: 12.5px; font-weight: 650; color: var(--accent); display: inline-flex; gap: 7px; align-items: center;
  font-variant-numeric: tabular-nums; }
.health-running::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .health-running::before { animation: blink 1.2s ease-in-out infinite; }
}
@keyframes blink { 50% { opacity: 0.25; } }

/* Layout */
.shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 1280px; margin: 0 auto;
  padding: 20px 24px 40px; align-items: start; }
.layout { display: grid; grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); gap: 20px; align-items: start; min-width: 0; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 18px 20px; display: grid; gap: 18px; min-width: 0; }
.panel-title { font-size: 15px; font-weight: 700; }
.sub-title { font-size: 13px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; }
.block { display: grid; gap: 10px; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.block-head h2 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }

/* Fields */
.field { display: grid; gap: 6px; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--fg); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
select, input[type="text"] { font: inherit; width: 100%; min-width: 0; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--sunk); color: var(--fg); }
select { font-weight: 600; }

/* Buttons */
.btn { font: inherit; font-weight: 600; font-size: 13.5px; padding: 8px 14px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn-secondary { background: var(--paper); color: var(--fg); border-color: var(--line); }
.btn-secondary:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-warn { background: var(--warn); color: var(--on-accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.link { font: inherit; font-size: 12.5px; border: none; background: none; color: var(--accent); padding: 0; cursor: pointer; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Demo flow */
.flow { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.flow li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); }
.flow li::before { content: attr(data-num); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color: var(--accent); background: var(--accent-tint); }
.flow li.done::before { content: "✓"; color: var(--ok); background: var(--ok-tint); }
.flow li.waiting::before { content: "…"; color: var(--warn); background: var(--warn-tint); }
.flow li.failed::before { content: "!"; color: var(--bad); background: var(--bad-tint); }
.flow li.needs::before { color: var(--warn); background: var(--warn-tint); }
.flow-title { font-weight: 600; font-size: 13.5px; }
.flow-desc { color: var(--muted); font-size: 12.5px; }
.flow-state { font-size: 11.5px; font-weight: 600; color: var(--muted); }

/* Command chips */
.cmd-group { display: grid; gap: 6px; }
.cmd-group-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 11px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--paper); color: var(--fg); }
.chip-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.chip-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.chip-btn { display: inline-flex; align-items: center; gap: 7px; padding-left: 5px; }
.chip-btn .num { min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--accent); background: var(--accent-tint); font-variant-numeric: tabular-nums; }
.chip-btn.done .num { color: var(--ok); background: var(--ok-tint); }
.chip-btn.done { border-color: color-mix(in srgb, var(--ok) 45%, var(--line)); }
.chip-btn.waiting .num, .chip-btn.needs .num { color: var(--warn); background: var(--warn-tint); }
.chip-btn.failed .num { color: var(--bad); background: var(--bad-tint); }
.custom summary { cursor: pointer; font-size: 12.5px; color: var(--accent); font-weight: 600; }
.custom-form { display: flex; gap: 8px; margin-top: 8px; }

/* Output */
.empty { border: 1px dashed var(--line); border-radius: 10px; padding: 28px; text-align: center; color: var(--muted); display: grid; gap: 6px; }
.empty-title { color: var(--fg); font-weight: 700; font-size: 15px; }
.run { display: grid; gap: 14px; }
.run-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.run-title { display: flex; gap: 10px; align-items: center; min-width: 0; flex-wrap: wrap; }
.run-title code { font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--fg); }
.run-meta { display: flex; gap: 14px; align-items: center; }
.time { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px;
  background: var(--accent-tint); color: var(--accent); }

/* Run phases. Each is pending, active (running now), wait (PM approval), ok, warn (stopped there), bad (failed
   there) or skip (not needed for this result). Active phases of a one-step Nexus run light up together. */
.progress { list-style: none; margin: 0; padding: 0; display: flex; }
.ph { flex: 1; position: relative; min-width: 0; padding: 20px 2px 0; display: grid; gap: 1px; align-content: start;
  text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.ph::before { content: ""; position: absolute; top: 2px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  box-sizing: border-box; border: 2px solid var(--line); background: var(--paper); z-index: 1; }
.ph::after { content: ""; position: absolute; top: 8px; left: -50%; width: 100%; height: 2px; background: var(--line); }
.ph:first-child::after { display: none; }
.ph-label { line-height: 1.3; overflow-wrap: anywhere; }
.ph-note { font-size: 11px; font-weight: 500; color: var(--muted); line-height: 1.3; overflow-wrap: anywhere; }
.ph.ok { color: var(--fg); }
.ph.ok::before { background: var(--accent); border-color: var(--accent); }
.ph.ok::after, .ph.warn::after, .ph.bad::after, .ph.wait::after { background: var(--accent); }
.ph.active { color: var(--accent); }
.ph.active::before { border-color: var(--accent); background: var(--accent-tint); }
.ph.active::after { background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 10px); }
.ph.wait { color: var(--warn); }
.ph.wait::before { border-color: var(--warn); background: var(--warn-tint); }
.ph.warn { color: var(--warn); }
.ph.warn::before { border-color: var(--warn); background: var(--warn); }
.ph.bad { color: var(--bad); }
.ph.bad::before { border-color: var(--bad); background: var(--bad); }
.ph.skip { opacity: 0.6; }
.ph.skip::before { border-style: dashed; }
.ph.skip::after { background: var(--line); }
@media (prefers-reduced-motion: no-preference) {
  .ph.active::before { animation: pulse 1.4s ease-in-out infinite; }
  .ph.wait::before { animation: pulse-warn 1.4s ease-in-out infinite; }
}
@keyframes pulse { 50% { box-shadow: 0 0 0 6px var(--accent-tint); } }
@keyframes pulse-warn { 50% { box-shadow: 0 0 0 6px var(--warn-tint); } }
.progress-note { font-size: 12px; color: var(--muted); }
.progress.mini .ph { padding-top: 16px; font-size: 10.5px; }
.progress.mini .ph::before { width: 11px; height: 11px; margin-left: -5.5px; top: 1px; }
.progress.mini .ph::after { top: 6px; }
.progress.mini .ph-note { font-size: 10px; }
.progress.mini .ph-label, .progress.mini .ph-note { overflow-wrap: normal; }

.callout { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap;
  padding: 14px 16px; border-radius: 10px; }
.callout.warn { background: var(--warn-tint); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.callout.bad { background: var(--bad-tint); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.callout.info { background: var(--sunk); border: 1px solid var(--line); }
.callout-title { font-weight: 700; margin-bottom: 4px; }
.callout.bad .callout-title { color: var(--bad); }
.problem .problem-fix { margin-top: 8px; }
.problem details.more { margin-top: 8px; }
.callout-steps { margin: 4px 0 6px; padding-left: 18px; font-size: 13px; }
.callout-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Result card: a title row, then sections (key points, questions, what changed), then the next step. */
.result { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--paper); }
.result-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap;
  padding: 14px 18px; background: var(--sunk); border-bottom: 1px solid var(--line); }
.result-titles { min-width: 0; }
.result-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.result-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.result-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge.ok { background: var(--ok-tint); color: var(--ok); }
.badge.draft { background: var(--warn-tint); color: var(--warn); }
.badge.muted { background: var(--paper); color: var(--muted); border: 1px solid var(--line); }
.badge.bad { background: var(--bad-tint); color: var(--bad); }
.result-body { padding: 16px 18px 18px; display: grid; gap: 18px; }
.kv { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 14px; }
.kv dt { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* The saved file */
.file-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--sunk); }
.file-icon { flex: none; width: 34px; height: 40px; border-radius: 6px; display: grid; place-items: center;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.03em; color: #fff; background: var(--accent); }
.file-icon.word { background: #2b579a; }
.file-text { min-width: 0; }
.file-name { font-weight: 650; overflow-wrap: anywhere; }
.file-path { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.no-file { font-size: 13px; color: var(--muted); }

/* Sections */
.rsection { display: grid; gap: 10px; }
.rsection + .rsection { border-top: 1px solid var(--line); padding-top: 16px; }
.rsection-head { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--muted); display: flex; align-items: center; gap: 8px; }
.rsection-head .count { font-size: 11px; letter-spacing: 0; padding: 0 7px; border-radius: 999px; background: var(--accent-tint);
  color: var(--accent); line-height: 18px; }
.point { line-height: 1.6; max-width: 88ch; overflow-wrap: anywhere; }
.point strong, .point-lead { font-weight: 650; color: var(--fg); }

.points-grid { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); gap: 0; margin: 0; }
.points-grid dt, .points-grid dd { padding: 10px 0; border-top: 1px solid var(--line); }
.points-grid dt:first-child, .points-grid dt:first-child + dd, .points-grid dd.wide:first-child { border-top: none; padding-top: 2px; }
.points-grid dt { font-size: 13px; font-weight: 650; color: var(--fg); padding-right: 16px; }
.points-grid dd { margin: 0; }
.points-grid dd.wide { grid-column: 1 / -1; }

.points { margin: 0; padding-left: 20px; display: grid; gap: 10px; }
.points li::marker { color: var(--accent); }

.questions { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: q; }
.questions li { position: relative; padding: 10px 12px 10px 44px; border: 1px solid var(--line); border-radius: 10px;
  counter-increment: q; }
.questions li::before { content: counter(q); position: absolute; left: 12px; top: 10px; width: 22px; height: 22px;
  border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--warn);
  background: var(--warn-tint); }

.changed .point { color: var(--muted); }

/* Sources and the agent's tags */
.sources { margin: 5px 0 0; display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; font-size: 11.5px; color: var(--muted); }
.sources-label { font-weight: 600; margin-right: 2px; }
.src { display: inline-block; padding: 1px 7px; border-radius: 5px; background: var(--sunk); border: 1px solid var(--line);
  line-height: 1.55; max-width: 100%; overflow-wrap: anywhere; }
.src-file { font-weight: 600; color: var(--fg); }
.note-tag { display: inline-block; font-size: 11px; font-weight: 650; line-height: 1.5; padding: 0 7px; border-radius: 5px;
  vertical-align: 1px; white-space: nowrap; }
.note-tag.pm { color: var(--accent); background: var(--accent-tint); }
.note-tag.inferred { color: var(--warn); background: var(--warn-tint); }
.note-tag.missing { color: var(--bad); background: var(--bad-tint); }

/* Jira lines from the sprint plan */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
.tasks { width: 100%; border-collapse: collapse; font-size: 13px; }
.tasks th { text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); background: var(--sunk); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tasks td { padding: 10px 12px; vertical-align: top; border-top: 1px solid var(--line); }
.tasks tr:first-child td { border-top: none; }
.task-title { font-weight: 650; }
.task-desc { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.story-id { font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--accent); margin-right: 6px; }
.criteria { margin: 0; padding-left: 16px; display: grid; gap: 3px; }
.tbc { color: var(--muted); font-style: italic; }
.type-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 5px; white-space: nowrap; }
.type-badge.story { color: var(--ok); background: var(--ok-tint); }
.type-badge.task { color: var(--accent); background: var(--accent-tint); }
.type-badge.epic { color: #7b4bb3; background: color-mix(in srgb, #7b4bb3 14%, transparent); }
.sprint-pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
  border: 1px solid var(--line); white-space: nowrap; }

/* Jira issues */
.issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.issues li { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; }
.issue-key { font-family: var(--mono); font-weight: 700; color: var(--accent); white-space: nowrap; text-decoration: none; }
.issue-key:hover { text-decoration: underline; }
.issue-summary { flex: 1; min-width: 160px; }

/* One-sentence replies (stops) and longer free text */
.notice { padding: 14px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--sunk); font-size: 15px; }
.notice.warn { background: var(--warn-tint); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice.bad { background: var(--bad-tint); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.notice .point { max-width: none; }
.plain { display: grid; gap: 8px; }
.plain-head { font-weight: 700; margin-top: 6px; }

/* Next step */
.next { display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap;
  padding: 12px 16px; background: var(--accent-tint); border-radius: 10px; }
.next-text { min-width: 0; }
.next-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--accent); }
.next-line { font-weight: 600; overflow-wrap: anywhere; }

pre.raw { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--mono); font-size: 12.5px;
  background: var(--sunk); border-radius: 8px; padding: 12px; }
details.more summary { cursor: pointer; color: var(--muted); font-size: 12.5px; }
details.more[open] summary { margin-bottom: 8px; }
.nodes { color: var(--muted); font-size: 12px; }

/* History */
.history { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.history ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.history li details { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
.history summary { cursor: pointer; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.history details[open] summary { margin-bottom: 10px; }
.history summary code { font-family: var(--font); font-size: 13px; font-weight: 600; }

/* Dialog */
.dialog { border: none; border-radius: 12px; padding: 22px; max-width: 460px; width: calc(100% - 32px); background: var(--paper); color: var(--fg); box-shadow: 0 20px 60px rgba(0,0,0,0.25); }
.dialog::backdrop { background: rgba(15, 20, 30, 0.45); }
.dialog form { display: grid; gap: 10px; }
.dialog h2 { font-size: 17px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* Project assistant */
.assistant { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.assistant-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line); }
.assistant-head h2 { font-size: 15px; font-weight: 700; }
.assistant-titles { min-width: 0; }
.assistant-actions { display: flex; gap: 12px; align-items: center; }
.icon-btn { font: inherit; font-size: 20px; line-height: 1; width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--paper); color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0; }
.icon-btn:hover { color: var(--fg); border-color: var(--accent); }
.assistant-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.chip-btn.ask-chip { padding-left: 11px; font-size: 12px; }
.assistant-log { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px;
  background: var(--sunk); overscroll-behavior: contain; }
.assistant-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); align-items: flex-end; }
.assistant-form textarea { font: inherit; flex: 1; min-width: 0; resize: none; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--sunk); color: var(--fg); max-height: 140px; }

.welcome { border: 1px dashed var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 8px; justify-items: start;
  color: var(--muted); background: var(--paper); font-size: 13.5px; }
.welcome-title { color: var(--fg); font-weight: 700; }
.msg { display: flex; min-width: 0; }
.msg.user { justify-content: flex-end; }
.bubble { max-width: 88%; padding: 8px 12px; border-radius: 12px 12px 4px 12px; font-size: 13.5px; overflow-wrap: anywhere;
  background: var(--accent-tint); color: var(--fg); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.bot-card { width: 100%; min-width: 0; display: grid; gap: 10px; padding: 12px 14px; font-size: 13.5px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 4px 12px 12px 12px; }
.msg-time { justify-self: end; font-size: 11px; color: var(--muted); }
.bot-text { overflow-wrap: anywhere; }
.bot-text strong { font-weight: 650; }
.bot-sub { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  display: flex; gap: 6px; align-items: center; }
.bot-sub .count { font-size: 11px; letter-spacing: 0; padding: 0 7px; border-radius: 999px; background: var(--accent-tint);
  color: var(--accent); line-height: 18px; }
.bot-points { display: grid; gap: 6px; }
.bot-card .points { gap: 6px; padding-left: 18px; }
.bot-card .point { max-width: none; }
.bot-card .notice { font-size: 13.5px; padding: 10px 12px; }
.bot-card .notice .callout-title { margin-bottom: 2px; }
.bot-card pre.raw { font-size: 12px; }
.bot-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.bot-actions:empty { display: none; }
.btn-sm { font-size: 12.5px; padding: 5px 10px; border-radius: 7px; white-space: normal; text-align: left; }

.bot-items { display: grid; gap: 8px; }
.gap-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.gap { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-left-width: 3px; border-radius: 10px;
  background: var(--paper); min-width: 0; }
.bot-items.blocked .gap { border-left-color: var(--bad); }
.bot-items.missing .gap, .bot-items.conflicts .gap { border-left-color: var(--warn); }
.bot-items.questions .gap, .bot-items.flow .gap { border-left-color: var(--accent); }
.bot-items.next .gap { border-left-color: var(--ok); }
.gap-meta { font-size: 12px; color: var(--muted); }
.answer-slot:empty { display: none; }
.answer-box { display: grid; gap: 6px; }
.answer-row, .line-editor { display: flex; gap: 6px; }
.answer-row input, .line-editor input { font: inherit; font-size: 13px; flex: 1; min-width: 0; padding: 7px 9px;
  border: 1px solid var(--line); border-radius: 7px; background: var(--sunk); color: var(--fg); }
.line-editor input { font-family: var(--mono); font-size: 12.5px; }
.line-preview { font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }

.run-card { display: grid; gap: 8px; }
.run-card-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.run-card-line { flex: 1; min-width: 0; font-family: var(--font); font-size: 13px; font-weight: 650; }
.report { display: grid; gap: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.report-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.report-title { font-weight: 700; font-size: 14.5px; }
.counts { display: flex; flex-wrap: wrap; gap: 6px; }

/* Wide screens: the assistant is the third column and stays in view while the page scrolls. */
@media (min-width: 1360px) {
  body.assistant-open .shell { grid-template-columns: minmax(0, 1fr) 380px; max-width: 1720px; }
  body.assistant-open .layout { grid-template-columns: minmax(300px, 360px) minmax(0, 1fr); }
  .assistant { position: sticky; top: 16px; height: calc(100vh - 32px); }
  body:not(.assistant-open) .assistant { display: none; }
}
/* Narrower screens: the assistant is a drawer over the page. */
@media (max-width: 1359.98px) {
  .assistant { position: fixed; top: 0; right: 0; bottom: 0; z-index: 40; width: min(420px, 100vw); border-radius: 0;
    border-width: 0 0 0 1px; transform: translateX(100%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; }
  body.assistant-open .assistant { transform: none; visibility: visible; box-shadow: -12px 0 40px rgba(10, 15, 25, 0.25); }
}
@media (prefers-reduced-motion: reduce) {
  .assistant { transition: none; }
}

@media (max-width: 860px) {
  .shell { padding: 16px; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .appbar { padding: 12px 16px; }
  .health-inner { padding: 10px 16px; }
  .health-side { margin-left: 0; }
  .kv { grid-template-columns: minmax(0, 1fr); }
  .points-grid { grid-template-columns: minmax(0, 1fr); }
  .points-grid dd { border-top: none; padding-top: 0; }
  .result-head, .result-body { padding-left: 14px; padding-right: 14px; }
}

/* ---------- BISTEC Agent Console additions ---------- */
.login { max-width: 460px; margin: 10vh auto 0; padding: 0 max(16px, env(safe-area-inset-left, 0px)); }
.login .panel { display: grid; gap: 16px; }
.login-step { display: grid; gap: 10px; }
.code-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-code { font-family: var(--mono); font-size: 26px; font-weight: 700; letter-spacing: 0.12em; padding: 8px 14px;
  border-radius: 10px; background: var(--accent-tint); color: var(--accent-strong); }
.form-error { color: var(--bad); font-size: 13px; min-height: 1em; }
.who { font-size: 13px; font-weight: 600; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; }
.dev-banner { width: min(1280px, calc(100% - 32px)); box-sizing: border-box; margin: 12px auto 0; padding: 8px 14px; border-radius: 8px; font-size: 13px;
  background: var(--warn-tint); color: var(--warn); }
.tabs { display: flex; gap: 4px; max-width: 1280px; margin: 16px auto 0; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tab { font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); background: none; border: 0;
  border-bottom: 2px solid transparent; padding: 10px 14px; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.tab:hover { color: var(--fg); }
.layout.single { grid-template-columns: minmax(0, 1fr); max-width: 920px; margin: 0 auto; width: 100%; }
.layout.single .panel { display: grid; gap: 14px; }
.jira-start { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.jira-start .field { flex: 1 1 260px; margin: 0; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }
.chat-form input { flex: 1; min-width: 0; }
.consent .callout-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.result .callout-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
@media (max-width: 640px) {
  .who { display: none; }
  .tab { padding: 10px 8px; font-size: 13px; }
}
.job-view { display: grid; gap: 12px; min-width: 0; }
#jira-body, .layout.single .panel > * { min-width: 0; }
.job-view > .progress, #jira-body > .progress { max-width: 100%; }
.job-view > .progress, #jira-body > .progress { margin-bottom: 2px; }
@media (max-width: 640px) {
  .job-view > .progress, #jira-body > .progress { overflow-x: auto; padding-bottom: 4px; }
  .job-view > .progress .ph, #jira-body > .progress .ph { flex: 0 0 76px; }
  .job-view > .progress .ph-label, #jira-body > .progress .ph-label { overflow-wrap: normal; }
}

/* ---------- Chat-first layout: the chat is the page, the runs sit in a rail ---------- */
.workspace { max-width: 1440px; margin: 0 auto; padding: 16px 24px 24px; display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 16px; align-items: start; }
.rail { display: grid; gap: 16px; min-width: 0; }
.rail .panel { display: grid; gap: 10px; min-width: 0; }
.rail .progress .ph-note { display: none; }
.rail .progress .ph { font-size: 11px; }
.fold > summary { cursor: pointer; }
.chat-main { position: sticky; top: 12px; height: calc(100dvh - 150px); min-height: 460px; display: flex;
  flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-project { flex: 1 1 240px; max-width: 420px; margin: 0; }
.chat-head-actions { display: flex; gap: 14px; align-items: center; padding-bottom: 8px; }
.chat-log { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.chat-welcome { color: var(--muted); font-size: 14px; max-width: 640px; }
.chat-welcome strong { color: var(--fg); }
.chat-msg { max-width: min(84%, 780px); border-radius: 12px; padding: 9px 12px; font-size: 14px; overflow-wrap: anywhere; min-width: 0; }
.chat-msg.user { align-self: flex-end; background: var(--accent); color: var(--on-accent); white-space: pre-wrap; border-bottom-right-radius: 4px; }
.chat-msg.bot { align-self: flex-start; background: var(--sunk); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.chat-msg.bot.error { background: var(--bad-tint); border-color: transparent; color: var(--bad); }
.chat-msg .plain { display: grid; gap: 6px; }
.chat-msg.thinking { display: grid; gap: 8px; width: min(84%, 780px); }
.result-msg { display: grid; gap: 4px; border-left: 4px solid var(--ok); }
.result-msg.error { border-left-color: var(--bad); }
.result-msg-title { font-weight: 700; font-size: 13px; }
.chat-chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 16px 0; }
.chat-chips .chip-btn { font-size: 12px; }
.chat-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 16px 14px; align-items: end; }
.chat-box textarea { font: inherit; width: 100%; min-width: 0; resize: vertical; min-height: 44px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--sunk); color: var(--fg); }
.run-item { display: grid; gap: 6px; padding: 8px 0; border-top: 1px solid var(--line); }
.run-item:first-child { border-top: 0; padding-top: 0; }
.run-item-title { font-size: 12.5px; font-weight: 650; }
.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.history-list summary { cursor: pointer; font-size: 12.5px; }
.hist-title { font-weight: 600; }
.rail-toggle { display: none; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .chat-main { position: static; height: min(78dvh, 760px); }
  .rail-toggle { display: inline; }
  .rail.closed { display: none; }
}
@media (max-width: 640px) {
  .workspace { padding: 12px 16px 16px; }
  .chat-msg { max-width: 94%; }
}

/* Your connections (rail): one row per agent connection, with Connect / sign-in steps */
.conn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.conn-row { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); }
.conn-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.conn-head .hint { margin: 2px 0 0; }
.status-strip button.pill { cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; }
.status-strip button.pill:hover { filter: brightness(0.96); }
