/* Agentur-Dashboard – madebyheim-CI, ruhig und dicht */
:root {
  --tinte: #15171c;
  --text: #2b2f36;
  --leise: #5b616b;
  --linie: #e3e5e8;
  --grau: #f4f5f6;
  --weiss: #fff;
  --akzent: #ff5b24;
  --rot: #b42318;
  --rot-hell: #fdecea;
  --gelb: #8a5a00;
  --gelb-hell: #fff4d6;
  --gruen: #17704a;
  --gruen-hell: #e6f4ec;
  --blau: #2f45ff;
  --blau-hell: #eceefe;
  --radius: 14px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--grau);
  color: var(--text);
  font: 400 0.9375rem/1.55 var(--font-text);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); color: var(--tinte); margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 800; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--tinte); text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; border-radius: 4px; }
small, .leise { color: var(--leise); }

/* Leiste */
.leiste {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 0 clamp(16px, 3vw, 32px);
  min-height: 60px;
  background: var(--weiss);
  border-bottom: 1px solid var(--linie);
}
.marke { font: 800 1.35rem/1 var(--font-display); text-decoration: none; letter-spacing: -0.03em; }
.marke small { font: 500 0.75rem/1 var(--font-text); color: var(--leise); letter-spacing: 0; margin-left: 4px; }
.marke-i { position: relative; }
.marke-i::before {
  content: ''; position: absolute; left: 50%; top: 0.08em; translate: -50% 0;
  width: 0.24em; height: 0.24em; background: var(--akzent);
  clip-path: polygon(0 100%, 0 48%, 50% 0, 100% 48%, 100% 100%);
}
.leiste nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.leiste nav a {
  padding: 8px 12px; border-radius: 8px; text-decoration: none; font-weight: 500; white-space: nowrap; color: var(--leise);
}
.leiste nav a:hover { color: var(--tinte); background: var(--grau); }
.leiste nav a[aria-current='page'] { color: var(--tinte); background: var(--grau); }
.abmelden button { all: unset; cursor: pointer; color: var(--leise); font-size: 0.875rem; padding: 8px; }
.abmelden button:hover { color: var(--tinte); }
@media (max-width: 640px) {
  .leiste { flex-wrap: wrap; gap: 4px 12px; padding-block: 8px; }
  .leiste nav { order: 3; flex-basis: 100%; }
  .marke { margin-right: auto; }
}

.inhalt { padding: clamp(20px, 3vw, 36px) clamp(16px, 3vw, 32px) 64px; max-width: 1320px; margin: 0 auto; display: grid; gap: 24px; }
.kopf { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; }
.kopf p { margin-top: 4px; }

/* Flächen */
.flaeche { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); }
.flaeche > header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--linie); }
.flaeche > .koerper { padding: 16px 20px; }
.raster { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); align-items: start; }

