/* ============================================================================
   FullFilm OS · Gestaltung

   Übernimmt die Bildsprache des Prototyps (Prototyp/equipment-app.html):
   dunkler Grund, Gold als einziger Akzent, 12er-Radien, Helvetica Neue mit
   Museo Sans für Überschriften.

   Farben sind Variablen. Wer sie ändern will, ändert sie hier — einmal.
   Die Hellfassung schaltet sich nach der Systemeinstellung dazu, damit die
   Liste auch bei Sonne im Studio lesbar bleibt.
   ============================================================================ */

:root {
  --bg:        #0f1216;
  --panel:     #161b22;
  --panel-hi:  #1c222b;
  --border:    #262d38;
  --text:      #e6edf3;
  --muted:     #8b96a5;
  --still:     #667081;
  /* Die beiden Markenwerte. Angegeben sind sie in CMYK; hier stehen sie in
     sRGB, gewandelt über das Profil FOGRA39L (gestrichenes Papier, Europa).
       Akzent  CMYK 0 | 35 | 85 | 0
       Blau    CMYK 100 | 0 | 15 | 0
     Das Blau trägt die Marke nach außen — Zeichen, Symbol, Druck. In der
     Oberfläche führt der Akzent: Ein zweiter starker Farbton neben den
     Zustandsfarben für Bestand und Lieferstatus wäre eine Farbe zu viel. */
  --accent:    #FAB33D;
  --accent-soft:#FAB33D22;
  --marke-blau:#009FCD;
  --gut:       #22c55e;
  --warnung:   #FAB33D;
  --schlecht:  #ef4444;
  --gut-bg:      #22c55e1a;
  --warnung-bg:  #FAB33D1a;
  --schlecht-bg: #ef44441a;
  --radius:    12px;
  --radius-s:  8px;
  --kopfhoehe: 56px;
  --font-body:    'Helvetica Neue', HelveticaNeue, Helvetica, Arial, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Museo Sans', 'Museo Sans W01', MuseoSans, Museo, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --schatten:  0 1px 2px rgba(0,0,0,.30), 0 8px 24px rgba(0,0,0,.22);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:       #f7f8fa;
    --panel:    #ffffff;
    --panel-hi: #f1f3f7;
    --border:   #e4e7ec;
    --text:     #111827;
    --muted:    #6b7280;
    --still:    #9aa1ad;
    --schatten: 0 1px 2px rgba(0,0,0,.05), 0 8px 24px rgba(0,0,0,.05);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font: 14px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.01em; }

.mono  { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .92em; }
.leise { color: var(--muted); }
.still { color: var(--still); }
.rechts { text-align: right; }

/* --- Formularelemente ---------------------------------------------------- */

label { display: block; font-size: 12.5px; font-weight: 500; margin: 14px 0 5px; color: var(--muted); }

input[type=text], input[type=email], input[type=password], input[type=search],
select, textarea {
  width: 100%; padding: 9px 11px; font: inherit;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-s);
  outline: none; transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; }
::placeholder { color: var(--still); }

button {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: 13px; cursor: pointer;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-s);
  padding: 8px 12px; transition: background .15s, border-color .15s;
}
button:hover { background: var(--panel-hi); }
/* Ohne diese Zeile bliebe ein Knopf mit hidden sichtbar: Die eigene
   display-Regel oben ist spezifischer als die eingebaute für [hidden]. */
button[hidden] { display: none; }
button:disabled { opacity: .5; cursor: default; }
button.haupt, button.haupt-klein, button.betont {
  background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600;
}
button.haupt:hover, button.haupt-klein:hover, button.betont:hover { background: #FBC163; }
button.haupt { width: 100%; padding: 11px; margin-top: 20px; justify-content: center; }

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

#anmeldung { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.karte {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 32px; width: 100%; max-width: 400px;
}
.karte h1 { margin: 0 0 4px; font-size: 21px; }
.karte p.unter { margin: 0 0 22px; color: var(--muted); font-size: 13px; }

.meldung {
  margin-top: 16px; padding: 10px 12px; border-radius: var(--radius-s); font-size: 13px;
  background: var(--schlecht-bg); color: var(--schlecht);
  border: 1px solid rgba(239,68,68,.28);
}

/* --- Rahmen -------------------------------------------------------------- */

#rahmen { display: none; min-height: 100dvh; flex-direction: column; }
#rahmen.an { display: flex; }

header.kopf {
  display: flex; align-items: center; gap: 14px;
  height: var(--kopfhoehe); padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.marke {
  font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; font-size: 15px;
  display: flex; align-items: center; gap: 9px;
}
/* Das Zeichen aus dem Prototyp. currentColor, damit es die Schriftfarbe der
   Kopfzeile erbt und bei einem Themenwechsel nichts nachgezogen werden muss. */
.logo { width: 20px; height: 21px; display: block; flex: none; color: var(--text); }
.logo svg { width: 100%; height: 100%; display: block; }
.umgebung {
  font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(250,179,61,.35);
}
.umgebung.prod {
  background: var(--gut-bg); color: var(--gut); border-color: rgba(34,197,94,.35);
}
.kopf .schub { margin-left: auto; display: flex; align-items: center; gap: 12px; }

main { padding: 20px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* --- Suchleiste ---------------------------------------------------------- */

.suchzeile { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.suchzeile input[type=search] {
  flex: 1; min-width: 240px; padding: 10px 14px;
  background: var(--panel); border-radius: 999px;
}
.schalter {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--muted); margin: 0; white-space: nowrap;
}
.schalter input { width: auto; }
.feldgruppe .schalter { margin-top: 10px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  display: inline-flex; gap: 7px; align-items: center;
  border: 1px solid var(--border); background: var(--panel-hi); color: var(--text);
  padding: 5px 12px; border-radius: 999px; font-size: 13px; cursor: pointer;
}
.chip:hover { border-color: var(--still); }
.chip .zahl { color: var(--still); font-size: 11.5px; }
.chip[aria-pressed=true] {
  background: var(--accent); color: #111; border-color: var(--accent); font-weight: 600;
}
.chip[aria-pressed=true] .zahl { color: rgba(0,0,0,.55); }

/* --- Tabelle ------------------------------------------------------------- */

.tabellenrahmen {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--schatten);
}
/* Bewusst OHNE overflow: hidden am Rahmen — das machte ihn zum Bezugsrahmen
   für den klebenden Tabellenkopf, der dann die erste Zeile verdeckte.
   Die Ecken werden stattdessen an den Zellen gerundet. */
.tabellenrahmen table { border-radius: var(--radius) var(--radius) 0 0; overflow: clip; }
table { width: 100%; border-collapse: collapse; }

thead th {
  position: sticky; top: var(--kopfhoehe); z-index: 20;
  background: var(--panel-hi); color: var(--muted);
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 12px; box-shadow: 0 1px 0 var(--border);
}
thead th:first-child { border-top-left-radius:  var(--radius); }
thead th:last-child  { border-top-right-radius: var(--radius); }

tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--panel-hi); }
tbody tr.gewaehlt td { background: var(--accent-soft); }
tbody tr.archiviert td { color: var(--still); }

