html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="dark"] body {
  --color-bg: #091218;
  --color-bg-accent: #102029;
  --color-surface: #112028;
  --color-surface-soft: #162a34;
  --color-surface-strong: #1b3540;
  --color-text: #ebf5f3;
  --color-text-muted: #adc0c8;
  --color-text-soft: #89a1aa;
  --color-border: #234451;
  --color-border-strong: #2f5f70;
  --color-primary: #38bdf8;
  --color-primary-strong: #7dd3fc;
  --color-secondary: #4ade80;
  --gradient-hero: linear-gradient(135deg, rgba(56, 189, 248, 0.18), rgba(74, 222, 128, 0.08));
  --gradient-panel: linear-gradient(180deg, rgba(17, 32, 40, 0.98), rgba(11, 22, 28, 0.96));
  --gradient-progress: linear-gradient(90deg, #38bdf8 0%, #4ade80 100%);
  --shadow-sm: 0 14px 26px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 22px 48px rgba(0, 0, 0, 0.36);
  --shadow-focus: 0 0 0 4px rgba(56, 189, 248, 0.18);
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(74, 222, 128, 0.08), transparent 24%),
    var(--color-bg);
}

html[data-theme="dark"] .hero {
  border-color: rgba(56, 189, 248, 0.14);
}

html[data-theme="dark"] .pill {
  background: rgba(56, 189, 248, 0.10);
  color: #d7f4ff;
}

html[data-theme="dark"] .pill--ghost {
  background: rgba(17, 32, 40, 0.72);
  border-color: rgba(56, 189, 248, 0.16);
}

html[data-theme="dark"] .workflow-nav__item {
  background: rgba(17, 32, 40, 0.88);
  border-color: var(--color-border);
}

html[data-theme="dark"] .workflow-nav__item--locked {
  background: rgba(17, 32, 40, 0.62);
}

html[data-theme="dark"] .workflow-nav__item--complete {
  background: rgba(15, 118, 110, 0.14);
  border-color: rgba(45, 212, 191, 0.18);
}

html[data-theme="dark"] .workflow-nav__item--active {
  background: rgba(56, 189, 248, 0.18);
  border-color: #7dd3fc;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

html[data-theme="dark"] .workflow-nav__index {
  background: rgba(9, 18, 24, 0.92);
  color: #d7f4ff;
  box-shadow: inset 0 0 0 1px rgba(125, 211, 252, 0.14);
}

html[data-theme="dark"] .workflow-nav__item--complete .workflow-nav__index {
  background: rgba(15, 118, 110, 0.18);
  color: #d5ffe3;
}

html[data-theme="dark"] input,
html[data-theme="dark"] textarea {
  background: rgba(10, 20, 26, 0.7);
  color: var(--color-text);
}

html[data-theme="dark"] input[type="file"] {
  background: rgba(16, 32, 41, 0.9);
}

html[data-theme="dark"] .button--secondary {
  background: rgba(17, 32, 40, 0.88);
  color: var(--color-text);
}

html[data-theme="dark"] .button--secondary:hover {
  color: var(--color-primary-strong);
}

html[data-theme="dark"] .scope-switch__item,
html[data-theme="dark"] .flow-view-switch__item,
html[data-theme="dark"] .rubric-subpanel,
html[data-theme="dark"] .concept-mode-guide__item,
html[data-theme="dark"] .concept-group-item,
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .summary-table-card,
html[data-theme="dark"] .research-card,
html[data-theme="dark"] .research-summary-course__surface,
html[data-theme="dark"] .research-summary-metric,
html[data-theme="dark"] .research-monitor-card,
html[data-theme="dark"] .research-console,
html[data-theme="dark"] .research-console__status,
html[data-theme="dark"] .research-progress-event,
html[data-theme="dark"] .analysis-loading,
html[data-theme="dark"] .analysis-kpi,
html[data-theme="dark"] .results-chart-card,
html[data-theme="dark"] .results-card {
  background: rgba(17, 32, 40, 0.88);
  border-color: var(--color-border);
}

html[data-theme="dark"] .research-summary-course__surface,
html[data-theme="dark"] .research-console {
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(17, 32, 40, 0.96), rgba(11, 22, 28, 0.94));
}

html[data-theme="dark"] .research-monitor-card--timer,
html[data-theme="dark"] .research-summary-callout,
html[data-theme="dark"] .results-card--insight {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.12), rgba(17, 32, 40, 0.92));
}

html[data-theme="dark"] .research-summary-availability {
  background: rgba(18, 36, 44, 0.94);
}

html[data-theme="dark"] .concept-mode-chip--active {
  border-color: #7dd3fc;
  background: rgba(56, 189, 248, 0.18);
  color: #ebf5f3;
  box-shadow:
    inset 0 0 0 1px rgba(125, 211, 252, 0.18),
    0 0 0 3px rgba(56, 189, 248, 0.14);
}

html[data-theme="dark"] .button--link {
  color: var(--color-primary-strong);
}

html[data-theme="dark"] .button--reset {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #101418;
  box-shadow: 0 16px 30px rgba(217, 119, 6, 0.18);
}

