/* ═══════════════════════════════════════════════════════════════════════════════
   VIObjTree — Darstellung des zentralen Objektbaums über Arbeitslisten.
   Ausschließlich Design-Tokens, eigener Namensraum `.vot-`, keine Elementselektoren
   (§52/§53). Leitsatz: Hierarchie entsteht durch Einrückung, Typografie und Ruhe —
   nicht durch Rahmen um jede Ebene (§15).
   ═══════════════════════════════════════════════════════════════════════════════ */

.vot { display: flex; flex-direction: column; }

/* ── Ast ─────────────────────────────────────────────────────────────────────
   Kein Container-in-Container. Nur der Ort (Ebene 0) bekommt oben eine ruhige
   Trennlinie; alles Weitere trägt die Einrückung. */
.vot-ast { display: flex; flex-direction: column; min-width: 0; }
.vot-ast--t0 + .vot-ast--t0 { border-top: 1px solid var(--gray-200); margin-top: var(--space-2); padding-top: var(--space-2); }

/* Einrückung als Baumtiefe — bewusst klein, sie ordnet, sie schiebt nicht weg. */
.vot-ast--t1 > .vot-inhalt { padding-left: var(--space-3); }
.vot-ast--t2 > .vot-inhalt { padding-left: var(--space-3); }
.vot-ast--t3 > .vot-inhalt { padding-left: var(--space-3); }

/* Reduzierter Baumverbinder statt Rahmen: eine Haarlinie an der Einrückung. */
.vot-ast--t1 > .vot-inhalt,
.vot-ast--t2 > .vot-inhalt,
.vot-ast--t3 > .vot-inhalt { border-left: 1px solid var(--gray-200); margin-left: var(--space-2); }

.vot-inhalt { display: flex; flex-direction: column; min-width: 0; }
.vot-ast.is-zu > .vot-inhalt { display: none; }

/* ── Kopfzeile ───────────────────────────────────────────────────────────────
   Eine Zeile, kein Kasten: Chevron · Name · Anschrift · Zähler.
   Höhe bewusst knapp — die frühere Akkordeonzeile war 50+ px hoch ohne Mehrwert. */
.vot-kopf {
  display: flex; align-items: baseline; gap: var(--space-2);
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer;
  font: inherit; color: var(--gray-900);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  min-height: 30px;
}
.vot-kopf:hover { background: var(--gray-100); }
.vot-kopf:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.vot-chev {
  flex: none; width: 0; height: 0; align-self: center;
  border-left: 5px solid var(--gray-500); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  transform: rotate(90deg); transition: transform .12s;
}
.vot-ast.is-zu > .vot-kopf .vot-chev { transform: rotate(0deg); }

.vot-titel { font-weight: var(--fw-semibold); font-size: var(--text-sm); min-width: 0; overflow-wrap: anywhere; }
.vot-adresse { font-size: var(--text-xs); color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vot-adresse::before { content: '· '; }

.vot-zaehler { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); flex: none; }
.vot-z {
  font-size: var(--text-xs); font-variant-numeric: tabular-nums;
  color: var(--gray-700); background: var(--gray-100);
  border-radius: var(--radius-sm); padding: 0 var(--space-2); white-space: nowrap;
}
.vot-z--warn { background: var(--color-warning-soft); color: var(--color-warning); }
/* AP 1.6 — ein Zähler mit Ziel: er filtert die Liste auf genau diese Lücke.
   Er sieht aus wie die übrigen Chips und verrät sich nur über den Zeiger und den
   Fokusring — die Zahl bleibt die Aussage, der Klick ist die Zugabe. */
.vot-z--klick { border: 0; font: inherit; cursor: pointer; }
.vot-z--klick:hover { filter: brightness(0.96); }
.vot-z--klick:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

/* Ortsebene: die oberste sichtbare Stufe darf etwas kräftiger sprechen. */
.vot-kopf--ort .vot-titel { font-size: var(--text-md); color: var(--color-forest); }

/* „Kein Objekt zugeordnet" — Datenmangel wird gezeigt, nicht versteckt. */
.vot-kopf--ohne { display: flex; align-items: baseline; gap: var(--space-2); padding: var(--space-1) var(--space-2); }
.vot-kopf--ohne .vot-titel { color: var(--gray-500); font-style: italic; }

