/* Farbtokens aus netero uebernommen (netero/ui/static/netero.css), damit die
   beiden Oberflaechen zusammengehoeren: GitHub-Dark als Grundlage, Bernstein
   als Akzent. Die Variablennamen bleiben, nur die Werte wechseln — dadurch
   zieht der ganze Rest der Datei automatisch mit. */
:root {
  --sage-100: #e6edf3;   /* Text                        (netero --ink)      */
  --sage-200: #ecc47e;   /* Akzent heller, fuer Hover                       */
  --sage-300: #e0b25e;   /* Akzent                      (netero --sage-dark)*/
  --sage-400: #8b949e;   /* gedaempft, Links            (netero --info)     */
  --ink: #0d1117;        /* Schrift AUF dem Akzent      (netero --solid)    */

  --signal:      #e0806e; /* Fehler   (netero --bad/--crit) */
  --signal-soft: #d8b14a; /* Warnung  (netero --warn/--med) */
  --signal-deep: #5cbe90; /* Gut      (netero --ok)         */

  --font-sans: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

  --bg: #0d1117;
  --bg-tint: #12171e;
  --surface: #171e26;
  --surface-2: #1c242e;
  --fg: var(--sage-100);
  --fg-soft: rgba(230, 237, 243, 0.82);
  --fg-mute: #9aa5b1;
  --line: #2c3742;
  --line-strong: #3d4a57;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* MUSS ganz oben stehen und !important tragen: mehrere Regeln unten setzen
   display:flex bzw. inline-flex, und das schlaegt das HTML-Attribut `hidden`
   aus der Browser-Vorgabe. Ohne diese Zeile bleibt die Detailtafel dauerhaft
   sichtbar und laesst sich nicht schliessen. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- Kopf ---------- */
.kopf {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg-tint);
  position: sticky; top: 0; z-index: 20;
}
.marke { display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.marke-name {
  font-family: var(--font-mono); font-weight: 700; font-size: 1.1rem;
  letter-spacing: 0.06em; color: var(--sage-300);
}
.marke-sub { color: var(--fg-mute); font-size: 0.85rem; }

.tabs { display: flex; gap: 0.3rem; margin-left: auto; margin-right: 1rem; }
.tab {
  background: none; border: 1px solid transparent; color: var(--fg-mute);
  font: inherit; font-size: 0.88rem; padding: 0.35rem 0.8rem;
  border-radius: 8px; cursor: pointer;
}
.tab:hover { background: var(--surface); color: var(--fg); }
.tab.aktiv { background: var(--surface-2); border-color: var(--line-strong); color: var(--fg); }

/* ---------- Bibliothek ---------- */
.bib { padding: 1.1rem 1.25rem 3rem; }
.bib-filter { max-width: 220px; margin: 0; }
.bib-liste { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 0.75rem; }
.bib-zeile {
  display: grid; grid-template-columns: 1fr auto; gap: 0.35rem 1rem;
  padding: 0.6rem 0.75rem; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
}
.bib-titel { font-size: 0.92rem; }
.bib-zahlen { font-family: var(--font-mono); font-size: 0.78rem; color: var(--fg-mute); white-space: nowrap; }
.bib-zahlen .fehlt { color: var(--signal-soft); }
.bib-zahlen .voll { color: var(--sage-300); }
.balken {
  grid-column: 1 / -1; height: 4px; border-radius: 999px;
  background: var(--surface-2); overflow: hidden;
}
.balken i { display: block; height: 100%; background: var(--sage-300); }
.status { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: var(--fg-mute); }
.led {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--fg-mute); box-shadow: 0 0 0 3px rgba(129,154,145,0.12);
}
.led.gut { background: var(--sage-300); }
.led.schlecht { background: var(--signal); }

/* ---------- Aufteilung ---------- */
.huelle { display: grid; grid-template-columns: 250px 1fr; min-height: calc(100vh - 56px); }
@media (max-width: 780px) {
  .huelle { grid-template-columns: 1fr; }
  .quellen {
    border-right: none; border-bottom: 1px solid var(--line);
    max-height: 210px; position: static;
  }
}

/* Handy: der Kopf muss umbrechen duerfen, die Tafel den ganzen Schirm
   nutzen, und die Kacheln kleiner werden. */
