/* 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. Every colour is a token, so dark.css's
 * token flip themes all of it; no dark rules here. */

/* ═══════════════════════ 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(--link); /* --accent is 3.6:1 on white: too light for small text */
  text-decoration: none;
}
.ct-engage-inline-link:hover {
  color: var(--link-hover);
  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;
}
/* Active step: cyan wash + solid cyan number (the --highlight pair is the same
   in both themes). Done steps: a quieter slate number, inverted per theme. */
.ct-stepper-active {
  background: var(--primary-soft);
  border-color: var(--accent);
  color: var(--text);
}
.ct-stepper-active .ct-step-num {
  background: var(--highlight);
  color: var(--highlight-ink);
}
.ct-stepper-done {
  color: var(--text);
}
.ct-stepper-done .ct-step-num {
  background: var(--text-muted);
  color: var(--text-invert);
}

/* ═══════════════════════ Priority row rails (admin decisions) ═══════════════════════ */
/* 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);
}

/* ═══════════════════════ Admin clients ═══════════════════════ */
/* Risk rails on the clients 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);
}

/* ═══════════════════════ Phase 2 · 2B (C7-C10) ═══════════════════════
 * The client app's second half and the shared records: SDS, campaigns and
 * supplier requests, the ΗΡΙΔΑΝΟΣ registry, the packages. Tokens only; the
 * semantic --confirmed / --potential / --clear flip themselves in dark.css. */

/* A number or a count in a table cell. */
.ct-cell-num {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}
.ct-text-warn {
  color: var(--potential);
}

/* The next step at a record's top right, and why it is disabled. */
.ct-next-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  max-width: 320px;
}
.ct-next-why {
  margin: 0;
  text-align: right;
}

/* "What still waits": each count a link to the list where it is done (C10). */
.ct-wait-list {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ct-wait-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}
.ct-wait-link:hover {
  background: var(--primary-soft);
  color: var(--link-hover);
}
.ct-wait-link:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.ct-wait-arrow {
  margin-left: auto;
  color: var(--text-subtle);
  font-size: 1.2rem;
  line-height: 1;
}
.ct-empty .ct-wait-list {
  max-width: 460px;
  margin: 4px auto 0;
  text-align: left;
}
.ct-subs-waiting {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-3) var(--space-2);
  border: 1px solid var(--potential-edge);
  border-radius: var(--radius);
  background: var(--potential-tint);
}
.ct-subs-waiting[hidden] {
  display: none;
}
.ct-subs-waiting-title {
  margin: 0 0 4px 12px;
  color: var(--text);
  font-weight: 700;
}
.ct-subs-form .ct-grid-form {
  margin: var(--space-4) 0;
}
.ct-package-update {
  margin: 0 0 var(--space-3);
}

