/* ============================================================
   RYCAL DARK MODE
   Toggle via <html data-theme="dark">. Light is the default.
   Preference stored in localStorage as 'rycalTheme'.
   ============================================================ */

[data-theme="dark"] {
  /* ---- Original variable system (app.css :root) ---- */
  --background: #0F172A !important;
  --text: #E2E8F0 !important;
  --text-soft: #94A3B8 !important;
  --border: #334155 !important;
  --white: #1E293B !important;

  --green-dark: #34D399 !important;
  --green: #34D399 !important;
  --green-medium: #6EE7B7 !important;
  --green-light: #064E3B !important;
  --green-pale: #0F2E23 !important;

  --red-light: #3B1D1D !important;
  --red: #F87171 !important;

  --amber-light: #3B2F0B !important;
  --amber: #FBBF24 !important;

  /* ---- Newer variable system (app.css second :root) ---- */
  --bg-app: #0F172A !important;
  --bg-surface: #1E293B !important;
  --border-subtle: #334155 !important;
  --border-strong: #475569 !important;

  --text-main: #E2E8F0 !important;
  --text-muted: #94A3B8 !important;

  --brand-emerald: #059669 !important;
  --brand-emerald-hover: #10B981 !important;
  --brand-emerald-subtle: #064E3B !important;

  /* ---- Rycal semantic variables ---- */
  --rycal-surface: #1E293B !important;
  --rycal-soft: #162033 !important;
  --rycal-rule: #334155 !important;
  --rycal-ink: #E2E8F0 !important;
  --rycal-muted: #94A3B8 !important;

  /* ---- Slate scale (used with fallbacks throughout) ---- */
  --rycal-slate-50: #0F172A !important;
  --rycal-slate-100: #1E293B !important;
  --rycal-slate-200: #334155 !important;
  --rycal-slate-300: #475569 !important;
  --rycal-slate-400: #64748B !important;
  --rycal-slate-500: #94A3B8 !important;
  --rycal-slate-600: #CBD5E1 !important;
  --rycal-slate-700: #E2E8F0 !important;
  --rycal-slate-800: #F1F5F9 !important;
  --rycal-slate-900: #F8FAFC !important;
  --rycal-slate-950: #FFFFFF !important;

  /* ---- Emerald scale ---- */
  --rycal-emerald-50: #064E3B !important;
  --rycal-emerald-100: #065F46 !important;
  --rycal-emerald-400: #34D399 !important;
  --rycal-emerald-500: #10B981 !important;
  --rycal-emerald-600: #34D399 !important;
  --rycal-emerald-700: #6EE7B7 !important;
  --rycal-emerald-800: #A7F3D0 !important;

  color-scheme: dark;
}

/* ---- Base element overrides for hardcoded colors ---- */

[data-theme="dark"] body {
  background-color: #0F172A !important;
  color: #E2E8F0 !important;
}

[data-theme="dark"] header {
  background: rgba(15, 23, 42, 0.97);
  border-bottom-color: #334155;
}

/* Cards and surfaces with hardcoded white */
[data-theme="dark"] .card,
[data-theme="dark"] .deck-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .utility-box,
[data-theme="dark"] .mode-card,
[data-theme="dark"] .flashcard,
[data-theme="dark"] .settings-modal,
[data-theme="dark"] .account-menu,
[data-theme="dark"] .modal,
[data-theme="dark"] .dialog {
  background-color: #1E293B;
  border-color: #334155;
  color: #E2E8F0;
}

/* Inputs */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background-color: #1E293B;
  border-color: #475569;
  color: #E2E8F0;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #64748B;
}

/* Buttons - keep emerald primary, adjust secondary */
[data-theme="dark"] .secondary-button,
[data-theme="dark"] button.secondary {
  background-color: #1E293B;
  border-color: #475569;
  color: #E2E8F0;
}

/* Tables */
[data-theme="dark"] table {
  color: #E2E8F0;
}

[data-theme="dark"] th {
  background-color: #1E293B;
  color: #94A3B8;
}

[data-theme="dark"] td {
  border-color: #334155;
}

[data-theme="dark"] tr:nth-child(even) td {
  background-color: #162033;
}

