:root {
  color-scheme: light;
  --surface-soft: #eef1ec;
  --surface-subtle: #f7f9f6;
  --surface-warm: #fffdf7;
  --field-border: #cdd5ce;
  --status-bg: #e6eee8;
  --status-border: #cedbd2;
  --chart-grid: #e4e8e2;
  --sticky-surface: rgba(255, 255, 255, .96);
  --accent-ink: #fff;
  --attention-surface: #fffaf0;
  --danger-surface: #fff1f0;
  --danger-ink: #7c2926;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8f0eb;
  --muted: #a5b4ac;
  --paper: #0b1410;
  --card: #14221c;
  --line: #2b3d34;
  --green: #75d5ad;
  --red: #ff928c;
  --nav: #07110d;
  --shadow: 0 18px 50px rgba(0, 0, 0, .28);
  --surface-soft: #1b2b24;
  --surface-subtle: #112019;
  --surface-warm: #211f17;
  --field-border: #385045;
  --status-bg: #193126;
  --status-border: #315343;
  --chart-grid: #2b3c34;
  --sticky-surface: rgba(20, 34, 28, .96);
  --accent-ink: #07110d;
  --attention-surface: #2a2518;
  --danger-surface: #301b1b;
  --danger-ink: #ffaaa5;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"] {
    color-scheme: dark;
    --ink: #e8f0eb;
    --muted: #a5b4ac;
    --paper: #0b1410;
    --card: #14221c;
    --line: #2b3d34;
    --green: #75d5ad;
    --red: #ff928c;
    --nav: #07110d;
    --shadow: 0 18px 50px rgba(0, 0, 0, .28);
    --surface-soft: #1b2b24;
    --surface-subtle: #112019;
    --surface-warm: #211f17;
    --field-border: #385045;
    --status-bg: #193126;
    --status-border: #315343;
    --chart-grid: #2b3c34;
    --sticky-surface: rgba(20, 34, 28, .96);
    --accent-ink: #07110d;
    --attention-surface: #2a2518;
    --danger-surface: #301b1b;
    --danger-ink: #ffaaa5;
  }
}

body { background: var(--paper); color: var(--ink); }
.button,
input,
select,
textarea,
.article-card,
.detail,
.customer-intro,
.customer-summary,
.customer-card,
.evaluation-detail,
.customer-workspace-card,
.customer-module-card,
.dedupe-stats div,
.editorial-stats > div,
.editorial-card,
.visual-editor,
.editor-toolbar button,
.editor-toolbar select,
.media-result,
.analysis-direction-option,
.revision-card,
.manual-source-list { background: var(--card); color: var(--ink); }
input,
select,
textarea,
.visual-editor { border-color: var(--field-border); }
.button.ghost:hover,
.editor-toolbar,
.health-card,
.sent-email-body pre,
.revision-comparison details,
.case-section pre,
.inbox-message pre,
.question-assessment blockquote,
.gap-scores span,
.source-owner-grid > div,
.empty-recipient-questions,
.manual-question-form,
.article-send-form,
.source-help { background: var(--surface-soft); color: var(--ink); border-color: var(--line); }
.selector-examples span,
.responsive-table tr { background: var(--card); color: var(--ink); }
.source-help code,
.field-help code { background: var(--surface-soft); color: var(--green); }
.case-row.unread { background: var(--surface-warm); }
.journalist-analysis,
.health-chart-frame,
.media-preview { background: var(--surface-subtle); }
.status-pill { background: var(--status-bg); border-color: var(--status-border); }
.editorial-actions { background: var(--sticky-surface); border-color: var(--line); }
.health-chart svg .grid { stroke: var(--chart-grid); }
.article-thumb,
.editorial-placeholder { background: var(--surface-soft); }
.credential-card,
.overview-stats .stat-card.attention { background: var(--attention-surface); color: var(--ink); }
.overview-notice,
.journalist-analysis.failed { background: var(--danger-surface); color: var(--danger-ink); }
.stat-card.accent,
.button.primary,
.score-orb { color: var(--accent-ink); }
.mfa-qr { background: #fff; }

.dashboard-footer {
  display: flex;
  min-width: 0;
  max-width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 44px;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}
.footer-identity { display: grid; gap: 4px; min-width: 0; }
.footer-identity span { font-size: 10px; font-weight: 850; letter-spacing: 1px; text-transform: uppercase; }
.footer-identity strong { overflow-wrap: anywhere; color: var(--ink); font-size: 13px; }
.theme-picker { display: flex; min-width: 0; max-width: 100%; align-items: center; gap: 10px; }
.theme-picker fieldset { display: flex; min-width: 0; max-width: 100%; gap: 4px; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.theme-picker .analytics-picker { flex: none; }
.theme-picker legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.theme-picker label { display: block; cursor: pointer; }
.theme-picker input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  border: 0;
  opacity: 0;
  white-space: nowrap;
}
.theme-picker label span { display: block; padding: 8px 11px; border-radius: 8px; color: var(--muted); font-size: 12px; font-weight: 750; }
.theme-picker input:checked + span { background: var(--green); color: var(--nav); }
.theme-picker input:focus-visible + span { outline: 3px solid rgba(217, 243, 106, .6); outline-offset: 1px; }
.theme-save { min-height: 38px; padding: 7px 10px; font-size: 12px; }
.theme-picker.theme-enhanced .theme-save { display: none; }

@media (max-width: 700px) {
  .dashboard-footer { align-items: stretch; flex-direction: column; gap: 16px; margin-top: 32px; }
  .theme-picker { align-items: stretch; }
  .theme-picker fieldset { flex: 1; }
  .theme-picker .analytics-picker { flex: none; }
  .theme-picker label { flex: 1; text-align: center; }
  .theme-picker label span { padding-inline: 7px; }
}
