/* ===========================================================================
   Reiter „Besichtigung“ (besichtigung.js, Entwurf 40 A) und die Vor-Ort-Zeit
   im Reiter „Rechnung“ (rechnung.js, Entwurf 40 C). Liegt über stil.css und
   nutzt nur dessen Farben (--ziegel, --gold, --sand, --flaeche, --linie …),
   damit Hell und Dunkel von selbst stimmen. Präfixe: bs- (Besichtigung),
   rgv- (Vor-Ort-Zeit in der Rechnung).
   =========================================================================== */

.bs { display: grid; gap: 18px; }
.bs svg { width: 16px; height: 16px; flex: none; }
.bs h2 { font-size: 18px; letter-spacing: -.01em; margin: 0; }
.bs-unter { font-size: 13px; color: var(--leise); }
.bs-luft { flex: 1; }

/* Sprungleiste */
.bs-sprung { position: sticky; top: var(--hub-hoehe, 58px); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: -18px -24px 0; padding: 10px 24px; background: color-mix(in srgb, var(--grund) 92%, transparent);
  border-bottom: 1px solid var(--linie); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.bs-sprung a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 999px; text-decoration: none;
  color: var(--tinte); font-weight: 700; font-size: 13.5px; background: var(--flaeche); border: 1px solid var(--linie); }
.bs-sprung a:hover { border-color: var(--leise); }
.bs-sprung a i { font-style: normal; color: var(--ziegel); font-weight: 800; }
.bs-sprung a.on { border-color: var(--hinw-rand); background: var(--flaeche); box-shadow: inset 0 0 0 1px var(--hinw-rand); }

/* Band: Übertragungsstand */
.bs-stand { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 10px 14px; border-radius: 12px;
  background: var(--flaeche); border: 1px solid var(--linie); font-size: 13.5px; }
.bs-stand b { font-weight: 700; }
.bs-punkt { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--ok); }
.bs-punkt--gelb { background: var(--gold); }
.bs-punkt--rot { background: var(--ziegel); }
.bs-punkt--leer { background: var(--still); }
.bs-geraet { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: var(--sand); color: color-mix(in srgb, var(--tinte) 80%, var(--sand)); white-space: nowrap; }
.bs .bs-geraet svg { width: 13px; height: 13px; }
.bs-geraet--hub { background: var(--sand); color: var(--rot-dk); }
.bs-geraet--gelb { background: var(--hinw) border-box; color: var(--hinw-tinte); }
.bs-geraet--rot { background: var(--sand); color: var(--rot-dk); }

/* Band: Grundlage fürs Gutachten */
.bs-gutachten { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 12px 14px; border-radius: 12px;
  background: color-mix(in srgb, var(--gold) 10%, var(--flaeche)); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); font-size: 14px; }
.bs .bs-gutachten__ic { color: var(--gold-dk); width: 20px; height: 20px; }
.bs-gutachten > div { flex: 1; min-width: 240px; display: grid; gap: 2px; }
.bs-gutachten > div > span { font-size: 13px; color: color-mix(in srgb, var(--tinte) 75%, var(--flaeche)); }

/* Abschnitte */
.bs-teil { display: grid; gap: 12px; }
.bs-teil__kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; scroll-margin-top: 130px; }
.bs-teil { scroll-margin-top: 120px; }
.bs-teil__kopf h2 { flex: 0 0 auto; }
.bs-teil__kopf .bs-unter { flex: 1; min-width: 200px; }
.bs-karte { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 14px 16px; display: grid; gap: 16px; }

