/* Studio - Oberflaeche.
 *
 * Eine Datei, kein Inline-Stil: die CSP faehrt default-src 'self' ohne 'unsafe-inline'.
 * Auf der Seite, auf der fremde HTML-Mockups im Rahmen laufen, ist das die richtige
 * Reihenfolge der Zugestaendnisse.
 *
 * Zwei vollstaendige Token-Saetze, kein invertierter Abklatsch. Die Seitenleiste ist in
 * beiden dunkel (Marineblau, Akzent Petrol) - so hat Joern das Mockup abgenommen.
 * Die Vorgabe kommt aus dem System (prefers-color-scheme); waehlt der Mensch etwas,
 * steht es als data-thema am <html> und sticht die Vorgabe in beide Richtungen.
 *
 * Keine Schrift von aussen, keine CDN, kein Verlauf als Dekoration. Ruhe, Luft,
 * feine Linien.
 */

:root {
  /* Inhalt, hell */
  --ink: #161B22;
  --ink-2: #3D4451;
  --leise: #6F7885;
  --linie: #E4E6EA;
  --linie-stark: #D3D7DD;
  --grund: #F6F6F4;
  --flaeche: #FFFFFF;
  --flaeche-2: #FBFBFA;
  --akzent: #0E5A57;
  --akzent-tief: #0B3E3C;
  --akzent-wasch: #E6F0EE;
  --warn: #8C4F35;
  --warn-wasch: #F7EDE8;
  --auf-akzent: #FFFFFF;
  --schatten: 0 1px 0 rgba(22, 27, 34, .04), 0 12px 32px -20px rgba(22, 27, 34, .22);
  --schatten-hoch: 0 1px 0 rgba(22, 27, 34, .04), 0 18px 36px -20px rgba(22, 27, 34, .28);

  /* Seitenleiste - in beiden Themen dieselbe */
  --leiste: #121A26;
  --leiste-2: #0D141E;
  --leiste-linie: rgba(255, 255, 255, .08);
  --leiste-text: #9FAAB9;
  --leiste-stark: #F1F4F8;
  --leiste-an: rgba(63, 192, 181, .13);
  --leiste-an-text: #6FD8CE;
  --leiste-marke: #14A79E;

  /* Menschen und Abteilungen - dieselben drei Farben wie im Mockup */
  --wer-z: #6E82A8;
  --wer-b: #3FA79F;
  --wer-m: #C0795A;

  --radius: 12px;
  --radius-klein: 8px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-thema="hell"]) {
    --ink: #E8ECF1;
    --ink-2: #BAC3CE;
    --leise: #848E9C;
    --linie: #242C38;
    --linie-stark: #333D4B;
    --grund: #0B1016;
    --flaeche: #151C25;
    --flaeche-2: #1A222C;
    --akzent: #3FC0B5;
    --akzent-tief: #8BE2DA;
    --akzent-wasch: #12312F;
    --warn: #D79172;
    --warn-wasch: #2C2019;
    --auf-akzent: #08221F;
    --schatten: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 32px -20px rgba(0, 0, 0, .75);
    --schatten-hoch: 0 1px 0 rgba(0, 0, 0, .3), 0 18px 36px -20px rgba(0, 0, 0, .85);
  }
}

:root[data-thema="dunkel"] {
  --ink: #E8ECF1;
  --ink-2: #BAC3CE;
  --leise: #848E9C;
  --linie: #242C38;
  --linie-stark: #333D4B;
  --grund: #0B1016;
  --flaeche: #151C25;
  --flaeche-2: #1A222C;
  --akzent: #3FC0B5;
  --akzent-tief: #8BE2DA;
  --akzent-wasch: #12312F;
  --warn: #D79172;
  --warn-wasch: #2C2019;
  --auf-akzent: #08221F;
  --schatten: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 32px -20px rgba(0, 0, 0, .75);
  --schatten-hoch: 0 1px 0 rgba(0, 0, 0, .3), 0 18px 36px -20px rgba(0, 0, 0, .85);
}

* { box-sizing: border-box; }
html { font-size: 15px; color-scheme: light dark; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 2px;
  border-radius: 4px;
}

svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------------------------------------------------------------- Gerüst */

.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }

