:root {
  --grund: #f6f7f9;
  --flaeche: #ffffff;
  --rand: #e2e5ea;
  --text: #1c2128;
  --text-leise: #6b7280;
  --akzent: #2563eb;
  --akzent-dunkel: #1d4ed8;
  --gefahr: #dc2626;
  --gut: #16a34a;
  --warn: #d97706;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #121417;
    --flaeche: #1b1f24;
    --rand: #2c323a;
    --text: #e6e9ed;
    --text-leise: #9aa3ae;
    --akzent: #60a5fa;
    --akzent-dunkel: #3b82f6;
    --schatten: none;
  }
}

* { box-sizing: border-box; }

/* Das hidden-Attribut setzt display:none nur ueber das Standardstylesheet des Browsers.
   Jede eigene display-Regel gewaenne dagegen, und ein als versteckt markiertes Element
   waere trotzdem sichtbar. Deshalb hier ausdruecklich. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

/* Kopf */
.kopf {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  height: 56px;
  background: var(--flaeche);
  border-bottom: 1px solid var(--rand);
  position: sticky;
  top: 0;
  z-index: 10;
}
.marke { font-weight: 600; text-decoration: none; color: var(--text); white-space: nowrap; }
.kopf nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.kopf nav a {
  padding: 6px 12px;
  border-radius: 7px;
  text-decoration: none;
  color: var(--text-leise);
  font-weight: 500;
}
.kopf nav a:hover { background: var(--grund); color: var(--text); }
.kopf nav a.aktiv { background: var(--akzent); color: #fff; }
.kopf-rechts { display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.benutzer { color: var(--text-leise); font-size: 14px; }
.abmelden-link { font-size: 14px; }

main { max-width: 1120px; margin: 0 auto; padding: 28px 24px 120px; }
main.schmal { max-width: 420px; padding-top: 12vh; }

h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 20px 0 8px; }
.unterzeile { color: var(--text-leise); margin: 0 0 24px; max-width: 68ch; }

/* Karten */
.karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--schatten);
}
.karte.kein-rand { padding: 0; overflow: hidden; }
.karte.kein-rand .tabelle { margin: 0; }
.karte-kopf { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.karte-kopf h2 { margin: 0; }
.hinweis-karte { text-align: center; padding: 40px 20px; }
.hinweis-karte p { color: var(--text-leise); margin-bottom: 20px; }

/* Login */
.login-karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: 14px;
  padding: 32px;
  box-shadow: var(--schatten);
}
.login-karte h1 { text-align: center; }
.login-karte .unterzeile { text-align: center; font-size: 14px; }
.login-karte label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }

/* Formular */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--rand);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
input:focus, select:focus { outline: 2px solid var(--akzent); outline-offset: -1px; border-color: transparent; }

.formular { max-width: 720px; }
.feld { margin-bottom: 14px; flex: 1; }
.feld.schmal { max-width: 120px; }
.feld label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.feld-reihe { display: flex; gap: 14px; flex-wrap: wrap; }
.optional { font-weight: 400; color: var(--text-leise); }
.erweitert { margin: 8px 0 18px; }
.erweitert summary { cursor: pointer; color: var(--text-leise); font-size: 14px; padding: 6px 0; }
.knopf-reihe { display: flex; gap: 10px; flex-wrap: wrap; }