.artikelname  { font-weight: 500; }
.artikelunter { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* Zustand: Farbe nie allein — immer mit Form und Wort. */
.zustand { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; white-space: nowrap; }
.zustand .punkt { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.zustand.gut      { color: var(--gut); }
.zustand.warnung  { color: var(--warnung); }
.zustand.schlecht { color: var(--schlecht); }
.zustand.gut .punkt      { background: var(--gut); }
.zustand.warnung .punkt  { background: var(--warnung); border-radius: 1px; transform: rotate(45deg); }
.zustand.schlecht .punkt { background: var(--schlecht); border-radius: 0;
                           clip-path: polygon(50% 0, 100% 100%, 0 100%); }

.fussnote {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 12px; font-size: 12.5px; color: var(--muted);
  border-top: 1px solid var(--border); background: var(--panel-hi);
  border-radius: 0 0 var(--radius) var(--radius);
}
.fussnote button { padding: 5px 11px; font-size: 12.5px; }
.leerzustand { padding: 48px 20px; text-align: center; color: var(--muted); }

/* --- Seitenpanel --------------------------------------------------------- */

#schleier {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 40; animation: einblenden .12s ease-out;
}
@keyframes einblenden { from { opacity: 0 } to { opacity: 1 } }

#panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100vw);
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0,0,0,.35);
  z-index: 50; display: flex; flex-direction: column;
  animation: hereinschieben .16s ease-out;
}
@keyframes hereinschieben { from { transform: translateX(28px); opacity: .4 } to { transform: none; opacity: 1 } }
#panel[hidden], #schleier[hidden] { display: none; }

.panelkopf {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.panelkopf h2 { margin: 0; font-size: 17px; }
.panelkopf button { margin-left: auto; }

.panelkoerper { overflow-y: auto; padding: 0 20px 20px; flex: 1; }
/* Kein Innenabstand oben am scrollenden Bereich: Ein klebender Tabellenkopf
   hielte sonst genau diesen Abstand zur Titelleiste, und die Zeilen schienen
   beim Scrollen durch den Spalt (Vorlage anwenden, 01.10.2026). Der Abstand
   sitzt deshalb am ersten Element. */
.panelkoerper > :first-child { margin-top: 4px; }

.feldgruppe { padding: 16px 0; border-bottom: 1px solid var(--border); }
.feldgruppe:last-child { border-bottom: 0; }
.feldgruppe h3 {
  margin: 0 0 2px; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--still);
}
.feldgruppe input[type=text] + input[type=text] { margin-top: 6px; }

.zweispaltig { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.dreispaltig { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.pflicht {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent); margin-left: 6px;
}
.notiz { margin: 8px 0 0; font-size: 12.5px; color: var(--muted); }

.hinweis {
  margin: 14px 0 0; padding: 10px 12px; border-radius: var(--radius-s); font-size: 13px;
  background: var(--gut-bg); color: var(--gut); border: 1px solid rgba(34,197,94,.28);
}
.hinweis.warn {
  background: var(--warnung-bg); color: var(--warnung); border-color: rgba(250,179,61,.32);
}
.hinweis ul { margin: 6px 0 0; padding-left: 18px; }
.hinweis li { margin: 2px 0; }

.kacheln { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 8px; margin-top: 10px; }
.kachel { border: 1px solid var(--border); border-radius: var(--radius-s); padding: 10px 12px; background: var(--panel-hi); }
.kachel .wert { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -.01em; }
.kachel .bez  { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.panelfuss {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-top: 1px solid var(--border); background: var(--panel-hi);
}
.panelfuss .still { margin-right: auto; font-size: 12.5px; }

@media (max-width: 820px) {
  .verbergen-klein { display: none; }
  main { padding: 12px; }
  thead th { position: static; }
  .zweispaltig, .dreispaltig { grid-template-columns: 1fr; }
}

/* Auf dem Handy — und dort wird die Zählliste abgearbeitet — passte die
   Kopfzeile mit vier Bereichen nicht mehr in die Breite und schob die ganze
   Seite quer. Sie darf jetzt seitlich scrollen; die Seite selbst nicht. */
@media (max-width: 560px) {
  header.kopf { padding: 0 12px; gap: 10px; }
  .marke { font-size: 14px; }
  .umgebung { display: none; }
  .navi { overflow-x: auto; scrollbar-width: none; }
  .navi::-webkit-scrollbar { display: none; }
  .kopf .schub .leise { display: none; }
  body { overflow-x: hidden; }
  /* Die Tabelle darf in ihrem eigenen Rahmen seitlich rutschen, statt
     abgeschnitten zu werden. Der klebende Kopf ist hier ohnehin abgeschaltet
     (siehe 820px-Regel), sonst würde er wieder die erste Zeile verdecken. */
  .tabellenrahmen { overflow-x: auto; }
  .tabellenrahmen table { min-width: 560px; }
}

/* --- Sortierbare Spalten -------------------------------------------------- */
thead th[data-sort] { cursor: pointer; user-select: none; }
thead th[data-sort]:hover { color: var(--text); }
thead th[data-sort]::after { content: ''; }
thead th[data-sort][aria-sort=asc]::after  { content: ' ▲'; color: var(--accent); }
thead th[data-sort][aria-sort=desc]::after { content: ' ▼'; color: var(--accent); }

/* --- Kleine Tabellen im Panel -------------------------------------------- */
.minitabelle { width: 100%; margin-top: 10px; }
.minitabelle td {
  padding: 7px 8px; border-bottom: 1px solid var(--border); font-size: 13px;
  vertical-align: middle;
}
.minitabelle tr:last-child td { border-bottom: 0; }
.minitabelle td.weg { width: 34px; text-align: right; }
.minitabelle button.weg {
  padding: 3px 8px; font-size: 12px; color: var(--muted);
}
.minitabelle button.weg:hover { color: var(--schlecht); border-color: var(--schlecht); }
.minitabelle .leerhinweis { color: var(--still); font-size: 12.5px; padding: 8px 0; }

.minizeile { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.minizeile select, .minizeile input { flex: 1; min-width: 88px; padding: 7px 9px; font-size: 13px; }
.minizeile button { white-space: nowrap; }

.trefferliste {
  margin-top: 6px; border: 1px solid var(--border); border-radius: var(--radius-s);
  background: var(--bg); max-height: 220px; overflow-y: auto;
}
.trefferliste div {
  padding: 7px 10px; font-size: 13px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.trefferliste div:last-child { border-bottom: 0; }
.trefferliste div:hover { background: var(--panel-hi); }
.trefferliste .zt { color: var(--muted); font-size: 12px; }

/* --- Bilder --------------------------------------------------------------- */
.bildzelle { width: 52px; padding-right: 0 !important; }
.bildchen {
  width: 34px; height: 34px; border-radius: 6px; object-fit: cover;
  background: var(--panel-hi); border: 1px solid var(--border); display: block;
}
.bildchen.leer {
  display: grid; place-items: center; color: var(--still); font-size: 15px;
}
#bildvorschau { margin-top: 10px; }
#bildvorschau img {
  max-width: 100%; max-height: 220px; border-radius: var(--radius-s);
  border: 1px solid var(--border); background: var(--panel-hi);
}
.minitabelle td a { color: var(--accent); text-decoration: none; }
.minitabelle td a:hover { text-decoration: underline; }
.dateiart {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--still); font-weight: 600;
}

/* --- Ansichtswechsel ------------------------------------------------------ */
.navi { display: flex; gap: 4px; }
.navi button {
  background: transparent; border-color: transparent; color: var(--muted);
  padding: 6px 12px; border-radius: 999px;
}
.navi button:hover { background: var(--panel-hi); color: var(--text); }
.navi button[aria-pressed=true] {
  background: var(--panel-hi); color: var(--text);
  border-color: var(--border); font-weight: 600;
}
#bundlePanel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0,0,0,.35);
  z-index: 50; display: flex; flex-direction: column;
  animation: hereinschieben .16s ease-out;
}
#bundlePanel[hidden] { display: none; }

/* --- Import --------------------------------------------------------------- */
.importkarte {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--schatten);
  padding: 24px; max-width: 900px;
}
.importkarte h2 { margin: 0 0 4px; font-size: 18px; }
.importkarte h3 { margin: 0 0 2px; font-size: 11px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: var(--still); }
#iVorschau { font-size: 12.5px; }
#iVorschau th { position: static; white-space: nowrap; }
#iVorschau td { white-space: nowrap; max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; }
#iZuordnungListe td { vertical-align: middle; }
#iZuordnungListe select { max-width: 320px; }
.hinweis b { display: block; margin-bottom: 4px; }

