/* ───── Page layout ───── */

.page-content { display: grid; gap: var(--s-5); }

.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-4);
  margin-top: var(--s-7);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
}

.app-footer div,
.app-footer nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-3);
}

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

.app-footer a {
  color: var(--muted);
  font-weight: 600;
  transition: color var(--dur-fast) var(--ease);
}

.app-footer a:hover { color: var(--accent); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: var(--s-3);
}

/* Calm first-run welcome: one focused message, no cockpit. */
.dashboard-welcome {
  display: grid;
  gap: var(--s-2);
  padding: var(--s-6);
}

.dashboard-welcome h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.15;
}

.dashboard-welcome p {
  margin: 0;
  max-width: 60ch;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

/* Post-onboarding header: name + next step + one readiness badge.
   Replaces the old multi-bar "operator command" cockpit. */
.dashboard-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-5) var(--s-6);
}

.dashboard-head-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.dashboard-head-main h2 {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.15;
}

.dashboard-head-main p {
  margin: 0 0 4px;
  max-width: 56ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.readiness-badge {
  flex: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 116px;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--paper-sunk);
  text-align: center;
}

.readiness-badge strong {
  font-size: 26px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.readiness-badge span {
  font-size: 12px;
  color: var(--muted);
}

.readiness-badge.good {
  border-color: rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.08);
}

.readiness-badge.good strong { color: #16a34a; }

.readiness-badge.review {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.readiness-badge.review strong { color: var(--accent-strong); }

.readiness-badge.setup strong { color: var(--ink); }

/* Channels tabs: keep every section available but show one group at a time so the
   page is not a 5-section wall. CSS-only; degrades to a stack without :has(). */
.channels-tabs {
  display: grid;
  gap: 0;
}

.channels-tab-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.channels-tablist {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--s-4);
}

.channels-tab {
  padding: 10px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: var(--r-1) var(--r-1) 0 0;
  transition: color 0.15s ease, background 0.15s ease;
}

.channels-tab:hover {
  color: var(--ink);
  background: var(--paper-sunk);
}

.channels-tab-input:focus-visible + .channels-tab,
.channels-tablist:focus-within .channels-tab:hover {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
}

.channels-tabs:has(#chtab-web:checked) label[for="chtab-web"],
.channels-tabs:has(#chtab-msg:checked) label[for="chtab-msg"],
.channels-tabs:has(#chtab-svc:checked) label[for="chtab-svc"] {
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
}

.channels-panel {
  display: grid;
  gap: var(--s-4);
}

.channels-tabs:has(#chtab-web:checked) .channels-panel:not([data-tab="web"]),
.channels-tabs:has(#chtab-msg:checked) .channels-panel:not([data-tab="msg"]),
.channels-tabs:has(#chtab-svc:checked) .channels-panel:not([data-tab="svc"]) {
  display: none;
}

.dashboard-command {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.75fr);
  gap: var(--s-5);
  align-items: stretch;
  padding: var(--s-6);
  overflow: hidden;
  border: 1px solid var(--nav-line);
  border-radius: var(--r-3);
  background:
    linear-gradient(135deg, rgba(var(--brand-blue-rgb), 0.24) 0%, rgba(var(--brand-blue-rgb), 0.08) 38%, rgba(6, 11, 22, 0) 72%),
    var(--nav);
  color: var(--nav-ink);
  box-shadow: var(--shadow-3);
}

.dashboard-command::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(248, 250, 252, 0.065) 1px, transparent 1px),
    linear-gradient(90deg, rgba(248, 250, 252, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.5;
}

.command-copy,
.readiness-panel {
  position: relative;
  z-index: 1;
}

.command-copy {
  display: grid;
  align-content: center;
  gap: var(--s-4);
  min-width: 0;
}

.dashboard-command .section-kicker {
  color: rgba(248, 250, 252, 0.68);
}

.command-copy h2 {
  max-width: 760px;
  margin: 0;
  color: var(--nav-ink);
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.02;
  letter-spacing: 0;
  font-weight: 700;
}

.command-copy p {
  max-width: 620px;
  margin: 0;
  color: rgba(248, 250, 252, 0.74);
  font-size: 15px;
  line-height: 1.65;
}

.command-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

.command-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(248, 250, 252, 0.16);
  border-radius: var(--r-pill);
  background: rgba(248, 250, 252, 0.08);
  color: rgba(248, 250, 252, 0.82);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.brief-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
}

.command-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: var(--r-2);
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0 var(--s-4);
  font-size: 13px;
  font-weight: 800;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}

.command-action:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.command-action:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus);
}

.command-action:active { transform: translateY(1px); }

.command-action.secondary {
  border-color: rgba(248, 250, 252, 0.2);
  background: rgba(248, 250, 252, 0.08);
  color: var(--nav-ink);
}

.command-action.secondary:hover {
  border-color: rgba(248, 250, 252, 0.34);
  background: rgba(248, 250, 252, 0.14);
}

