/* =============================================================
   tigerClaims design system
   Insurance-trust palette: calm navy + teal-green money,
   iris for reserves, amber for attention.
   Imported app-wide from base.html; loads after Tailwind so it
   overrides utilities where needed.
   ============================================================= */

/* Make the `hidden` attribute win over author `display` rules (e.g. .tc-pill). */
[hidden] { display: none !important; }

:root {
  /* surfaces */
  --bg: #F5F7FB;
  --surface: #FFFFFF;
  --surface-2: #F9FAFD;
  --surface-tint-blue:  #F0F5FA;
  --surface-tint-teal:  #ECF5F2;
  --surface-tint-iris:  #F1EFFB;
  --surface-tint-amber: #FBF5EA;

  /* lines */
  --border:        #E3E8EF;
  --border-strong: #C9D2DE;
  --border-input:  #D5DCE5;

  /* text */
  --text-1: #0E1A2B;
  --text-2: #3A4A5F;
  --text-3: #6B7A8F;
  --text-4: #97A2B3;

  /* brand */
  --primary:        #0F2D52;
  --primary-hover:  #0a2444;
  --primary-dark:   #143a60;
  --primary-soft:   #E7EDF6;
  --primary-text:   #0F2D52;

  /* semantic */
  --success:        #0E7A5F;
  --success-hover:  #0A6750;
  --success-soft:   #E1F0EB;
  --success-text:   #0A5F4A;

  --reserve:        #5B4FBE;
  --reserve-hover:  #4f43a6;
  --reserve-soft:   #ECEAF9;
  --reserve-text:   #463CA0;
  --hairline-iris:  color-mix(in srgb, var(--reserve) 28%, transparent);

  --warning:        #A8650C;
  --warning-hover:  #8A5208;
  --warning-soft:   #FBF1DD;
  --warning-text:   #8A5208;

  --danger:         #B12A3B;
  --danger-hover:   #95222F;
  --danger-soft:    #FBE7EA;
  --danger-text:    #B12A3B;

  /* ink on solid semantic fills */
  --on-solid:       #FFFFFF;

  /* type */
  --f-display: 'Geist', 'Söhne', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono:    'Geist Mono', 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  /* shadows */
  --shadow-sm: 0 1px 2px rgba(14,26,43,0.04);
  --shadow-md: 0 2px 8px rgba(14,26,43,0.06), 0 1px 2px rgba(14,26,43,0.04);
  --shadow-lg: 0 10px 24px rgba(14,26,43,0.10), 0 4px 8px rgba(14,26,43,0.06);

  /* spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px;

  /* tooltips — stable dark surface that reads on both light and dark pages */
  --tooltip-bg:   #0F172A;
  --tooltip-text: #F1F5F9;
}

/* ---- base typography on the app shell ---- */
body {
  font-family: var(--f-display);
  font-feature-settings: "ss01" on, "cv11" on;
  -webkit-font-smoothing: antialiased;
  color: var(--text-1);
  background: var(--bg);
}
/* main is the overflow-y:auto scroll container — explicit bg (dark mode) + a stable gutter so content doesn't shift when the scrollbar appears on load. */
main {
  background: var(--bg);
  scrollbar-gutter: stable;
}
html { scrollbar-gutter: stable; }
/* All native checkboxes & radios use the brand primary accent, app-wide. */
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.font-mono, .tabular-nums { font-variant-numeric: tabular-nums; }
.mono, .num { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }

/* ---- utility additions ---- */
.tc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: none;
  overflow: hidden;
  min-width: 0; /* shrink in grid/flex rows so wide content scrolls, not overflows the page */
}
/* For cards that host floating menus (tc-menu) or absolutely-positioned
   popovers (tc-combobox) which otherwise get clipped by overflow:hidden. */
.tc-card.is-overflow-visible { overflow: visible; }
.tc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-5);
  border-bottom: 1px solid var(--border);
}
.tc-card-head.tint-blue   { background: var(--surface-tint-blue);  }
.tc-card-head.tint-teal   { background: var(--surface-tint-teal);  }
.tc-card-head.tint-iris   { background: var(--surface-tint-iris);  }
.tc-card-head.tint-amber  { background: var(--surface-tint-amber); }
.tc-card-head.tint-danger { background: var(--danger-soft);         }
.tc-card-head.plain       { background: var(--surface); }
html.tc-modal-open,
html.tc-modal-open body {
  overflow: hidden;
}
.tc-batch-import-backdrop,
.tc-batch-import-layer {
  margin-top: 0 !important;
  top: 0;
}
.tc-batch-import-layer {
  padding-top: min(4vh, 2rem);
}
.tc-batch-import-card {
  border: 0;
  width: min(58rem, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  max-height: calc(100dvh - 4rem);
  border-radius: var(--r-xl);
  box-shadow:
    0 28px 48px -28px rgba(14, 26, 43, 0.45),
    0 10px 22px -16px rgba(14, 26, 43, 0.28);
}
.tc-batch-import-card:has(.tc-batch-upload) {
  width: min(54rem, calc(100vw - 2rem));
}
.tc-batch-import-card:has(.tc-batch-review) {
  width: min(66rem, calc(100vw - 2rem));
}
.tc-batch-head {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex: 0 0 auto;
  padding: 0.875rem var(--s-5);
  background: var(--surface-tint-teal);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.tc-batch-head-icon {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--surface) 62%, var(--success-soft));
  border: 1px solid rgba(14, 122, 95, 0.18);
  color: var(--success);
  flex: 0 0 auto;
}
.tc-batch-head-copy {
  min-width: 0;
  flex: 1 1 auto;
}
.tc-batch-head-copy h2 {
  margin: 0;
  font-size: 12px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-1);
}
.tc-batch-head-copy p {
  margin: 3px 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-3);
}
.tc-batch-close {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: var(--r-sm);
  color: var(--text-3);
  background: transparent;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}
.tc-batch-close:hover {
  color: var(--text-1);
  background: rgba(255, 255, 255, 0.55);
}
.tc-batch-close:focus-visible,
.tc-batch-dropzone:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.tc-batch-errors {
  flex: 0 0 auto;
  padding: var(--s-3) var(--s-5) 0;
}
.tc-batch-errors:empty {
  display: none;
}
.tc-batch-error-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  border: 1px solid rgba(177, 42, 59, 0.18);
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger);
  padding: var(--s-3);
  font-size: 13px;
  line-height: 1.4;
}
.tc-batch-error-alert svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
  margin-top: 1px;
}
.tc-batch-error-alert p {
  margin: 0 0 2px;
  font-weight: 700;
}
.tc-batch-error-alert ul {
  margin: 0;
  padding-left: 1rem;
}
#batch-import-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.tc-batch-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tc-batch-upload,
.tc-batch-review {
  flex: 1 1 auto;
  min-height: 0;
  padding: var(--s-4) var(--s-5) var(--s-5);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
}
.tc-batch-upload { overflow: auto; }
.tc-batch-review { overflow: hidden; }
.tc-batch-stagebar {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-3);
  font-size: 12px;
  font-weight: 600;
}
.tc-batch-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tc-batch-step + .tc-batch-step::before {
  content: "";
  width: 1.5rem;
  height: 1px;
  background: var(--border);
  margin-right: var(--s-2);
}
.tc-batch-step > span {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-3);
  font-size: 12px;
  font-family: var(--f-mono);
}
.tc-batch-step.is-active { color: var(--primary-text); }
.tc-batch-step.is-active > span {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}
.tc-batch-step.is-done { color: var(--success-text); }
.tc-batch-step.is-done > span {
  color: var(--success-text);
  border-color: rgba(14, 122, 95, 0.18);
  background: var(--success-soft);
}
.tc-batch-upload-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(14rem, 16.5rem);
  gap: var(--s-4);
  align-items: stretch;
}
.tc-batch-upload-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.tc-batch-dropzone {
  position: relative;
  min-height: 11.25rem;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-5);
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, box-shadow 140ms ease;
}
.tc-batch-dropzone:hover,
.tc-batch-dropzone.is-dragging {
  border-color: var(--primary);
  background: var(--surface-tint-blue);
  box-shadow: inset 0 0 0 1px rgba(15, 45, 82, 0.06);
}
.tc-batch-dropzone.has-file {
  border-style: solid;
  border-color: rgba(14, 122, 95, 0.28);
  background: var(--surface-tint-teal);
}
.tc-batch-dropzone.has-error {
  border-color: rgba(177, 42, 59, 0.38);
  background: color-mix(in srgb, var(--danger-soft) 52%, var(--surface));
}
.tc-batch-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.tc-batch-drop-empty,
.tc-batch-drop-selected {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  text-align: center;
}
.tc-batch-drop-icon,
.tc-batch-file-icon {
  width: 2.75rem;
  height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--primary);
  border: 1px solid var(--border);
}
.tc-batch-drop-icon svg,
.tc-batch-file-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}
.tc-batch-drop-copy p {
  margin: 0;
  color: var(--text-1);
  font-size: 15px;
}
.tc-batch-drop-copy span,
.tc-batch-foot-note,
.tc-batch-review-main > span {
  color: var(--text-3);
  font-size: 13px;
}
.tc-batch-file-icon {
  color: var(--success);
  background: var(--success-soft);
  border-color: rgba(14, 122, 95, 0.18);
}
.tc-batch-file-meta {
  min-width: 0;
}
.tc-batch-file-meta p {
  margin: 0;
  color: var(--text-1);
  font-weight: 600;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.tc-batch-file-meta span {
  color: var(--text-3);
  font-size: 12px;
}
.tc-batch-file-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}
.tc-batch-clear-file {
  align-self: center;
  border: 0;
  background: transparent;
  color: var(--danger);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 4px;
  cursor: pointer;
}
.tc-batch-clear-file:hover { text-decoration: underline; }
.tc-batch-guide {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  padding: var(--s-3);
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  min-width: 0;
}
/* Title row: label left, download button right */
.tc-batch-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-2);
}
/* Description sits below the head row as its own element */
.tc-batch-guide-desc {
  margin-top: -6px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.4;
}
/* Thin separator between logical sections */
.tc-batch-guide-sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
}
.tc-batch-guide-head p,
.tc-batch-required p,
.tc-batch-review-eyebrow {
  margin: 0;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tc-batch-required {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}
.tc-batch-required > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tc-batch-required code {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--f-mono);
  font-size: 12px;
  padding: 3px 6px;
  cursor: default;
}
/* Optional columns — dashed border, muted tone */
.tc-batch-required code.is-optional {
  border-style: dashed;
  background: transparent;
  color: var(--text-3);
}
/* Drag-and-drop hint beneath the Browse button */
.tc-batch-drop-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tc-batch-drop-or {
  font-size: 12px;
  color: var(--text-4);
}
.tc-batch-foot {
  flex: 0 0 auto;
  padding-block: var(--s-3);
  justify-content: space-between;
  flex-wrap: wrap;
}
.tc-batch-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  margin-left: auto;
}
.tc-batch-actions form { margin: 0; }
.tc-batch-review-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s-4);
}
.tc-batch-review-main {
  min-width: 0;
}
.tc-batch-review-main h3 {
  margin: 2px 0 0;
  color: var(--text-1);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 650;
}
.tc-batch-review-main h3:focus {
  outline: none;
}
.tc-batch-review-total {
  margin: 6px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}