/* --- Bundle-Zugehörigkeit ------------------------------------------------- */
.bundlemarke {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 7px; padding: 1px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600; vertical-align: 1px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(250,179,61,.3);
  cursor: pointer;
}
.bundlemarke:hover { background: var(--accent); color: #111; }
.bundlemarke .stapel { font-size: 10px; line-height: 1; }
.minitabelle td button.sprung {
  padding: 3px 9px; font-size: 12px;
}

/* ============================================================================
   LAGER · Phase 4
   ============================================================================ */

#lagerPanel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(600px, 100vw);
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0,0,0,.35);
  z-index: 50; display: flex; flex-direction: column;
  animation: hereinschieben .16s ease-out;
}
#lagerPanel[hidden] { display: none; }

/* Die Art einer Bewegung als Marke, nicht als Wort in der Zeile: Beim
   Überfliegen eines Journals sucht das Auge nach Form und Farbe, nicht nach
   Text. Eingänge grün, Abgänge rot, alles Nachträgliche gold. */
.art {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border); color: var(--muted); background: var(--panel-hi);
}
.art-ein     { color: var(--gut);      background: var(--gut-bg);      border-color: rgba(34,197,94,.3); }
.art-retoure { color: var(--gut);      background: var(--gut-bg);      border-color: rgba(34,197,94,.3); }
.art-aus     { color: var(--schlecht); background: var(--schlecht-bg); border-color: rgba(239,68,68,.3); }
.art-defekt  { color: var(--schlecht); background: var(--schlecht-bg); border-color: rgba(239,68,68,.3); }
.art-eigennutzung { color: var(--schlecht); background: var(--schlecht-bg);
                    border-color: rgba(239,68,68,.3); }
.art-korrektur, .art-inventur {
  color: var(--accent); background: var(--accent-soft); border-color: rgba(250,179,61,.3);
}

.plus  { color: var(--gut); }
.minus { color: var(--schlecht); }

/* Eine korrigierte Zeile bleibt stehen — sie wird durchgestrichen, nicht
   entfernt. Das ist der sichtbare Teil von Prinzip 5. */
tr.storniert td { opacity: .55; }
tr.storniert .artikelname { text-decoration: line-through; }

.kachel.warn { border-color: rgba(250,179,61,.4); background: var(--warnung-bg); }
.kachel.warn .wert { color: var(--accent); }

/* Roter Rahmen an einem Feld, das die Buchung aufhält (Kriterium 2). */
input.fehler, select.fehler, textarea.fehler {
  border-color: var(--schlecht);
  background: var(--schlecht-bg);
}
.notiz.warnend { color: var(--accent); }

.gewaehltkarte {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-s);
  background: var(--panel-hi); border: 1px solid var(--border);
}
.gewaehltkarte > div { flex: 1; min-width: 0; }
.gewaehltkarte button { padding: 5px 10px; font-size: 12px; }

.snliste {
  margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-s);
  max-height: 220px; overflow-y: auto;
}
.snzeile {
  display: flex; align-items: center; gap: 9px; margin: 0;
  padding: 8px 11px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 400; color: var(--text); cursor: pointer;
}
.snzeile:last-child { border-bottom: 0; }
.snzeile:hover { background: var(--panel-hi); }
.snzeile input { width: auto; flex: none; }
.snzeile .still { margin-left: auto; font-size: 12px; }

/* Das Zählfeld ist bewusst schmal und steht allein in seiner Spalte: Daneben
   darf nichts stehen, was nach Sollwert aussieht. */
input.zaehlfeld {
  max-width: 96px; text-align: right; display: inline-block;
  padding: 6px 9px; font-size: 13px;
}