.readiness-panel {
  display: grid;
  gap: var(--s-4);
  align-content: start;
  min-width: 0;
  border: 1px solid rgba(248, 250, 252, 0.16);
  border-radius: var(--r-3);
  background: rgba(248, 250, 252, 0.08);
  padding: var(--s-5);
  backdrop-filter: blur(10px);
}

.score-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}

.score-row small {
  display: block;
  color: rgba(248, 250, 252, 0.64);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.score-row strong {
  display: block;
  margin-top: 2px;
  color: var(--nav-ink);
  font-size: 42px;
  line-height: 1;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.score-badge {
  border: 1px solid rgba(248, 250, 252, 0.16);
  border-radius: var(--r-pill);
  background: rgba(248, 250, 252, 0.1);
  color: rgba(248, 250, 252, 0.78);
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.readiness-meter,
.signal-bar {
  display: block;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: rgba(248, 250, 252, 0.13);
}

.readiness-meter { height: 9px; }
.signal-bar { height: 6px; }

.readiness-meter span,
.signal-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--info));
}

.signal-stack {
  display: grid;
  gap: var(--s-3);
}

.signal-row {
  display: grid;
  gap: 7px;
}

.signal-row header {
  display: flex;
  justify-content: space-between;
  gap: var(--s-3);
  color: rgba(248, 250, 252, 0.78);
  font-size: 12.5px;
  font-weight: 700;
}

.signal-row small {
  color: rgba(248, 250, 252, 0.56);
  font-weight: 600;
}

html[data-theme="light"] .dashboard-command {
  border-color: var(--line);
  background:
    linear-gradient(135deg, rgba(var(--brand-blue-rgb), 0.14) 0%, rgba(var(--brand-blue-rgb), 0.07) 42%, rgba(255, 255, 255, 0) 78%),
    var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-2);
}

html[data-theme="light"] .dashboard-command::before {
  background-image:
    linear-gradient(rgba(17, 24, 39, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, 0.032) 1px, transparent 1px);
  opacity: 0.42;
}

html[data-theme="light"] .dashboard-command .section-kicker,
html[data-theme="light"] .score-row small,
html[data-theme="light"] .signal-row small {
  color: var(--muted);
}

html[data-theme="light"] .command-copy h2,
html[data-theme="light"] .score-row strong {
  color: var(--ink);
}

html[data-theme="light"] .command-copy p,
html[data-theme="light"] .signal-row header {
  color: var(--ink-soft);
}

html[data-theme="light"] .command-meta span {
  border-color: var(--line);
  background: var(--paper-sunk);
  color: var(--ink-soft);
}

html[data-theme="light"] .command-action.secondary {
  border-color: var(--line);
  background: var(--card);
  color: var(--ink);
}

html[data-theme="light"] .command-action.secondary:hover {
  border-color: var(--line-strong);
  background: var(--card-hover);
}

html[data-theme="light"] .readiness-panel {
  border-color: var(--line-soft);
  background: rgba(255, 255, 255, 0.74);
}

html[data-theme="light"] .score-badge {
  border-color: var(--line);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

html[data-theme="light"] .readiness-meter,
html[data-theme="light"] .signal-bar {
  background: var(--line-soft);
}

.workflow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
}

.workflow-node {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--s-3);
  min-height: 138px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--card);
  padding: var(--s-4);
  box-shadow: var(--shadow-1);
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}

.workflow-node::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--warn);
}

.workflow-node.ready::before {
  background: var(--success);
}

.workflow-node:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-2);
  transform: translateY(-1px);
}

.node-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.node-index {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.node-status {
  border-radius: var(--r-pill);
  background: var(--warn-soft);
  color: var(--warn);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
}

.workflow-node.ready .node-status {
  background: var(--success-soft);
  color: var(--success);
}

.workflow-node strong,
.workflow-node small,
.workflow-node em {
  display: block;
}

.workflow-node strong {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.workflow-node small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.workflow-node em {
  color: var(--ink-soft);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.quick-setup-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
}

.quick-setup-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--s-3);
  min-height: 184px;
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background:
    linear-gradient(180deg, var(--card) 0%, var(--paper-sunk) 100%);
  padding: var(--s-4);
  box-shadow: var(--shadow-1);
}

.quick-index {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--nav-line);
  border-radius: var(--r-2);
  background: var(--nav);
  color: var(--nav-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
}

.quick-setup-card.complete .quick-index {
  background: var(--success-soft);
  color: var(--success);
}

.quick-setup-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.25;
}

.quick-setup-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.5;
}

.quick-setup-card button {
  justify-self: start;
}

.guided-setup {
  display: grid;
  gap: var(--s-4);
  overflow: hidden;
}

.guided-header {
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  align-items: flex-start;
}

.guided-header h2,
.guided-action h3,
.guided-proof h3 {
  margin: 0;
  color: var(--ink);
}

.guided-header h2 {
  font-size: 28px;
  line-height: 1.1;
}

.guided-header p,
.guided-action p,
.guided-proof p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.guided-score {
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: var(--s-3);
  text-align: center;
}