/* Links */
[data-theme="dark"] a {
  color: #34D399;
}

/* Code blocks */
[data-theme="dark"] code,
[data-theme="dark"] pre {
  background-color: #1E293B;
  border-color: #334155;
  color: #E2E8F0;
}

/* Dividers */
[data-theme="dark"] hr {
  border-color: #334155;
}

/* Scrollbars */
[data-theme="dark"] ::-webkit-scrollbar-track {
  background: #0F172A;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: #475569;
}

/* ---- Theme toggle button ---- */
.theme-toggle {
  background: none;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 10px;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-soft, #66736c);
  transition: border-color .15s, color .15s, background .15s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--text-soft, #66736c);
  color: var(--text, #24312b);
}
.theme-toggle:focus-visible {
  outline: 2px solid var(--brand-emerald, #059669);
  outline-offset: 2px;
}
/* Show moon in light mode, sun in dark mode (text glyphs: the inline SVGs
   silently failed to render in this button in Chromium, twice, undiagnosed) */
.theme-toggle .theme-glyph { font-size: 19px; line-height: 1; }
.theme-toggle .theme-glyph-sun { display: none; }
.theme-toggle .theme-glyph-moon { display: inline; }
[data-theme="dark"] .theme-toggle .theme-glyph-sun { display: inline; }
[data-theme="dark"] .theme-toggle .theme-glyph-moon { display: none; }
[data-theme="dark"] .theme-toggle {
  border-color: #475569;
  color: #94A3B8;
}
[data-theme="dark"] .theme-toggle:hover {
  border-color: #94A3B8;
  color: #E2E8F0;
}

/* ---- Test planner sweep (hardcoded amber in light) ---- */
[data-theme="dark"] .tp-sweep {
  background: #3B2F0B;
  border-color: #92400e;
  color: #FDE68A;
}

/* ---- Fix hardcoded white cards ---- */
[data-theme="dark"] .fc-card {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .ap-library-card {
  background: #1E293B !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .ap-library-card h2,
[data-theme="dark"] .ap-library-card h3 {
  color: #E2E8F0 !important;
}
[data-theme="dark"] .ap-library-card p {
  color: #94A3B8 !important;
}
/* Header: override header-nav.css */
[data-theme="dark"] header,
[data-theme="dark"] .site-header,
[data-theme="dark"] #headerNav {
  background: #0F172A !important;
  border-bottom-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] header a,
[data-theme="dark"] .site-header a {
  color: #E2E8F0 !important;
}

/* ---- Flashcard faces (were .fc-card, actually .card-scene/.card-face) ---- */
[data-theme="dark"] .card-scene,
[data-theme="dark"] .card-face {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .card-face .card-text {
  color: #E2E8F0 !important;
}
[data-theme="dark"] .card-hint {
  color: #94A3B8 !important;
}

/* ---- Topic picker rows ---- */
[data-theme="dark"] .topic-card,
[data-theme="dark"] .topic-list .topic-card,
[data-theme="dark"] .cram-topic-row,
[data-theme="dark"] label[class*="topic"] {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

/* ---- Bottom nav buttons (Flip, arrows) ---- */
[data-theme="dark"] .fc-nav-btn,
[data-theme="dark"] button[class*="flip"],
[data-theme="dark"] .card-nav button {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

/* ---- Footer ---- */
[data-theme="dark"] footer,
[data-theme="dark"] .site-footer,
[data-theme="dark"] #footer {
  background: #0F172A !important;
  border-top-color: #334155 !important;
  color: #94A3B8 !important;
}
[data-theme="dark"] footer a,
[data-theme="dark"] .site-footer a {
  color: #94A3B8 !important;
}

/* ---- Profile/settings page ---- */
[data-theme="dark"] .profile-card,
[data-theme="dark"] .settings-card,
[data-theme="dark"] .account-card,
[data-theme="dark"] [class*="profile-"] {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .profile-card h2,
[data-theme="dark"] .profile-card h3,
[data-theme="dark"] .settings-card h2 {
  color: #E2E8F0 !important;
}
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #0F172A !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

/* ---- Flashcard flip/nav buttons (bottom row) ---- */
[data-theme="dark"] .fc-controls button,
[data-theme="dark"] .card-controls button,
[data-theme="dark"] .flashcard-nav button,
[data-theme="dark"] button[onclick*="flip"],
[data-theme="dark"] button[onclick*="nextCard"],
[data-theme="dark"] button[onclick*="prevCard"] {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

/* ---- Flashcard control buttons ---- */
[data-theme="dark"] .control-button {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .control-button:hover {
  background: #334155 !important;
}
[data-theme="dark"] .control-button:disabled {
  opacity: 0.4;
}

/* ---- Icon control buttons (back, shuffle) - explicit override ---- */
[data-theme="dark"] #flashcardScreen .control-button,
[data-theme="dark"] #flashcardScreen .icon-control,
[data-theme="dark"] .control-button.icon-control {
  background: #1E293B !important;
  background-color: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .control-button.icon-control svg {
  stroke: #E2E8F0 !important;
}

/* ---- Account chip (profile photo button in header) ---- */
[data-theme="dark"] .user-chip {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .user-chip:hover {
  background: #334155 !important;
}

/* ============================================================
   COMPREHENSIVE AUDIT FIXES (2026-10-05)
   Covering all hardcoded white backgrounds and dark text
   ============================================================ */

/* ---- White card backgrounds ---- */
[data-theme="dark"] .unit-card,
[data-theme="dark"] .home-card,
[data-theme="dark"] .science-card,
[data-theme="dark"] .question-card,
[data-theme="dark"] .review-card,
[data-theme="dark"] .count-card,
[data-theme="dark"] .count-button,
[data-theme="dark"] .stimulus-table,
[data-theme="dark"] .results,
[data-theme="dark"] .progress-stat-card,
[data-theme="dark"] .progress-concept-row,
[data-theme="dark"] .recent-session-row,
[data-theme="dark"] .teacher-panel,
[data-theme="dark"] .auth-google,
[data-theme="dark"] .learn-option,
[data-theme="dark"] .forgetting-visual,
[data-theme="dark"] .difference-panel,
[data-theme="dark"] .study-routine,
[data-theme="dark"] .answer-choice,
[data-theme="dark"] .shared-set-card,
[data-theme="dark"] .gov-progress-card {
  background: #1E293B !important;
  background-color: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

/* ---- Light-tinted card backgrounds ---- */
[data-theme="dark"] .concept-card,
[data-theme="dark"] .stimulus-container,
[data-theme="dark"] .stimulus-table,
[data-theme="dark"] .psych-stimulus {
  background: #162033 !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

/* ---- Answer choices ---- */
[data-theme="dark"] .answer-letter {
  background: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .answer-choice:hover:not(:disabled) {
  border-color: #34D399 !important;
}
/* Correct/incorrect states must override the !important base above */
[data-theme="dark"] .answer-choice.correct {
  background: #064E3B !important;
  background-color: #064E3B !important;
  border-color: #34D399 !important;
}
[data-theme="dark"] .answer-choice.incorrect {
  background: #3B1D1D !important;
  background-color: #3B1D1D !important;
  border-color: #F87171 !important;
}

/* ---- Auth modal ---- */
[data-theme="dark"] .auth-modal-close {
  background: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .auth-button {
  border-color: #475569 !important;
}

/* ---- Set editor / inputs ---- */
[data-theme="dark"] .teacher-field input,
[data-theme="dark"] .set-field input,
[data-theme="dark"] .card-editor-row textarea,
[data-theme="dark"] .all-cards-search {
  background: #0F172A !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .remove-card-btn,
[data-theme="dark"] .all-cards-close,
[data-theme="dark"] .flash-action-btn {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

/* ---- Progress bars and tracks ---- */
[data-theme="dark"] .progress-bar,
[data-theme="dark"] .progress-mini-track,
[data-theme="dark"] .concept-track,
[data-theme="dark"] .mastery-track {
  background: #334155 !important;
}
[data-theme="dark"] .bar-chart i {
  background: #475569 !important;
}

/* ---- Badges, pills, tags ---- */
[data-theme="dark"] .ced-badge.muted {
  background: #334155 !important;
  color: #94A3B8 !important;
}
[data-theme="dark"] .starter-deck-tag,
[data-theme="dark"] .coming-soon-pill {
  background: #334155 !important;
  color: #94A3B8 !important;
}
[data-theme="dark"] .qb-weight-pill {
  background: #064E3B !important;
  border-color: #065F46 !important;
  color: #6EE7B7 !important;
}

/* ---- Dark green text (invisible on dark bg) ---- */
[data-theme="dark"] .unit-cram-link:hover,
[data-theme="dark"] .unit-copy-link:hover,
[data-theme="dark"] .unit-quick-study:hover,
[data-theme="dark"] .cram-sheet-link:hover,
[data-theme="dark"] .topic-check,
[data-theme="dark"] .set-favorite-button.saved,
[data-theme="dark"] .starter-copy-status,
[data-theme="dark"] .flash-action-btn,
[data-theme="dark"] .all-cards-close,
[data-theme="dark"] .quiet-principle,
[data-theme="dark"] .flash-speak-btn.speaking,
[data-theme="dark"] .diagram-input:focus,
[data-theme="dark"] .knowledge-section h2,
[data-theme="dark"] .knowledge-section .knowledge-pull,
[data-theme="dark"] .audience-paths-head h2,
[data-theme="dark"] .tp-guest-note .tp-link-btn,
[data-theme="dark"] .guest-banner,
[data-theme="dark"] .guest-banner-dismiss,
[data-theme="dark"] .coming-soon-pill,
[data-theme="dark"] .brain-score {
  color: #34D399 !important;
}

/* ---- Muted gray text (hardcoded, not using variables) ---- */
[data-theme="dark"] .import-help,
[data-theme="dark"] .set-study-note,
[data-theme="dark"] .launch-roadmap-note,
[data-theme="dark"] .visual-caption,
[data-theme="dark"] .brain-dump-meta,
[data-theme="dark"] .brain-score-card p,
[data-theme="dark"] .audience-card p,
[data-theme="dark"] .importer-option p,
[data-theme="dark"] .all-card-definition,
[data-theme="dark"] .flash-rate-hint,
[data-theme="dark"] .kbd-hint kbd,
[data-theme="dark"] .admin-feedback-count,
[data-theme="dark"] .admin-feedback-user,
[data-theme="dark"] .admin-feedback-empty {
  color: #94A3B8 !important;
}

/* ---- Brain dump ---- */
[data-theme="dark"] .brain-dump-instruction,
[data-theme="dark"] .brain-result-callout {
  background: #162033 !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .brain-dump-textarea {
  background: #0F172A !important;
  border-color: #475569 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .brain-chip.strong {
  background: #064E3B !important;
  border-color: #065F46 !important;
  color: #6EE7B7 !important;
}
[data-theme="dark"] .brain-chip.partial {
  background: #3B2F0B !important;
  border-color: #92400E !important;
  color: #FDE68A !important;
}
[data-theme="dark"] .brain-chip.missing {
  background: #334155 !important;
  border-color: #475569 !important;
  color: #CBD5E1 !important;
}
[data-theme="dark"] .brain-score-card {
  background: #1E293B !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .brain-dump-select-grid select {
  background: #0F172A !important;
  border-color: #475569 !important;
  color: #E2E8F0 !important;
}

/* ---- Test planner ---- */
[data-theme="dark"] .tp-guest-note {
  background: #064E3B !important;
  border-color: #065F46 !important;
  color: #6EE7B7 !important;
}
[data-theme="dark"] .guest-banner {
  background: #064E3B !important;
  color: #6EE7B7 !important;
}
[data-theme="dark"] .guest-banner-dismiss:hover {
  background: #065F46 !important;
}
[data-theme="dark"] .tp-action-btn.danger {
  color: #F87171 !important;
}
[data-theme="dark"] .tp-action-btn.danger:hover {
  background: #3B1D1D !important;
}
[data-theme="dark"] .tp-status,
[data-theme="dark"] .tp-runway-label.behind {
  color: #FBBF24 !important;
}
[data-theme="dark"] .rycal-plan-time:hover {
  color: #E2E8F0 !important;
}

/* ---- Learn mode ---- */
[data-theme="dark"] .feedback.incorrect-feedback {
  color: #F87171 !important;
}
[data-theme="dark"] .feedback-bad .feedback-title,
[data-theme="dark"] .utility-tag-due {
  color: #FBBF24 !important;
}
[data-theme="dark"] .utility-tag-due {
  background: #3B2F0B !important;
}

/* ---- Cram sheet rate buttons ---- */
[data-theme="dark"] .cram-rate-btn.is-on[data-cram-rate="didnt"] {
  background: #3B2F0B !important;
  color: #FDE68A !important;
  border-color: #92400E !important;
}

/* ---- AP practice ---- */
[data-theme="dark"] .ap-notice,
[data-theme="dark"] .stimulus-described {
  background: #162033 !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .ap-results-timer-note,
[data-theme="dark"] .ap-skill-tag {
  background: #1E293B !important;
  color: #94A3B8 !important;
}
[data-theme="dark"] .ap-review-item {
  border-left-color: #475569 !important;
}
[data-theme="dark"] .ap-nav-btn.is-answered {
  background: #064E3B !important;
}

/* ---- Psych exam practice ---- */
[data-theme="dark"] .psych-stimulus,
[data-theme="dark"] .psych-practice-note {
  background: #162033 !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

/* ---- Importer ---- */
[data-theme="dark"] .importer-preview-def,
[data-theme="dark"] .importer-drop {
  color: #E2E8F0 !important;
}

/* ---- Admin ---- */
[data-theme="dark"] .admin-feedback-chip {
  background: #1E293B !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .admin-feedback-status-new {
  background: #3B2F0B !important;
  color: #FDE68A !important;
}
[data-theme="dark"] .admin-feedback-status-reviewing {
  background: #1E3A5F !important;
  color: #93C5FD !important;
}
[data-theme="dark"] .admin-feedback-status-fixed {
  background: #064E3B !important;
  color: #6EE7B7 !important;
}
[data-theme="dark"] .admin-feedback-status-closed {
  background: #334155 !important;
  color: #94A3B8 !important;
}
[data-theme="dark"] .admin-feedback-empty {
  border-color: #475569 !important;
}

/* ---- Deep work / engagement ---- */
[data-theme="dark"] .deep-engagement-status {
  background: #1E293B !important;
  color: #94A3B8 !important;
}
[data-theme="dark"] .deep-engagement-status.active {
  background: #064E3B !important;
  color: #6EE7B7 !important;
}
[data-theme="dark"] .deep-engagement-status.paused {
  background: #3B2F0B !important;
  color: #FDE68A !important;
}
[data-theme="dark"] .deep-assignment-banner,
[data-theme="dark"] .adaptive-how {
  background: #162033 !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .deep-step-number {
  color: #E2E8F0 !important;
}
[data-theme="dark"] .deep-toast {
  color: #E2E8F0 !important;
}

/* ---- Result guest nudge ---- */
[data-theme="dark"] .result-guest-nudge {
  background: #064E3B !important;
  border-color: #065F46 !important;
  color: #6EE7B7 !important;
}

/* ---- Gov additions ---- */
[data-theme="dark"] .gov-progress-card,
[data-theme="dark"] .gov-guidance-card {
  background: #1E293B !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}

/* ---- Tables ---- */
[data-theme="dark"] .rycal-data-table th,
[data-theme="dark"] .rycal-data-table td,
[data-theme="dark"] .ef-table th,
[data-theme="dark"] .ef-table td {
  border-bottom-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .ef-meta-row {
  border-bottom-color: #334155 !important;
}

/* ---- Flash toolbar and hints ---- */
[data-theme="dark"] .flash-toolbar,
[data-theme="dark"] .kbd-hint kbd {
  border-color: #334155 !important;
}
[data-theme="dark"] .flash-mode-banner,
[data-theme="dark"] .flash-skip-reminder,
[data-theme="dark"] .flash-skip-reminder p {
  color: #94A3B8 !important;
}
[data-theme="dark"] .flash-skip-title {
  color: #FBBF24 !important;
}
[data-theme="dark"] .flash-unrated-badge {
  color: #FBBF24 !important;
}
[data-theme="dark"] .flash-speak-btn:hover {
  color: #94A3B8 !important;
}

/* ---- Mastery heatmap ---- */
[data-theme="dark"] .mastery-cell.m-stable .mastery-sub {
  color: #34D399 !important;
}
[data-theme="dark"] .mastery-cell.m-mixed .mastery-sub {
  color: #FBBF24 !important;
}
[data-theme="dark"] .mastery-cell.m-weak .mastery-sub {
  color: #F87171 !important;
}

/* ---- Science/landing pages ---- */
[data-theme="dark"] .science-hero .quiet-principle {
  color: #E2E8F0 !important;
}
[data-theme="dark"] .teacher-hero,
[data-theme="dark"] .progress-hero {
  background: #0F172A !important;
}
[data-theme="dark"] .home-card.primary-course {
  background: #1E293B !important;
}

/* ---- Brain delta ---- */
[data-theme="dark"] .brain-delta-down {
  background: #3B1D1D !important;
  color: #F87171 !important;
}
[data-theme="dark"] .deep-parked-x:hover {
  color: #F87171 !important;
}

/* ---- Set share ---- */
[data-theme="dark"] .set-share-link {
  background: #0F172A !important;
  border-color: #334155 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .set-favorite-button.saved {
  background: #064E3B !important;
}

/* ---- Empty states ---- */
[data-theme="dark"] .empty-sets {
  border-color: #475569 !important;
  color: #94A3B8 !important;
}
[data-theme="dark"] .all-card-row {
  border-color: #334155 !important;
}

/* ---- Compact buttons ---- */
[data-theme="dark"] .compact-button:hover,
[data-theme="dark"] .flash-action-btn:hover,
[data-theme="dark"] .dashboard-class-card:hover,
[data-theme="dark"] .home-card:hover,
[data-theme="dark"] .unit-card:hover,
[data-theme="dark"] .study-source-card:hover,
[data-theme="dark"] .topic-card:hover,
[data-theme="dark"] .science-card[open] {
  border-color: #34D399 !important;
}

/* ---- SVG chart grids ---- */
[data-theme="dark"] .chart-grid {
  stroke: #334155 !important;
}
[data-theme="dark"] .rycal-visual {
  border-color: #334155 !important;
}

/* ---- Landing page hero card ---- */
[data-theme="dark"] .landing-final {
  background: #1E293B !important;
  border: 1px solid #334155 !important;
}
[data-theme="dark"] .landing-final h2 {
  color: #E2E8F0 !important;
}
[data-theme="dark"] .landing-final p {
  color: #94A3B8 !important;
}

/* ============================================================
   AUDITOR 1 FIXES (2026-10-05) - Visual consistency pass
   ============================================================ */

/* ---- Sidebar navigation (light-refinement-v6.css) ---- */
[data-theme="dark"] .sidebar-link.active {
  background: #064E3B !important;
  color: #6EE7B7 !important;
}
[data-theme="dark"] .sidebar-link .nav-icon {
  color: #34D399 !important;
}
[data-theme="dark"] .sidebar-link.active .nav-icon {
  color: #6EE7B7 !important;
}
[data-theme="dark"] .sidebar-link:hover {
  background: #1E293B !important;
}

/* ---- Mastery heatmap legend ---- */
[data-theme="dark"] .mastery-legend .needs {
  color: #F87171 !important;
}
[data-theme="dark"] .mastery-legend .learning {
  color: #FBBF24 !important;
}
[data-theme="dark"] .mastery-legend .strong {
  color: #34D399 !important;
}
[data-theme="dark"] .mastery-legend .later {
  color: #94A3B8 !important;
}

/* ---- Psych exam practice (FRQ scoring) ---- */
[data-theme="dark"] .aaq-score-points {
  color: #34D399 !important;
}
[data-theme="dark"] .psych-frq-section h3 {
  color: #34D399 !important;
}

/* ---- Deep work / assignment completion ---- */
[data-theme="dark"] .assignment-complete {
  color: #34D399 !important;
}
[data-theme="dark"] .rc5-status.complete {
  color: #34D399 !important;
}

/* ---- Starter deck source links ---- */
[data-theme="dark"] .starter-deck-sources a {
  color: #34D399 !important;
}

/* ---- Mobile: chart SVG overflow fix ---- */
@media (max-width: 600px) {
  [data-theme="dark"] .chart-svg,
  .chart-svg {
    min-width: 0 !important;
    max-width: 100% !important;
  }
}

/* ---- Light-tinted backgrounds (second pass) ---- */
[data-theme="dark"] .flow-box {
  background: #162033 !important;
  border-color: #34D399 !important;
  color: #E2E8F0 !important;
}
[data-theme="dark"] .deep-privacy-note {
  background: #162033 !important;
  border-left-color: #475569 !important;
}
[data-theme="dark"] .privacy-promise-grid > div {
  background: #1E293B !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .rc5-import-panel {
  background: #162033 !important;
  border-color: #334155 !important;
}
[data-theme="dark"] .bar-chart i {
  background: #475569 !important;
  border-left-color: #34D399 !important;
}
[data-theme="dark"] .bar-chart b {
  color: #E2E8F0 !important;
}
[data-theme="dark"] .visual-caption {
  color: #94A3B8 !important;
}
[data-theme="dark"] .flow-arrow {
  color: #94A3B8 !important;
}

/* ---- Landing problem card (same slate-950 inversion issue) ---- */
[data-theme="dark"] .landing-problem {
  background: #1E293B !important;
  border: 1px solid #334155 !important;
}
[data-theme="dark"] .landing-problem h2 {
  color: #E2E8F0 !important;
}
[data-theme="dark"] .landing-problem p {
  color: #94A3B8 !important;
}

/* ---- Methodology paper contents card ---- */
[data-theme="dark"] .paper-toc,
[data-theme="dark"] .methodology-toc,
[data-theme="dark"] .toc-card,
[data-theme="dark"] [class*="contents-card"] {
  background: #1E293B !important;
  border-color: #334155 !important;
}

/* ---- Cram sheet: --bg-subtle was missing a dark override ---- */
[data-theme="dark"] {
  --bg-subtle: #162033 !important;
}

/* ---- Wordmark: light text variant in dark mode ---- */
.wordmark-dark { display: none; }
[data-theme="dark"] .wordmark-light { display: none; }
[data-theme="dark"] .wordmark-dark { display: inline; }
[data-theme="dark"] img.rycal-logo-auth.wordmark-dark { display: block; }

/* ---- Footer: buttons match link color in dark mode ---- */
[data-theme="dark"] .site-footer button,
[data-theme="dark"] footer button {
  color: #94A3B8 !important;
}
[data-theme="dark"] .site-footer button:hover,
[data-theme="dark"] footer button:hover {
  color: #E2E8F0 !important;
}

/* ---- Heroes: deep green gradients in dark mode, never neon ---- */
[data-theme="dark"] .landing-hero,
[data-theme="dark"] .science-hero {
  background: linear-gradient(135deg, #064E3B, #065F46) !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, .35) !important;
}
[data-theme="dark"] .science-hero a {
  color: #A7F3D0 !important;
  text-decoration: underline;
}
[data-theme="dark"] .guest-principle {
  background: #064E3B !important;
}
[data-theme="dark"] .guest-principle .home-kicker {
  color: #A7F3D0 !important;
}

/* ---- Try-cue pills: soft mint text, no neon glow ---- */
[data-theme="dark"] .try-cue {
  color: #A7F3D0 !important;
}
[data-theme="dark"] .science-example strong {
  color: #A7F3D0 !important;
}

/* ---- html background: no white strip on short pages ---- */
/* NOTE: data-theme is set on <html> itself, so the selector must be
   html[data-theme="dark"] — "[data-theme=dark] html" never matches. */
html[data-theme="dark"],
html[data-theme="dark"] body {
  background-color: #0F172A !important;
}

/* ---- Theme toggle: larger, brighter icon ---- */
[data-theme="dark"] .theme-toggle {
  color: #E2E8F0 !important;
}

/* ---- Theme toggle: filled icons need strong color in both modes ---- */
.theme-toggle {
  color: #475569 !important;
}