.tc-batch-success-icon {
  width: 3.5rem;
  height: 3.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(14, 122, 95, 0.18);
}
.tc-batch-success-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}
.tc-batch-success-heading {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  color: var(--text-1);
  line-height: 1.25;
}
.tc-batch-success-subtext {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-3);
}
.tc-batch-success-total {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
}
.tc-batch-import-ref {
  margin: 0;
  font-size: 12px;
  color: var(--text-4);
}
.tc-batch-import-ref code {
  font-family: var(--f-mono);
  font-size: inherit;
}
.tc-batch-review-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-2);
  flex: 0 0 auto;
}
.tc-batch-review-metrics {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.tc-batch-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.tc-batch-chip svg,
.tc-batch-download-link svg,
.tc-batch-result svg,
.tc-batch-blocked svg,
.tc-batch-review-callout svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}
.tc-batch-chip.is-ready {
  color: var(--success-text);
  background: var(--success-soft);
}
.tc-batch-chip.is-error {
  color: var(--danger);
  background: var(--danger-soft);
}
.tc-batch-download-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.tc-batch-download-link:hover { color: var(--text-1); }
.tc-batch-review-callout {
  display: flex;
  align-items: flex-start;
  gap: var(--s-2);
  border: 1px solid rgba(168, 101, 12, 0.18);
  border-radius: var(--r-md);
  background: var(--warning-soft);
  color: var(--warning-text);
  padding: 8px 11px;
  font-size: 13px;
  line-height: 1.35;
}
.tc-batch-review-callout.is-danger {
  color: var(--danger);
  border-color: rgba(177, 42, 59, 0.18);
  background: var(--danger-soft);
}
.tc-batch-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}
.tc-batch-segmented {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.tc-batch-segmented button {
  min-height: 1.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
  font-size: 12px;
  font-weight: 650;
  padding: 4px 9px;
  white-space: nowrap;
}
.tc-batch-segmented button span {
  color: inherit;
  font-family: var(--f-mono);
  font-size: 12px;
}
.tc-batch-segmented button:hover {
  color: var(--text-1);
  background: var(--surface);
}
.tc-batch-segmented button.is-active {
  color: var(--primary-text);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.tc-batch-segmented button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.tc-batch-table-wrap {
  /* Grow to fill the review area so the rows (the main content) get the space,
     instead of being capped while the banners take their natural height. */
  flex: 1 1 auto;
  min-height: 8rem;
  /* overflow-y only — horizontal scrolling is on tc-batch-table-scroll below.
     Separating the axes lets position:sticky work correctly in the thead. */
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
}
/* Inner wrapper carries the horizontal scroll so the two axes are independent. */
.tc-batch-table-scroll {
  overflow-x: auto;
  min-width: 0;
}
.tc-batch-preview-table {
  min-width: 60rem;
  table-layout: fixed;
}
.tc-batch-preview-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-2);
  padding: 0.625rem 0.875rem;
  /* Hard box-shadow replaces the bottom border so it scrolls with the header,
     not with the table body. */
  box-shadow: 0 1px 0 var(--border);
}
.tc-batch-preview-table tbody td {
  padding: 0.625rem 0.875rem;
  vertical-align: top;
  /* Clip cell content to the fixed column width so long values don't bleed
     into adjacent cells. */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Result column: error messages can be multi-line — let them wrap instead. */
.tc-batch-preview-table tbody td:last-child {
  white-space: normal;
  overflow: visible;
}
.tc-batch-preview-table th:nth-child(1),
.tc-batch-preview-table td:nth-child(1) { width: 3.5rem; }
.tc-batch-preview-table th:nth-child(2),
.tc-batch-preview-table td:nth-child(2) { width: 9.5rem; }
.tc-batch-preview-table th:nth-child(3),
.tc-batch-preview-table td:nth-child(3) { width: 8.5rem; }
.tc-batch-preview-table th:nth-child(4),
.tc-batch-preview-table td:nth-child(4) { width: 7rem; }
.tc-batch-preview-table th:nth-child(5),
.tc-batch-preview-table td:nth-child(5) { width: 10rem; }
.tc-batch-preview-table th:nth-child(6),
.tc-batch-preview-table td:nth-child(6) { width: 7.5rem; }
.tc-batch-preview-table th:nth-child(7),
.tc-batch-preview-table td:nth-child(7) { width: 17.5rem; }
/* Historical preview inserts a Status column (7th), pushing Result to the 8th.
   Re-map the last two columns and widen the table so neither collapses. */
.tc-batch-preview-table.has-status { min-width: 70rem; }
.tc-batch-preview-table.has-status th:nth-child(7),
.tc-batch-preview-table.has-status td:nth-child(7) { width: 6.5rem; }
.tc-batch-preview-table.has-status th:nth-child(8),
.tc-batch-preview-table.has-status td:nth-child(8) { width: 17.5rem; }
.tc-batch-row-ready td {
  background: var(--surface);
}
.tc-batch-row-error td {
  background: color-mix(in srgb, var(--danger-soft) 42%, var(--surface));
}
.tc-batch-row-ready td:first-child {
  box-shadow: inset 3px 0 0 rgba(14, 122, 95, 0.28);
}
.tc-batch-row-error td:first-child {
  box-shadow: inset 3px 0 0 rgba(177, 42, 59, 0.34);
}
.tc-batch-preview-table tbody tr:hover td {
  background: var(--surface-2);
}
.tc-batch-result {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}
.tc-batch-result.is-ready { color: var(--success-text); }
.tc-batch-result.is-error { color: var(--danger); }
.tc-batch-result-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
.tc-batch-blocked {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}
@media (max-width: 900px) {
  .tc-batch-import-layer {
    padding: 0.75rem 0.5rem 1rem;
  }
  .tc-batch-import-card {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
  }
  .tc-batch-head,
  .tc-batch-upload,
  .tc-batch-review,
  .tc-batch-foot,
  .tc-batch-errors {
    padding-inline: var(--s-3);
  }
  .tc-batch-upload-grid {
    grid-template-columns: 1fr;
  }
  .tc-batch-review-summary {
    flex-direction: column;
  }
  .tc-batch-review-side {
    align-items: flex-start;
    width: 100%;
  }
  .tc-batch-actions {
    width: 100%;
    margin-left: 0;
    justify-content: stretch;
  }
  .tc-batch-actions .btn,
  .tc-batch-foot > .btn {
    width: 100%;
  }
  .tc-batch-table-toolbar,
  .tc-batch-foot {
    align-items: stretch;
  }
  .tc-batch-segmented {
    width: 100%;
  }
  .tc-batch-segmented button {
    flex: 1 1 0;
  }
}
/* ===== Import filter notice ============================================ */
.tc-import-filter-notice {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 9px var(--s-4);
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  border: 1px solid rgba(27, 74, 122, 0.14);
  font-size: 13px;
  color: var(--primary-text);
  margin-bottom: var(--s-3);
}
.tc-import-filter-notice svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--primary);
}
.tc-import-filter-clear {
  margin-left: auto;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
.tc-import-filter-clear:hover { text-decoration: underline; }

/* ===== Import History Panel ============================================ */
.tc-import-history {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-1);
  overflow: hidden;
}
.tc-import-history summary { list-style: none; }
.tc-import-history summary::-webkit-details-marker { display: none; }
.tc-import-history-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  padding: 10px var(--s-4);
  cursor: pointer;
  user-select: none;
  border-radius: inherit;
  transition: background 120ms;
}
.tc-import-history-toggle:hover { background: var(--surface-2); }
.tc-import-history-title {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.tc-import-history-title svg {
  width: 14px;
  height: 14px;
  color: var(--text-3);
  flex: 0 0 auto;
}
.tc-import-history-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
}
.tc-import-history-chev {
  width: 14px;
  height: 14px;
  color: var(--text-4);
  transition: transform 180ms ease;
  flex: 0 0 auto;
}
.tc-import-history-chev.is-open { transform: rotate(180deg); }
.tc-import-history-body { border-top: 1px solid var(--border); }
.tc-import-history-table { font-size: 13px; }
.tc-import-history-table thead th {
  font-size: 12px;
  padding-block: 7px;
}
.tc-import-history-table td { padding-block: 8px; }
.tc-import-action-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
  white-space: nowrap;
}
.tc-import-action-link:hover { text-decoration: underline; }
.tc-import-action-link svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}
.tc-import-action-link.is-danger { color: var(--danger); }

.tc-card-title {
  display: flex; align-items: center; gap: var(--s-3); min-width: 0;
}
.tc-card-title h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-1);
}
/* Title + sub share one line (sub follows the title with a · separator); wraps only when cramped. */
.tc-card-title > div { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px var(--s-2); min-width: 0; }
.tc-card-title .sub {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-3);
}
.tc-card-title .sub::before { content: "·"; margin-right: var(--s-2); color: var(--text-4); }
/* Fraud Score card: keep title + sub on one line across scored/assessing states (ellipsis if cramped). */
#fraud-score-card .tc-card-title > div { flex-wrap: nowrap; }
#fraud-score-card .tc-card-title .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-card-title .ico {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: var(--primary-soft);
  border: 1px solid rgba(15,45,82,0.18);
  color: var(--primary);
  flex: 0 0 auto;
}
.tc-card-title .ico.teal   { color: var(--success); background: var(--success-soft); border-color: rgba(14,122,95,0.18); }
.tc-card-title .ico.iris   { color: var(--reserve); background: var(--reserve-soft); border-color: rgba(91,79,190,0.18); }
.tc-card-title .ico.amber  { color: var(--warning); background: var(--warning-soft); border-color: rgba(168,101,12,0.18); }
.tc-card-title .ico.danger { color: var(--danger);  background: var(--danger-soft);  border-color: rgba(177,42,59,0.18); }

/* ===== Override existing partials: turn gradient banners into
   uniform tinted card heads + give them a clean uppercase title.
   This rewrites the visual treatment of every existing card without
   touching the partial markup. */
.bg-gradient-to-r.from-indigo-50.to-indigo-100,
.bg-gradient-to-r.from-blue-50.to-blue-100,
.bg-gradient-to-r.from-blue-50.to-indigo-50 {
  background-image: none !important;
  background-color: var(--surface-tint-blue) !important;
  border-color: var(--border) !important;
}
.bg-gradient-to-r.from-emerald-50.to-emerald-100,
.bg-gradient-to-r.from-green-50.to-green-100,
.bg-gradient-to-r.from-teal-50.to-teal-100 {
  background-image: none !important;
  background-color: var(--surface-tint-teal) !important;
  border-color: var(--border) !important;
}
.bg-gradient-to-r.from-amber-50.to-amber-100,
.bg-gradient-to-r.from-yellow-50.to-yellow-100,
.bg-gradient-to-r.from-orange-50.to-orange-100,
.bg-gradient-to-r.from-yellow-50.to-amber-50 {
  background-image: none !important;
  background-color: var(--surface-tint-amber) !important;
  border-color: var(--border) !important;
}
.bg-gradient-to-r.from-purple-50.to-purple-100,
.bg-gradient-to-r.from-violet-50.to-violet-100 {
  background-image: none !important;
  background-color: var(--surface-tint-iris) !important;
  border-color: var(--border) !important;
}
.bg-gradient-to-r.from-red-50.to-red-100,
.bg-gradient-to-r.from-rose-50.to-rose-100 {
  background-image: none !important;
  background-color: var(--danger-soft) !important;
  border-color: var(--border) !important;
}

/* Card containers used across partials: harmonise corner radius + border + shadow */
.bg-white.rounded-xl.shadow-sm.border.border-gray-200,
.bg-white.rounded-xl.shadow-sm.border-2 {
  border-radius: var(--r-lg);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

/* ===== Statstrip + claim header (used by overhauled header) ===== */
.tc-claim-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto;
}
.tc-claim-header .ch-top {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-4);
  border-right: 1px solid var(--border);
  flex-shrink: 0;
}
.tc-claim-header .ch-id-group {
  display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap;
}
.tc-claim-header .ch-id {
  margin: 0;
  font-family: var(--f-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-1);
  line-height: 1.2;
}
/* For detail pages where the title is a name (not a code-like ID), opt out
   of mono via .is-text so spacing/size match but the typography reads
   naturally for human names. */
.tc-claim-header .ch-id.is-text {
  font-family: var(--f-display, inherit);
  letter-spacing: -0.015em;
}
.tc-claim-header .ch-meta {
  font-size: 12px;
  color: var(--text-3);
}
/* ===== Page header — calm, low-chrome strip. */
.tc-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem 0.25rem;
}
.tc-page-header .ph-meta { min-width: 0; flex: 1; display: flex; align-items: baseline; gap: 0.625rem; flex-wrap: wrap; }
.tc-page-header .ph-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-1);
  line-height: 1.2;
}
.tc-page-header .ph-sub {
  font-size: 13px;
  color: var(--text-3);
}
.tc-page-header .ph-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}
/* Normalise all action-area buttons to consistent size — font/gap/icon only,
   vertical padding stays at base btn (py-1.5) so height is 28px. */
.tc-page-header .ph-actions .btn {
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
  font-size: 0.8125rem !important;
  line-height: 1rem !important;
  gap: 0.5rem !important;
}
.tc-page-header .ph-actions .btn .btn-icon {
  width: 0.875rem !important;
  height: 0.875rem !important;
}
/* Selects in the action area match the buttons exactly (28px, same font/border). */
.tc-page-header .ph-actions select {
  height: 28px;
  padding: 0 1.875rem 0 0.75rem;
  font-size: 0.8125rem;
  line-height: 1rem;
  border-radius: 0.5rem;
  border-color: var(--border);
  background-color: var(--surface);
}
.tc-page-header .ph-divider {
  width: 1px;
  height: 1.5rem;
  background: var(--border);
  flex-shrink: 0;
}

/* Inline stats — at-a-glance counters that sit on the right side of
   the page header. Mono numerics with a soft text label beside each. */