html[data-theme="dark"] .button--reset:hover {
  background: linear-gradient(135deg, #fbbf24, #ea580c);
}

html[data-theme="dark"] .results-nav__item {
  background: rgba(17, 32, 40, 0.88);
  border-color: var(--color-border);
  color: var(--color-text);
}

html[data-theme="dark"] .results-nav__item--active {
  border-color: #7dd3fc;
  background: rgba(56, 189, 248, 0.18);
  color: #ebf5f3;
  box-shadow:
    inset 0 0 0 1px rgba(125, 211, 252, 0.18),
    0 0 0 3px rgba(56, 189, 248, 0.14);
}

html[data-theme="dark"] .analysis-loading__copy,
html[data-theme="dark"] .results-chart-card__subtitle,
html[data-theme="dark"] .results-card__copy,
html[data-theme="dark"] .analysis-kpi__label,
html[data-theme="dark"] .results-row__label {
  color: var(--color-text-muted);
}

html[data-theme="dark"] .analysis-kpi__value,
html[data-theme="dark"] .results-row__value,
html[data-theme="dark"] .results-card__title {
  color: var(--color-text);
}

html[data-theme="dark"] .results-progress__track {
  background: rgba(56, 189, 248, 0.16);
}

html[data-theme="dark"] .results-chart__grid {
  stroke: rgba(148, 163, 184, 0.14);
}

html[data-theme="dark"] .results-chart__axis-line {
  stroke: rgba(148, 163, 184, 0.45);
}

html[data-theme="dark"] .results-chart__axis-label {
  fill: var(--color-text-muted);
}

html[data-theme="dark"] .results-chart__tick-label,
html[data-theme="dark"] .results-chart__legend-item {
  fill: var(--color-text-soft);
  color: var(--color-text-soft);
}

html[data-theme="dark"] .results-chart__empty {
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

html[data-theme="dark"] .back-to-top {
  background: rgba(255, 255, 255, 0.5);
  color: #091218;
}

html[data-theme="dark"] .back-to-top:hover {
  background: rgba(255, 255, 255, 0.58);
}

html[data-theme="dark"] .back-to-top__icon::before,
html[data-theme="dark"] .back-to-top__icon::after {
  background: #091218;
}

html[data-theme="dark"] .scope-switch__title,
html[data-theme="dark"] .rule-field-label {
  color: var(--color-primary-strong);
}

html[data-theme="dark"] .subpanel-title,
html[data-theme="dark"] .concept-mode-guide__title,
html[data-theme="dark"] .research-progress-event__stage,
html[data-theme="dark"] .research-summary-metric__value,
html[data-theme="dark"] .research-monitor-card__timer {
  color: var(--color-primary-strong);
}

html[data-theme="dark"] .helper-text,
html[data-theme="dark"] .concept-mode-guide__copy,
html[data-theme="dark"] .scope-switch__meta,
html[data-theme="dark"] .research-summary-course__file,
html[data-theme="dark"] .research-progress-event__time,
html[data-theme="dark"] .research-monitor-card__label,
html[data-theme="dark"] .research-summary-metric__label,
html[data-theme="dark"] .summary-card__label,
html[data-theme="dark"] .summary-table__label,
html[data-theme="dark"] .metric-card__label,
html[data-theme="dark"] .result-detail__label {
  color: var(--color-text-muted);
}

html[data-theme="dark"] .concept-group-item__footer .helper-text {
  color: #ebf5f3;
}

html[data-theme="dark"] .scope-switch__item--active,
html[data-theme="dark"] .flow-view-switch__item--active,
html[data-theme="dark"] .results-nav__item--active {
  color: #ebf5f3;
}

html[data-theme="dark"] .summary-card__value,
html[data-theme="dark"] .summary-table__value,
html[data-theme="dark"] .metric-card__value,
html[data-theme="dark"] .result-detail__value,
html[data-theme="dark"] .research-monitor-card__value,
html[data-theme="dark"] .research-console__status,
html[data-theme="dark"] .research-progress-event__message-line,
html[data-theme="dark"] .results-data-table td {
  color: var(--color-text);
}

html[data-theme="dark"] .file-status,
html[data-theme="dark"] .analysis-loading__badge {
  background: rgba(56, 189, 248, 0.14);
  color: #d7f4ff;
}

html[data-theme="dark"] .summary-table__row,
html[data-theme="dark"] .metric-card,
html[data-theme="dark"] .progress-panel,
html[data-theme="dark"] .results-table-wrap {
  background: rgba(18, 36, 44, 0.94);
  border-color: var(--color-border);
}

html[data-theme="dark"] .results-data-table th {
  background: rgba(24, 47, 58, 0.96);
  color: var(--color-text-muted);
}

html[data-theme="dark"] .results-data-table th,
html[data-theme="dark"] .results-data-table td {
  border-color: rgba(84, 122, 138, 0.22);
}

html[data-theme="dark"] .banner--info {
  background: rgba(56, 189, 248, 0.10);
  border-color: rgba(56, 189, 248, 0.16);
  color: #bdeeff;
}

html[data-theme="dark"] .banner--success {
  background: rgba(74, 222, 128, 0.10);
  border-color: rgba(74, 222, 128, 0.16);
  color: #d5ffe3;
}

html[data-theme="dark"] .banner--error {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.20);
  color: #ffd5d5;
}

html[data-theme="dark"] .reset-panel {
  border-color: rgba(245, 158, 11, 0.18);
  background: linear-gradient(180deg, rgba(44, 28, 12, 0.98), rgba(31, 20, 10, 0.96));
}

html[data-theme="dark"] .progress-track {
  background: rgba(56, 189, 248, 0.16);
}

html[data-theme="dark"] .footer-bar {
  color: #93adb8;
}

html[data-theme="dark"] .is-busy input:not([type="checkbox"]):not([type="file"]),
html[data-theme="dark"] .is-busy textarea {
  background: rgba(18, 36, 44, 0.92);
  color: var(--color-text-muted);
}
