/* Shared appearance controls work on public, account and workspace pages. */
.appearance-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.theme-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--type-xs);
  color: var(--muted);
}
/* The top bar's compact select (docs/DESIGN-SYSTEM.md). */
.theme-control select {
  font: inherit;
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  color: var(--ink);
  background: var(--white);
}
.report-history-row {
  color: var(--ink);
  background: var(--white);
}
.report-history-row small {
  color: var(--muted);
}
.report-results-heading .eyebrow {
  color: var(--muted);
}
/* Dark: only what the components' tokens do not decide (docs/DESIGN-SYSTEM.md). */
[data-theme='dark'] caption {
  color: var(--muted);
}
/* Preserve provider logos, photographs, videos and QR pixels. Only interface surfaces change. */
[data-theme='dark'] body {
  color: var(--ink);
  background: var(--paper);
}
/* An ID member gives the whole group its specificity: no component with variants or states here. */
[data-theme='dark']
  :is(
    .empty,
    .endpoint-box,
    .command-trigger,
    #command-results button,
    .social-button,
    .report-summary-card,
    .report-pack
  ) {
  color: var(--ink);
  background: var(--white);
  border-color: var(--line);
}
[data-theme='dark']
  :is(
    .report-control-top,
    .report-runbar,
    .report-progress,
    .report-options[open] > summary,
    .code-block,
    .manage-footer,
    .platform-metrics,
    .stat-icon,
    .asset-count,
    .feature-ai,
    .feature-icon,
    .hero-stage,
    .mini-plan,
    .mini-plan b,
    .frame-story,
    .client-cloud span,
    .evidence-tags span,
    .auth-page,
    .auth-story,
    .auth-divider span,
    .account-hero,
    .workspace-metrics article,
    .account-monogram,
    .session-icon,
    .quick-actions > a,
    .quick-actions > a > span,
    .activity-failure,
    .source-next-action,
    .report-platform-dot,
    .measurement-task-links a,
    .recovery-key,
    code
  ) {
  color: var(--ink);
  background: var(--surface-subtle);
  border-color: var(--line);
}
[data-theme='dark'] :is(p, label, summary, th, dt, .brand, .how-steps li > span) {
  color: inherit;
}
[data-theme='dark'] :is(small, .eyebrow, .report-section-label > span, .target-currency-row label) {
  color: var(--muted);
}
[data-theme='dark'] :is(.public-nav nav a, #breadcrumb, footer a) {
  color: var(--muted);
}
[data-theme='dark'] article strong {
  color: var(--ink);
}
[data-theme='dark'] :is(a.text-link, .auth-legal a, .hero-copy h1 > span) {
  color: var(--iris-700);
}
[data-theme='dark'] .password-toggle {
  color: var(--muted);
  background: var(--white);
}
[data-theme='dark']
  :is(input:not([type='checkbox']):not([type='radio']):not([type='color']), select, textarea, .search) {
  color: var(--ink);
  background: var(--white);
  border-color: var(--line-strong);
}
[data-theme='dark'] ::placeholder {
  color: var(--muted);
  opacity: 1;
}
/* Hover and selected. Primary and danger buttons, warning and error notices keep their own. */
[data-theme='dark']
  :is(
    .button:not(.primary, .danger):hover:where(:not(:disabled)),
    .social-button:hover:not(:disabled),
    #command-results button:hover,
    #command-results button:focus,
    .measurement-task-links a:hover,
    .measurement-task-links a:focus-visible,
    .filter-tab.active,
    .client-tab.active,
    .default-badge,
    .report-table th,
    .notice:not(.warning, .error),
    .avatar
  ) {
  color: var(--ink);
  background: var(--surface-accent);
  border-color: var(--line-strong);
}
/* Recommendation decisions take their dark colours from the decision tokens (reporting.css), never from these groups. */
[data-theme='dark'] :is(.auth-success, .callback-step.done) {
  color: var(--success-ink);
  background: var(--success-bg);
  border-color: var(--success-ink);
}
[data-theme='dark'] .callback-step.failed {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: var(--danger);
}
[data-theme='dark'] :is(.error, .status.error) {
  color: var(--danger);
}
[data-theme='dark'] .auth-form-card .owner-entry {
  background: var(--surface-subtle);
}
[data-theme='dark'] .auth-form-card .owner-entry .eyebrow {
  color: var(--muted);
}
[data-theme='dark'] .auth-divider:before {
  background: var(--line);
}
[data-theme='dark'] .platform-logo.x {
  color-scheme: light;
  background: Canvas;
  border-radius: 6px;
}
[data-theme='dark'] ::selection {
  color: var(--on-accent);
  background: var(--iris);
}
@media (max-width: 600px) {
  .theme-control > span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
}