.tc-inline-stats {
  display: inline-flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: nowrap;
  white-space: nowrap;
}
.tc-inline-stats > span {
  display: inline-flex;
  align-items: baseline;
  gap: 0.375rem;
  white-space: nowrap;
}
.tc-inline-stats .num {
  font-family: var(--f-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1;
}
.tc-inline-stats .lbl {
  font-size: 12px;
  color: var(--text-3);
  text-transform: lowercase;
  letter-spacing: 0.01em;
}
/* Communications page header: pin the right zone to a uniform width AND
   height so the layout doesn't shift — horizontally OR vertically — when
   switching between a tab that has a trailing btn-md button (Templates /
   Inbox) and one that doesn't (Outbound / Unmatched). */
.tc-page-header .ph-actions:has(.comm-stats) {
  min-width: 480px;
  min-height: 36px;
  justify-content: flex-end;
}

/* ===== Filter / search bar — single-row horizontal toolbar.
   Inputs flow left-to-right, toggle chip + actions sit on the right. */
.tc-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.625rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.tc-filterbar .fb-search {
  position: relative;
  flex: 1 1 16rem;
  min-width: 12rem;
  display: flex;
  align-items: center;
}
.tc-filterbar .fb-search-icon {
  position: absolute;
  left: 0.625rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  color: var(--text-4);
  pointer-events: none;
}
.tc-filterbar .fb-search-icon svg { width: 1rem; height: 1rem; }
.tc-filterbar .fb-search-input { padding-left: 2rem; }
.tc-filterbar .fb-sep {
  width: 1px;
  height: 1.25rem;
  background: var(--border);
  flex-shrink: 0;
  margin: 0 0.125rem;
}
.tc-filterbar .fb-input {
  flex: 0 1 11rem;
  min-width: 9rem;
}
.tc-filterbar .fb-input-date {
  flex: 0 1 9rem;
  min-width: 8rem;
}
.tc-filterbar .fb-spacer { flex: 1 1 0; }
.tc-filterbar .fb-actions {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
  margin-left: auto;
}

/* Toggle chip — pill-shaped checkbox affordance used in filter bars
   so an "Assigned to me" toggle doesn't read as a stray form input. */
.tc-toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  user-select: none;
  transition: background-color 100ms ease, border-color 100ms ease, color 100ms ease;
}
.tc-toggle-chip:hover { border-color: var(--border-strong); color: var(--text-1); }
.tc-toggle-chip input[type="checkbox"] {
  width: 0.875rem;
  height: 0.875rem;
  margin: 0;
  border-radius: var(--r-xs);
  border: 1px solid var(--border-strong);
  accent-color: var(--primary);
  cursor: pointer;
}
.tc-toggle-chip:has(input:checked) {
  background: var(--primary-soft);
  border-color: rgba(15, 45, 82, 0.25);
  color: var(--primary-text);
}

/* ===== Data table — refined grid styles for list pages. */
.tc-table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
/* Flat-flush table inside a tc-card: the parent card already provides the
   rounded outer chrome, so the wrap drops its own border + radius to avoid
   the double-edge bleed at the rounded corner. */
.tc-card > .tc-table-wrap,
.tc-card > .p-4 > .tc-table-wrap {
  border: 0;
  border-radius: 0;
}
.tc-table-wrap.is-overflow-visible,
.tc-table-wrap.is-overflow-visible > .overflow-x-auto { overflow: visible; }
.tc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tc-table thead th {
  padding: 0.75rem 1.125rem;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  background: transparent;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tc-table thead th:not([class*="text-"]) { text-align: left; }
/* Opt-in sticky header (<thead class="sticky">): pin the cells (thead sticky breaks
   under border-collapse), keep them opaque, divider via shadow not border. */
.tc-table thead.sticky th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--border);
}
.tc-table tbody td {
  padding: 0.875rem 1.125rem;
  color: var(--text-1);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tc-table tbody tr:last-child td { border-bottom: 0; }
.tc-table tbody tr {
  transition: background-color 80ms ease;
}
.tc-table tbody tr:hover { background: var(--surface-2); }
.tc-table td { font-variant-numeric: tabular-nums; }
.tc-table td.mono,
.tc-table th.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.tc-table .row-link {
  font-family: var(--f-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  text-decoration: none;
  letter-spacing: -0.005em;
}
.tc-table .row-link:hover { color: var(--primary); }
.tc-table .muted { color: var(--text-3); }

/* ===== Pagination — compact, neutral. */
.tc-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.125rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  font-size: 13px;
  color: var(--text-3);
}
.tc-pagination .pg-controls { display: flex; gap: 0.375rem; }
.tc-pagination .pg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.625rem;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color 100ms ease, border-color 100ms ease, color 100ms ease;
}
.tc-pagination .pg-btn:hover { background: var(--surface-2); color: var(--text-1); }
.tc-pagination .pg-btn.is-current {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-solid);
  cursor: default;
}
.tc-pagination .pg-btn.is-disabled { opacity: 0.4; pointer-events: none; }

/* ===== Empty state. */
.tc-empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 3rem 1.5rem;
  text-align: center;
}
/* When the empty state is embedded inside a tc-card or similar surface, drop
   its own border/background so it doesn't render as a nested card. */
.tc-card .tc-empty,
.tc-claim-header .tc-empty,
.tc-table-wrap .tc-empty {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 2.5rem 1.5rem;
}
.tc-empty .em-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-4);
  margin-bottom: 0.75rem;
}
.tc-empty .em-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
}
.tc-empty .em-sub {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 0.375rem;
}

.tc-statstrip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
}
/* When inside a tc-claim-header grid, statstrip takes column 2, row 1 */
.tc-claim-header > .tc-statstrip {
  grid-column: 2;
  grid-row: 1;
}
.tc-statstrip.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tc-statstrip.cols-4 { grid-template-columns: repeat(4, 1fr); }
.tc-statstrip.cols-2 { grid-template-columns: repeat(2, 1fr); }
.tc-statstrip .cell {
  padding: var(--s-3) var(--s-4);
  display: flex; flex-direction: column; gap: 1px;
  min-width: 0;
}
.tc-statstrip .label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-weight: 500;
}
.tc-statstrip .value {
  font-size: 13px;
  color: var(--text-1);
  font-weight: 500;
  display: flex; align-items: center; gap: var(--s-2);
  min-height: 16px;
}
.tc-statstrip .value.placeholder { color: var(--text-3); font-weight: 400; }
.tc-statstrip .value.money,
.tc-statstrip .value .money { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.tc-statstrip .value .ghost { color: var(--text-4); }
.tc-statstrip .inline-cta {
  font-size: 12px;
  color: var(--primary-text);
  background: var(--primary-soft);
  padding: 2px 8px;
  border-radius: var(--r-xs);
  border: 0;
  cursor: pointer;
  font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
.tc-statstrip .inline-cta:hover { background: color-mix(in srgb, var(--primary-soft) 60%, var(--surface-2)); }

.tc-attention {
  grid-column: 1 / -1;
  grid-row: 2;
  border-top: 1px solid var(--border);
  background: var(--surface-tint-amber);
  padding: 6px var(--s-4);
  border-bottom-left-radius: var(--r-lg);
  border-bottom-right-radius: var(--r-lg);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--warning-text);
}
.tc-attention .a-icon {
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--warning);
  flex: 0 0 auto;
}
.tc-attention .a-msg { flex: 1; min-width: 0; }
.tc-attention .a-msg strong { font-weight: 600; color: var(--warning-text); }
.tc-attention .a-link {
  font-size: 13px;
  color: var(--warning-text);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 0;
  font-weight: 500;
}
.tc-attention .a-link:hover { color: var(--text-1); }

/* ── Global divide-gray-* → design-system border ───────────────────────── */
.divide-gray-100 > :not([hidden]) ~ :not([hidden]),
.divide-gray-200 > :not([hidden]) ~ :not([hidden]) { border-color: var(--border) !important; }

/* ── Instinct (AI/agentic) standard ──────────────────────────────────────
   One visual language for everything Instinct touches. Iris tint + 4-point star.
   · corner    .instinct-corner                   bare iris star on the doc-icon corner — "analysed"
   · chip      .tc-pill.tone-iris.doc-chip + star labelled chip (provenance, flags)
   · action    .btn.btn-reserve / -solid          Instinct buttons (Suggest, Review…)
   · activity  claims/_instinct_analysing.html    the one spinner pill
   · content   .instinct-panel                    tinted, clamp-and-expand insight body
   · prose     .dol-prose                         rendered Instinct text                */
/* Instinct "analysed" indicator — bare iris sparkle overlaid on the doc-icon corner. */
.instinct-corner {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: inline-flex;
  line-height: 0;
  color: var(--reserve);
  filter: drop-shadow(0 0 1.5px var(--surface)) drop-shadow(0 0 1.5px var(--surface));
}
.instinct-corner-fail { color: var(--danger); }
/* Iris badge on the Refine action button — "Instinct has something for you". */
.instinct-dot-badge { position: absolute; top: -2px; right: -2px; width: 8px; height: 8px; border-radius: 9999px; background: var(--reserve); box-shadow: 0 0 0 2px var(--surface); }
/* Iris hairline — pair with Tailwind `border-t` (the Instinct divider). */
.hairline-iris { border-color: var(--hairline-iris); }
/* Glyph sitting inline on the text baseline (e.g. the ✦ within a sentence). */
.glyph-inline { display: inline-flex; vertical-align: -0.15em; }

/* Working state: the Gemini sparkle spins with a gentle scale breath (crisp, no blur). */
@keyframes instinct-pulse {
  0%   { transform: rotate(0deg) scale(.92); }
  50%  { transform: rotate(180deg) scale(1.08); }
  100% { transform: rotate(360deg) scale(.92); }
}
.instinct-pulse {
  animation: instinct-pulse 2.4s cubic-bezier(.45, .05, .55, .95) infinite;
  transform-origin: center;
  transform-box: fill-box;
  will-change: transform;
}
/* Analysing indicator — inline star + shimmering label (not a chip), used everywhere. */
.instinct-working {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  color: var(--reserve-text);
  vertical-align: middle;
}
.instinct-working svg { color: var(--reserve); }
/* A light band sweeps across the label text. */
@keyframes instinct-text-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.instinct-shimmer-text {
  background: linear-gradient(100deg,
    var(--reserve-text) 35%,
    color-mix(in srgb, var(--reserve) 38%, white) 50%,
    var(--reserve-text) 65%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: instinct-text-shimmer 2s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .instinct-pulse { animation: none; }
  .instinct-shimmer-text {
    animation: none;
    -webkit-text-fill-color: var(--reserve-text);
    color: var(--reserve-text);
  }
}
/* Subtle hover-revealed re-run control on a document row — Instinct-tinted. */
.instinct-rerun { background: var(--surface-tint-iris); color: var(--reserve); }
.instinct-rerun:hover { background: var(--reserve-soft); }
/* Failed-analysis reason panel — takes the place of the Instinct insights. */
.instinct-fail-panel {
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 20%, transparent);
  background: var(--danger-soft);
  padding: 8px 12px;
}
.instinct-fail-panel .head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--danger-text);
}
.instinct-fail-panel .body {
  margin-top: 4px;
  font-size: .75rem;
  line-height: 1.55;
  color: var(--text-2);
  word-break: break-word;
}
/* Borderless: no box or fill — the iris ✦ + label is the only signal; a hairline separates the body. */
.instinct-panel { background: none; border: 0; }
.instinct-panel .head {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 6px;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--reserve-text);
  background: none;
  cursor: pointer;
  transition: color 150ms;
}
.instinct-panel .head svg:first-child { color: var(--reserve); }
.instinct-panel .head:hover { color: var(--reserve); }
.instinct-panel .body {
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid var(--hairline-iris);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-2);
}
.instinct-panel .body.clamped {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.instinct-panel .body p { margin: 0 0 6px; }
.instinct-panel .body p:last-child { margin-bottom: 0; }
.instinct-panel .body strong { font-weight: 600; color: var(--text-1); }
.instinct-panel .body ul,
.instinct-panel .body ol { margin: 2px 0 8px; padding-left: 18px; }
.instinct-panel .body ul { list-style: disc; }
.instinct-panel .body ol { list-style: decimal; }
.instinct-panel .body li { margin: 2px 0; }
.instinct-panel .body li > ul,
.instinct-panel .body li > ol { margin-bottom: 2px; }
.instinct-panel .body h3,
.instinct-panel .body h4,
.instinct-panel .body h5 {
  margin: 8px 0 3px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--reserve-text);
}
.instinct-panel .body code {
  font-size: .7rem;
  background: color-mix(in srgb, var(--reserve) 10%, transparent);
  border-radius: 4px;
  padding: 0 4px;
}

/* ── Compact document row indicators (overview tab) — square tiles ──────── */
.doc-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem; height: 1.25rem;
  border-radius: 6px;
  flex-shrink: 0;
}
.doc-indicator.legal-hold { background: var(--warning-soft); color: var(--warning-text); }

