/* ChemTrust UI kit + screen styles. Class names are kept stable (components
 * and tests depend on them); the styling is the redesign. */

/* ═══════════════════════════ Primitives ═══════════════════════════ */

/* Page head — the EUDR page card's head (.assess-header): a round green
   badge, the title over a thin accent rule, the description under the rule,
   the screen's main action on the right. render.js pageHeader() builds it;
   on a desktop the screen around it is the page card (layout.css). */
.ct-page-header-wrap {
  margin-bottom: var(--space-5);
}
.ct-page-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.ct-page-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--page-badge);
  color: var(--page-badge-ink);
  box-shadow: var(--shadow-sm);
}
.ct-page-icon svg {
  width: 22px;
  height: 22px;
}
.ct-page-heading {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.ct-page-title {
  margin: 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--page-rule);
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.ct-page-desc {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
  max-width: 90ch;
}
.ct-page-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}
/* Back: EUDR's small outlined "← Back" key above the head. */
.ct-page-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-3);
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--page-panel);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
}
.ct-page-back:hover {
  border-color: var(--accent);
  color: var(--primary);
}
/* The context strip under the head (EUDR's "Operator: … Supplier: …" line):
   on the admin's one-client screens, the client they are about. */
.ct-page-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  margin-top: var(--space-4);
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--table-head);
  color: var(--text);
  font-size: var(--text-sm);
}

/* Card */
.ct-card {
  background: var(--glass-lit), var(--glass);
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  padding: var(--space-5);
}

.ct-section {
  margin-top: var(--space-6);
}
.ct-section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--text-lg);
  font-weight: 800;
}

/* Text that sits directly ON the shell canvas — page/section headers, the back
   link, filter labels — rather than inside a card.
   These used to be pinned to fixed light tones because the canvas was navy in
   both themes. The canvas now follows the theme, so they follow it too via the
   --canvas-text ramp: dark ink on the light canvas, light on the dark one.
   Pinning them light again would make every page title invisible in light mode.
   Scoped to `.ct-shell-active` so the login/portal public pages (own layouts)
   are unaffected. */
body.ct-shell-active .ct-page-title,
body.ct-shell-active .ct-section-title {
  color: var(--canvas-text);
}
body.ct-shell-active .ct-page-desc {
  color: var(--canvas-text-muted);
}
body.ct-shell-active .ct-page-back {
  color: var(--canvas-text-muted);
}
body.ct-shell-active .ct-page-back:hover {
  color: var(--canvas-text);
}
body.ct-shell-active .ct-filters label {
  color: var(--canvas-text-muted);
}

/* Buttons — the eudr-x template, verbatim behavior (style.css .btn-primary /
   .btn-secondary / .btn-danger-outline): solid fills, 6px radius, 0.18s ease,
   a -1px hover LIFT on the primary action, and destructive actions as a
   quiet outline that only turns red on hover ("don't steal attention from
   the primary palette but still signal intent"). Nunito flows from --font-body. */
.ct-btn-primary,
.ct-btn-secondary,
.ct-btn-danger,
.ct-btn-ghost,
.ct-questionnaire-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-size: var(--text-base);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.ct-btn-primary:active,
.ct-btn-secondary:active,
.ct-btn-danger:active {
  transform: translateY(1px);
}

.ct-btn-primary,
.ct-questionnaire-submit {
  background-color: var(--action);
  background-image: linear-gradient(180deg, rgb(255 255 255 / 0.12), rgb(255 255 255 / 0) 60%);
  color: var(--action-ink);
  box-shadow: var(--action-glow);
}
.ct-btn-primary:hover:not(:disabled),
.ct-questionnaire-submit:hover:not(:disabled) {
  background-color: var(--action-hover);
  transform: translateY(-1px);
}

/* Secondary: a glass button (EUDR phone secondary) that warms to a cyan wash. */
.ct-btn-secondary {
  background-color: var(--action-2);
  border-color: var(--action-2-edge);
  color: var(--action-2-ink);
}
.ct-btn-secondary:hover:not(:disabled) {
  background-color: var(--action-2-hover);
  border-color: var(--accent);
}

/* A Delete (and every destructive action) is red-edged at rest and fills red
   on hover (EUDR style.css:6375-6392, the owner 2026-11-06). The fill is the
   hazard red in both themes: white on #b0443a is 5.6:1. */
.ct-btn-danger {
  background: transparent;
  border: 1.5px solid var(--confirmed);
  color: var(--confirmed);
  font-weight: 700;
}
.ct-btn-danger:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: #b0443a;
  background: #b0443a;
  color: #ffffff;
}
body.dark-mode .ct-btn-danger:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: #c4473c;
  background: #b0443a;
  color: #ffffff;
}

