/* ============================================================
   Components — primitives. Every class = one reusable pattern.
   ============================================================ */

/* ---------- Button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 10px 18px;
  font-size: var(--fs-14);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.005em;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  transition: all var(--t-fast) var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled,
.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--gold);
  color: #0A0A0C;
  border-color: var(--gold);
}
.btn-primary:hover:not(:disabled) {
  background: var(--gold-hover);
  border-color: var(--gold-hover);
  transform: translateY(-1px);
  box-shadow: var(--gold-glow);
}
.btn-primary:active:not(:disabled) {
  background: var(--gold-deep);
  transform: scale(0.98);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--gold-tint-04);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover:not(:disabled) {
  color: var(--gold);
  background: var(--gold-tint-04);
}

.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: var(--border);
}
.btn-danger:hover:not(:disabled) {
  background: var(--error-tint);
  border-color: var(--error);
}

/* Toggled-on state for the Skip button on optional fields. Read by
 * field-card.js's _wireOptionalHandlers — adding the class signals
 * "field is currently skipped, click to undo." Uses theme tokens so it
 * renders correctly in both dark and light. */
.btn-skipped {
  background: var(--surface-2);
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-skipped:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--gold);
  background: var(--gold-tint-04);
}

.btn-sm { padding: 6px 12px; font-size: var(--fs-13); border-radius: var(--r-sm); }
.btn-lg { padding: 14px 24px; font-size: var(--fs-15); border-radius: var(--r-lg); }
.btn-block { width: 100%; }

.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  border-radius: var(--r-md);
  color: var(--text-muted);
}
.btn-icon:hover:not(:disabled) {
  color: var(--gold);
  background: var(--gold-tint-08);
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: border-color var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              transform var(--t-fast) var(--ease);
}
.card-pad { padding: var(--s-5); }
.card-pad-lg { padding: var(--s-6); }
.card-hover { cursor: pointer; }
.card-hover:hover {
  border-color: var(--gold-tint-40);
  background: var(--bg-raised);
}
.card-hover:active { transform: scale(0.995); }
.card-selected {
  border-color: var(--gold);
  background: var(--gold-tint-04);
  box-shadow: var(--gold-glow);
}

/* ============================================================
   TODO · Paper treatment experiment (reverted 2026-04-20)
   ------------------------------------------------------------
   Cards styled as cream paper sheets regardless of outer theme.
   - Scoped variable overrides make nested elements cream-compatible
   - Pseudo-element hosts visible surface (fiber + cream bg)
   - SVG displacement filter gives deckled paper edges
   - --paper-warmth variable tunes gold overlay on selected/hover
   Assets: assets/paper-fiber.svg, assets/paper-grain.svg
   To re-enable: uncomment the block below and also the matching
   .field-card block in review.html.
   ============================================================ */
/*
.card,
.field-card {
  --bg:             #EDF2FA;
  --bg-raised:      #F5F8FC;
  --surface:        #FAF7EC;
  --surface-2:      #F4F0DE;
  --surface-3:      #EDE7CD;
  --border:         #E2DBC2;
  --border-strong:  #CFC5A4;
  --border-subtle:  #EDE7D2;
  --text:           #1A1F2E;
  --text-strong:    #0A0F1C;
  --text-muted:     #5A6478;
  --text-subtle:    #8A93A7;
  --text-faint:     #B4BBCC;
  color: var(--text);
}
.card {
  position: relative;
  isolation: isolate;
  transition: transform var(--t-fast) var(--ease);
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--surface);
  background-image:
    linear-gradient(var(--paper-warmth, transparent), var(--paper-warmth, transparent)),
    url("../assets/paper-fiber.svg");
  background-size: auto, 400px 400px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  filter: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg'><filter id='d'><feTurbulence type='fractalNoise' baseFrequency='0.012' numOctaves='3' seed='7'/><feDisplacementMap in='SourceGraphic' scale='5'/></filter></svg>#d");
  transition: border-color var(--t-fast) var(--ease),
              background-color var(--t-fast) var(--ease);
}
.card-hover:hover::before {
  border-color: var(--gold);
  --paper-warmth: rgba(212, 167, 44, 0.06);
}
.card-selected::before {
  --paper-warmth: rgba(212, 167, 44, 0.15);
  border-color: var(--gold);
  box-shadow: var(--gold-glow);
}
.card-paper-fold::after {
  content: "";
  position: absolute;
  top: 50%;
  left: var(--s-5);
  right: var(--s-5);
  height: 1px;
  background: linear-gradient(to right, transparent, var(--border-strong), transparent);
  opacity: 0.4;
  pointer-events: none;
}
*/