/* Kennzahlen */
.zahlen { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.zahl { background: var(--weiss); border: 1px solid var(--linie); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; }
.zahl b { font: 800 1.6rem/1.1 var(--font-display); color: var(--tinte); letter-spacing: -0.03em; }
.zahl span { font-size: 0.8125rem; color: var(--leise); }
.zahl.minus b { color: var(--rot); }

/* Tabellen */
.tabelle-huelle { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 500; font-size: 0.8125rem; color: var(--leise); padding: 10px 20px; border-bottom: 1px solid var(--linie); white-space: nowrap; }
td { padding: 12px 20px; border-bottom: 1px solid var(--linie); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfb; }
td.zahlspalte, th.zahlspalte { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.zeile-titel { font-weight: 500; color: var(--tinte); text-decoration: none; }
.zeile-titel:hover { text-decoration: underline; }
.unter { display: block; font-size: 0.8125rem; color: var(--leise); }

/* Kennzeichen */
.pille { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 0.75rem; font-weight: 500; background: var(--grau); color: var(--text); white-space: nowrap; }
.pille.live { background: var(--gruen-hell); color: var(--gruen); }
.pille.vorschau { background: var(--blau-hell); color: var(--blau); }
.pille.umsetzung, .pille.angebot, .pille.anfrage { background: var(--gelb-hell); color: var(--gelb); }
.pille.kritisch { background: var(--rot-hell); color: var(--rot); }
.pille.warnung { background: var(--gelb-hell); color: var(--gelb); }
.pille.hinweis { background: var(--grau); color: var(--leise); }
.punkt { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: #c9ccd1; flex: none; }
.punkt.gut { background: #1fa463; }
.punkt.schlecht { background: var(--rot); }
.punkt.mittel { background: #e2a33b; }
.status { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

/* Warnungen */
.warnliste { list-style: none; margin: 0; padding: 0; }
.warnliste li { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 20px; border-bottom: 1px solid var(--linie); }
.warnliste li:last-child { border-bottom: 0; }
.warnliste a { text-decoration: none; color: inherit; }
.warnliste a:hover .w-text { text-decoration: underline; }
.w-bereich { font-size: 0.75rem; color: var(--leise); }
.leer { padding: 20px; color: var(--leise); }

/* Angaben (Schlüssel/Wert) */
.angaben { display: grid; grid-template-columns: minmax(130px, auto) 1fr; gap: 8px 16px; margin: 0; }
.angaben dt { color: var(--leise); font-size: 0.875rem; }
.angaben dd { margin: 0; word-break: break-word; }

/* Formulare */
form.formular { display: grid; gap: 12px; }
.felder { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
label { display: grid; gap: 4px; font-size: 0.8125rem; font-weight: 500; color: var(--tinte); }
input, select, textarea {
  font: inherit; color: var(--tinte); background: var(--weiss);
  border: 1px solid #d3d6db; border-radius: 8px; padding: 8px 10px; min-height: 40px; width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--tinte); }
label.haken { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.haken input { width: 18px; min-height: 18px; }
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--tinte);
  background: var(--tinte); color: #fff; font: 500 0.875rem/1 var(--font-text); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.knopf:hover { background: #000; }
.knopf.hell { background: var(--weiss); color: var(--tinte); border-color: #d3d6db; }
.knopf.hell:hover { border-color: var(--tinte); }
.knopf.klein { min-height: 32px; padding: 0 12px; font-size: 0.8125rem; }
.knopf.gefahr { background: var(--weiss); color: var(--rot); border-color: #f1c4bf; }
.inline { display: inline; }
.zeile-aktionen { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.meldung { padding: 10px 14px; border-radius: 10px; background: var(--gruen-hell); color: var(--gruen); font-weight: 500; }
.meldung.fehler { background: var(--rot-hell); color: var(--rot); }
details.aufklappen > summary { cursor: pointer; font-weight: 500; color: var(--tinte); padding: 4px 0; }
details.aufklappen[open] > summary { margin-bottom: 12px; }

/* Anmeldung */
body.schlicht .inhalt { min-height: 100dvh; place-content: center; }
.anmelden-karte { width: min(100%, 380px); padding: 32px; display: grid; gap: 16px; }
.oben { margin-top: 12px; }
.zeile-aktionen.links { justify-content: flex-start; }

/* Raster darf nicht breiter werden als der Bildschirm (breite Tabellen scrollen in ihrer Hülle) */
.inhalt { grid-template-columns: minmax(0, 1fr); }
.inhalt > *, .raster > *, .warnliste li > * { min-width: 0; }
.raster > .breit { grid-column: 1 / -1; }
.kopf p { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .warnliste li { grid-template-columns: 1fr; gap: 4px; padding: 12px 16px; }
  .warnliste li > :empty { display: none; }
  .flaeche > header, .flaeche > .koerper { padding-inline: 16px; }
  th, td { padding-inline: 14px; }
  .angaben { grid-template-columns: 1fr; gap: 2px; }
  .angaben dd { margin-bottom: 8px; }
}
