:root {
  color-scheme: light;
  --bg: #fafafa;
  --panel: #ffffff;
  --panel-alt: #fafafa;
  --ink: #0a0a0a;
  --ink-2: #171717;
  --ink-3: #404040;
  --muted: #737373;
  --muted-2: #a3a3a3;
  --line: #ebebeb;
  --line-2: #e4e4e4;
  --line-strong: #d4d4d4;
  --accent: #0070f3;
  --accent-soft: rgba(0, 112, 243, 0.08);
  --success: #0a8754;
  --success-soft: #e6f4ec;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --error: #b91c1c;
  --error-soft: #fef2f2;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: "Inter", "Geist", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select {
  font: inherit;
  letter-spacing: inherit;
}

button,
a,
select {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a {
  color: var(--ink);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
}

h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
}

.mono {
  font-family: var(--mono);
  font-feature-settings: "ss01", "ss02", "tnum";
}

.icon {
  display: inline-block;
  flex: 0 0 auto;
  height: 16px;
  width: 16px;
}

/* ============ Header ============ */

.app-header {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 16px;
  grid-template-columns: auto 1fr auto;
  padding: 14px 24px;
}

.brand-mark {
  align-items: center;
  background: var(--ink);
  border-radius: var(--radius-sm);
  color: white;
  display: grid;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.brand-mark .icon {
  height: 14px;
  width: 14px;
}

.brand-copy {
  min-width: 0;
}

.brand-copy .eyebrow {
  display: none;
}

.brand-copy h1 {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.eyebrow,
.section-kicker {
  display: none;
}

.header-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.language-switch {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  padding: 2px;
}

.lang-button {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  min-height: 24px;
  padding: 0 8px;
  transition: color 120ms ease, background 120ms ease;
}

.lang-button:hover {
  color: var(--ink);
}

.lang-button.is-active {
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.ghost-link {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-3);
  display: inline-flex;
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  text-decoration: none;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.ghost-link:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.ghost-link.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ============ Layout ============ */

main {
  display: grid;
  gap: 16px;
  grid-template-columns: 220px minmax(0, 1fr);
  grid-template-areas:
    "rail hero"
    "rail scancard"
    "rail banner"
    "rail mapgrid"
    "rail metrics"
    "rail results";
  margin: 0 auto;
  max-width: 1500px;
  padding: 24px;
  transition: grid-template-columns 200ms ease;
}

main > .scan-card {
  grid-area: scancard;
}

/* Run status bar (post-scan compact summary) */

.run-status-bar {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 48px;
  padding: 8px 16px;
}

.run-status-bar[hidden] {
  display: none;
}

.run-status-summary {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-size: 13px;
  gap: 10px;
  min-width: 0;
}

.run-status-dot {
  background: var(--muted-2);
  border-radius: 999px;
  flex: 0 0 auto;
  height: 8px;
  width: 8px;
}

.run-status-dot.is-completed {
  background: var(--success);
}

.run-status-dot.is-running {
  animation: pulse 1.2s ease-in-out infinite;
  background: var(--accent);
}

.run-status-dot.is-failed {
  background: var(--error);
}

.run-status-text {
  font-family: var(--sans);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-status-text .meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  margin: 0 6px;
}

.run-status-text strong {
  color: var(--ink);
  font-weight: 600;
}

.run-status-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  gap: 6px;
  letter-spacing: 0.02em;
  min-height: 32px;
  padding: 0 10px;
  text-transform: uppercase;
  transition: border-color 120ms ease, color 120ms ease;
}

.run-status-toggle:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.run-status-toggle-chev {
  display: inline-flex;
  transition: transform 180ms ease;
}

.run-status-toggle[aria-expanded="true"] .run-status-toggle-chev {
  transform: rotate(180deg);
}

/* PRO-203: scan-card — unified module replacing status bar + summary grid + map-progress + results split */

.scan-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.scan-card[hidden] {
  display: none;
}

.scan-card.is-completed {
  border-color: rgba(10, 135, 84, 0.3);
}

.scan-card.is-failed {
  border-color: rgba(185, 28, 28, 0.3);
}

.scan-card-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
}

.scan-card-title-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.scan-card-dot {
  background: var(--muted-2);
  border-radius: 999px;
  flex: 0 0 auto;
  height: 10px;
  width: 10px;
}

.scan-card-dot.is-running {
  animation: pulse 1.2s ease-in-out infinite;
  background: var(--accent);
}

.scan-card-dot.is-completed {
  background: var(--success);
}

.scan-card-dot.is-failed {
  background: var(--error);
}

.scan-card-title {
  color: var(--ink);
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-card-title .meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  margin-left: 8px;
}

.scan-card-title .check {
  color: var(--success);
  margin-right: 6px;
}

.scan-card-toggle {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
  letter-spacing: -0.005em;
  min-height: 32px;
  padding: 0 12px;
  transition: border-color 120ms ease, color 120ms ease;
}

.scan-card-toggle:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.scan-card-toggle-chev {
  display: inline-flex;
  transition: transform 180ms ease;
}

.scan-card-toggle[aria-expanded="true"] .scan-card-toggle-chev {
  transform: rotate(180deg);
}

/* Progress bar (running state only) */
.scan-card-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scan-card-progress[hidden] {
  display: none;
}

.scan-card-progress-bar {
  background: var(--line);
  border-radius: 999px;
  flex: 1;
  height: 4px;
  overflow: hidden;
}

#scan-card-progress-fill {
  background: var(--accent);
  height: 100%;
  transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
}

.scan-card-progress-text {
  color: var(--ink-3);
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

/* PRO-206: Agent pipeline (running state, 4 stages with live event) */
.scan-card-pipeline {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--panel-alt);
}

.scan-card-pipeline[hidden] {
  display: none;
}

.scan-card-pipeline li {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: 20px 18px minmax(0, 1fr) auto;
  min-height: 44px;
  padding: 8px 12px;
}

.scan-card-pipeline li:last-child {
  border-bottom: 0;
}

.pipeline-dot {
  align-items: center;
  background: var(--panel);
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted-2);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  height: 18px;
  justify-content: center;
  line-height: 1;
  width: 18px;
}

.scan-card-pipeline li.is-pending .pipeline-dot {
  background: var(--panel);
  border-color: var(--line-strong);
  color: var(--muted-2);
}

.scan-card-pipeline li.is-running .pipeline-dot {
  animation: pulse 1.2s ease-in-out infinite;
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.scan-card-pipeline li.is-done .pipeline-dot {
  background: var(--success-soft);
  border-color: var(--success);
  color: var(--success);
}

.scan-card-pipeline li.is-failed .pipeline-dot {
  background: var(--error-soft);
  border-color: var(--error);
  color: var(--error);
}

.pipeline-icon {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.scan-card-pipeline li.is-running .pipeline-icon,
.scan-card-pipeline li.is-done .pipeline-icon {
  color: var(--ink-3);
}

.pipeline-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pipeline-title {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-card-pipeline li.is-pending .pipeline-title {
  color: var(--muted);
  font-weight: 400;
}

.pipeline-detail {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-detail .arrow {
  color: var(--muted-2);
  margin: 0 4px;
}

.pipeline-detail .name {
  color: var(--ink-3);
}

.scan-card-pipeline li.is-running .pipeline-detail .name {
  color: var(--ink);
}

.pipeline-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.scan-card-pipeline li.is-running .pipeline-count {
  color: var(--accent);
  font-weight: 600;
}

.scan-card-pipeline li.is-done .pipeline-count {
  color: var(--success);
}

@media (max-width: 780px) {
  .scan-card-pipeline li {
    grid-template-columns: 18px 16px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 8px 10px;
  }
  .pipeline-title {
    font-size: 12px;
  }
  .pipeline-detail {
    font-size: 10px;
  }
}

/* Big number metric tiles in the header */
.scan-card-metrics {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.scan-card-metrics[hidden] {
  display: none;
}

.scan-card-metric {
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 14px 8px 0;
}

.scan-card-metric:first-child {
  padding-left: 0;
}

.scan-card-metric:last-child {
  border-right: 0;
}

.scan-card-metric-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.scan-card-metric-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1;
}

.scan-card-metric.opportunity .scan-card-metric-value {
  color: var(--success);
}

.scan-card-metric.gap .scan-card-metric-value {
  color: var(--warn);
}

/* Action row (CSV / Markdown / Feishu) */
.scan-card-actions {
  display: flex;
  gap: 6px;
}

.scan-card-actions[hidden] {
  display: none;
}

/* Body (collapsed by default) */
.scan-card-body {
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 18px;
}

.scan-card-body[hidden] {
  display: none;
}

.scan-card-body > .map-progress-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(420px, 1fr) minmax(380px, 0.9fr);
}

.scan-card-body > .results-layout {
  display: block;
}

.outreach-console {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
}

.outreach-console[hidden] {
  display: none;
}

.outreach-console-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.outreach-console-head h3 {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}

.outreach-console-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  margin: 3px 0 0;
}

.outreach-head-actions {
  align-items: flex-end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.outreach-ready {
  align-items: center;
  background: var(--success-soft);
  border: 1px solid rgba(10, 135, 84, 0.22);
  border-radius: 999px;
  color: var(--success);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  min-height: 28px;
  padding: 0 10px;
}

.outreach-bulk-build,
.outreach-bulk-email {
  align-items: center;
  appearance: none;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  color: var(--panel);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.outreach-bulk-email {
  background: var(--panel);
  color: var(--ink);
}

.outreach-bulk-build .icon,
.outreach-bulk-email .icon {
  height: 14px;
  width: 14px;
}

.outreach-bulk-build:hover {
  background: var(--ink-2);
}

.outreach-bulk-email:hover {
  background: var(--panel-alt);
}

.outreach-bulk-build:disabled,
.outreach-bulk-email:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.outreach-bulk-build[aria-busy="true"] .icon,
.outreach-bulk-email[aria-busy="true"] .icon {
  animation: case-spin 0.8s linear infinite;
}

.outreach-bulk-note {
  color: var(--muted);
  flex-basis: 100%;
  font-family: var(--mono);
  font-size: 10px;
  text-align: right;
}

.outreach-email-preflight {
  align-items: start;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1fr) auto;
  padding: 10px 12px;
}

.outreach-email-preflight.is-ok {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.22);
}

.outreach-email-preflight.is-warn {
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.24);
}

.outreach-email-preflight.is-error {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.24);
}

.outreach-email-preflight span {
  color: var(--muted);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.outreach-email-preflight strong {
  color: var(--ink);
  display: block;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 2px;
}

.outreach-email-preflight small {
  color: var(--ink-3);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.45;
  margin-top: 4px;
}

.outreach-email-preflight-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.outreach-email-preflight-chips b {
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 8px;
}

.outreach-agent-summary {
  align-items: start;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(220px, 1fr) auto;
  padding: 10px 12px;
}

.outreach-agent-summary.is-ok {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.22);
}

.outreach-agent-summary.is-warn {
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.24);
}

.outreach-agent-summary span {
  color: var(--muted);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.outreach-agent-summary strong {
  color: var(--ink);
  display: block;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 2px;
}

.outreach-agent-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.outreach-agent-metrics b,
.outreach-style-chip {
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 8px;
}

.outreach-style-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 1 / -1;
}

.outreach-audit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  grid-column: 1 / -1;
}

.outreach-style-chip {
  color: var(--ink);
}

.outreach-style-chip.is-duplicate {
  border-color: rgba(180, 83, 9, 0.4);
  color: var(--warn);
}

.outreach-audit-chip {
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 8px;
}

.outreach-audit-chip.is-risk {
  border-color: rgba(180, 83, 9, 0.4);
  color: var(--warn);
}

.outreach-audit-chip.is-strength {
  border-color: rgba(10, 135, 84, 0.25);
  color: var(--success);
}