/* ---------- Input ---------- */
.input,
.select,
.textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: var(--fs-14);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  outline: none;
  transition: all var(--t-fast) var(--ease);
}
.input:hover,
.select:hover,
.textarea:hover { border-color: var(--border-strong); }
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--gold);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--gold-tint-15);
}
.input-error { border-color: var(--error); }
.input-error:focus { box-shadow: 0 0 0 3px var(--error-tint); }

/* Inside a field card the ORBIT (focus-within, below) is the ONE focus
   signal. The global gold input glow made focus look widget-dependent —
   text inputs glowed (a second, subtler indicator under the orbit) while
   radio options didn't. Quiet border shift keeps the text-entry affordance;
   no glow. Error inputs keep their red ring. Inputs outside cards keep the
   global gold focus. */
.field-card .input:focus:not(.input-error),
.field-card .select:focus,
.field-card .textarea:focus {
  border-color: var(--border-strong);
  box-shadow: none;
}

/* ---- "You are here" focus treatment (review field cards) ----
   The card being edited gets a slow gold light orbiting its border. Same
   brand hue as the needs-review state, but a different DIMENSION — motion +
   full-perimeter form — so it can't be confused with the static gold LEFT
   rule that means "AI suggestion awaiting review". Nothing else in the UI
   animates persistently, so motion uniquely reads "editing here".
   Implementation: a rotating conic gradient on ::after, masked to a 2px
   band around the card (content-box XOR full-box). @property lets the
   angle interpolate; without support the beam renders as a static arc. */
@property --focus-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
.field-card:focus-within {
  /* The full focused-card treatment, CSS-only so EVERY surface gets it
     with zero wiring: gold border + glow (was web-only — its transcript
     sidebar JS added .field-card-focused on focusin; MCP only flashed it
     on sidebar jumps and ES never had it — same class, different
     triggers). :focus-within needs no listener, so the trigger cannot
     fork per surface. The .field-card-focused class remains for the
     sidebar jump-to-card pairing (highlighting a card you did NOT focus). */
  position: relative;
  border-color: var(--gold);
  box-shadow: var(--gold-glow);
}
.field-card:focus-within::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  padding: 3px;
  /* Long soft comet tail — covers ~half the perimeter at a LOWER peak
     (no gold-soft hot spot), so the orbit is easier to notice without
     any increase in contrast. Visibility via coverage, not intensity. */
  background: conic-gradient(
    from var(--focus-angle, 0deg),
    transparent 0%,
    transparent 45%,
    var(--gold-tint-08) 58%,
    var(--gold-tint-25) 75%,
    var(--gold-tint-40) 90%,
    var(--gold) 97%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  pointer-events: none;
  animation: focus-orbit 3.2s linear infinite;
}
@keyframes focus-orbit {
  to { --focus-angle: 360deg; }
}
@media (prefers-reduced-motion: reduce) {
  .field-card:focus-within::after { animation: none; }
}

.textarea { min-height: 140px; resize: vertical; line-height: var(--lh-normal); }
.textarea-mono { font-family: var(--font-mono); font-size: var(--fs-13); }

.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%239B9BA3' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