/* Unten LINKS, nicht rechts: Rechts steht bei offenem Panel der Buchen-Knopf,
   und eine Rückmeldung, die den Knopf verdeckt, den sie kommentiert, ist eine
   schlechte Rückmeldung. */
.meldebox {
  position: fixed; left: 20px; bottom: 20px; z-index: 60;
  max-width: min(420px, calc(100vw - 40px));
  padding: 11px 15px; border-radius: var(--radius-s);
  background: var(--panel); border: 1px solid var(--gut);
  color: var(--text); font-size: 13px; box-shadow: var(--schatten);
  animation: einblenden .12s ease-out;
}
.meldebox.schlecht { border-color: var(--schlecht); }
.meldebox[hidden] { display: none; }

#lagerReiter { margin-top: 16px; }
#teilFremdware .hinweis { margin-bottom: 14px; }

/* ============================================================================
   PROJEKTE · Phase 5
   ============================================================================ */

#prPanel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw);
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0,0,0,.35);
  z-index: 50; display: flex; flex-direction: column;
  animation: hereinschieben .16s ease-out;
}
#prPanel[hidden] { display: none; }

.projektkopf {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px;
}
.projekttitel { flex: 1; min-width: 220px; }
.projekttitel h2 { margin: 0; font-size: 20px; }
.projekttitel .still { font-size: 12.5px; margin-top: 2px; }

/* Trennt die Bearbeiten-Knöpfe von den Export-Knöpfen: Was die Planung
   verändert, gehört nicht neben das, was sie nur herausschreibt. */
.schub-rechts { margin-left: auto; }

/* Der Status eines Projekts als Marke — dieselbe Form wie die Bewegungsart
   im Lager, damit beides gleich gelesen wird. */
.art-status-anfrage_lead        { color: var(--muted); }
.art-status-angebot_raus        { color: var(--accent); background: var(--accent-soft);
                                  border-color: rgba(250,179,61,.3); }
.art-status-material_beschaffen { color: var(--accent); background: var(--accent-soft);
                                  border-color: rgba(250,179,61,.3); }
.art-status-aufbau_terminieren  { color: var(--accent); background: var(--accent-soft);
                                  border-color: rgba(250,179,61,.3); }
.art-status-aufbau_terminiert   { color: var(--gut); background: var(--gut-bg);
                                  border-color: rgba(34,197,94,.3); }
.art-status-im_betrieb_support  { color: var(--gut); background: var(--gut-bg);
                                  border-color: rgba(34,197,94,.3); }
.art-status-archiviert_verloren { color: var(--still); }

.marke-nachtrag {
  display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; vertical-align: 1px;
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid rgba(250,179,61,.3);
}

.aufzaehlung { margin: 10px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.aufzaehlung li { margin: 6px 0; }
.aufzaehlung b { color: var(--text); }

/* Die Herkunft der Kalkulation steht klein unter dem Betrag. Sie ist der
   Grund, warum dort diese Zahl steht — ohne sie ist jeder Preis eine
   Behauptung. */
#pdZeilen .artikelunter { font-size: 11.5px; }

/* ============================================================================
   BESCHAFFUNG · Phase 6
   ============================================================================ */

#bsPanel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw);
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0,0,0,.35);
  z-index: 50; display: flex; flex-direction: column;
  animation: hereinschieben .16s ease-out;
}
#bsPanel[hidden] { display: none; }

/* Eine Gruppe je Händler. Sie ist die Einheit, in der bestellt wird —
   deshalb steht der Knopf im Gruppenkopf und nicht über der ganzen Liste. */
.haendlergruppe {
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel); margin-bottom: 14px; overflow: clip;
}
.gruppenkopf {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--panel-hi);
  border-bottom: 1px solid var(--border);
}
.gruppenkopf > div:first-child { flex: 1; min-width: 180px; }
.gruppenname { font-weight: 600; font-size: 14.5px; }
.haendlergruppe .minitabelle { margin: 0; }
.haendlergruppe .minitabelle td { padding: 10px 16px; }
.haendlergruppe .minitabelle input[type=checkbox] { width: auto; }

/* Die Herkunft einer Sammelzeile: aus welchem Projekt wie viel kommt.
   Ohne sie wäre die addierte Menge eine Zahl ohne Begründung. */
.herkunft { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.herkunft span {
  font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); color: var(--muted);
}

tr.gepackt td { opacity: .5; }

/* ============================================================================
   ARTIKELLISTE → PROJEKT
   ============================================================================ */

.zielzeile{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  margin:0 0 14px; padding:10px 14px;
  background:var(--panel); border:1px solid var(--border); border-radius:var(--radius);
}
.zielzeile label{margin:0; white-space:nowrap}
.zielzeile select{max-width:340px; width:auto}
.zielzeile .still, .zielzeile .warnend{font-size:12.5px}
.warnend{color:var(--accent)}
.korbstand{
  font-size:12.5px; padding:3px 10px; border-radius:999px;
  background:var(--gut-bg); color:var(--gut); border:1px solid rgba(34,197,94,.3);
}

/* Die Übernahmespalte gibt es nur, wenn ein Zielprojekt gewählt ist. Eine
   Spalte, die immer da ist und meistens nichts tut, kostet Breite und
   Aufmerksamkeit. */
.zielspalte{display:none}
body.mitZiel .zielspalte{display:table-cell}