.outreach-agent-ops {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.outreach-agent-ops-head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.outreach-agent-ops-head span {
  color: var(--ink);
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.outreach-agent-ops-head p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  margin: 2px 0 0;
}

.outreach-agent-ops-stats,
.outreach-agent-flow-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.outreach-agent-ops-stats b,
.outreach-agent-flow-meta b {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 8px;
}

.outreach-agent-flow-list {
  display: grid;
  gap: 8px;
}

.outreach-agent-flow {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 8px;
  padding: 10px;
}

.outreach-agent-flow.is-running {
  border-color: rgba(0, 112, 243, 0.24);
}

.outreach-agent-flow.is-done {
  border-color: rgba(10, 135, 84, 0.22);
}

.outreach-agent-flow.is-failed {
  border-color: rgba(220, 38, 38, 0.22);
}

.outreach-agent-flow header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.outreach-agent-flow header strong {
  color: var(--ink);
  display: block;
  font-size: 12px;
}

.outreach-agent-flow header small {
  color: var(--muted);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  margin-top: 2px;
}

.outreach-agent-flow-steps {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(9, minmax(70px, 1fr));
  list-style: none;
  margin: 0;
  overflow-x: auto;
  padding: 0;
}

.outreach-agent-flow-steps li {
  align-items: center;
  border-top: 2px solid var(--line);
  color: var(--muted);
  display: grid;
  gap: 4px;
  min-width: 70px;
  padding-top: 7px;
}

.outreach-agent-flow-steps i {
  background: var(--line);
  border-radius: 999px;
  display: block;
  height: 6px;
  width: 6px;
}

.outreach-agent-flow-steps span {
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.25;
}

.outreach-agent-flow-steps li[data-state="done"] {
  border-color: rgba(10, 135, 84, 0.36);
  color: var(--success);
}

.outreach-agent-flow-steps li[data-state="done"] i {
  background: var(--success);
}

.outreach-agent-flow-steps li[data-state="active"] {
  border-color: rgba(0, 112, 243, 0.38);
  color: var(--accent);
}

.outreach-agent-flow-steps li[data-state="active"] i {
  animation: pulse 1.2s ease-in-out infinite;
  background: var(--accent);
}

.outreach-agent-flow-steps li[data-state="failed"] {
  border-color: rgba(220, 38, 38, 0.34);
  color: var(--error);
}

.outreach-agent-flow-steps li[data-state="failed"] i {
  background: var(--error);
}

.outreach-agent-decision {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.outreach-agent-decision-lane {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 8px;
}

.outreach-agent-decision-lane.is-ready {
  border-color: rgba(10, 135, 84, 0.24);
}

.outreach-agent-decision-lane > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
}

.outreach-agent-decision-lane strong {
  color: var(--ink);
  font-size: 11px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outreach-agent-decision-lane p,
.outreach-agent-decision-lane small {
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.35;
  margin: 0;
}

.outreach-agent-decision-lane small {
  color: var(--muted);
}

.outreach-agent-decision-scores {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.outreach-agent-decision-scores b {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 5px 6px;
}

.outreach-agent-decision-scores b.is-ok {
  background: rgba(10, 135, 84, 0.08);
  border-color: rgba(10, 135, 84, 0.22);
  color: var(--success);
}

.outreach-agent-decision-scores b.is-warn {
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.24);
  color: #92400e;
}

.outreach-agent-decision-scores span {
  color: inherit;
  opacity: 0.72;
  padding-right: 3px;
}

.outreach-table-wrap {
  overflow-x: auto;
}

.outreach-table {
  border-collapse: collapse;
  min-width: 1080px;
  width: 100%;
}

.outreach-table th {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 8px 8px;
  text-align: left;
  text-transform: uppercase;
}

.outreach-table td {
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.35;
  padding: 10px 8px;
  vertical-align: top;
}

.outreach-table tbody tr:last-child td {
  border-bottom: 0;
}

.outreach-table td:first-child {
  min-width: 220px;
}

.outreach-table td:first-child strong {
  color: var(--ink);
  display: block;
  font-size: 13px;
  font-weight: 600;
}

.outreach-table td:first-child span {
  color: var(--muted);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  margin-top: 2px;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-agent-intent {
  display: grid;
  gap: 6px;
  min-width: 220px;
}

.case-agent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.case-agent-chips b {
  background: color-mix(in srgb, var(--panel-alt) 84%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  gap: 4px;
  line-height: 1;
  max-width: 150px;
  overflow: hidden;
  padding: 5px 6px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.case-agent-chips b span {
  color: var(--muted);
  flex: 0 0 auto;
}

.case-agent-intent p,
.case-agent-intent em,
.case-agent-intent small {
  display: block;
  margin: 0;
}

.case-agent-intent p {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
}

.case-agent-intent p span {
  color: var(--muted);
  display: block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.case-agent-intent em {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-style: normal;
}

.case-agent-intent em.is-ready {
  color: var(--success);
}

.case-agent-intent em.is-gap {
  color: var(--warn);
}

.case-agent-intent small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.outreach-score {
  color: var(--success);
  font-family: var(--mono);
  font-size: 14px;
}

.preview-link-pair,
.outreach-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preview-link-pair a,
.outreach-actions button {
  align-items: center;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  font-size: 11px;
  font-weight: 500;
  min-height: 26px;
  padding: 0 8px;
  text-decoration: none;
}

.preview-link-pair a:hover,
.outreach-actions button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.outreach-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.outreach-muted {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.outreach-status {
  color: var(--muted);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  margin-top: 6px;
}

.outreach-status.is-copied {
  color: var(--accent);
}

.outreach-status.is-mailto {
  color: var(--success);
}

.outreach-status.is-email_prepared,
.outreach-status.is-email_draft,
.outreach-status.is-email_sent {
  color: var(--success);
}

.outreach-status.is-email_failed {
  color: var(--error);
}

.outreach-preview-compare {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
}

.outreach-preview-compare[hidden] {
  display: none;
}

.outreach-preview-compare-head {
  align-items: baseline;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.outreach-preview-compare-head span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.outreach-preview-compare-head p {
  color: var(--muted);
  font-size: 11px;
  margin: 0;
}

.outreach-preview-compare-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.outreach-preview-compare-stats b {
  background: color-mix(in srgb, var(--panel-alt) 88%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 650;
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 5px 8px;
}

.outreach-preview-compare-stats b.is-ok {
  border-color: rgba(5, 150, 105, 0.34);
  color: var(--ok);
}

.outreach-preview-compare-stats b.is-warn {
  border-color: rgba(180, 83, 9, 0.42);
  color: var(--warn);
}

.outreach-preview-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.outreach-preview-tile {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 8px;
}

.outreach-preview-tile header {
  display: grid;
  gap: 2px;
  min-height: 40px;
}

.outreach-preview-tile strong {
  color: var(--ink);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outreach-preview-tile small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outreach-preview-slot {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 3px;
}

.outreach-preview-slot b {
  background: color-mix(in srgb, var(--accent-soft) 58%, transparent);
  border-radius: 999px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: anywhere;
  padding: 4px 6px;
}

.outreach-preview-slot small {
  color: var(--muted);
  flex-basis: 100%;
  font-size: 9px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.outreach-preview-shell {
  align-items: flex-start;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 2px;
  margin-top: 3px;
  padding: 6px;
}

.outreach-preview-shell b {
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.outreach-preview-shell small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.outreach-preview-fingerprint {
  align-items: center;
  background: color-mix(in srgb, var(--panel) 80%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  gap: 4px;
  line-height: 1.25;
  max-width: 100%;
  padding: 5px 7px;
}

.outreach-preview-fingerprint.is-risk {
  border-color: rgba(180, 83, 9, 0.4);
  color: var(--warn);
}

.outreach-preview-fingerprint small {
  color: inherit;
  flex-basis: 100%;
  font-size: 9px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.outreach-preview-tile iframe,
.outreach-preview-tile img {
  aspect-ratio: 4 / 3;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: block;
  object-fit: cover;
  object-position: top center;
  width: 100%;
}

.outreach-preview-gates {
  display: grid;
  gap: 5px;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
}

.outreach-preview-gates b {
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  display: grid;
  font-family: var(--mono);
  font-size: 10px;
  gap: 2px;
  min-height: 42px;
  padding: 6px;
}

.outreach-preview-gates b.is-ok {
  border-color: rgba(5, 150, 105, 0.34);
  color: var(--ok);
}

.outreach-preview-gates b.is-warn {
  border-color: rgba(180, 83, 9, 0.42);
  color: var(--warn);
}

.outreach-preview-gates b.is-risk {
  border-color: rgba(220, 38, 38, 0.38);
  color: var(--bad);
}

.outreach-preview-gates span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outreach-preview-intent {
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1.45;
  margin: 0;
}

.outreach-preview-email {
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 3px;
  min-height: 48px;
  padding: 7px;
}

.outreach-preview-email.is-ok {
  border-color: rgba(5, 150, 105, 0.34);
}

.outreach-preview-email.is-warn {
  border-color: rgba(180, 83, 9, 0.42);
}

.outreach-preview-email strong {
  color: var(--ink);
  font-size: 11px;
}

.outreach-preview-email small {
  white-space: normal;
}

.outreach-preview-actions {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
}

.outreach-preview-actions a,
.outreach-preview-actions button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  font-size: 11px;
  justify-content: center;
  min-height: 28px;
  padding: 0 8px;
  text-decoration: none;
}

@media (max-width: 1180px) {
  .scan-card-body > .map-progress-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 780px) {
  .scan-card-header {
    gap: 12px;
    padding: 12px 14px;
  }

  .scan-card-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .scan-card-metric {
    border-right: 0;
    padding: 6px 0;
  }

  .scan-card-metric:nth-child(odd) {
    border-right: 1px solid var(--line);
    padding-right: 10px;
  }

  .scan-card-metric-value {
    font-size: 22px;
  }

  .scan-card-toggle {
    min-height: 36px;
  }

  .scan-card-body {
    padding: 14px;
  }

  .outreach-agent-summary {
    grid-template-columns: 1fr;
  }

  .outreach-email-preflight {
    grid-template-columns: 1fr;
  }

  .outreach-email-preflight-chips {
    justify-content: flex-start;
  }

  .outreach-agent-metrics {
    justify-content: flex-start;
  }

  .outreach-agent-ops-head {
    display: grid;
  }

  .outreach-agent-ops-stats,
  .outreach-agent-flow-meta {
    justify-content: flex-start;
  }

  .outreach-table {
    min-width: 940px;
  }
}

/* History rail collapsed mode */

.history-rail-actions {
  align-items: center;
  display: flex;
  gap: 2px;
}

.history-collapse {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 22px;
  justify-content: center;
  padding: 0;
  width: 22px;
}

.history-collapse:hover {
  color: var(--ink);
}

body.history-collapsed main {
  grid-template-columns: 44px minmax(0, 1fr);
}

body.history-collapsed .history-rail {
  overflow: hidden;
}

body.history-collapsed .history-title-text,
body.history-collapsed .history-list,
body.history-collapsed .history-empty,
body.history-collapsed .history-refresh {
  display: none;
}

body.history-collapsed .history-rail-head {
  justify-content: center;
  padding: 10px 0;
}

body.history-collapsed .history-collapse {
  transform: rotate(180deg);
}

/* Insight drawer */

.drawer-backdrop {
  background: rgba(10, 10, 10, 0.18);
  inset: 0;
  opacity: 0;
  pointer-events: none;
  position: fixed;
  transition: opacity 180ms ease;
  z-index: 40;
}

.drawer-backdrop[hidden] {
  display: none;
}

body.drawer-open .drawer-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.insight-drawer {
  background: var(--panel);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 28px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-width: 100vw;
  position: fixed;
  right: 0;
  top: 0;
  transform: translateX(100%);
  transition: transform 220ms cubic-bezier(0.4, 0, 0.2, 1);
  width: 380px;
  z-index: 50;
}

.insight-drawer[hidden] {
  display: flex;
}

body.drawer-open .insight-drawer {
  transform: translateX(0);
}

.drawer-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 48px;
  padding: 10px 16px;
}

.drawer-head h2 {
  color: var(--ink);
  font-size: 14px;
}

.drawer-close {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.drawer-close:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.drafts-section {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 14px;
}

.drafts-section h3 {
  color: var(--ink);
  font-size: 13px;
  margin-bottom: 10px;
}

/* Drawer used to live in results-layout; that's gone now */

.results-layout {
  display: block;
}

main > .history-rail {
  grid-area: rail;
}

main > .hero-shell {
  grid-area: hero;
}

main > .map-progress-grid {
  grid-area: mapgrid;
}

main > .demo-banner {
  grid-area: banner;
}

main > .summary-grid {
  grid-area: metrics;
}

main > .results-layout {
  grid-area: results;
}

.history-rail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 60px);
  overflow: hidden;
  position: sticky;
  top: 14px;
}

.history-rail-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  justify-content: space-between;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  text-transform: uppercase;
}

.history-refresh {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  height: 22px;
  justify-content: center;
  padding: 0;
  width: 22px;
}

.history-refresh:hover {
  color: var(--ink);
}

.history-refresh.is-loading .icon {
  animation: spin 0.9s linear infinite;
}

.history-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0;
  list-style: none;
  margin: 0;
  overflow-y: auto;
  padding: 4px 0;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

.history-item {
  align-items: flex-start;
  border-left: 2px solid transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 12px 8px 10px;
  transition: background 100ms ease, border-color 100ms ease;
}

.history-item:hover {
  background: var(--panel-alt);
}

.history-item.is-active {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}

.history-item-row {
  align-items: center;
  display: flex;
  gap: 6px;
  width: 100%;
}

.history-delete {
  align-items: center;
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font: inherit;
  font-size: 14px;
  height: 18px;
  justify-content: center;
  line-height: 1;
  margin-left: auto;
  opacity: 0;
  padding: 0;
  transition: opacity 100ms ease, color 100ms ease, border-color 100ms ease;
  width: 18px;
}

.history-item:hover .history-delete,
.history-delete:focus-visible {
  opacity: 1;
}

.history-delete:hover {
  border-color: var(--error);
  color: var(--error);
}

.history-status-dot {
  background: var(--muted-2);
  border-radius: 999px;
  flex: 0 0 auto;
  height: 6px;
  width: 6px;
}

.history-status-dot.is-running {
  animation: pulse 1.2s ease-in-out infinite;
  background: var(--accent);
}

.history-status-dot.is-completed {
  background: var(--success);
}

.history-status-dot.is-failed {
  background: var(--error);
}

.history-target {
  color: var(--ink);
  flex: 1;
  font-size: 12px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.history-meta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.history-meta .source {
  color: var(--ink-3);
}

.history-empty {
  color: var(--muted);
  font-size: 12px;
  padding: 12px;
  text-align: center;
}

.history-empty[hidden] {
  display: none;
}

.hero-shell {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(280px, 0.95fr) minmax(440px, 1.2fr);
}

.intro-panel,
.run-panel,
.map-panel,
.progress-panel,
.insight-panel,
.merchant-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.intro-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: space-between;
  padding: 20px;
}

.intro-panel h2 {
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
  max-width: 540px;
}

.intro-panel p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  max-width: 480px;
}

.guide-list {
  display: grid;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-list li {
  align-items: center;
  color: var(--ink-3);
  display: flex;
  font-size: 12px;
  gap: 8px;
  padding: 6px 0;
}

.guide-list li .icon {
  color: var(--muted-2);
  height: 14px;
  width: 14px;
}

.guide-list li::before {
  background: var(--muted-2);
  border-radius: 999px;
  content: "";
  flex: 0 0 auto;
  font-family: var(--mono);
  height: 4px;
  width: 4px;
}

.guide-list li > span[data-icon] {
  display: none;
}

.run-panel,
.map-panel,
.progress-panel,
.insight-panel,
.merchant-panel {
  padding: 16px 16px 16px;
}

.panel-heading {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-heading.compact {
  margin-bottom: 12px;
}

.panel-heading h2 {
  color: var(--ink);
}

.status-chip {
  align-items: center;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  gap: 6px;
  letter-spacing: 0.01em;
  min-height: 24px;
  padding: 0 10px;
  text-transform: lowercase;
}

.status-chip .icon {
  height: 12px;
  width: 12px;
}

.status-chip.is-running {
  background: var(--accent-soft);
  border-color: rgba(0, 112, 243, 0.2);
  color: var(--accent);
}

.status-chip.is-done {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.2);
  color: var(--success);
}

.status-chip.is-failed {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.2);
  color: var(--error);
}

/* ============ Guided website builder ============ */

.builder-guide {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: 280px minmax(0, 1fr);
}

.guide-rail {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 18px;
  padding: 16px;
  position: sticky;
  top: 16px;
}

.guide-rail-head {
  align-items: flex-start;
  display: grid;
  gap: 10px;
  grid-template-columns: 32px minmax(0, 1fr);
}

.guide-rail-icon {
  align-items: center;
  background: var(--ink);
  border-radius: var(--radius-sm);
  color: var(--panel);
  display: inline-flex;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.guide-rail-head p,
.guide-overline {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.guide-rail-head h2 {
  color: var(--ink);
  font-size: 18px;
  letter-spacing: 0;
  line-height: 1.25;
}

.guide-steps {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-steps li {
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  grid-template-columns: 28px minmax(0, 1fr);
  min-height: 52px;
  padding: 8px;
}

.guide-steps li > span {
  align-items: center;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.guide-steps strong,
.guide-steps small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-steps strong {
  color: var(--ink);
  font-size: 13px;
}

.guide-steps small {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.guide-steps li.is-active {
  background: var(--panel-alt);
  border-color: var(--line);
}

.guide-steps li.is-active > span {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--panel);
}

.guide-steps li.is-done > span {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.24);
  color: var(--success);
}

.guide-steps li.is-disabled {
  opacity: 0.58;
}

.guide-workbench {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.guide-stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  transition: border-color 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.guide-stage-input,
.guide-stage-preview {
  grid-column: 1 / -1;
}

.guide-stage.is-active {
  border-color: rgba(0, 112, 243, 0.26);
  box-shadow: 0 0 0 3px rgba(0, 112, 243, 0.045);
}

.guide-stage.is-disabled {
  opacity: 0.72;
}

.guide-heading {
  margin-bottom: 0;
}

.guide-stage-head {
  align-items: flex-start;
  display: grid;
  gap: 10px;
  grid-template-columns: 28px minmax(0, 1fr);
}

.guide-stage-head > span {
  align-items: center;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  display: inline-flex;
  height: 28px;
  justify-content: center;
  width: 28px;
}

.guide-stage-head strong {
  color: var(--ink);
  display: block;
  font-size: 14px;
  line-height: 1.3;
}

.guide-stage-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin-top: 2px;
}

.guide-evidence-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guide-evidence-metric {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 4px;
  min-height: 80px;
  padding: 10px;
}

.guide-evidence-metric span {
  color: var(--muted);
}

.guide-evidence-metric small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
}

.guide-evidence-metric strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 18px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-opportunity-list {
  display: grid;
  gap: 6px;
}

.guide-opportunity-head {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guide-opportunity-item {
  align-items: center;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 8px;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  min-height: 44px;
  padding: 8px 10px;
  text-align: left;
}

.guide-opportunity-item:hover {
  border-color: var(--line-strong);
}

.guide-opportunity-item > span {
  color: var(--muted);
}

.guide-opportunity-item strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-opportunity-item small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  white-space: nowrap;
}

.guide-mode-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.guide-mode-card {
  appearance: none;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 8px;
  min-height: 162px;
  padding: 10px;
  text-align: left;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.guide-mode-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.guide-mode-card.is-active {
  background: var(--panel);
  border-color: var(--ink);
}

.guide-mode-card strong {
  font-size: 13px;
  line-height: 1.25;
}

.guide-mode-card small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.guide-mockup {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 6px;
  height: 78px;
  overflow: hidden;
  padding: 8px;
}

.guide-mockup i {
  border-radius: 3px;
  display: block;
}

.guide-mockup.is-visual {
  background: #111827;
  grid-template-columns: 1.2fr 0.8fr;
}

.guide-mockup.is-visual i:first-child {
  background: linear-gradient(135deg, #d97706, #f8fafc);
  grid-row: span 3;
}

.guide-mockup.is-visual i:nth-child(2) {
  background: #f8fafc;
}

.guide-mockup.is-visual i:nth-child(3) {
  background: #22c55e;
}

.guide-mockup.is-practical {
  background: #f8fafc;
}

.guide-mockup.is-practical i:first-child {
  background: #0f172a;
  height: 18px;
}

.guide-mockup.is-practical i:nth-child(2) {
  background: #e2e8f0;
  height: 26px;
}

.guide-mockup.is-practical i:nth-child(3) {
  background: #2563eb;
  height: 14px;
  width: 64%;
}

.guide-mockup.is-fast {
  background: #ecfdf5;
  grid-template-columns: repeat(2, 1fr);
}

.guide-mockup.is-fast i:first-child {
  background: #0f766e;
  grid-column: 1 / -1;
}

.guide-mockup.is-fast i:nth-child(2) {
  background: #ffffff;
}

.guide-mockup.is-fast i:nth-child(3) {
  background: #f59e0b;
}

.guide-action-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.guide-action-row .primary-button,
.guide-action-row .secondary-button {
  min-height: 42px;
}

.guide-action-row [aria-busy="true"] .icon {
  animation: spin 0.9s linear infinite;
}

.guide-preview-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}

.guide-preview-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 0;
  min-height: 220px;
  overflow: hidden;
}

.guide-preview-card iframe,
.guide-preview-card img,
.guide-preview-placeholder {
  background: #f8fafc;
  border: 0;
  height: 138px;
  object-fit: cover;
  object-position: top center;
  width: 100%;
}

.guide-preview-placeholder {
  align-items: center;
  color: var(--muted);
  display: grid;
  gap: 8px;
  justify-items: center;
}

.guide-preview-placeholder .icon {
  height: 22px;
  width: 22px;
}

.guide-preview-card.is-queued .guide-preview-placeholder .icon,
.guide-preview-card.is-running .guide-preview-placeholder .icon {
  animation: spin 0.9s linear infinite;
}

.guide-preview-card-body {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.guide-preview-card-body strong {
  color: var(--ink);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guide-preview-card-body small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  min-height: 14px;
}

.guide-preview-card-body div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guide-preview-card-body a,
.guide-preview-card-body button,
.guide-preview-all {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 11px;
  font-weight: 600;
  min-height: 30px;
  padding: 0 9px;
  text-decoration: none;
}

.guide-preview-card-body a:hover,
.guide-preview-card-body button:hover,
.guide-preview-all:hover {
  border-color: var(--ink);
}

.guide-preview-card-body button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.guide-preview-all {
  justify-content: center;
  min-height: 40px;
}

/* ============ Scan form ============ */

.scan-form {
  display: grid;
  gap: 10px;
}

.geolocate-row {
  align-items: stretch;
  display: flex;
  gap: 8px;
}

.geolocate-button {
  align-items: center;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  color: white;
  cursor: pointer;
  display: inline-flex;
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  gap: 8px;
  justify-content: center;
  letter-spacing: -0.005em;
  min-height: 48px;
  padding: 0 18px;
  transition: background 120ms ease, transform 120ms ease;
}

.geolocate-button .icon {
  height: 18px;
  width: 18px;
}

.geolocate-button:hover {
  background: #262626;
}

.geolocate-button:active {
  transform: translateY(0.5px);
}

.geolocate-button:disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.geolocate-button.is-loading {
  background: var(--accent);
  border-color: var(--accent);
}

.geolocate-button.is-loading .icon {
  animation: spin 0.9s linear infinite;
}

.geolocate-button.is-success {
  background: var(--success);
  border-color: var(--success);
}

.radius-chips {
  align-items: stretch;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  flex: 0 0 auto;
  padding: 3px;
}

.radius-chips .chip {
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  min-height: 42px;
  min-width: 44px;
  padding: 0 10px;
  transition: background 120ms ease, color 120ms ease;
}

.radius-chips .chip:hover {
  color: var(--ink);
}

.radius-chips .chip.is-active {
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.field-error {
  background: var(--error-soft);
  border: 1px solid rgba(185, 28, 28, 0.18);
  border-radius: var(--radius);
  color: var(--error);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
  padding: 8px 10px;
}

.field-error[hidden] {
  display: none;
}

.manual-form {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 4px;
  overflow: hidden;
}

.manual-form[open] {
  background: var(--panel);
}

.manual-summary {
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  gap: 6px;
  letter-spacing: 0.02em;
  list-style: none;
  min-height: 36px;
  padding: 0 12px;
  text-transform: uppercase;
  user-select: none;
}

.manual-summary::-webkit-details-marker {
  display: none;
}

.manual-summary .icon {
  height: 12px;
  width: 12px;
}

.manual-summary:hover {
  color: var(--ink);
}

.manual-form[open] .manual-summary {
  border-bottom: 1px solid var(--line);
  color: var(--ink);
}

.manual-form .input-row {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 12px;
}

.manual-form .field-help {
  padding: 0 12px 12px;
}

.secondary-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 500;
  gap: 6px;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  transition: border-color 120ms ease, background 120ms ease;
}

.secondary-button:hover {
  background: var(--panel-alt);
  border-color: var(--ink);
}

.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.scan-form > label,
.radius-field span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.input-row {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) 88px 120px;
}

.url-field {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  display: flex;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.url-field:focus-within {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.04);
}

.url-field .icon {
  color: var(--muted);
}

.url-field input {
  background: transparent;
  border: 0;
  color: var(--ink);
  font-size: 13px;
  min-width: 0;
  outline: 0;
  width: 100%;
}

.url-field input::placeholder {
  color: var(--muted-2);
}

.radius-field {
  display: grid;
  gap: 4px;
}

.radius-field input,
select {
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  color: var(--ink);
  font-size: 13px;
  min-height: 36px;
  padding: 0 10px;
  transition: border-color 120ms ease;
}

.radius-field input:focus,
select:focus {
  border-color: var(--ink);
}

.primary-button {
  align-items: center;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  color: white;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 500;
  gap: 6px;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  transition: background 120ms ease, opacity 120ms ease, transform 120ms ease;
}

.primary-button:hover {
  background: #262626;
}

.primary-button:active {
  transform: translateY(0.5px);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.sample-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.sample-button {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  transition: border-color 120ms ease, color 120ms ease;
}

.sample-button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.sample-button .icon {
  color: var(--muted-2);
  height: 12px;
  width: 12px;
}

/* ============ Map + Progress grid ============ */

.map-progress-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(420px, 1fr) minmax(380px, 0.9fr);
}

.map-frame {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 280px;
  overflow: hidden;
  position: relative;
}

.map-frame iframe {
  border: 0;
  height: 100%;
  width: 100%;
}

.map-empty,
.selected-empty,
.merchant-empty {
  align-content: center;
  color: var(--muted);
  display: grid;
  font-size: 12px;
  gap: 6px;
  height: 100%;
  justify-items: center;
  padding: 20px;
  text-align: center;
}

.map-empty .icon,
.selected-empty .icon,
.merchant-empty .icon {
  color: var(--muted-2);
  height: 20px;
  width: 20px;
}

.map-empty strong,
.selected-empty strong,
.merchant-empty strong {
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 500;
}

.target-strip {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
}

.target-strip div {
  border-right: 1px solid var(--line);
  min-width: 0;
  padding: 4px 12px;
}

.target-strip div:first-child {
  padding-left: 0;
}

.target-strip div:last-child {
  border-right: 0;
}

.target-strip span {
  color: var(--muted);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.target-strip strong {
  color: var(--ink);
  display: block;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  overflow-wrap: anywhere;
}

/* ============ Progress + Timeline ============ */

.progress-panel {
  display: flex;
  flex-direction: column;
}

.progress-header {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  text-transform: lowercase;
}

#run-progress {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
}

.progress-bar {
  background: var(--line);
  border-radius: 999px;
  height: 3px;
  margin-bottom: 14px;
  overflow: hidden;
}

#progress-fill {
  background: var(--ink);
  height: 100%;
  transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1);
  width: 0;
}

.steps {
  display: grid;
  gap: 1px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.steps li {
  align-items: center;
  background: transparent;
  border: 0;
  display: grid;
  font-size: 13px;
  gap: 6px 10px;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  padding: 6px 0;
}

.steps li .step-icon {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--muted-2);
  display: grid;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.steps li .step-icon .icon {
  height: 14px;
  width: 14px;
}

.steps li span:not(.step-icon) {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
}

.steps li small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  grid-column: 2 / -1;
  line-height: 1.3;
}

.steps .running .step-icon {
  color: var(--accent);
}

.steps .running span:not(.step-icon) {
  color: var(--ink);
}

.steps .running .step-icon .icon {
  animation: spin 0.9s linear infinite;
}

.steps .done .step-icon {
  color: var(--success);
}

.steps .done span:not(.step-icon) {
  color: var(--ink);
}

.steps .failed .step-icon {
  color: var(--error);
}

.steps .failed span:not(.step-icon) {
  color: var(--error);
}

/* Event timeline */

.timeline-header {
  align-items: center;
  border-top: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  gap: 6px;
  justify-content: space-between;
  letter-spacing: 0.02em;
  margin: 14px -16px 0;
  padding: 12px 16px 8px;
  text-transform: uppercase;
}

.timeline-header .pulse {
  background: var(--muted-2);
  border-radius: 999px;
  height: 6px;
  width: 6px;
}

.timeline-header.is-running .pulse {
  animation: pulse 1.2s ease-in-out infinite;
  background: var(--accent);
}

.timeline {
  --bullet: 9px;
  font-family: var(--mono);
  font-size: 11px;
  margin: 0 -16px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px 16px 4px;
  scrollbar-gutter: stable;
}

.timeline::-webkit-scrollbar {
  width: 6px;
}

.timeline::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

.timeline-empty {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  padding: 12px 0;
}

.timeline-group {
  padding: 4px 0;
  position: relative;
}

.timeline-group + .timeline-group {
  border-top: 1px solid var(--line);
}

.timeline-row {
  align-items: baseline;
  color: var(--ink-3);
  display: grid;
  gap: 0 10px;
  grid-template-columns: 64px var(--bullet) 1fr;
  line-height: 1.4;
  padding: 3px 0;
}

.timeline-row .ts {
  color: var(--muted-2);
  font-size: 10px;
  text-align: right;
}

.timeline-row .bullet {
  align-self: center;
  background: var(--muted-2);
  border-radius: 999px;
  height: 5px;
  justify-self: center;
  width: 5px;
}

.timeline-row.is-step-head .bullet {
  background: var(--ink);
  height: 7px;
  width: 7px;
}

.timeline-row.is-step-head .label {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.timeline-row .label {
  color: var(--ink-3);
  font-size: 11px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.timeline-row .label small {
  color: var(--muted);
  display: block;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.35;
  margin-top: 2px;
  text-transform: none;
}

.timeline-row.is-tick .label {
  color: var(--ink-3);
}

.timeline-row.is-tick .label .name {
  color: var(--ink);
}

.timeline-row.is-tick .label .arrow {
  color: var(--muted-2);
  margin: 0 4px;
}

.timeline-row.is-warn .bullet {
  background: var(--warn);
}

.timeline-row.is-warn .label {
  color: var(--warn);
}

.timeline-group.is-warn .timeline-row .bullet {
  background: var(--warn);
}

.timeline-group.is-warn .timeline-row .label {
  color: var(--warn);
}

.timeline-row.is-error .bullet {
  background: var(--error);
}

.timeline-row.is-error .label {
  color: var(--error);
}

.timeline-group.is-error .timeline-row .bullet {
  background: var(--error);
}

.timeline-group.is-error .timeline-row .label {
  color: var(--error);
}

.timeline-row.is-running .bullet {
  animation: pulse 1.2s ease-in-out infinite;
  background: var(--accent);
}

.timeline-row.is-running .label {
  color: var(--ink);
}

.timeline-group.is-running .timeline-row .bullet {
  animation: pulse 1.2s ease-in-out infinite;
  background: var(--accent);
}

.timeline-group.is-running .timeline-row .label {
  color: var(--ink);
}

.timeline-row .meta {
  color: var(--muted);
  font-size: 10px;
  margin-left: 8px;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.3); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ Demo banner ============ */

.demo-banner {
  align-items: center;
  background: var(--warn-soft);
  border: 1px solid rgba(180, 83, 9, 0.25);
  border-radius: var(--radius);
  color: var(--warn);
  display: flex;
  font-size: 12px;
  gap: 10px;
  line-height: 1.5;
  padding: 10px 14px;
}

.demo-banner[hidden] {
  display: none;
}

.demo-banner-dot {
  animation: pulse 1.6s ease-in-out infinite;
  background: var(--warn);
  border-radius: 999px;
  flex: 0 0 auto;
  height: 7px;
  width: 7px;
}

.demo-banner strong {
  color: var(--warn);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.demo-banner span:not(.demo-banner-dot) {
  color: var(--ink-3);
}

/* ============ Metrics ============ */

.summary-grid {
  display: grid;
  gap: 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.summary-grid .metric {
  border-radius: 0;
  border-right: 0;
  display: grid;
  gap: 8px;
  min-height: 80px;
  padding: 14px 16px;
}

.summary-grid .metric:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.summary-grid .metric:last-child {
  border-radius: 0 var(--radius) var(--radius) 0;
  border-right: 1px solid var(--line);
}

.metric-icon {
  display: none;
}

.metric span:not(.metric-icon) {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
}

/* ============ Results layout ============ */

.results-layout {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 320px;
}

.insight-panel {
  position: sticky;
  top: 14px;
}

.draft-heading {
  border-top: 1px solid var(--line);
  margin: 14px -16px 0;
  padding: 14px 16px 0;
}

.selected-card {
  display: grid;
  gap: 12px;
}

.selected-visual {
  align-items: center;
  background: var(--panel-alt);
  background-position: center;
  background-size: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  height: 96px;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.selected-visual.has-image::after,
.merchant-preview.has-image::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35));
  content: "";
  inset: 0;
  position: absolute;
}

.selected-visual span {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  display: grid;
  height: 32px;
  justify-content: center;
  position: relative;
  width: 32px;
  z-index: 1;
}

.selected-body {
  display: grid;
  gap: 8px;
}

.selected-body h3 {
  font-size: 15px;
}

.selected-body p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.selected-body dl {
  display: grid;
  gap: 6px;
  grid-template-columns: 1fr 1fr;
  margin: 4px 0 0;
}

.selected-body dt {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.selected-body dd {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  margin: 2px 0 0;
}

/* PRO-207: Place Details evidence block inside drawer */
.place-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.place-details[hidden],
.place-details[data-state="empty"] {
  display: none;
}

.place-details[data-state="loading"] {
  align-items: center;
  flex-direction: row;
  gap: 8px;
  justify-content: center;
  padding: 14px 12px;
}

.place-details-loading {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  gap: 8px;
}

.place-details-loading .icon {
  animation: spin 0.9s linear infinite;
  color: var(--accent);
}

.place-photos {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(3, 1fr);
}

.place-photo {
  background-color: var(--panel-alt);
  background-position: center;
  background-size: cover;
  border-radius: var(--radius-sm);
  display: block;
  height: 96px;
  text-decoration: none;
  transition: transform 120ms ease;
}

.place-photo:hover {
  transform: scale(1.02);
}

.place-rating {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.place-rating strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
}

.place-rating-stars {
  color: #f59e0b;
  font-size: 12px;
  letter-spacing: 1px;
}

.place-rating-count {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

.place-summary {
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.5;
}

.place-address {
  align-items: flex-start;
  color: var(--muted);
  display: flex;
  font-size: 11px;
  gap: 6px;
  line-height: 1.4;
}

.place-address .icon {
  color: var(--muted-2);
  flex: 0 0 auto;
  height: 14px;
  margin-top: 1px;
  width: 14px;
}

.place-hours {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.place-hours summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 12px;
  gap: 8px;
  list-style: none;
  padding: 8px 10px;
}

.place-hours summary::-webkit-details-marker {
  display: none;
}

.place-hours-icon {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
}

.place-hours-icon .icon {
  height: 14px;
  width: 14px;
}

.place-hours-today {
  color: var(--ink);
  flex: 1;
  font-family: var(--mono);
  font-size: 11px;
}

.place-hours-status {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
}

.place-hours-status.is-open {
  color: var(--success);
}

.place-hours-status.is-closed {
  color: var(--error);
}

.place-hours-week {
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0;
  list-style: none;
  margin: 0;
  padding: 6px 10px;
}

.place-hours-week li {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 0;
}

.place-hours-week li.is-today {
  color: var(--ink);
  font-weight: 600;
}

.place-reviews {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.place-review {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.place-review header {
  align-items: baseline;
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.place-review strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.place-review-rating {
  color: #f59e0b;
  font-size: 11px;
  letter-spacing: 1px;
}

.place-review-time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  margin-left: auto;
}

.place-review p {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

.brief-section {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-alt);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.brief-section[hidden] { display: none; }

.brief-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brief-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.brief-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-3);
}

.brief-meta {
  font-size: 11px;
  color: var(--ink-3);
}

.brief-meta code {
  font-family: var(--mono);
  font-size: 10.5px;
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 4px;
  border-radius: 3px;
}

.brief-cta {
  appearance: none;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  align-self: flex-start;
  transition: transform 0.12s ease, background 0.12s ease;
}

.brief-cta:hover {
  background: #1f1f1f;
  transform: translateY(-1px);
}

.brief-cta:active {
  transform: translateY(0);
}

.brief-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 12px 4px;
}

.brief-loading [data-icon] {
  width: 18px;
  height: 18px;
  animation: brief-spin 1.1s linear infinite;
}

@keyframes brief-spin {
  to { transform: rotate(360deg); }
}

.brief-pipeline {
  list-style: none;
  margin: 10px 0 4px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.brief-pipeline-step {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line, #e5e7eb);
  border-radius: 8px;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface, #fff);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.brief-pipeline-step[data-state="start"] {
  border-color: var(--accent, #2563eb);
  color: var(--accent, #2563eb);
  background: var(--accent-soft, #eff6ff);
}

.brief-pipeline-step[data-state="done"] {
  border-color: var(--success, #16a34a);
  color: var(--success, #16a34a);
}

.brief-pipeline-step[data-state="error"] {
  border-color: var(--danger, #dc2626);
  color: var(--danger, #dc2626);
}

.brief-pipeline-dot {
  font-size: 14px;
  line-height: 1;
}

.brief-pipeline-label {
  flex: 1;
  font-weight: 600;
}

.brief-pipeline-status {
  font-size: 11px;
  opacity: 0.75;
}

.brief-pipeline-step[data-state="start"] .brief-pipeline-dot {
  animation: brief-spin 1.1s linear infinite;
  display: inline-block;
}

.brief-agent-process {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  padding: 10px;
}

.brief-agent-process > header {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.brief-agent-process > header span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-agent-process > header p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
  max-width: 420px;
  text-align: right;
}

.brief-agent-process-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.brief-agent-process-step {
  align-items: flex-start;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 8px;
  grid-template-columns: 10px minmax(0, 1fr);
  min-width: 0;
  padding: 9px;
}

.brief-agent-process-step.is-start {
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.28);
}

.brief-agent-process-step.is-done {
  border-color: rgba(10, 135, 84, 0.24);
}

.brief-agent-process-step.is-error {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.28);
}

.brief-agent-process-node {
  background: var(--muted-2);
  border-radius: 999px;
  height: 8px;
  margin-top: 5px;
  width: 8px;
}

.brief-agent-process-step.is-start .brief-agent-process-node {
  animation: pulse 1.2s ease-in-out infinite;
  background: var(--accent);
}

.brief-agent-process-step.is-done .brief-agent-process-node {
  background: var(--success);
}

.brief-agent-process-step.is-error .brief-agent-process-node {
  background: var(--error);
}

.brief-agent-process-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.brief-agent-process-top {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.brief-agent-process-top span,
.brief-agent-process-top b,
.brief-agent-process-body em {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}

.brief-agent-process-top span {
  color: var(--muted);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.brief-agent-process-top b {
  color: var(--ink);
  font-weight: 700;
}

.brief-agent-process-body em {
  color: var(--ink-3);
  font-style: normal;
}

.brief-agent-process-body small {
  color: var(--ink-2);
  font-size: 10px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.brief-events {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  padding: 10px;
}

.brief-repair-audit {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  padding: 10px;
}

.brief-repair-audit.is-ok {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.22);
}

.brief-repair-audit.is-warn {
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.24);
}

.brief-repair-audit.is-error {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.24);
}

.brief-repair-audit > div {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.brief-repair-audit span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-repair-audit strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
}

.brief-repair-audit p {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.45;
  margin: 0;
}

.brief-repair-audit ol {
  display: grid;
  gap: 5px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.brief-repair-audit .repair-iterations {
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.brief-repair-audit li {
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 2px;
  padding: 7px 8px;
}

.brief-repair-audit .repair-iteration {
  background: color-mix(in srgb, var(--warn-soft) 42%, var(--panel));
}

.brief-repair-audit li b {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.35;
}

.brief-repair-audit li small {
  color: var(--ink-3);
  font-size: 10px;
  line-height: 1.35;
}

.brief-agent-ledger {
  display: grid;
  gap: 10px;
}

.brief-agent-ledger > header {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.brief-agent-ledger > header span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-agent-ledger > header p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
  max-width: 360px;
  text-align: right;
}

.brief-agent-ledger-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.brief-agent-ledger-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
}

.brief-agent-ledger-card.is-start {
  border-color: rgba(37, 99, 235, 0.24);
}

.brief-agent-ledger-card.is-done {
  border-color: rgba(10, 135, 84, 0.22);
}

.brief-agent-ledger-card.is-error {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.24);
}

.brief-agent-ledger-card > div {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.brief-agent-ledger-card span,
.brief-agent-ledger-card b,
.brief-agent-ledger-card em {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.35;
}

.brief-agent-ledger-card span {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-agent-ledger-card b {
  color: var(--ink-3);
  font-style: normal;
  font-weight: 700;
}

.brief-agent-ledger-card strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.brief-agent-ledger-card p,
.brief-agent-ledger-card small {
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.brief-agent-ledger-card p,
.brief-agent-ledger-card em {
  color: var(--muted);
  font-family: var(--mono);
}

.brief-agent-ledger-error {
  color: var(--danger, #dc2626) !important;
}

.brief-agent-decision-trace {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  padding: 10px;
}

.brief-agent-decision-trace > header {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.brief-agent-decision-trace > header span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-agent-decision-trace > header p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
  max-width: 420px;
  text-align: right;
}

.brief-agent-decision-list {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.brief-agent-decision-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px;
}

.brief-agent-decision-card.is-start {
  background: var(--accent-soft);
  border-color: rgba(37, 99, 235, 0.24);
}

.brief-agent-decision-card.is-done,
.brief-agent-decision-card.is-repaired {
  border-color: rgba(10, 135, 84, 0.22);
}

.brief-agent-decision-card.is-error,
.brief-agent-decision-card.is-blocked {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.24);
}

.brief-agent-decision-card > div {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.brief-agent-decision-card span,
.brief-agent-decision-card b {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.35;
}

.brief-agent-decision-card span {
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.brief-agent-decision-card b {
  color: var(--ink-3);
  font-weight: 700;
}

.brief-agent-decision-card strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.brief-agent-decision-card p,
.brief-agent-decision-card small {
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.brief-agent-decision-card p {
  color: var(--ink-2);
}

.brief-agent-decision-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.brief-agent-decision-chips b {
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  font-size: 10px;
  padding: 3px 7px;
}

.visual-repair-brief {
  background: color-mix(in srgb, var(--warn-soft) 55%, var(--panel) 45%);
  border: 1px solid rgba(180, 83, 9, 0.24);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  display: grid;
  gap: 4px;
  margin: 6px 0 0;
  padding: 8px;
}

.visual-repair-brief b {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.visual-repair-brief span,
.visual-repair-brief small {
  color: var(--ink-3);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.35;
}

.visual-repair-brief ul {
  display: grid;
  gap: 3px;
  list-style: disc;
  margin: 2px 0 0 14px;
  padding: 0;
}

.visual-repair-brief li {
  color: var(--ink-3);
  font-size: 10.5px;
  line-height: 1.35;
}

.brief-events .visual-repair-brief li {
  align-items: initial;
  display: list-item;
  gap: 0;
  grid-template-columns: none;
  padding: 0;
}

.brief-events-head {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-events ol {
  display: grid;
  gap: 5px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.brief-events li {
  align-items: baseline;
  display: grid;
  gap: 8px;
  grid-template-columns: 56px minmax(0, 1fr);
}

.brief-events li.is-running .brief-event-message {
  color: var(--accent, #2563eb);
}

.brief-events li.is-done .brief-event-message {
  color: var(--success, #16a34a);
}

.brief-events li.is-error .brief-event-message {
  color: var(--danger, #dc2626);
}

.brief-live-agent-state {
  display: grid;
  gap: 10px;
}

.brief-live-agent-state > header {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.brief-live-agent-state > header span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-live-agent-state > header p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  margin: 0;
  text-align: right;
}

.brief-live-agent-grid {
  display: grid;
  gap: 8px;
}

.brief-live-agent-grid .brief-design,
.brief-live-agent-grid .brief-quality,
.brief-live-agent-grid .brief-acceptance {
  margin: 0;
}

.brief-event-time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

.brief-event-message {
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.4;
  min-width: 0;
  overflow-wrap: anywhere;
}

.brief-event-message small {
  color: var(--muted);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.35;
  margin-top: 2px;
  white-space: pre-wrap;
}

.brief-preview-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 0;
  margin: 8px 0 12px;
  overflow: hidden;
  background: var(--surface, #fff);
}

.brief-preview-link {
  padding: 10px 12px;
  border: 1px dashed var(--accent, #2563eb);
  border-width: 0 0 1px;
  border-radius: 0;
  background: var(--accent-soft, #eff6ff);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brief-preview-label {
  font-weight: 600;
  color: var(--ink-2);
}

.brief-preview-anchor {
  color: var(--accent, #2563eb);
  font-weight: 600;
  text-decoration: none;
}

.brief-preview-anchor:hover {
  text-decoration: underline;
}

.brief-preview-frame {
  background: #fff;
  border: 0;
  display: block;
  height: min(56vh, 520px);
  min-height: 340px;
  width: 100%;
}

.brief-agent-summary-report {
  background: color-mix(in srgb, var(--panel-alt) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 12px;
  margin: 10px 0 12px;
  padding: 14px;
}

.brief-agent-summary-report header {
  display: grid;
  gap: 6px;
}

.brief-agent-summary-report span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-agent-summary-report strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
}

.brief-agent-summary-report ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.brief-agent-summary-report li {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  padding-top: 8px;
}

.brief-agent-summary-report li p {
  color: var(--ink-3);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.brief-copy-details,
.brief-debug-details,
.case-agent-debug {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 10px 0;
  overflow: hidden;
}

.brief-copy-details summary,
.brief-debug-details summary,
.case-agent-debug summary {
  color: var(--ink-2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  padding: 10px 12px;
}

.brief-debug-details {
  background: color-mix(in srgb, var(--panel-alt) 75%, transparent);
}

.brief-agent-readiness {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 10px 12px;
}

.brief-agent-readiness span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-agent-readiness small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.45;
}

.brief-agent-readiness-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.brief-agent-readiness-chips b {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 3px 7px;
}

.brief-agent-readiness.is-ok {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.24);
}

.brief-agent-readiness.is-warn {
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.25);
}

.brief-agent-readiness.is-error {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.24);
}

.brief-design {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  padding: 10px 12px;
}

.brief-design > div:first-child {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.brief-design span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-design strong {
  color: var(--ink);
  font-size: 13px;
}

.brief-design p {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.brief-design small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.brief-design ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 16px;
}

.brief-design li {
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.4;
}

.brief-acceptance {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.brief-acceptance.is-ok {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.22);
}

.brief-acceptance.is-warn {
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.24);
}

.brief-acceptance.is-error {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.24);
}

.brief-acceptance > div:first-child {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.brief-acceptance span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.brief-acceptance strong {
  color: var(--ink);
  font-size: 13px;
}

.brief-acceptance p,
.brief-acceptance small {
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.45;
  margin: 0;
}

.brief-acceptance-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.brief-acceptance-check {
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-3);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  gap: 5px;
  line-height: 1;
  padding: 6px 8px;
  text-transform: none;
}

.brief-acceptance-check b {
  color: var(--ink);
  font-weight: 700;
}

.brief-acceptance-check.is-fail {
  border-color: rgba(185, 28, 28, 0.28);
  color: var(--error);
}

.brief-acceptance-check.is-warn {
  border-color: rgba(180, 83, 9, 0.34);
  color: var(--warn);
}

.brief-acceptance-check.is-pass {
  border-color: rgba(10, 135, 84, 0.24);
  color: var(--success);
}

.brief-swatches {
  display: flex;
  gap: 5px;
}

.brief-swatch {
  background: var(--swatch);
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-flex;
  height: 18px;
  width: 18px;
}

.brief-experiment-list {
  display: grid;
  gap: 7px;
  margin-top: 2px;
}

.brief-experiment-row {
  border-left: 3px solid var(--line-strong);
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 6px 0 6px 10px;
}

.brief-experiment-row.is-selected {
  border-left-color: var(--success);
}

.brief-experiment-row > div:first-child {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.brief-experiment-row strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.brief-experiment-row > div:first-child span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.brief-experiment-row small {
  color: var(--ink-3);
  font-family: var(--mono);
  overflow-wrap: anywhere;
}

.brief-composition-experiments .brief-experiment-row p {
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
}

.brief-experiment-sketch {
  background: var(--sketch-bg, var(--panel-alt));
  border: 1px solid color-mix(in srgb, var(--sketch-accent, var(--line-strong)) 28%, var(--line));
  border-radius: 6px;
  color: var(--sketch-ink, var(--ink));
  display: grid;
  gap: 5px;
  min-height: 82px;
  overflow: hidden;
  padding: 7px;
}

.sketch-hero {
  background: color-mix(in srgb, var(--sketch-surface, white) 78%, var(--sketch-bg, var(--panel)) 22%);
  border-radius: 4px;
  display: grid;
  gap: 5px;
  grid-template-columns: minmax(0, 1fr) 34%;
  min-height: 28px;
  padding: 5px;
}

.sketch-hero span,
.sketch-hero b,
.sketch-blocks i,
.sketch-cta {
  border-radius: 999px;
  display: block;
}

.sketch-hero span {
  background: var(--sketch-ink, var(--ink));
  opacity: 0.76;
}

.sketch-hero b {
  background: var(--sketch-accent, var(--accent));
  min-height: 18px;
}

.sketch-blocks {
  display: grid;
  gap: 4px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.sketch-blocks i {
  background: color-mix(in srgb, var(--sketch-accent-2, var(--sketch-accent, var(--accent))) 60%, var(--sketch-surface, white));
  min-height: 16px;
}

.sketch-blocks i[data-pattern="mosaic"],
.sketch-blocks i[data-pattern="media-hero"] {
  min-height: 25px;
}

.sketch-blocks i[data-pattern="route"],
.sketch-blocks i[data-pattern="schedule"] {
  background: color-mix(in srgb, var(--sketch-accent, var(--accent)) 68%, var(--sketch-surface, white));
}

.sketch-blocks i[data-pattern="quote"],
.sketch-blocks i[data-pattern="trust-gap"] {
  background: color-mix(in srgb, var(--sketch-muted, var(--muted)) 46%, var(--sketch-surface, white));
}

.sketch-cta {
  background: var(--sketch-accent, var(--accent));
  height: 7px;
  width: 38%;
}

.brief-experiment-sketch[data-layout="immersive"] .sketch-hero,
.brief-experiment-sketch[data-layout="gallery-led"] .sketch-hero {
  min-height: 38px;
}

.brief-experiment-sketch[data-layout="index"] .sketch-hero {
  grid-template-columns: 1fr;
  min-height: 20px;
}

.brief-experiment-sketch[data-layout="editorial"] .sketch-blocks {
  grid-template-columns: 1fr;
}

.brief-experiment-sketch[data-layout="split"] .sketch-blocks,
.brief-experiment-sketch[data-layout="conversion-led"] .sketch-blocks {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.brief-quality {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 9px 12px;
}

.brief-quality > span {
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
}

.brief-quality p {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
}

.brief-quality strong {
  color: var(--ink);
  display: block;
  font-size: 12px;
}

.brief-quality.is-ok {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.25);
}

.brief-quality.is-ok > span {
  background: var(--success);
  color: white;
}

.brief-quality.is-warn {
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.25);
}

.brief-quality.is-warn > span {
  background: var(--warn);
  color: white;
}

.quality-checklist {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.quality-check {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.2;
  padding: 3px 7px;
}

.quality-check.is-ok {
  background: rgba(10, 135, 84, 0.08);
  border-color: rgba(10, 135, 84, 0.24);
  color: var(--success);
}

.quality-check.is-warn {
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.25);
  color: var(--warn);
}

.brief-body {
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
}

.brief-body h2.brief-h1 {
  margin: 4px 0 8px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.brief-body h3.brief-h2 {
  margin: 14px 0 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.brief-body h3.brief-h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 8px;
}

.brief-body h4.brief-h3 {
  margin: 10px 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.brief-body p {
  margin: 6px 0;
}

.brief-body ul {
  margin: 6px 0 6px 18px;
  padding: 0;
}

.brief-body li {
  margin: 3px 0;
}

.brief-body a {
  color: var(--accent, #0070f3);
  text-decoration: underline;
}

.brief-body code {
  font-family: var(--mono);
  font-size: 12px;
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 4px;
  border-radius: 3px;
}

.brief-body em {
  color: var(--ink-2);
}

.brief-foot {
  display: flex;
  justify-content: flex-end;
  border-top: 1px dashed var(--line);
  padding-top: 8px;
}

.brief-secondary {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-2);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.brief-secondary:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--ink);
}

.brief-error {
  margin: 0;
  font-size: 12.5px;
  color: var(--danger, #c53030);
  line-height: 1.5;
}

.score-breakdown {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.score-breakdown-head {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding-bottom: 6px;
}

.score-breakdown-head span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.score-breakdown-head strong {
  color: var(--ink);
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1;
}

.score-breakdown-list {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 8px 0 0;
}

.score-breakdown-list li {
  align-items: baseline;
  display: flex;
  font-size: 11px;
  gap: 8px;
  justify-content: space-between;
}

.score-breakdown-label {
  color: var(--ink-3);
  cursor: help;
  flex: 1;
  font-size: 11px;
}

.score-breakdown-value {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  min-width: 28px;
  text-align: right;
}

.score-breakdown-value.is-pos {
  color: var(--success);
}

.score-breakdown-value.is-neg {
  color: var(--warn);
}

.score-breakdown-value.is-zero {
  color: var(--muted);
}

/* QA chips + actions */

.qa-chip {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 2px 7px;
}

.qa-chip.qa-pending {
  background: rgba(115, 115, 115, 0.08);
  border-color: var(--line-strong);
  color: var(--muted);
}

.qa-chip.qa-confirmed_owned {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.25);
  color: var(--success);
}

.qa-chip.qa-confirmed_platform {
  background: var(--accent-soft);
  border-color: rgba(0, 112, 243, 0.25);
  color: var(--accent);
}

.qa-chip.qa-flagged {
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.25);
  color: var(--warn);
}

.qa-chip.qa-dismissed {
  background: transparent;
  border-color: var(--line);
  color: var(--muted-2);
  text-decoration: line-through;
}

.qa-panel {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 4px;
  padding: 10px 12px;
}

.qa-panel-head {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  justify-content: space-between;
  letter-spacing: 0.04em;
  padding-bottom: 6px;
  text-transform: uppercase;
}

.qa-actions {
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr 1fr;
}

.qa-action,
.qa-clear {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 11px;
  font-weight: 500;
  min-height: 28px;
  padding: 0 8px;
  text-align: center;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.qa-action:hover,
.qa-clear:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.qa-action.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

.qa-action.is-active:hover {
  background: #262626;
}

.qa-clear {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  min-height: 18px;
  padding: 0;
  text-decoration: underline;
}

.qa-clear:hover {
  color: var(--ink);
}

.export-group {
  display: flex;
  gap: 4px;
}

.export-group[hidden] {
  display: none;
}

.export-button {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  font-size: 12px;
  font-weight: 500;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  text-decoration: none;
  transition: border-color 120ms ease, color 120ms ease;
}

.export-button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.export-button .icon {
  color: var(--muted-2);
  height: 12px;
  width: 12px;
}

.export-button.is-copied {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.25);
  color: var(--success);
}

.export-button.is-loading {
  background: var(--accent-soft);
  border-color: rgba(0, 112, 243, 0.25);
  color: var(--accent);
}

.export-button.is-loading .icon {
  animation: spin 0.9s linear infinite;
}

.export-button.is-failed {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.2);
  color: var(--error);
}

.export-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.merchant-tags {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

/* QA chip is now a dot on the avatar — hide the inline chip on PC. Mobile keeps the existing dot logic. */
.merchant-tags .qa-chip {
  display: none;
}

/* Action icons hover-only on PC (give name maximum breathing space) */
.merchant-card .merchant-actions {
  opacity: 0;
  transition: opacity 120ms ease;
}

.merchant-card:hover .merchant-actions,
.merchant-card.is-selected .merchant-actions,
.merchant-card:focus-within .merchant-actions {
  opacity: 1;
}

@media (max-width: 780px) {
  /* Mobile: actions always visible (no hover) */
  .merchant-card .merchant-actions {
    opacity: 1;
  }
}

.evidence-links,
.merchant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.evidence-links a,
.merchant-actions a,
.merchant-actions span {
  align-items: center;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  display: inline-flex;
  font-size: 11px;
  font-weight: 500;
  gap: 4px;
  min-height: 24px;
  padding: 0 8px;
  text-decoration: none;
  transition: border-color 120ms ease, color 120ms ease;
}

.evidence-links a:hover,
.merchant-actions a:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.merchant-actions span {
  color: var(--error);
}

.merchant-actions .icon {
  color: var(--muted-2);
  height: 12px;
  width: 12px;
}

/* Drafts */

.drafts {
  display: grid;
  gap: 6px;
}

.draft {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  display: grid;
  gap: 8px;
  grid-template-columns: 24px minmax(0, 1fr);
  padding: 8px 0;
}

.draft:last-child {
  border-bottom: 0;
}

.draft-icon {
  align-items: center;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  display: grid;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.draft-icon .icon {
  height: 12px;
  width: 12px;
}

.draft strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.draft p,
.empty-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 4px 0;
}

.draft span {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
}

.draft-build-path {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
}

.draft-path-head {
  align-items: flex-start;
  display: flex;
  gap: 8px;
}

.draft-path-head > span {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--accent);
  display: grid;
  flex: 0 0 auto;
  height: 26px;
  justify-content: center;
  width: 26px;
}

.draft-path-head .icon {
  height: 14px;
  width: 14px;
}

.draft-path-head small,
.draft-tools small {
  color: var(--muted);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.draft-path-head strong {
  display: block;
  font-size: 12px;
  line-height: 1.4;
}

.draft-rationale,
.draft-cost,
.draft-next {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.45;
}

.draft-cost strong,
.draft-next strong {
  color: var(--ink);
  display: block;
  font-size: 11px;
  margin-bottom: 2px;
}

.draft-deliverables {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.draft-deliverables span {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 11px;
  line-height: 1.3;
  padding: 4px 6px;
}

.draft-tools ul {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.draft-tools li {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: grid;
  gap: 2px;
  padding: 7px;
}

.draft-tools li strong {
  font-size: 12px;
}

.draft-tools li span {
  color: var(--muted);
  font-family: var(--sans);
  font-size: 11px;
  line-height: 1.4;
}

/* ============ Merchant list (row layout) ============ */

.table-header {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin: -16px -16px 0;
  padding: 12px 16px;
}

.filter-label {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
}

.filter-label .icon {
  color: var(--muted-2);
}

.filter-label select {
  border: 0;
  font-size: 12px;
  min-height: 26px;
  padding: 0;
}

.merchant-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.merchant-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
  transition: border-color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.merchant-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.merchant-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* PRO-204: merchant card head / body / foot */

.merchant-card-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 10px;
  padding: 12px 14px;
}

.merchant-card-avatar {
  align-items: center;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  display: grid;
  flex: 0 0 auto;
  height: 36px;
  justify-content: center;
  overflow: visible;
  position: relative;
  width: 36px;
}

.merchant-card-avatar img {
  height: 20px;
  width: 20px;
}

.merchant-card-avatar .icon {
  height: 16px;
  width: 16px;
}

.merchant-card-title {
  flex: 1;
  min-width: 0;
}

.merchant-card-title h3 {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merchant-card-title p {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merchant-card-score {
  align-items: center;
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  display: inline-flex;
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  justify-content: center;
  letter-spacing: -0.01em;
  min-height: 30px;
  min-width: 38px;
  padding: 0 6px;
  text-align: center;
}

.card-preview {
  align-items: center;
  background: var(--panel-alt);
  background-position: center;
  background-size: cover;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 6px;
  justify-content: center;
  min-height: 120px;
  padding: 16px 14px;
  position: relative;
  text-align: center;
}

.card-preview .icon {
  color: var(--muted);
  height: 22px;
  width: 22px;
}

.card-preview strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  word-break: break-all;
}

.card-preview span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  word-break: break-all;
}

/* Owned: og:image fills the preview; overlay a fallback when image missing */
.card-preview-owned {
  background-color: var(--panel-alt);
  min-height: 140px;
  padding: 0;
}

.card-preview-owned.has-image {
  position: relative;
}

.card-preview-owned.has-image::after {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.18) 100%);
  content: "";
  inset: 0;
  position: absolute;
  pointer-events: none;
}

.card-preview-owned .card-preview-fallback {
  align-items: center;
  color: var(--ink-3);
  display: flex;
  flex-direction: column;
  gap: 6px;
  height: 100%;
  justify-content: center;
  padding: 14px;
  width: 100%;
}

.card-preview-owned .card-preview-fallback .icon {
  color: var(--muted);
}

.card-preview-owned .card-preview-fallback span {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 12px;
}

.card-preview-ig .icon {
  color: #c1356b;
}

.card-preview-ig strong {
  color: var(--ink);
}

.card-preview-platform .icon {
  color: var(--warn);
}

.card-preview-platform strong {
  color: var(--ink);
}

.card-preview-empty {
  background: repeating-linear-gradient(
    45deg,
    var(--panel-alt),
    var(--panel-alt) 8px,
    var(--panel) 8px,
    var(--panel) 16px
  );
}

.card-preview-empty .icon {
  color: var(--error);
}

.card-preview-empty strong {
  color: var(--error);
}

.card-cta {
  align-items: center;
  background: transparent;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  font-size: 12px;
  font-weight: 500;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  text-decoration: none;
  transition: background 120ms ease;
}

.card-cta:hover {
  background: var(--panel-alt);
}

.card-cta .icon {
  color: var(--muted);
  flex: 0 0 auto;
  height: 14px;
  width: 14px;
}

.card-cta span {
  font-size: 12px;
}

.card-cta-host {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  margin-left: auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merchant-card-foot {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 10px 14px;
}

/* Legacy aliases (still used in old DOM places) */
.merchant-preview {
  align-items: center;
  background: var(--panel-alt);
  background-position: center;
  background-size: cover;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  height: 36px;
  min-height: 0;
  overflow: visible;
  padding: 0;
  position: relative;
  width: 36px;
}

/* Tiny QA status dot on the avatar corner (replaces inline qa-chip) */
.qa-dot {
  background: var(--muted-2);
  border: 2px solid var(--panel);
  border-radius: 999px;
  bottom: -2px;
  height: 10px;
  pointer-events: none;
  position: absolute;
  right: -2px;
  width: 10px;
}

.merchant-card:hover .qa-dot,
.merchant-card.is-selected .qa-dot {
  border-color: var(--panel-alt);
}

.qa-dot.qa-pending {
  background: var(--muted-2);
}

.qa-dot.qa-confirmed_owned {
  background: var(--success);
}

.qa-dot.qa-confirmed_platform {
  background: var(--accent);
}

.qa-dot.qa-flagged {
  background: var(--warn);
}

.qa-dot.qa-dismissed {
  background: var(--line-strong);
}

.qa-dot.qa-none {
  display: none;
}

.merchant-preview.has-image::after {
  display: none;
}

.merchant-avatar {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--ink-3);
  display: grid;
  height: 36px;
  justify-content: center;
  overflow: hidden;
  position: relative;
  width: 36px;
  z-index: 1;
}

.merchant-avatar img {
  height: 18px;
  width: 18px;
}

.merchant-avatar .icon {
  height: 16px;
  width: 16px;
}

.type-pill {
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  text-transform: uppercase;
}

.type-pill.owned,
.type-pill.brand_chain_branch {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.25);
  color: var(--success);
}

.type-pill.instagram,
.type-pill.platform,
.type-pill.ota {
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.25);
  color: var(--warn);
}

.type-pill.no_website,
.type-pill.unknown {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.2);
  color: var(--error);
}

.merchant-content {
  align-items: baseline;
  display: flex;
  gap: 6px;
  min-width: 0;
  padding: 0;
}

.merchant-title-row {
  align-items: baseline;
  display: flex;
  flex: 1;
  gap: 8px;
  justify-content: flex-start;
  min-width: 0;
}

.merchant-title-row > div:first-child {
  flex: 1;
  min-width: 0;
}

.merchant-title-row h3 {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.merchant-title-row p,
.preview-title {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.35;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-badge {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  padding: 0;
  text-align: right;
  width: 30px;
}

@media (max-width: 1180px) {
  main {
    grid-template-columns: 1fr;
    grid-template-areas:
      "rail"
      "hero"
      "scancard"
      "banner"
      "mapgrid"
      "metrics"
      "results";
  }

  /* Bug #3: history collapse button is PC-only ("collapse to icon strip"); hide on mobile where rail is already a top strip */
  .history-collapse {
    display: none;
  }

  .history-rail {
    max-height: 220px;
    position: static;
  }

  .hero-shell,
  .map-progress-grid,
  .results-layout {
    grid-template-columns: 1fr;
  }

  .builder-guide {
    grid-template-columns: 1fr;
  }

  .guide-rail {
    position: static;
  }

  .guide-workbench {
    grid-template-columns: 1fr;
  }

  .guide-stage-input,
  .guide-stage-preview {
    grid-column: auto;
  }

  .insight-panel {
    position: static;
  }

  .merchant-card {
    grid-template-columns: 28px minmax(0, 1fr) auto auto;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-grid .metric {
    border-radius: 0;
    border-right: 1px solid var(--line);
  }

  .summary-grid .metric:nth-child(odd) {
    border-right: 0;
  }
}

@media (max-width: 780px) {
  main {
    gap: 12px;
    padding: 12px;
  }

  .app-header {
    min-height: 48px;
    padding: 8px 12px;
  }

  .brand-mark {
    height: 24px;
    width: 24px;
  }

  .brand-copy h1 {
    font-size: 13px;
  }

  .header-actions {
    gap: 4px;
  }

  .ghost-link {
    min-height: 32px;
    padding: 0 8px;
  }

  .ghost-link span:not(.icon) {
    display: none;
  }

  /* Hide the marketing intro-panel on small screens; the form is the action */
  .intro-panel {
    display: none;
  }

  /* History rail collapses to a slim summary header that the user can expand */
  .history-rail {
    border-radius: var(--radius);
    max-height: 56px;
    overflow: hidden;
    transition: max-height 200ms ease;
  }

  .history-rail.is-open {
    max-height: 60vh;
  }

  .history-rail-head {
    cursor: pointer;
    min-height: 44px;
  }

  .history-rail-head::after {
    color: var(--muted-2);
    content: "▾";
    font-family: var(--mono);
    font-size: 14px;
    margin-left: 6px;
    transition: transform 180ms ease;
  }

  .history-rail.is-open .history-rail-head::after {
    transform: rotate(180deg);
  }

  /* Make the run-panel breathe on mobile and pad its inner padding less */
  .run-panel,
  .map-panel,
  .progress-panel,
  .insight-panel,
  .merchant-panel {
    padding: 14px;
  }

  .panel-heading {
    margin-bottom: 10px;
  }

  .guide-rail {
    gap: 12px;
    padding: 14px;
  }

  .guide-rail-head h2 {
    font-size: 16px;
  }

  .guide-steps {
    gap: 6px;
  }

  .guide-stage {
    padding: 14px;
  }

  .guide-evidence-grid,
  .guide-mode-grid,
  .guide-preview-grid {
    grid-template-columns: 1fr;
  }

  .guide-opportunity-item {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .guide-opportunity-item small {
    grid-column: 2;
    white-space: normal;
  }

  /* Form: geolocate row stacks on tiny screens for thumb-friendly tap */
  .geolocate-row {
    flex-wrap: wrap;
  }

  .geolocate-button {
    flex: 1 1 100%;
    min-height: 52px;
  }

  .radius-chips {
    flex: 1 1 100%;
    justify-content: space-between;
  }

  .radius-chips .chip {
    flex: 1;
    min-height: 44px;
  }

  .input-row,
  .target-strip,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .manual-form .input-row {
    grid-template-columns: 1fr;
  }

  .secondary-button {
    min-height: 48px;
  }

  .target-strip div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }

  .target-strip div:first-child {
    padding-top: 0;
  }

  .target-strip div:last-child {
    border-bottom: 0;
  }

  .map-frame {
    height: 200px;
  }

  .table-header {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-label,
  .filter-label select {
    width: 100%;
  }

  .filter-label {
    min-height: 44px;
  }

  /* PRO-204: cards stay column-flex on mobile; just tighten paddings */
  .merchant-card-head {
    padding: 10px 12px;
  }

  .merchant-card-foot {
    padding: 8px 12px;
  }

  .card-cta {
    min-height: 44px;
    padding: 0 12px;
  }

  .card-preview {
    min-height: 100px;
    padding: 12px;
  }

  .card-preview-owned {
    min-height: 130px;
  }

  /* Detail panel becomes a normal card below; not sticky on mobile */
  .insight-panel {
    position: static;
  }

  /* Bigger primary actions on mobile */
  .primary-button {
    min-height: 48px;
  }

  /* Bigger QA action buttons for thumbs */
  .qa-action,
  .qa-clear {
    min-height: 36px;
  }

  .qa-action {
    min-height: 40px;
  }

  /* Four actions are too tight for one mobile row; keep them stable as a 2x2 grid. */
  .export-group {
    flex-direction: row;
    flex-wrap: wrap;
    width: 100%;
  }

  .export-button {
    flex: 1 1 calc(50% - 4px);
    font-size: 11px;
    justify-content: center;
    min-height: 36px;
    min-width: 0;
    padding: 0 6px;
  }

  .export-button span:not([data-icon]) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Bug #4: tighten the DEMO banner so it doesn't dominate the first screen */
  .demo-banner {
    align-items: flex-start;
    font-size: 11px;
    gap: 8px;
    line-height: 1.4;
    padding: 8px 10px;
  }

  .demo-banner strong {
    font-size: 10px;
  }
}

/* Extra-tight phones */
@media (max-width: 420px) {
  main {
    padding: 10px;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .summary-grid .metric:nth-child(odd) {
    border-right: 0;
  }

  .summary-grid .metric strong {
    font-size: 20px;
  }

  /* Bug #5: 5 metric tiles in 2-col grid leave an orphan; let the 5th tile span both columns */
  .summary-grid .metric:nth-child(5):last-child {
    grid-column: 1 / -1;
  }

  .merchant-card-title h3 {
    font-size: 13px;
  }

  .merchant-card-score {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Agent build cases — outreach console additions ===== */

.case-start {
  appearance: none;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  white-space: nowrap;
}
.case-start:hover { filter: brightness(1.08); }

.case-pill {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  padding: 4px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  color: var(--ink);
}
.case-pill:hover { border-color: var(--accent); color: var(--accent); }
.case-pill:disabled {
  cursor: default;
}
.case-pill:disabled:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}
.case-pill.is-queued   { background: #f4f5f7; color: var(--muted); border-color: var(--line); }
.case-pill.is-running  { background: var(--accent-soft); color: var(--accent); border-color: rgba(0,112,243,0.25); }
.case-pill.is-done     { background: var(--success-soft); color: var(--success); border-color: rgba(10,135,84,0.25); }
.case-pill.is-failed   { background: var(--error-soft); color: var(--error); border-color: rgba(185,28,28,0.25); }
.case-pill.is-await    { background: var(--warn-soft); color: var(--warn); border-color: rgba(180,83,9,0.25); }

.case-spin {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: case-spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes case-spin { to { transform: rotate(360deg); } }

/* Pill + retry combo. Used only in terminal states (done / failed); the
   refresh-arrow button kicks off an in-place rerun of the same case_id. */
.case-status-stack {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.case-retry {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--muted);
  border-radius: 999px;
  width: 22px;
  height: 22px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.case-retry:hover { border-color: var(--accent); color: var(--accent); }

.case-shot {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  border-radius: var(--radius);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  display: inline-block;
  line-height: 0;
}
.case-shot:hover { border-color: var(--accent); }
.case-shot img { width: 80px; height: 56px; object-fit: cover; display: block; }

/* ===== Case detail drawer ===== */

.case-drawer {
  position: fixed;
  inset: 0;
  z-index: 200;
}
.case-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 18, 33, 0.45);
}
.case-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(960px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--line-strong);
  box-shadow: -4px 0 24px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
}
.case-drawer-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.case-drawer-panel header h3 {
  font-size: 15px;
  margin: 0;
  font-weight: 600;
}
.case-drawer-close {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  width: 28px;
  height: 28px;
  color: var(--muted);
}
.case-drawer-close:hover { color: var(--error); border-color: var(--error); }

.case-drawer-body {
  padding: 18px 20px 24px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--ink-3);
}
.case-drawer-body h4 {
  margin: 24px 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 600;
}
.case-drawer-body a {
  word-break: break-all;
  color: var(--accent);
}
.case-drawer-shot {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.case-drawer-shot img { width: 100%; display: block; }

.case-preview-live {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  display: grid;
  gap: 8px;
  margin: 14px 0;
  overflow: hidden;
  padding: 10px;
}

.case-preview-live-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.case-preview-live-head span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.case-preview-live-head a {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 500;
  min-height: 26px;
  padding: 5px 8px;
  text-decoration: none;
}

.case-preview-live iframe {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: min(58vh, 560px);
  min-height: 360px;
  width: 100%;
}

.case-preview-live img {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: block;
  max-height: min(58vh, 560px);
  object-fit: cover;
  object-position: top center;
  width: 100%;
}

.case-preview-live.is-design-mockup img {
  background: #f8fafc;
  max-height: min(68vh, 720px);
  object-fit: contain;
}

/* PRO-336: immutable preview version history in the case drawer */
.case-preview-versions {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin: 14px 0;
  padding: 10px;
}

.case-preview-versions h4 {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 8px;
}

.case-preview-versions ul {
  display: grid;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.case-preview-version {
  align-items: center;
  display: flex;
  font-size: 12px;
  gap: 8px;
}

.case-preview-version-tag {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
}

.case-preview-version.is-current .case-preview-version-tag {
  border-color: var(--accent, var(--ink-3));
  color: var(--accent, var(--ink));
}

.case-preview-version-source {
  color: var(--ink-3);
}

.case-preview-version-time {
  color: var(--muted);
  margin-left: auto;
}

.case-preview-version a {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  flex: 0 0 auto;
  font-size: 11px;
  padding: 3px 8px;
  text-decoration: none;
}

.case-design {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 10px 12px;
}

.case-design span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.case-design strong {
  color: var(--ink);
  font-size: 13px;
}

.case-design p {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  margin: 0;
}

.case-quality {
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
  padding: 9px 12px;
}

.case-quality > span {
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
}

.case-quality p {
  color: var(--ink-3);
  flex: 1 1 220px;
  font-size: 12px;
  line-height: 1.4;
  margin: 0;
}

.case-quality small {
  color: var(--muted);
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  margin-top: 3px;
}

.case-quality.is-ok {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.25);
}

.case-quality.is-ok > span {
  background: var(--success);
  color: white;
}

.case-quality.is-warn {
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.25);
}

.case-quality.is-warn > span {
  background: var(--warn);
  color: white;
}

.case-agent-trace {
  margin: 14px 0;
}

.case-agent-trace h4 {
  color: var(--ink);
  font-size: 13px;
  margin: 0 0 8px;
}

.case-trace-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.case-trace-card {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
}

.case-trace-card span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.case-trace-card strong {
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.case-trace-card p,
.case-trace-card small {
  color: var(--ink-3);
  font-size: 11px;
  line-height: 1.45;
  margin: 0;
  white-space: pre-wrap;
}

.case-trace-card p {
  font-family: var(--mono);
}

.case-trace-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}

.case-trace-swatch {
  background: var(--swatch);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  display: inline-block;
  height: 14px;
  width: 14px;
}

.case-email {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 6px;
  margin: 12px 0;
  padding: 10px 12px;
}

.case-email span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.case-email strong {
  color: var(--ink);
  font-size: 13px;
}

.case-email p {
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
}

.case-email small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.4;
}

.case-email-decision {
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  display: grid;
  gap: 5px;
  padding: 8px;
}

.case-email-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.case-email-chips b {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.2;
  padding: 3px 7px;
}

.brief-email {
  margin: 0;
}

.case-delivery {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: grid;
  gap: 5px;
  margin: 12px 0;
  padding: 10px 12px;
}

.case-delivery span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.case-delivery strong {
  color: var(--ink);
  font-size: 13px;
}

.case-delivery p {
  color: var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  margin: 0;
}

.case-delivery.is-ok {
  background: var(--success-soft);
  border-color: rgba(10, 135, 84, 0.25);
}

.case-delivery.is-skip {
  background: var(--panel-alt);
}

.case-delivery.is-error {
  background: var(--error-soft);
  border-color: rgba(185, 28, 28, 0.24);
}

.case-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.case-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.case-step:last-child { border-bottom: 0; }
.case-step-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--panel-alt);
  font-size: 11px;
  color: var(--muted);
  flex-shrink: 0;
}
.case-step.is-done .case-step-icon    { background: var(--success-soft); color: var(--success); }
.case-step.is-failed .case-step-icon  { background: var(--error-soft);   color: var(--error); }
.case-step.is-running .case-step-icon { background: var(--accent-soft);  color: var(--accent); }
.case-step-label { font-weight: 500; color: var(--ink); }
/* Step-level retry (PRO-334): inline "retry from this step" affordance. */
.case-step-retry {
  margin-left: auto;
  flex-shrink: 0;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-alt);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.case-step-retry:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.case-step-retry:disabled { opacity: 0.5; cursor: default; }
.case-step.is-failed .case-step-retry { border-color: var(--error-soft); color: var(--error); }

.case-events {
  list-style: none;
  padding: 0;
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  max-height: 320px;
  overflow-y: auto;
}
.case-event {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
}
.case-event:last-child { border-bottom: 0; }
.case-event-ts { color: var(--muted); }
.case-event-step {
  background: var(--panel-alt);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 11px;
  color: var(--ink-3);
}
.case-event-msg { color: var(--ink); word-break: break-word; }
.case-event.is-error .case-event-msg { color: var(--error); }
.case-event.is-done  .case-event-step { background: var(--success-soft); color: var(--success); }

.case-event-data {
  grid-column: 1 / -1;
}

.case-event-data summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.case-event-data pre {
  background: var(--panel-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  font-size: 10.5px;
  line-height: 1.35;
  margin: 5px 0 0;
  overflow-x: auto;
  padding: 8px;
  white-space: pre-wrap;
}

.case-degraded {
  padding: 8px 12px;
  background: var(--warn-soft);
  color: var(--warn);
  border-radius: var(--radius);
  font-size: 12px;
  margin: 12px 0;
}

/* PRO-333: user-facing narrative activity stream (default, non-debug drawer) */
.case-narrative-stream {
  margin: 14px 0;
}
.case-narrative-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.case-narrative-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-alt);
  padding: 10px 12px;
}
.case-narrative-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  background: var(--muted);
}
.case-narrative-card.is-phase-analyze .case-narrative-dot { background: var(--accent); }
.case-narrative-card.is-phase-design .case-narrative-dot  { background: var(--warn); }
.case-narrative-card.is-phase-preview .case-narrative-dot { background: var(--success); }
.case-narrative-card.is-failed .case-narrative-dot        { background: var(--error); }
.case-narrative-card.is-failed .case-narrative-msg        { color: var(--error); }
.case-narrative-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.case-narrative-msg {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  word-break: break-word;
}
.case-narrative-thumb {
  display: block;
  max-width: 180px;
  max-height: 120px;
  width: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  object-fit: cover;
}
.case-narrative-open {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 12px;
  text-decoration: none;
}
.case-narrative-time {
  font-size: 11px;
  color: var(--muted);
}
.case-narrative-empty {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
.case-drawer-actions {
  margin-top: 20px;
  display: flex;
  gap: 8px;
}
.case-drawer-actions button {
  appearance: none;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--error);
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  padding: 6px 12px;
}
.case-drawer-actions button:hover { background: var(--error-soft); }
.case-drawer-actions .case-drawer-rebuild {
  color: var(--accent, #2563eb);
  border-color: var(--accent, #2563eb);
  font-weight: 600;
}
.case-drawer-actions .case-drawer-rebuild:hover { background: var(--accent-soft, rgba(37, 99, 235, 0.08)); }
.case-drawer-actions .case-drawer-rebuild:disabled { opacity: 0.5; cursor: wait; }

/* ---- PRO-352: multi-model fan-out variants compare ---- */
.case-build-variants { margin-top: 22px; }
.case-build-variants-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 12px;
}
.case-build-variants-head .cv-count { color: var(--muted); font-weight: 500; }
.case-variant-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px;
}
.case-variant {
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--panel); box-shadow: var(--shadow-sm); padding: 12px;
  display: flex; flex-direction: column; gap: 10px; transition: border-color .15s, box-shadow .15s;
}
.case-variant:hover { border-color: var(--line-strong); }
.case-variant.is-selected {
  border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-sm);
  background: var(--accent-soft);
}
.case-variant-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.case-variant-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.cv-badge {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  font-size: 11px; line-height: 1; font-weight: 600;
  padding: 4px 8px; border-radius: 999px; white-space: nowrap;
}
.cv-badge.is-done { background: var(--success-soft); color: var(--success); }
.cv-badge.is-failed { background: var(--error-soft); color: var(--error); }
.cv-badge.is-building { background: var(--accent-soft); color: var(--accent); }
.cv-spinner {
  width: 9px; height: 9px; border-radius: 50%;
  border: 1.5px solid currentColor; border-right-color: transparent;
  animation: cv-spin .7s linear infinite;
}
@keyframes cv-spin { to { transform: rotate(360deg); } }
.case-variant-shot {
  width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--panel-alt);
}
.case-variant-shot-empty {
  width: 100%; aspect-ratio: 16 / 10; border-radius: var(--radius-sm);
  border: 1px dashed var(--line-strong); background: var(--panel-alt);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 11px; text-align: center; padding: 8px;
}
/* live iframe thumbnail: the real variant page scaled down (no screenshot infra) */
.case-variant-thumb {
  position: relative; width: 100%; aspect-ratio: 16 / 10; overflow: hidden;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; cursor: pointer; transition: border-color .15s;
}
.case-variant-thumb:hover { border-color: var(--accent); }
.case-variant-thumb::after { content: ""; position: absolute; inset: 0; }
.case-variant-frame {
  position: absolute; top: 0; left: 0; width: 1200px; height: 750px; border: 0;
  transform-origin: top left; transform: scale(var(--cv-scale, 0.18));
  pointer-events: none; background: #fff;
}
.case-variant-err {
  font-size: 11px; color: var(--error); background: var(--error-soft);
  border-radius: var(--radius-sm); padding: 6px 8px; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.case-variant-actions { display: flex; gap: 6px; margin-top: auto; flex-wrap: wrap; }
.case-variant-actions button {
  appearance: none; cursor: pointer; font: inherit; font-size: 12px; font-weight: 600;
  padding: 7px 12px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--ink); transition: background .15s, border-color .15s, opacity .15s;
}
.case-variant-actions button:hover { background: var(--panel-alt); border-color: var(--accent); color: var(--accent); }
.case-variant-actions button:disabled { opacity: .5; cursor: not-allowed; }
.case-variant-actions .cv-select {
  background: var(--accent); border-color: var(--accent); color: #fff; flex: 1;
}
.case-variant-actions .cv-select:hover { background: #0060df; border-color: #0060df; color: #fff; }
.case-variant-actions .cv-select:disabled { background: var(--success); border-color: var(--success); color: #fff; opacity: 1; }
.case-variant-actions .cv-retry { color: var(--warn); border-color: var(--warn); }
.case-variant-actions .cv-retry:hover { background: var(--warn-soft); color: var(--warn); }

/* lightweight toast (replaces native alert) */
.app-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(12px);
  z-index: 9999; max-width: 420px; padding: 11px 16px; border-radius: var(--radius-lg);
  background: var(--ink); color: #fff; font-size: 13px; box-shadow: 0 8px 30px rgba(0,0,0,.22);
  opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
}
.app-toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.app-toast.is-error { background: var(--error); }
.app-toast.is-success { background: var(--success); }

.case-fallback-badge {
  display: inline-block;
  font-size: 10px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 999px;
  border: 1px solid var(--warning, #b45309);
  color: var(--warning, #b45309);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .case-preview-live {
    margin-left: -8px;
    margin-right: -8px;
  }

  .case-preview-live iframe {
    height: 520px;
    min-height: 420px;
  }
}
