html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: var(--font-line-base);
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: var(--font-line-base);
}

:where(a, button, input, select, textarea, summary, [role="button"], [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--focus-ring, 0 0 0 3px rgba(37, 99, 235, 0.35));
}

:where(input[type="checkbox"], input[type="radio"]) {
  accent-color: var(--primary);
}

:where(input, textarea)::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

:where(button, input, select, textarea):disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.dashboard-body {
  background: var(--bg-primary);
  color: var(--text-primary);
  background-image: none;
}

.dashboard-hero {
  background: var(--bg-card);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-contrast);
  box-shadow: none;
}

.form-footer button,
.form-field input[type="file"]::file-selector-button {
  background: var(--primary);
  color: var(--primary-contrast);
  box-shadow: none;
}

.form-footer button:hover,
.form-field input[type="file"]:hover::file-selector-button {
  transform: none;
  box-shadow: none;
  opacity: 0.92;
}

.btn-ghost:hover,
.btn-outline:hover,
.collapsible-toggle:hover,
.collapse-toggle:hover {
  transform: none;
}

.btn-ghost:hover,
.collapsible-toggle:hover {
  border-color: var(--border);
  background: var(--accent-soft);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  outline: none;
}

.floating-message {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.floating-message.success,
.floating-message.error {
  background: var(--bg-card);
  color: var(--text-primary);
}

.floating-message.success {
  border-left: 4px solid var(--success);
}

.floating-message.error {
  border-left: 4px solid var(--danger);
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-small);
  margin: 0 0 var(--space-3);
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.alert.success,
.alert.alert--success {
  border-left: 4px solid var(--success);
}

.alert.error,
.alert.alert--error {
  border-left: 4px solid var(--danger);
}

.alert.info,
.alert.alert--info {
  border-left: 4px solid var(--primary);
}

.cards-section .card {
  background: var(--bg-card);
}

/* Theme toggle (opt-in markup via `includes/theme_toggle.php`). */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.theme-toggle__label {
  font-size: var(--font-size-0);
  color: var(--text-secondary);
}

.theme-toggle__select {
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  color-scheme: light;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.theme-toggle__select option,
.theme-toggle__select optgroup {
  background: var(--input-bg);
  color: var(--input-text);
}

.theme-toggle__select:hover {
  background: rgba(var(--text-rgb), 0.06);
}

.theme-toggle__select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
  outline: none;
}

html[data-theme="dark"] .theme-toggle__select,
html[data-theme-effective="dark"] .theme-toggle__select {
  color-scheme: dark;
  background: rgba(var(--surface-rgb), 0.94);
  color: var(--text);
}

html[data-theme="dark"] .theme-toggle__select option,
html[data-theme-effective="dark"] .theme-toggle__select option,
html[data-theme="dark"] .theme-toggle__select optgroup,
html[data-theme-effective="dark"] .theme-toggle__select optgroup {
  background: rgba(var(--surface-rgb), 0.94);
  color: var(--text);
}

html[data-theme="light"] .theme-toggle__select,
html[data-theme-effective="light"] .theme-toggle__select {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] .theme-toggle__select {
    color-scheme: dark;
  }
}

/* Migration helpers (opt-in utilities). */
.t-surface {
  background: var(--surface);
  color: var(--text);
}

.t-surface-2 {
  background: var(--surface-2);
  color: var(--text);
}

.t-border {
  border: 1px solid var(--border);
}

.t-text-muted {
  color: var(--muted);
}

.t-card {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.t-input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--input-text);
  border-radius: 12px;
  padding: 12px 14px;
}

.t-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg);
  color: var(--btn-text);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.t-btn:hover {
  background: var(--btn-bg-hover);
}

.t-btn--primary {
  border-color: transparent;
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
}

.t-btn--danger {
  border-color: transparent;
  background: var(--btn-danger-bg);
  color: var(--btn-danger-text);
}
