/* Business-Layer GUI — GTF-schlicht, responsive, Dark+Hell (design-gui-rest §6).
   Kein Inline-Style (CSP default-src 'self', D19) — alles hier. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --border: #d9dee4;
  --text: #1c2530;
  --text-muted: #5b6875;
  --accent: #1f6feb;
  --accent-text: #ffffff;
  --gruen: #1a7f45;
  --gruen-bg: #e3f4ea;
  --rot: #b23b3b;
  --rot-bg: #f8e4e4;
  --gelb: #8a6d1a;
  --gelb-bg: #f6efd9;
  --radius: 10px;
  --gap: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --surface: #161c24;
    --surface-2: #1e2732;
    --border: #2a3441;
    --text: #e6ecf2;
    --text-muted: #9aa7b4;
    --accent: #4c8dff;
    --accent-text: #0f141a;
    --gruen: #4cc07c;
    --gruen-bg: #16301f;
    --rot: #e06a6a;
    --rot-bg: #331a1a;
    --gelb: #d8b74a;
    --gelb-bg: #2e2812;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

/* --- Kopf/Navigation --- */
header.topbar {
  display: flex;
  align-items: center;
  gap: var(--gap);
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; letter-spacing: .2px; margin-right: 8px; white-space: nowrap; }
.brand small { color: var(--text-muted); font-weight: 400; }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
nav.tabs a {
  padding: 7px 13px; border-radius: 8px; text-decoration: none;
  color: var(--text-muted); font-weight: 500;
}
nav.tabs a.active { background: var(--surface-2); color: var(--text); }
nav.tabs a:hover { background: var(--surface-2); }
.topbar .rechts { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { color: var(--text-muted); font-size: 13px; }

main { max-width: 1080px; margin: 0 auto; padding: 24px 20px 64px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.unter { color: var(--text-muted); margin: 0 0 24px; }

/* --- Karten / Sektionen --- */
.karte {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; margin-bottom: var(--gap);
}
.karten-reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); }
.karte h2 { display: flex; align-items: center; gap: 8px; }

/* --- Tabellen --- */
.tabelle-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tr:last-child td { border-bottom: none; }
td.zahl, th.zahl { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Badges / Ampeln --- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.klick { cursor: pointer; }
.badge.grau { background: var(--surface-2); color: var(--text-muted); }
td.stark, .stark { font-weight: 700; }
.badge.gruen { background: var(--gruen-bg); color: var(--gruen); }
.badge.rot { background: var(--rot-bg); color: var(--rot); }
.badge.gelb { background: var(--gelb-bg); color: var(--gelb); }
.ampel { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.ampel.gruen { background: var(--gruen); }
.ampel.rot { background: var(--rot); }
.ampel.gelb { background: var(--gelb); }

/* --- Buttons / Formulare --- */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  padding: 7px 14px; border-radius: 8px; font-weight: 500;
}
button:hover, .btn:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.gefahr { color: var(--rot); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.klein { padding: 4px 9px; font-size: 13px; }

label { display: block; font-size: 13px; color: var(--text-muted); margin: 10px 0 4px; }
input, select, textarea {
  font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: 8px; background: var(--surface); color: var(--text);
}
textarea { min-height: 64px; resize: vertical; }
.feld-fehler { color: var(--rot); font-size: 12px; margin-top: 4px; }
.formzeile { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.aktionen { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

/* --- Banner / Toast / Leerzustand --- */
.banner { padding: 12px 16px; border-radius: 8px; margin-bottom: var(--gap); font-size: 14px; }
.banner.info { background: var(--surface-2); color: var(--text); }
.banner.warn { background: var(--gelb-bg); color: var(--gelb); }
.banner.fehler { background: var(--rot-bg); color: var(--rot); }
.leer { color: var(--text-muted); padding: 28px; text-align: center; }
.hinweisbox { background: var(--gelb-bg); color: var(--gelb); border-radius: 8px; padding: 12px 14px; font-size: 13px; margin-bottom: var(--gap); }
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px;
  font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 50;
  max-width: 90vw;
}
#toast.zeigen { opacity: 1; }

.verborgen { display: none !important; }
.werkzeugleiste { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: var(--gap); }
.werkzeugleiste > div { min-width: 130px; }
.werkzeugleiste label { margin-top: 0; }

/* --- Dialog (Detail / Formular) --- */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  color: var(--text); padding: 0; max-width: 640px; width: calc(100vw - 32px);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog-kopf { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dialog-koerper { padding: 20px; max-height: 70vh; overflow-y: auto; }
.dialog-fuss { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* --- Anmelden-Seite --- */
.anmelden-huelle { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.anmelden-karte { max-width: 380px; width: 100%; text-align: center; }
.anmelden-karte .brand { font-size: 20px; display: block; margin-bottom: 6px; }
.anmelden-karte p { color: var(--text-muted); }
.anmelden-karte button, .anmelden-karte .btn {
  width: 100%; margin-top: 18px; padding: 11px; display: block; text-decoration: none;
}

.meta { color: var(--text-muted); font-size: 13px; }
dl.detail { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
dl.detail dt { color: var(--text-muted); }
dl.detail dd { margin: 0; }
