/* Leitstand – Design-Fundament: Tokens, Basis-Typografie, Fokus, Reduced-Motion.
   Werte exakt aus DESIGN.md. Layout/Komponenten stehen in app.css. */

@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@500;600;700&family=Source+Sans+3:wght@400;500;600&display=swap');

:root {
  /* Farb-Tokens Light (Default) */
  --bg:#F8FAFC; --fg:#020617;
  --card:#FFFFFF; --card-fg:#020617;
  --muted:#E8ECF1; --muted-fg:#64748B;
  --border:#E2E8F0;
  --primary:#0F172A; --primary-fg:#FFFFFF;      /* Navy: Header, primäre Flächen */
  --accent:#0369A1; --accent-fg:#FFFFFF;        /* Aktionen, Links, aktive Nav */
  --success:#16A34A; --warning:#D97706; --danger:#DC2626;
  --success-bg:#F0FDF4; --warning-bg:#FFFBEB; --danger-bg:#FEF2F2;
  --success-fg:#166534; --warning-fg:#92400E; --danger-fg:#991B1B;
  --shadow:0 1px 2px rgba(2,6,23,.06), 0 4px 12px rgba(2,6,23,.06);

  /* Highlight-Flash für Live-Sync (siehe app.css .row-flash), abgeleitet aus --accent */
  --accent-flash: rgba(3,105,161,.12);

  /* Ergänzende Implementierungs-Tokens (nicht in DESIGN.md, additiv für Layout/Komponenten) */
  --font-heading: 'Lexend', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius-card: 12px;
  --radius-control: 8px;
  --sidebar-width: 220px;
  --sidebar-width-collapsed: 64px;
  --topbar-height: 60px;
  --bottom-tabs-height: 64px;
  --content-max: 1400px;

  color-scheme: light;
}

[data-theme="dark"] {
  /* Farb-Tokens Dark */
  --bg:#020617; --fg:#F8FAFC;
  --card:#0E1223; --card-fg:#F8FAFC;
  --muted:#1A1E2F; --muted-fg:#94A3B8;
  --border:#334155;
  --primary:#1E293B; --primary-fg:#F8FAFC;
  --accent:#38BDF8; --accent-fg:#020617;
  --success:#22C55E; --warning:#F59E0B; --danger:#EF4444;
  --success-bg:rgba(34,197,94,.12); --warning-bg:rgba(245,158,11,.12); --danger-bg:rgba(239,68,68,.14);
  --success-fg:#4ADE80; --warning-fg:#FCD34D; --danger-fg:#FCA5A5;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 4px 12px rgba(0,0,0,.3);

  --accent-flash: rgba(56,189,248,.14);

  color-scheme: dark;
}

/* Basis-Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (min-width: 768px) {
  body { font-size: 16px; }
}

img, svg { display: block; max-width: 100%; }

/* Basis-Typografie */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 8px;
  color: var(--fg);
}
h1 { font-size: 1.5rem; font-weight: 700; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.0625rem; }
p { margin: 0 0 12px; }
small { font-size: .8125rem; color: var(--muted-fg); }
strong { font-weight: 600; }

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }

ul, ol { margin: 0; padding-left: 1.25em; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* Zahlen: immer tabellarisch (Tabellen, KPIs) */
.num, table, .tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Sichtbarer Fokus-Ring – 3px accent auf :focus-visible */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Nur für Screenreader sichtbar */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced Motion: alle Übergänge/Animationen praktisch deaktivieren, Highlights bleiben statisch */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