/* Every Cancel turns red on hover (EUDR style.css:6375 .gt-cancel): a
   quiet button that says "this is the way out" before it is clicked. */
.ct-cancel:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: var(--confirmed);
  background: var(--danger-hover-bg);
  color: var(--confirmed);
}

.ct-btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 7px 10px;
}
.ct-btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

/* A control that cannot be used says so, everywhere (EUDR style.css:
   6596-6614, sidebar.css:197-202): the "blocked" cursor, never the hand;
   dimmed; no shadow and no hover lift. aria-disabled looks the same but
   stays focusable, so Tab reaches it and a screen reader says "dimmed"
   (the button says why in its title and in the text beside it). A busy
   button (feedback.js busy) keeps its own look. */
button:disabled,
input[type="submit"]:disabled,
input[type="button"]:disabled,
:is(button, a, summary, [role="button"], [role="menuitem"], [role="radio"], [role="tab"])[aria-disabled="true"] {
  cursor: not-allowed;
}
:is(.ct-btn-primary, .ct-btn-secondary, .ct-btn-danger, .ct-btn-ghost, .ct-questionnaire-submit, .ct-icon-btn, .ct-filter-clear):is(:disabled, [aria-disabled="true"]):not(.is-busy) {
  opacity: 0.55;
  box-shadow: none;
  transform: none;
}
:is(.ct-btn-primary, .ct-btn-secondary, .ct-btn-danger, .ct-btn-ghost, .ct-questionnaire-submit):is(:disabled, [aria-disabled="true"]):hover {
  transform: none;
  box-shadow: none;
}
/* aria-disabled leaves the hover rules matching: put the resting look back */
.ct-btn-primary[aria-disabled="true"]:hover,
.ct-questionnaire-submit[aria-disabled="true"]:hover {
  background-color: var(--action);
}
.ct-btn-secondary[aria-disabled="true"]:hover {
  background-color: var(--action-2);
  border-color: var(--action-2-edge);
}
.ct-btn-primary.is-busy,
.ct-btn-secondary.is-busy,
.ct-btn-danger.is-busy,
.ct-questionnaire-submit.is-busy {
  opacity: 0.85;
  box-shadow: none;
  transform: none;
}

/* ── Action rows (EUDR style.css:6367-6374, 5706-5721) ──
   .ct-actions: a Back (.ct-back) at the inline start, the actions at the end
   at their own width. On a phone the row stacks, the primary (the last
   child) on top. */
.ct-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-2);
}
.ct-actions > * {
  flex: 0 0 auto;
  width: auto;
  margin: 0;
}
.ct-actions > .ct-back,
.ct-record-foot > .ct-back {
  margin-inline-end: auto;
}
@media (max-width: 600px) {
  .ct-actions,
  .ct-record-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .ct-actions > *,
  .ct-record-actions > * {
    width: 100%;
  }
}

/* ── A row with one main action and secondary buttons (EUDR style.css:
   1540-1583 .gt-row) ──
   The row is not a control (a role="button" row holding buttons is nested
   interactive content). Its main action is a real <button class=
   "ct-row-main"> or link whose ::after covers the whole row, so a click
   anywhere on the row runs it; the secondary buttons sit in .ct-row-aside,
   above that overlay, as separate controls. The aside lets clicks through
   its gaps (a date or a pill in it still opens the row). */
.ct-row {
  position: relative;
}
.ct-row-main {
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  text-decoration: none;
  cursor: pointer;
}
.ct-row-main::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.ct-row-main:focus-visible {
  outline: none;
}
.ct-row-main:focus-visible::after {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.ct-row-aside {
  position: relative;
  z-index: 1;
  pointer-events: none;
}
.ct-row-aside :is(a, button, input, label, select, textarea, summary) {
  pointer-events: auto;
}

/* Form controls */
.ct-question input,
.ct-question select,
.ct-form input,
.ct-form select,
.ct-filters select,
.ct-extraction-actions-row input,
.ct-drawer-actions input,
.ct-drawer-actions textarea,
.ct-components-field input,
.ct-completeness-form input,
.ct-tenant-switcher-form input,
.ct-tenant-switcher-form select {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-base);
}
.ct-question input:focus,
.ct-question select:focus,
.ct-form input:focus,
.ct-completeness-form input:focus,
.ct-filters select:focus {
  border-color: var(--focus);
  outline: none;
  box-shadow: var(--focus-ring);
}

