/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --c-primary:      #2563eb;
  --c-primary-dark: #1d4ed8;
  --c-secondary:    #64748b;
  --c-bg:           #f1f5f9;
  --c-surface:      #ffffff;
  --c-border:       #e2e8f0;
  --c-text:         #1e293b;
  --c-text-muted:   #64748b;
  --c-green:        #16a34a;
  --c-green-bg:     #f0fdf4;
  --c-yellow:       #d97706;
  --c-yellow-bg:    #fffbeb;
  --c-red:          #dc2626;
  --c-red-bg:       #fef2f2;
  --c-success:      #15803d;
  --c-success-bg:   #dcfce7;
  --radius:         8px;
  --radius-sm:      4px;
  --shadow:         0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:      0 4px 12px rgba(0,0,0,.12);
  --font:           -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  /* Never let the engine FAKE a weight/slant the family does not have.
     Synthesized bold is exactly what "the whole app went bold" looks like
     when a font resolution hiccups in WebView2. */
  font-synthesis: none;
}

/* Form controls do NOT inherit typography from the page — that is a UA
   default, not an oversight of ours. Any control a class rule misses would
   otherwise render in the engine's own font (serif/monospace, often heavier),
   which reads as "the fonts changed". Normalise them all. */
input, textarea, select, button, optgroup, option {
  font-family: inherit;
  font-synthesis: none;
}

/* ── Utility ──────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── App header ───────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 48px;
  background: var(--c-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-title { font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.header-right { display: flex; align-items: center; gap: 10px; }
.env-badge {
  padding: 3px 10px;
  border: none;
  border-radius: 12px;
  background: rgba(255,255,255,.18);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter .15s;
}
.env-badge:hover { filter: brightness(1.25); }

/* Credential-status hint under each password field in Settings. */
.cred-status {
  font-size: 12px;
  margin: 4px 0 2px;
  min-height: 1em;
}
.cred-status-present { color: var(--c-green); }
.cred-status-missing { color: var(--c-yellow); }
.icon-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.8);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.15); color: #fff; }

/* ── Screens ──────────────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: flex; flex-direction: column; }
#screen-review.active { display: flex; flex-direction: row; }

#app-main { flex: 1; min-height: 0; }
body { display: flex; flex-direction: column; }

/* ── Card ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--c-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-header { margin-bottom: 8px; }
.card-header h1 { font-size: 22px; font-weight: 700; color: var(--c-text); }
.card-header h2 { font-size: 18px; font-weight: 700; }
.card-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--c-border);
}
.subtitle { color: var(--c-text-muted); font-size: 13px; margin-top: 4px; }

/* ── Setup & env screens ──────────────────────────────────────────────────── */
#screen-setup,
#screen-env {
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 0px);
  padding: 32px 16px;
  background: var(--c-bg);
}
.setup-card, .env-card { max-width: 560px; width: 100%; }
.env-card { max-width: 380px; }

/* ── Input screen ─────────────────────────────────────────────────────────── */
.input-screen-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  padding: 32px 16px;
  background: var(--c-bg);
}
.input-card { max-width: 480px; width: 100%; }

/* ── Form elements ────────────────────────────────────────────────────────── */
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-muted);
  margin-bottom: 4px;
  margin-top: 4px;
}
.text-input {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.text-input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.text-input[readonly] { background: var(--c-bg); cursor: default; }
.text-input-lg { padding: 10px 14px; font-size: 15px; }
.select-input {
  padding: 7px 28px 7px 10px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
  cursor: pointer;
  appearance: auto;
}
.select-input:focus { border-color: var(--c-primary); }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--c-primary-dark); }
.btn-secondary {
  background: var(--c-surface);
  color: var(--c-secondary);
  border: 1px solid var(--c-border);
}
.btn-secondary:hover:not(:disabled) { background: var(--c-bg); }
.btn-lg { padding: 10px 28px; font-size: 15px; }

/* ── Row group (inline inputs) ────────────────────────────────────────────── */
.row-group { display: flex; gap: 8px; align-items: center; }
.row-group .text-input { flex: 1; }