/* ── Coverage breakdown — dark-mode-safe colour overrides ──────────────── */
/* Row dividers — Tailwind's divide-y uses :not([hidden]) ~ :not([hidden])  */
#coverage-breakdown .divide-y > :not([hidden]) ~ :not([hidden]) { border-color: var(--border); }
/* Primary coverage tint (replaces bg-indigo-50/30) */
.coverage-row-primary { background: var(--reserve-soft); }
/* Claim-level reserve row with pending (replaces bg-amber-50/30) */
.coverage-row-pending { background: var(--surface-tint-amber); }
/* Assessed value column — adapts between light/dark (replaces text-sky-700/sky-900) */
.cb-assessed-lbl { color: var(--primary-text); }
.cb-assessed-val { color: var(--primary); }
/* Reserve column — adapts between light/dark (replaces text-indigo-700) */
.cb-reserve-lbl  { color: var(--reserve-text); }
.cb-reserve-val  { color: var(--reserve); }
/* Pending approval form panel (replaces hardcoded bg-amber-50 + amber borders) */
.tc-pending-panel {
  border-top: 1px solid var(--border);
  background: var(--surface-2); /* light grey form area, matching the Adjust Reserve panel */
  padding: 0.75rem 1.25rem;
}
.tc-pending-panel .pp-title {
  font-size: .75rem;
  font-weight: 600;
  color: var(--warning-text);
}
.tc-pending-panel .pp-label {
  display: block;
  font-size: .75rem;
  font-weight: 500;
  color: var(--warning-text);
  margin-bottom: .375rem;
}
/* Reactive "current → proposed" summary in the panel header — from + arrow are neutral, only the proposed value is emphasised. */
.tc-pending-panel .pp-delta { display: inline-flex; align-items: center; gap: .5rem; font-size: .8125rem; color: var(--text-3); }
.tc-pending-panel .pp-delta svg { width: .85rem; height: .85rem; flex: none; }
.tc-pending-panel .pp-delta .to { font-weight: 600; color: var(--text-2); transition: color .15s ease; }
.tc-pending-panel .pp-delta.is-changed .to { color: var(--warning-text); }

/* ===== Tab nav (claim detail) ===== */
.tc-tabnav {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 0 var(--s-3);
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}
.tc-tabnav::-webkit-scrollbar { display: none; }
.tc-tab {
  background: none;
  border: 0;
  padding: 10px var(--s-3);
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  color: var(--text-2);
  font-weight: 500;
  font-size: 13px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}
.tc-tab:hover { color: var(--text-1); }
.tc-tab[aria-selected="true"],
.tc-tab.active {
  color: var(--primary-text);
  border-bottom-color: var(--primary);
}
/* Rendered Description-of-Loss (Markdown → sanitised HTML). */
.dol-prose { font-size: 13px; line-height: 1.7; color: var(--text-1); overflow-wrap: anywhere; }
.dol-prose > :first-child { margin-top: 0; }
.dol-prose > :last-child { margin-bottom: 0; }
.dol-prose p { margin: 0 0 0.7rem; }
.dol-prose strong { font-weight: 600; color: var(--text-1); }
.dol-prose em { font-style: italic; }
.dol-prose h3, .dol-prose h4, .dol-prose h5 { font-weight: 600; font-size: 13px; margin: 0.9rem 0 0.3rem; color: var(--text-1); }
.dol-prose ul, .dol-prose ol { margin: 0 0 0.7rem 1.25rem; }
.dol-prose ul { list-style: disc; }
.dol-prose ol { list-style: decimal; }
.dol-prose li { margin: 0.15rem 0; }
.dol-prose blockquote { border-left: 2px solid var(--border); padding-left: 0.75rem; margin: 0 0 0.7rem; color: var(--text-2); }
.dol-prose code { font-size: 12px; background: var(--surface-2); padding: 0 0.25rem; border-radius: 4px; }
/* Word-level diff over .dol-prose (DOL review): additions green, removals struck red. */
.dol-diff ins { text-decoration: none; background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success-text); border-radius: 2px; padding: 0 1px; }
.dol-diff del { text-decoration: line-through; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger-text); border-radius: 2px; padding: 0 1px; }

/* =============================================================
   Pill design language — category-led shapes (supersedes tc-pill)
   One `.pill` base; a CATEGORY modifier sets the FORM, a tone sets
   the COLOUR. Category is legible by shape, not hue alone:
     .pill--status   round, soft fill, leading dot   (lifecycle)
     .pill--outcome  solid fill + glyph              (decisions/approvals)
     .pill--level    soft fill + ordinal ramp        (priority/severity/level)
     .pill--meta     soft mono, uppercase, borderless (type/category)
     .pill--flag     icon-led, soft fill             (attributes/markers)
     .pill--count    compact mono numeric badge      (counts/metrics)
   ============================================================= */
.pill {
  --p-soft: var(--surface-2);
  --p-text: var(--text-2);
  --p-solid: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  white-space: nowrap;
  border: 0;
  border-radius: 999px;
  padding: 2px 9px;
}
.pill svg { width: 12px; height: 12px; flex: 0 0 auto; }
/* Off-screen holder for the <use> glyph sprite (see includes/_pill_glyphs.html). */
.pill-glyph-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* tones set colour only — the category modifier decides how they're used */
.pill.tone-neutral { --p-soft: var(--surface-2);        --p-text: var(--text-2);       --p-solid: var(--text-3); }
.pill.tone-success { --p-soft: var(--success-soft);     --p-text: var(--success-text); --p-solid: var(--success); }
.pill.tone-open    { --p-soft: var(--surface-tint-teal);--p-text: var(--success-text); --p-solid: var(--success); }
.pill.tone-info    { --p-soft: var(--primary-soft);     --p-text: var(--primary-text); --p-solid: var(--primary); }
.pill.tone-warning { --p-soft: var(--warning-soft);     --p-text: var(--warning-text); --p-solid: var(--warning); }
.pill.tone-danger  { --p-soft: var(--danger-soft);      --p-text: var(--danger-text);  --p-solid: var(--danger); }
.pill.tone-iris    { --p-soft: var(--reserve-soft);     --p-text: var(--reserve-text); --p-solid: var(--reserve); }

/* status — soft fill + leading state dot */
.pill--status { background: var(--p-soft); color: var(--p-text); }
.pill--status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--p-solid); flex: 0 0 auto; }

/* outcome (decision/approval) — solid fill + glyph (glyph supplied in markup) */
.pill--outcome { background: var(--p-solid); color: var(--on-solid); font-weight: 600; }
.pill--outcome.tone-neutral { background: var(--text-2); }

/* level (priority/severity) — soft fill + ordinal ramp; filled <i.on> count = severity (1–3) */
.pill--level { background: var(--p-soft); color: var(--p-text); font-weight: 600; border-radius: var(--r-xs); padding-left: 7px; }
.pill--level .lvl-ramp { display: inline-flex; align-items: flex-end; gap: 1.5px; }
.pill--level .lvl-ramp i { width: 3px; border-radius: 1px; background: var(--p-solid); opacity: .25; }
.pill--level .lvl-ramp i.on { opacity: 1; }
.pill--level .lvl-ramp i:nth-child(1) { height: 5px; }
.pill--level .lvl-ramp i:nth-child(2) { height: 7px; }
.pill--level .lvl-ramp i:nth-child(3) { height: 9px; }

/* meta (type/category) — soft mono, uppercase, borderless; neutral unless a tone is set */
.pill--meta {
  background: var(--p-soft); color: var(--p-text); border-radius: var(--r-xs);
  font-family: var(--f-mono); font-size: 12px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; padding: 1px 7px;
}

/* flag (attribute) — soft fill + leading icon; .icon-only for tight spaces (label via title) */
.pill--flag { background: var(--p-soft); color: var(--p-text); }
.pill--flag svg { color: var(--p-solid); }
.pill--flag.icon-only { padding: 3px; border-radius: 999px; }
.pill--flag.icon-only svg { width: 13px; height: 13px; }

/* count (count/metric) — compact mono badge; .solid for high-urgency counts only */
.pill--count {
  background: var(--p-soft); color: var(--p-text);
  border: 1px solid var(--border);
  font-family: var(--f-mono); font-weight: 600; font-size: 12px; line-height: 1;
  min-width: 18px; height: 18px; padding: 0 6px; justify-content: center;
}
.pill--count.solid { background: var(--p-solid); color: var(--on-solid); border-color: transparent; }
/* Zero/empty count — recede it (transparent fill + border, muted text) but keep it present. */
.pill--count.is-empty { background: transparent; color: var(--text-4); border-color: transparent; }

/* Setup-notice chips (the duplicate / unassigned / no-type strip) */
.bg-orange-50.text-orange-800,
.bg-amber-50.text-amber-800 {
  background: var(--warning-soft) !important;
  color: var(--warning-text) !important;
  border-color: rgba(168,101,12,0.18) !important;
}

/* ===== KPI tiles (used in design financial tab) ===== */
.tc-kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
}
.tc-kpi-row.cols-5 { grid-template-columns: repeat(5, 1fr); }
.tc-kpi-row.cols-4 { grid-template-columns: repeat(4, 1fr); }
.tc-kpi-row.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tc-kpi {
  padding: var(--s-3) var(--s-5);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px;
  min-width: 0;
}
.tc-kpi:last-child { border-right: 0; }
.tc-kpi .k-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-weight: 500;
}
.tc-kpi .k-value {
  font-family: var(--f-mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--text-1);
  letter-spacing: -0.01em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.tc-kpi .k-value.muted { color: var(--text-3); }
.tc-kpi .k-hint { font-size: 12px; color: var(--text-3); }
.tc-card-head .ch-meta { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.tc-card-head .ch-meta b { color: var(--text-2); font-weight: 500; }

/* Coverage Summary — exposure / funding bar (ported from Claude Design). */
.expo-wrap { padding: var(--s-3) var(--s-5) var(--s-4); border-top: 1px solid var(--border); }
.expo-bar { position: relative; }
.expo-track {
  display: flex;
  height: 10px;
  border-radius: 999px 0 0 999px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden;
}
.expo-seg { height: 100%; }
.expo-seg.paid    { background: var(--success); }
.expo-seg.reserve { background: var(--reserve); }
.expo-marker {
  position: absolute; top: -6px; bottom: -6px;
  width: 2px; background: var(--text-1);
  transform: translateX(-1px);
}
.expo-marker-lbl {
  position: absolute; top: -22px;
  font-family: var(--f-mono);
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--text-1); white-space: nowrap; text-align: center;
}
.expo-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-5); margin-top: var(--s-3); }
.expo-legend { display: flex; flex-wrap: wrap; gap: var(--s-5); font-size: 13px; color: var(--text-2); }
.expo-legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.expo-legend .sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.expo-legend .sw.paid { background: var(--success); }
.expo-legend .sw.reserve { background: var(--reserve); }
.expo-legend .sw.headroom { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border-strong); }
.expo-track.full { border-radius: 999px; }
.expo-legend b { color: var(--text-1); font-weight: 600; font-family: var(--f-mono); }
.expo-cap { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.expo-cap svg { width: 13px; height: 13px; flex: 0 0 auto; }
.expo-cap.ok     { color: var(--success-text); }
.expo-cap.warn   { color: var(--warning-text); }
.expo-cap.danger { color: var(--danger-text); }

/* "Set as primary" — subtle outlined header action. */
.cov-setprimary {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  padding: 4px 10px; border-radius: var(--r-sm);
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border-strong);
  cursor: pointer; transition: background 120ms ease, border-color 120ms ease;
}
.cov-setprimary svg { width: 12px; height: 12px; color: var(--text-3); }
.cov-setprimary:hover { background: var(--surface-2); border-color: var(--text-4); }
.cov-setprimary:disabled { opacity: 0.5; cursor: not-allowed; }