.ct-label,
.ct-question-label {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--text);
}

/* ═══════════════════════════ Stat cards ═══════════════════════════ */

.ct-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.ct-stat {
  position: relative;
  padding: var(--space-4);
  background: var(--glass-lit), var(--glass);
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  overflow: hidden;
}
/* Status dot in the corner, as on the ops stat cards. */
.ct-stat::before {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neutral-status);
}
.ct-stat-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ct-stat-label {
  margin-top: 6px;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-muted);
}
.ct-stat.verdict-confirmed::before { background: var(--confirmed); }
.ct-stat.verdict-potential::before { background: var(--potential); }
.ct-stat.verdict-indeterminate::before { background: var(--indeterminate); }
.ct-stat.verdict-clear::before { background: var(--clear); }
.ct-stat.verdict-confirmed .ct-stat-value { color: var(--confirmed); }
.ct-stat.verdict-potential .ct-stat-value { color: var(--potential); }
.ct-stat.verdict-indeterminate .ct-stat-value { color: var(--indeterminate); }
.ct-stat.verdict-clear .ct-stat-value { color: var(--clear); }

/* ═══════════════════════════ Get-started guide ═══════════════════════════ */

.ct-getstarted {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: var(--space-6);
  background: var(--glass-lit), var(--glass);
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
  padding: var(--space-6);
  max-width: 980px;
}
.ct-getstarted h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xl);
}
.ct-getstarted p {
  margin: 0 0 var(--space-5);
  color: var(--text-muted);
  max-width: 52ch;
}
.ct-getstarted-aside {
  align-self: start;
  padding: var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ct-aside-title {
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: var(--space-3);
}
.ct-aside-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.ct-aside-list li {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.ct-aside-list code {
  flex: 0 0 46px;
  font-weight: 700;
  color: var(--confirmed);
}
.ct-aside-list span {
  color: var(--text-muted);
}
@media (max-width: 760px) {
  .ct-getstarted {
    grid-template-columns: 1fr;
  }
}
.ct-steps {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.ct-step {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
/* Scoped to .ct-steps so this 30px get-started badge doesn't leak its
   `flex: 0 0 30px` onto the Path B wizard's own `.ct-step-num` (engage.css),
   which would override its 22px width and render an oval. */
.ct-steps .ct-step-num {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
  font-size: var(--text-sm);
}
.ct-step-text {
  font-weight: 600;
}
.ct-step-text small {
  display: block;
  font-weight: 500;
  color: var(--text-muted);
}

/* Generic empty state (tables, lists) */
.ct-empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--text-muted);
}

/* ═══════════════════════════ Toolbar / filters ═══════════════════════════ */

/* A row of labelled filters (the client dashboard's compliance table). */
.ct-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3) var(--space-4);
  margin-bottom: var(--space-4);
}
.ct-question {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ct-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-6);
  padding: var(--space-4);
  background: var(--glass-lit), var(--glass);
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}
.ct-checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ct-checkbox-field label {
  font-weight: 600;
  font-size: var(--text-sm);
}

/* The list toolbar — EUDR's filter row (AdminFilterRow): one framed line of
   the search, the dropdowns ("All clients", "All types"…) and the count on
   the right. render.js toolbar() builds it. */
.ct-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-4);
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--page-panel);
}
.ct-toolbar-search {
  position: relative;
  display: flex;
  flex: 2 1 240px;
  align-items: center;
  min-width: 180px;
}
.ct-toolbar-search svg {
  position: absolute;
  left: 11px;
  color: var(--text-subtle);
  pointer-events: none;
}
.ct-toolbar-search-input,
.ct-toolbar-select {
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--field-soft);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
}
.ct-toolbar-search-input {
  width: 100%;
  padding: 0 12px 0 34px;
}
.ct-toolbar-search-input::placeholder {
  color: var(--text-subtle);
}
.ct-toolbar-select {
  flex: 1 1 150px;
  min-width: 130px;
  max-width: 230px;
  padding: 0 10px;
  font-weight: 600;
  cursor: pointer;
}
.ct-toolbar-search-input:focus,
.ct-toolbar-select:focus {
  border-color: var(--focus);
  outline: none;
  box-shadow: var(--focus-ring);
}
.ct-toolbar-select:hover {
  border-color: var(--accent);
}
.ct-toolbar-count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Row actions: EUDR's square icon keys (eye, copy, delete). */
.ct-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--page-panel);
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.ct-icon-btn:hover {
  border-color: var(--accent);
  background: var(--primary-soft);
  color: var(--primary);
}
.ct-icon-btn--danger {
  color: var(--confirmed);
  border-color: var(--confirmed-edge);
}
.ct-icon-btn--danger:hover {
  border-color: var(--confirmed);
  background: var(--danger-hover-bg);
  color: var(--confirmed);
}
.ct-row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