/* ── Section labels ───────────────────────────────────────────────────────── */
.section-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text);
  padding-top: 12px;
  border-top: 1px solid var(--c-border);
  margin-top: 8px;
  cursor: default;
}
.section-label:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.optional-tag { font-weight: 400; color: var(--c-text-muted); font-size: 12px; }
details.collapsible-section { display: flex; flex-direction: column; gap: 8px; }
details.collapsible-section > summary { list-style: none; cursor: pointer; }
details.collapsible-section > summary::-webkit-details-marker { display: none; }
details.collapsible-section[open] > summary { margin-bottom: 4px; }

/* ── Environment-screen logging control ───────────────────────────────────── */
.env-log-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0 8px;
}
.env-log-row .field-label { margin: 0; white-space: nowrap; }
.env-log-row .select-input { flex: 0 0 auto; }
.env-log-hint {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--c-text-muted);
}
.env-log-hint.is-warn { color: var(--c-red); }

/* ── Radio group ──────────────────────────────────────────────────────────── */
.radio-group { display: flex; flex-direction: column; gap: 12px; padding: 16px 0; }
.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border: 2px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.radio-option:hover { border-color: var(--c-primary); background: #eff6ff; }
.radio-option.selected { border-color: var(--c-primary); background: #eff6ff; }
.radio-option input[type="radio"] { accent-color: var(--c-primary); width: 16px; height: 16px; margin-top: 3px; }
.radio-option-body { flex: 1; min-width: 0; }
.radio-option-label { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.radio-option-url-input {
  width: 100%;
  font-size: 12px;
  color: var(--c-text);
  padding: 6px 8px;
  border: 1px solid var(--c-border);
  border-radius: 4px;
  background: #fff;
  font-family: inherit;
}
.radio-option-url-input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}
.env-status { font-size: 13px; color: var(--c-text-muted); padding: 4px 0 8px; text-align: center; }
.env-status-error { color: var(--c-danger, #dc2626); }

/* ── Review screen ────────────────────────────────────────────────────────── */
.review-screen {
  height: calc(100vh - 48px);
  overflow: hidden;
}
.review-left {
  display: flex;
  flex-direction: column;
  width: 52%;
  min-width: 420px;
  border-right: 2px solid var(--c-border);
  background: var(--c-surface);
  overflow: hidden;
}
.review-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  overflow: hidden;
}
.review-panel-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-surface);
  flex-shrink: 0;
}
.review-panel-header h2 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.template-selector-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.template-selector-row .field-label { margin: 0; white-space: nowrap; }
.score-badge {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}
.score-high { background: var(--c-green-bg); color: var(--c-green); }
.score-med  { background: var(--c-yellow-bg); color: var(--c-yellow); }
.score-low  { background: var(--c-red-bg); color: var(--c-red); }
.client-county-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.client-badge {
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--c-primary);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.county-banner {
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: #eff6ff;
  color: var(--c-primary);
  font-size: 12px;
  font-weight: 600;
}
.county-banner.county-undetected { background: var(--c-yellow-bg); color: var(--c-yellow); }
/* "Will generate: …" letter-set preview (multi-letter clients, e.g. HMSA). */
.letters-preview {
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--c-bg, #f8fafc);
  color: var(--c-text-muted, #475569);
  font-size: 12px;
}
/* Selection notice (e.g. FEP manual process). */
.selection-notice {
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--c-yellow-bg);
  color: var(--c-yellow);
  font-size: 12px;
  font-weight: 600;
}

/* Red warning shown under the selection notice when changing the template
   re-anchors the field values. Stays until the next template change. */
.anchor-notice {
  margin-top: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--c-red-bg);
  color: var(--c-red);
  font-size: 12px;
  font-weight: 600;
}

/* Review-screen field group heading: which letter(s) of the set use the fields
   below it (Member + provider / provider only / facility address). */
.field-group-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 4px;
  padding: 0 20px 3px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.field-group-title:first-child { margin-top: 0; }
/* How many of the letter set's union of fields this group holds. */
.field-group-count {
  font-family: 'Consolas', 'Courier New', monospace;
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0;
  color: var(--c-text-muted);
  opacity: .8;
}

/* Non-blocking warning banner (e.g. multiple denial notes → used most recent). */
.notes-warning {
  margin: 8px 16px 0;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--c-yellow-bg);
  color: var(--c-yellow);
  border: 1px solid #fcd34d;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