.uebernahme{display:flex; gap:6px; align-items:center}
.uebernahme input{
  width:56px; padding:5px 7px; font-size:13px; text-align:right;
}
.uebernahme button{
  padding:5px 11px; font-size:15px; line-height:1; font-weight:600;
  background:var(--accent-soft); color:var(--accent); border-color:rgba(250,179,61,.35);
}
.uebernahme button:hover{background:var(--accent); color:#111}

/* Lieferstatus direkt in der Zeile. Die Auswahl ist bewusst ruhig — sie steht
   in jeder Zeile und soll die Tabelle nicht in ein Formular verwandeln. */
.statuswahl{
  width:100%; padding:5px 8px; font-size:12.5px;
  background:transparent; border-color:transparent;
}
tr:hover .statuswahl, .statuswahl:focus{ background:var(--bg); border-color:var(--border) }
.zustandzelle .stufen{ display:flex; flex-wrap:wrap; gap:5px; margin-top:4px }
.zustandzelle .zustand b{ font-weight:700; margin-left:3px }

/* Ankreuzfeld je Zeile und die Sammelzeile darüber. */
.wahlzelle{ text-align:center }
.wahlzelle input{ width:auto; cursor:pointer }
.sammelzeile{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  margin:0 0 12px; padding:9px 14px;
  background:var(--accent-soft); border:1px solid rgba(250,179,61,.35);
  border-radius:var(--radius);
}
/* Ohne diese Zeile bliebe die Sammelzeile mit hidden sichtbar: Die eigene
   display-Regel oben ist spezifischer als die eingebaute für [hidden].
   Derselbe Fall wie bei button[hidden] weiter oben. */
.sammelzeile[hidden]{ display:none }
.sammelzeile #pdSammelZahl{ font-weight:600; white-space:nowrap }

/* Händlerlinks in der Zeile. Klein und ruhig, bis man sie braucht — sie
   stehen in jeder der 1.141 Zeilen und dürfen die Liste nicht dominieren. */
.linkzelle{ line-height:1.9 }
.shoplink{
  display:inline-block; margin-right:8px; font-size:12px;
  color:var(--still); text-decoration:none; border-bottom:1px solid transparent;
}
.shoplink:hover{ color:var(--accent); border-bottom-color:var(--accent) }
.shoplink:focus-visible{ outline:2px solid var(--accent); outline-offset:2px }

/* Was im Zielprojekt schon steht: dauerhafte Marke mit der geplanten Menge. */
.drin{
  font-size:11.5px; white-space:nowrap; padding:2px 8px; border-radius:999px;
  background:var(--accent-soft); color:var(--accent);
  border:1px solid rgba(250,179,61,.35);
}

/* Dauerhafte Hervorhebung der Zeilen, die zum Projekt gehören. Bewusst ein
   Streifen am linken Rand statt einer Flächenfarbe: Die Tabelle hat schon
   Zustandsfarben für Verfügbarkeit, und zwei Farbsysteme übereinander liest
   niemand mehr auseinander. */
tr.imProjekt td{background:rgba(250,179,61,.055)}
tr.imProjekt td:first-child{box-shadow:inset 3px 0 0 var(--accent)}
tr.imProjekt .artikelname{font-weight:600}

/* Kurze grüne Quittung in der Zeile — beim Durchgehen von vierzig Artikeln
   sieht man so, was eben passiert ist, ohne dass Meldungen einander
   überholen. Steht nach .imProjekt, damit die Quittung sichtbar bleibt. */
tr.uebernommen td{background:var(--gut-bg); transition:background .2s}

/* ============================================================================
   SCHALTPLAN · Bauplan 5.5

   Gezeichnet wird in SVG. Deshalb steht hier fast nichts über die Adern selbst
   — Farbe und Stärke setzt schaltplan.js je Signaltyp direkt am Element, weil
   dieselbe Angabe im PDF-Export wieder gebraucht wird. Was hier steht, ist der
   Rahmen: drei Bereiche, ihre Größen und die Zustände der Anschlusspunkte.
   ============================================================================ */

.spLayout{
  display:grid; grid-template-columns:250px minmax(0,1fr); gap:14px;
  align-items:start;
}
@media (max-width:900px){ .spLayout{ grid-template-columns:minmax(0,1fr) } }

.spSpalte{
  background:var(--panel); border:1px solid var(--border);
  border-radius:var(--radius); padding:12px;
}
.spSpalte label{ display:block; margin-bottom:6px; font-size:12.5px; color:var(--muted) }
.spSpalte input[type=search]{ width:100% }
.spTrefferliste{ margin:8px 0; max-height:280px; overflow:auto }
.spTrefferliste .still{ padding:8px 2px; font-size:12.5px }

/* Ein Treffer ist ein Knopf, der wie eine Zeile aussieht: eine Fläche zum
   Klicken, zwei Zeilen Text darin. Ohne display:block stellte die
   Grundregel für button die beiden Zeilen nebeneinander — derselbe Fall wie
   bei .variantenkarte. */
button.spTreffer{
  display:block; width:100%; text-align:left; font:inherit;
  margin-bottom:5px; padding:7px 9px; line-height:1.35;
}
button.spTreffer:hover{ border-color:var(--accent) }

/* Die Fläche selbst. Sie scrollt in beide Richtungen: Ein Plan mit zwanzig
   Geräten ist breiter als der Bildschirm, und ihn kleinzurechnen macht die
   Anschlusspunkte untreffbar. */
.spFlaeche{
  background:var(--panel); border:1px solid var(--border);
  border-radius:var(--radius); overflow:auto;
  max-height:calc(100vh - 320px); min-height:420px;
  background-image:
    radial-gradient(circle, var(--border) 1px, transparent 1px);
  background-size:20px 20px;
}
.spFlaeche svg{ display:block }

#spSvg text{ font-family:var(--font-body); fill:var(--text) }
.spRahmen{ fill:var(--panel-hi); stroke:var(--border); stroke-width:1.4 }
.spKasten{ cursor:grab }
.spKasten:hover .spRahmen{ stroke:var(--accent) }
.spName{ font-size:12.5px; font-weight:600 }
.spUnter{ font-size:10.5px; fill:var(--muted) }

/* Gezeichnet, aber nicht in der Komponentenliste: gestrichelter Rahmen. Die
   Strichelung setzt schaltplan.js am Element, hier kommt nur die Tönung dazu,
   damit der Unterschied auch aus zwei Metern Abstand auffällt. */
.spKasten.ohnePosition .spRahmen{ fill:var(--accent-soft); stroke:var(--accent) }

.spPort{ cursor:crosshair }
.spPort:hover circle:first-child{ r:7 }
.spPort.gewaehlt circle:first-child{ stroke:var(--accent); stroke-width:3 }
.spPort.moeglich circle:first-child{ stroke-width:2.6 }
/* Wer verbinden will, soll die unmöglichen Ports gar nicht erst anfassen. */
.spPort:not(.moeglich):not(.gewaehlt) circle:first-child{ transition:r .1s }
.spAder{ cursor:pointer }
.spAder:hover path:first-child{ stroke-width:3.4 }
.spZone text{ font-family:var(--font-display) }

/* --- Das Abgleichsband -------------------------------------------------- */

.spBand{
  margin-top:14px; background:var(--panel);
  border:1px solid var(--border); border-radius:var(--radius); overflow:hidden;
}
.spBandKopf{
  display:flex; align-items:center; gap:12px; width:100%;
  padding:11px 14px; font:inherit; text-align:left;
  background:transparent; border:0; border-radius:0; cursor:pointer;
}
.spBandKopf:hover{ background:var(--panel-hi) }
.spBandName{ font-weight:600 }
.spBandKopf #spBandZahl{ font-size:12.5px }
.spBandPfeil{ margin-left:auto; color:var(--still); transition:transform .15s }
.spBand.offen .spBandPfeil{ transform:rotate(180deg) }

/* Zu, solange nichts abzugleichen ist. bandLaden() setzt .offen, sobald es
   etwas zu tun gibt. */
.spBandKoerper{ display:none; border-top:1px solid var(--border) }
.spBand.offen .spBandKoerper{
  display:grid; grid-template-columns:1fr 1fr; gap:0;
}
@media (max-width:900px){
  .spBand.offen .spBandKoerper{ grid-template-columns:1fr }
}
.spBandSpalte{ padding:12px 14px 14px }
.spBandSpalte + .spBandSpalte{ border-left:1px solid var(--border) }
@media (max-width:900px){
  .spBandSpalte + .spBandSpalte{ border-left:0; border-top:1px solid var(--border) }
}
.spBandSpalte h3{ margin:0 0 2px; font-size:14px }
.spBandSpalte .notiz{ margin:0 0 10px }
.spBandSpalte > div > .still{ font-size:12.5px }

.spBandzeile{
  display:flex; align-items:center; gap:10px;
  padding:7px 0; border-top:1px solid var(--border);
}
.spBandzeile .menge{ font-weight:600; min-width:36px; text-align:right }
.spBandzeile .haupt-teil{ flex:1; min-width:0 }
.spBandzeile .haupt-teil span{ display:block }
.spBandzeile button{ padding:5px 11px; font-size:12.5px; flex:none }

/* Und wieder: Das Panel hat eine eigene display-Regel, also braucht [hidden]
   eine eigene. Ohne diese Zeile stünde es beim Laden offen da. */
#spPanel{
  position:fixed; top:0; right:0; bottom:0; width:min(460px,100%);
  background:var(--panel); border-left:1px solid var(--border);
  box-shadow:-12px 0 40px rgba(0,0,0,.35);
  z-index:50; display:flex; flex-direction:column;
  animation:hereinschieben .16s ease-out;
}
#spPanel[hidden]{ display:none }

