:root {
  /* Layered dark palette — depth through surface elevation */
  --bg: #0b0d10;
  --bg-raised: #0f1216;
  --card: #12161b;
  --card-hover: #161b22;
  --fg: #e9edf2;
  --fg-secondary: #c8ced6;
  --muted: #7a838d;
  --dim: #55606c;
  --border: rgba(255, 255, 255, 0.06);
  --border-soft: rgba(255, 255, 255, 0.04);
  --border-strong: rgba(255, 255, 255, 0.10);
  --primary: #5ad1e0;
  --primary-dim: #2c8a96;
  --error: #ff6b6b;
  --critical: #ff4757;
  --high: #ff8a3c;
  --medium: #ffc247;
  --low: #5fd97a;
  --queued: #7a838d;
  --running: #ffc247;
  --done: #5fd97a;
  --err: #ff6b6b;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Inter Variable", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 0% 50%, rgba(90,209,224,0.02) 0%, transparent 50%),
    radial-gradient(circle at 100% 50%, rgba(90,209,224,0.02) 0%, transparent 50%);
  color: var(--fg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); transition: color 150ms ease; }
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 1.5rem;
  height: 60px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(11, 13, 16, 0.82);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  position: sticky;
  top: 0;
  z-index: 100;
}
main { position: relative; z-index: 1; min-height: calc(100vh - 60px); }
header .brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: -0.01em;
  padding: 0.35rem 0.4rem;
  margin-left: -0.4rem;
  border-radius: 6px;
  transition: color 120ms ease;
}
header .brand:hover { color: var(--primary); }
header .brand-logo {
  width: 28px;
  height: 28px;
  display: block;
  flex: 0 0 auto;
}
header .brand-name {
  line-height: 1;
  color: var(--fg);
  font-weight: 600;
  font-size: 0.95rem;
}
header .brand:hover .brand-name { color: var(--primary); }

header .nav-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
}
header .nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  height: 100%;
}
header .nav-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
}
header .nav-account {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  height: 100%;
}
form.inline { display: inline; }
main { max-width: 1600px; margin: 2rem auto; padding: 0 1.5rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 6px 16px -6px rgba(0,0,0,0.2);
  transition: box-shadow 200ms ease, border-color 200ms ease;
}
.card:hover { border-color: var(--border-strong); }
.card.narrow { max-width: 420px; margin-inline: auto; margin-top: 3rem; }
.row { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
h1, h2 { margin-top: 0; font-weight: 650; letter-spacing: -0.015em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }
h3 { font-weight: 600; }
h4 { margin: 1.1rem 0 0.4rem; color: var(--muted); font-weight: 500; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; }
.small { font-size: 0.85em; }
p { line-height: 1.6; }
label { display: block; margin-bottom: 0.8rem; }
input, button, .button {
  font: inherit;
  padding: 0.55rem 0.9rem;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--fg);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease, transform 100ms ease;
}
input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(90,209,224,0.10); }
input[type=text], input[type=password] { width: 100%; margin-top: 0.25rem; }
button, .button {
  background: linear-gradient(135deg, #4ec5d4, #5ad1e0, #6ad8e8);
  color: #0b0d10;
  border: none;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover, .button:hover {
  background: linear-gradient(135deg, #5ad1e0, #7adde8, #8ae4ef);
  box-shadow: 0 2px 12px -2px rgba(90,209,224,0.3);
  transform: translateY(-0.5px);
}
button:active, .button:active { transform: translateY(0); }
.button.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border-strong);
}
.button.ghost:hover { color: var(--fg); border-color: var(--primary-dim); background: rgba(90,209,224,0.04); box-shadow: none; transform: none; }
button.link { background: none; color: var(--muted); font-weight: normal; padding: 0; border: 0; cursor: pointer; }
button.link:hover { color: var(--fg); text-decoration: underline; background: none; box-shadow: none; transform: none; }
input[type=file] { padding: 0.3rem; }
table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
th, td { text-align: left; padding: 0.6rem 0.7rem; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
th { color: var(--dim); font-weight: 600; font-size: 0.78em; letter-spacing: 0.06em; text-transform: uppercase; }
td { color: var(--fg-secondary); font-size: 0.92em; }
tbody tr { transition: background 120ms ease; }
tbody tr:hover { background: rgba(255,255,255,0.015); }
code {
  background: rgba(255,255,255,0.04);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.85em;
  color: var(--primary);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.muted { color: var(--muted); }
.error { color: var(--error); }
pre.error { background: rgba(255,107,107,0.06); border: 1px solid rgba(255,107,107,0.15); padding: 0.9rem 1rem; border-radius: 8px; white-space: pre-wrap; overflow-x: auto; }

/* Skeleton pulse — used during action plan generation */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.06; }
  50% { opacity: 0.12; }
}
.skeleton-line {
  height: 14px; border-radius: 6px;
  background: var(--fg);
  animation: skeleton-pulse 1.8s ease-in-out infinite;
  margin-bottom: 10px;
}
.skeleton-line:nth-child(1) { width: 70%; }
.skeleton-line:nth-child(2) { width: 90%; }
.skeleton-line:nth-child(3) { width: 55%; }

/* Spinning ring */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 0.9s linear infinite; }

