:root {
  /* Hell (Standard) */
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f0f3fb;
  --border: #e2e7f2;
  --text: #1b2240;
  --muted: #6b7398;
  --primary: #3d5cf5;
  --primary-ink: #ffffff;
  --danger: #d63a55;
  --ok: #1c9e73;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(40, 60, 120, 0.08);
}

:root[data-theme="dark"] {
  --bg: #0f1220;
  --surface: #1a1f36;
  --surface-2: #232a4d;
  --border: #2f3a63;
  --text: #eef1f8;
  --muted: #a2acce;
  --primary: #6c8cff;
  --primary-ink: #0b1030;
  --danger: #ff6b7d;
  --ok: #46d19e;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.topnav { display: flex; align-items: center; gap: 14px; }
.user { color: var(--muted); font-size: 0.9rem; }

/* Theme-Umschalter */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
}
.theme-toggle:hover { filter: brightness(1.05); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.container {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 28px 20px;
  flex: 1;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  padding: 18px;
}

/* Buttons & links */
.btn {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: transparent; font-weight: 600; }
.btn.block { width: 100%; }

.link {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
}
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); }
.inline { display: inline; }

.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }

/* Alerts */
.alert { padding: 10px 14px; border-radius: 10px; margin: 0 0 16px; font-size: 0.92rem; }
.alert.error { background: rgba(214, 58, 85, 0.12); color: var(--danger); border: 1px solid rgba(214, 58, 85, 0.3); }

/* Auth / form card */
.auth-card {
  max-width: 420px;
  margin: 6vh auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.auth-card.wide { max-width: 560px; }
.auth-card h1 { margin-top: 0; }

form label { display: block; margin-bottom: 14px; font-size: 0.9rem; color: var(--muted); }
form input, form select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
}
form input:focus, form select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.row { display: flex; gap: 14px; }
.row > label { flex: 1; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* Passwortfeld mit Anzeigen-Button */
.password-field { position: relative; display: block; margin-top: 6px; }
.password-field input { margin-top: 0; padding-right: 44px; }
.pw-toggle {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
}
.pw-toggle:hover { color: var(--text); }
.pw-toggle .eye-off { display: none; }
.pw-toggle[data-visible="true"] .eye { display: none; }
.pw-toggle[data-visible="true"] .eye-off { display: inline-flex; }

/* Dashboard */
.dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.dashboard-head h1 { margin: 0; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 22px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.stat-label { display: block; color: var(--muted); font-size: 0.85rem; }
.stat-value { display: block; font-size: 1.8rem; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.panel h2 { margin-top: 0; font-size: 1.05rem; }

/* Donut-Diagramm */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.donut { width: 180px; height: 180px; flex-shrink: 0; }
.donut-ring { stroke: var(--surface-2); }
.donut-seg { transition: stroke-width 0.15s ease; }
.donut-seg:hover { stroke-width: 5.2; }
.donut-value { font-size: 4.4px; font-weight: 700; fill: var(--text); }
.donut-caption { font-size: 2.6px; fill: var(--muted); }

.cat-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 220px; }
.cat-legend li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.cat-legend li:last-child { border-bottom: none; }
.dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.legend-name { flex: 1; }
.legend-val { color: var(--muted); font-size: 0.9rem; }

.empty { color: var(--muted); text-align: center; padding: 24px 0; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
td.num, th.num { text-align: right; }
.actions { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }

@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .row { flex-direction: column; gap: 0; }
  .dashboard-head { flex-direction: column; align-items: flex-start; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { margin: 0 auto; }
}