/* ═══════════════════════════ Table ═══════════════════════════ */

/* EUDR's admin table (.operator-table): a solid head band in plain bold
   words (sentence case reads better than spaced capitals, in Greek above
   all), roomy rows, a soft hover. Phones restack every row as a card
   (mobile.css §2.3). */
.ct-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.9rem;
}
.ct-table th,
.ct-table td {
  padding: 11px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.ct-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-head);
  border-bottom-color: var(--table-head-edge);
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--table-head-ink);
  white-space: nowrap;
}
.ct-table tbody tr:last-child td {
  border-bottom: none;
}
.ct-table tbody tr {
  transition: background 0.1s ease;
}
.ct-table tbody tr:hover {
  background: var(--primary-soft);
}
.ct-table-empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--text-muted);
}
/* A cell's second line (EUDR .admin-cell-sub): the e-mail under a name. */
.ct-cell-sub {
  display: block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.ct-cell-strong {
  font-weight: 700;
}
.ct-num {
  font-variant-numeric: tabular-nums;
}
/* Verdict rail on rows (Dashboard passes rowClassName). */
.ct-table tbody tr.verdict-confirmed td:first-child { box-shadow: inset 3px 0 0 var(--confirmed); }
.ct-table tbody tr.verdict-potential td:first-child { box-shadow: inset 3px 0 0 var(--potential); }
.ct-table tbody tr.verdict-indeterminate td:first-child { box-shadow: inset 3px 0 0 var(--indeterminate); }
.ct-table tbody tr.verdict-clear td:first-child { box-shadow: inset 3px 0 0 var(--clear); }

/* Wrap tables that can overflow horizontally */
.ct-table-scroll {
  overflow-x: auto;
}

/* ═══════════════════════════ StatusBadge ═══════════════════════════ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  background: var(--neutral-tint);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.status-confirmed {
  background: var(--confirmed-tint);
  color: var(--confirmed);
  border-color: var(--confirmed-edge);
}
.status-potential,
.status-open,
.status-in_review {
  background: var(--potential-tint);
  color: var(--potential);
  border-color: var(--potential-edge);
}
.status-clear,
.status-validated,
.status-signed_off,
.status-exported {
  background: var(--clear-tint);
  color: var(--clear);
  border-color: var(--clear-edge);
}
.status-indeterminate,
.status-draft,
.status-unknown {
  background: var(--indeterminate-tint);
  color: var(--indeterminate);
  border-color: var(--indeterminate-edge);
}
.status-dismissed {
  background: var(--neutral-tint);
  color: var(--text-subtle);
}

/* Extraction review state chips reuse the same visual grammar. */
.ct-review-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
  border: 1px solid var(--border);
}
.ct-review-state::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.ct-review-state-auto { background: var(--neutral-tint); color: var(--text-muted); }
.ct-review-state-pending_review { background: var(--potential-tint); color: var(--potential); border-color: var(--potential-edge); }
.ct-review-state-approved { background: var(--clear-tint); color: var(--clear); border-color: var(--clear-edge); }
.ct-review-state-rejected { background: var(--confirmed-tint); color: var(--confirmed); border-color: var(--confirmed-edge); }
/* Reference rows carry no decision — deliberately the quietest chip on screen
   so a reviewer's eye skips them and lands on what still needs answering. */
.ct-review-state-reference { background: var(--surface-2); color: var(--text-subtle); border-color: var(--border); }
.ct-review-state-reference::before { display: none; }

/* ═══════════════════════════ ConfidenceBar ═══════════════════════════ */

.ct-confidence {
  position: relative;
  display: inline-block;
  width: 100%;
  min-width: 90px;
  height: 8px;
  border-radius: 4px;
  background: var(--surface-3);
  overflow: hidden;
  vertical-align: middle;
}
.ct-confidence-fill {
  height: 100%;
  background: var(--clear);
  border-radius: 4px;
}
.ct-confidence[data-level="med"] .ct-confidence-fill { background: var(--potential); }
.ct-confidence[data-level="low"] .ct-confidence-fill { background: var(--confirmed); }

/* ═══════════════════════════ FileDrop ═══════════════════════════ */