.guided-score strong {
  display: block;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.guided-score span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.setup-step-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-2);
}

.setup-step-strip span {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px var(--s-2);
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--paper);
  padding: var(--s-3);
}

.setup-step-strip b {
  grid-row: span 2;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--paper-sunk);
  color: var(--muted);
  font-size: 11px;
}

.setup-step-strip em {
  min-width: 0;
  color: var(--ink);
  font-style: normal;
  font-size: 13px;
  font-weight: 900;
}

.setup-step-strip small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-step-strip .complete {
  border-color: rgba(20, 184, 166, 0.34);
  background: var(--success-soft);
}

.setup-step-strip .complete b {
  background: var(--success);
  color: #fff;
}

.guided-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, 0.65fr);
  gap: var(--s-4);
  align-items: stretch;
}

/* First-run: a single focused action, no second column. */
.guided-body.single {
  grid-template-columns: minmax(0, 1fr);
}

.guided-setup.first-run {
  padding: var(--s-5);
}

.guided-action,
.guided-proof {
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background:
    linear-gradient(180deg, var(--paper) 0%, var(--paper-sunk) 100%);
  padding: var(--s-5);
}

.guided-action.verified {
  background:
    linear-gradient(180deg, rgba(20, 184, 166, 0.12) 0%, var(--paper) 70%);
}

.guided-form {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.guided-form.inline {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.guided-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s-3);
}

.guided-form textarea {
  min-height: 130px;
  resize: vertical;
}

.guided-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--s-2);
  margin: var(--s-4) 0;
}

.guided-result-grid span {
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--paper);
  padding: var(--s-3);
}

.guided-result-grid strong {
  display: block;
  color: var(--ink);
  font-size: 22px;
}

.guided-result-grid small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.setup-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-3);
}

.brief-action-row.compact {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: var(--s-3);
}

.snippet.compact {
  display: block;
  max-height: 96px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* Widget studio */
.surface-lead {
  margin: var(--s-2) 0 0;
  color: var(--muted);
  font-size: 14px;
  max-width: 60ch;
}

.widget-studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
  gap: var(--s-5);
  align-items: start;
  margin-top: var(--s-4);
}

.widget-studio-controls {
  display: grid;
  gap: var(--s-3);
  min-width: 0;
}

.studio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
}

.studio-field {
  display: grid;
  gap: var(--s-1);
  min-width: 0;
}

.studio-field .field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}

.studio-field .field-label b {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.studio-field input[type="text"],
.studio-field select,
.studio-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  padding: 8px 10px;
  font: inherit;
  font-size: 14px;
  background: var(--nav);
  color: var(--ink);
}

.studio-field textarea {
  resize: vertical;
  min-height: 64px;
}

.studio-field input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  background: var(--nav);
  cursor: pointer;
}

.studio-field input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.studio-toggle {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 14px;
  color: var(--ink);
}

.studio-toggle input[type="checkbox"] {
  accent-color: var(--accent);
}

.studio-toggle input[type="color"] {
  width: 44px;
  height: 28px;
  margin-left: auto;
  padding: 1px;
  border: 1px solid var(--line);
  border-radius: var(--r-1);
  cursor: pointer;
}

.studio-toggle input[type="color"]:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.widget-studio-preview-wrap {
  position: sticky;
  top: var(--s-4);
  display: grid;
  gap: var(--s-2);
}

.widget-studio-preview-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.widget-studio-preview {
  width: 100%;
  height: 440px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--nav-soft);
}

.widget-studio-output {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-4);
}

.widget-studio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}

@media (max-width: 860px) {
  .widget-studio {
    grid-template-columns: minmax(0, 1fr);
  }
  .widget-studio-preview-wrap {
    position: static;
  }
}

.launch-map { overflow: hidden; }

.launch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
}

.launch-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: var(--s-3);
  min-height: 210px;
  padding: var(--s-5);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-3);
  background:
    linear-gradient(180deg, var(--card) 0%, var(--paper-sunk) 100%);
  overflow: hidden;
}

.launch-card::after {
  content: "";
  position: absolute;
  inset: auto 14px 14px auto;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent-soft);
  opacity: 0.55;
}

.launch-card.pending::after {
  background: var(--warn-soft);
}

.launch-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--nav-line);
  border-radius: var(--r-2);
  background: var(--nav);
  color: var(--nav-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.launch-card.pending .launch-number {
  background: var(--warn-soft);
  color: var(--warn);
}

.launch-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.2;
  letter-spacing: -0.012em;
}

.launch-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.launch-card a {
  position: relative;
  z-index: 1;
  justify-self: start;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

/* ───── Surfaces / cards ───── */

.metric-card, .surface, .plan-card, .channel-card {
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--card);
  box-shadow: var(--shadow-1);
  transition: box-shadow var(--dur-base) var(--ease),
              border-color var(--dur-base) var(--ease);
}

.metric-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: var(--s-4) var(--s-4) var(--s-4);
}