.label {
  display: block;
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  margin-bottom: var(--s-2);
  letter-spacing: -0.002em;
}

.field { margin-bottom: var(--s-4); }
.field-hint { font-size: var(--fs-12); color: var(--text-subtle); margin-top: 6px; }
.field-error { font-size: var(--fs-12); color: var(--error); margin-top: 6px; }

/* ---------- Radio / Checkbox cards ---------- */
.option {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.option:hover {
  border-color: var(--gold-tint-40);
  background: var(--surface-3);
}
.option-selected {
  border-color: var(--gold);
  background: var(--gold-tint-08);
}
.option-selected:hover { background: var(--gold-tint-15); }

.option input[type="radio"],
.option input[type="checkbox"] {
  appearance: none;
  width: 18px; height: 18px;
  margin-top: 2px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-full);
  background: var(--bg);
  flex-shrink: 0;
  transition: all var(--t-fast) var(--ease);
  position: relative;
}
.option input[type="checkbox"] { border-radius: var(--r-xs); }
.option input[type="radio"]:checked,
.option input[type="checkbox"]:checked {
  border-color: var(--gold);
  background: var(--gold);
}
.option input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: var(--bg);
  border-radius: var(--r-full);
}
.option input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' fill='none'><path d='M2.5 6L5 8.5L9.5 3.5' stroke='%230A0A0C' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
}

/* ---------- Badge / Chip ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  line-height: var(--lh-snug);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge-gold {
  background: var(--gold-tint-08);
  border-color: var(--gold-tint-25);
  color: var(--gold-soft);
}
.badge-success {
  background: var(--success-tint);
  border-color: rgba(61, 214, 140, 0.25);
  color: var(--success);
}
.badge-warn {
  background: var(--warn-tint);
  border-color: rgba(232, 168, 76, 0.25);
  color: var(--warn);
}
.badge-error {
  background: var(--error-tint);
  border-color: rgba(232, 90, 90, 0.25);
  color: var(--error);
}
.badge-info {
  background: var(--info-tint);
  border-color: rgba(109, 174, 216, 0.25);
  color: var(--info);
}
/* "AI assisted" — lavender, to set it apart from the blue "AI answered". */
.badge-assist {
  background: rgba(236, 230, 243, 0.08);
  border-color: rgba(236, 230, 243, 0.28);
  color: #ece6f3;
}
/* Permanent "required" marker next to the field title — neutral and mode-aware
   (near-black in light, near-white in dark via --text-strong), always present
   on required fields regardless of commit state / badge. */
.req-star {
  color: var(--text-strong);
  font-weight: 700;
  margin-left: 3px;
}

.badge-dot {
  width: 6px; height: 6px;
  border-radius: var(--r-full);
  background: currentColor;
  flex-shrink: 0;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: var(--s-1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s-5);
}
.tab {
  padding: 10px 16px;
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  color: var(--text-muted);
  border: 0;
  border-bottom: 2px solid transparent;
  transition: all var(--t-fast) var(--ease);
  margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* Pill-style tabs (for toggles) */
.tabs-pill {
  display: inline-flex;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.tabs-pill .tab {
  padding: 6px 14px;
  border: 0;
  border-radius: var(--r-sm);
  margin: 0;
  font-size: var(--fs-13);
}
.tabs-pill .tab.active {
  background: var(--gold);
  color: #0A0A0C;
  border: 0;
}

/* ---------- Spinner ---------- */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid var(--gold-tint-25);
  border-top-color: var(--gold);
  border-radius: var(--r-full);
  animation: spin 0.7s linear infinite;
}
.spinner-sm { width: 12px; height: 12px; border-width: 1.5px; }
.spinner-lg { width: 28px; height: 28px; border-width: 2.5px; }
.spinner-xl { width: 48px; height: 48px; border-width: 3px; }

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

/* ---------- Progress bar ---------- */
.progress {
  width: 100%;
  height: 6px;
  /* Visible track: --surface-2 was too faint, so the unfilled portion vanished
     and the bar read as a plain line. A deeper fill + a defined border + an
     inset groove make it obviously a track that's only partly filled. */
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-full);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.14);
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold), var(--gold-soft));
  border-radius: var(--r-full);
  transition: width var(--t-slow) var(--ease);
  box-shadow: 0 0 10px var(--gold-tint-40);
}

