/* Accessible color-scheme corrections shared by public, member, and admin pages. */
:root {
  color-scheme: light;
  --ui-border: #d7dee8;
  --ui-muted: #f1f4f8;
  --ui-text-muted: #43536a;
  --ui-link: var(--link-color, #174a80);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ui-border: #384758;
  --ui-muted: #202c39;
  --ui-text-muted: #bdc8d5;
  --ui-link: #a9d2ff;
  --ui-shadow: 0 8px 24px rgb(0 0 0 / 32%);
  --ui-shadow-raised: 0 16px 34px rgb(0 0 0 / 44%);
}

body { background-color: var(--page-bg); color: var(--ink); }
a:not(.button) { color: var(--ui-link); }

:root[data-theme="dark"] :is(.section-soft, .bg-cream, .notice, .notice-error,
  .alert, .admin-nav, .admin-disclosure, .form-disclosure, .progressive-disclosure,
  .table-wrap, .card, .form-card, .stat-card, .quick-action, .chart-card,
  .community-card, .dashboard-section) {
  color: var(--ink);
  border-color: var(--ui-border);
}

:root[data-theme="dark"] :is(.section-soft, .bg-cream, .admin-disclosure,
  .form-disclosure, .progressive-disclosure) { background-color: var(--page-bg); }

:root[data-theme="dark"] :is(.card, .form-card, .stat-card, .quick-action,
  .chart-card, .community-card, .dashboard-section, .table-wrap) {
  background-color: var(--surface-bg);
}

:root[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]),
  select, textarea) {
  color-scheme: dark;
  background-color: #111a24;
  border-color: #647487;
  color: #f1f5f9;
}

:root[data-theme="dark"] :is(input, select, textarea)::placeholder { color: #aab8c8; opacity: 1; }
:root[data-theme="dark"] :is(input, select, textarea):disabled { background-color: #25313e; color: #c4ced9; }
:root[data-theme="dark"] :is(th, .table-wrap th) { background-color: #23374d; color: #f5f8fc; }
:root[data-theme="dark"] table { background-color: var(--surface-bg); color: var(--ink); }
:root[data-theme="dark"] :is(td, th) { border-color: var(--ui-border); }
:root[data-theme="dark"] tbody tr:nth-child(even) { background-color: #202c39; }
:root[data-theme="dark"] tbody tr:hover { background-color: #2a3949; }
:root[data-theme="dark"] :is(.notice, .notice-error, .alert) { background-color: #202b37; }
:root[data-theme="dark"] :is(.muted, .text-muted, small, .help-text) { color: var(--ui-text-muted); }
:root[data-theme="dark"] ::selection { background: #f1cc56; color: #17202b; }

@media (prefers-reduced-motion: reduce) {
  body { transition: none; }
}