.metric-card span, .metric-card small,
.muted, .empty-state, .data-row small,
.channel-card p, .auth-copy p,
.definition-grid dt {
  color: var(--muted);
}

.metric-card .metric-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-right: 40px;
}

.metric-icon {
  position: absolute;
  top: var(--s-3);
  right: var(--s-3);
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  color: var(--muted);
  transition: background var(--dur-base) var(--ease),
              color var(--dur-base) var(--ease);
}

.metric-icon svg { width: 18px; height: 18px; display: block; }

.metric-card:hover .metric-icon {
  background: var(--accent-soft);
  color: var(--accent);
}

.metric-card.warn .metric-icon {
  background: rgba(154, 101, 0, 0.12);
  color: var(--warn);
}

.metric-card.good .metric-icon {
  background: var(--success-soft);
  color: var(--success);
}

.metric-card strong {
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.metric-card small { font-size: 12.5px; }

.empty-state {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: var(--s-6);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  text-align: center;
  font-size: 13.5px;
}

.surface { padding: var(--s-5); min-width: 0; }

.surface-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.surface-header.compact { margin-top: var(--s-5); margin-bottom: var(--s-3); }
.surface-divider { height: 1px; background: var(--line-soft); margin: var(--s-5) 0; }

.surface-header h2, .auth-copy h2 {
  margin: 4px 0 0;
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.text-link {
  color: var(--accent);
  font-weight: 600;
  font-size: 13.5px;
  transition: color var(--dur-fast) var(--ease);
}
.text-link:hover { color: var(--accent-strong); }

/* ───── Two-column ───── */

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.85fr);
  gap: var(--s-5);
  align-items: start;
}

.two-column.wide-left {
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
}

/* ───── Definition grid ───── */

.definition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3);
  margin: 0;
}

.definition-grid div {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: var(--s-3) var(--s-4);
}

.definition-grid dt {
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.definition-grid dd {
  margin: 0;
  line-height: 1.4;
  font-weight: 500;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* ───── Checklist & lists ───── */

.checklist, .data-list, .stacked-form { display: grid; gap: var(--s-2); }

.check-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s-3);
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: 12px var(--s-4);
}

.check-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--line-strong);
  box-shadow: 0 0 0 3px var(--paper-sunk);
}

.check-item.complete .check-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-soft);
}

.check-item strong, .check-item small { display: block; }
.check-item strong { font-size: 14px; letter-spacing: -0.005em; }
.check-item small { color: var(--muted); font-size: 12.5px; margin-top: 1px; }

.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: 12px var(--s-4);
  transition: background var(--dur-fast) var(--ease);
}
.data-row:hover { background: var(--card-hover); }

.data-row strong { font-size: 14px; letter-spacing: -0.005em; }
.data-row small { font-size: 12.5px; }

.data-list.compact .data-row { padding: 10px var(--s-3); }

.usage-list {
  gap: var(--s-3);
}

.usage-row {
  align-items: stretch;
  gap: var(--s-4);
}

.usage-org-main {
  min-width: 260px;
  flex: 1 1 330px;
  display: grid;
  gap: 6px;
}

.usage-org-main strong,
.usage-org-main small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.usage-meter {
  width: min(360px, 100%);
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line-soft);
}

.usage-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--success));
}

.usage-facts {
  flex: 2 1 520px;
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  gap: var(--s-2);
  align-items: stretch;
}

.usage-facts span {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-1);
  background: var(--paper);
  padding: 9px 10px;
}

.usage-facts strong,
.usage-facts small {
  display: block;
}

.usage-facts small {
  color: var(--muted);
}

.admin-request-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(0, 1.22fr);
  gap: var(--s-5);
  align-items: start;
}

.admin-hero .surface-header {
  align-items: start;
}

.admin-action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  align-items: center;
  margin: 0 0 var(--s-4);
}

.admin-action-strip .status-badge {
  margin-left: auto;
}

.admin-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
  gap: var(--s-5);
  align-items: start;
}

.admin-panel-filters {
  grid-template-columns: minmax(170px, 220px) minmax(170px, 220px) minmax(220px, 280px) auto;
}

.admin-usage-row {
  align-items: stretch;
}

.admin-user-row {
  align-items: stretch;
}

.admin-user-main {
  min-width: 240px;
  flex: 1 1 360px;
  display: grid;
  gap: 4px;
}

.admin-user-main strong,
.admin-user-main small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.admin-usage-facts {
  flex: 1 1 300px;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
}

.admin-user-facts {
  flex: 1 1 300px;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
}

.admin-risk-item {
  cursor: pointer;
}

.admin-request-filters {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(220px, 280px) auto;
  gap: var(--s-3);
  align-items: end;
}

.ops-request-list {
  display: grid;
  gap: var(--s-2);
  max-height: 620px;
  overflow: auto;
  padding-right: 2px;
}

.ops-request-item {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  color: var(--ink);
  padding: 12px var(--s-4);
  text-align: left;
}

.ops-request-item:hover,
.ops-request-item.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.ops-request-item strong,
.ops-request-item small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.ops-request-item strong {
  font-size: 14px;
  letter-spacing: 0;
}