/* --- Bedienung mit dem Finger · Kriterium 18 --------------------------- */

/* Ohne diese Zeile gewinnt beim Wischen die Fläche: Der Browser deutet die
   Berührung als Scrollen und liefert gar keine pointermove-Ereignisse mehr.
   Das Kästchen bliebe liegen, und niemand wüsste warum. */
.spKasten, .spPort { touch-action: none; }
/* Die Fläche selbst darf weiter geschoben werden — nur eben nicht, während
   man ein Kästchen am Finger hat. */
.spFlaeche { touch-action: pan-x pan-y; }

/* Auf kleinen Geräten ist die Zeichnung zum Lesen da; gearbeitet wird über
   die Listen. Also mehr Höhe für den Plan und weniger Rand ringsum. */
@media (max-width: 700px) {
  .spFlaeche { max-height: calc(100vh - 260px); min-height: 300px; }
  .spSpalte { padding: 10px; }
  .projektkopf .projekttitel .still { display: none; }
}

/* Eine Zeile in den Listen: volle Breite, großzügig hoch — ein Ziel, das man
   auch im Stehen mit einer Hand trifft. */
button.spListenzeile {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; font: inherit; padding: 9px 11px; margin-bottom: 6px;
  min-height: 44px;
}
button.spListenzeile:hover { border-color: var(--accent); }
button.spListenzeile .punkt {
  width: 10px; height: 10px; border-radius: 50%; flex: none;
}
button.spListenzeile .haupt-teil { flex: 1; min-width: 0 }
button.spListenzeile .haupt-teil span { display: block }


/* ============================================================================
   BETRIEB UND ZEITREISE · Phase 10

   Beide Ansichten kommen mit den vorhandenen Bausteinen aus — Tabellen,
   Kacheln, Chips, Zustandspunkte. Neu ist nur, was es vorher nirgends gab:
   eine Zwischenüberschrift über einer Tabelle, ein Verbrauchsbalken und das
   Schreibschutz-Band der Zeitreise.
   ============================================================================ */

/* Zwischenüberschrift. Die Verträge- und die Nachkalkulationsansicht zeigen je
   zwei Tabellen untereinander; ohne Überschrift läse sich die zweite wie eine
   Fortsetzung der ersten. */
.abschnitt {
  margin: 0; font-size: 15px; font-family: var(--font-display);
  letter-spacing: -.01em;
}

/* Verbrauchsbalken. Farbe nie allein: Rechts daneben steht immer entweder
   „x h frei" oder das Wort „überzogen" mit Zustandszeichen. Der Balken ist
   die schnelle Fassung derselben Aussage, nicht ihr einziger Träger. */
.balken {
  height: 7px; border-radius: 999px; background: var(--panel-hi);
  border: 1px solid var(--border); overflow: hidden;
}
.balken span {
  display: block; height: 100%; background: var(--gut); border-radius: 999px;
}
.balken.warn span { background: var(--schlecht); }

/* „Ursache noch offen" in der Vorgangsliste. Kein Alarm — ein offener Vorgang
   ohne Ursache ist der Normalfall, solange er offen ist. */
.still.offen { font-style: italic; }

/* --- Zeitreise ---------------------------------------------------------- */

/* Das Band, das den Schreibschutz sichtbar macht. Ein alter Stand, der wie die
   Gegenwart aussieht, ist gefährlicher als gar keiner: Wer darin eine Menge
   liest und danach handelt, arbeitet mit Zahlen von vorletzter Woche. */
.zrBanner {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 16px; margin-bottom: 16px;
  border: 1px solid rgba(250,179,61,.35); border-left-width: 3px;
  border-radius: var(--radius); background: var(--accent-soft);
  font-size: 13px; line-height: 1.5;
}
.zrBanner b { color: var(--text); }

.zrVariante {
  display: flex; align-items: baseline; gap: 10px;
  margin: 18px 0 8px; font-size: 15px;
  font-family: var(--font-display); letter-spacing: -.01em;
}
.zrVariante .still { font-family: var(--font); font-size: 12.5px; }

/* Wie bei allen Panels mit eigener display-Regel braucht [hidden] eine
   eigene Zeile — sonst stehen sie beim Laden offen da. */