@media (max-width: 560px) {
  .kopf { flex-wrap: wrap; gap: 0.5rem 0.75rem; padding: 0.7rem 0.85rem; }
  .marke-sub { display: none; }
  .tabs { margin: 0; order: 3; width: 100%; }
  .tab { flex: 1; text-align: center; }
  .status { margin-left: auto; }
  .inhalt, .bib { padding: 0.9rem 0.85rem 3rem; }
  .gitter { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 0.6rem; }
  .tafel { width: 100%; border-left: none; }
  .tafel-fuss { position: sticky; bottom: 0; background: var(--bg-tint); padding-bottom: 0.5rem; }
  .quellen-block h2 { top: 0; }
  .werkzeugleiste h1 { font-size: 1rem; }
  .suche input { min-width: 0; }
  .bib-zeile { grid-template-columns: 1fr; }
  .zeilen-knoepfe { flex-wrap: wrap; }
}

.quellen {
  border-right: 1px solid var(--line);
  padding: 0.75rem; overflow-y: auto;
  max-height: calc(100vh - 56px); position: sticky; top: 56px;
}
.feldchen { display: block; margin-bottom: 0.45rem; }
.feldchen select {
  width: 100%; padding: 0.45rem 0.6rem;
  background: var(--surface-2); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 0.85rem;
}
/* Die aufgeklappte Liste erbt die Seitenfarben NICHT — ohne das hier steht
   auf hellem Systemhintergrund helle Schrift, also nichts Lesbares. */
.feldchen select option { background: #12171e; color: #e6edf3; }

/* Abdeckungs-Anzeige unter den Scanlator-Gruppen */
.deckung {
  margin-top: 0.55rem; padding: 0.5rem 0.6rem; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 0.82rem; line-height: 1.45;
}
.deckung b { color: var(--sage-300); }
.deckung .luecke { color: var(--signal-soft); }
.deckung-knoepfe { display: flex; gap: 0.4rem; margin-top: 0.5rem; flex-wrap: wrap; }
.kat .spanne {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.68rem;
  color: var(--fg-mute); white-space: nowrap;
}
.warteschlange {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--fg-mute);
  border: 1px solid var(--line); border-radius: 999px; padding: 0.1rem 0.55rem;
}
.warteschlange.aktiv { color: var(--sage-300); border-color: var(--line-strong); cursor: pointer; }
.warteschlange.aktiv:hover { background: var(--surface-2); }

.zeilen-knoepfe { grid-column: 1 / -1; display: flex; gap: 0.4rem; margin-top: 0.15rem; }
.kat .zahl {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.7rem;
  color: var(--fg-mute);
}
#downloadStarten { margin-top: 0.6rem; }
.feldchen input, .suche input {
  width: 100%; padding: 0.5rem 0.65rem;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 0.9rem;
}
.feldchen input:focus, .suche input:focus { outline: none; border-color: var(--line-strong); }
.quellen-liste { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 2px; }
.sprach-titel {
  font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--fg-mute); margin: 0.85rem 0 0.3rem 0.4rem;
}
.quelle {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.4rem 0.5rem; border-radius: 8px;
  background: none; border: 1px solid transparent; color: var(--fg-soft);
  font: inherit; font-size: 0.9rem; text-align: left; cursor: pointer; width: 100%;
}
.quelle:hover { background: var(--surface); }
.quelle.aktiv { background: var(--surface-2); border-color: var(--line-strong); color: var(--fg); }
.quelle img { width: 20px; height: 20px; border-radius: 4px; flex: 0 0 auto; }
.quelle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Inhalt ---------- */
.inhalt { padding: 1.1rem 1.25rem 3rem; }
.werkzeugleiste {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.werkzeugleiste h1 { font-size: 1.15rem; margin: 0; font-weight: 600; }
.suche { display: flex; gap: 0.4rem; }
.suche input { min-width: 220px; }

/* ---------- Suche über alle Quellen ---------- */
.global-suche { display: flex; gap: 0.4rem; margin-bottom: 1rem; }
.global-suche input {
  flex: 1; min-width: 0; padding: 0.55rem 0.75rem;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line-strong); border-radius: 8px; font: inherit;
}
.global-suche input:focus { outline: none; border-color: var(--sage-400); }
/* Deutliche Trennung zwischen den Quellen — sonst laeuft die naechste
   Trefferliste optisch in die vorige hinein. */