.ops-request-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12.5px;
}

.ops-request-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.ops-detail-block {
  display: grid;
  gap: 6px;
  margin-top: var(--s-4);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: var(--s-4);
}

.ops-detail-block strong {
  color: var(--ink);
  font-size: 13px;
}

.ops-detail-block p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ops-access-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
  margin: 0;
}

.ops-access-list div {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--card);
  padding: var(--s-3);
}

.ops-access-list dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.ops-access-list dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.status-badge.new,
.status-badge.reviewing,
.status-badge.quoted,
.status-badge.scheduled,
.status-badge.high,
.status-badge.urgent {
  border-color: transparent;
  background: var(--warn-soft);
  color: var(--warn);
}

.status-badge.done,
.status-badge.normal {
  border-color: transparent;
  background: var(--success-soft);
  color: var(--success);
}

.status-badge.cancelled {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

.field-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.bot-profile-form {
  margin-top: var(--s-5);
  padding-top: var(--s-5);
  border-top: 1px solid var(--line-soft);
}

.system-prompt-input {
  min-height: 220px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.field-help {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--ink-soft);
  font-size: 13px;
}

.checkbox-line input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-2);
}

.checkbox-grid.compact .checkbox-line {
  align-items: flex-start;
  padding: var(--s-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
}

.checkbox-line span {
  display: grid;
  gap: 2px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  min-width: max-content;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  line-height: 1;
}

.empty-state.compact {
  min-height: 74px;
  padding: var(--s-4);
}

.external-tools-list { margin-top: var(--s-4); }

.channel-guide {
  display: grid;
  gap: 8px;
  margin-top: var(--s-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: var(--s-3);
}

.channel-guide span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.channel-guide li {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
}

/* Inline credential form so messaging channels can actually be connected. */
.channel-config {
  margin-top: var(--s-3);
}

.channel-config > summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  list-style: none;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--r-2);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
}

.channel-config > summary::-webkit-details-marker {
  display: none;
}

.channel-config > summary::before {
  content: "+";
  font-weight: 700;
}

.channel-config[open] > summary::before {
  content: "−";
}

.channel-config[open] > summary {
  margin-bottom: var(--s-3);
}

.channel-config-form {
  display: grid;
  gap: var(--s-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: var(--s-3);
}

.channel-config-form .field-help {
  margin: 0;
}

.install-wizard-panel {
  display: grid;
  gap: var(--s-3);
  margin-bottom: var(--s-5);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-3);
  background: var(--paper-sunk);
  padding: var(--s-4);
}

.manual-install-details {
  display: grid;
  gap: var(--s-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--card);
  padding: var(--s-3);
}

.manual-install-details summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 750;
}

.manual-install-details[open] summary {
  margin-bottom: var(--s-2);
}

.manual-install-details .stacked-form {
  margin-top: var(--s-3);
}

.platform-guides {
  display: grid;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.platform-guide {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--card);
  padding: var(--s-3);
}

.platform-guide summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 750;
}

.platform-guide[open] summary {
  margin-bottom: var(--s-2);
}

.platform-guide .platform-steps {
  margin: 0 0 var(--s-2);
  padding-left: 1.25rem;
  display: grid;
  gap: var(--s-1);
  color: var(--muted);
}

.platform-guide .snippet {
  display: block;
  margin-bottom: var(--s-2);
}

.install-step-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
}

.install-step-grid article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--card);
  padding: var(--s-3);
}

.install-step-grid b {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.install-step-grid strong {
  color: var(--ink);
  font-size: 13.5px;
}

.install-step-grid small {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.tool-template-panel {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-5);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-3);
  background: var(--paper-sunk);
  padding: var(--s-4);
}

.template-panel-copy {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.tool-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: var(--s-3);
}

.tool-template-card {
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: var(--s-3);
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--card);
  padding: var(--s-4);
}

.tool-template-card header {
  display: grid;
  gap: var(--s-2);
  align-content: start;
}

.tool-template-card h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.25;
  letter-spacing: 0;
}

.tool-template-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tool-template-card ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.tool-template-card li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 8px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.45;
}

.tool-template-card li::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.tool-template-card button {
  width: 100%;
  min-height: 38px;
}

.tool-template-card.support {
  border-color: rgba(183, 121, 31, 0.28);
  background: linear-gradient(180deg, var(--card) 0%, var(--warn-soft) 100%);
}

.tool-draft-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.72fr) auto;
  align-items: center;
  gap: var(--s-3);
  margin-bottom: var(--s-4);
  border: 1px solid rgba(var(--brand-blue-rgb), 0.24);
  border-radius: var(--r-2);
  background: var(--accent-soft);
  padding: var(--s-3);
}

.tool-draft-panel div {
  display: grid;
  gap: 3px;
}

.tool-draft-panel strong {
  color: var(--ink);
  font-size: 14px;
}

.tool-draft-panel small {
  color: var(--muted);
  font-size: 12.5px;
}

