/* =====================================================================
   MeineBRD — Verwaltungsoberfläche

   Gestaltungsidee: eine digitale Amtsstube. Das Panel ist kein Dashboard
   für Kennzahlen, sondern ein Arbeitsplatz zum Bearbeiten von Vorgängen:
   Datensätze prüfen und freigeben, Meldungen entscheiden, Updates einspielen.

   Entsprechend die Entscheidungen:
   - Dichte Listen statt großzügiger Kacheln. Wer prüft, will viel auf einen
     Blick sehen.
   - Jeder Datensatz trägt seine Kennung sichtbar in Monospace, wie ein
     Aktenzeichen. Das ist die Nummer, die man beim Nachfragen nennt.
   - Status wird als eckiger Vermerk gesetzt, nicht als runde Pille.
     Eckig liest sich wie ein Stempel, rund wie eine App.
   - Farbe trägt Bedeutung, sie schmückt nicht: Amtsblau für Handlungen,
     Siegelrot für Offenes, Grün für Geprüftes.
   - Ein einziger auffälliger Bereich: die Amtsleiste oben mit dem
     Systemzustand. Alles andere bleibt ruhig.
====================================================================== */

:root {
  /* Flächen */
  --paper:        #f5f6f2;
  --surface:      #ffffff;
  --surface-sunk: #eceee7;

  /* Chrome */
  --slate:        #262d36;
  --slate-deep:   #1b2129;
  --slate-line:   #3a434f;
  --slate-text:   #b6c0cc;
  --slate-mute:   #7d8894;

  /* Text */
  --ink:          #1a1d21;
  --text:         #2b3138;
  --text-mute:    #626a74;

  /* Linien */
  --rule:         #d5d7d0;
  --rule-strong:  #b4b8ad;

  /* Bedeutungsträger */
  --official:     #14507d;
  --official-dk:  #0f3c5e;
  --official-bg:  #e8eff5;
  --seal:         #7a1f2b;
  --seal-bg:      #f7eaec;
  --verified:     #2c6e4a;
  --verified-bg:  #e8f1ea;
  --pending:      #8a6a15;
  --pending-bg:   #f9f1dc;

  --sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;
}

* { box-sizing: border-box; }

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

a { color: var(--official); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
:focus-visible { outline: 2px solid var(--official); outline-offset: 2px; }

.mono { font-family: var(--mono); }

/* ---------------------------------------------------------------------
   Grundgerüst
------------------------------------------------------------------------ */

.shell { display: flex; min-height: 100vh; }

/* --- Seitenleiste --- */

.rail {
  width: 244px;
  flex-shrink: 0;
  background: var(--slate);
  color: var(--slate-text);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--slate-deep);
}

.rail__head {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--slate-line);
}
.rail__wordmark {
  display: block;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.rail__wordmark:hover { text-decoration: none; }
.rail__role {
  display: block;
  font-size: 12.5px;
  color: var(--slate-mute);
  margin-top: 1px;
}

.rail__nav { padding: 14px 10px; flex-grow: 1; }

.rail__group {
  font-size: 11.5px;
  color: var(--slate-mute);
  padding: 12px 8px 5px;
  letter-spacing: 0.02em;
}
.rail__group:first-child { padding-top: 2px; }

.rail__link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border-radius: 2px;
  color: var(--slate-text);
  font-size: 14.5px;
  border-left: 2px solid transparent;
}
.rail__link:hover { background: rgba(255, 255, 255, 0.05); text-decoration: none; color: #fff; }
.rail__link.is-active {
  background: rgba(255, 255, 255, 0.07);
  border-left-color: #5f9ecf;
  color: #fff;
  font-weight: 600;
}

/* Zähler in der Navigation: zeigt echte offene Arbeit, kein Schmuck. */
.rail__count {
  margin-left: auto;
  min-width: 20px;
  text-align: center;
  padding: 1px 6px;
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 12px;
  background: var(--seal);
  color: #fff;
}
.rail__count--quiet { background: var(--slate-line); color: var(--slate-text); }

.rail__foot {
  padding: 12px 16px 16px;
  border-top: 1px solid var(--slate-line);
  font-size: 13px;
}
.rail__user { color: #fff; }
.rail__userrole { color: var(--slate-mute); font-size: 12.5px; margin-bottom: 8px; }
.rail__exit {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--slate-mute); font-size: 13px;
}
.rail__exit:hover { color: #fff; text-decoration: underline; }

/* --- Arbeitsfläche --- */

.work { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; }

/* Amtsleiste: der eine auffällige Bereich. Zeigt den Systemzustand. */
.statusbar {
  background: var(--slate-deep);
  color: var(--slate-text);
  padding: 7px 28px;
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 12.5px;
  flex-wrap: wrap;
}
.statusbar__item { display: flex; align-items: center; gap: 7px; }
.statusbar__label { color: var(--slate-mute); }
.statusbar__value { font-family: var(--mono); color: #fff; }
.statusbar__lamp {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4c9a6a; flex-shrink: 0;
}
.statusbar__lamp--warn { background: #c9a227; }
.statusbar__spacer { margin-left: auto; }

.sheet { padding: 26px 28px 56px; max-width: 1180px; }

.sheet__head {
  padding-bottom: 14px;
  margin-bottom: 22px;
  border-bottom: 2px solid var(--ink);
}
.sheet__head h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.sheet__head p {
  margin: 5px 0 0;
  color: var(--text-mute);
  font-size: 14.5px;
  max-width: 74ch;
}

/* ---------------------------------------------------------------------
   Aktenblock
------------------------------------------------------------------------ */

.block {
  background: var(--surface);
  border: 1px solid var(--rule);
  margin-bottom: 20px;
}

.block__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-sunk);
}
.block__head h2 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}
.block__hint { font-size: 13px; color: var(--text-mute); margin-left: auto; }
.block__body { padding: 16px; }
.block__body--flush { padding: 0; }

/* ---------------------------------------------------------------------
   Kennzahlenreihe
------------------------------------------------------------------------ */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  border: 1px solid var(--rule);
  background: var(--rule);
  gap: 1px;
  margin-bottom: 20px;
}
.figure { background: var(--surface); padding: 13px 16px; }
.figure__label { font-size: 12.5px; color: var(--text-mute); }
.figure__value {
  font-family: var(--mono);
  font-size: 21px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}