/* Felder mit Memos */
.bs-feld { display: grid; gap: 6px; min-width: 0; }
.bs-feld__kopf { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bs-feld__kopf .lbl { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--leise); }
.bs-feld__her { font-size: 12px; color: var(--leise); display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bs-status { font-size: 12px; color: var(--leise); font-weight: 600; }
.bs-status:empty { display: none; }

/* Textfeld mit Spiegel: das Feld davor ist durchsichtig, die Markierung liegt
   im Spiegel dahinter (dieselbe Schrift, Breite, Zeilenhöhe, Polster). */
.bs-eingabe { position: relative; display: grid; border-radius: var(--rund); background: var(--feld); }
.bs-eingabe > * { grid-area: 1 / 1; }
.bs-text, .bs-spiegel { font: inherit; font-size: 15px; line-height: 1.55; padding: 9px 12px; border: 1px solid var(--linie);
  border-radius: var(--rund); white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; margin: 0; box-sizing: border-box;
  letter-spacing: normal; tab-size: 4; }
.bs-text { position: relative; z-index: 1; background: transparent; color: var(--tinte); min-height: 42px; resize: none; overflow: hidden; width: 100%; }
.bs-text:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 28%, transparent); }
.bs-spiegel { color: transparent; border-color: transparent; pointer-events: none; user-select: none; overflow: hidden; }
.bs-spiegel span.an { background: #D6D3CE; border-radius: 4px; box-shadow: 0 0 0 2px #D6D3CE; }
.bs-text--klein { font-size: 14.5px; }
@media (pointer: coarse) { .bs-spiegel { font-size: 16px !important; } }
/* Anwesende als Personenliste (H4): je Zeile Feld + Spiegel, beide mit den Maßen der Personenliste. */
.bs-pl .pl textarea.pl__eingabe.bs-text, .bs-pl .bs-spiegel { padding: 10px 12px; line-height: 1.4; min-height: 44px; font-size: 15px; }
.bs-pl .pl__zeile > .bs-eingabe { min-width: 0; }

.bs-memos { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.bs-memos[hidden] { display: none; }
.bs-memo { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 12px 0 9px; border-radius: 999px;
  font-size: 13px; font-weight: 600; background: var(--flaeche); border: 1px solid var(--linie); color: var(--tinte);
  font-variant-numeric: tabular-nums; }
.bs .bs-memo svg { width: 14px; height: 14px; }
.bs-memo small { color: var(--leise); font-weight: 600; font-size: 12.5px; }
.bs-memo--laeuft { background: var(--sand); border-color: color-mix(in srgb, var(--ziegel) 55%, transparent);
  color: var(--rot-dk); }
.bs-memo--laeuft small { color: var(--rot-dk); }
.bs-memo__spur { position: relative; width: 70px; height: 4px; border-radius: 4px; background: var(--linie); }
.bs-memo__spur::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--p, 0%); border-radius: 4px; background: var(--ziegel); }
.bs-abhier { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--hinw) border-box; color: var(--hinw-tinte); border: 1px solid transparent; box-shadow: var(--hinw-sch); }
.bs .bs-abhier svg { width: 13px; height: 13px; }
.bs-taste { font: 600 11.5px var(--mono); padding: 1px 5px; border-radius: 4px; background: var(--sand); color: var(--leise); }

/* Konflikt: beide Fassungen zur Wahl */
.bs-konflikt { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; font-size: 13.5px;
  background: var(--sand); border: 1px solid color-mix(in srgb, var(--ziegel) 40%, transparent); }
.bs-konflikt[hidden] { display: none; }
.bs-konflikt__text { margin: 0; white-space: pre-wrap; color: var(--tinte); }
.bs-konflikt__knoepfe { display: flex; flex-wrap: wrap; gap: 8px; }

/* Vor-Ort-Zeit */
.bs-zeit { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.bs-zeit > div { padding: 10px 12px; border-radius: 12px; background: var(--sand); display: grid; gap: 2px; align-content: start; }
.bs-zeit span { font-size: 12.5px; color: color-mix(in srgb, var(--tinte) 70%, var(--sand)); }
.bs-zeit b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.bs-zeit small { font-size: 12px; color: color-mix(in srgb, var(--tinte) 70%, var(--sand)); display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bs .bs-zeit small svg { width: 12px; height: 12px; }
.bs-zeit .gilt { background: var(--hinw) border-box; color: var(--hinw-tinte); }
.bs-zeit .gilt small { color: rgba(255,255,255,.8); }
.bs-korr { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; padding: 10px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--sand) 50%, var(--flaeche)); border: 1px dashed var(--linie); }
.bs-korr[hidden] { display: none; }
.bs-korr .feldgruppe { margin: 0; min-width: 190px; }
.bs-korr label { font-size: 12px; font-weight: 700; color: var(--leise); }