.tool-draft-panel code {
  margin: 0;
  min-height: 38px;
  padding: 9px 10px;
  font-size: 12px;
}

.api-token-once {
  display: grid;
  gap: var(--s-2);
  border: 1px solid rgba(183, 121, 31, 0.32);
  border-radius: var(--r-2);
  background: var(--warn-soft);
  padding: var(--s-3);
}

.api-token-once strong {
  color: var(--ink);
  font-size: 13px;
}

.api-key-list {
  margin-top: var(--s-3);
}

.api-doc-grid {
  display: grid;
  gap: var(--s-3);
}

.api-doc-grid .snippet {
  margin-top: 8px;
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
}

/* ───── Knowledge lab ───── */

.answer-lab {
  display: grid;
  gap: var(--s-4);
}

.corpus-import-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
}

.corpus-import-panel div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.corpus-import-panel strong {
  color: var(--ink);
  font-size: 14px;
}

.corpus-import-panel span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.corpus-import-panel button {
  flex: 0 0 auto;
}

/* Website import: the lowest-friction way to fill the knowledge base, so it is
   highlighted with the brand accent as the primary path over manual entry. */
.website-import-panel {
  display: grid;
  gap: var(--s-3);
  border: 1px solid var(--accent);
  border-radius: var(--r-2);
  background: var(--accent-soft);
  padding: var(--s-3);
  margin-bottom: var(--s-4);
}

.website-import-panel > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.website-import-panel strong {
  color: var(--ink);
  font-size: 14px;
}

.website-import-panel span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.website-import-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.website-import-row input {
  flex: 1 1 220px;
  min-width: 0;
}

.website-import-row button {
  flex: 0 0 auto;
}

.guided-form.website-import {
  gap: 8px;
}

.guided-form.website-import input {
  width: 100%;
}

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

.guided-manual {
  margin-top: var(--s-3);
}

.guided-manual > summary {
  cursor: pointer;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  padding: 6px 0;
}

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

.guided-manual > summary::before {
  content: "+ ";
  font-weight: 700;
}

.guided-manual[open] > summary::before {
  content: "− ";
}

.answer-test-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s-3);
  align-items: end;
}

/* Inbox: the owner's view of real customer conversations. */
.inbox-list {
  display: grid;
  gap: 10px;
}

.inbox-item {
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--paper);
  overflow: hidden;
}

.inbox-item > summary {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: 12px var(--s-4);
  cursor: pointer;
  list-style: none;
}

.inbox-item > summary::-webkit-details-marker {
  display: none;
}

.inbox-channel {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--paper-sunk);
  color: var(--muted);
}

