/* Map Monkeytype's palette tokens onto the platform design system. Files that
   only contain selector overrides inherit a dark or light fallback palette. */
html[data-theme-scheme="light"] {
  --theme-fallback-bg: #f5f7fb;
  --theme-fallback-main: #4263eb;
  --theme-fallback-sub: #626f82;
  --theme-fallback-sub-alt: #ffffff;
  --theme-fallback-text: #182230;
}
html {
  --bg-color: var(--theme-fallback-bg, #323437);
  --main-color: var(--theme-fallback-main, #e2b714);
  --sub-color: var(--theme-fallback-sub, #646669);
  --sub-alt-color: var(--theme-fallback-sub-alt, #2c2e31);
  --text-color: var(--theme-fallback-text, #d1d0c5);
  --error-color: #ca4754;
}
html[data-theme] {
  --bg-main: var(--bg-color);
  --bg-card: var(--sub-alt-color, rgb(0 0 0 / 5%));
  --bg-card-hover: var(--sub-color);
  --border-color: var(--sub-color);
  --text-primary: var(--text-color);
  --text-secondary: var(--sub-color);
  --text-muted: var(--sub-color);
  --accent: var(--main-color);
  --accent-hover: var(--main-color);
  --accent-light: color-mix(in srgb, var(--main-color) 15%, transparent);
  --accent-gradient-from: var(--main-color);
  --accent-gradient-to: var(--sub-color);
  --accent-contrast: var(--bg-color);
  --header-bg: color-mix(in srgb, var(--bg-main) 90%, transparent);
  --brand: var(--accent);
  --brand-dark: var(--accent-hover);
  --brand-soft: var(--accent-light);
  --brand-action: var(--accent);
  --brand-action-hover: var(--accent-hover);
  --bg: var(--bg-main);
  --surface: var(--bg-card);
  --surface-raised: var(--bg-card-hover);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --border: var(--border-color);
  --focus: var(--accent);
  --focus-soft: var(--accent-light);
  --bs-primary: var(--accent);
  --bs-link-color: var(--accent);
  --bs-link-hover-color: var(--accent-hover);
  --bs-body-color: var(--text-primary);
  --bs-body-bg: var(--bg-main);
  --bs-border-color: var(--border-color);
  color-scheme: dark;
}
html[data-theme-scheme="dark"] {
  /* Keep the selected theme's hue, but give it the contrast of a Swiss system. */
  --bg-main: #101010;
  --bg-card: #191919;
  --bg-card-hover: #252525;
  --border-color: #454545;
  --text-primary: #f5f5f5;
  --text-secondary: #d0d0d0;
  --text-muted: #bdbdbd;
  --accent: color-mix(in srgb, var(--main-color, #91dbe2) 50%, #ffffff);
  --accent-hover: color-mix(in srgb, var(--main-color, #91dbe2) 40%, #ffffff);
  --accent-light: color-mix(in srgb, var(--accent) 14%, #191919);
  --accent-gradient-from: var(--accent);
  --accent-gradient-to: var(--accent);
  --accent-contrast: #101010;
  --header-bg: #191919;
  --focus: #99c2ff;
  --focus-soft: rgb(153 194 255 / 22%);
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --brand: var(--accent);
  --brand-dark: var(--accent-hover);
  --brand-soft: var(--accent-light);
  --brand-action: var(--accent);
  --brand-action-hover: var(--accent-hover);
  --bg: var(--bg-main);
  --surface: var(--bg-card);
  --surface-raised: var(--bg-card-hover);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --border: var(--border-color);
  --bs-primary: var(--accent);
  --bs-body-color: var(--text-primary);
  --bs-body-bg: var(--bg-main);
  --bs-border-color: var(--border-color);
  --bs-link-color: var(--accent);
  --bs-link-hover-color: var(--accent-hover);
  --bs-focus-ring-color: var(--focus-soft);
}
html[data-theme-scheme="light"] { color-scheme: light; }
html[data-theme-scheme="light"] {
  --bg-main: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5f5;
  --border-color: #d6d6d6;
  --text-primary: #111111;
  --text-secondary: #525252;
  --text-muted: #525252;
  --accent: color-mix(in srgb, var(--main-color, #126570) 45%, #000000);
  --accent-hover: color-mix(in srgb, var(--main-color, #126570) 40%, #000000);
  --accent-light: color-mix(in srgb, var(--accent) 10%, #ffffff);
  --accent-gradient-from: var(--accent);
  --accent-gradient-to: var(--accent);
  --accent-contrast: #ffffff;
  --header-bg: #ffffff;
  --brand: var(--accent);
  --brand-dark: var(--accent-hover);
  --brand-soft: var(--accent-light);
  --brand-action: var(--accent);
  --brand-action-hover: var(--accent-hover);
  --bg: var(--bg-main);
  --surface: var(--bg-card);
  --surface-raised: var(--bg-card-hover);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --border: var(--border-color);
  --focus: #005fcc;
  --focus-soft: rgb(0 95 204 / 18%);
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --bs-focus-ring-color: var(--focus-soft);
  color-scheme: light;
}
/* The base member shell has light defaults on body. Remap them for every
   dark theme, including custom/Monkeytype theme names, so dark text and
   surfaces stay paired instead of depending on a literal theme name. */
html[data-theme-scheme="dark"] body:not(.admin-app) {
  --brand: var(--accent);
  --brand-dark: var(--accent-hover);
  --brand-soft: var(--accent-light);
  --bg: var(--bg-main);
  --surface: var(--bg-card);
  --surface-raised: var(--bg-card-hover);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --border: var(--border-color);
  --focus: var(--accent);
  --focus-soft: var(--accent-light);
  --bs-body-color: var(--text-primary);
  --bs-body-bg: var(--bg-main);
  --bs-border-color: var(--border-color);
  background: var(--bg-main);
  color: var(--text-primary);
}
html[data-theme][data-theme] body.rose-community-ui { background: var(--bg-main); color: var(--text-primary); }
html[data-theme][data-theme] .admin-frame {
  --admin-surface: var(--bg-card);
  --admin-page: var(--bg-main);
  --admin-ink: var(--text-primary);
  --admin-muted: var(--text-secondary);
  --admin-line: var(--border-color);
  --admin-accent: var(--accent);
  --admin-violet: var(--accent-light);
}
html[data-theme][data-theme] .rose-community-ui .feed-cover,
html[data-theme][data-theme] .rose-community-ui .profile-cover,
html[data-theme][data-theme] .rose-community-ui .profile-preview-cover,
html[data-theme][data-theme] .rose-community-ui .jobs-profile-cover,
html[data-theme][data-theme] .rose-community-ui .notification-profile-cover {
  background: var(--accent);
}
html[data-theme][data-theme] .rose-spotlight {
  border-color: var(--border-color);
  background: var(--bg-card);
  color: var(--text-primary);
  box-shadow: none;
}
html[data-theme][data-theme] .rose-spotlight p { color: var(--text-secondary); }
html[data-theme][data-theme] .rose-spotlight > a,
html[data-theme][data-theme] .spotlight-kicker { color: var(--accent); }

/* Swiss surfaces use solid fills and measured semantic tokens. */
html[data-theme] body:not(.admin-app) :is(.feed-cover,.profile-cover,.profile-preview-cover,.jobs-profile-cover,.notification-profile-cover) {
  background: var(--accent);
  box-shadow: none;
}
html[data-theme] body:not(.admin-app) :is(.rose-spotlight,.workspace-card,.jobs-listing-card,.tracker-job-card) {
  box-shadow: none;
}
html[data-theme][data-theme] .nav-link.active,
html[data-theme][data-theme] .filter-pill[aria-current="page"],
html[data-theme][data-theme] .filter-pill.is-active,
html[data-theme][data-theme] .message-filter-chip.is-active,
html[data-theme][data-theme] .notification-filter.is-active,
html[data-theme][data-theme] .rose-community-ui .feed-mode-tabs a[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}
html[data-theme][data-theme] .feed-mode-tabs a[aria-current="page"]::after,
html[data-theme][data-theme] .social-tabs a[aria-current="page"]::after,
html[data-theme][data-theme] .mobile-tabs a[aria-current="page"]::before,
html[data-theme][data-theme] .network-hub-tabs a[aria-current="page"]::after { background: var(--accent); }
html[data-theme][data-theme] .feed-mode-tabs a[aria-current="page"],
html[data-theme][data-theme] .social-tabs a[aria-current="page"],
html[data-theme][data-theme] .mobile-tabs a[aria-current="page"],
html[data-theme][data-theme] .search-tabs a[aria-current="page"],
html[data-theme][data-theme] .network-hub-tabs a[aria-current="page"] { color: var(--accent); }
html[data-theme][data-theme] .rose-community-ui .feed-mode-tabs a[aria-current="page"] { color: var(--accent-contrast); }