aside {
  background: var(--leiste);
  border-right: 1px solid var(--leiste-linie);
  color: var(--leiste-text);
  padding: 26px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.marke { display: flex; align-items: center; gap: 12px; }
.marke .zeichen {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--leiste-marke); color: #06201E;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; letter-spacing: .02em;
}
.marke h1 { font-size: 16px; margin: 0; font-weight: 600; letter-spacing: -.01em; color: var(--leiste-stark); }
.marke small { display: block; font-size: 12px; color: var(--leiste-text); font-weight: 400; margin-top: 1px; }

nav { display: flex; flex-direction: column; gap: 20px; }
nav h6 { margin: 0 0 6px; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: #6B7688; font-weight: 600; }
nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-klein); font-size: 14px; color: var(--leiste-text); }
nav a:hover { background: rgba(255, 255, 255, .05); color: var(--leiste-stark); }
nav a.an { background: var(--leiste-an); color: var(--leiste-an-text); font-weight: 600; }
nav a .zahl { margin-left: auto; font-size: 11.5px; color: #6B7688; font-variant-numeric: tabular-nums; }
nav a.an .zahl { color: var(--leiste-an-text); }

.punkt { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.punkt.z { background: var(--wer-z); }
.punkt.b { background: var(--wer-b); }
.punkt.m { background: var(--wer-m); }

.ich { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--leiste-linie); display: flex; flex-direction: column; gap: 12px; }
.ich .zeile { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--leiste-stark); }
.ich .bild { width: 30px; height: 30px; border-radius: 50%; background: #2A3545; color: var(--leiste-stark); display: grid; place-items: center; font-weight: 600; font-size: 12.5px; }
.ich .rolle { display: block; color: var(--leiste-text); font-size: 12px; }
.ich .knoepfe { display: flex; gap: 8px; }
.ich form { display: contents; }
.leiste-knopf {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--leiste-linie); color: var(--leiste-text);
  border-radius: var(--radius-klein); padding: 7px 10px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.leiste-knopf:hover { background: rgba(255, 255, 255, .11); color: var(--leiste-stark); }
.leiste-knopf svg { width: 15px; height: 15px; }

main { padding: 26px 32px 48px; min-width: 0; }

/* ---------------------------------------------------------------- Kopfzeile */

.kopf { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; flex-wrap: wrap; }

/* Die Suchleiste bricht nicht um: sie darf schrumpfen (min-width:0) und schneidet den
 * Text ab, statt sich in zwei Zeilen zu legen. */
.suche { display: flex; align-items: center; gap: 10px; flex: 1 1 240px; min-width: 0; max-width: 480px; }
.suche label { display: flex; align-items: center; gap: 10px; flex: 1 1 auto; min-width: 0;
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: 10px; padding: 8px 13px; }
.suche label:focus-within { border-color: var(--akzent); }
.suche svg { color: var(--leise); }
.suche input {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent; color: var(--ink);
  font: inherit; font-size: 14px; white-space: nowrap; text-overflow: ellipsis;
}
.suche input:focus { outline: none; }
.suche input::placeholder { color: var(--leise); }

.marken { display: flex; gap: 8px; flex-wrap: wrap; }
.marker { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--linie); background: var(--flaeche); font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.marker:hover { border-color: var(--linie-stark); }
.marker.an { background: var(--ink); border-color: var(--ink); color: var(--grund); font-weight: 500; }

.knopf {
  background: var(--akzent); color: var(--auf-akzent); border: 1px solid var(--akzent);
  border-radius: 10px; padding: 9px 15px; font: inherit; font-weight: 600; font-size: 13.5px;
  display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; cursor: pointer;
}
.knopf:hover { background: var(--akzent-tief); border-color: var(--akzent-tief); }
.knopf.still { background: var(--flaeche); color: var(--ink-2); border-color: var(--linie); }
.knopf.still:hover { background: var(--flaeche-2); border-color: var(--linie-stark); }
.knopf.rechts { margin-left: auto; }
.knopf[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------------------------------------------------------- Text */

h2 { font-size: 24px; margin: 0 0 6px; font-weight: 600; letter-spacing: -.02em; }
h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.unter { color: var(--leise); margin: 0 0 18px; font-size: 14px; max-width: 64ch; }
.leer { color: var(--leise); font-size: 14px; padding: 18px 0; }

/* ---------------------------------------------------------------- Karten */

.gitter { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin-bottom: 32px; }

.karte {
  background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius);
  box-shadow: var(--schatten); overflow: hidden; display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.karte:hover { transform: translateY(-2px); box-shadow: var(--schatten-hoch); border-color: var(--linie-stark); }

.blick { height: 132px; border-bottom: 1px solid var(--linie); position: relative; overflow: hidden; background: var(--flaeche-2); }
.blick .art {
  position: absolute; top: 12px; left: 12px; z-index: 1;
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; background: var(--flaeche); color: var(--ink-2); border: 1px solid var(--linie);
}
/* Der Anriss beginnt UNTER dem Schild. Ohne das Polster oben legt sich das Schild auf
 * die erste Zeile, und die Ueberschrift des Berichts faengt fuer den Leser mittendrin an. */
.blick .anriss { padding: 44px 18px 16px; font-size: 11.5px; line-height: 1.5; color: var(--ink-2); }
.blick .anriss b { display: block; font-size: 12.5px; color: var(--ink); margin-bottom: 5px; font-weight: 600; }
.blick .verlauf { position: absolute; left: 0; right: 0; bottom: 0; height: 44px; background: linear-gradient(to bottom, transparent, var(--flaeche-2)); }
.blick .zeichnung { position: absolute; inset: 0; display: grid; place-items: center; color: var(--linie-stark); }
.blick .zeichnung svg { width: 44px; height: 44px; stroke-width: 1.2; }
.blick img { width: 100%; height: 100%; object-fit: cover; display: block; }

.karte .koerper { padding: 13px 16px 15px; }
.karte h4 { margin: 0 0 6px; font-size: 14.5px; font-weight: 600; line-height: 1.35; letter-spacing: -.005em; word-break: break-word; }
.wer-zeile { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--leise); flex-wrap: wrap; }
.wer { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; font-weight: 600; color: #fff; }
.wer.z { background: var(--wer-z); }
.wer.b { background: var(--wer-b); }
.wer.m { background: var(--wer-m); }
.neu { color: var(--akzent); font-weight: 600; }

/* ---------------------------------------------------------------- Tafeln */

.reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px; }
.tafel { background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); padding: 20px 22px; min-width: 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
td, th { padding: 11px 4px; border-top: 1px solid var(--linie); vertical-align: middle; text-align: left; }
thead th { border-top: 0; font-size: 12.5px; color: var(--leise); font-weight: 600; }
td.zeit { color: var(--leise); white-space: nowrap; font-size: 12.5px; text-align: right; }
tr:first-child td { border-top: 0; }

.schild { font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--grund); color: var(--ink-2); font-weight: 500; margin-left: 6px; border: 1px solid var(--linie); white-space: nowrap; }
.klein { color: var(--leise); font-size: 12.5px; }