.inbox-channel.web {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.inbox-preview {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 500;
}

.inbox-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.inbox-thread {
  display: grid;
  gap: 10px;
  padding: var(--s-4);
  border-top: 1px solid var(--line-soft);
  background: var(--paper-sunk);
}

.inbox-msg {
  display: grid;
  gap: 3px;
  max-width: 85%;
}

.inbox-msg.user {
  justify-self: start;
}

.inbox-msg.assistant {
  justify-self: end;
  text-align: right;
}

.inbox-role {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.inbox-bubble {
  display: inline-block;
  padding: 10px 12px;
  border-radius: var(--r-2);
  border: 1px solid var(--line);
  background: var(--paper);
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 14px;
  text-align: left;
}

.inbox-msg.assistant .inbox-bubble {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.inbox-msg-meta {
  color: var(--muted);
  font-size: 11px;
}

/* Inbox tabs: Conversations / Leads / Unanswered questions. */
.inbox-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: var(--s-4);
}

.inbox-tabs .inbox-tab.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.inbox-tab-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.surface-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.lead-item,
.gap-item {
  padding: 12px var(--s-4);
}

.lead-item-main {
  display: flex;
  gap: var(--s-4);
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.lead-item-main > div:first-child {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.lead-contact {
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.lead-note {
  margin: 0;
  font-size: 13px;
  color: var(--ink);
  white-space: pre-wrap;
}

.lead-item-side {
  display: grid;
  gap: 6px;
  justify-items: end;
  flex: 0 0 auto;
}

.lead-item-side select {
  font-size: 13px;
  padding: 4px 8px;
}

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

.answer-test-form button {
  min-width: 148px;
}

.answer-empty {
  display: grid;
  gap: 4px;
  min-height: 96px;
  align-content: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: var(--s-5);
}

.answer-empty strong {
  color: var(--ink);
  font-size: 15px;
}

.answer-empty span {
  color: var(--muted);
  font-size: 13px;
}

/* Clean 2D retrieval-evidence visualization (replaces the 3D scene): a
   Question→Retrieval→Matches→Answer rail + per-source similarity score bars.
   Theme tokens adapt automatically to light/night. */
.answer-evidence-panel {
  display: grid;
  gap: var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  background: var(--paper);
  padding: var(--s-5);
}

.answer-evidence-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}

.answer-evidence-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.answer-evidence-head h3 {
  margin: 0;
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.2;
}

.answer-evidence-head p {
  margin: 0;
  max-width: 56ch;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.answer-evidence-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, auto));
  gap: 8px;
}

.answer-evidence-metrics span {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: 8px 12px;
  text-align: center;
}

.answer-evidence-metrics small {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.answer-evidence-metrics strong {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.answer-flow-rail {
  display: flex;
  align-items: flex-start;
  margin: 0;
  padding: 4px 0;
  list-style: none;
}

.answer-flow-rail li {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

.answer-flow-rail li::before {
  content: "";
  position: absolute;
  top: 7px;
  left: -50%;
  width: 100%;
  height: 2px;
  background: var(--line);
}

.answer-flow-rail li:first-child::before {
  display: none;
}

.answer-flow-rail .flow-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--paper);
  z-index: 1;
}

.answer-flow-rail li.done {
  color: var(--ink);
}

.answer-flow-rail li.done .flow-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.answer-flow-rail li.done::before {
  background: var(--accent);
}

.evidence-bars {
  display: grid;
  gap: 10px;
}

.evidence-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 240px) auto;
  align-items: center;
  gap: var(--s-3);
}

.evidence-bar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.evidence-bar-label b {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.evidence-bar-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.evidence-bar-track {
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--paper-sunk);
  overflow: hidden;
}

.evidence-bar-track > span {
  display: block;
  height: 100%;
  border-radius: var(--r-pill);
  background: var(--accent);
  transition: width 0.4s ease;
}

.evidence-bar.good .evidence-bar-track > span { background: #16a34a; }
.evidence-bar.mid .evidence-bar-track > span { background: var(--accent); }
.evidence-bar.low .evidence-bar-track > span { background: #d97706; }

.evidence-bar > strong {
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}

.evidence-empty {
  display: grid;
  gap: 4px;
  border: 1px dashed var(--line);
  border-radius: var(--r-2);
  padding: var(--s-4);
  text-align: center;
}

.evidence-empty span {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 640px) {
  .evidence-bar {
    grid-template-columns: 1fr auto;
  }
  .evidence-bar-track {
    grid-column: 1 / -1;
  }
}

.answer-map-3d {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  margin-inline: calc(var(--s-5) * -1);
  border-block: 1px solid var(--line-soft);
  background:
    linear-gradient(135deg, rgba(6, 12, 24, 0.98) 0%, rgba(15, 23, 42, 0.96) 54%, rgba(7, 45, 43, 0.96) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -80px 120px rgba(2, 6, 23, 0.46);
}

.answer-map-copy {
  position: absolute;
  z-index: 2;
  top: var(--s-5);
  left: var(--s-5);
  max-width: min(380px, calc(100% - 40px));
  display: grid;
  gap: 6px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--r-2);
  background: rgba(15, 23, 42, 0.58);
  padding: var(--s-4);
  box-shadow: 0 20px 60px -32px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(14px);
}

.answer-map-copy .section-kicker {
  color: #67e8f9;
}

.answer-map-copy h3 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.15;
}

.answer-map-copy p {
  margin: 0;
  color: #a8b4c7;
  font-size: 13px;
  line-height: 1.45;
}

.answer-map-metrics {
  position: absolute;
  z-index: 2;
  top: var(--s-5);
  right: var(--s-5);
  display: grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
  gap: 8px;
  max-width: min(390px, calc(100% - 40px));
}

.answer-map-metrics span {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: var(--r-2);
  background: rgba(15, 23, 42, 0.58);
  padding: 10px 12px;
  backdrop-filter: blur(14px);
}

.answer-map-metrics small,
.answer-map-metrics strong {
  display: block;
  min-width: 0;
}

.answer-map-metrics small {
  color: #94a3b8;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
}

.answer-map-metrics strong {
  margin-top: 2px;
  color: #f8fafc;
  font-size: 17px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.answer-scene-canvas {
  display: block;
  width: 100%;
  height: 520px;
  min-height: 420px;
}

.answer-map-legend {
  position: absolute;
  z-index: 2;
  right: var(--s-5);
  bottom: var(--s-5);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.answer-map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--r-pill);
  background: rgba(15, 23, 42, 0.58);
  color: #dbe7f4;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(14px);
}

.answer-map-legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.answer-map-legend .source { background: #2dd4bf; }
.answer-map-legend .chunk { background: #60a5fa; }
.answer-map-legend .match { background: #f59e0b; }

.answer-map-evidence {
  position: absolute;
  z-index: 2;
  left: var(--s-5);
  bottom: var(--s-5);
  width: min(440px, calc(100% - 40px));
  display: grid;
  gap: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: var(--r-2);
  background: rgba(15, 23, 42, 0.64);
  padding: var(--s-4);
  box-shadow: 0 20px 60px -32px rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(14px);
}

.answer-map-evidence > strong,
.answer-map-evidence > span {
  min-width: 0;
}

.answer-map-evidence > strong {
  color: #f8fafc;
  font-size: 13px;
}

.answer-map-evidence > span {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: #dbe7f4;
  font-size: 12px;
  overflow: hidden;
}

.answer-map-evidence b {
  color: #fbbf24;
  font-family: var(--font-mono);
  font-size: 11px;
}

.answer-map-evidence em {
  color: #94a3b8;
  font-style: normal;
  white-space: nowrap;
}

.answer-map-evidence > span.summary {
  display: block;
  color: #a8b4c7;
  line-height: 1.45;
}

.answer-stage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--s-3);
}

.answer-stage-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--paper-sunk);
  padding: var(--s-3);
}

.answer-stage-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.answer-stage-card strong {
  color: var(--ink);
  font-size: 14px;
  text-transform: capitalize;
}

.answer-stage-card small {
  color: var(--muted);
  font-size: 12px;
}

.answer-stage-card.complete {
  border-color: rgba(31, 122, 77, 0.28);
  background: var(--success-soft);
}

.answer-stage-card.needs_knowledge,
.answer-stage-card.empty {
  border-color: rgba(183, 121, 31, 0.32);
  background: var(--warn-soft);
}

.answer-flow {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(160px, 0.8fr) minmax(140px, 0.6fr);
  gap: var(--s-3);
}

.answer-flow article {
  min-width: 0;
  border: 1px solid var(--line-soft);
  border-radius: var(--r-2);
  background: var(--card);
  padding: var(--s-4);
}

.answer-flow strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.answer-flow small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.token-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--s-2);
}

