/* engage.css — WP6 (campaigns / suppliers / submissions / processes / ops
 * console). Page-specific chrome only; forms, tables, cards, badges and the
 * tenant switcher come from ui.css. Colors are drawn from the navy tokens so
 * WP7's token flip themes most of this for free; the few fixed navy literals
 * (numbered step chips) are intentionally theme-independent. */

/* ═══════════════════════ Shared create-form layout ═══════════════════════ */
/* (suppliers / campaigns / submissions). Stacks the .ct-form vertically with a
 * section title, then a horizontal row of fields. */
.ct-engage-form {
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}
.ct-engage-form-title {
  margin: 0 0 2px;
  font-size: var(--text-md);
  font-weight: 800;
}
.ct-engage-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-4);
}
.ct-engage-form-row .ct-question {
  flex: 1 1 200px;
}
.ct-engage-recipients {
  border: none;
  padding: 0;
  margin: 0;
}
.ct-engage-recipients legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
}
.ct-engage-inline-link {
  display: inline-block;
  align-self: flex-start;
  margin-top: 4px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.ct-engage-inline-link:hover {
  color: var(--primary);
  text-decoration: underline;
}

/* ═══════════════════════ Detail meta row (campaign detail) ═══════════════════════ */
.ct-engage-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-4);
}
.ct-engage-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text);
}
.ct-engage-meta-label {
  color: var(--text-muted);
  font-weight: 600;
}

/* ═══════════════════════ Counts cell (submissions findings) ═══════════════════════ */
.ct-engage-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

/* ═══════════════════════ Step indicator (Path B wizard) ═══════════════════════ */
.ct-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
}
.ct-stepper-step {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
}
.ct-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.ct-stepper-label {
  white-space: nowrap;
}
/* Fixed navy chips so the numbered markers read the same in both themes. */
.ct-stepper-active {
  border-color: #1f3c54;
  color: var(--text);
}
.ct-stepper-active .ct-step-num {
  background: #1f3c54;
  color: #fff;
}
.ct-stepper-done {
  color: var(--text);
}
.ct-stepper-done .ct-step-num {
  background: #526878;
  color: #fff;
}

/* ═══════════════════════ Ops work-queue stats header ═══════════════════════ */
.ct-ops-stats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.ct-ops-stat {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
/* Status dot in the corner; the colour classes below set its background. */
.ct-ops-stat::before {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neutral-status);
}
.ct-ops-stat-value {
  font-size: var(--text-xl);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.ct-ops-stat-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
}
.ct-ops-stat-open::before {
  background: var(--potential);
}
.ct-ops-stat-claimed::before {
  background: var(--indeterminate);
}
.ct-ops-stat-oldest::before {
  background: var(--confirmed);
}

/* ═══════════════════════ Priority row rails (ops queue) ═══════════════════════ */
/* Priority 1 = highest (a red rail, mirroring the verdict rails); 2 = amber. */
.ct-table tbody tr.ct-task-p1 td:first-child {
  box-shadow: inset 3px 0 0 var(--confirmed);
}
.ct-table tbody tr.ct-task-p2 td:first-child {
  box-shadow: inset 3px 0 0 var(--potential);
}

/* ═══════════════════════ Ops match detail ═══════════════════════ */
.ct-engage-detail {
  margin-bottom: var(--space-4);
}
.ct-engage-detail-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.ct-engage-detail-row {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}
.ct-engage-detail-label {
  flex: 0 0 120px;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
}
.ct-engage-detail-value {
  font-size: var(--text-sm);
}
.ct-engage-detail-json {
  padding-top: var(--space-3);
  border-top: 1px solid var(--border);
}
.ct-engage-json-list {
  display: grid;
  grid-template-columns: minmax(120px, auto) 1fr;
  gap: 4px var(--space-3);
  margin: 6px 0 0;
  font-size: var(--text-sm);
}
.ct-engage-json-list dt {
  font-weight: 700;
  color: var(--text-muted);
}
.ct-engage-json-list dd {
  margin: 0;
  font-family: var(--font-mono);
  word-break: break-word;
}

/* ═══════════════════════ Dark mode ═══════════════════════ */
/* Surfaces/borders/text flip via WP7's token flip; the stepper's active pill
 * gets a navy wash so it doesn't read as a bright light chip on dark canvas. */
body.dark-mode .ct-stepper-active {
  background: rgba(31, 60, 84, 0.35);
  border-color: #2a5478;
}

/* ≤640px: stat cards and step chips wrap comfortably; forms already stack. */
@media (max-width: 640px) {
  .ct-ops-stat {
    flex: 1 1 40%;
    min-width: 0;
  }
  .ct-engage-detail-label {
    flex-basis: 90px;
  }
}

/* ═══════════════════════ Ops portfolio overview ═══════════════════════ */
.ct-ops-stat-overdue::before {
  background: var(--confirmed);
}
.ct-ops-stat-neutral::before {
  background: var(--accent);
}
/* Risk rails on the tenant table — same grammar as the priority rails above,
   so "this account needs attention" reads identically to "this task does". */
.ct-table tbody tr.ct-row-overdue td:first-child {
  box-shadow: inset 3px 0 0 var(--confirmed);
}
.ct-table tbody tr.ct-row-urgent td:first-child {
  box-shadow: inset 3px 0 0 var(--potential);
}
.ct-muted {
  color: var(--text-subtle);
}