#btPanel, #zrPanel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%);
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -12px 0 40px rgba(0,0,0,.35);
  z-index: 50; display: flex; flex-direction: column;
  animation: hereinschieben .16s ease-out;
}
#btPanel[hidden], #zrPanel[hidden] { display: none; }

/* Die Vorgangsliste ist anklickbar — das muss man sehen können. */
#voZeilen tr { cursor: pointer; }

/* ============================================================================
   ENTWURF (Lieferstatus 0) · Bauplan 1.4

   Bewusst keine neue Farbe: Neben Gold, Grün und Rot wäre jede vierte eine zu
   viel. Ein Entwurf ist stattdessen GESTRICHELT — Rand, Punkt, Kachel. Das
   liest sich als „noch nicht fest", ohne mit einem Zustand zu konkurrieren.
   ============================================================================ */
.zustand.entwurf { color: var(--muted); font-style: italic; }
.zustand.entwurf .punkt { background: transparent; border: 1.5px dashed var(--muted); width: 9px; height: 9px; }
tr.entwurf td:first-child { box-shadow: inset 3px 0 0 transparent; border-left: 3px dashed var(--muted); }
tr.entwurf .artikelname { font-style: italic; }
.kachel.entwurf { border-style: dashed; background: transparent; }
.kachel.entwurf .wert { color: var(--muted); }
.hinweis.entwurf {
  background: var(--panel-hi); color: var(--text);
  border: 1px dashed var(--muted);
}
.hinweis.entwurf b { display: inline; }

/* Menge direkt in der Zeile. Ruhig wie die Statusauswahl — sie steht in jeder
   Zeile und soll die Tabelle nicht in ein Formular verwandeln. */
input.mengenfeld {
  width: 64px; padding: 4px 7px; font-size: 13px; text-align: right;
  font-variant-numeric: tabular-nums;
  background: transparent; border: 1px solid var(--border);
}
tr:hover input.mengenfeld, input.mengenfeld:focus { background: var(--bg); }
input.mengenfeld:focus { border-color: var(--accent); }
.mengenzelle .artikelunter { margin-top: 2px; }

/* Erklärung für den Kunden, direkt unter dem Artikelnamen. Sieht aus wie Text,
   bis man hineinklickt. */
textarea.erklaerung-feld {
  display: block; width: 100%; margin-top: 4px; padding: 3px 6px;
  font: inherit; font-size: 12.5px; line-height: 1.4; color: var(--muted);
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-s);
  resize: none; overflow: hidden; min-height: 0;
}
.erklaerung-feld::placeholder { color: var(--still); font-style: italic; opacity: 0; }
tr:hover .erklaerung-feld::placeholder, .erklaerung-feld:focus::placeholder { opacity: 1; }
tr:hover textarea.erklaerung-feld, textarea.erklaerung-feld:focus { background: var(--bg); border-color: var(--border); }
.erklaerung-feld:focus { color: var(--text); }
.erklaerung-text { margin-top: 4px; font-size: 12.5px; color: var(--muted); }

/* Vorschau „Früheres Projekt als Vorlage" im Seitenpanel: kompakt, die
   Mengenspalte rechtsbündig mit festen Ziffern. */
.vorschautabelle td, .vorschautabelle th { padding: 6px 8px; }
.vorschautabelle input.mengenfeld { width: 56px; background: var(--bg); }

/* Kategorien in der Projekttabelle — wie in der Artikelliste des Prototyps:
   ein goldgetöntes Band, Name in Versalien, rechts Anzahl und Wert. Ein
   Klick auf das Band klappt die Kategorie auf oder zu. */
tr.kategoriezeile td {
  padding: 9px 14px; cursor: pointer;
  background: rgba(250,179,61,.11); border-top: 1px solid rgba(250,179,61,.18);
}
tr.kategoriezeile:hover td { background: rgba(250,179,61,.16); }
.kategorieknopf {
  all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  letter-spacing: .04em; text-transform: uppercase; color: var(--text);
}
.kategorieknopf:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.kategorieknopf .pfeil {
  width: 0; height: 0; border-left: 5px solid var(--accent);
  border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transition: transform .15s;
}
.kategorieknopf[aria-expanded="true"] .pfeil { transform: rotate(90deg); }
.kategorieinfo {
  float: right; font-size: 12.5px; font-weight: 600; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.projektsuche input[type=search] { flex: 1; min-width: 240px; }

/* Tabellen in Seitenpanels: Der Kopf klebt am oberen Rand des Panels, nicht
   unter der Menüleiste der Seite — sonst schwebt er beim Scrollen mitten in
   der Liste (Vorschau „Vorlage anwenden"). */
#prPanel thead th, #panel thead th, .vorschautabelle thead th { top: 0; }
/* Im Panel ohne runde Ecken am Kopf: Klebt er, schienen die Zeilen sonst
   durch die Ecken. Die Tabelle selbst bleibt rund (overflow: clip). */
#prPanel thead th, #panel thead th { border-radius: 0; }

/* Artikelname als Weg zu den Stammdaten. Sieht aus wie Text; beim Überfahren
   erscheint ein Stift. */
.stammlink {
  all: unset; cursor: pointer; color: inherit; font: inherit;
  border-bottom: 1px dashed transparent;
}
.stammlink:hover { border-bottom-color: var(--muted); }
.stammlink:hover::after { content: ' ✎'; color: var(--accent); font-weight: 400; }
.stammlink:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

/* Bezugsweg in der Zeile: drei ruhige Auswahllisten, die erst beim
   Überfahren als Feld erkennbar werden — wie die Menge. */
.bezugswahl { display: flex; flex-direction: column; gap: 3px; }
.bezugswahl-zeile { display: flex; gap: 3px; }
.bezugswahl-zeile[hidden] { display: none; }
.bezugswahl select {
  width: 100%; min-width: 0; padding: 3px 6px; font-size: 12.5px; color: var(--muted);
  background: transparent; border-color: transparent;
}
tr:hover .bezugswahl select, .bezugswahl select:focus {
  background: var(--bg); border-color: var(--border); color: var(--text);
}

/* ============================================================================
   LIEFERSTATUS ALS PILLE

   Die Farbe sagt, wo im Ablauf eine Position steht — dieselben vier Töne wie
   überall: grau Planung, gold unterwegs, grün angekommen, rot raus; der
   Entwurf gestrichelt. Die Nummer bleibt sichtbar, weil im Team mit
   Nummern gesprochen wird („steht auf 5").
   ============================================================================ */
.statuspille {
  display: inline-flex; align-items: center; gap: 7px; max-width: 100%;
  padding: 4px 10px 4px 9px; border-radius: 999px;
  font-size: 12.5px; line-height: 1.3; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel-hi); color: var(--text);
  transition: border-color .12s, background .12s;
}
.statuspille:hover:not(:disabled) { border-color: var(--muted); }
.statuspille:disabled { cursor: default; opacity: .8; }
.statuspille .punkt, .statusmenue .punkt {
  width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--still);
}
.statuspille .nr, .statusmenue .nr {
  font-variant-numeric: tabular-nums; font-weight: 700; color: var(--muted);
  min-width: 1.1em; text-align: right;
}
.statuspille .wort { overflow: hidden; text-overflow: ellipsis; }
.statuspille .pfeilchen {
  width: 0; height: 0; margin-left: 2px; opacity: .55;
  border-top: 4px solid currentColor; border-left: 4px solid transparent; border-right: 4px solid transparent;
}