/* ── C8 · campaigns, the letter, a request ── */
.ct-letter {
  margin-bottom: var(--space-4);
}
.ct-letter-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--page-panel);
}
.ct-letter-what {
  flex: 1 1 260px;
  min-width: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.ct-letter-what strong {
  color: var(--text);
}
.ct-letter-actions.ct-form-actions {
  margin-top: 0;
}
.ct-letter .ct-banner {
  margin-top: var(--space-3);
}
.ct-letter-replace,
.ct-letter-form {
  margin-top: var(--space-3);
}
.ct-campaign-form .ct-grid-form {
  margin-bottom: var(--space-4);
}
.ct-campaign-suppliers {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ct-campaign-suppliers > legend {
  padding: 0 6px;
  font-size: var(--text-sm);
  font-weight: 700;
}
.ct-campaign-recipient {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 18rem);
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.ct-campaign-recipient .ct-checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ct-campaign-recipient select {
  width: 100%;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}
.ct-campaign-recipient select:disabled {
  opacity: 0.55;
}
.ct-campaign-add {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-2);
}
.ct-campaign-actions {
  justify-content: flex-end;
}
.ct-form-left {
  margin-top: var(--space-2);
  text-align: right;
}
.ct-form-left:empty {
  display: none;
}
.ct-campaign-done .ct-campaign-link-row {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.ct-why {
  color: var(--confirmed);
}
.ct-next-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}
.ct-answer-facts {
  --ct-fact-cols: 2;
}
.ct-answer-sub {
  margin: var(--space-4) 0 var(--space-2);
  font-size: var(--text-sm);
  font-weight: 800;
}
.ct-offline-form .ct-grid-form {
  margin-top: var(--space-3);
}
@media (max-width: 900px) {
  .ct-campaign-recipient {
    grid-template-columns: 1fr;
  }
}

/* ── The readiness panel (core/readiness-panel.js; EUDR css/dds.css:1780-2045):
   flat, one soft tint, no stripes, no box per row; the tone is in the icons
   and the answer's words. ── */
.ct-rdy {
  --rd-tone: var(--confirmed);
  /* the page card is a flex column that scrolls: never squeezed */
  flex-shrink: 0;
  margin: 0 0 var(--space-5);
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  overflow: hidden;
}
.ct-rdy[data-status="warnings"] {
  --rd-tone: var(--potential);
}
.ct-rdy[data-status="ready"] {
  --rd-tone: var(--clear);
}
.ct-rdy[data-status="replaced"] {
  --rd-tone: var(--neutral-status);
}
.ct-rdy-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  padding: 14px 18px;
}
.ct-rdy-status-icon {
  display: inline-flex;
  align-self: start;
  margin-top: 2px;
  color: var(--rd-tone);
}
.ct-rdy-heading {
  min-width: 0;
}
.ct-rdy-question {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 700;
}
.ct-rdy-title {
  margin: 0;
  color: var(--rd-tone);
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
}
.ct-rdy-title:focus {
  outline: none;
}
.ct-rdy-title:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}
.ct-rdy-summary {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.ct-rdy-recheck {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ct-rdy-recheck[aria-disabled="true"] {
  cursor: progress;
}
.ct-rdy-recheck-icon {
  display: inline-flex;
}
.ct-rdy-group {
  padding: 12px 18px 12px 52px;
  border-top: 1px solid var(--border);
}
.ct-rdy-group-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-bottom: 6px;
}
.ct-rdy-group-title {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ct-rdy-chip {
  font-size: var(--text-xs);
  font-weight: 700;
}
.ct-rdy-chip.is-block {
  color: var(--confirmed);
}
.ct-rdy-chip.is-warn {
  color: var(--potential);
}
.ct-rdy-chip.is-info {
  color: var(--text-muted);
}
.ct-rdy-group-action {
  margin-left: auto;
}
.ct-rdy-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ct-rdy-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 6px 10px;
}
.ct-rdy-item.is-block .ct-rdy-icon {
  color: var(--confirmed);
}
.ct-rdy-item.is-warn .ct-rdy-icon {
  color: var(--potential);
}
.ct-rdy-item.is-info .ct-rdy-icon {
  color: var(--text-muted);
}
.ct-rdy-item.is-info .ct-rdy-item-title {
  color: var(--text-muted);
  font-weight: 500;
}
.ct-rdy-icon {
  display: inline-flex;
  flex: none;
  margin-top: 1px;
}
.ct-rdy-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.ct-rdy-item-title {
  font-size: var(--text-sm);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.ct-rdy-item-detail {
  color: var(--text-muted);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}
.ct-rdy-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: normal;
}
.ct-rdy-passed {
  padding: 6px 14px 8px 46px;
  border-top: 1px solid var(--border);
}
.ct-rdy-passed-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--clear);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
}
.ct-rdy-passed-toggle:hover {
  background: var(--clear-tint);
}
.ct-rdy-passed-toggle:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.ct-rdy-chevron {
  display: inline-flex;
  transition: transform 0.15s ease;
}
.ct-rdy-passed-toggle[aria-expanded="true"] .ct-rdy-chevron {
  transform: rotate(180deg);
}
.ct-rdy-passed-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 6px 18px;
  margin: 4px 0 2px;
  padding: 0 6px;
  list-style: none;
}
.ct-rdy-passed-list[hidden] {
  display: none;
}
.ct-rdy-passed-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: var(--text-sm);
}
.ct-rdy-passed-list .ct-rdy-icon {
  color: var(--clear);
}
@media (max-width: 720px) {
  .ct-rdy-head {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .ct-rdy-recheck {
    grid-column: 2;
    justify-self: start;
  }
  .ct-rdy-group {
    padding: 12px;
  }
  .ct-rdy-item {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .ct-rdy-item .ct-rdy-action {
    grid-column: 2;
    justify-self: start;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ct-rdy-chevron {
    transition: none;
  }
}

/* ── C7 · the SDS list's upload and the SDS record ── */
.ct-sds-upload-panel {
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--page-panel);
}
.ct-upload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.ct-upload-head .ct-record-section-title {
  margin: 0;
}
.ct-sds-upload-panel > .ct-hint {
  margin: 4px 0 var(--space-3);
}
.ct-sds-reading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: var(--space-3);
}
.ct-sds-result {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--clear-edge);
  border-radius: var(--radius);
  background: var(--clear-tint);
}
.ct-sds-result p {
  margin: 0;
  font-weight: 600;
}
.ct-fields-table tr.is-open > td {
  background: var(--primary-soft);
}
.ct-fields-table tr.ct-field-detail > td {
  padding: 0;
  background: var(--surface-2);
}
.ct-field-detail-body {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5);
  border-left: 3px solid var(--accent);
}
.ct-field-ask {
  margin: 0;
  font-weight: 700;
}
.ct-field-state {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}
.ct-field-state .ct-confidence {
  width: 120px;
}
.ct-field-actions.ct-form-actions,
.ct-decision-actions.ct-form-actions {
  margin-top: 0;
}
.ct-decision-actions {
  justify-content: flex-end;
}
.ct-decision-left {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: right;
}
.ct-decision-left[hidden] {
  display: none;
}
.ct-decision-now {
  margin-bottom: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--page-panel);
}
.ct-decision-now p {
  margin: 0 0 4px;
}
.ct-decision-now.is-accepted .ct-decision-word {
  color: var(--clear);
}
.ct-decision-now.is-rejected .ct-decision-word {
  color: var(--confirmed);
}
.ct-decision-now.is-needs_info .ct-decision-word {
  color: var(--potential);
}
.ct-decision-word {
  font-weight: 800;
}
.ct-ph-upload {
  margin: 12px 16px 0;
}