/* Deductible waive — outlined toggle button + inline reason form (replaces the modal). */
.cov-waive-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  padding: 3px 12px; border-radius: var(--r-sm);
  color: var(--primary-text); background: var(--surface);
  border: 1px solid var(--border-strong);
  cursor: pointer; transition: background 120ms ease, border-color 120ms ease;
}
.cov-waive-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.cov-waive-form { margin: 4px 0 10px; }
/* Shared inline reason editor (decision reason + deductible waiver) — single line, auto-grows (capped). */
.cd-reason-input {
  width: 100%; resize: none; overflow-y: auto;
  min-height: 30px; max-height: 140px;
  padding: 5px 10px; font-size: 13px; line-height: 1.4;
  color: var(--text-1); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.cd-reason-input::placeholder { color: var(--text-4); }
.cd-reason-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.cd-reason-input.is-error { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.cd-reason-input:disabled { opacity: .6; }

/* Coverage card detail — limits / deductibles / conditions (ported from Claude Design). */
.cd-sec {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em;
  font-weight: 600; color: var(--text-3);
  padding-bottom: 8px; margin-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
}
.cd-sec.gap { margin-top: var(--s-5); }
.cd-empty { margin: 0 0 var(--s-2); font-size: 13px; font-style: italic; color: var(--text-3); }
.cd-line { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); padding: 6px 0; }
.cd-l { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.cd-k { font-size: 14px; color: var(--text-2); }
.cd-sub { font-size: 12px; color: var(--text-3); }
.cd-r { display: flex; align-items: center; gap: var(--s-2); white-space: nowrap; }
.cd-v { font-size: 14px; font-weight: 600; color: var(--text-1); font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.cd-v.struck { text-decoration: line-through; color: var(--text-3); font-weight: 500; }
.cd-note { margin: 2px 0 4px; font-size: 13px; font-style: italic; color: var(--text-3); }
/* Click-to-edit decision reason — reads as text, hints it's editable on hover. */
.cd-note-btn { display: inline-flex; align-items: flex-start; gap: 4px; margin: 2px 0 4px;
  text-align: left; font-size: 13px; font-style: italic; color: var(--text-3); cursor: pointer; }
.cd-note-btn:hover { color: var(--text-2); }
.cd-note-btn:hover span { text-decoration: underline dotted; text-underline-offset: 2px; }
.cd-note-pencil { width: 12px; height: 12px; flex: none; margin-top: 2px; opacity: 0; transition: opacity .15s ease; }
.cd-note-btn:hover .cd-note-pencil { opacity: .65; }
.cd-consume { margin: 2px 0 8px; display: flex; flex-direction: column; gap: 5px; }
.cd-cbar { height: 6px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--border); overflow: hidden; }
.cd-cfill { height: 100%; border-radius: 999px; }
.cd-cfill.ok { background: var(--success); }
.cd-cfill.warn { background: var(--warning); }
.cd-cfill.danger { background: var(--danger); }
.cd-cmeta { font-size: 12px; color: var(--text-3); font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.cd-cmeta b.ok { color: var(--success-text); }
.cd-cmeta b.warn { color: var(--warning-text); }
.cd-cmeta b.danger { color: var(--danger); }
.tc-kpi.tone-claimed .k-value  { color: var(--primary-text); }
.tc-kpi.tone-claimed .k-label  { color: var(--primary-text); }
.tc-kpi.tone-approved .k-value { color: var(--success-text); }
.tc-kpi.tone-approved .k-label { color: var(--success-text); }
.tc-kpi.tone-reserve  .k-value { color: var(--reserve-text); }
.tc-kpi.tone-reserve  .k-label { color: var(--reserve-text); }
.tc-kpi.tone-warning  .k-value { color: var(--warning-text); }
.tc-kpi.tone-warning  .k-label { color: var(--warning-text); }
/* Soft tints — reserve (iris/indigo) and paid (teal/green) KPI cards. */
.tc-kpi.tone-reserve { background: var(--surface-tint-iris); }
.tc-kpi.tone-paid    { background: var(--surface-tint-teal); }

/* ===== buttons ===== */
/* Refresh the existing .btn rule to use new tokens. The base.html @apply
   chain still owns the spacing; we only re-tone the variants here. */
.btn-primary {
  color: var(--primary-text) !important;
  background-color: var(--primary-soft) !important;
  border-color: rgba(27,74,122,0.18) !important;
}
.btn-primary:hover {
  color: var(--on-solid) !important;
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
}
.btn-primary-solid {
  color: var(--on-solid) !important;
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  background-image: none !important;
}
.btn-primary-solid:hover,
.btn-primary-solid:active {
  background-color: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}
.btn-reserve { color: var(--reserve-text) !important; background: var(--reserve-soft) !important; border-color: rgba(91,79,190,0.18) !important; }
.btn-reserve:hover { color: var(--on-solid) !important; background: var(--reserve) !important; border-color: var(--reserve) !important; }
.btn-reserve-solid { color: var(--on-solid) !important; background-color: var(--reserve) !important; border-color: var(--reserve) !important; background-image: none !important; }
.btn-reserve-solid:hover { background-color: var(--reserve-hover) !important; border-color: var(--reserve-hover) !important; }
/* Corner notification dot (e.g. Suggested DOL). */
.has-notif { position: relative; }
.notif-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 9px;
  height: 9px;
  border-radius: 9999px;
  background: var(--warning);
  box-shadow: 0 0 0 2px var(--surface);
}
.btn-success { color: var(--success-text) !important; background: var(--success-soft) !important; border-color: rgba(14,122,95,0.18) !important; }
.btn-success:hover { color: var(--on-solid) !important; background: var(--success) !important; border-color: var(--success) !important; }
.btn-success-solid { color: var(--on-solid) !important; background-color: var(--success) !important; border-color: var(--success) !important; background-image: none !important; }
.btn-success-solid:hover { background-color: var(--success-hover) !important; border-color: var(--success-hover) !important; }
.btn-info { color: var(--primary-text) !important; background: var(--primary-soft) !important; border-color: rgba(27,74,122,0.12) !important; }
.btn-info:hover { color: var(--on-solid) !important; background: var(--primary) !important; border-color: var(--primary) !important; }
.btn-info-solid { color: var(--on-solid) !important; background-color: var(--primary) !important; border-color: var(--primary) !important; background-image: none !important; }
.btn-info-solid:hover { background-color: var(--primary-hover) !important; border-color: var(--primary-hover) !important; }
.btn-warning { color: var(--warning-text) !important; background: var(--warning-soft) !important; border-color: rgba(168,101,12,0.18) !important; }
.btn-warning:hover { color: var(--on-solid) !important; background: var(--warning) !important; border-color: var(--warning) !important; }
.btn-warning-solid { color: var(--on-solid) !important; background-color: var(--warning) !important; border-color: var(--warning) !important; background-image: none !important; }
.btn-warning-solid:hover { background-color: var(--warning-hover) !important; border-color: var(--warning-hover) !important; }
.btn-danger { color: var(--danger-text) !important; background: var(--danger-soft) !important; border-color: rgba(177,42,59,0.18) !important; }
.btn-danger:hover { color: var(--on-solid) !important; background: var(--danger) !important; border-color: var(--danger) !important; }
.btn-danger-solid { color: var(--on-solid) !important; background-color: var(--danger) !important; border-color: var(--danger) !important; background-image: none !important; }
.btn-danger-solid:hover { background-color: var(--danger-hover) !important; border-color: var(--danger-hover) !important; }
.btn-secondary { color: var(--text-2) !important; background: var(--surface) !important; border-color: var(--border) !important; }
.btn-secondary:hover { color: var(--text-1) !important; background: var(--surface-2) !important; border-color: var(--border-strong) !important; }

/* Section title — small uppercase label with bottom rule, used to divide
   modal bodies and dense forms into named groups. */
.tc-section-title {
  margin: 0 0 var(--s-3);
  padding-bottom: var(--s-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-2);
}
.tc-section-title .hint {
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-4);
}

/* Inline primary-coverage indicator — replaces the iris pill chip with a
   subtler star+text combo. Used wherever a coverage is the primary. */
.tc-primary-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--reserve-text);
  letter-spacing: 0.01em;
}
.tc-primary-mark svg { fill: var(--reserve); }

/* Replace the native select chrome on any <select> that opts into our input
   styling. We match the existing input border / radius / focus ring so a
   select reads as a peer of <input class="w-full">. */
select.w-full,
select.tc-select,
.tc-card select,
.tc-modal-foot select,
form select.border {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B7A8F'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 1.1em 1.1em;
  padding-right: 2.25rem;
  background-color: var(--surface);
}
select.w-full:focus,
select.tc-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
  outline: none;
}

/* tc-field — shared input/textarea sizing that lines up with the tc-combobox
   trigger (min-height 42px, 8px×12px padding, --r-md radius). Apply to every
   text input, textarea, and date input rendered inside a modal so neighbouring
   fields and dropdowns visually align. */
.tc-field {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0.5rem 0.75rem;
  font-size: 14px;
  color: var(--text-1);
  background-color: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea.tc-field { min-height: auto; line-height: 1.5; resize: vertical; }
.tc-field:hover { border-color: var(--border-strong); }
.tc-field:focus,
.tc-field:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.tc-field::placeholder { color: var(--text-4); }

/* MFA security modal — allauth content is rendered headless inside the modal, so the
   auth layout's scoped input styles don't ship with it. Mirror tc-field here. */
.mfa-modal-fragment input:not([type="checkbox"]):not([type="radio"]),
.mfa-modal-fragment select,
.mfa-modal-fragment textarea {
  display: block;
  width: 100%;
  min-height: 42px;
  padding: 0.5rem 0.75rem;
  font-size: 14px;
  color: var(--text-1);
  background-color: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.mfa-modal-fragment textarea { line-height: 1.5; resize: vertical; font-family: var(--font-mono, monospace); }
.mfa-modal-fragment input:not([type="checkbox"]):not([type="radio"]):hover,
.mfa-modal-fragment select:hover,
.mfa-modal-fragment textarea:hover { border-color: var(--border-strong); }
.mfa-modal-fragment input:not([type="checkbox"]):not([type="radio"]):focus,
.mfa-modal-fragment select:focus,
.mfa-modal-fragment textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.mfa-modal-fragment input::placeholder { color: var(--text-4); }
.mfa-modal-fragment input[disabled],
.mfa-modal-fragment textarea[disabled] {
  background-color: var(--surface-2);
  color: var(--text-3);
  cursor: not-allowed;
}
.mfa-modal-fragment input[type="checkbox"],
.mfa-modal-fragment input[type="radio"] { accent-color: var(--primary); }
.mfa-modal-fragment img { max-width: 220px; height: auto; margin: 0.25rem auto; display: block; }
.mfa-modal-fragment .errorlist { list-style: none; padding: 0; margin: 0.375rem 0 0; }
.mfa-modal-fragment .errorlist li { font-size: 0.75rem; color: var(--danger-text); }
.mfa-modal-fragment a:not(.btn):not(.inline-flex) { color: var(--primary); font-weight: 500; }
.mfa-modal-fragment a:not(.btn):not(.inline-flex):hover { color: var(--primary-hover); text-decoration: underline; }

/* tc-check — clean checkbox row for modal forms. */
.tc-check {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 100ms ease, background-color 100ms ease;
}
.tc-check:hover { border-color: var(--border-strong); background: var(--surface-2); }
.tc-check:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.tc-check .tc-check-input {
  width: 1rem;
  height: 1rem;
  margin-top: 2px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border-strong);
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.tc-check .tc-check-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.tc-check .tc-check-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.25;
}
.tc-check:has(input:checked) .tc-check-label { color: var(--primary-text); }
.tc-check .tc-check-desc {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  line-height: 1.35;
}

/* Compact tc-field variant for inline inputs (reply forms, filter bars, etc.)
   where the standard 42px field height would dominate its neighbours. */
.tc-field-sm {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 0.375rem 0.625rem;
  font-size: 13px;
  color: var(--text-1);
  background-color: var(--surface);
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
textarea.tc-field-sm { min-height: auto; line-height: 1.5; resize: vertical; }
.tc-field-sm:hover { border-color: var(--border-strong); }
.tc-field-sm:focus,
.tc-field-sm:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.tc-field-sm::placeholder { color: var(--text-4); }

/* tcCombobox — custom dropdown rendered around a hidden native <select>. */
.tc-combobox { position: relative; }
.tc-combobox .tc-combobox-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.tc-combobox-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 42px;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  background: var(--surface);
  font-size: 14px;
  color: var(--text-1);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.tc-combobox-trigger:hover { border-color: var(--border-strong); }
.tc-combobox-trigger:focus,
.tc-combobox-trigger:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.tc-combobox-trigger[aria-expanded="true"] {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
/* Compact variant — pairs with .tc-field-sm input sizing. */
.tc-combobox-trigger.is-sm {
  min-height: 34px;
  padding: 0.375rem 0.625rem;
  font-size: 13px;
}
.tc-combobox-trigger .tc-combobox-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tc-combobox-trigger .tc-combobox-label.is-placeholder { color: var(--text-4); }
.tc-combobox-trigger .tc-combobox-chev {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--text-3);
  transition: transform 150ms ease;
}
.tc-combobox-trigger[aria-expanded="true"] .tc-combobox-chev { transform: rotate(180deg); }

.tc-combobox-popover {
  position: absolute;
  z-index: 200;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.tc-combobox-option {
  display: flex;
  width: 100%;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-1);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.tc-combobox-option[data-active="true"] { background: var(--surface-2); }
.tc-combobox-option.is-selected { background: var(--primary-soft); color: var(--primary-text); }
.tc-combobox-option.is-selected .tc-combobox-option-desc { color: var(--primary-text); opacity: 0.75; }
.tc-combobox-option.is-disabled { color: var(--text-4); cursor: not-allowed; }
.tc-combobox-option-text { flex: 1 1 auto; min-width: 0; }
.tc-combobox-option-label { font-size: 14px; font-weight: 500; line-height: 1.35; }
.tc-combobox-option-desc {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-3);
}
.tc-combobox-option-check {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--primary-text);
}

/* Action menu — anchored popover for dispatched actions.
   Use .tc-combobox for value selection (different ARIA + keyboard model). */
.tc-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 14rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  z-index: 60;
  padding: 0.375rem;
}
.tc-menu.is-wide { min-width: 17rem; }

.tc-menu-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.375rem;
}
.tc-menu-head-meta { min-width: 0; flex: 1; }
.tc-menu-head-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tc-menu-head-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tc-menu-section {
  padding: 0.375rem 0.625rem 0.25rem;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-4);
}