.ct-filedrop-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.ct-filedrop {
  /* Contains the visually-hidden file input: without it the 1px input is
     placed against the page and stretches the document below the scrolling
     .ct-main, giving phones a second, empty scroll. */
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-7) var(--space-5);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.ct-filedrop:hover {
  border-color: var(--accent);
  background: var(--surface-2);
}
.ct-filedrop.dragover {
  border-color: var(--primary);
  border-style: solid;
  background: var(--primary-soft);
  color: var(--primary);
}
.ct-filedrop-icon {
  width: 38px;
  height: 38px;
  color: var(--accent);
}
.ct-filedrop-primary {
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text);
}
.ct-filedrop-hint {
  font-size: var(--text-sm);
  color: var(--text-subtle);
}
.ct-filedrop-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.ct-filedrop-error {
  margin: 0;
  color: var(--confirmed);
  font-size: var(--text-sm);
  font-weight: 600;
}
.ct-filedrop-error[hidden] {
  display: none;
}
/* The input is visually hidden: the zone shows its focus. */
.ct-filedrop:focus-within {
  border-color: var(--focus);
  box-shadow: var(--focus-ring);
}
/* A touch screen has nothing to drag from: "Tap to choose a file". */
.ct-filedrop-primary--coarse {
  display: none;
}
@media (pointer: coarse) {
  .ct-filedrop-primary--fine {
    display: none;
  }
  .ct-filedrop-primary--coarse {
    display: inline;
  }
}
/* While a file is dragged over (a drag counter in filedrop.js, so the
   zone's own text never flickers it): "Drop the file here" over the zone. */
.ct-filedrop-overlay {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: inherit;
  background: color-mix(in srgb, var(--primary-soft) 92%, transparent);
  color: var(--primary);
  font-weight: 800;
  pointer-events: none;
}
.ct-filedrop.dragover .ct-filedrop-overlay {
  display: flex;
}
/* Any element can take the drop too (fileDrop target): a whole form step. */
.ct-filedrop-target {
  position: relative;
}
.ct-filedrop-target.is-dragging {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
}
/* Uploading: disabled, the file's name and "Uploading…". */
.ct-filedrop.is-busy {
  border-style: solid;
  cursor: progress;
}
.ct-filedrop.is-busy > :is(.ct-filedrop-primary, .ct-filedrop-hint) {
  display: none;
}
.ct-filedrop-busy {
  max-width: 100%;
  color: var(--text);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.ct-filedrop-busy[hidden] {
  display: none;
}
.ct-filedrop-note {
  margin: 0;
}

/* ═══════════════════════════ Toast ═══════════════════════════ */

.ct-toast-viewport {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 340px;
  max-width: calc(100vw - 40px);
  z-index: 1000;
}
.ct-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--on-status);
  background: var(--brand-storm);
  box-shadow: var(--shadow-lg);
}
.ct-toast span {
  flex: 1 1 auto;
}
.ct-toast-error { background: var(--confirmed); }
.ct-toast-success { background: var(--clear); }
.ct-toast-info { background: var(--storm-88); }
.ct-toast-reqid {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  opacity: 0.85;
}
.ct-toast-close {
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
}

/* ═══════════════════════════ Questionnaire ═══════════════════════════ */

.ct-questionnaire,
.ct-pathb-questionnaire {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 660px;
}
.ct-question-error {
  margin: 0;
  color: var(--confirmed);
  font-size: var(--text-sm);
  font-weight: 600;
}

/* ═══════════════════════════ SDS upload / result ═══════════════════════════ */

.ct-sds-upload {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
/* The dropzone stays a comfortable width even though the document list below
   it spans the full content column. */
.ct-sds-upload > .ct-filedrop-wrap {
  max-width: 680px;
}
.ct-sds-result {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid var(--clear-edge);
  border-radius: var(--radius);
  background: var(--clear-tint);
}
.ct-sds-result p {
  margin: 0;
  font-weight: 600;
}

/* ═══════════════════════════ Extraction review ═══════════════════════════ */

.ct-extraction-review {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.ct-extraction-failed,
.ct-extraction-error {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  font-weight: 700;
}
.ct-extraction-failed {
  background: var(--potential-tint);
  color: var(--potential);
  border: 1px solid var(--potential-edge);
}
.ct-extraction-error {
  background: var(--confirmed-tint);
  color: var(--confirmed);
  border: 1px solid var(--confirmed-edge);
}
.ct-extraction-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 230px;
}
.ct-extraction-actions-row {
  display: flex;
  gap: 6px;
}
.ct-extraction-actions-row input {
  flex: 1 1 auto;
  min-width: 0;
}
/* Table cells stay one scannable line; the whole value lives in the drawer.
   A raw section-15 capture is 2000 characters and used to stretch its row to
   ~600px, which broke the table as a scan surface. */
.ct-cell-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 46ch;
}
.ct-row-pending td:first-child {
  box-shadow: inset 3px 0 0 var(--potential);
}
.ct-btn-sm {
  padding: 4px 10px;
  font-size: var(--text-xs);
}