.figure--alert .figure__value { color: var(--seal); }

/* ---------------------------------------------------------------------
   Tabellen
------------------------------------------------------------------------ */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-mute);
  padding: 9px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-sunk);
  white-space: nowrap;
}
tbody td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafaf7; }
td.num, th.num { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.cell-sub { display: block; color: var(--text-mute); font-size: 13px; margin-top: 2px; }
.cell-actions { text-align: right; white-space: nowrap; }

/* Aktenzeichen */
.ref {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-mute);
  background: var(--surface-sunk);
  padding: 1px 5px;
  border: 1px solid var(--rule);
}

/* ---------------------------------------------------------------------
   Vermerke (Status)
------------------------------------------------------------------------ */

.mark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 2px;
  border: 1px solid;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}
.mark::before {
  content: "";
  width: 6px; height: 6px;
  background: currentColor;
}
.mark--verified { color: var(--verified); border-color: #b7d4c1; background: var(--verified-bg); }
.mark--pending  { color: var(--pending);  border-color: #e3d3a4; background: var(--pending-bg); }
.mark--open     { color: var(--seal);     border-color: #ddb9bf; background: var(--seal-bg); }
.mark--neutral  { color: var(--text-mute);border-color: var(--rule-strong); background: var(--surface-sunk); }
.mark--info     { color: var(--official); border-color: #bcd0e0; background: var(--official-bg); }

/* ---------------------------------------------------------------------
   Schaltflächen
------------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--surface-sunk); text-decoration: none; }
.btn--primary { background: var(--official); border-color: var(--official); color: #fff; }
.btn--primary:hover { background: var(--official-dk); }
.btn--primary:disabled { background: #8ba6bb; border-color: #8ba6bb; cursor: not-allowed; }
.btn--seal { background: var(--seal); border-color: var(--seal); color: #fff; }
.btn--seal:hover { background: #62171f; }
.btn--quiet { border-color: var(--rule); color: var(--text-mute); }
.btn--wide { width: 100%; }
.btn-row { display: flex; gap: 7px; flex-wrap: wrap; }
.inline-form { display: inline; }

/* ---------------------------------------------------------------------
   Formulare
------------------------------------------------------------------------ */

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; color: var(--ink); margin-bottom: 5px; }
.field input[type="text"],
.field input[type="password"],
.field select,
.field textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background: var(--surface);
  color: var(--text);
}
.field textarea { min-height: 90px; resize: vertical; }
.field-note { font-size: 12.5px; color: var(--text-mute); margin: 5px 0 0; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }

/* ---------------------------------------------------------------------
   Meldungen
------------------------------------------------------------------------ */

.note {
  padding: 11px 14px;
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: 2px;
  font-size: 14px;
  margin-bottom: 18px;
  background: var(--surface);
}
.note--ok    { border-left-color: var(--verified); background: var(--verified-bg); color: #1f5236; }
.note--warn  { border-left-color: var(--pending);  background: var(--pending-bg);  color: #6b520f; }
.note--error { border-left-color: var(--seal);     background: var(--seal-bg);     color: var(--seal); }
.note--info  { border-left-color: var(--official); background: var(--official-bg); color: var(--official-dk); }

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
}

/* ---------------------------------------------------------------------
   Vorgangsliste (Moderation)
------------------------------------------------------------------------ */

.case {
  border: 1px solid var(--rule);
  border-left: 3px solid var(--rule-strong);
  background: var(--surface);
  margin-bottom: 12px;
}
.case--open { border-left-color: var(--seal); }
.case--done { border-left-color: var(--verified); }

.case__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-sunk);
  flex-wrap: wrap;
}
.case__reason { font-weight: 600; color: var(--ink); font-size: 14px; }
.case__meta { font-size: 12.5px; color: var(--text-mute); font-family: var(--mono); }
.case__meta--right { margin-left: auto; }

.case__body { padding: 14px 15px; }
.case__quote {
  border-left: 2px solid var(--rule-strong);
  padding: 2px 0 2px 13px;
  margin: 0 0 12px;
  color: var(--text);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 170px;
  overflow-y: auto;
}
.case__title { font-weight: 600; color: var(--ink); margin: 0 0 5px; }
.case__foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 15px;
  border-top: 1px solid var(--rule);
  background: #fbfbf9;
  flex-wrap: wrap;
}
.case__spacer { margin-left: auto; }

