/* Contrast layer (loaded last). Form controls get a border that meets the 3:1 non-text minimum, text keeps 4.5:1 or better, and a
   "High contrast" setting (Settings -> Appearance, or the system preference) raises everything to AAA. Checked by tools/contrast.mjs. */
:root { --control: #6f7f95; --lime: #3f6212; --lime-bg: #ecfccb; }
[data-theme="dark"] { --control: #8393ad; --lime: #bef264; --lime-bg: #26340d; }

.lg-input, .input, select.input, textarea.input, .btn, .combo-btn, .combo-search, .cf-in, .ra-btn, .lg-ref, .pd-t, .ax-seg, .rl-chip, .lg-search .lg-input { border-color: var(--control); }
.btn:hover, .ra-btn:hover, .rl-chip:hover, .combo-btn:hover { border-color: var(--accent); }
.lg-input:focus, .input:focus, .cf-in:focus { border-color: var(--accent); }
::placeholder { color: var(--muted); opacity: 1; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.lg-sec a, .lead a, p a, td a, .md a { text-decoration: underline; text-underline-offset: 2px; }
:disabled, .disabled { opacity: .62; }
.lg-grid td, .inv-table td, .ax-matrix td { border-bottom-color: var(--line); }

/* High contrast: stronger text, borders and accents (AAA text, 4.5:1 for borders) */
[data-contrast="high"] { --ink: #000; --ink-2: #111827; --muted: #1f2937; --line: #6b7788; --line-2: #4b5563; --control: #374151; --accent: #1e3a8a; --accent-2: #172554; --accent-soft: #dbeafe; --accent-ink: #fff;
  --ok: #14532d; --warn: #713f12; --bad: #7f1d1d; --info: #1e3a8a; --violet: #4c1d95; --lime: #1a2e05; --nav-ink: #111827; --nav-muted: #1f2937; --add-i: #052e16; --edit-i: #422006; --view-i: #083344; --rem-i: #4c0519; }
[data-theme="dark"][data-contrast="high"] { --ink: #fff; --ink-2: #f1f5f9; --muted: #e2e8f0; --line: #94a3b8; --line-2: #cbd5e1; --control: #cbd5e1; --accent: #bfdbfe; --accent-2: #dbeafe; --accent-soft: #1e3a8a; --accent-ink: #0b1220;
  --ok: #bbf7d0; --warn: #fde68a; --bad: #fecaca; --info: #bfdbfe; --violet: #ddd6fe; --lime: #ecfccb; --nav-ink: #fff; --nav-muted: #e2e8f0; --add-i: #dcfce7; --edit-i: #fef3c7; --view-i: #cffafe; --rem-i: #ffe4e6; }
[data-contrast="high"] .btn, [data-contrast="high"] .lg-input, [data-contrast="high"] .input { border-width: 2px; }
@media (prefers-contrast: more) { :root:not([data-contrast="normal"]) { --muted: #1f2937; --control: #374151; --line-2: #4b5563; } [data-theme="dark"]:not([data-contrast="normal"]) { --muted: #e2e8f0; --control: #cbd5e1; --line-2: #cbd5e1; } }