.token-row span {
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--paper-sunk);
  color: var(--ink-soft);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.answer-match-list {
  display: grid;
  gap: var(--s-3);
}

.answer-match {
  display: grid;
  gap: var(--s-3);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: var(--card);
  padding: var(--s-4);
}

.answer-match header {
  display: flex;
  align-items: center;
  gap: var(--s-3);
}

.answer-match strong,
.answer-match small {
  display: block;
}

.answer-match strong {
  color: var(--ink);
  font-size: 14px;
}

.answer-match small {
  color: var(--muted);
  font-size: 12px;
}

.answer-match p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.6;
}

.answer-score-bar {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: var(--r-pill);
  background: var(--paper-sunk);
}

.answer-score-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--info));
}

@media (max-width: 960px) {
  .admin-panel-grid,
  .admin-request-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-panel-filters,
  .admin-request-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-action-strip .status-badge {
    margin-left: 0;
  }

  .admin-usage-facts,
  .admin-user-facts,
  .usage-facts {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
  }
}

/* Businesses: multi-business switcher + add form on the Bots page */
.businesses-surface .business-list {
  display: grid;
  gap: var(--s-2);
  margin: var(--s-4) 0;
}
.business-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  width: 100%;
  text-align: left;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.business-row:hover { border-color: var(--accent); }
.business-row.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.business-row-main { display: grid; gap: 2px; min-width: 0; }
.business-row-main strong { color: var(--ink); }
.business-row-main small { color: var(--muted); }
.business-row-tag {
  font-size: 0.78rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 2px 10px;
  white-space: nowrap;
}
.business-row.is-active .business-row-tag {
  color: var(--accent);
  border-color: var(--accent);
}
.business-add { margin-top: var(--s-4); }

/* ----- Two-way support ticket messaging ----- */
.row-actions { display: flex; align-items: center; gap: var(--s-2); }
.inline-toggle { display: flex; align-items: center; gap: var(--s-2); font-size: 13px; }
.inline-toggle input { width: auto; }
.ticket-panel {
  margin: var(--s-2) 0 var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-2, 10px);
  background: var(--card-hover, rgba(0, 0, 0, 0.02));
}
.ticket-thread { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-3); }
.ticket-message {
  padding: var(--s-2) var(--s-3);
  border-radius: var(--radius-2, 10px);
  border: 1px solid var(--border);
  background: var(--card, #fff);
  max-width: 90%;
}
.ticket-message.from-customer { align-self: flex-start; }
.ticket-message.from-admin { align-self: flex-end; border-color: var(--accent); }
.ticket-message.internal { background: #fff7e6; border-color: #f0c36d; }
.ticket-message-head {
  display: flex; align-items: center; gap: var(--s-2);
  font-size: 12px; margin-bottom: 4px;
}
.ticket-message-head .muted { margin-left: auto; }
.ticket-message p { margin: 0; font-size: 13.5px; line-height: 1.5; word-break: break-word; }
.ticket-attachment {
  display: inline-block; margin-top: 6px; margin-right: var(--s-2);
  font-size: 12.5px; text-decoration: none; color: var(--accent);
}
.ticket-attachment:hover { text-decoration: underline; }

/* ----- Own card checkout form ----- */
.card-fields {
  display: flex; flex-direction: column; gap: var(--s-2);
  margin: var(--s-2) 0 var(--s-3);
  padding: var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-2, 10px);
  background: var(--card-hover, rgba(0, 0, 0, 0.02));
}
.card-fields .card-full { display: block; }
.card-fields .card-full input { width: 100%; }
.card-fields .form-grid { margin: 0; }