/* ---------------------------------------------------------------- Ablegen */

.ablage { border: 1px dashed var(--linie-stark); border-radius: var(--radius); padding: 22px 20px; text-align: center; color: var(--ink-2); background: var(--flaeche-2); }
.ablage svg.gross { width: 26px; height: 26px; color: var(--leise); margin-bottom: 6px; }
.ablage strong { display: block; color: var(--ink); margin-bottom: 4px; font-weight: 600; }
.ablage.bereit { border-color: var(--akzent); background: var(--akzent-wasch); }
.ablage input[type="file"] { display: block; margin: 14px auto 0; max-width: 100%; font: inherit; font-size: 12.5px; color: var(--ink-2); }
/* Der eingebaute Knopf im Dateifeld traegt sonst die Farben des Betriebssystems und
 * leuchtet im dunklen Thema wie ein Fremdkoerper. */
.ablage input[type="file"]::file-selector-button {
  font: inherit; font-size: 12.5px; margin-right: 10px; cursor: pointer;
  background: var(--flaeche); color: var(--ink-2);
  border: 1px solid var(--linie); border-radius: var(--radius-klein); padding: 6px 12px;
}
.ablage input[type="file"]::file-selector-button:hover { background: var(--flaeche-2); border-color: var(--linie-stark); }
.ablage .wahl { display: flex; gap: 8px; margin-top: 14px; justify-content: center; flex-wrap: wrap; }
.ablage .wahl label { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--linie); background: var(--flaeche); font-size: 12.5px; cursor: pointer; }
.ablage .wahl input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.ablage .wahl input[type="radio"]:checked + span { color: var(--auf-akzent); }
.ablage .wahl label:has(input:checked) { background: var(--ink); color: var(--grund); border-color: var(--ink); font-weight: 500; }
.ablage .wahl label:has(input:focus-visible) { outline: 2px solid var(--akzent); outline-offset: 2px; }
.ablage textarea, .grund textarea {
  width: 100%; margin-top: 14px; border: 1px solid var(--linie); border-radius: var(--radius-klein);
  padding: 10px 12px; font: inherit; font-size: 13px; resize: vertical; min-height: 64px;
  color: var(--ink); background: var(--flaeche);
}
.ablage .abschicken { margin-top: 14px; display: flex; justify-content: center; }