.tc-menu-sep { height: 1px; margin: 0.375rem 0; background: var(--border); }
.tc-menu-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.4375rem 0.625rem;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  color: var(--text-2);
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background-color 100ms ease, color 100ms ease;
}
.tc-menu-item:hover,
.tc-menu-item:focus-visible { background: var(--surface-2); color: var(--text-1); outline: 0; }
.tc-menu-item .tc-menu-icon { width: 1rem; height: 1rem; color: var(--text-3); flex-shrink: 0; }
.tc-menu-item:hover .tc-menu-icon,
.tc-menu-item:focus-visible .tc-menu-icon { color: var(--text-2); }

.tc-menu-item.is-danger { color: var(--danger); }
.tc-menu-item.is-danger .tc-menu-icon { color: var(--danger); }
.tc-menu-item.is-danger:hover,
.tc-menu-item.is-danger:focus-visible { background: var(--danger-soft); color: var(--danger); }
.tc-menu-item.is-danger:hover .tc-menu-icon { color: var(--danger); }

.tc-menu-item.is-success { color: var(--success-text); }
.tc-menu-item.is-success .tc-menu-icon { color: var(--success); }
.tc-menu-item.is-success:hover,
.tc-menu-item.is-success:focus-visible { background: var(--success-soft); color: var(--success-text); }

.tc-menu-item.is-disabled { color: var(--text-4); cursor: not-allowed; pointer-events: none; }

/* Tone accents — colored icon + soft-tint hover, mirroring tc-card-head tints. */
.tc-menu-item.tone-iris .tc-menu-icon,
.tc-menu-item.tone-iris:hover .tc-menu-icon,
.tc-menu-item.tone-iris:focus-visible .tc-menu-icon { color: var(--reserve); }
.tc-menu-item.tone-iris:hover,
.tc-menu-item.tone-iris:focus-visible { background: var(--surface-tint-iris); color: var(--text-1); }

.tc-menu-item.tone-amber .tc-menu-icon,
.tc-menu-item.tone-amber:hover .tc-menu-icon,
.tc-menu-item.tone-amber:focus-visible .tc-menu-icon { color: var(--warning); }
.tc-menu-item.tone-amber:hover,
.tc-menu-item.tone-amber:focus-visible { background: var(--surface-tint-amber); color: var(--text-1); }

.tc-menu-item.tone-teal .tc-menu-icon,
.tc-menu-item.tone-teal:hover .tc-menu-icon,
.tc-menu-item.tone-teal:focus-visible .tc-menu-icon { color: var(--success); }
.tc-menu-item.tone-teal:hover,
.tc-menu-item.tone-teal:focus-visible { background: var(--surface-tint-teal); color: var(--text-1); }

.tc-menu-item.tone-blue .tc-menu-icon,
.tc-menu-item.tone-blue:hover .tc-menu-icon,
.tc-menu-item.tone-blue:focus-visible .tc-menu-icon { color: var(--primary); }
.tc-menu-item.tone-blue:hover,
.tc-menu-item.tone-blue:focus-visible { background: var(--surface-tint-blue); color: var(--text-1); }

.tc-menu-divider {
  height: 1px;
  margin: 0.375rem 0;
  background: var(--border);
  border: 0;
}

/* Modal footer — sticky bottom strip with gray fill and right-aligned actions. */
.tc-modal-foot {
  padding: var(--s-4) var(--s-5);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--s-2);
  background: var(--surface-2);
  border-bottom-left-radius: var(--r-xl);
  border-bottom-right-radius: var(--r-xl);
}

/* Bordered ghost button used for low-priority toggles like "Set as Primary"
   on coverage cards. Switches to iris when active. */
.btn-star {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn-star:hover { background: var(--surface-2); color: var(--text-1); }
.btn-star.is-primary {
  border-color: transparent;
  color: var(--reserve-text);
  background: var(--reserve-soft);
}
.btn-star.is-primary:hover { background: var(--reserve-soft); color: var(--reserve-text); }
.btn-star:disabled { opacity: 0.5; cursor: not-allowed; }
/* Square icon-only variant — matched header-action toolbar (Instinct + Edit). */
.btn-star.btn-star-icon { padding: 0; width: 1.9rem; height: 1.9rem; justify-content: center; gap: 0; }
/* Compact label variant — sized to the provenance tag (.btn-star sets 12.5px,
   so a utility class can't win the cascade; do it here). */
.btn-star.btn-star-sm { font-size: .68rem; padding: 4px 9px; }

/* Quick Actions button: collapse the rainbow gradient to a calm primary solid */
.btn-quick-actions {
  background-image: none !important;
  background-color: var(--primary) !important;
  color: var(--on-solid) !important;
  border: 1px solid var(--primary) !important;
  box-shadow: var(--shadow-sm) !important;
}
.btn-quick-actions:hover {
  background-color: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
}

/* ===== money + number helpers (apply on top of Tailwind classes) ===== */
.amount-pos { color: var(--success-text); }
.amount-reserve { color: var(--reserve-text); }
.amount-warning { color: var(--warning-text); }
.amount-zero { color: var(--text-3); }

/* Re-tone the dense money classes used in KPIs + tables so they share the
   palette without rewriting partials. */
.text-emerald-600,
.text-emerald-700 { color: var(--success-text) !important; }
.text-indigo-600,
.text-indigo-700 { color: var(--reserve-text) !important; }
.text-amber-600,
.text-amber-700,
.text-orange-600 { color: var(--warning-text) !important; }
.text-red-600,
.text-red-700 { color: var(--danger) !important; }
.text-blue-600,
.text-blue-700,
.text-blue-800,
.text-blue-900 { color: var(--primary-text) !important; }
.text-emerald-900,
.text-green-900 { color: var(--success-text) !important; }
.text-yellow-800,
.text-amber-800,
.text-amber-900 { color: var(--warning-text) !important; }

/* Soft chip backgrounds used in KPI tiles — bring them to the new palette */
.bg-emerald-50, .bg-green-50 { background-color: var(--surface-tint-teal) !important; }
.bg-indigo-50  { background-color: var(--surface-tint-iris) !important; }
.bg-amber-50, .bg-yellow-50, .bg-orange-50 { background-color: var(--surface-tint-amber) !important; }
.bg-blue-50    { background-color: var(--surface-tint-blue) !important; }
.bg-red-50, .bg-rose-50 { background-color: var(--danger-soft) !important; }
.border-emerald-100, .border-emerald-200, .border-emerald-400 { border-color: rgba(14,122,95,0.22) !important; }
.border-indigo-100, .border-indigo-200, .border-indigo-300 { border-color: rgba(91,79,190,0.22) !important; }
.border-amber-100, .border-amber-200, .border-amber-300 { border-color: rgba(168,101,12,0.22) !important; }
.border-blue-100, .border-blue-200, .border-blue-300 { border-color: rgba(27,74,122,0.22) !important; }

/* Solid background swatches in legends / dots */
.bg-emerald-500, .bg-emerald-600 { background-color: var(--success) !important; }
.bg-indigo-500, .bg-indigo-600 { background-color: var(--reserve) !important; }
.bg-amber-500, .bg-amber-600, .bg-yellow-500 { background-color: var(--warning) !important; }
.bg-blue-500, .bg-blue-600 { background-color: var(--primary) !important; }
.bg-red-500, .bg-red-600 { background-color: var(--danger) !important; }
/* White text on those re-skinned solids must flip with the theme too */
.bg-emerald-500.text-white, .bg-emerald-600.text-white,
.bg-indigo-500.text-white, .bg-indigo-600.text-white,
.bg-amber-500.text-white, .bg-amber-600.text-white, .bg-yellow-500.text-white,
.bg-blue-500.text-white, .bg-blue-600.text-white,
.bg-red-500.text-white, .bg-red-600.text-white { color: var(--on-solid) !important; }
/* Same for templates that pair text-white with a token fill via arbitrary
   values, e.g. class="bg-[color:var(--primary)] text-white" */
.bg-\[color\:var\(--primary\)\].text-white,
.bg-\[color\:var\(--primary-hover\)\].text-white,
.bg-\[color\:var\(--success\)\].text-white,
.bg-\[color\:var\(--reserve\)\].text-white,
.bg-\[color\:var\(--warning\)\].text-white,
.bg-\[color\:var\(--danger\)\].text-white { color: var(--on-solid) !important; }

/* ===== Legacy light-hardcoded Tailwind utilities → tokens.
   These render as bright/white artifacts in dark mode; in light mode the
   token values are visually identical (or near-identical) to the original
   Tailwind colors, so light mode is unchanged. ===== */

/* Tailwind preflight defaults every border to #e5e7eb and every ring offset
   to #fff — both glow on dark surfaces whenever a `border`/ring class lacks
   an explicit (compiled) color. Re-declare at the same zero specificity so
   any class-level color still wins. */
*, ::before, ::after {
  border-color: var(--border);
  --tw-ring-offset-color: var(--surface);
}

/* Rings — `ring-white` is a masking halo (e.g. timeline avatars); it must
   match the surface it sits on, not stay literally white. */
.ring-white { --tw-ring-color: var(--surface) !important; }
.ring-gray-200 { --tw-ring-color: var(--border) !important; }
.ring-gray-300 { --tw-ring-color: var(--border-strong) !important; }

/* Borders & dividers */
.border-gray-100, .border-gray-200, .border-slate-200 { border-color: var(--border) !important; }
.border-gray-300, .border-gray-400, .border-gray-900 { border-color: var(--border-strong) !important; }
.divide-gray-100 > :not([hidden]) ~ :not([hidden]),
.divide-gray-200 > :not([hidden]) ~ :not([hidden]) { border-color: var(--border) !important; }

/* Light surface fills */
.bg-gray-50, .bg-slate-50, .bg-gray-100, .bg-slate-100 { background-color: var(--surface-2) !important; }
.bg-amber-50 { background-color: var(--surface-tint-amber) !important; }
.text-amber-600, .text-amber-700, .text-amber-800, .text-amber-900 { color: var(--warning-text) !important; }

/* Dark emphasis fills (active filter chips, inverted badges). --tooltip-bg is
   the existing "stable dark emphasis" token: ≈gray-900 in light mode, a
   lifted slate in dark mode so white text stays readable without glare. */
.bg-gray-900, .bg-slate-900, .bg-slate-800 { background-color: var(--tooltip-bg) !important; }

/* ===== tables: soften existing table styling app-wide. Scoped to legacy
   tables only (not tc-table) so the design-system tables can keep their
   transparent thead background. */
table.w-full:not(.tc-table) thead th {
  background-color: var(--surface-2) !important;
  color: var(--text-3) !important;
  font-weight: 600 !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 12px !important;
}

/* Tabular numerals everywhere it matters */
.tabular-nums, td.tabular-nums { font-variant-numeric: tabular-nums; }

/* ===== inputs: focus ring to brand navy ===== */
input:focus, select:focus, textarea:focus {
  outline: none;
}
.focus\:ring-blue-500:focus,
.focus\:ring-indigo-500:focus,
.focus\:ring-blue-500\/40:focus { --tw-ring-color: rgba(27,74,122,0.30) !important; }
.focus\:border-blue-500:focus,
.focus\:border-indigo-500:focus { border-color: var(--primary) !important; }

/* ===== Sidebar / authenticated nav refinements ===== */
aside .nav-link-active,
.nav-link-active {
  background-color: var(--primary-soft) !important;
  color: var(--primary-text) !important;
}

/* bg-gray-50 legacy compat (old templates not yet migrated) */
main.bg-gray-50 { background: var(--bg) !important; }

/* ===== Modal headers: standardise the gradient bands into uniform tints ===== */
.rounded-t-xl.bg-gradient-to-r {
  background-image: none !important;
}

/* ===== Light empty-state polish ===== */
.text-gray-300 { color: var(--text-4) !important; }

/* ===== Responsive collapse for stat strip ===== */
@media (max-width: 1100px) {
  .tc-statstrip { grid-template-columns: repeat(3, 1fr); }
  .tc-kpi-row { grid-template-columns: repeat(2, 1fr) !important; }
  .tc-kpi { border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 768px) {
  .tc-claim-header { grid-template-columns: 1fr; }
  .tc-claim-header > .ch-top { border-right: 0; border-bottom: 1px solid var(--border); grid-column: 1; }
  .tc-claim-header > .tc-statstrip { grid-column: 1; grid-row: 2; }
  .tc-claim-header > .tc-attention { grid-row: 3; }
  .tc-statstrip { grid-template-columns: repeat(2, 1fr); }
  .tc-statstrip .cell { border-right: 0; border-bottom: 1px solid var(--border); }
}
@media (max-width: 480px) {
  .tc-statstrip { grid-template-columns: 1fr; }
  .tc-kpi-row { grid-template-columns: 1fr !important; }
}

/* ===== Application shell — sidebar + top bar ============================
   Collapsed state is driven by html[data-sidebar-collapsed="true"], set
   synchronously by an inline <head> script in base.html (avoids flicker)
   and toggled via toggleSidebar() in the body x-data. */

.shell-sidebar {
  width: 16rem;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 160ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* Sidebar shows wordmark by default; only swap to the symbol on desktop when
   collapsed. Mobile uses the off-canvas drawer at full width regardless. */
.shell-sidebar .shell-brand-symbol { display: none; }
@media (min-width: 1024px) {
  /* overflow:visible after the 160ms collapse so tooltips escape the sidebar;
     the delay keeps content clipped during the width animation itself. */
  html[data-sidebar-collapsed="true"] .shell-sidebar {
    width: 3.5rem;
    overflow: visible;
    transition: width 160ms cubic-bezier(0.4, 0, 0.2, 1), overflow 0s 160ms;
  }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-nav { overflow: visible; }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-brand { padding: 0; }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-brand-link { flex: 0 0 auto; }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-brand-full { display: none; }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-brand-symbol { display: inline-flex; }
  /* Smooth label fade-out — max-width collapses and opacity fades together */
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-nav-item .shell-nav-label {
    max-width: 0;
    opacity: 0;
    margin-left: 0;
  }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-section-label {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
  }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-chevron,
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-submenu { display: none; }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-cta-button .shell-nav-label { display: none; }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-nav-item { justify-content: center; padding: 0.5rem; }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-cta { padding: 0.25rem 0.5rem 0.5rem; }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-cta-button { padding: 0.5rem; }
  html[data-sidebar-collapsed="true"] .shell-sidebar .shell-nav-section { margin-top: 0.5rem; }
}

.shell-sidebar .shell-brand {
  height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.75rem;
  width: 100%;
}
.shell-sidebar .shell-brand-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  color: inherit;
}
.shell-sidebar .shell-brand-full svg { height: 1.625rem; width: auto; display: block; }
.shell-sidebar .shell-brand-symbol svg { height: 2.5rem; width: auto; display: block; }

/* Sidebar primary CTA (Submit Claim) */
.shell-cta {
  padding: 0.25rem 0.75rem 0.75rem;
}
.shell-cta-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5625rem 0.875rem;
  background: var(--primary);
  color: var(--on-solid);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--r-md);
  transition: background-color 100ms ease;
  position: relative;
}
.shell-cta-button > svg { flex-shrink: 0; }
.shell-cta-button:hover { background: var(--primary-hover); }

