:root {
  /* Neutrale, ruhige Basispalette – bewusst zurueckhaltend. */
  --accent: #2f6fed;
  --accent-weak: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-ink: #ffffff;

  --bg: #f6f7f9;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --surface-3: #eceef1;
  --line: #e2e5ea;
  --line-strong: #cfd4dc;

  --text: #16181d;
  --text-muted: #5c626e;
  --text-faint: #878d99;

  --ok: #1f8a52;
  --warn: #b7791f;
  --danger: #c3372b;
  --info: #2f6fed;

  --ok-bg: color-mix(in srgb, var(--ok) 12%, transparent);
  --warn-bg: color-mix(in srgb, var(--warn) 14%, transparent);
  --danger-bg: color-mix(in srgb, var(--danger) 12%, transparent);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Dezente Schatten, kein Glow. */
  --shadow-xs: 0 1px 2px rgba(16, 20, 28, .06);
  --shadow-sm: 0 1px 3px rgba(16, 20, 28, .08), 0 1px 2px rgba(16, 20, 28, .04);
  --shadow-md: 0 4px 14px rgba(16, 20, 28, .09), 0 1px 3px rgba(16, 20, 28, .05);
  --shadow-lg: 0 18px 44px rgba(16, 20, 28, .16), 0 2px 8px rgba(16, 20, 28, .07);

  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-num: ui-rounded, "SF Pro Rounded", var(--font);
  --fs-root: 15px;

  --sidebar-w: 244px;
  --header-h: 56px;
  --tabbar-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --dur: 160ms;
  --ease: cubic-bezier(.2, .7, .3, 1);
}

:root[data-theme="dark"] {
  --bg: #0f1115;
  --bg-elevated: #171a20;
  --surface: #171a20;
  --surface-2: #1e2229;
  --surface-3: #262b33;
  --line: #2a2f38;
  --line-strong: #3a414c;

  --text: #e9ecf1;
  --text-muted: #a3aab7;
  --text-faint: #767d8a;

  --ok: #46b97b;
  --warn: #d8a238;
  --danger: #e2685c;
  --info: #6a9bff;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .36);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .42);
  --shadow-lg: 0 22px 48px rgba(0, 0, 0, .56);
}

:root[data-font="small"]  { --fs-root: 14px; }
:root[data-font="large"]  { --fs-root: 16.5px; }
:root[data-font="xlarge"] { --fs-root: 18px; }

:root[data-density="compact"] {
  --sp-3: 9px; --sp-4: 12px; --sp-5: 15px; --sp-6: 18px; --sp-7: 24px;
  --header-h: 50px;
}

* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html {
  font-size: var(--fs-root);
  -webkit-text-size-adjust: 100%;
  height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.011em; line-height: 1.25; }
/* Bewusst moderate Groessen – keine ueberdimensionierten Headlines. */
h1 { font-size: 1.3rem; }
h2 { font-size: 1.075rem; }
h3 { font-size: .96rem; }
h4 { font-size: .875rem; }
p  { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }

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

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:disabled { cursor: not-allowed; }

ul, ol { margin: 0; padding: 0; list-style: none; }

hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-5) 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

.skip-link {
  position: fixed; top: -60px; left: var(--sp-3); z-index: 200;
  background: var(--surface); color: var(--text); padding: 10px 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-md); transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: calc(var(--safe-top) + 8px); }

.mono, .num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: .82rem; }
.tiny  { font-size: .74rem; }
.strong { font-weight: 600; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hidden { display: none !important; }
.grow { flex: 1 1 auto; min-width: 0; }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.col { display: flex; flex-direction: column; gap: var(--sp-3); }
.wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); } .gap-5 { gap: var(--sp-5); }
.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.mb-2 { margin-bottom: var(--sp-2); } .mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }

.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;
}

.boot {
  position: fixed; inset: 0; display: grid; place-content: center;
  justify-items: center; gap: var(--sp-4); background: var(--bg);
}
.boot-mark {
  width: 34px; height: 34px; border-radius: 9px;
  border: 2.5px solid var(--line-strong); border-top-color: var(--accent);
  animation: spin .75s linear infinite;
}
.boot-text { color: var(--text-muted); font-size: .875rem; }
@keyframes spin { to { transform: rotate(360deg); } }

.noscript {
  position: fixed; inset: 0; display: grid; place-content: center;
  background: var(--bg); color: var(--text); padding: var(--sp-6); text-align: center;
}

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong); border-radius: 8px;
  border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

::selection { background: var(--accent-soft); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}