/* --- Filterreiter --- */

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); margin-bottom: 18px; }
.tab {
  padding: 8px 15px;
  font-size: 14px;
  color: var(--text-mute);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--official); }

/* ---------------------------------------------------------------------
   Anmeldung und Ersteinrichtung
------------------------------------------------------------------------ */

.gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--slate-deep);
  padding: 24px;
}
.gate__card {
  width: 100%;
  max-width: 388px;
  background: var(--surface);
  border-top: 3px solid var(--official);
}
.gate__head { padding: 22px 26px 16px; border-bottom: 1px solid var(--rule); }
.gate__title { margin: 0; font-size: 17px; font-weight: 600; color: var(--ink); }
.gate__sub { margin: 3px 0 0; font-size: 13.5px; color: var(--text-mute); }
.gate__body { padding: 20px 26px 24px; }
.gate__foot {
  padding: 12px 26px;
  border-top: 1px solid var(--rule);
  background: var(--surface-sunk);
  font-size: 12.5px;
  color: var(--text-mute);
}

/* ---------------------------------------------------------------------
   Upload
------------------------------------------------------------------------ */

.drop {
  border: 1.5px dashed var(--rule-strong);
  border-radius: 2px;
  padding: 28px 18px;
  text-align: center;
  color: var(--text-mute);
  cursor: pointer;
  display: block;
  background: #fbfbf9;
}
.drop.is-over { border-color: var(--official); background: var(--official-bg); color: var(--official-dk); }
.drop strong { color: var(--ink); display: block; margin-bottom: 3px; }
.drop input[type="file"] { display: none; }

.log { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.log li { display: flex; gap: 13px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.log li:last-child { border-bottom: none; }
.log time { font-family: var(--mono); font-size: 12.5px; color: var(--text-mute); white-space: nowrap; }

/* ---------------------------------------------------------------------
   Schmale Bildschirme
------------------------------------------------------------------------ */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail { width: 100%; border-right: none; border-bottom: 1px solid var(--slate-deep); }
  .rail__nav { display: flex; flex-wrap: wrap; gap: 3px; padding: 10px; flex-grow: 0; }
  .rail__group { display: none; }
  .rail__link { border-left: none; border-bottom: 2px solid transparent; }
  .rail__link.is-active { border-left: none; border-bottom-color: #5f9ecf; }
  .rail__foot { display: flex; align-items: center; gap: 12px; padding: 10px 16px; }
  .rail__userrole { margin: 0; }
  .sheet { padding: 20px 16px 40px; }
  .statusbar { padding: 7px 16px; gap: 16px; }
  thead { display: none; }
  tbody td { display: block; padding: 6px 14px; border: none; }
  tbody tr { display: block; border-bottom: 1px solid var(--rule); padding: 8px 0; }
  .cell-actions { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Verlaufsbalken in der Auswertung: zeigt Größenverhältnisse ohne Diagramm-
   Bibliothek und ohne zusätzliche Abhängigkeit. */
.bar {
  display: inline-block;
  height: 9px;
  min-width: 2px;
  background: var(--official);
  border-radius: 1px;
  vertical-align: middle;
}