/* overflow-x hidden: overflow-y:auto alone computes overflow-x to auto, so
   wide content (e.g. hidden nowrap tooltips) would spawn a horizontal
   scrollbar. */
.shell-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0.5rem; }
.shell-nav::-webkit-scrollbar { width: 4px; }
.shell-nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

.shell-nav-section { margin-top: 1rem; }
.shell-nav-section:first-child { margin-top: 0.25rem; }
.shell-nav-section .shell-section-label {
  display: block;
  padding: 0 0.75rem;
  margin-bottom: 0.375rem;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-4, #94a3b8);
  max-height: 2rem;
  overflow: hidden;
  opacity: 1;
  transition: max-height 160ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 130ms ease,
              margin-bottom 160ms cubic-bezier(0.4, 0, 0.2, 1);
}

.shell-nav-item {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0.5rem 0.75rem;
  font-size: 13px;
  color: var(--text-2);
  border-radius: var(--r-md);
  transition: background-color 100ms ease, color 100ms ease;
  white-space: nowrap;
  position: relative;
}
.shell-nav-item .shell-nav-label {
  flex-shrink: 1;
  min-width: 0;
  margin-left: 0.625rem;
  max-width: 200px;
  overflow: hidden;
  opacity: 1;
  transition: max-width 160ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 130ms ease,
              margin-left 160ms cubic-bezier(0.4, 0, 0.2, 1);
}
/* Submenu items have no icon — reset the margin-left offset */
.shell-submenu .shell-nav-item .shell-nav-label {
  margin-left: 0;
  max-width: none;
  transition: none;
}
.shell-nav-item:hover { background: var(--surface-2); color: var(--text-1); }
.shell-nav-item .shell-icon { flex-shrink: 0; width: 1.125rem; height: 1.125rem; color: var(--text-3); }
.shell-nav-item:hover .shell-icon { color: var(--text-1); }
.shell-nav-item.is-active {
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 500;
}
.shell-nav-item.is-active .shell-icon { color: var(--primary); }
.shell-nav-item .shell-chevron {
  margin-left: auto;
  width: 0.875rem;
  height: 0.875rem;
  color: var(--text-4);
}

.shell-submenu {
  margin-top: 0.125rem;
  padding-left: 1.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.shell-submenu .shell-nav-item { padding: 0.375rem 0.5rem; font-size: 13px; }

/* ----- Top bar ----- */

.shell-topbar {
  position: relative;
  height: 3.25rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.25rem;
  background: transparent;
}

.shell-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: background-color 100ms ease, color 100ms ease;
}
.shell-icon-btn:hover { background: var(--surface-2); color: var(--text-1); }

/* Semantic action icon buttons — View / Edit / Add / Delete / Archive / Restore */
.tc-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: var(--r-sm);
  transition: background-color 100ms ease;
  cursor: pointer;
  position: relative;
}
.tc-action-btn.is-view    { background: var(--surface-tint-blue);  color: var(--primary); }
.tc-action-btn.is-view:hover    { background: var(--primary-soft); }
.tc-action-btn.is-edit    { background: var(--surface-2);           color: var(--text-2);  }
.tc-action-btn.is-edit:hover    { background: var(--border);         color: var(--text-1);  }
.tc-action-btn.is-add     { background: var(--surface-tint-teal);   color: var(--success); }
.tc-action-btn.is-add:hover     { background: var(--success-soft);   }
.tc-action-btn.is-archive { background: var(--surface-tint-amber);  color: var(--warning); }
.tc-action-btn.is-archive:hover { background: var(--warning-soft);  }
.tc-action-btn.is-restore { background: var(--surface-tint-teal);   color: var(--success); }
.tc-action-btn.is-restore:hover { background: var(--success-soft);  }
.tc-action-btn.is-delete        { background: var(--danger-soft); color: var(--danger); }
.tc-action-btn.is-delete:hover  { background: color-mix(in srgb, var(--danger-soft) 70%, var(--border)); }

.shell-palette-trigger {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 36rem;
  max-width: calc(100% - 28rem);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4375rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-3);
  font-size: 13px;
  cursor: pointer;
  transition: background-color 100ms ease, border-color 100ms ease, box-shadow 100ms ease;
}
.shell-palette-trigger:hover { border-color: var(--border-strong, var(--text-4)); box-shadow: 0 1px 3px rgb(15 23 42 / 0.06); }
.shell-palette-kbds {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}
.shell-palette-trigger .kbd {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--text-3);
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
/* Cmd key only shows on Mac (data-platform set synchronously in <head>) */
.shell-palette-kbds .kbd-cmd { display: none; }
html[data-platform="mac"] .shell-palette-kbds .kbd-cmd { display: inline-flex; }
html[data-platform="mac"] .shell-palette-kbds .kbd-ctrl { display: none; }

/* ----- User menu avatar ----- */

.shell-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.shell-avatar-lg {
  width: 2.5rem;
  height: 2.5rem;
  font-size: 14px;
}

/* User chip on top bar — avatar + name/email + chevron */
.shell-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.1875rem 0.625rem 0.1875rem 0.25rem;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}
.shell-user-chip:hover {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04);
}
.shell-user-chip[aria-expanded="true"] {
  background: var(--surface);
  border-color: var(--border-strong, var(--border));
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.06);
}
.shell-user-chip .shell-user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.2;
  max-width: 12rem;
}
.shell-user-chip .shell-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  letter-spacing: -0.005em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.shell-user-chip .shell-user-email {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 400;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.shell-user-chip .shell-user-chevron {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--text-4, #94a3b8);
  flex-shrink: 0;
  transition: transform 120ms ease, color 120ms ease;
}
.shell-user-chip:hover .shell-user-chevron { color: var(--text-2); }
.shell-user-chip .shell-user-meta,
.shell-user-chip .shell-user-chevron { display: none; }
.shell-user-chip { padding: 0.25rem; }


/* ----- Command palette ----- */

.cmdk-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgb(15 23 42 / 0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6rem 1rem 1rem;
}
.cmdk-panel {
  width: 100%;
  max-width: 38rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.cmdk-input-row .cmdk-icon { width: 1.125rem; height: 1.125rem; color: var(--text-3); flex-shrink: 0; }
.cmdk-input-row input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 15px;
  color: var(--text-1);
}
.cmdk-input-row input::placeholder { color: var(--text-3); }
.cmdk-body { max-height: 24rem; overflow-y: auto; padding: 0.5rem 0; }
.cmdk-group-label {
  padding: 0.375rem 1rem 0.25rem;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-4);
}
.cmdk-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5625rem 1rem;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
  width: 100%;
}
.cmdk-item:hover, .cmdk-item[data-active="true"] { background: var(--surface-2); color: var(--text-1); }
.cmdk-item .cmdk-it-icon { width: 1rem; height: 1rem; color: var(--text-3); flex-shrink: 0; }
.cmdk-item .cmdk-it-icon svg { width: 1rem; height: 1rem; }
.cmdk-item .cmdk-it-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-item .cmdk-it-mono { font-family: var(--f-mono); font-size: 13px; }
.cmdk-item .cmdk-it-kind {
  font-size: 12px;
  color: var(--text-4, #94a3b8);
  flex-shrink: 0;
  text-transform: capitalize;
  letter-spacing: 0.01em;
}
.cmdk-item .cmdk-it-meta { margin-left: auto; font-family: var(--f-mono); font-size: 12px; color: var(--text-4); }
.cmdk-empty { padding: 2rem 1rem; text-align: center; font-size: 13px; color: var(--text-3); }
.cmdk-foot {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
}
.cmdk-foot .kbd {
  font-family: var(--f-mono);
  font-size: 12px;
  padding: 1px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text-2);
}

/* Expandable timeline rows (used by policy history). */
.tc-timeline-details > summary { list-style: none; }
.tc-timeline-details > summary::-webkit-details-marker { display: none; }
.tc-timeline-details .tc-timeline-chev { transition: transform 150ms ease; }
.tc-timeline-details[open] .tc-timeline-chev { transform: rotate(180deg); }

/* Picker rows — selectable cards inside modal pickers (assign service area,
   etc.). Hide the native radio, swap to a small dot indicator on the left.
   Hover/checked states give clear feedback without disrupting the inline
   metadata grid on the right. */
.tc-pick-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: border-color 100ms ease, background-color 100ms ease, box-shadow 100ms ease;
}
.tc-pick-row:hover { border-color: var(--border-strong); background: var(--surface-2); }
.tc-pick-row.is-selected,
.tc-pick-row:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 1px var(--primary) inset;
}
.tc-pick-row .tc-pick-radio {
  position: relative;
  appearance: none;
  width: 1rem;
  height: 1rem;
  margin-top: 3px;
  border-radius: 999px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 100ms ease;
}
.tc-pick-row:hover .tc-pick-radio { border-color: var(--text-3); }
.tc-pick-row .tc-pick-radio:checked {
  border-color: var(--primary);
  background: var(--primary);
}
.tc-pick-row .tc-pick-radio:checked::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 999px;
  background: var(--surface);
}

/* Toasts — Django messages popovers (top-right). Minimal: clean surface card, thin border, light shadow, tone shown by the icon colour. */
.tc-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-family: var(--f-display);
  color: var(--text-1);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
}
.tc-toast.is-visible { opacity: 1; transform: translateY(0); }
.tc-toast-ico {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.tc-toast-ico svg { width: 1.125rem; height: 1.125rem; }
.tc-toast-body {
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-1);
  font-weight: 500;
}
.tc-toast-close {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  color: var(--text-4);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 100ms ease, color 100ms ease;
}
.tc-toast-close svg { width: 0.875rem; height: 0.875rem; }
.tc-toast-close:hover { background: var(--surface-2); color: var(--text-1); }
/* Tone — minimal: coloured icon only. */
.tc-toast--success .tc-toast-ico { color: var(--success); }
.tc-toast--danger  .tc-toast-ico { color: var(--danger); }
.tc-toast--warning .tc-toast-ico { color: var(--warning); }
.tc-toast--info    .tc-toast-ico { color: var(--primary); }

/* ===== Native <select> harmonisation =====
   Django widgets render bare <select> elements with the Tailwind CSS_INPUT
   chain — that strips the browser chevron only on some platforms. This rule
   restyles every <select> that uses the design-system input classes so they
   look like the tc-combobox trigger: rounded surface, custom chevron, hover
   + focus states matching the rest of the form chrome. */