/* ═══════════════════════════ Drawer ═══════════════════════════ */

.ct-drawer-wrap {
  position: fixed;
  inset: 0;
  z-index: 4000;
}
.ct-drawer-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
/* Solid sheet (never glass): the drawer is read in long stretches, and its
   scrim is a sibling, so the scrim's blur never traps anything inside it. */
.ct-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--glass-strong);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 40px rgb(var(--storm-rgb) / 0.18);
  outline: none;
}
body.dark-mode .ct-drawer {
  /* A storm-tinted shadow disappears into the dark ground. */
  box-shadow: -18px 0 40px rgb(0 0 0 / 0.45);
}
.ct-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-5);
  border-bottom: 1px solid var(--border);
}
.ct-drawer-title {
  margin: 0;
  font-size: var(--text-md);
  line-height: 1.35;
  color: var(--text);
}
.ct-drawer-subtitle {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.ct-drawer-close {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 4px 9px;
  cursor: pointer;
}
.ct-drawer-close:hover {
  background: var(--surface-3);
  color: var(--text);
}
.ct-drawer-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  overflow-y: auto;
}
.ct-drawer-ask {
  padding: var(--space-3) var(--space-4);
  border: 1px solid color-mix(in srgb, var(--primary) 28%, transparent);
  border-radius: var(--radius);
  background: var(--primary-soft);
  color: var(--text);
  font-weight: 700;
}
.ct-drawer-state {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.ct-drawer-meta {
  flex-wrap: wrap;
}
.ct-drawer-section {
  margin: 0 0 var(--space-2);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
}
.ct-evidence-quote {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  max-height: 340px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
  white-space: pre-wrap;
}
.ct-evidence-quote mark {
  background: var(--potential-tint);
  color: var(--potential);
  font-weight: 700;
  border-radius: 3px;
  padding: 0 2px;
}
.ct-drawer-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.ct-drawer-actions-row {
  display: flex;
  gap: 6px;
}
.ct-drawer-actions-row button {
  flex: 1 1 0;
}
.ct-drawer-label {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-muted);
}
.ct-drawer-textarea {
  width: 100%;
  resize: vertical;
  font-family: inherit;
}
body.ct-drawer-open {
  overflow: hidden;
}

/* ═══════════════════════════ Products / detail ═══════════════════════════ */

.ct-product-meta {
  display: flex;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.ct-evidence {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

/* ═══════════════════════════ Campaigns ═══════════════════════════ */

.ct-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.ct-campaign-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: var(--space-4) 0 var(--space-6);
  padding: var(--space-4);
  background: var(--glass-lit), var(--glass);
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}
.ct-campaign-links-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.ct-campaign-link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}
.ct-campaign-link-supplier {
  font-weight: 700;
  min-width: 140px;
}
.ct-campaign-link-url {
  flex: 1 1 auto;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  word-break: break-all;
}

/* ═══════════════════════════ Path B wizard ═══════════════════════════ */

.ct-pathb-process-context {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
}
.ct-pathb-summary,
.ct-pathb-match {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}
.ct-pathb-summary {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: var(--glass-lit), var(--glass);
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}

/* ═══════════════════════════ Submissions ═══════════════════════════ */

.ct-legal-caveat {
  padding: var(--space-4) var(--space-5);
  margin: var(--space-3) 0;
  border-radius: var(--radius);
  background: var(--potential-tint);
  color: var(--potential);
  border: 1px solid var(--potential-edge);
  font-weight: 600;
}
.ct-submission-actions {
  display: flex;
  flex-wrap: wrap; /* XLSX + JSON export + hint no longer fit one phone row */
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-4) 0;
}

/* ═══════════════════════════ Admin (Green Trust) ═══════════════════════════ */

/* The client picker in the head of an admin screen that is one client's
   (core/ops.js): labelled, and amber until a client is chosen. */
.ct-client-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  width: 100%;
  margin: 0;
}
.ct-client-picker-label {
  font-weight: 800;
}
.ct-client-picker .ct-toolbar-select {
  flex: 0 1 300px;
  max-width: 340px;
  background: var(--page-panel);
}
.ct-client-picker .ct-btn-primary {
  height: 36px;
  padding: 0 14px;
  font-size: var(--text-sm);
}
.ct-client-picker-hint {
  flex: 1 1 16rem;
  color: var(--text);
}
.ct-page-context:has(.ct-client-picker--required) {
  background: var(--potential-tint);
  box-shadow: inset 0 0 0 1px var(--potential-edge);
}
.ct-client-context {
  margin: 0;
}