.quellen-block { margin-bottom: 1.75rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.quellen-block:first-of-type { border-top: none; padding-top: 0.25rem; }
.quellen-block h2 {
  font-size: 0.92rem; margin: 0 0 0.6rem; display: flex; align-items: center; gap: 0.5rem;
  position: sticky; top: 56px; z-index: 5;
  background: var(--bg); padding: 0.35rem 0; border-bottom: 1px solid var(--line);
}
.quellen-block h2 .anzahl {
  font-family: var(--font-mono); font-size: 0.72rem; color: var(--fg-mute);
}
.quellen-block h2 a { color: var(--sage-400); font-size: 0.72rem; text-decoration: none; }
.quellen-block h2 a:hover { text-decoration: underline; }
.suche-rest {
  padding: 0.6rem 0.75rem; border-radius: 8px; font-size: 0.82rem;
  background: var(--surface); border: 1px solid var(--line); color: var(--fg-mute);
}
.suche-rest .kaputt { color: var(--signal-soft); }

.gitter {
  display: grid; gap: 0.9rem;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}
.karte {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  overflow: hidden; cursor: pointer; padding: 0; text-align: left;
  color: var(--fg); font: inherit; display: flex; flex-direction: column;
  transition: border-color .15s, transform .15s;
}
.karte:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.karte-bild { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; background: var(--surface-2); display: block; }
.karte-titel {
  padding: 0.5rem 0.6rem 0.65rem; font-size: 0.82rem; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.abzeichen {
  position: absolute; margin: 0.4rem; padding: 0.1rem 0.4rem;
  background: var(--sage-300); color: var(--ink); border-radius: 5px;
  font-size: 0.65rem; font-weight: 700; font-family: var(--font-mono);
}
.karte-huelle { position: relative; }

.mehr-zeile { display: flex; justify-content: center; margin-top: 1.5rem; }

/* ---------- Knoepfe ---------- */
.knopf {
  padding: 0.5rem 0.9rem; border-radius: 8px; cursor: pointer;
  background: var(--sage-300); color: var(--ink); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 0.88rem; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.knopf:hover { background: var(--sage-200); }
.knopf:disabled { opacity: 0.5; cursor: default; }
.knopf.still { background: var(--surface-2); color: var(--fg); border-color: var(--line); }
.knopf.still:hover { border-color: var(--line-strong); }
.knopf.schmal { padding: 0.5rem 0.7rem; font-size: 0.82rem; }
.knopf.gross { padding: 0.6rem 1.2rem; }

/* ---------- Detailtafel ---------- */
.tafel-hintergrund { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 30; }
.tafel {
  /* Breit genug fuer die Vergleichstabelle (sieben Spalten) und die
     Kategorienliste — mit 460px musste man dafuer waagerecht scrollen.
     min() haelt sie auf schmalen Schirmen weiter bildschirmfuellend. */
  position: fixed; top: 0; right: 0; bottom: 0; width: min(820px, 100%);
  background: var(--bg-tint); border-left: 1px solid var(--line-strong);
  padding: 1.25rem; overflow-y: auto; z-index: 31;
  display: flex; flex-direction: column; gap: 1rem;
}
.tafel-zu {
  position: absolute; top: 0.6rem; right: 0.75rem;
  background: none; border: none; color: var(--fg-mute);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.tafel-kopf { display: flex; gap: 1rem; align-items: flex-start; padding-right: 1.5rem; }
.tafel-bild { width: 110px; aspect-ratio: 2/3; object-fit: cover; border-radius: 8px; background: var(--surface-2); }
.tafel h2 { margin: 0 0 0.3rem; font-size: 1.05rem; line-height: 1.3; }
.tafel-text {
  margin: 0; font-size: 0.88rem; color: var(--fg-soft);
  max-height: 11rem; overflow-y: auto; white-space: pre-wrap;
}
.tafel-block h3 { margin: 0 0 0.25rem; font-size: 0.9rem; }
.tafel-fuss { margin-top: auto; display: flex; gap: 0.6rem; padding-top: 0.5rem; }
.tafel-fuss .knopf { flex: 1; }

/* Nebeneinander statt untereinander: bei 820 px Tafelbreite passen zwei bis
   drei Spalten, und die Liste bleibt ohne Scrollen im Blick. Untereinander
   wuchs sie bei vielen Kategorien oder Scanlator-Gruppen aus der Tafel heraus. */
.kategorien {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.35rem; margin-top: 0.6rem;
}
.kat {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.4rem 0.55rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  cursor: pointer; font-size: 0.88rem;
}
.kat:hover { border-color: var(--line-strong); }
.kat input { accent-color: var(--sage-300); }
.kat .lade-marke {
  margin-left: auto; font-family: var(--font-mono); font-size: 0.65rem;
  color: var(--signal-soft); border: 1px solid var(--line); border-radius: 5px; padding: 0 0.35rem;
}

.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.4rem 0 0; }
.chips span {
  font-size: 0.7rem; padding: 0.1rem 0.45rem; border-radius: 999px;
  background: var(--surface-2); color: var(--fg-mute);
}

/* ---------- Kleinkram ---------- */
/* ---------- Anmeldung ---------- */
.anmeldung {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
}
.anmelde-kasten {
  display: flex; flex-direction: column; gap: 0.6rem;
  width: min(320px, 100%); padding: 1.5rem;
  background: var(--bg-tint); border: 1px solid var(--line-strong); border-radius: 12px;
}
.anmelde-kasten input {
  padding: 0.55rem 0.7rem; background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
.anmelde-kasten input:focus { outline: none; border-color: var(--line-strong); }
.anmelde-kasten .marke-name.gross { font-size: 1.5rem; }
.anmelde-kasten p { margin: 0 0 0.4rem; }
.anmelde-fehler {
  margin: 0; padding: 0.5rem 0.6rem; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--signal);
  color: var(--signal-soft); font-size: 0.85rem;
}

/* ---------- Konten ---------- */
.konto-form { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.75rem 0; }
.konto-form input, .konto-form select {
  padding: 0.45rem 0.6rem; background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 0.88rem;
}
.konto-form option { background: #12171e; color: #e6edf3; }
.konto-zeile {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.75rem; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line);
}
.konto-zeile .rolle {
  font-family: var(--font-mono); font-size: 0.7rem; padding: 0.05rem 0.4rem;
  border-radius: 5px; border: 1px solid var(--line);
}
.konto-zeile .rolle.admin { color: var(--signal-soft); border-color: var(--signal-soft); }
.konto-zeile .weg { margin-left: auto; }

.mute { color: var(--fg-mute); }
.klein { font-size: 0.8rem; }
.hinweis {
  padding: 0.75rem 0.9rem; border-radius: 10px; margin-bottom: 1rem;
  background: var(--surface); border: 1px solid var(--line-strong); font-size: 0.9rem;
}
.hinweis.schlimm { border-color: var(--signal); }
.toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%);
  background: var(--sage-300); color: var(--ink); padding: 0.6rem 1.1rem;
  border-radius: 999px; font-weight: 600; font-size: 0.9rem; z-index: 50;
}
.toast.schlimm { background: var(--signal); color: var(--sage-100); }
.leer { color: var(--fg-mute); padding: 2rem 0; }

/* ---------- Anfragen ---------- */

/* Abzeichen am Reiter: die Zahl offener Anfragen. Sitzt im Knopf, damit es
   mitwandert, wenn die Reiter auf schmalen Schirmen umbrechen. */
.tab-marke {
  display: inline-block; margin-left: 0.35rem; min-width: 1.15rem;
  padding: 0 0.25rem; border-radius: 999px; text-align: center;
  background: var(--sage-300); color: var(--ink);
  font-family: var(--font-mono); font-size: 0.68rem; font-weight: 700;
}

/* Eigene Spalten statt der geerbten "1fr auto" aus .bib-zeile: Bild, Text,
   Zustand, Knoepfe. */
.bib-zeile.anfrage {
  grid-template-columns: 40px 1fr auto auto;
  align-items: center; gap: 0.35rem 0.9rem;
}
.bib-zeile.anfrage.erledigt,
.bib-zeile.anfrage.abgelehnt { opacity: 0.62; }

.anfrage-bild {
  width: 40px; height: 56px; object-fit: cover;
  border-radius: 5px; background: var(--surface-2);
}
.anfrage-mitte { min-width: 0; }
.anfrage-notiz-text {
  font-size: 0.8rem; color: var(--fg-soft); margin-top: 0.2rem;
  border-left: 2px solid var(--line-strong); padding-left: 0.5rem;
}
.anfrage-grund {
  font-size: 0.8rem; color: var(--signal); margin-top: 0.2rem;
}
.anfrage-knoepfe { display: flex; gap: 0.35rem; flex-wrap: wrap; justify-content: flex-end; }

/* Zustandsmarke — dieselbe Form wie die Rollenmarke bei den Konten. */
.bib-zeile.anfrage .rolle {
  font-family: var(--font-mono); font-size: 0.7rem; padding: 0.05rem 0.4rem;
  border-radius: 5px; border: 1px solid var(--line); color: var(--fg-mute);
}
.bib-zeile.anfrage .rolle.offen { color: var(--sage-300); border-color: var(--sage-300); }
.bib-zeile.anfrage .rolle.erledigt { color: var(--signal-deep); border-color: var(--signal-deep); }
.bib-zeile.anfrage .rolle.abgelehnt { color: var(--signal); border-color: var(--signal); }

/* Der Anfrage-Block in der Detailtafel */
.anfrage-notiz {
  width: 100%; margin-top: 0.5rem; padding: 0.5rem 0.6rem;
  background: var(--bg-tint); color: var(--fg); font: inherit; font-size: 0.88rem;
  border: 1px solid var(--line); border-radius: 8px;
}
.anfrage-notiz:focus { outline: none; border-color: var(--sage-300); }
.anfrage-stand {
  margin: 0.5rem 0 0; font-size: 0.82rem; color: var(--sage-300);
}

/* Auf schmalen Schirmen rutschen die Knoepfe unter den Text, sonst wird die
   Titelspalte auf wenige Zeichen zusammengedrueckt. */
@media (max-width: 640px) {
  .bib-zeile.anfrage { grid-template-columns: 40px 1fr auto; }
  .anfrage-knoepfe { grid-column: 2 / -1; justify-content: flex-start; }
}

/* ---------- Teilkapitel-Schalter und Quellenvergleich ---------- */

.teil-schalter {
  display: flex; align-items: center; gap: 0.5rem; margin-top: 0.6rem;
  font-size: 0.86rem; cursor: pointer;
}
.teil-detail {
  margin-top: 0.3rem; padding-left: 1.6rem;
  font-size: 0.78rem; color: var(--fg-mute); font-family: var(--font-mono);
}

.vergleich { margin-top: 0.9rem; overflow-x: auto; }
.zd-vergleich { border-collapse: collapse; width: 100%; font-size: 0.82rem; }
.zd-vergleich th, .zd-vergleich td {
  text-align: right; padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.zd-vergleich th:first-child, .zd-vergleich td:first-child { text-align: left; }
.zd-vergleich th { color: var(--fg-mute); font-weight: 600; }
.zd-vergleich tbody tr:hover { background: var(--surface-2); }
/* Die Quelle, die gerade offen ist — damit man sich im Vergleich wiederfindet. */
.zd-vergleich tr.aktuell { color: var(--sage-300); }
/* Quelle, deren Titel deutlich abweicht — vermutlich eine andere Serie. */
.zd-vergleich tr.fraglich td { color: var(--fg-mute); }
.zd-vergleich tr.fraglich td:nth-child(2) { color: var(--signal-soft); }

/* Seitenformat-Befund in der Tafel */
.seiten-profil {
  margin-top: 0.6rem; padding: 0.5rem 0.7rem; border-radius: 8px;
  background: var(--bg-tint); border: 1px solid var(--line); font-size: 0.84rem;
}
.seiten-profil.streifen { border-color: var(--signal-soft); }
.seiten-profil.seiten   { border-color: var(--signal-deep); }
.zd-vergleich td.format-seiten   { color: var(--signal-deep); white-space: nowrap; }
.zd-vergleich td.format-streifen { color: var(--signal-soft); white-space: nowrap; }

/* Empfehlung und unbrauchbare Zaehlung im Quellenvergleich */
.zd-vergleich tr.empfohlen td { background: rgba(92, 190, 144, 0.09); }
.zd-vergleich tr.empfohlen td:first-child { color: var(--signal-deep); font-weight: 600; }
.zd-vergleich td.zaehlung-kaputt { color: var(--signal-soft); }