.s-gut      { --ton: var(--gut); }
.s-warnung  { --ton: var(--warnung); }
.s-schlecht { --ton: var(--schlecht); }
.statuspille.s-gut      { background: var(--gut-bg);      border-color: rgba(34,197,94,.30);  color: var(--gut); }
.statuspille.s-warnung  { background: var(--warnung-bg);  border-color: rgba(250,179,61,.32); color: var(--warnung); }
.statuspille.s-schlecht { background: var(--schlecht-bg); border-color: rgba(239,68,68,.30);  color: var(--schlecht); }
.statuspille.s-entwurf  { background: transparent; border-style: dashed; border-color: var(--muted); color: var(--muted); font-style: italic; }
.statuspille.s-gemischt { background: transparent; color: var(--muted); }
.s-gut .punkt, .s-warnung .punkt, .s-schlecht .punkt { background: var(--ton); }
.s-warnung .punkt { border-radius: 1px; transform: rotate(45deg); width: 7px; height: 7px; }
.s-schlecht .punkt { border-radius: 1px; }
.s-entwurf .punkt { background: transparent; border: 1.5px dashed var(--muted); }
.s-gemischt .punkt { background: conic-gradient(var(--gut) 0 33%, var(--warnung) 0 66%, var(--still) 0); }
.statuspille.s-gut .nr, .statuspille.s-warnung .nr, .statuspille.s-schlecht .nr { color: inherit; opacity: .75; }

.statusmenue {
  position: absolute; z-index: 80; width: 250px; max-height: min(520px, 80vh); overflow: auto;
  padding: 6px; border-radius: var(--radius-s);
  background: var(--panel); border: 1px solid var(--border); box-shadow: var(--schatten);
  animation: einblenden .1s ease-out;
}
.statusmenue .phase {
  padding: 8px 8px 3px; font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--muted);
}
.statusmenue .phase:first-child { padding-top: 2px; }
.statusmenue button {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer;
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px;
  font-size: 13px; color: var(--text);
}
.statusmenue button:hover, .statusmenue button:focus-visible { background: var(--panel-hi); }
.statusmenue button.aktiv { background: var(--accent-soft); }
.statusmenue button.aktiv::after { content: '✓'; margin-left: auto; color: var(--accent); font-weight: 700; }
.bezugswahl-zeile select:first-child { flex: 1.5; }
.bezugswahl-zeile select:last-child  { flex: 1; }
.uebernahme input::placeholder { color: var(--muted); opacity: .8; }

/* ============================================================================
   VISUALISIERUNGEN · Bauplan 6.16

   Eine Leiste unter dem Projektkopf und eine Seitenansicht rechts. Ist die
   Seitenansicht offen, rückt der Inhalt nach links — die Liste bleibt voll
   bedienbar, statt unter einem Fenster zu verschwinden.
   ============================================================================ */
:root { --visu-breite: 46vw; }

.visuleiste {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 0 0 12px;
}
.visulabel {
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); margin-right: 2px;
}
.visuchip .visuicon { color: var(--accent); margin-right: 6px; }
.visuneu {
  padding: 5px 12px; font-size: 13px; border-style: dashed; background: transparent; color: var(--muted);
}
.visuneu:hover { color: var(--text); border-color: var(--accent); }
.visutipp { font-size: 12.5px; }
.visuformular {
  flex-basis: 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px dashed var(--accent); border-radius: var(--radius-s);
  background: var(--accent-soft);
}
.visuformular[hidden] { display: none; }
.visuformular label { margin: 0; color: var(--text); }
.visuformular input { flex: 1; min-width: 220px; padding: 6px 10px; }

/* Ziehen einer Datei auf das Projekt */
#projektDetail { position: relative; }
#projektDetail.ablegen::after {
  content: 'Loslassen, um die Visualisierung hinzuzufügen';
  position: absolute; inset: -8px; z-index: 30; pointer-events: none;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--accent);
  border: 2px dashed var(--accent); border-radius: var(--radius);
  background: rgba(15,18,22,.78);
}

body.mitVisu main { max-width: none; width: auto; margin-right: var(--visu-breite); }
body.mitVisu .tabellenrahmen { overflow-x: auto; }
#visuPane {
  position: fixed; top: var(--kopfhoehe); right: 0; bottom: 0; width: var(--visu-breite);
  z-index: 40; display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(0,0,0,.25);
}
#visuPane[hidden] { display: none; }
#visuPane:fullscreen { top: 0; width: 100%; }
.visugriff {
  position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 2;
}
.visugriff:hover, body.visuZiehen .visugriff { background: linear-gradient(90deg, transparent 3px, var(--accent) 3px 5px, transparent 5px); }
body.visuZiehen, body.visuZiehen * { cursor: col-resize !important; user-select: none; }
body.visuZiehen .visurahmen iframe { pointer-events: none; }
.visukopf {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.visukopf .visutitel { flex: 1; min-width: 0; }
.visukopf .visutitel b, .visukopf .visutitel div {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.visukopf .visutitel div { font-size: 12px; }
.visukopf button { padding: 5px 10px; font-size: 12.5px; }
#visuZu { font-size: 18px; line-height: 1; padding: 4px 10px; }
#visuWeg.wirklich { background: var(--schlecht-bg); color: var(--schlecht); border-color: rgba(239,68,68,.4); }
.visurahmen { flex: 1; min-height: 0; background: #0f1216; }
.visurahmen iframe { width: 100%; height: 100%; border: 0; display: block; }

@media (max-width: 900px) {
  body.mitVisu main { margin-right: 0; }
  #visuPane { width: 100%; }
  .visugriff { display: none; }
}
