:root {
  --sidebar: #000;
  --bg: #050505;
  --raise: #131313;
  --panel: #1c1c1c;
  --border: #1d1d1d;
  --text: #f3f3f3;
  --muted: #9a9a9a;
  --faint: #6b6b6b;
  --accent: #fff;
  --gruen: #3fa76a;
  --rot: #e5534b;
  --flaeche: #0d0d0d;
  --hover: rgba(243, 243, 243, .10);
  --hover-menu: rgba(243, 243, 243, .02);
  --r-feld: 8px;
  --r-karte: 12px;
  --r-gross: 16px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Söhne", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
.num, .kpi-wert, td.n, .tab-zahl { font-variant-numeric: tabular-nums; }

/* ---------- Grundgerüst ---------- */
#app { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
#seite {
  background: var(--sidebar); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
#haupt { min-width: 0; padding: 28px 36px 64px; max-width: 1280px; width: 100%; }
#konsole { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; padding: 4px 10px 18px; }
.logo-zeichen { width: 28px; height: 28px; border-radius: 8px; background: var(--panel); display: grid; place-items: center; }
.nav { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-feld); color: var(--muted); width: 100%; text-align: left; }
.nav:hover { background: var(--hover); color: var(--text); }
.nav.an { background: var(--panel); color: var(--text); }
.nav svg { width: 17px; height: 17px; flex: none; }
.nav .bald { margin-left: auto; font-size: 11px; color: var(--faint); }
.seite-fuss { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--r-feld); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.seite-fuss .wer { min-width: 0; flex: 1; }
.seite-fuss .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seite-fuss .sync { font-size: 12px; color: var(--faint); }
.demo-band { margin: 8px 10px; padding: 8px 10px; border-radius: var(--r-feld); background: var(--panel); color: var(--muted); font-size: 12px; }