/* Per-template state tally above the field list. */
.fields-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  padding: 7px 20px;
  border-bottom: 1px solid var(--c-border);
  background: #f8fafc;
  font-size: 11px;
  color: var(--c-text-muted);
  flex-shrink: 0;
}
.legend-total { font-weight: 700; color: var(--c-text); }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-item.legend-zero { opacity: .45; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* ── Fields list ──────────────────────────────────────────────────────────── */
.fields-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.field-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 20px;
  border-bottom: 1px solid var(--c-border);
  transition: background .1s;
}
.field-row:hover { background: #f8fafc; }
.field-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.dot-green  { background: var(--c-green); }
.dot-yellow { background: var(--c-yellow); }
/* Prefilled but must be read before mailing - deliberately the RED colour,
   same as a manual field, with its own state label (user ruling 2026-09-09). */
.dot-validate { background: var(--c-red); }
.dot-red    { background: var(--c-red); }
.field-body { flex: 1; min-width: 0; }
.field-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}
.field-head .field-placeholder { margin-bottom: 0; }
/* Per-field state name, so the colour is never the only signal. */
.field-state {
  flex-shrink: 0;
  margin-left: auto;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 8px;
}
.state-green    { color: var(--c-green);  background: var(--c-green-bg); }
.state-yellow   { color: var(--c-yellow); background: var(--c-yellow-bg); }
.state-validate { color: var(--c-red);    background: var(--c-red-bg); }
.state-red      { color: var(--c-red);    background: var(--c-red-bg); }
.field-placeholder {
  font-size: 11px;
  color: var(--c-text-muted);
  font-family: 'Consolas', 'Courier New', monospace;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.field-value-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 13px;
  color: var(--c-text);
  background: var(--c-surface);
  resize: none;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field-value-input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 2px rgba(37,99,235,.1); }
.field-value-input.is-red {
  border-color: var(--c-red);
  background: var(--c-red-bg);
}
.field-value-input.is-red::placeholder { color: var(--c-red); opacity: .7; }
/* Validate: prefilled, so no red fill - just the red border saying "read me". */
.field-value-input.is-validate { border-color: var(--c-red); }
.field-source {
  font-size: 10px;
  color: var(--c-text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Review footer ────────────────────────────────────────────────────────── */
.review-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--c-border);
  background: var(--c-surface);
  flex-shrink: 0;
}
.review-footer-right { display: flex; align-items: center; gap: 10px; }
.warning-tag {
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--c-red-bg);
  color: var(--c-red);
}

/* ── Note data panel (READ-ONLY reference) ────────────────────────────────── */
.readonly-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--c-border);
  color: var(--c-text-muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  vertical-align: middle;
}
.panel-caption {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-top: 6px;
}
/* Right-panel tabs */
.tab-bar {
  display: flex;
  gap: 4px;
}
.tab-btn {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--c-border);
  border-bottom: none;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: var(--c-bg);
  color: var(--c-text-muted);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s, color .15s;
}
.tab-btn:hover { background: #eef2f7; color: var(--c-text); }
.tab-btn.active {
  background: var(--c-surface);
  color: var(--c-primary);
  border-color: var(--c-primary);
  border-bottom: 2px solid var(--c-surface);
  margin-bottom: -1px;
}
/* Highlighted note block that a focused field was sourced/derived from */
.note-attr.highlighted {
  background: #fef9c3;            /* soft amber */
  border-radius: var(--radius-sm);
  margin-left: -8px;
  padding: 6px 8px;
  box-shadow: 0 0 0 1px #fde047;
  transition: background .2s, box-shadow .2s;
}
.note-attr.highlighted .note-attr-value { border-left-color: #ca8a04; }
.note-data-panel {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  /* Visually distinct from the editable left panel */
  background: var(--c-bg);
}
.note-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text);
  margin: 18px 0 10px;
  padding-bottom: 4px;
  border-bottom: 2px solid var(--c-border);
}
.note-section-title:first-child { margin-top: 0; }
.note-attr {
  margin-bottom: 14px;
}
.note-attr-key {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--c-text-muted);
  margin-bottom: 2px;
}
/* Plain text with a left rule — clearly NOT an input box, but still selectable. */
.note-attr-value {
  font-size: 13px;
  color: var(--c-text);
  background: transparent;
  padding: 1px 0 1px 10px;
  border: none;
  border-left: 2px solid var(--c-border);
  white-space: pre-wrap;
  line-height: 1.5;
  cursor: text;
}
.note-attr-empty { color: var(--c-text-muted); font-style: italic; }