select.tc-field,
select.tc-field-sm,
select.tc-combobox-native ~ select,
.tc-modal-foot select,
.tc-card select.form-control,
form[hx-post] select,
form[action] select,
.tc-page-header select,
.tc-filterbar select.tc-field-sm {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7A8F' stroke-width='2'><path stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  background-size: 1rem 1rem;
  padding-right: 1.875rem;
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  color: var(--text-1);
  cursor: pointer;
  transition: border-color 100ms ease, box-shadow 100ms ease;
}
select.tc-field:hover,
select.tc-field-sm:hover,
form select:hover { border-color: var(--border-strong); }
select.tc-field:focus,
select.tc-field-sm:focus,
form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* Card radius — matches Claim Detail's flatter section treatment. */
.tc-card-head { border-top-left-radius: 8px; border-top-right-radius: 8px; }
.tc-claim-header { border-radius: 8px; box-shadow: none; }
.tc-tabnav { border-radius: 8px; box-shadow: none; }

/* Policy-form-modal condition row: ensure each select keeps a usable width
   when its option list is unselected (otherwise the native <select> collapses
   to the chevron). */
.tc-modal-foot ~ form .condition-row > select,
form > [x-data] .grid select,
form select { min-width: 6rem; }

/* animate-ping — Tailwind's expanding-ring heartbeat keyframe.
   Not compiled into tailwind.staff.css because it wasn't used when the
   CSS was last built; defined here so we don't need a rebuild. */
@keyframes ping {
  75%, 100% { transform: scale(2); opacity: 0; }
}
.animate-ping {
  animation: ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;
}

/* ── Named utility classes (replaces inline styles to satisfy djlint H021) ── */

/* Unsaved-changes dot indicator — small circle coloured by semantic token. */
.dot-warning { background: var(--warning); }

/* Condition/rule form — operator <select> pinned to 8rem so tc-field-sm's
   width:100% cannot override it in a flex row. */
.op-select-fixed {
  flex: 0 0 8rem;
  width: 8rem;
}

/* Payment batch sub-row — first cell indentation + left accent line. */
.batch-subrow-num-cell {
  padding-left: 2.75rem;
  border-left: 2px solid rgba(167,139,250,0.4);
}

/* Tiny payment number text used in batch sub-rows. */
.text-10 {
  font-size: 12px;
}

/* Payment creation modal — height cap so body scrolls inside the modal. */
.payment-modal-card {
  max-height: calc(100vh - 8rem);
}

/* Approval notification dot — positioned just outside the bell icon. */
.approval-dot {
  top: -3px;
  right: -3px;
}

/* Pulse AI assistant widget — replaces inline styles (djlint H021). */
.pulse-panel {
  /* Fixed tall height — the modal does not grow/shrink with message count;
     the messages region flexes and scrolls within it. */
  height: min(720px, 88vh);
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 24px 64px rgba(0,0,0,0.12), 0 4px 16px rgba(0,0,0,0.06);
}
.pulse-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.pulse-avatar {
  background: var(--reserve-soft);
  border: 1px solid rgba(91,79,190,0.20);
  border-radius: var(--r-sm);
  color: var(--reserve);
}
.pulse-messages { background: var(--surface-2); }
.pulse-suggestion {
  background: var(--reserve-soft);
  border: 1px solid rgba(91,79,190,0.18);
  color: var(--reserve-text);
  border-radius: var(--r-sm);
  padding: 4px 10px;
}
.pulse-input-footer { border-top: 1px solid var(--border); }
.pulse-input { min-height: 42px; font-size: 14px; }
.pulse-input:focus {
  border-color: var(--reserve);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--reserve-soft);
}
.pulse-send { background: var(--reserve); }
.pulse-send:hover:not(:disabled) { background: var(--reserve-hover); }

/* Suggested-DOL review modal — fixed enlarged dimensions (arbitrary vh/rem
   Tailwind utilities aren't in the prebuilt sheet, so size it here). */
.dol-review-panel { max-height: 90vh; }
.dol-review-body  { height: 62vh; min-height: 26rem; }

/* Borderless Instinct provenance tag — same treatment as the Instinct
   Assessment panel header (.instinct-panel .head): small, uppercase, iris. */
.instinct-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--reserve-text);
}
.instinct-tag svg { width: 11px; height: 11px; }
.instinct-tag.is-user { color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════════════════
   DARK MODE
   html[data-theme="dark"] — explicit user preference only. The bootstrap
   script in base.html always sets data-theme to "light" or "dark"
   (default light); there is no system/auto mode.
   Token values are contrast-checked: text-1/2/3 ≥ 4.5:1 on --surface,
   semantic -text ≥ 4.5:1 on -soft tints, --on-solid ≥ 4.5:1 on solid fills.
   ═══════════════════════════════════════════════════════════════════════════ */
html[data-theme="dark"] {
  color-scheme: dark;
  /* Surfaces */
  --bg:                  #0E1117;
  --surface:             #161B27;
  --surface-2:           #1E2330;
  --surface-tint-blue:   rgba(110,155,204,0.12);
  --surface-tint-teal:   rgba(52,211,153,0.12);
  --surface-tint-iris:   rgba(167,139,250,0.12);
  --surface-tint-amber:  rgba(214,165,90,0.12);
  /* Borders — strong enough to be perceptible on dark surfaces */
  --border:              #313B4D;
  --border-strong:       #51607A;
  --border-input:        #3C4759;
  /* Text — full ramp passes AA on --surface except text-4 (muted tier) */
  --text-1:              #EEF2F7;   /* 14.9:1 */
  --text-2:              #AEB9C9;   /*  7.6:1 */
  --text-3:              #8A98AC;   /*  5.1:1 */
  --text-4:              #6F7E93;   /*  3.3:1 — placeholder/disabled only */
  /* Brand primary — cornflower blue */
  --primary:             #7FA8D4;
  --primary-hover:       #97BBDF;   /* lighten on hover in dark mode */
  --primary-dark:        #5585B8;
  --primary-soft:        rgba(127,168,212,0.16);
  --primary-text:        #9CC0E6;
  /* Success / teal */
  --success:             #3FD9A2;
  --success-hover:       #63E3B8;
  --success-soft:        rgba(63,217,162,0.16);
  --success-text:        #5BDDAC;
  /* Reserve / iris */
  --reserve:             #B49DFB;
  --reserve-hover:       #C7B6FC;
  --reserve-soft:        rgba(180,157,251,0.16);
  --reserve-text:        #BCA8FC;
  /* Warning / amber — muted bronze-gold (not neon) */
  --warning:             #D6A55A;
  --warning-hover:       #E3B871;
  --warning-soft:        rgba(214,165,90,0.16);
  --warning-text:        #E0B470;
  /* Danger */
  --danger:              #F4868A;
  --danger-hover:        #F8A0A3;
  --danger-soft:         rgba(244,134,138,0.16);
  --danger-text:         #F69A9D;
  /* Ink on solid semantic fills — dark navy on the light pastel fills */
  --on-solid:            #0B1220;
  /* Shadows */
  --shadow-sm:           0 1px 2px rgba(0,0,0,0.4);
  --shadow-md:           0 2px 8px rgba(0,0,0,0.5), 0 1px 2px rgba(0,0,0,0.4);
  --shadow-lg:           0 10px 24px rgba(0,0,0,0.6), 0 4px 8px rgba(0,0,0,0.5);
  /* Tooltips — slightly lighter than bg so they stand out in dark mode */
  --tooltip-bg:          #334155;
  --tooltip-text:        #F1F5F9;
}

html[data-theme="dark"] .pulse-avatar    { border-color: rgba(127,168,212,0.3); }
html[data-theme="dark"] .pulse-suggestion { border-color: rgba(127,168,212,0.25); }

/* Rich tooltip — use when the label is a full sentence that needs wrapping. */
.tc-tip-host { position: relative; display: inline-block; }
.tc-tip {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  width: 13rem;
  padding: 6px 10px;
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  font-family: var(--f-display, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: normal;
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 9999;
  white-space: normal;
  text-align: left;
}
/* Arrow pointing up */
.tc-tip::before {
  content: '';
  position: absolute;
  bottom: 100%;
  right: 1rem;
  border: 5px solid transparent;
  border-bottom-color: var(--tooltip-bg);
}
.tc-tip-host:hover .tc-tip,
.tc-tip-host:focus-within .tc-tip { opacity: 1; }

/* Quiet hover affordance for tooltip-bearing text — dotted underline + help cursor. */
.tc-help {
  cursor: help;
  text-decoration: underline dotted;
  text-decoration-color: var(--text-4);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
.tc-help:hover { text-decoration-color: var(--text-3); }

/* Universal tooltip — any [data-tooltip] element with position:relative.
   .tc-tooltip adds position:relative + overflow:visible for un-positioned elements. */
.tc-tooltip { position: relative; overflow: visible; }

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--tooltip-bg);
  color: var(--tooltip-text);
  /* Pin typography so tooltips don't inherit the host's font/case/spacing. */
  font-family: var(--f-display, system-ui, sans-serif);
  font-size: 12px;
  font-weight: 500;
  font-style: normal;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
  padding: 4px 9px;
  border-radius: var(--r-xs);
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 9999;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
[data-tooltip]::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--tooltip-bg);
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 9999;
}
[data-tooltip]:hover::after,
[data-tooltip]:hover::before { opacity: 1; }

/* Tooltip positioned to the right — use data-tooltip-pos="right" */
[data-tooltip][data-tooltip-pos="right"]::after {
  bottom: auto;
  top: 50%;
  left: calc(100% + 8px);
  transform: translateY(-50%);
}
[data-tooltip][data-tooltip-pos="right"]::before {
  bottom: auto;
  top: 50%;
  left: calc(100% + 1px);
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--tooltip-bg);
  border-top-color: transparent;
}

/* Tooltip positioned below — use data-tooltip-pos="bottom" */
[data-tooltip][data-tooltip-pos="bottom"]::after {
  top: calc(100% + 6px);
  bottom: auto;
}
[data-tooltip][data-tooltip-pos="bottom"]::before {
  top: calc(100% + 2px);
  bottom: auto;
  border: 4px solid transparent;
  border-bottom-color: var(--tooltip-bg);
  border-top-color: transparent;
}

/* Expanded sidebar: nav tooltips are redundant (the label is visible) and
   their always-present nowrap pseudo-elements widen the nav's scrollable
   area — suppress them; they only render when the sidebar is collapsed. */
html:not([data-sidebar-collapsed="true"]) .shell-sidebar .shell-nav-item[data-tooltip]::after,
html:not([data-sidebar-collapsed="true"]) .shell-sidebar .shell-nav-item[data-tooltip]::before {
  display: none;
}

/* Collapsed sidebar nav + CTA tooltips appear to the right of the icon */
html[data-sidebar-collapsed="true"] .shell-sidebar .shell-nav-item[data-tooltip]::after,
html[data-sidebar-collapsed="true"] .shell-sidebar .shell-cta-button[data-tooltip]::after {
  bottom: auto;
  top: 50%;
  left: calc(100% + 10px);
  transform: translateY(-50%);
  white-space: nowrap;
}
html[data-sidebar-collapsed="true"] .shell-sidebar .shell-nav-item[data-tooltip]::before,
html[data-sidebar-collapsed="true"] .shell-sidebar .shell-cta-button[data-tooltip]::before {
  bottom: auto;
  top: 50%;
  left: calc(100% + 3px);
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-right-color: var(--tooltip-bg);
  border-top-color: transparent;
}

/* ═══════════════════════════════════════════════════════════════════════════
   NATIVE DATE / DATETIME-LOCAL INPUTS
   Styled to match .tc-field and .tc-field-sm. The browser-native calendar
   popup inherits dark/light mode automatically via color-scheme on the input.
   ═══════════════════════════════════════════════════════════════════════════ */
input[type="date"],
input[type="datetime-local"] {
  color-scheme: light;
}
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="datetime-local"] { color-scheme: dark; }

/* Row flash after a successful assignment — theme-aware success tint.
   !important so it wins over row hover/zebra backgrounds, like the old
   inline style did. */
.row-assigned-flash { background: var(--success-soft) !important; }

/* Calendar icon — tint to match our text-3 token */
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
  opacity: 0.5;
  cursor: pointer;
  border-radius: 2px;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* ── Notes: inline @mention token + rich-text body ─────────────────────────── */
.note-mention {
  display: inline-block;
  padding: 0 4px;
  border-radius: var(--r-sm, 4px);
  background: var(--blue-3, #e6f0fe);
  color: var(--blue-11, #1d6fdb);
  font-weight: 500;
  white-space: nowrap;
}
.note-body > :first-child { margin-top: 0; }
.note-body > :last-child { margin-bottom: 0; }
.note-body p { margin: 0 0 0.5rem; }
.note-body ul, .note-body ol { margin: 0 0 0.5rem; padding-left: 1.25rem; }
.note-body ul { list-style: disc; }
.note-body ul ul { list-style: circle; }
.note-body ul ul ul { list-style: square; }
.note-body ol { list-style: decimal; }
.note-body a { color: #2563eb; text-decoration: underline; }
.note-body u { text-decoration: underline; }
/* Floating notes popup: keep the card header in view while the notes list scrolls. */
.notes-popup > .tc-card { display: flex; flex-direction: column; }
.notes-popup .tc-card-head { position: sticky; top: 0; z-index: 2; }