/* ── C9 · the registry's bottom bar (EUDR dds.css:1662-1680): Back on the
   left, the entry's name in the middle, its actions on the right; at the
   end of the entry, as EUDR's (not pinned over the content). ── */
.ct-rdy-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-5);
  padding: 10px 20px;
  border-top: 2px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface-2);
}
.ct-rdy-bar-center {
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 700;
  text-align: center;
}
.ct-rdy-bar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}
.ct-rdy-bar-why {
  max-width: 240px;
  text-align: right;
}
.ct-company-context {
  margin-top: var(--space-2);
}
.ct-company-context .ct-client-context {
  margin: 0;
}
@media (max-width: 900px) {
  .ct-rdy-bar {
    grid-template-columns: 1fr;
  }
  .ct-rdy-bar-center {
    display: none;
  }
}
/* A desktop part of a page inside a phone screen (the registry's forms):
   the phone's gutters, no card in a card. */
body.ct-ph .ct-ph-desk {
  margin: 12px 16px 0;
}
body.ct-ph .ct-ph-desk > .ct-panel {
  margin: 0;
}
/* An empty slot above a list takes no row (the page card spaces its children). */
.ct-sds-top:empty,
.ct-letter-slot:empty {
  display: none;
}

/* The questions the platform drafted for the supplier, as the email words them
   (one line each): keep the line breaks. */
.ct-ask-text { white-space: pre-wrap; margin: 0; overflow-wrap: anywhere; }

/* "Approve all of section N" (questionnaire Q15/Q16): one action per section. */
.ct-section-approve { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }

/* "Same product?" (questionnaire Q6), the expert's yes/no on the sheet. */
.ct-identity-question { border: 1px solid var(--warning); border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; }
.ct-identity-question p { margin: 0 0 10px; }
.ct-identity-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* The SDS team's per-section checklist (questionnaire Q1/Q3). */
.ct-checklist-table td { vertical-align: middle; }
.ct-checklist-table .ct-input { width: 100%; min-width: 120px; }
.ct-checklist-warning { border-left: 3px solid var(--warning); padding: 6px 10px; margin: 0 0 8px; }