/* Räume */
.bs-raeume { display: grid; gap: 10px; }
.bs-raum { background: var(--flaeche); border: 1px solid var(--linie); border-radius: 12px; padding: 12px 14px 14px; display: grid; gap: 10px; }
.bs-raum__kopf { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bs-griff { color: var(--leise); cursor: grab; display: grid; place-items: center; width: 22px; height: 30px; }
.bs-griff:active { cursor: grabbing; }
input.bs-raum__name { font-size: 16px; font-weight: 800; padding: 3px 8px; margin-left: -6px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; width: auto; min-width: 120px; max-width: 320px; min-height: 32px; field-sizing: content; }
input.bs-raum__name:hover { border-color: var(--linie); }
input.bs-raum__name:focus { border-color: var(--gold); background: var(--feld); outline: none; }
.bs-raum__zahl { display: inline-flex; gap: 10px; font-size: 12.5px; color: var(--leise); font-weight: 700; }
.bs-raum__zahl span { display: inline-flex; align-items: center; gap: 4px; }
.bs .bs-raum__zahl svg { width: 14px; height: 14px; }
.bs-raum--zieht { opacity: .5; }
.bs-raum--ziel { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.bs-neu { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; }

/* Bildkacheln */
.ph { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--sand);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
button.ph { padding: 0; min-height: 0; border: none; display: block; width: 100%; cursor: zoom-in; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .t { position: absolute; left: 5px; bottom: 5px; padding: 1px 6px; border-radius: 4px; background: rgba(20,16,12,.62); color: #fff;
  font: 700 11.5px var(--schrift); font-variant-numeric: tabular-nums; }
.ph--leer { background: repeating-linear-gradient(135deg, var(--sand) 0 8px, color-mix(in srgb, var(--sand) 60%, var(--flaeche)) 8px 16px);
  display: grid; place-items: center; color: var(--leise); font-size: 12px; font-weight: 700; text-align: center; box-shadow: inset 0 0 0 1.5px var(--linie); }
.bs-fotoraster { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px 12px; }
.bs-bild { margin: 0; display: grid; gap: 5px; min-width: 0; }
.bs-bild__rahmen { position: relative; }
.bs-stern { position: absolute; right: 6px; top: 6px; width: 30px; height: 30px; min-height: 0; padding: 0; border-radius: 8px;
  background: rgba(255,255,255,.92); border: 1px solid rgba(0,0,0,.08); color: var(--leise); }
.bs-stern.an { color: var(--gold-dk); background: var(--sand); }
.bs .bs-stern.an svg { fill: currentColor; }
.bs .bs-stern svg { width: 16px; height: 16px; }
.bs-bild figcaption { display: grid; gap: 1px; font-size: 12px; color: var(--leise); line-height: 1.35; }
.bs-bild figcaption b { color: var(--tinte); font-size: 12.5px; }
.bs-meta { display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs .bs-meta svg { width: 12px; height: 12px; }
.bs-meta--fehlt { color: var(--acht); }
.bs-pfeil { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--sand); flex: none; }
.bs .bs-pfeil svg { width: 10px; height: 10px; transform: rotate(var(--r, 0deg)); color: var(--ziegel); }
.bs-gruppe { display: grid; gap: 8px; scroll-margin-top: 120px; }
.bs-gruppe__kopf { display: flex; align-items: baseline; gap: 8px; font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--leise); }
.bs-gruppe__kopf span { font-weight: 700; letter-spacing: 0; text-transform: none; }

/* Zeichnungen */
.bs-zeichnungen { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.bs-zeichnung { margin: 0; display: grid; gap: 5px; }
.bs-zeichnung .blatt { aspect-ratio: 4 / 3; border-radius: 8px; border: 1px solid var(--linie); background-color: #fff; overflow: hidden;
  padding: 0; min-height: 0; width: 100%; display: block; cursor: zoom-in; }
.bs-zeichnung .blatt img { width: 100%; height: 100%; object-fit: contain; display: block; }
.bs-zeichnung--wartet .blatt { display: grid; place-items: center; cursor: default; }
.bs-zeichnung figcaption { font-size: 12px; color: var(--leise); display: grid; gap: 1px; }
.bs-zeichnung figcaption b { color: var(--tinte); font-size: 12.5px; }

/* Memoliste */
.bs-memoliste { display: grid; gap: 0; border-top: 1px solid var(--linie); }
.bs-memozeile { display: grid; grid-template-columns: 34px 190px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 8px 4px;
  border-bottom: 1px solid var(--linie); font-size: 13.5px; }
.bs-memozeile .spiel { width: 32px; height: 32px; min-height: 0; padding: 0; border-radius: 50%; }
.bs .bs-memozeile .spiel svg { width: 12px; height: 12px; }
.bs-memozeile .wo { font-weight: 700; }
.bs-memozeile .txt { color: var(--leise); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bs-memozeile.laeuft { background: var(--sand); }
.bs-memozeile.laeuft .spiel { background: var(--ziegel); color: #fff; border-color: var(--ziegel); }

/* Dialoge: Übernehmen (die Großansicht ist der Bilder-Viewer, stil.css .vw) */
.bs-liste { margin: 0 0 10px; padding-left: 20px; display: grid; gap: 6px; }
.bs-wahl { display: grid; gap: 8px; margin: 6px 0 10px; }
.bs-wahl__opt { display: grid; grid-template-columns: 22px 1fr; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--linie);
  cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--tinte); }
.bs-wahl__opt:has(input:checked) { border-color: var(--hinw-rand); background: var(--flaeche); box-shadow: inset 0 0 0 1px var(--hinw-rand); }
.bs-wahl__opt input { width: 18px; height: 18px; min-height: 0; margin: 2px 0 0; accent-color: var(--gold); }
.bs-wahl__opt span { display: grid; gap: 2px; }
.bs-wahl__opt small { color: var(--leise); font-size: 12.5px; }

/* Reiter „Bilder“: Herkunft unter dem Namen */
.bildraster__herkunft { display: inline-block; margin-top: 2px; font-size: 11.5px; font-weight: 700; color: var(--hinw-tinte);
  background: var(--hinw) border-box; padding: 1px 7px; border-radius: 999px; justify-self: start; }

/* ---------------------------------------------------------- Rechnung: welcher Aufenthalt gilt (Entwurf 40 C) */
.rgv { display: grid; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--linie); background: var(--flaeche); margin-top: 12px; }
.rgv__kopf { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.rgv__kopf b { font-size: 14px; }
.rgv__kopf .bs-luft { flex: 1; }
.rgv__kopf .bs-unter { font-size: 12.5px; color: var(--leise); }
.rgv-wahl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rgv-opt { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 4px 10px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--linie); background: var(--flaeche); font-size: 13px; color: var(--tinte); cursor: pointer; text-align: left;
  align-content: start; min-height: 0; justify-content: stretch; font-weight: 400; }
.rgv-opt:hover { border-color: var(--leise); }
.rgv-opt[aria-disabled="true"] { cursor: default; opacity: .6; }
.rgv-opt__radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--leise); margin-top: 2px; grid-row: span 3; }
.rgv-opt.on .rgv-opt__radio { border-color: var(--gold); background: radial-gradient(circle, var(--gold) 0 45%, transparent 50%); }
.rgv-opt b { font-size: 15px; display: inline-flex; align-items: baseline; gap: 4px; flex-wrap: wrap; }
.rgv-opt b em { font-style: normal; font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rgv-opt small { grid-column: 2; color: var(--leise); font-size: 12px; line-height: 1.4; }
.rgv-opt .rgv-rund { color: var(--gold-dk); font-weight: 700; }
.rgv-opt.on { border-color: var(--hinw-rand); background: var(--flaeche); box-shadow: inset 0 0 0 1px var(--hinw-rand); }
.rgv-hand { grid-column: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; }
.rgv-hand input { width: 92px; min-height: 32px; padding: 3px 6px; font-size: 13.5px; }
.rgv-hand button { min-height: 32px; padding: 3px 10px; font-size: 13px; }
.rgv-hand span { font-size: 12.5px; color: var(--leise); }

/* ---------------------------------------------------------- schmal */
@media (max-width: 860px) {
  .rgv-wahl { grid-template-columns: minmax(0, 1fr); }
  .bs-zeit { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .bs-zeit .gilt { grid-column: 1 / -1; }
  .bs-memozeile { grid-template-columns: 34px minmax(0, 1fr) auto; }
  .bs-memozeile .txt { grid-column: 2 / -1; grid-row: 2; white-space: normal; }
}
@media (max-width: 700px) {
  .bs-sprung { margin: -18px -16px 0; padding: 8px 16px; flex-wrap: nowrap; overflow-x: auto; }
  .bs-sprung a { flex: none; }
}

/* Hinweis im Raum auf die Fotos unten (jedes Foto steht nur einmal in der Oberfläche); daneben, leise, die Bilder von
   extern mit diesem Raum – sie stehen im Reiter „Bilder“ der Akte, der Knopf führt hin */
.bs-raum__fuss { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; }
.bs-extern { min-height: 44px; padding: 0 6px; border: none; background: none; box-shadow: none; border-radius: 8px; font-size: 13px; font-weight: 600;
  color: var(--leise); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.bs-extern:hover { color: var(--tinte); }
.bs-streifen__hin { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 8px; font-size: 13.5px; font-weight: 700;
  color: var(--tinte); background: var(--g-glass); border: 1px solid var(--g-glass-line); box-shadow: var(--g-glass-shadow); transition: background .12s, transform .12s; }
.bs-streifen__hin:hover { background: var(--g-glass-hover); }
.bs-streifen__hin:active { background: var(--g-glass-press); transform: scale(.98); }
.bs-streifen__hin svg { width: 16px; height: 16px; }

/* „Im Gutachten“ in der Besichtigung: wie im Raster der Akte und im Viewer (gelber Stern, mit Wort, wenn an) */
.bs-stern.an { width: auto; padding: 0 10px 0 7px; display: inline-flex; align-items: center; gap: 5px; background: var(--hinw) border-box; color: var(--hinw-tinte); border-color: transparent; }
.bs-stern.an .tx { font-size: 12px; font-weight: 800; line-height: 1; }