/* Generating state for the button */
.btn-outline.is-generating {
  pointer-events: none; opacity: 0.7;
  border-color: var(--primary);
  color: var(--primary);
}
.status {
  padding: 0.2em 0.65em;
  border-radius: 999px;
  font-size: 0.75em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-queued  { background: rgba(122,131,141,0.15); color: var(--queued); border: 1px solid rgba(122,131,141,0.25); }
.status-running { background: rgba(255,194,71,0.12);  color: var(--running); border: 1px solid rgba(255,194,71,0.25); }
.status-done    { background: rgba(95,217,122,0.12);  color: var(--done); border: 1px solid rgba(95,217,122,0.25); }
.status-error   { background: rgba(255,107,107,0.12); color: var(--err); border: 1px solid rgba(255,107,107,0.25); }
.pill {
  padding: 0.15em 0.6em;
  border-radius: 999px;
  font-size: 0.75em;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pill-critical { background: rgba(255,71,87,0.15); color: var(--critical); border: 1px solid rgba(255,71,87,0.3); }
.pill-high     { background: rgba(255,138,60,0.14); color: var(--high); border: 1px solid rgba(255,138,60,0.3); }
.pill-medium   { background: rgba(255,194,71,0.12); color: var(--medium); border: 1px solid rgba(255,194,71,0.25); }
.pill-low      { background: rgba(95,217,122,0.12); color: var(--low); border: 1px solid rgba(95,217,122,0.25); }
.themes { padding-left: 1.3rem; }
.themes li { margin-bottom: 0.5rem; }
.charts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 1rem;
  align-items: stretch;
}
.chart-card {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.15rem 1.1rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.chart-card.wide { grid-column: 1 / -1; }
.chart-card h3 {
  margin: 0;
  font-size: 0.98em;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.01em;
}
.chart-card .chart-sub {
  margin: 0.2rem 0 0.75rem;
  font-size: 0.82em;
  color: var(--muted);
  min-height: 1.1em;
}
.chart-wrap {
  position: relative;
  height: 260px;
  flex: 1;
  min-height: 0;
}
.chart-card canvas {
  width: 100% !important;
  height: 100% !important;
}
.chart-card.wide .chart-wrap { height: 300px; }
details {
  margin-bottom: 1rem; border: 1px solid var(--border);
  border-radius: 10px; padding: 0.85rem 1.1rem;
  background: var(--bg-raised);
  transition: border-color 150ms ease;
}
details:hover { border-color: var(--border-strong); }
details summary { cursor: pointer; font-size: 1em; margin: -0.25rem -0.5rem 0; padding: 0.25rem 0.5rem; }
details summary strong { color: var(--primary); }
details[open] > summary { margin-bottom: 0.6rem; }
.proposal ul { margin: 0.3rem 0 0.8rem 1.2rem; padding: 0; }
.proposal ul li { margin-bottom: 0.35rem; }

header .nav-link {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 0.85rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: 6px;
  position: relative;
  transition: background 120ms ease, color 120ms ease;
}
header .nav-link:hover { color: var(--fg); background: rgba(255, 255, 255, 0.04); }
header .nav-link.is-active { color: var(--fg); }
header .nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: -2px;
  height: 2px;
  background: var(--primary);
  border-radius: 2px;
}

header .account-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.65rem 0.3rem 0.35rem;
  text-decoration: none;
  color: var(--fg);
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 120ms ease, border-color 120ms ease;
}
header .account-chip:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--border); }
header .account-chip.is-active { background: rgba(92, 207, 230, 0.08); border-color: rgba(92, 207, 230, 0.35); }
header .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a3340 0%, #3a4555 100%);
  color: var(--fg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: 0 0 auto;
}
header .account-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  line-height: 1;
}
header .account-name { font-size: 0.92rem; font-weight: 500; }

button.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.35rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
button.btn-ghost:hover {
  color: var(--fg);
  border-color: #3a3030;
  background: rgba(255, 102, 102, 0.06);
}

.login-card { text-align: center; padding-top: 2rem; }
.login-card form { text-align: left; margin-top: 1rem; }
.login-logo {
  display: block;
  width: 88px;
  height: auto;
  margin: 0 auto 0.8rem;
}
.login-subtitle {
  margin: 0 0 0.6rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 600;
}
.login-card h1 { margin-top: 0.2rem; }

.section-heading {
  margin: 2rem 0 0.8rem;
  font-size: 1.3em;
  color: var(--muted);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* Agent accents — used by both help tiles and the per-proposal sections */
.accent-blue   { --accent: #5ccfe6; }
.accent-purple { --accent: #c792ea; }
.accent-green  { --accent: #7fd962; }
.accent-orange { --accent: #ffae57; }
.accent-red    { --accent: #ff8078; }
.accent-teal   { --accent: #6ad9c4; }

/* ─── Agent selector grid (brainstorm + analysis) ─── */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 10px;
}
.agent-toggle {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, var(--primary));
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.agent-toggle:hover { border-color: var(--border-strong); background: var(--card-hover); }
.agent-toggle:has(input:checked) {
  border-color: var(--accent, var(--primary));
  background: rgba(90, 209, 224, 0.04);
}
.agent-toggle input[type=checkbox] {
  margin-top: 3px; accent-color: var(--primary);
  width: 16px; height: 16px; flex-shrink: 0;
}
.agent-toggle-body { display: flex; flex-direction: column; gap: 2px; }
.agent-toggle-body strong { font-size: 0.92rem; font-weight: 600; color: var(--fg); }
.agent-toggle-body .muted { font-size: 0.8rem; line-height: 1.4; }

textarea {
  font: inherit; font-size: 0.95rem; line-height: 1.55;
  padding: 12px 14px;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(90,209,224,0.10);
}
.btn-primary {
  display: inline-flex; align-items: center; gap: 0;
  height: 42px; padding: 0 18px; font-size: 14px;
}

/* ─── Document upload for brainstorm ─── */
.doc-upload-zone {
  margin-bottom: 1.2rem;
}
.doc-upload-zone input[type=file] {
  width: 100%; padding: 10px 14px;
  background: var(--bg); color: var(--fg);
  border: 1px dashed var(--border-strong);
  border-radius: 8px; font: inherit; font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 150ms ease;
}
.doc-upload-zone input[type=file]:hover { border-color: var(--primary); }
.doc-file-list {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.doc-file-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; font-size: 12px;
  background: rgba(90, 209, 224, 0.06);
  border: 1px solid var(--border);
  border-radius: 6px; color: var(--fg);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.doc-file-chip .size { color: var(--muted); }

/* ─── Action Plan ─── */
.plan-notes { margin: 0 0 1.25rem; }
.plan-notes h3 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); margin: 0 0 0.4rem; font-weight: 600; }
.plan-notes ul { margin: 0 0 0 1.2rem; padding: 0; font-size: 0.9em; color: var(--muted); line-height: 1.6; }

.plan-grid {
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 1rem;
}
@media (max-width: 860px) { .plan-grid { grid-template-columns: 1fr; gap: 16px; } }

/* Plan item — strict column flow, no position hacks */
.plan-item {
  display: flex;
  flex-direction: column;
  gap: 0;           /* spacing via margins on children — explicit, debuggable */
  background: #1e2327;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-left: 4px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
.plan-item:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow: 0 4px 20px -6px rgba(0,0,0,0.4);
}
.plan-item.plan-priority-critical { border-left-color: var(--critical); }
.plan-item.plan-priority-high     { border-left-color: var(--high); }
.plan-item.plan-priority-medium   { border-left-color: var(--medium); }
.plan-item.plan-priority-low      { border-left-color: var(--low); }

/* Row 1: badges — priority left, effort right */
.plan-badges {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.plan-effort {
  color: var(--dim); font-size: 0.78rem; font-weight: 500;
  white-space: nowrap; letter-spacing: 0.02em;
}

/* Row 2: title — height: auto, natural push-down */
.plan-title {
  margin: 12px 0 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--fg);
  height: auto;      /* explicit: never constrain */
}

/* Row 3: problem / body text */
.plan-problem {
  margin: 12px 0 0;
  font-size: 0.92em;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.70);
}

/* Row 4: metadata */
.plan-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 0.82em;
  color: var(--muted);
  margin: 12px 0 0;
  line-height: 1.5;
}
.plan-meta code, .plan-problem code, .plan-criteria code, .plan-deps code {
  background: rgba(0, 0, 0, 0.32);
  padding: 2px 5px; border-radius: 3px;
  font-size: 0.88em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

/* Rows 5+: criteria, deps, labels */
.plan-item h4 {
  margin: 14px 0 4px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--dim);
  font-weight: 600;
}
.plan-criteria {
  margin: 0 0 0 1.1rem;
  padding: 0;
  font-size: 0.88em;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.70);
}
.plan-criteria li { margin-bottom: 4px; }
.plan-deps {
  margin: 8px 0 0; font-size: 0.85em;
  color: var(--muted); line-height: 1.5;
}
.plan-labels { margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 5px; }
.plan-labels .label {
  display: inline-block;
  padding: 3px 8px;
  font-size: 0.7rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.02em;
}

/* ---------- Upload dropzone ---------- */
.dropzone {
  display: block;
  cursor: pointer;
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  padding: 2.2rem 1.75rem;
  transition: border-color 200ms ease, background 200ms ease;
  text-align: center;
  transition: border-color 150ms ease, background 150ms ease;
  background: rgba(255, 255, 255, 0.015);
}
.dropzone:hover { border-color: var(--primary); background: rgba(92, 207, 230, 0.04); }
.dropzone.dz-dragover {
  border-color: var(--primary);
  border-style: solid;
  background: rgba(92, 207, 230, 0.08);
}
.dropzone.dz-has-file { border-style: solid; border-color: #3d5840; background: rgba(127, 217, 98, 0.05); }
.dropzone.dz-error { border-color: #8a3030; background: rgba(255, 102, 102, 0.06); }
.dz-icon { color: var(--muted); margin-bottom: 0.6rem; }
.dropzone:hover .dz-icon { color: var(--primary); }
.dz-title { font-size: 1rem; color: var(--fg); margin-bottom: 0.35rem; }
.dz-link { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.dz-hint { font-size: 0.85rem; }

.dz-selected {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.file-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.85rem;
  background: rgba(127, 217, 98, 0.12);
  border: 1px solid rgba(127, 217, 98, 0.4);
  color: #b8e8a4;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
}
.file-pill svg { color: #7fd962; flex: 0 0 auto; }
.file-pill-name { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88em; }
.file-pill-size { font-size: 0.82em; margin-left: 0.2rem; }

.upload-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}
button.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none !important;
}

/* ---------- Jobs table ---------- */
.jobs-table th.numeric, .jobs-table td.numeric { text-align: right; }
.jobs-table tr.job-row { cursor: pointer; transition: background 120ms ease; }
.jobs-table tr.job-row:hover { background: rgba(255, 255, 255, 0.03); }
.jobs-table tr.job-row:focus { outline: 2px solid var(--primary); outline-offset: -2px; }
.jobs-table a.file-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--fg);
  text-decoration: none;
  font-weight: 500;
}
.jobs-table a.file-link:hover { color: var(--primary); }
.jobs-table a.file-link svg { color: var(--muted); flex: 0 0 auto; }
.jobs-table a.file-link:hover svg { color: var(--primary); }
.jobs-table .file-name {
  max-width: 26rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.jobs-table .id-code { font-size: 0.8em; color: var(--muted); background: transparent; }

.me-pill {
  display: inline-block;
  padding: 0.15em 0.6em;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(92, 207, 230, 0.12);
  color: var(--primary);
  border: 1px solid rgba(92, 207, 230, 0.35);
  border-radius: 999px;
}

.status-pulsing { display: inline-flex; align-items: center; gap: 0.4rem; }
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--running);
  box-shadow: 0 0 0 0 var(--running);
  animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 rgba(255, 204, 102, 0.6); }
  70%  { box-shadow: 0 0 0 8px rgba(255, 204, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 204, 102, 0); }
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem 2rem;
  color: var(--muted);
}
.empty-state svg { color: var(--border); margin-bottom: 0.6rem; }
.empty-state p { margin: 0.3rem 0; }
.empty-state strong { color: var(--fg); font-size: 1rem; }