/* Indeterminate progress */
.progress-indet .progress-bar {
  width: 40%;
  animation: indet 1.4s ease-in-out infinite;
}
@keyframes indet {
  0%   { margin-left: -40%; }
  100% { margin-left: 100%; }
}

/* ---------- Stepper (vertical) ---------- */
.stepper { display: flex; flex-direction: column; gap: 0; }
.step {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  align-items: flex-start;
  position: relative;
}
.step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 11px;
  top: 32px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
  border-radius: var(--r-full);
}
.step-active:not(:last-child)::after {
  background: linear-gradient(180deg, var(--gold), var(--border) 60%);
}
.step-done:not(:last-child)::after { background: var(--gold); }

.step-dot {
  width: 24px; height: 24px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  font-size: var(--fs-12);
  flex-shrink: 0;
  z-index: 1;
  transition: all var(--t-base) var(--ease);
}
.step-active .step-dot {
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: var(--gold-glow);
}
.step-done .step-dot {
  border-color: var(--gold);
  background: var(--gold);
  color: #0A0A0C;
}

.step-body { padding-top: 1px; }
.step-title {
  font-size: var(--fs-14);
  font-weight: var(--fw-medium);
  color: var(--text);
}
.step-active .step-title { color: var(--gold); }
.step-sub {
  font-size: var(--fs-12);
  color: var(--text-subtle);
  margin-top: 2px;
}

/* ============================================================
   Review-page components — SINGLE SOURCE (2026-07-15)
   ------------------------------------------------------------
   These rules were quadruplicated across both products' review.html
   <style> blocks (web + MCP) and drifted: transparent-vs-filled cards
   (V1), a task-card copy that missed the flex-wrap audit fix, an
   hprogress family defined three times. ONE parent now. Page files may
   keep only page-layout chrome (paper-sheet, grids, rails, product-only
   drawers) — component selectors reappearing in a page <style> block
   are blocked by both repos' shared-contract guard tests.
   Treatment decision (Claude's call, 2026-07-15, under the user's
   "make them look the same" directive — announced, not user-picked):
   the web's filled card wins everywhere; hprogress is the web bar with
   mono step digits.
   ============================================================ */

/* Field card — the core review component. Left-border accent maps to the
   field's ui_color: green/gold/warn/error. */
.field-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--s-5);
  transition: border-color var(--t-fast) var(--ease);
}
.field-card:hover { border-color: var(--border-strong); }
.field-card-high    { border-left-color: var(--success); }
.field-card-med     { border-left-color: var(--gold); }
.field-card-low     { border-left-color: var(--warn); }
.field-card-missing { border-left-color: var(--error); }
.field-card-resolved { opacity: 0.65; }
.field-card-error   {
  border-color: var(--error);
  box-shadow: 0 0 0 1px var(--error-tint);
}
/* Focused card — pairs with the evidence/transcript sidebar highlight. */
.field-card-focused {
  border-color: var(--gold) !important;
  box-shadow: var(--gold-glow);
}

/* Inline commit-state indicator inside each field card. */
.commit-indicator {
  font-size: var(--fs-12);
  margin-top: var(--s-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.commit-indicator-pending { color: var(--text-muted); }
.commit-indicator-saved   { color: var(--success); }
.commit-indicator-error   { color: var(--error); }

/* Submit overlay — full-screen during the submit-then-extract gap. */
.review-submit-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 10, 12, 0.72);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
}