/* ---------------------------------------------------------------- Einzelne Datei */

.blatt { margin-top: 4px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); overflow: hidden; }
.blatt .balken { display: flex; align-items: center; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--linie); font-size: 13px; color: var(--leise); flex-wrap: wrap; }
.blatt .balken b { color: var(--ink); font-size: 14.5px; font-weight: 600; word-break: break-all; }
.blatt .balken .taten { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tat { padding: 6px 11px; border: 1px solid var(--linie); border-radius: var(--radius-klein); font-size: 12.5px; background: var(--flaeche); color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-family: inherit; }
.tat:hover { border-color: var(--linie-stark); background: var(--flaeche-2); }
.tat svg { width: 15px; height: 15px; }
.tat.stark { background: var(--akzent); border-color: var(--akzent); color: var(--auf-akzent); font-weight: 600; }

.rahmen { width: 100%; height: calc(100vh - 220px); min-height: 380px; border: 0; background: var(--flaeche); display: block; }
.bildflaeche { padding: 24px; text-align: center; background: var(--flaeche-2); }
.bildflaeche img { max-width: 100%; height: auto; border-radius: var(--radius-klein); border: 1px solid var(--linie); }

.gelesen { padding: 26px 32px; max-width: 78ch; }
.gelesen h1, .gelesen h2, .gelesen h3 { letter-spacing: -.01em; }
.gelesen h1 { font-size: 24px; margin: 0 0 12px; }
.gelesen h2 { font-size: 19px; margin: 26px 0 8px; }
.gelesen h3 { font-size: 16px; margin: 20px 0 6px; }
.gelesen img { max-width: 100%; height: auto; }
.gelesen pre { overflow-x: auto; background: var(--flaeche-2); border: 1px solid var(--linie); padding: 12px 14px; border-radius: var(--radius-klein); font-size: 13px; }
.gelesen code { font-size: 13px; }
.gelesen blockquote { border-left: 3px solid var(--linie-stark); margin: 12px 0; padding: 2px 14px; color: var(--leise); }
.gelesen table { width: auto; min-width: 50%; }
.gelesen a { color: var(--akzent); text-decoration: underline; text-underline-offset: 2px; }
.gelesen hr { border: 0; border-top: 1px solid var(--linie); margin: 24px 0; }
.rollbar { overflow-x: auto; }

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

.meldung { border: 1px solid var(--linie); border-left: 3px solid var(--akzent); background: var(--flaeche); border-radius: var(--radius-klein); padding: 12px 16px; margin-bottom: 20px; font-size: 14px; }
.meldung.warnung { border-left-color: var(--warn); background: var(--warn-wasch); }

/* ---------------------------------------------------------------- Anmeldung */

.tor { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--grund); }
.tor .kasten { width: 100%; max-width: 420px; background: var(--flaeche); border: 1px solid var(--linie); border-radius: var(--radius); box-shadow: var(--schatten); padding: 32px 30px; }
.tor .marke { margin-bottom: 22px; }
.tor .marke h1 { color: var(--ink); }
.tor .marke small { color: var(--leise); }
.tor p { color: var(--leise); font-size: 14px; }
.tor .knopf { width: 100%; justify-content: center; margin-top: 8px; }
.tor .fussnote { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--linie); font-size: 12.5px; color: var(--leise); }

.fuss { margin-top: 28px; color: var(--leise); font-size: 12.5px; border-top: 1px solid var(--linie); padding-top: 14px; }

/* ---------------------------------------------------------------- Schmal */

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  aside { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 14px; padding: 14px 18px; border-right: 0; border-bottom: 1px solid var(--leiste-linie); }
  nav { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  nav h6 { display: none; }
  nav > div { display: flex; gap: 6px; flex-wrap: wrap; }
  .ich { margin: 0 0 0 auto; padding: 0; border: 0; flex-direction: row; align-items: center; }
  main { padding: 20px 18px 40px; }
  .blatt .balken .taten { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .karte { transition: none; }
  .karte:hover { transform: none; }
}