/* ── Mobil ───────────────────────────────────────────────────────────────────
   Kein Zusammenquetschen der Desktopstruktur: Anschrift rückt unter den Namen,
   der Zähler bleibt rechts an der Titelzeile (§43). */
@media (max-width: 640px) {
  .vot-kopf { flex-wrap: wrap; row-gap: 0; min-height: 40px; padding: var(--space-2); }
  .vot-titel { flex: 1 1 auto; }
  .vot-zaehler { order: 3; margin-left: auto; }
  .vot-adresse { flex: 1 0 100%; order: 4; white-space: normal; padding-left: calc(var(--space-2) + 5px); }
  .vot-adresse::before { content: ''; }
  .vot-ast--t1 > .vot-inhalt,
  .vot-ast--t2 > .vot-inhalt,
  .vot-ast--t3 > .vot-inhalt { padding-left: var(--space-2); margin-left: var(--space-1); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PORTFOLIO — der Objektbaum als Navigator (CAFM-Welle §4–§9)
   ───────────────────────────────────────────────────────────────────────────────
   Kompakte Objektzeilen statt Akkordeon: Name + PLZ/Ort links, Zustandszähler
   rechts, ›. Richtwert 52–68 px je Zeile (§6). Ruhig: der Normalzustand trägt
   keine Farbe, nur Abweichungen (§9).
   ═══════════════════════════════════════════════════════════════════════════════ */
.vop { display: flex; flex-direction: column; gap: var(--space-4); }

.vop-abschnitt { display: flex; flex-direction: column; min-width: 0; }
.vop-ort {
  margin: 0 0 var(--space-1);
  font-size: var(--text-sm); font-weight: var(--fw-semibold); color: var(--color-forest);
  line-height: var(--lh-snug);
}

.vop-zeile {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; min-height: 52px;
  padding: var(--space-1) var(--space-2);
  background: none; border: 0; border-top: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font: inherit; color: var(--gray-900); text-align: left; cursor: pointer;
}
.vop-abschnitt > .vop-zeile:first-of-type { border-top: 0; }
.vop-zeile:hover { background: var(--gray-100); }
.vop-zeile:focus-visible { outline: none; box-shadow: var(--focus-ring); }

.vop-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.vop-name { font-size: var(--text-sm); font-weight: var(--fw-semibold); overflow-wrap: anywhere; }
.vop-adresse { font-size: var(--text-xs); color: var(--gray-500); }

.vop-chips { flex: 0 1 auto; display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; justify-content: flex-end; }
.vop-go { flex: none; color: var(--gray-500); font-size: var(--text-lg); line-height: 1; }

/* Mobil: Zähler unter die Anschrift, Zeile bleibt EINE Trefffläche (§36).
   WICHTIG: ohne flex-wrap quetscht die 100%-Basis der Chips den Text auf Breite 0
   (Fehlerbild 27.08.2026: überlappende Zeilen in der mobilen Schale). */
@media (max-width: 640px) {
  .vop-zeile { min-height: 60px; padding: var(--space-2); flex-wrap: wrap; row-gap: 0; }
  .vop-chips { flex: 1 0 100%; order: 4; justify-content: flex-start; padding-left: 0; }
  .vop-txt { flex: 1 1 0; min-width: 0; }
}

/* ── Objekt-Arbeitskontext (Ebene 2, §10/§53) ─────────────────────────────────
   Ein geöffnetes Objekt: Zurück-Weg, Name + Anschrift, Zustandszähler. Fokus
   ausschließlich auf diesem Objekt — kein Hintergrundrauschen der anderen. */
.vok { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-2); }
.vok-zurueck {
  align-self: flex-start;
  background: none; border: 0; padding: var(--space-1) 0;
  font: inherit; font-size: var(--text-sm); color: var(--color-sage);
  cursor: pointer;
}
.vok-zurueck:hover { text-decoration: underline; }
.vok-zurueck:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.vok-kopf { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.vok-txt { display: flex; flex-direction: column; min-width: 0; }
.vok-name { margin: 0; font-size: var(--text-lg); font-weight: var(--fw-semibold); color: var(--gray-900); line-height: var(--lh-tight); }
.vok-adresse { font-size: var(--text-sm); color: var(--gray-500); }
.vok-chips { margin-left: auto; display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap; }
@media (max-width: 640px) {
  .vok-chips { margin-left: 0; flex-basis: 100%; }
}