/* ---------- Elemente ---------- */
.knopf { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 16px; border-radius: 999px; background: var(--panel); white-space: nowrap; }
.knopf:hover { background: #262626; }
.knopf.haupt { background: var(--accent); color: #000; font-weight: 500; }
.knopf.haupt:hover { background: #e6e6e6; }
.knopf.klein { height: 28px; padding: 0 12px; font-size: 13px; }
.knopf.gefahr { color: var(--rot); }
.icon-knopf { width: 34px; height: 34px; border-radius: 999px; display: inline-grid; place-items: center; color: var(--muted); }
.icon-knopf:hover { background: var(--hover); color: var(--text); }
.icon-knopf svg { width: 17px; height: 17px; }
.icon-knopf.gruen { color: var(--gruen); }
.icon-knopf.halb { color: #c9a227; }
.pillen { display: inline-flex; gap: 2px; background: var(--flaeche); border-radius: 999px; padding: 3px; flex-wrap: wrap; }
.pille { height: 28px; padding: 0 12px; border-radius: 999px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.pille:hover { color: var(--text); }
.pille.an { background: var(--panel); color: var(--text); }
input.feld, select.feld, textarea.feld {
  background: var(--flaeche); border: 1px solid var(--border); border-radius: var(--r-feld);
  padding: 8px 10px; width: 100%; outline: none;
}
input.feld:focus, select.feld:focus, textarea.feld:focus { border-color: #3a3a3a; }
label.lbl { display: block; font-size: 12px; color: var(--muted); margin: 0 0 6px; }
.gruen { color: var(--gruen); }
.rot { color: var(--rot); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.leer { padding: 48px 20px; text-align: center; color: var(--faint); }

/* ---------- Kopfzeilen ---------- */
.kopf { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.kopf h1 { font-size: 26px; font-weight: 600; margin: 0; letter-spacing: -.01em; }
.kopf h1 .anzahl { color: var(--faint); font-weight: 400; margin-left: 6px; }
.gruss { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.gruss h1 { font-size: 26px; }
.wahl { position: relative; }
.wahl > button { color: var(--muted); font-size: 13px; }
.wahl > button:hover { color: var(--text); }
.menue {
  position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 220px; max-height: 360px; overflow: auto;
  background: var(--raise); border-radius: var(--r-feld); padding: 4px; box-shadow: 0 12px 32px rgba(0,0,0,.6);
}
.menue.rechts { left: auto; right: 0; }
.menue button { display: flex; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; gap: 8px; align-items: center; }
.menue button:hover { background: var(--hover); }
.menue button.an { background: var(--panel); }
.menue .trenner { height: 1px; background: var(--border); margin: 4px 0; }

/* ---------- Kennzahlen ---------- */
.kpis { display: flex; flex-wrap: wrap; gap: 8px 36px; align-items: flex-end; margin-bottom: 8px; }
.kpi .kpi-name { font-size: 13px; color: var(--muted); }
.kpi .kpi-wert { font-size: 22px; font-weight: 500; letter-spacing: -.01em; }
.kpi.gross .kpi-wert { font-size: 40px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.kpis.klein { gap: 8px 28px; margin: 6px 0 18px; }
.kpis.klein .kpi-wert { font-size: 16px; }
.plakette { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--flaeche); margin-bottom: 14px; }
.pfeil { font-size: 12px; font-variant-numeric: tabular-nums; }
.pfeil.hoch { color: var(--gruen); }
.pfeil.runter { color: var(--rot); }

/* ---------- Charts ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .achse { fill: var(--faint); font-size: 11px; }
.chart .gitter { stroke: var(--border); }
.tipp {
  position: absolute; pointer-events: none; background: var(--raise); border-radius: var(--r-feld);
  padding: 8px 10px; font-size: 12px; white-space: nowrap; box-shadow: 0 8px 24px rgba(0,0,0,.6); z-index: 10; display: none;
}
.tipp .zeile { display: flex; justify-content: space-between; gap: 18px; }
.tipp .gross { font-size: 14px; font-weight: 600; }
.chart-leer { height: 220px; display: grid; place-items: center; color: var(--faint); background: var(--flaeche); border-radius: var(--r-karte); }

.karten { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.karte { background: var(--flaeche); border-radius: var(--r-karte); padding: 18px; min-width: 0; }
.karte.breit { grid-column: 1 / -1; }
.karte-kopf { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.karte-kopf h3 { margin: 0; font-size: 14px; font-weight: 500; white-space: nowrap; }
.karte-kopf .pillen { flex-wrap: nowrap; }
.karte-kopf .faint { white-space: nowrap; font-size: 12px; }
.karte-fuss { margin-top: 12px; }
.karte-fuss .gross { font-size: 22px; font-weight: 600; }

/* ---------- Projektliste ---------- */
.band { background: var(--flaeche); border-radius: var(--r-gross); padding: 20px 22px; margin-bottom: 18px; }
.leiste { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.leiste .rechts { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.suche { display: flex; align-items: center; gap: 6px; }
.suche input { width: 200px; height: 34px; border-radius: 999px; }
.raster { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pkarte { background: var(--flaeche); border-radius: var(--r-karte); padding: 18px 18px 0; text-align: left; width: 100%; display: flex; flex-direction: column; overflow: hidden; }
.pkarte:hover { background: #111; }
.pkarte h3 { margin: 0 0 4px; font-size: 16px; font-weight: 500; display: flex; justify-content: space-between; gap: 10px; }
.pkarte .meta { font-size: 12px; color: var(--faint); margin-bottom: 14px; }
.pkarte .werte { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.pkarte .werte .kpi-name { font-size: 12px; }
.pkarte .werte .kpi-wert { font-size: 15px; }
.pkarte .spark { margin: 0 -18px; height: 46px; }

/* ---------- Einzelprojekt ---------- */
.pkopf { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; flex-wrap: wrap; }
.pkopf h1 { margin: 0; font-size: 26px; font-weight: 600; }
.pkopf .eckdaten { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 6px; }
.pkopf .eckdaten .feldname { color: var(--faint); margin-right: 4px; }
.editierbar { cursor: text; border-radius: 4px; padding: 0 2px; margin: 0 -2px; }
.editierbar:hover { background: var(--hover); }
.inline-feld { background: var(--flaeche); border: 1px solid #3a3a3a; border-radius: 4px; padding: 0 4px; outline: none; min-width: 60px; }
h1 .inline-feld { font-size: 24px; font-weight: 600; width: 100%; }
.icons { display: flex; gap: 2px; }
.abschnitt { margin-top: 30px; }
.abschnitt h2 { font-size: 15px; font-weight: 500; margin: 0 0 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }

table.tab { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tab th { text-align: left; color: var(--faint); font-weight: 400; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tab td { padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.tab th.n, table.tab td.n { text-align: right; }
table.tab tr:hover td { background: var(--hover-menu); }
.tab-huelle { overflow-x: auto; background: var(--flaeche); border-radius: var(--r-karte); }
.quelle-tag { font-size: 11px; color: var(--faint); background: var(--panel); border-radius: 999px; padding: 1px 7px; }

/* ---------- Fenster ---------- */
.schleier { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; display: grid; place-items: center; padding: 16px; }
.fenster { background: var(--raise); border-radius: var(--r-gross); padding: 22px; width: 560px; max-width: 100%; max-height: 88vh; overflow: auto; }
.fenster h2 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.fenster .unter { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.fenster-fuss { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.gitter2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gitter3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.liste-wahl { display: flex; flex-direction: column; gap: 2px; max-height: 300px; overflow: auto; background: var(--flaeche); border-radius: var(--r-feld); padding: 4px; }
.liste-wahl label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 6px; cursor: pointer; }
.liste-wahl label:hover { background: var(--hover); }
.liste-wahl .gruppe { font-size: 11px; color: var(--faint); padding: 8px 8px 2px; text-transform: uppercase; letter-spacing: .04em; }
.hinweis { font-size: 12px; color: var(--faint); margin-top: 6px; }

/* ---------- Toasts ---------- */
.toast { background: var(--raise); border-radius: var(--r-feld); padding: 10px 14px; font-size: 13px; box-shadow: 0 8px 24px rgba(0,0,0,.6); max-width: 360px; }
.toast.fehler { border-left: 3px solid var(--rot); }

/* ---------- Anmeldung ---------- */
.anmelden { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--bg); }
.anmelden .fenster { width: 380px; text-align: center; background: var(--raise); }
.anmelden .logo-zeichen { margin: 0 auto 12px; width: 40px; height: 40px; }
.anmelden form { display: flex; flex-direction: column; gap: 10px; text-align: left; margin-top: 16px; }
.anmelden .knopf { justify-content: center; width: 100%; }
.anmelden .klein-text { font-size: 12px; color: var(--faint); margin-top: 14px; }

/* ---------- Handy ---------- */
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  #seite { position: sticky; top: 0; z-index: 30; height: auto; flex-direction: row; align-items: center; padding: 8px 10px; gap: 2px; overflow-x: auto; }
  .logo { padding: 0 8px 0 2px; }
  .logo span { display: none; }
  .nav { width: auto; padding: 8px 10px; }
  .nav .bald { display: none; }
  .seite-fuss { margin: 0 0 0 auto; padding: 4px; }
  .seite-fuss .wer { display: none; }
  .demo-band { display: none; }
  #haupt { padding: 18px 16px 64px; }
  .karten, .raster { grid-template-columns: 1fr; }
  .kpi.gross .kpi-wert { font-size: 32px; }
  .kpis { gap: 8px 22px; }
  .pkarte .werte { grid-template-columns: repeat(2, 1fr); }
  .gitter3 { grid-template-columns: 1fr 1fr; }
  .suche input { width: 140px; }
}
