/* ============================================================
   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); }

.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);
}

.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: 4px;
  background: var(--surface-2);
  border-radius: var(--r-full);
  overflow: hidden;
}
.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 8px 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;
}

/* ---------- Progress bar (horizontal, clickable, numbered) ---------- */
.hprogress {
  display: flex;
  align-items: center;
  gap: 0;
  padding: var(--s-3) 0;
}
.hprogress-step {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 6px 12px;
  border-radius: var(--r-md);
  color: var(--text-subtle);
  font-size: var(--fs-13);
  font-weight: var(--fw-medium);
  transition: all var(--t-fast) var(--ease);
  cursor: pointer;
  flex-shrink: 0;
}
.hprogress-step:hover { color: var(--text); background: var(--surface-2); }
.hprogress-step-current { color: var(--gold); }
.hprogress-step-done { color: var(--text-muted); }
.hprogress-num {
  width: 20px; height: 20px;
  border-radius: var(--r-full);
  border: 1.5px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  flex-shrink: 0;
}
.hprogress-step-done .hprogress-num {
  background: var(--gold);
  border-color: var(--gold);
  color: #0A0A0C;
}
.hprogress-sep {
  width: 32px;
  height: 1px;
  background: var(--border);
  flex-shrink: 0;
}

/* ---------- 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 (quoted transcript line) ---------- */
.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: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) 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;
  gap: var(--s-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: var(--s-1);
}
.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);
}