/* Inline error ring markers (_handleSubmit). */
.ring-paper-error { box-shadow: 0 0 0 2px var(--error); }

/* PaperOS task footer — read-only task list with deep-links. Distinct
   look from the field-card so users don't mistake them for inputs. */
.task-card {
  display: flex;
  align-items: center;
  flex-wrap: wrap;   /* narrow widths: wrap instead of overflowing (audit #7) */
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--t-fast) var(--ease);
}
.task-card:hover { border-color: var(--border-strong); }
.task-card-label {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-14);
  color: var(--text);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--fs-12);
  white-space: nowrap;
}
.task-chip-state-completed { color: var(--success); border-color: var(--success); }
.task-chip-state-flagged   { color: var(--warn);    border-color: var(--warn); }
.task-chip-state-incomplete { color: var(--text-muted); }
.task-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: var(--fs-12);
  color: var(--gold);
  text-decoration: none;
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.task-link:hover { background: var(--gold-tint-08); }
.task-link-disabled {
  color: var(--text-subtle);
  cursor: not-allowed;
}

/* Progress bar (horizontal, clickable, numbered) — THE definition.
   Was triple-defined (a stale base here + both page blocks); the page
   copies are gone and this is the only one. */
.hprogress {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;   /* 390px: scroll inside itself (audit #9) */
}
.hprogress-step {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-13);
  color: var(--text-muted);
  white-space: nowrap;
}
.hprogress-step-done { color: var(--text); }
.hprogress-step-done .hprogress-num {
  background: var(--success); color: #0A0A0C;
}
.hprogress-step-current { color: var(--text-strong); font-weight: var(--fw-medium); }
.hprogress-step-current .hprogress-num {
  background: var(--gold); color: #0A0A0C;
}
.hprogress-step-clickable { cursor: pointer; }
.hprogress-step-clickable:hover { color: var(--text); }
/* Blocked-pending: still clickable (user can pre-fill the fields), but
   visually flagged so they know finalize won't go through until the
   upstream PaperOS prereq is resolved. */
.hprogress-step-blocked {
  color: var(--warn);
  opacity: 0.85;
}
.hprogress-step-blocked .hprogress-num {
  background: rgba(232, 168, 76, 0.18);
  color: var(--warn);
}
.hprogress-step-failed {
  color: var(--error);
  opacity: 0.9;
}
.hprogress-step-failed .hprogress-num {
  background: var(--error-tint);
  color: var(--error);
}
.hprogress-num {
  width: 20px; height: 20px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: var(--fw-semibold);
  font-family: var(--font-mono);
  line-height: 1;
  flex-shrink: 0;
}
.hprogress-sep {
  width: 20px; height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* Dashboard row components — workspace initials icon + hover-reveal row
   delete. Were byte-identical copies in BOTH products' index.html style
   blocks (4 files). Single source, same guard as the review components. */
.dash-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
}
.dash-icon-active {
  background: var(--gold-tint-08);
  border-color: var(--gold-tint-25);
  color: var(--gold);
}
.row-delete {
  opacity: 0;
  transition: opacity var(--t-fast) var(--ease);
  background: transparent;
  border: 0;
  padding: 4px;
  cursor: pointer;
  color: var(--text-subtle);
  border-radius: var(--r-sm);
}
tr:hover .row-delete { opacity: 1; }
.row-delete:hover { color: var(--error); background: rgba(232,90,90,0.08); }

/* ---------- Toast / Banner ---------- */
.toast {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  font-size: var(--fs-14);
  color: var(--text);
  max-width: 440px;
}
.toast-success { border-color: rgba(61, 214, 140, 0.35); }
.toast-success .toast-icon { color: var(--success); }
.toast-error { border-color: rgba(232, 90, 90, 0.35); }
.toast-error .toast-icon { color: var(--error); }
.toast-warn { border-color: rgba(232, 168, 76, 0.35); }
.toast-warn .toast-icon { color: var(--warn); }