/* A count that filters a list (the home's clients → their decisions). */
.ct-count-link {
  min-width: 34px;
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  background: var(--page-panel);
  color: var(--link);
  font: inherit;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.ct-count-link:hover {
  border-color: var(--accent);
  background: var(--primary-soft);
  color: var(--primary);
}
.ct-waiting {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.ct-complete-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-3);
}
.ct-complete-form textarea {
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-base);
  resize: vertical;
}
.ct-complete-form textarea:focus {
  border-color: var(--focus);
  outline: none;
  box-shadow: var(--focus-ring);
}
.ct-complete-form .ct-btn-primary {
  align-self: flex-start;
}
/* A list's one-line summary under its toolbar (readiness, clients). */
.ct-list-summary {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
}

/* The occupational physician's company switcher (core/doctor.js). */
.ct-tenant-switcher {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.ct-tenant-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 11px 16px;
  border-radius: var(--radius);
  background: var(--clear-tint);
  color: var(--clear);
  border: 1px solid var(--clear-edge);
  font-weight: 700;
}
.ct-tenant-banner-empty {
  background: var(--potential-tint);
  color: var(--potential);
  border-color: var(--potential-edge);
}
.ct-tenant-switcher-form {
  display: flex;
  gap: var(--space-2);
  margin: 0;
}
/* Phones: the switcher is pinned above the page's scroller, so every pixel it
   takes is lost to the page. One compact banner line + the client select; the
   "act as" button only shows once a different client is picked. */
@media (max-width: 600px) {
  .ct-tenant-switcher {
    gap: 6px;
    margin-bottom: var(--space-3);
  }
  .ct-tenant-banner {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 8px 12px;
    font-size: var(--text-sm);
  }
  .ct-tenant-banner > span {
    flex: 1 1 10rem;
    min-width: 0;
  }
  .ct-tenant-banner .ct-btn-secondary {
    padding: 5px 10px;
    font-size: var(--text-xs);
    white-space: normal;
  }
  .ct-tenant-switcher-form {
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
  }
  .ct-tenant-switcher-form .ct-question {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
  }
  .ct-tenant-switcher-form .ct-question label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }
  .ct-tenant-switcher-form select {
    width: 100%;
  }
  .ct-tenant-switcher-form .ct-btn-primary {
    flex: 0 1 auto;
    max-width: 45%;
    white-space: normal;
  }
  .ct-tenant-switcher-form .ct-btn-primary:disabled {
    display: none;
  }
}
.ct-validation-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-3);
  max-width: 440px;
}
.ct-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ct-evidence-list .ct-evidence {
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ═══════════════════════════ Supplier portal ═══════════════════════════ */

.ct-portal-invalid,
.ct-portal-confirmation {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 640px;
  padding: var(--space-6);
  background: var(--glass-lit), var(--glass);
  border: 1px solid transparent;
  border-radius: var(--radius-glass);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), inset 0 1px 0 var(--glass-edge), var(--glass-shadow);
}
.ct-portal-landing {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 720px;
}
.ct-portal-context {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ct-portal-attachments {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.ct-portal-attachments-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ct-portal-attachments-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

/* ═══════════════════════════ CMR components widget ═══════════════════════════ */

.ct-components-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.ct-components-field input {
  width: 100%;
}

/* ── Confirmation dialog (core/render.js confirmDialog) ──
   A centred dialog on desktop, a bottom sheet on a phone (EUDR Modal.js /
   PhSheet). Solid, never glass: it asks a question that must be read. Sits
   above drawers (4000) and the phone tab bar. */
.ct-confirm-wrap {
  position: fixed;
  inset: 0;
  z-index: 4100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}
.ct-confirm-scrim {
  position: absolute;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.ct-confirm {
  position: relative;
  width: min(440px, 100%);
  padding: var(--space-5);
  border-radius: var(--radius-glass);
  background: var(--glass-strong);
  color: var(--text);
  box-shadow: inset 0 0 0 0.5px var(--glass-edge), var(--shadow-lg);
  animation: ct-confirm-in 0.18s ease-out;
}
.ct-confirm-handle {
  display: none;
}
.ct-confirm-title {
  margin: 0 0 var(--space-2);
  font-size: var(--text-lg);
  font-weight: 800;
}
.ct-confirm-body {
  margin: 0 0 var(--space-5);
  color: var(--text-muted);
}
.ct-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}
/* The confirm button of a destructive question is a solid red, not the quiet
   outline the in-page Remove buttons use: here the user has already chosen. */
.ct-confirm .ct-confirm-danger,
.ct-confirm .ct-confirm-danger:hover:not(:disabled) {
  background: #b0443a;
  border-color: #b0443a;
  color: #ffffff;
}
.ct-confirm .ct-confirm-danger:hover:not(:disabled) {
  background: #963a31;
  border-color: #963a31;
}
@keyframes ct-confirm-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.ct-confirm:focus {
  outline: none;
}
.ct-confirm-body {
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.ct-confirm-actions > button {
  min-width: 96px;
}
/* The fields of a confirmation (feedback.js confirmAction): tick-boxes, the
   text to type, a required reason with its counter; under them, what still
   stops the button (EUDR DDSPanel.js:51-92, DdsRetention.js:190-227). */
.ct-confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  line-height: 1.45;
  cursor: pointer;
}
.ct-confirm-check input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--action);
}
.ct-confirm-check small {
  display: block;
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.ct-confirm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 var(--space-3);
}
.ct-confirm-field > label {
  font-size: var(--text-sm);
  font-weight: 700;
}
.ct-confirm-typed {
  padding: 0 4px;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-weight: 700;
  white-space: pre-wrap;
}
.ct-confirm-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: var(--text-base);
}
textarea.ct-confirm-input {
  min-height: 84px;
  resize: vertical;
}
.ct-confirm-input:focus {
  border-color: var(--focus);
  outline: none;
  box-shadow: var(--focus-ring);
}
.ct-confirm-field-foot {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-xs);
}
.ct-confirm-counter {
  font-variant-numeric: tabular-nums;
}
.ct-confirm-left {
  margin: 0 0 var(--space-3);
  color: var(--text-muted);
  font-size: var(--text-sm);
  text-align: end;
}
.ct-confirm-left[hidden] {
  display: none;
}
/* A disabled confirm stays red-or-green but dimmed (ui.css button rules);
   the solid red never turns darker while it cannot be pressed. */