/* ── Collapsible blocks (All Notes list + Line Items) ───────────────────────── */
.all-notes-count {
  font-size: 12px;
  color: var(--c-text-muted);
  margin: 0 0 12px;
}
.collapse-block {
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  background: var(--c-surface);
  margin-bottom: 8px;
}
.collapse-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
  list-style: none;          /* hide default triangle (we draw our own) */
}
.collapse-summary::-webkit-details-marker { display: none; }
.collapse-summary::before {
  content: '\25B8';          /* ▸ */
  color: var(--c-text-muted);
  font-size: 11px;
  transition: transform .15s;
}
.collapse-block[open] > .collapse-summary::before { transform: rotate(90deg); }
.collapse-summary:hover { background: var(--c-bg); }
.collapse-title { flex: 1; }
.collapse-meta {
  font-size: 11px;
  font-weight: 500;
  color: var(--c-text-muted);
  white-space: nowrap;
}
.collapse-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.badge-denial { background: var(--c-red-bg); color: var(--c-red); }
.badge-voided { background: var(--c-bg); color: var(--c-text-muted); border: 1px solid var(--c-border); }
.collapse-body { padding: 4px 12px 10px; }
.collapse-subtitle {
  font-size: 11px;
  color: var(--c-text-muted);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  margin-bottom: 8px;
}
.collapse-block,
.collapse-summary,
.collapse-title,
.collapse-body,
.collapse-body .note-attr-key,
.collapse-body .note-attr-value { -webkit-user-select: text; user-select: text; }

/* Reference panels are read-only but must be selectable/copyable. */
.note-data-panel,
.note-data-panel .note-section-title,
.note-data-panel .note-attr-key,
.note-data-panel .note-attr-value {
  -webkit-user-select: text;
  user-select: text;
}

/* Native date inputs in the field list */
.field-value-input.field-date { cursor: text; max-width: 200px; }

/* ── Success screen ───────────────────────────────────────────────────────── */
#screen-success {
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 48px);
  padding: 32px 16px;
}
.success-card { max-width: 540px; width: 100%; text-align: center; }
.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--c-success-bg);
  color: var(--c-success);
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.success-file-group {
  text-align: left;
  background: var(--c-bg);
  border-radius: var(--radius);
  padding: 14px 16px;
  border: 1px solid var(--c-border);
}
.success-file-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--c-text-muted); margin-bottom: 4px; }
.success-file-name { font-size: 13px; font-family: 'Consolas','Courier New',monospace; color: var(--c-text); word-break: break-all; margin-bottom: 10px; }
.success-file-actions { display: flex; gap: 8px; }

/* ── Settings screen ──────────────────────────────────────────────────────── */
#screen-settings {
  justify-content: center;
  align-items: center;
  min-height: calc(100vh - 48px);
  padding: 32px 16px;
}
.settings-card { max-width: 560px; width: 100%; }

/* ── Messages ─────────────────────────────────────────────────────────────── */
.error-msg {
  color: var(--c-red);
  background: var(--c-red-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.5;
}
.warning-msg {
  color: var(--c-yellow);
  background: var(--c-yellow-bg);
  border: 1px solid #fcd34d;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
}
/* ── Loading overlay ──────────────────────────────────────────────────────── */
/* The spinner is the app's ONLY animation, and the overlay covers the whole
   window on every lookup/generate (i.e. every time the user presses Enter).
   Creating and destroying that animated compositing layer can make WebView2
   re-rasterise page text, which shows up as text suddenly rendering heavier.
   `contain` + `isolation` keep the animation's layer to itself so it cannot
   affect how anything underneath is painted. */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 16px;
  contain: layout paint style;
  isolation: isolate;
}
.loading-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  will-change: transform;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-msg { color: #fff; font-size: 14px; font-weight: 500; }

/* ── Scrollbar styling ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