/* Knöpfe */
.knopf {
  display: inline-block;
  padding: 9px 16px;
  border: 1px solid var(--rand);
  border-radius: 8px;
  background: var(--flaeche);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.knopf:hover:not(:disabled) { background: var(--grund); }
.knopf:disabled { opacity: .5; cursor: not-allowed; }
.knopf.haupt { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.knopf.haupt:hover:not(:disabled) { background: var(--akzent-dunkel); }
.knopf.gefahr { color: var(--gefahr); border-color: color-mix(in srgb, var(--gefahr) 35%, var(--rand)); }
.knopf.gefahr:hover:not(:disabled) { background: color-mix(in srgb, var(--gefahr) 8%, var(--flaeche)); }
.knopf.klein { padding: 5px 11px; font-size: 13px; }
.knopf.gross { padding: 12px 22px; font-size: 16px; }
.knopf.breit { width: 100%; margin-top: 20px; }
.verweis { background: none; border: none; color: var(--akzent); cursor: pointer; font: inherit; padding: 0; text-align: left; }

/* Kacheln */
.kachel-reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.kachel {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 3px solid var(--rand);
}
.kachel:hover { border-color: var(--akzent); }
.kachel-zahl { font-size: 26px; font-weight: 650; letter-spacing: -.02em; }
.kachel-titel { font-size: 13px; color: var(--text-leise); }
.kachel.kategorie-werbung { border-left-color: #f97316; }
.kachel.kategorie-newsletter { border-left-color: #8b5cf6; }
.kachel.kategorie-spam { border-left-color: var(--gefahr); }
.kachel.kategorie-wichtig { border-left-color: var(--gut); }
.kachel.kategorie-unklar { border-left-color: var(--text-leise); }

.schritte { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.schritt {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px; border: 1px solid var(--rand); border-radius: 8px;
  text-decoration: none; color: var(--text);
}
.schritt:hover { border-color: var(--akzent); }
.schritt span { font-size: 13px; color: var(--text-leise); }

/* Tabellen */
.tabelle { width: 100%; border-collapse: collapse; }
.tabelle th, .tabelle td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--rand); vertical-align: middle; }
.tabelle th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-leise); font-weight: 600; }
.tabelle tbody tr:last-child td { border-bottom: none; }
.tabelle tbody tr:hover { background: var(--grund); }
.tabelle .rechts { text-align: right; }
.spalte-auswahl { width: 40px; }
.absender-knopf { background: none; border: none; padding: 0; font: inherit; color: var(--text); cursor: pointer; text-align: left; display: flex; flex-direction: column; }
.absender-knopf:hover strong { color: var(--akzent); }
.detail-zeile td { background: var(--grund); }
.mail-liste { margin: 0; padding: 0 0 0 4px; list-style: none; max-height: 260px; overflow-y: auto; }
.mail-liste li { padding: 4px 0; font-size: 14px; border-bottom: 1px solid var(--rand); }
.mail-liste li:last-child { border-bottom: none; }
.blaettern { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px; }

/* Tabs und Werkzeugleiste */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tab {
  padding: 7px 14px; border: 1px solid var(--rand); border-radius: 20px;
  background: var(--flaeche); color: var(--text-leise); font: inherit; font-weight: 500; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.aktiv { background: var(--akzent); border-color: var(--akzent); color: #fff; }
.tab .zahl { opacity: .7; font-size: 13px; }
.werkzeugleiste { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; }
.werkzeugleiste input[type=search] { max-width: 340px; }

/* Aktionsleiste */
.aktionsleiste {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px;
  display: flex; align-items: center; gap: 18px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px;
  padding: 12px 18px; box-shadow: 0 8px 24px rgba(16, 24, 40, .16);
  z-index: 20; max-width: calc(100% - 32px); flex-wrap: wrap;
}
.aktionsleiste-knoepfe { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kategorie-waehler { width: auto; padding: 9px 11px; font-size: 14px; }

/* Badges */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.badge.neutral { background: var(--grund); color: var(--text-leise); border-color: var(--rand); }
.badge.erfolg, .badge.gut { background: color-mix(in srgb, var(--gut) 14%, transparent); color: var(--gut); }
.badge.schlecht { background: color-mix(in srgb, var(--gefahr) 14%, transparent); color: var(--gefahr); }
.badge.merk { background: color-mix(in srgb, var(--akzent) 14%, transparent); color: var(--akzent); }
.badge.kategorie-werbung { background: rgba(249, 115, 22, .14); color: #c2410c; }
.badge.kategorie-newsletter { background: rgba(139, 92, 246, .14); color: #6d28d9; }
.badge.kategorie-spam { background: color-mix(in srgb, var(--gefahr) 14%, transparent); color: var(--gefahr); }
.badge.kategorie-wichtig { background: color-mix(in srgb, var(--gut) 14%, transparent); color: var(--gut); }
.badge.kategorie-unklar { background: var(--grund); color: var(--text-leise); border-color: var(--rand); }
@media (prefers-color-scheme: dark) {
  .badge.kategorie-werbung { color: #fdba74; }
  .badge.kategorie-newsletter { color: #c4b5fd; }
}

/* Zeitraum-Auswahl auf der Uebersicht */
.zeitraum { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.zeitraum label { font-size: 13px; font-weight: 600; white-space: nowrap; }
.zeitraum select { width: auto; min-width: 190px; padding: 7px 10px; font-size: 14px; }
.hinweis-zeile {
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--akzent) 10%, transparent);
  color: var(--akzent);
}

/* Fortschritt */
.fortschritt { margin: 12px 0; }
.balken { height: 6px; background: var(--rand); border-radius: 3px; overflow: hidden; }
.balken-fuellung { height: 100%; width: 0; background: var(--akzent); transition: width .3s ease; }
.balken-fuellung.unbestimmt { animation: pulsieren 1.4s ease-in-out infinite; }
.balken-fuellung.fehler { background: var(--gefahr); }
@keyframes pulsieren { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.fortschritt-text { font-size: 13px; color: var(--text-leise); margin: 7px 0 0; }

/* Bericht */
.bericht-kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 18px; }
.bericht-kachel { border: 1px solid var(--rand); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; border-left: 3px solid var(--rand); }
.bericht-kachel.gut { border-left-color: var(--gut); }
.bericht-kachel.ok { border-left-color: var(--akzent); }
.bericht-kachel.warn { border-left-color: var(--warn); }
.bericht-kachel.schlecht { border-left-color: var(--gefahr); }
.bericht-liste { list-style: none; padding: 0; margin: 0; }
.bericht-liste li { padding: 10px 0; border-bottom: 1px solid var(--rand); }
.bericht-liste li:last-child { border-bottom: none; }
.lauf-liste { list-style: none; padding: 0; margin: 0; }
.lauf-liste li { padding: 8px 0; border-bottom: 1px solid var(--rand); display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap; }
.lauf-liste li:last-child { border-bottom: none; }
.bestaetigung { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--rand); display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.bestaetigung p { margin: 0; max-width: 60ch; }

/* Profil */
.profil {
  background: var(--grund); border: 1px solid var(--rand); border-radius: 8px;
  padding: 18px; white-space: pre-wrap; word-break: break-word;
  font: 14px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 640px; overflow-y: auto;
}

/* Kleinkram */
.klein { font-size: 13px; }
.grau, .klein.grau { color: var(--text-leise); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
.leer { color: var(--text-leise); text-align: center; padding: 28px 14px; }
.anbieter-hinweis { font-size: 13px; color: var(--text-leise); margin: 0 0 14px; }
.warnung { font-size: 13px; background: color-mix(in srgb, var(--warn) 12%, transparent); color: var(--warn); padding: 10px 12px; border-radius: 8px; margin: 0 0 14px; }
.ki-status { color: var(--text-leise); margin-bottom: 0; }
.meldung { padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-top: 14px; }
.meldung.erfolg { background: color-mix(in srgb, var(--gut) 12%, transparent); color: var(--gut); }
.meldung.fehler, .fehler { color: var(--gefahr); font-size: 14px; }
.meldung.fehler { background: color-mix(in srgb, var(--gefahr) 12%, transparent); }

.hinweis {
  position: fixed; bottom: 22px; right: 22px; z-index: 40;
  background: var(--text); color: var(--flaeche);
  padding: 12px 18px; border-radius: 9px; max-width: 380px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .2);
}

@media (max-width: 720px) {
  .kopf { height: auto; padding: 10px 16px; flex-wrap: wrap; }
  main { padding: 20px 16px 140px; }
  .aktionsleiste { left: 16px; right: 16px; transform: none; max-width: none; }
}