/* ---------- Evidence block (inline callout / warning) ---------- */
.evidence {
  border-left: 2px solid var(--gold-tint-40);
  padding: var(--s-2) var(--s-3);
  font-family: var(--font-serif);
  font-style: italic;
  font-size: var(--fs-15);
  color: var(--text-muted);
  background: var(--gold-tint-04);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  line-height: var(--lh-loose);
}

/* ---------- Dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  padding: var(--s-10) var(--s-5);
  text-align: center;
  background: var(--surface);
  transition: all var(--t-base) var(--ease);
  cursor: pointer;
}
.dropzone:hover,
.dropzone-active {
  border-color: var(--gold);
  background: var(--gold-tint-04);
  box-shadow: var(--gold-glow);
}

/* ---------- Divider w/ label ---------- */
.divider {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  color: var(--text-subtle);
  font-size: var(--fs-12);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin: var(--s-5) 0;
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Confidence bar (field review) ---------- */
.conf {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--fs-12);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.conf-track {
  width: 36px; height: 4px;
  background: var(--surface-3);
  border-radius: var(--r-full);
  overflow: hidden;
}
.conf-fill {
  height: 100%;
  background: var(--gold);
  border-radius: var(--r-full);
}
.conf-high .conf-fill { background: var(--success); }
.conf-med .conf-fill { background: var(--gold); }
.conf-low .conf-fill { background: var(--warn); }

/* ---------- Tooltip (CSS-only via title is ugly; we use a span) ---------- */
.kbd {
  display: inline-block;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: var(--r-xs);
}

/* ---------- Table ---------- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: var(--fs-14);
}
.table thead th {
  text-align: left;
  padding: var(--s-3) var(--s-4);
  font-size: var(--fs-12);
  font-weight: var(--fw-medium);
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-raised);
}
.table tbody td {
  padding: var(--s-4);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text);
  vertical-align: middle;
}
.table tbody tr { transition: background var(--t-fast) var(--ease); }
.table tbody tr:hover { background: var(--gold-tint-04); }
.table tbody tr:last-child td { border-bottom: 0; }

/* ---------- Processing overlay ----------
   Full-page blur + orbital loader. Use on any HITL page after submit so
   the user stays on the same URL while the backend does its thing. */
.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 10, 12, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-6);
  text-align: center;
}
.processing-overlay.active { display: flex; }
.processing-orbital {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: var(--s-3);
}
.processing-orbital .ring-1 {
  position: absolute;
  inset: 0;
  border: 2px solid var(--gold-tint-15);
  border-radius: var(--r-full);
}
.processing-orbital .ring-1-active {
  position: absolute;
  inset: 0;
  border: 2px solid transparent;
  border-top-color: var(--gold);
  border-radius: var(--r-full);
  animation: spin 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  box-shadow: var(--gold-glow);
}
.processing-orbital .ring-2 {
  position: absolute;
  inset: 10px;
  border: 1.5px solid var(--gold-tint-08);
  border-radius: var(--r-full);
}
.processing-orbital .ring-2-active {
  position: absolute;
  inset: 10px;
  border: 1.5px solid transparent;
  border-bottom-color: var(--gold-soft);
  border-radius: var(--r-full);
  animation: spin 2.2s cubic-bezier(0.4, 0, 0.2, 1) infinite reverse;
}
.processing-orbital .ring-logo {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.processing-orbital .ring-logo img {
  width: 24px;
  height: 24px;
  opacity: 0.85;
}
.processing-title {
  font-family: var(--font-serif);
  font-size: var(--fs-24);
  color: var(--text-strong);
  letter-spacing: -0.01em;
}
.processing-title em { color: var(--gold); font-style: italic; }
.processing-sub {
  font-size: var(--fs-13);
  color: var(--text-muted);
  max-width: 360px;
  line-height: var(--lh-loose);
}

/* ---------- Skeleton ---------- */
.skel {
  background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%);
  background-size: 200% 100%;
  animation: skel 1.4s ease-in-out infinite;
  border-radius: var(--r-sm);
  height: 14px;
}
@keyframes skel {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: var(--s-11) var(--s-5);
}
.empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto var(--s-4);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
}
.empty-title {
  font-size: var(--fs-18);
  font-weight: var(--fw-medium);
  color: var(--text);
  margin-bottom: var(--s-2);
}
.empty-desc {
  font-size: var(--fs-14);
  color: var(--text-muted);
  max-width: 340px;
  margin: 0 auto var(--s-5);
  line-height: var(--lh-loose);
}

