/* Gemeinsame Basis: Farb-Tokens (hell/dunkel), Typografie, Karten, Buttons, Formulare, Tabellen */
:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #12161c;
  --text-2: #465061;
  --muted: #6f7888;
  --border: #dde1e7;
  --accent: #0b5cad;
  --accent-ink: #ffffff;
  --accent-soft: #e2edfa;
  --good: #0a6b2b;
  --good-bg: #dff3e4;
  --warn: #7a4f00;
  --warn-bg: #fcefcb;
  --crit: #b3261e;
  --crit-bg: #fbe3e1;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.08);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1015;
    --surface: #171b22;
    --surface-2: #20252e;
    --text: #eef1f5;
    --text-2: #bcc4cf;
    --muted: #8a94a3;
    --border: #2b323d;
    --accent: #62a8f3;
    --accent-ink: #06213d;
    --accent-soft: #17304c;
    --good: #63d386;
    --good-bg: #12321d;
    --warn: #f3c552;
    --warn-bg: #3a2e0d;
    --crit: #ff8f85;
    --crit-bg: #421b1b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: 1.15rem; line-height: 1.25; }
h3 { font-size: 1rem; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.tiny { font-size: 0.78rem; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.card > h2:first-child, .card > h3:first-child { margin-bottom: 10px; }
.eyebrow { font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--crit); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 0.875rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn svg { width: 18px; height: 18px; flex: none; }

label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 0.9rem; }
label.field > span.hint { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
input[type="text"], input[type="password"], input[type="date"], input[type="time"], input[type="number"],
input[type="search"], input[type="tel"], input[type="email"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
textarea { min-height: 96px; resize: vertical; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 0.78rem; font-weight: 650; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.crit { background: var(--crit-bg); color: var(--crit); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.note { padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--text); font-size: 0.9rem; }
.note.warn { background: var(--warn-bg); }
.note.crit { background: var(--crit-bg); }
.note.good { background: var(--good-bg); }

.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.tbl th, table.tbl td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tbl th { font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); font-weight: 650; white-space: nowrap; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl tr:last-child td { border-bottom: 0; }

.toast-host { position: fixed; left: 0; right: 0; bottom: 88px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 100; padding: 0 16px; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 0.9rem; font-weight: 550; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); max-width: 480px; }
.toast.error { background: var(--crit); color: #fff; }

dialog.modal { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 20px; width: min(560px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
dialog.modal::backdrop { background: rgba(10, 14, 20, 0.55); }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
