:root {
  --bg: #0d0d0d;          /* Seiten-Hintergrund */
  --card: #1a1a19;        /* Karten/Flächen */
  --elevated: #22221f;    /* Hover / eingaben */
  --input: #141412;
  --text: #ededea;        /* Primärtext */
  --text-strong: #ffffff;
  --secondary: #c3c2b7;
  --muted: #8f8d85;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.16);
  --primary: #3987e5;
  --primary-hover: #256abf;
  --link: #6da7ec;
  --danger: #e66767;
  --track: rgba(255, 255, 255, 0.07);
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px 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;
  -webkit-font-smoothing: antialiased;
}

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

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(26, 26, 25, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 1.15rem; color: var(--text-strong); }
.brand:hover { text-decoration: none; }
.topbar-nav { display: flex; align-items: center; gap: 14px; }
.user { color: var(--muted); font-size: 0.9rem; }

/* Layout */
.container { max-width: 1120px; margin: 0 auto; padding: 28px 24px 56px; }
.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 24px; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px; gap: 12px;
}
.page-head h1 { margin: 0; font-size: 1.7rem; color: var(--text-strong); letter-spacing: -0.01em; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.auth-card { max-width: 400px; margin: 56px auto; }
.auth-card h1 { margin-top: 0; color: var(--text-strong); }

/* KPI-Karten */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--text-strong); line-height: 1.15; }
.stat-value small { font-size: 0.9rem; color: var(--muted); font-weight: 500; }
.stat-sub { color: var(--secondary); font-size: 0.82rem; }

/* Auswertungs-Panels */
.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.panel-title {
  margin: 0 0 16px; font-size: 1rem; font-weight: 600; color: var(--text-strong);
}
.panel-sub { color: var(--muted); font-weight: 400; font-size: 0.82rem; }

.breakdown { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.breakdown-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 6px; }
.breakdown-label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; color: var(--secondary); }
.breakdown-amount { font-size: 0.9rem; font-weight: 600; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.bar { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; min-width: 3px; transition: width 0.3s ease; }

/* Tabelle */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table thead th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: var(--elevated); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .name-cell { font-weight: 600; color: var(--text-strong); }
.row-inactive td { color: var(--muted); }
.row-inactive .name-cell { color: var(--muted); }
.badge {
  display: inline-block; margin-left: 8px; padding: 1px 8px;
  font-size: 0.68rem; border-radius: 999px;
  background: rgba(250, 178, 25, 0.16); color: #fab219; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.actions { white-space: nowrap; text-align: right; }
.actions .inline { display: inline; }

/* Leerer Zustand */
.empty {
  background: var(--card);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 48px; text-align: center; color: var(--muted);
}
.empty .btn { margin-top: 12px; }

/* Formulare */
.form { display: flex; flex-direction: column; gap: 16px; }
.form.card { max-width: 620px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.88rem; font-weight: 600; color: var(--secondary); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form input, .form select {
  font: inherit; padding: 10px 12px; color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 9px; background: var(--input);
}
.form input::-webkit-calendar-picker-indicator { filter: invert(0.8); }
.form input:focus, .form select:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
.form .check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--text); }
.form .check input { width: auto; accent-color: var(--primary); }
.form-actions { display: flex; gap: 12px; margin-top: 4px; }

/* Buttons */
.btn {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  padding: 10px 18px; border-radius: 9px; border: 1px solid transparent; text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--secondary); border-color: var(--border-strong); }
.btn-ghost:hover { background: var(--elevated); }

.link {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--link); font: inherit; cursor: pointer;
}
.link:hover { text-decoration: underline; }
.link.danger { color: var(--danger); margin-left: 12px; }

/* Alerts */
.alert { padding: 12px 14px; border-radius: 9px; font-size: 0.9rem; margin-bottom: 4px; }
.alert-error { background: rgba(230, 103, 103, 0.15); color: #f19a9a; border: 1px solid rgba(230, 103, 103, 0.3); }
.alert-info { background: rgba(57, 135, 229, 0.15); color: #9ec5f4; border: 1px solid rgba(57, 135, 229, 0.3); }

.muted { color: var(--muted); }

@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .panels { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr; }
  .form .row { grid-template-columns: 1fr; }
}
