/* BigID Local — light/dark surfaces via CSS variables + html.dark */
:root {
  color-scheme: light;
  --page-bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #fafbfc;
  --surface-muted: #f5f7fa;
  --border: #d5dbe3;
  --border-strong: #cfd6e0;
  --border-soft: #e4e8ee;
  --border-faint: #eef1f5;
  --text: #1c2430;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;
  --hover: #f5f7fa;
  --hover-row: #f1f5f9;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.16);
  --selected-mix-base: #ffffff;
  --input-bg: #ffffff;
  --chip-fg: #334155;
  --seg-fg: #475569;
  --tag-ok-bg: #e8f8ef;
  --tag-ok-fg: #0f7a3f;
  --tag-ok-bd: #b7e6c9;
  --tag-none-bg: #fbe3e6;
  --tag-none-fg: #a4192c;
  --tag-none-bd: #f0c2c8;
  --tag-unres-bg: #fff7e8;
  --tag-unres-fg: #9a6700;
  --tag-unres-bd: #f0d9a0;
  --danger-soft-bg: #fbe3e6;
  --danger-soft-fg: #a4192c;
  --danger-soft-bd: #f0c2c8;
  --exc-soft-bg: #fde8e8;
  --exc-soft-fg: #b42318;
}

html.dark {
  color-scheme: dark;
  --page-bg: #0f1419;
  --surface: #1a222d;
  --surface-2: #151c26;
  --surface-3: #1e2733;
  --surface-muted: #151c26;
  --border: #2a3544;
  --border-strong: #3a4658;
  --border-soft: #243041;
  --border-faint: #1e2733;
  --text: #e8edf4;
  --text-secondary: #c5d0de;
  --text-muted: #94a3b8;
  --text-faint: #6b7a90;
  --hover: #243041;
  --hover-row: #243041;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 28px rgba(0, 0, 0, 0.5);
  --selected-mix-base: #1a222d;
  --input-bg: #151c26;
  --chip-fg: #c5d0de;
  --seg-fg: #94a3b8;
  --brand-accent-soft: color-mix(in srgb, var(--brand-accent) 24%, #1a222d);
  --tag-ok-bg: #0f2e1c;
  --tag-ok-fg: #4ade80;
  --tag-ok-bd: #166534;
  --tag-none-bg: #3b1519;
  --tag-none-fg: #fb7185;
  --tag-none-bd: #7f1d1d;
  --tag-unres-bg: #3d2e10;
  --tag-unres-fg: #fbbf24;
  --tag-unres-bd: #854d0e;
  --danger-soft-bg: #3b1519;
  --danger-soft-fg: #fb7185;
  --danger-soft-bd: #7f1d1d;
  --exc-soft-bg: #3b1519;
  --exc-soft-fg: #fb7185;
}

/* Remap common Tailwind light utilities when dark (avoid rewriting every class) */
html.dark .bg-white { background-color: var(--surface) !important; }
html.dark .bg-\[\#eef1f5\] { background-color: var(--page-bg) !important; }
html.dark .bg-\[\#f8fafc\] { background-color: var(--surface-2) !important; }
html.dark .bg-\[\#fafbfc\] { background-color: var(--surface-3) !important; }
html.dark .bg-\[\#f5f7fa\] { background-color: var(--surface-muted) !important; }
html.dark .bg-\[\#f1f3f6\] { background-color: var(--surface-muted) !important; }
html.dark .bg-\[\#e8f8ef\] { background-color: var(--tag-ok-bg) !important; }
html.dark .border-\[\#d5dbe3\] { border-color: var(--border) !important; }
html.dark .border-\[\#cfd6e0\] { border-color: var(--border-strong) !important; }
html.dark .border-\[\#e4e8ee\] { border-color: var(--border-soft) !important; }
html.dark .border-\[\#eef1f5\] { border-color: var(--border-faint) !important; }
html.dark .border-\[\#b7e6c9\] { border-color: var(--tag-ok-bd) !important; }
html.dark .text-\[\#1c2430\] { color: var(--text) !important; }
html.dark .text-\[\#0f7a3f\] { color: var(--tag-ok-fg) !important; }
html.dark .text-\[\#5b6573\] { color: var(--text-muted) !important; }
html.dark .text-slate-400 { color: var(--text-faint) !important; }
html.dark .text-slate-500 { color: var(--text-muted) !important; }
html.dark .text-slate-600 { color: var(--text-muted) !important; }
html.dark .text-slate-700 { color: var(--text-secondary) !important; }
html.dark .text-slate-800 { color: var(--text) !important; }
html.dark .text-rose-700 { color: #fb7185 !important; }
html.dark .text-amber-700,
html.dark .text-amber-800 { color: #fbbf24 !important; }
html.dark .text-emerald-700 { color: #4ade80 !important; }
html.dark .hover\:bg-slate-50:hover { background-color: var(--hover) !important; }
html.dark .divide-\[\#eef1f5\] > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--border-faint);
}
html.dark .bg-amber-50 { background-color: #3d2e10 !important; }
html.dark .bg-rose-50 { background-color: #3b1519 !important; }
html.dark .bg-emerald-50 { background-color: #0f2e1c !important; }
html.dark .border-amber-300 { border-color: #854d0e !important; }
html.dark .border-rose-300 { border-color: #7f1d1d !important; }
html.dark .border-emerald-300 { border-color: #166534 !important; }
html.dark .text-amber-950 { color: #fde68a !important; }
html.dark .text-rose-950 { color: #fecdd3 !important; }
html.dark .text-emerald-950 { color: #bbf7d0 !important; }
html.dark .file\:bg-\[\#f8fafc\]::file-selector-button { background-color: var(--surface-2) !important; }
html.dark .file\:border-\[\#d5dbe3\]::file-selector-button { border-color: var(--border) !important; }

/* Shell pieces that use semantic vars */
.shell-topnav {
  border-color: var(--border);
  background: var(--surface);
}
.shell-sidebar {
  border-color: var(--border);
  background: var(--surface);
}
.shell-topnav a:not(.bigid-tab-active) {
  color: var(--text-muted);
}
.shell-topnav a:not(.bigid-tab-active):hover {
  background: var(--hover);
}
.shell-sidebar a:not(.side-active) {
  color: var(--text-secondary);
}
.shell-sidebar a:not(.side-active):hover {
  background: var(--hover);
}
.shell-sidebar .side-heading {
  color: var(--text-muted);
}
.shell-sidebar .text-slate-500 {
  color: var(--text-muted);
}

/* Native form controls follow theme */
html.dark input:not([type="checkbox"]):not([type="radio"]),
html.dark select,
html.dark textarea {
  color-scheme: dark;
}


/* Brand ink is often a dark navy — unreadable on dark surfaces */
html.dark .ink-primary { color: var(--text); }
html.dark .side-active {
  background: var(--brand-accent-soft);
  color: var(--brand-accent);
}
html.dark .accent-bg-soft {
  background: var(--brand-accent-soft);
  color: var(--brand-accent);
}

/* Tables / zebra-ish borders painted via border-t utilities */
html.dark tbody tr.border-t { border-color: var(--border-faint); }
html.dark thead { color: var(--text-muted); }

/* Table row hover / selected / focus — never solid white in dark mode */
html.dark .hover\:bg-\[\#f5f7fa\]:hover,
html.dark .hover\:bg-\[\#f1f5f9\]:hover {
  background-color: var(--hover-row) !important;
}
html.dark #o-body tr:hover,
html.dark #rem-obj-body tr.rem-obj-row:hover {
  background-color: var(--hover-row) !important;
}
html.dark #o-body tr.selected,
html.dark #o-body tr.selected:hover,
html.dark #rem-obj-body tr.selected,
html.dark #rem-obj-body tr.selected:hover {
  background: color-mix(in srgb, var(--brand-accent) 22%, #151c26) !important;
  color: var(--text);
}
html.dark #o-body tr:focus-visible,
html.dark #rem-obj-body tr.rem-obj-row:focus-visible {
  background: color-mix(in srgb, var(--brand-accent) 18%, #151c26) !important;
  color: var(--text);
  outline: 1px solid color-mix(in srgb, var(--brand-accent) 55%, #3a4658);
  outline-offset: -1px;
}
html.dark #o-body tr.selected td,
html.dark #rem-obj-body tr.selected td {
  color: inherit;
}

