/* Design Tokens: Light & Dark Themes, Typography, Spacing, Radii, Elevation */

:root {
  color-scheme: light dark;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Light Palette */
  --bg-canvas: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-surface-alt: #f8fafc;
  --bg-surface-hover: #f1f5f9;
  --bg-inset: #e2e8f0;
  --bg-topbar: rgba(255, 255, 255, 0.92);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.14);

  /* Semantic Accents */
  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-primary-soft: rgba(79, 70, 229, 0.12);

  --status-success: #059669;
  --status-success-soft: rgba(16, 185, 129, 0.14);
  --status-success-border: rgba(16, 185, 129, 0.35);

  --status-warning: #d97706;
  --status-warning-soft: rgba(245, 158, 11, 0.14);
  --status-warning-border: rgba(245, 158, 11, 0.38);

  --status-danger: #e11d48;
  --status-danger-soft: rgba(244, 63, 94, 0.13);
  --status-danger-border: rgba(244, 63, 94, 0.35);

  --status-info: #0284c7;
  --status-info-soft: rgba(14, 165, 233, 0.14);
  --status-info-border: rgba(14, 165, 233, 0.35);

  --status-neutral: #475569;
  --status-neutral-soft: rgba(100, 116, 139, 0.14);
  --status-neutral-border: rgba(100, 116, 139, 0.32);

  /* Chart Series Colors */
  --chart-accepted: #10b981;
  --chart-modified: #0ea5e9;
  --chart-quarantined-ai: #6366f1;
  --chart-quarantined-static: #f59e0b;
  --chart-rejected: #f43f5e;
  --chart-discarded: #9f1239;
  --chart-grid: #e2e8f0;

  /* Dimensions */
  --sidebar-width: 224px;
  --topbar-height: 56px;
  --bottom-nav-height: 62px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --touch-min: 44px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-canvas: #0b1120;
    --bg-surface: #111827;
    --bg-surface-alt: #172033;
    --bg-surface-hover: #1e293b;
    --bg-inset: #0f172a;
    --bg-topbar: rgba(17, 24, 39, 0.92);

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-inverse: #0f172a;

    --border-subtle: #1e293b;
    --border-strong: #334155;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.55);

    --accent-primary: #6366f1;
    --accent-primary-hover: #818cf8;
    --accent-primary-soft: rgba(99, 102, 241, 0.2);

    --status-success: #34d399;
    --status-success-soft: rgba(16, 185, 129, 0.16);
    --status-success-border: rgba(52, 211, 153, 0.35);

    --status-warning: #fbbf24;
    --status-warning-soft: rgba(245, 158, 11, 0.16);
    --status-warning-border: rgba(251, 191, 36, 0.35);

    --status-danger: #fb7185;
    --status-danger-soft: rgba(244, 63, 94, 0.18);
    --status-danger-border: rgba(251, 113, 133, 0.35);

    --status-info: #38bdf8;
    --status-info-soft: rgba(14, 165, 233, 0.18);
    --status-info-border: rgba(56, 189, 248, 0.35);

    --status-neutral: #94a3b8;
    --status-neutral-soft: rgba(148, 163, 184, 0.16);
    --status-neutral-border: rgba(148, 163, 184, 0.3);

    --chart-accepted: #34d399;
    --chart-modified: #38bdf8;
    --chart-quarantined-ai: #818cf8;
    --chart-quarantined-static: #fbbf24;
    --chart-rejected: #fb7185;
    --chart-discarded: #e11d48;
    --chart-grid: #1e293b;
  }
}

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

  --bg-canvas: #0b1120;
  --bg-surface: #111827;
  --bg-surface-alt: #172033;
  --bg-surface-hover: #1e293b;
  --bg-inset: #0f172a;
  --bg-topbar: rgba(17, 24, 39, 0.92);

  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;

  --border-subtle: #1e293b;
  --border-strong: #334155;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.55);

  --accent-primary: #6366f1;
  --accent-primary-hover: #818cf8;
  --accent-primary-soft: rgba(99, 102, 241, 0.2);

  --status-success: #34d399;
  --status-success-soft: rgba(16, 185, 129, 0.16);
  --status-success-border: rgba(52, 211, 153, 0.35);

  --status-warning: #fbbf24;
  --status-warning-soft: rgba(245, 158, 11, 0.16);
  --status-warning-border: rgba(251, 191, 36, 0.35);

  --status-danger: #fb7185;
  --status-danger-soft: rgba(244, 63, 94, 0.18);
  --status-danger-border: rgba(251, 113, 133, 0.35);

  --status-info: #38bdf8;
  --status-info-soft: rgba(14, 165, 233, 0.18);
  --status-info-border: rgba(56, 189, 248, 0.35);

  --status-neutral: #94a3b8;
  --status-neutral-soft: rgba(148, 163, 184, 0.16);
  --status-neutral-border: rgba(148, 163, 184, 0.3);

  --chart-accepted: #34d399;
  --chart-modified: #38bdf8;
  --chart-quarantined-ai: #818cf8;
  --chart-quarantined-static: #fbbf24;
  --chart-rejected: #fb7185;
  --chart-discarded: #e11d48;
  --chart-grid: #1e293b;
}

:root[data-theme="light"] {
  color-scheme: light;
}