/* ---------- Toast container + animations (for banner.js) ---------- */
.toast-container {
  position: fixed;
  bottom: var(--s-5);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  align-items: center;
  z-index: 200;
  pointer-events: none;
}
.toast-container > * { pointer-events: auto; }

.toast {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 200ms ease, transform 200ms ease;
}
.toast.toast-in {
  opacity: 1;
  transform: translateY(0);
}
.toast.toast-out {
  opacity: 0;
  transform: translateY(8px);
}

.toast-message {
  flex: 1;
  line-height: var(--lh-loose);
}

.toast-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}
.toast-close:hover { color: var(--text); }

/* ---------- Field group (review.html resource sections) ----------
   Wraps cards belonging to one resource_variable_name (Company, Member,
   Officer, etc.) under a small header. _groupFieldsByResource +
   _buildGroupSection in review.js drive this. */
.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}
.field-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  /* wrap at narrow widths — the title + "N/M filled · ..." count row was the
     last fixed-width row overflowing the 390px widget (audit P2) */
  flex-wrap: wrap;
  gap: var(--s-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--s-1);
}
.field-group-header .field-group-title { min-width: 0; overflow-wrap: anywhere; }
.field-group-title {
  font-size: var(--fs-15);
  font-weight: var(--fw-semibold);
  color: var(--text-strong);
  letter-spacing: -0.005em;
}
.field-group-count {
  font-size: var(--fs-12);
  color: var(--text-muted);
  white-space: nowrap;
}
.field-group-fields {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}

/* Per-resource sub-section. Multi-resource and multi_entry groups render
   one of these per resource; single-resource groups skip the sub-header
   and just inline the cards (no extra wrapper styling needed). */
.field-group-resource {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.field-group-resource + .field-group-resource {
  margin-top: var(--s-4);
  padding-top: var(--s-4);
  border-top: 1px dashed var(--border-subtle);
}
.field-group-resource-header {
  display: flex;
  align-items: baseline;
  gap: var(--s-2);
  padding-left: var(--s-3);
  border-left: 2px solid var(--gold-tint-25);
}
.field-group-resource-title {
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  color: var(--text);
  letter-spacing: -0.002em;
}

/* "+ Add another …" action row at the end of multi_entry groups. */
.field-group-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px dashed var(--border-subtle);
}


/* ---------------------------------------------------------------------------
   Tailwind-free equivalents for the utility classes the field JS toggles.
   These used to resolve ONLY through the Tailwind CDN script (config maps
   paper-* names to the same vars) — an authored copy makes the CDN
   removable and survives hosts that block it. Border colors get !important
   so they win against the .option/.upload-area base rules they toggle over.
--------------------------------------------------------------------------- */
.border-paper-link   { border-color: var(--gold) !important; }
.border-paper-button { border-color: var(--gold) !important; }
.border-paper-border { border-color: var(--border) !important; }
.text-paper-error { color: var(--error); }
.text-paper-link  { color: var(--gold); }
.text-paper-text  { color: var(--text); }
/* Replaces the Tailwind bg-blue-50/30 drag/selection tint — blue was the
   CDN's palette, not ours; the brand tint is gold. */
.drag-highlight { background: var(--gold-tint-04) !important; }