/* Agents-in-this-run and help grids */
.agent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 0.8rem;
}
.agent-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent, var(--primary));
  border-radius: 6px;
  padding: 0.9rem 1rem;
}
.agent-tile h3 {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 1.05em;
}
.agent-tile .agent-role {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.85em;
}
.agent-tile .agent-domain {
  margin: 0 0 0.4rem;
  font-size: 0.9em;
}
.agent-tile .agent-lens {
  margin: 0.3rem 0 0.5rem;
  font-size: 0.92em;
}
.agent-tile details { margin: 0.5rem 0 0; padding: 0.3rem 0; border: 0; }
.agent-tile details summary {
  cursor: pointer;
  font-size: 0.88em;
  color: var(--muted);
  padding: 0;
  margin: 0;
}
.agent-tile details ul { margin: 0.4rem 0 0 1.1rem; padding: 0; font-size: 0.88em; }
.agent-tile details ul li { margin-bottom: 0.2rem; }

/* Per-agent proposal sections */
.agent-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 6px solid var(--accent, var(--primary));
  border-radius: 8px;
  padding: 0;
  margin-bottom: 1.8rem;
  overflow: hidden;
}
.agent-section .agent-header {
  background: color-mix(in srgb, var(--accent) 10%, var(--card));
  padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--border);
}
.agent-section .agent-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.agent-section .agent-header h2 {
  margin: 0;
  color: var(--accent);
}
.agent-section .agent-tag {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.8em;
  color: var(--muted);
  background: var(--bg);
  padding: 0.15em 0.55em;
  border-radius: 4px;
  border: 1px solid var(--border);
}
.agent-section .agent-role {
  margin: 0.4rem 0 0.2rem;
  color: var(--fg);
  font-weight: 500;
  font-size: 0.95em;
}
.agent-section .agent-lens {
  margin: 0.2rem 0 0.3rem;
  color: var(--muted);
  font-style: italic;
}
.agent-section .agent-body { padding: 0.8rem 1.3rem 1.3rem; }
.agent-section .agent-body h3 {
  margin: 1.1rem 0 0.35rem;
  font-size: 1em;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.agent-section .agent-body h3:first-child { margin-top: 0.2rem; }
.agent-section .agent-body ul {
  margin: 0.3rem 0 0.6rem 1.2rem;
  padding: 0;
}
.agent-section .agent-body ul li { margin-bottom: 0.4rem; }
.agent-section .rec-table {
  margin-top: 0.4rem;
  font-size: 0.93em;
}
.agent-section .rec-table td { vertical-align: top; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.9em; }
.small { font-size: 0.86em; }

/* Progress / stage */
.stage-line { margin: 0 0 0.8rem; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.stage-badge {
  padding: 0.15em 0.6em;
  border-radius: 14px;
  font-size: 0.82em;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--bg);
  border: 1px solid var(--border);
}
.stage-badge.stage-ingest     { color: var(--muted); }
.stage-badge.stage-proposals  { color: #5ccfe6; border-color: #5ccfe6; }
.stage-badge.stage-roundtable { color: #ffae57; border-color: #ffae57; }
.stage-badge.stage-consensus  { color: #c792ea; border-color: #c792ea; }
.stage-badge.stage-themes     { color: #7fd962; border-color: #7fd962; }
.stage-badge.stage-executive  { color: #ffcc66; border-color: #ffcc66; }
.stage-badge.stage-rendering  { color: var(--muted); }
.stage-badge.stage-done       { color: #7fd962; border-color: #7fd962; background: rgba(127,217,98,0.1); }

/* Executive summary card — top-of-page, amber accent */
.exec-card {
  border-left: 4px solid var(--medium);
  background: linear-gradient(180deg, rgba(255,194,71,0.04) 0%, var(--card) 35%);
}
.exec-card.exec-critical {
  border-image: linear-gradient(180deg, #ff4757, #cc2233) 1;
  background: linear-gradient(180deg, rgba(255,71,87,0.06) 0%, var(--card) 35%);
}
.exec-card.exec-elevated {
  border-image: linear-gradient(180deg, #ff8a3c, #e05a20) 1;
  background: linear-gradient(180deg, rgba(255,138,60,0.05) 0%, var(--card) 35%);
}
.exec-card.exec-managed  { border-left-color: var(--medium); }
.exec-card.exec-healthy  {
  border-left-color: var(--low);
  background: linear-gradient(180deg, rgba(95,217,122,0.04) 0%, var(--card) 35%);
}

.exec-head { margin-bottom: 1.1rem; }
.exec-headline {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.exec-label {
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}
.exec-lead {
  margin: 0;
  font-size: 1.15em;
  line-height: 1.5;
  font-weight: 500;
  color: var(--fg);
}

.posture-badge {
  padding: 0.25em 0.75em;
  border-radius: 999px;
  font-size: 0.75em;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid;
}
.posture-badge.posture-critical {
  background: rgba(255,71,87,0.15); color: #ff4757;
  border-color: rgba(255,71,87,0.3);
  box-shadow: 0 0 14px -3px rgba(255,71,87,0.35);
}
.posture-badge.posture-elevated {
  background: rgba(255,138,60,0.14); color: #ff8a3c;
  border-color: rgba(255,138,60,0.3);
  box-shadow: 0 0 14px -3px rgba(255,138,60,0.3);
}
.posture-badge.posture-managed {
  background: rgba(255,194,71,0.12); color: #ffc247;
  border-color: rgba(255,194,71,0.25);
}
.posture-badge.posture-healthy {
  background: rgba(95,217,122,0.12); color: #5fd97a;
  border-color: rgba(95,217,122,0.25);
}

.exec-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
  margin: 1rem 0 1.2rem;
}
.exec-metric {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
}
.exec-metric-value {
  font-size: 1.55em;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.1;
}
.exec-metric-label {
  margin-top: 0.2rem;
  font-size: 0.8em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.exec-metric-context { margin-top: 0.3rem; }

.exec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 1.2rem;
  margin-top: 0.6rem;
}
.exec-col h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}
.exec-col.exec-risks h3 { color: #ff9e9e; }
.exec-col.exec-investments h3 { color: #7fd962; }
.exec-list { list-style: none; padding: 0; margin: 0; }
.exec-list li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}
.exec-list li:last-child { border-bottom: 0; }
.exec-item-title {
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}
.likelihood {
  padding: 0.1em 0.55em;
  border-radius: 10px;
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.likelihood-low    { background: rgba(127,217,98,0.2); color: #7fd962; }
.likelihood-medium { background: rgba(255,204,102,0.25); color: #ffcc66; }
.likelihood-high   { background: rgba(255,59,59,0.22); color: #ff6666; }
.inv-badge {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.78em;
  padding: 0.08em 0.5em;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--primary);
  font-weight: 600;
}

.exec-asks {
  margin-top: 1.2rem;
  padding: 0.9rem 1rem;
  border-radius: 6px;
  background: rgba(92, 207, 230, 0.06);
  border-left: 3px solid var(--primary);
}
.exec-asks h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9em;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  font-weight: 600;
}
.exec-asks ul { margin: 0; padding-left: 1.2rem; }
.exec-asks li { margin-bottom: 0.3rem; }

.progress-table { margin-top: 0.4rem; }
.progress-table td, .progress-table th { padding: 0.4rem 0.6rem; }
.progress-table td:nth-child(1) { width: 22%; }
.progress-table td:nth-child(2), .progress-table td:nth-child(3) { width: 18%; }

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 0.45em;
  vertical-align: middle;
  background: var(--muted);
}
.dot-pending { background: #3a4048; }
.dot-running {
  background: #ffae57;
  box-shadow: 0 0 0 0 rgba(255,174,87,0.7);
  animation: dot-pulse 1.3s ease-out infinite;
}
.dot-done   { background: #7fd962; }
.dot-error  { background: #ff6666; }
@keyframes dot-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(255,174,87,0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(255,174,87,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,174,87,0); }
}

/* Roundtable / consensus */
.rec-flow {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
  margin-top: 0.5rem;
}
.rec-col { padding: 0.8rem 1rem; border-radius: 6px; border: 1px solid var(--border); }
.rec-col h3 { margin-top: 0; font-size: 0.95em; text-transform: uppercase; letter-spacing: 0.03em; }
.rec-col.strengthened { background: rgba(127,217,98,0.06); border-left: 3px solid #7fd962; }
.rec-col.strengthened h3 { color: #7fd962; }
.rec-col.weakened { background: rgba(255,102,102,0.06); border-left: 3px solid #ff6666; }
.rec-col.weakened h3 { color: #ff9e9e; }
.list-dis li { margin-bottom: 0.6rem; }
.list-net li { margin-bottom: 0.5rem; font-weight: 500; }

.peer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 1rem;
}
.peer-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent, var(--primary));
  border-radius: 6px;
  padding: 0.9rem 1rem;
}
.peer-card-head { display: flex; align-items: baseline; gap: 0.6rem; }
.peer-card-head h3 { margin: 0; color: var(--accent); font-size: 1.05em; }
.peer-review { margin-top: 0.6rem; padding: 0.5rem 0.7rem; }
.peer-review summary { font-size: 0.95em; }
.peer-review h4 {
  margin: 0.6rem 0 0.25rem;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.peer-review ul { margin: 0.2rem 0 0.4rem 1.1rem; padding: 0; font-size: 0.92em; }
.peer-review ul li { margin-bottom: 0.3rem; }
.peer-review p { margin: 0.4rem 0; font-size: 0.92em; }
.label-strong { color: #7fd962; }
.label-weak   { color: #ff9e9e; }

/* User control panel */
.notice {
  color: #7fd962;
  background: #102015;
  border: 1px solid #2a4a30;
  padding: 0.6rem 0.8rem;
  border-radius: 4px;
}
.role-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.22em 0.7em;
  border-radius: 999px;
  vertical-align: middle;
  line-height: 1;
}
.role-tag.role-admin { background: #4a2a55; color: #f5cdfa; border: 1px solid #7a4a8a; }
.role-tag.role-user  { background: #1f3450; color: #b4d6ff; border: 1px solid #3f6390; }
/* user management table */
.hidden { display: none !important; }

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}
.card-header h2 { margin: 0; }

.users-table { margin-top: 0.4rem; }
.users-table td { vertical-align: middle; padding: 0.6rem 0.6rem; }
.users-table th.actions-col { text-align: right; }
.users-table .inline-form { display: inline-flex; gap: 0; margin: 0; }

.user-row.is-self { opacity: 0.72; }
.user-row.is-self:hover { opacity: 1; }

.user-cell {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.avatar.small {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a3340 0%, #3a4555 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--fg);
  flex: 0 0 auto;
}
.user-name code { background: transparent; padding: 0; font-size: 0.95em; }

.role-cell .mode-edit {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.actions-cell { text-align: right; }
.actions-cell .row-actions,
.actions-cell .mode-pw {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.3rem;
}
.role-cell select,
.actions-cell input[type="password"] {
  padding: 0.3rem 0.5rem;
  font-size: 0.88rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.actions-cell input[type="password"] { min-width: 14rem; }

button.btn-compact {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 500;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
button.btn-compact:hover { background: rgba(255,255,255,0.04); border-color: #3a4250; }
button.btn-compact.ghost { background: transparent; color: var(--muted); }
button.btn-compact.ghost:hover { color: var(--fg); }
button.btn-compact.danger {
  color: #ffb8b8;
  border-color: #6a2828;
}
button.btn-compact.danger:hover {
  background: rgba(255, 102, 102, 0.08);
  border-color: #8a3030;
  color: #ffd0d0;
}

/* quiet text-link style used for row actions — stays neutral until hover */
button.btn-link {
  background: transparent;
  color: var(--fg);
  border: 1px solid transparent;
  padding: 0.3rem 0.6rem;
  font-size: 0.86rem;
  font-weight: 500;
  border-radius: 5px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
button.btn-link:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.btn-link.danger { color: #e99; }
button.btn-link.danger:hover {
  background: rgba(255, 102, 102, 0.1);
  border-color: #7a2828;
  color: #ffd0d0;
}
.user-row:not(:hover) .row-actions .btn-link { color: var(--muted); }
.user-row:hover .row-actions .btn-link { color: var(--fg); }
.user-row:hover .row-actions .btn-link.danger { color: #ffb8b8; }

.panel-heading {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

button.btn-primary {
  padding: 0.45rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--primary);
  color: #0f1419;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  transition: filter 120ms ease;
}
button.btn-primary:hover { filter: brightness(1.1); }

.add-user-panel {
  background: rgba(92, 207, 230, 0.04);
  border: 1px solid rgba(92, 207, 230, 0.18);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.add-user-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  align-items: flex-end;
}
.add-user-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
  flex: 1 1 12rem;
}
.add-user-form input,
.add-user-form select {
  height: 36px;
  padding: 0 0.6rem;
  font-size: 0.92rem;
  font-family: inherit;
  line-height: 1.2;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-sizing: border-box;
}
.add-user-form select { appearance: none; padding-right: 1.8rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.add-user-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

/* legacy — keep old .danger style for pre-existing usage */
button.danger:not(.btn-compact) {
  background: #5a1f1f;
  color: #ffb8b8;
  border: 1px solid #8a3030;
}
button.danger:not(.btn-compact):hover { background: #7a2828; }
.stacked-form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  max-width: 28rem;
}
.stacked-form label { display: flex; flex-direction: column; gap: 0.3rem; }
.stacked-form button { align-self: flex-start; }

/* Actions bar (top of completed job) — single horizontal baseline */
/* ─── Unified Toolbar (Actions Bar) ─── */
.actions-bar { border-left: 3px solid var(--primary); }

/* Single horizontal row — all items on one 40px baseline */
.actions-row {
  display: flex; align-items: center; gap: 10px;
  min-height: 42px;
}
.actions-row .inline { flex: 0 0 auto; }
.actions-row .share-form { flex: 1 1 auto; min-width: 0; max-width: 28rem; }

.action-done {
  font-size: 13px; color: var(--primary);
  height: 42px; padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px; white-space: nowrap;
  display: inline-flex; align-items: center;
}

/* Generate button — cyan primary with icon, 40px tall */
.btn-outline {
  background: linear-gradient(135deg, #4ec5d4, #5ad1e0);
  color: #0b0d10;
  border: none;
  font-weight: 600; cursor: pointer;
  height: 42px; padding: 0 16px;
  border-radius: 6px;
  font-size: 13px; white-space: nowrap;
  display: inline-flex; align-items: center;
  transition: background 180ms ease, box-shadow 180ms ease, transform 100ms ease;
}
.btn-outline:hover {
  background: linear-gradient(135deg, #5ad1e0, #7adde8);
  box-shadow: 0 2px 14px -3px rgba(90,209,224,0.35);
  transform: translateY(-0.5px);
}
.btn-outline:active { transform: translateY(0.5px); }

/* Inline SVG icons — 16px, tight with text */
.icon {
  display: inline-block; width: 16px; height: 16px; vertical-align: -2px;
  margin-right: 6px; fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0;
}

/* Downloads row below the toolbar */
.downloads-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.downloads-label { margin-right: 4px; }
.dl-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px;
  font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--primary); border: 1px solid var(--border);
  border-radius: 6px; transition: all .15s ease;
}
.dl-chip:hover {
  border-color: var(--primary); background: rgba(90,209,224,0.06);
  text-decoration: none; transform: translateY(-1px);
  box-shadow: 0 2px 8px -2px rgba(90,209,224,0.2);
}
.dl-chip .icon { width: 12px; height: 12px; margin-right: 3px; }

@media (max-width: 860px) {
  .actions-row { flex-wrap: wrap; }
  .actions-row .share-form { min-width: 240px; max-width: none; }
}

/* ─── Share Email — Joined Input Group, 40px ─── */
.share-form { }
.share-row {
  display: flex; height: 42px;
}
.share-row .share-input {
  flex: 1; padding: 0 12px; background: var(--bg); color: var(--fg);
  border: 1px solid var(--border-strong); font: inherit; font-size: 13px;
  border-radius: 4px 0 0 4px; border-right: none;
  min-width: 120px; height: 42px;
}
.share-row .share-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(90,209,224,0.10);
  z-index: 1; position: relative;
}
.share-row .btn-primary {
  border-radius: 0 4px 4px 0; white-space: nowrap;
  height: 42px; padding: 0 14px; font-size: 13px;
  display: inline-flex; align-items: center; gap: 0;
  border: 1px solid transparent;
}
.share-hint { margin: 10px 0 0; }
.share-success {
  padding: 10px 14px; border-radius: 8px; margin: 0 0 14px;
  background: rgba(74,208,122,0.08); border: 1px solid rgba(74,208,122,0.25);
  color: #5fd97a; font-size: 13px; font-weight: 500;
}
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 520px) {
  .share-row { flex-direction: column; height: auto; }
  .share-row .share-input { border-radius: 4px; border-right: 1px solid var(--border-strong); height: 42px; }
  .share-row .btn-primary { border-radius: 4px; height: 42px; margin-top: 6px; justify-content: center; }
}

/* ── Dashboard spacing rhythm token ────────────────────────────── */
:root { --dash-gap: 14px; }

/* ── Dashboard: quick-action cards ─────────────────────────────── */
.dash-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: var(--dash-gap);
}
.dash-action-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--fg);
  position: relative;
  transition: border-color 0.2s, background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.dash-action-card:hover {
  border-color: var(--primary-dim);
  background: var(--card-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(90,209,224,0.08), 0 0 0 1px rgba(90,209,224,0.1);
}
.dash-action-icon {
  flex-shrink: 0;
  width: 48px; height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(90,209,224,0.08);
  border-radius: 10px;
  color: var(--primary);
  transition: background 0.2s;
}
.dash-action-card:hover .dash-action-icon {
  background: rgba(90,209,224,0.14);
}
/* Hover chevron */
.dash-action-card::after {
  content: '';
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-right: 2px solid var(--dim);
  border-top: 2px solid var(--dim);
  transform: translateY(-50%) rotate(45deg);
  opacity: 0;
  transition: opacity 0.2s, border-color 0.2s;
}
.dash-action-card:hover::after {
  opacity: 1;
  border-color: var(--primary);
}
.dash-action-card strong { display: block; font-size: 15px; margin-bottom: 3px; }
.dash-action-card .muted { display: block; }
.dash-action-hint {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--dim);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 3px;
}

/* ── Dashboard: show-count picker ──────────────────────────────── */
.show-picker {
  display: flex;
  align-items: center;
  gap: 8px;
}
.show-select {
  background: var(--bg-raised);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.show-select:focus { outline: 2px solid var(--primary-dim); outline-offset: 1px; }

/* ── Type pill (Analysis / Brainstorm) ─────────────────────────── */
.type-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.type-analysis {
  background: rgba(90, 209, 224, 0.12);
  color: var(--primary);
}
.type-brainstorm {
  background: rgba(195, 140, 255, 0.12);
  color: #c38cff;
}

@media (max-width: 640px) {
  .dash-actions { grid-template-columns: 1fr; }
  .dash-action-card::after { display: none; }
  .dash-stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Meet the Team section ─────────────────────────────────────── */
.team-section {
  margin-bottom: 24px;
}
.team-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}
.team-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin: 0;
}
.team-subtitle {
  font-size: 12px;
}
.team-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 10px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.18s, transform 0.14s, box-shadow 0.18s;
  cursor: default;
}
.team-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}
/* Accent border-top per agent color */
.team-card.accent-border-blue:hover   { border-color: #4a9eff; }
.team-card.accent-border-purple:hover { border-color: #b07aff; }
.team-card.accent-border-green:hover  { border-color: #5fd97a; }
.team-card.accent-border-orange:hover { border-color: #ff8a3c; }
.team-card.accent-border-red:hover    { border-color: #ff6b6b; }
.team-card.accent-border-teal:hover   { border-color: #5ad1e0; }

.team-card-avatar {
  margin-bottom: 10px;
  padding: 6px;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
}
.agent-avatar-canvas {
  display: block;
  image-rendering: pixelated;
}
.team-card-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
}
.team-card-role {
  font-size: 12px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: 0.01em;
  line-height: 1.2;
}
.team-card-lens {
  font-size: 10px;
  line-height: 1.35;
  max-width: 130px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Team card interaction states ──────────────────────────────── */
.team-card { cursor: pointer; }
.team-card.is-selected {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 1px var(--primary), 0 4px 16px rgba(90,209,224,0.12);
  background: var(--bg-raised);
  opacity: 1 !important;
}
/* Dim unselected cards when one is active */
.team-grid.has-selection .team-card:not(.is-selected) {
  opacity: 0.5;
  transition: opacity 0.25s, border-color 0.18s, transform 0.14s, box-shadow 0.18s;
}
.team-grid.has-selection .team-card:not(.is-selected):hover {
  opacity: 0.8;
}

/* ── Agent identity slide-over panel ──────────────────────────── */
.agent-panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  cursor: pointer;
  transition: opacity 0.3s ease-out;
}
.agent-panel-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.agent-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 85vw);
  background: #161b22;
  border-left: 1px solid var(--border-strong);
  z-index: 210;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: -8px 0 32px rgba(0,0,0,0.35);
}
.agent-panel.is-open {
  transform: translateX(0);
}
.agent-panel-header {
  display: flex;
  justify-content: flex-end;
  padding: 14px 16px 0;
  flex-shrink: 0;
}
.agent-panel-close {
  background: none; border: 1px solid var(--border); color: var(--muted); cursor: pointer;
  padding: 6px; border-radius: 8px; width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.agent-panel-close:hover { color: var(--fg); background: rgba(255,255,255,0.06); border-color: var(--border-strong); }
.agent-panel-body {
  flex: 1; overflow-y: auto; padding: 8px 24px 32px;
  -webkit-overflow-scrolling: touch;
}

/* ── Panel content styles ─────────────────────────────────────── */
.ap-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.ap-avatar {
  display: block;
  image-rendering: pixelated;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px;
  flex-shrink: 0;
}
.ap-hero-text { min-width: 0; }
.ap-title {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.01em;
}
.ap-role { font-size: 13px; display: block; }

.ap-section {
  margin-bottom: 22px;
}
.ap-section-title {
  margin: 0 0 8px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
}
.ap-bio {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--fg);
}
.ap-domain {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* Competency tags — light border style */
.ap-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ap-tag {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  letter-spacing: 0.02em;
  background: transparent;
}
.ap-tag.accent-bg-blue   { border: 1px solid rgba(74,158,255,0.25); color: #4a9eff; }
.ap-tag.accent-bg-purple { border: 1px solid rgba(176,122,255,0.25); color: #b07aff; }
.ap-tag.accent-bg-green  { border: 1px solid rgba(95,217,122,0.25); color: #5fd97a; }
.ap-tag.accent-bg-orange { border: 1px solid rgba(255,138,60,0.25); color: #ff8a3c; }
.ap-tag.accent-bg-red    { border: 1px solid rgba(255,107,107,0.25); color: #ff6b6b; }
.ap-tag.accent-bg-teal   { border: 1px solid rgba(90,209,224,0.25); color: #5ad1e0; }

/* Looks-for list */
.ap-looks-for {
  margin: 0;
  padding: 0 0 0 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--fg-secondary);
}
.ap-looks-for li {
  margin-bottom: 6px;
}
.ap-looks-for li::marker {
  color: var(--dim);
}

/* Tools — interactive feel */
.ap-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ap-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-secondary);
  cursor: default;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.ap-tool:hover {
  border-color: var(--primary-dim);
  box-shadow: 0 0 8px rgba(90,209,224,0.1);
  transform: translateY(-1px);
}
.ap-tool svg { flex-shrink: 0; color: var(--primary); }

.ap-audience {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* Panel loading skeleton */
@keyframes ap-shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: 200px 0; }
}
.ap-skeleton {
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 100%);
  background-size: 400px 100%;
  animation: ap-shimmer 1.5s infinite linear;
  margin-bottom: 10px;
}

/* Mobile: full overlay drawer */
@media (max-width: 1024px) {
  .agent-panel { width: 100vw; }
}

/* ── Stat cards (4-column grid) ─────────────────────────────────── */
.dash-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: var(--dash-gap);
}
.dash-stat-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 14px 18px;
  background: #161b22;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.dash-stat-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.dash-stat-bg-icon {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 64px;
  height: 64px;
  opacity: 0.04;
  pointer-events: none;
}
.dash-stat-num {
  font-size: 34px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  line-height: 1;
  position: relative;
  z-index: 1;
}
.dash-stat-num-idle {
  color: var(--dim);
}
.dash-stat-num-live {
  color: var(--done);
  text-shadow: 0 0 10px rgba(74,222,128,0.5);
  animation: stat-pulse 2s ease-in-out infinite;
}
@keyframes stat-pulse {
  0%, 100% { opacity: 1; text-shadow: 0 0 10px rgba(74,222,128,0.5); }
  50% { opacity: 0.6; text-shadow: 0 0 16px rgba(74,222,128,0.3); }
}
.dash-stat-lbl {
  margin-top: 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  position: relative;
  z-index: 1;
}
.dash-stat-live {
  border-color: rgba(74,222,128,0.15);
}
.dash-stat-live .dash-stat-bg-icon {
  opacity: 0.06;
  stroke: var(--done);
}

/* ── Jobs section ──────────────────────────────────────────────── */
.dash-jobs-section {
  border-top: 1px solid #1f2937;
}
.dash-jobs-section > .card-header {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

/* ── Status icons (table) ──────────────────────────────────────── */
.status-icon { display: inline-flex; align-items: center; }
.status-icon svg { vertical-align: middle; }

/* ── Table action button ───────────────────────────────────────── */
.btn-table-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: rgba(90,209,224,0.08);
  border: 1px solid rgba(90,209,224,0.15);
  border-radius: 5px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  float: right;
}
.btn-table-action:hover {
  background: rgba(90,209,224,0.15);
  border-color: rgba(90,209,224,0.3);
}

@media (max-width: 800px) {
  .team-grid { grid-template-columns: repeat(3, 1fr); }
  .team-header { flex-direction: column; gap: 4px; }
}
@media (max-width: 500px) {
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-metrics-bar { flex-wrap: wrap; gap: 8px; }
  .dash-metric-sep { display: none; }
}

/* ── Status dots & war-stage bar ───────────────────────────────── */
.war-stage-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.dot-pending { background: var(--dim); }
.dot-running { background: var(--running); }
.dot-done { background: var(--done); }
.dot-error { background: var(--error); }
.dot-pulse {
  animation: dot-pulse-anim 1.4s ease-in-out infinite;
}
@keyframes dot-pulse-anim {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; }
  50% { opacity: 0.5; box-shadow: 0 0 6px 2px currentColor; }
}
.dot-running.dot-pulse { color: var(--running); }

/* Spinning conic-gradient border for critiquing / processing states */
.dot-spin {
  position: relative;
  background: transparent;
  width: 10px; height: 10px;
  will-change: transform;
}
.dot-spin::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    var(--teal) 30%,
    var(--running) 60%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: dot-spin-rotate 1.8s linear infinite;
}
.dot-spin::after {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--running);
  opacity: 0.35;
}
@keyframes dot-spin-rotate {
  to { transform: rotate(360deg); }
}

/* Progress table row hover highlight */
.progress-table tbody tr {
  transition: background 0.15s;
  cursor: default;
}
.progress-table tbody tr:hover {
  background: rgba(90,209,224,0.04);
}

/* ── Breadcrumb ────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 12px;
}
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.bc-sep { color: var(--dim); }
.bc-current { color: var(--fg-secondary); font-weight: 600; }

/* ── Back button ───────────────────────────────────────────────── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.btn-back:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--primary-dim);
  color: var(--primary);
}

/* ── Progress stepper ──────────────────────────────────────────── */
.war-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin: 20px 0 16px;
  padding: 16px 20px;
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
  border: 1px solid var(--border);
}
.war-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 70px;
}
.war-step-dot {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--dim);
  background: var(--bg);
  position: relative;
}
.war-step-done .war-step-dot {
  border-color: var(--done);
  background: rgba(95,217,122,0.1);
}
.war-step-active .war-step-dot {
  border-color: var(--primary);
  background: rgba(90,209,224,0.1);
}
.war-step-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: step-pulse 1.5s ease-in-out infinite;
  will-change: transform, opacity;
}
@keyframes step-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.4); opacity: 0.5; }
}
.war-step-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--dim);
}
.war-step-done .war-step-label { color: var(--done); }
.war-step-active .war-step-label { color: var(--primary); }
.war-step-line {
  flex: 1;
  height: 2px;
  background: var(--border-strong);
  min-width: 20px;
  margin: 0 4px;
  margin-bottom: 22px; /* offset for label height */
}
.war-step-line-done { background: var(--done); }

/* ── War room layout ───────────────────────────────────────────── */
.war-room-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 12px;
  margin-top: 16px;
}
@media (max-width: 1000px) {
  .war-room-layout { grid-template-columns: 1fr; }
}

/* ── Pixel Office ──────────────────────────────────────────────── */
.pixel-office-wrap {
  display: flex;
  justify-content: center;
}
.pixel-office-wrap canvas {
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0a0c0f;
  max-width: 100%;
  height: auto !important;
  cursor: crosshair;
  will-change: contents;
  transform: translateZ(0);
}

/* ── Activity log ──────────────────────────────────────────────── */
.war-activity-log {
  background: #0c0e12;
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  max-height: 500px;
  overflow: hidden;
}
.war-log-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.war-log-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  font-family: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--teal) transparent;
}
.war-log-body::-webkit-scrollbar { width: 4px; }
.war-log-body::-webkit-scrollbar-track { background: transparent; }
.war-log-body::-webkit-scrollbar-thumb {
  background: var(--teal);
  border-radius: 4px;
}
.war-log-entry {
  padding: 3px 14px;
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 0 6px;
  align-items: baseline;
}
.war-log-entry.war-log-system {
  grid-template-columns: auto 1fr;
  padding-top: 8px;
  padding-bottom: 4px;
}
.war-log-new {
  animation: log-flash 0.6s ease-out;
  will-change: background;
}
@keyframes log-flash {
  0% { background: rgba(90,209,224,0.08); }
  100% { background: transparent; }
}
.war-log-time {
  color: var(--dim);
  font-size: 11px;
  white-space: nowrap;
}
.war-log-agent {
  font-weight: 600;
  white-space: nowrap;
}
.war-log-msg {
  color: var(--fg-secondary);
}
.war-log-system .war-log-msg {
  color: var(--teal);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Agent click popup ─────────────────────────────────────────── */
.war-agent-popup {
  position: fixed;
  z-index: 300;
  background: #161b22;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 14px 16px;
  min-width: 220px;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.war-popup-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.war-popup-header canvas {
  image-rendering: pixelated;
  flex-shrink: 0;
}
.war-popup-header strong {
  font-size: 14px;
  display: block;
}
.war-popup-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}
.war-popup-close:hover { color: var(--fg); }
.war-popup-msg {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.03);
  border-radius: 6px;
  font-size: 12px;
  font-style: italic;
  color: var(--fg-secondary);
  border-left: 2px solid var(--primary-dim);
}

/* ── Results tab navigation ───────────────────────────────────── */
.results-tabs {
  display: flex;
  gap: 0.25rem;
  padding: 0 0.25rem;
  margin: 1.25rem 0 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 60px;
  z-index: 50;
  background: rgba(11, 13, 16, 0.88);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
}
.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 40px;
  padding: 0 0.9rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  border: none;
  background: none;
  border-radius: 6px 6px 0 0;
  position: relative;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.tab-btn:hover { color: var(--fg); background: rgba(255, 255, 255, 0.04); }
.tab-btn.is-active { color: var(--fg); }
.tab-btn.is-active::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0;
  height: 2px;
  background: var(--primary);
  border-radius: 2px 2px 0 0;
}
.tab-btn .tab-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 8px;
  line-height: 1.4;
}
.tab-btn.is-active .tab-count { color: var(--primary); background: rgba(90,209,224,0.12); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
@media print {
  .results-tabs { display: none; }
  .tab-panel { display: block !important; }
  .results-sidebar { display: none; }
  .results-split { display: block !important; }
}

/* ── Split layout: content + utility sidebar ─────────────────── */
.results-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}
.results-main { min-width: 0; }
.results-sidebar { display: none; }

@media (min-width: 1400px) {
  .results-split {
    grid-template-columns: 1fr 300px;
  }
  .results-sidebar { display: block; }
  /* Tab bar spans only the main column — no need for full width */
  .results-tabs { margin-right: 0; }
}

/* ── Sidebar styling ─────────────────────────────────────────── */
.results-sidebar {
  position: sticky;
  top: 72px; /* 60px header + 12px breathing room */
  align-self: start;
  max-height: calc(100vh - 84px);
  overflow-y: auto;
  padding-bottom: 2rem;
  -webkit-overflow-scrolling: touch;
}
.sidebar-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 12px;
}
.sidebar-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin: 0 0 10px;
}
.sidebar-heading svg { opacity: 0.6; flex-shrink: 0; }
.sidebar-downloads {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.sidebar-downloads .dl-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  padding: 6px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg-secondary);
  text-decoration: none;
  transition: background 120ms, color 120ms, border-color 120ms;
}
.sidebar-downloads .dl-chip:hover {
  background: rgba(90,209,224,0.08);
  color: var(--primary);
  border-color: rgba(90,209,224,0.2);
}
.sidebar-input {
  width: 100%;
  padding: 7px 10px;
  font-size: 0.78rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--fg);
  margin-bottom: 8px;
}
.sidebar-input:focus {
  outline: none;
  border-color: var(--primary-dim);
  box-shadow: 0 0 0 2px rgba(90,209,224,0.15);
}
.sidebar-btn {
  width: 100%;
  padding: 7px 0;
  font-size: 0.78rem;
  border-radius: 6px;
}
.sidebar-agents {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sidebar-agent {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  border-radius: 6px;
  border-left: 3px solid var(--primary-dim);
  background: rgba(255,255,255,0.02);
}
.sidebar-agent.accent-blue { border-left-color: #4a9eff; }
.sidebar-agent.accent-purple { border-left-color: #b07aff; }
.sidebar-agent.accent-green { border-left-color: #5fd97a; }
.sidebar-agent.accent-orange { border-left-color: #ff8a3c; }
.sidebar-agent.accent-red { border-left-color: #ff6b6b; }
.sidebar-agent.accent-teal { border-left-color: #5ad1e0; }
.sidebar-agent-name {
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--fg-secondary);
}
.sidebar-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.68rem;
  margin: 0;
}
.sidebar-dl dt {
  font-family: "Inter Variable", "Inter", system-ui, sans-serif;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}
.sidebar-dl dd { margin: 0; color: var(--fg-secondary); }
.sidebar-dl code { font-size: 0.65rem; }

/* ── Narrow-only actions bar (hidden when sidebar visible) ──── */
.actions-bar-narrow { display: block; }
@media (min-width: 1400px) {
  .actions-bar-narrow { display: none; }
}

/* ── Prose readability cap (≈75ch) ────────────────────────────── */
.agent-body p,
.agent-body ul,
.agent-body li,
.plan-notes,
.plan-problem,
.exec-asks,
.exec-lead,
.themes li,
.list-dis li,
.list-net li,
.peer-review li,
.peer-review p {
  max-width: 75ch;
}

/* ── Agent section separators ────────────────────────────────── */
.agent-section + .agent-section {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 0.5rem;
}

/* ── Sidebar: agent click → scroll to proposal ───────────────── */
.sidebar-agent {
  cursor: pointer;
  transition: background 120ms, border-left-color 120ms;
}
.sidebar-agent:hover {
  background: rgba(255,255,255,0.05);
}

/* ── Sidebar: compact export grid ────────────────────────────── */
.sidebar-downloads .dl-chip:last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

/* ── Share button success state ──────────────────────────────── */
.sidebar-btn.is-sent {
  background: var(--done);
  color: #0b0d10;
  pointer-events: none;
}

/* ── Email validation ────────────────────────────────────────── */
.sidebar-input:invalid:not(:placeholder-shown) {
  border-color: var(--error);
  box-shadow: 0 0 0 2px rgba(255,107,107,0.15);
}

/* ── Breadcrumb breathing room ───────────────────────────────── */
.breadcrumb { margin-bottom: 1.25rem; padding-top: 0.25rem; }

/* ── Stepper: left-align within main column on wide screens ──── */
@media (min-width: 1400px) {
  .war-stepper {
    padding: 20px 32px;
    gap: 0;
    justify-content: flex-start;
  }
  .war-step { min-width: 90px; }
  .war-step-dot { width: 28px; height: 28px; }
  .war-step-label { font-size: 11px; }
  .war-step-line { width: 48px; }
}

/* ── Dev environment banner ─────────────────────────────────────────
   Rendered only when OA_ENV=dev. Sticky at the very top so the user
   cannot confuse the dev URL with prod after scrolling. */
.env-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: 28px;
  padding: 0 16px;
  background: linear-gradient(90deg, #d97a1f 0%, #f4a14a 50%, #d97a1f 100%);
  color: #1a0f00;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.env-banner-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1a0f00;
  animation: env-banner-pulse 2s ease-in-out infinite;
}
@keyframes env-banner-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.85); }
  50%      { opacity: 1;   transform: scale(1.15); }
}
.env-banner-host {
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: none;
  opacity: 0.8;
}
/* Subtle inner border on the body so the dev nature is visible even
   when scrolled past the sticky banner on small screens. */
body.env-dev {
  box-shadow: inset 0 0 0 2px rgba(217, 122, 31, 0.35);
}