.ct-confirm .ct-confirm-danger[aria-disabled="true"]:hover {
  background: #b0443a;
  border-color: #b0443a;
}

/* The phone's look (feedback.js, when core/sheet.js is not there, and every
   outcome message on a phone): the title and Done ("Cancel") in the head,
   the sentence, one button at full width. */
.ct-confirm-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin: 0 0 var(--space-2);
  padding: 0 72px;
}
.ct-confirm--sheet .ct-confirm-title {
  margin: 0;
  font-size: 1.0625rem;
  text-align: center;
}
.ct-confirm-done {
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--link);
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.ct-confirm--sheet .ct-confirm-body {
  text-align: center;
}
.ct-confirm--sheet .ct-confirm-actions > button {
  width: 100%;
  min-height: 50px;
  white-space: normal;
}
/* Inside core/sheet.js's sheet (the phone's confirmation). */
.ct-confirm-sheet {
  padding: 4px 16px 8px;
}
.ct-confirm-sheet .ct-confirm-body {
  margin: 0 8px var(--space-4);
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}
.ct-confirm-sheet .ct-confirm-actions {
  display: flex;
  margin-top: var(--space-2);
}
.ct-confirm-sheet .ct-confirm-actions > button {
  flex: 1 1 auto;
  width: 100%;
  min-height: 50px;
  white-space: normal;
}
.ct-confirm-sheet .ct-confirm-input {
  font-size: 17px;
}
.ct-confirm-sheet .ct-confirm-left {
  text-align: center;
}

@media (max-width: 600px) {
  .ct-confirm-wrap {
    align-items: flex-end;
    padding: 0;
  }
  .ct-confirm {
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding: var(--space-3) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
    animation-name: ct-confirm-sheet-in;
  }
  .ct-confirm-handle {
    display: block;
    width: 36px;
    height: 5px;
    margin: 0 auto var(--space-3);
    border-radius: 3px;
    background: var(--border-strong);
  }
  .ct-confirm-actions {
    flex-direction: column-reverse;
  }
  .ct-confirm-actions > button {
    width: 100%;
    min-height: 48px;
  }
  .ct-confirm--sheet .ct-confirm-handle {
    display: none;
  }
  .ct-confirm--sheet {
    padding-top: var(--space-2);
  }
  .ct-confirm-input {
    font-size: 16px;
  }
  @keyframes ct-confirm-sheet-in {
    from { transform: translateY(100%); }
    to { transform: none; }
  }
}
