/* ==========================================================================
   Real Estate – Makeln und Verwalten
   Gemeinsame Bausteine der Masken (Objekt, Einheit, Interessent, Besichtigung,
   Transaktion) auf den Haus-Token (--bp-*). Die Masken selbst folgen dem
   Seitenprinzip (bp-mask*, bp-folder-tabs aus bp-components.css); hier steht
   nur, was das Modul zusätzlich braucht. Keine Verläufe, keine Schatten, Farbe
   nur als Zustand (DESIGN.md).
   ========================================================================== */

.re-page {
    --re-line: var(--bp-panel-border);
    --re-tint: color-mix(in srgb, var(--bp-text) 4%, transparent);
    font-variant-numeric: tabular-nums;
}

.re-page ::selection { background: color-mix(in srgb, var(--bp-yellow) 35%, transparent); color: var(--bp-text); }
.re-page * { scrollbar-width: thin; scrollbar-color: var(--bp-panel-border) transparent; }

/* ---- Kopf der Maske ---------------------------------------------------- */
.re-top { display: flex; flex-direction: column; gap: 1rem; }

/* Blättern in der Maske: Der bisherige Datensatz bleibt stehen, bis der nächste da ist. Erst wenn das Laden spürbar
   dauert (Verzögerung 150 ms), tritt er zurück und nimmt keine Eingaben mehr an — die Leiste bleibt bedienbar. */
.re-page--switching .re-top > :not(:first-child),
.re-page--switching .re-tabarea { opacity: .55; pointer-events: none; transition: opacity 120ms ease 150ms; }
.re-info { color: var(--bp-text-muted); font-size: 0.875rem; white-space: nowrap; }
.re-fields { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 1rem; }
.re-number { font-family: var(--bp-font-head); font-weight: 600; letter-spacing: 0.02em; color: var(--bp-text); }
.re-pair { display: flex; gap: 0.5rem; min-width: 0; }
.re-pair > * { flex: 1 1 auto; min-width: 0; }
.re-pair__short { flex: 0 0 4.5rem !important; }
.re-input--tiny { width: 3.5rem; text-align: center; text-transform: uppercase; }

/* ---- Reiter ------------------------------------------------------------ */
.re-tabarea { margin-top: 1rem; min-width: 0; }
.re-tabfoot { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.75rem; }
.re-grid--wide { grid-template-columns: 1fr; }
.re-note { width: 100%; resize: vertical; min-height: 4.5rem; line-height: 1.5; }
.re-lead { margin: 0 0 0.75rem; color: var(--bp-text); max-width: 75ch; line-height: 1.5; }

/* ---- Tabellen in Reitern ---------------------------------------------- */
.re-table { width: 100%; border-collapse: collapse; }
.re-table th { text-align: left; font-weight: 600; font-size: 0.8125rem; color: var(--bp-text-muted); padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--re-line); white-space: nowrap; }
.re-table td { padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--re-line); vertical-align: middle; }
.re-table tbody tr:hover { background: var(--re-tint); }
.re-table .bp-num, .re-table th.bp-num { text-align: right; white-space: nowrap; }
.re-table--edit td { padding: 0.3rem 0.4rem; }
.re-strong { font-family: var(--bp-font-head); font-weight: 600; color: var(--bp-text); }
.re-muted { color: var(--bp-text-muted); font-size: 0.875rem; }
.re-rowactions { text-align: right; white-space: nowrap; }

/* ---- Inline-Erfassung in Reitern (Mandat, Anfrage) --------------------- */
.re-inline {
    margin-top: 1rem; padding: 1rem; border: 1px solid var(--re-line); border-radius: var(--bp-radius-ctl);
    background: var(--re-tint);
}
.re-inline__field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.re-inline__field > span { font-size: 0.8125rem; color: var(--bp-text-muted); }
.re-inline__field--wide { grid-column: 1 / -1; }

/* ---- Einheiten-Stand, Pipeline, Prüfliste ------------------------------ */
.re-unitstrip { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.75rem; }

.re-pipeline { display: grid; grid-template-columns: repeat(7, minmax(6rem, 1fr)); gap: 1px; margin-bottom: 1rem; background: var(--re-line); border: 1px solid var(--re-line); border-radius: var(--bp-radius-ctl); overflow: hidden; }
.re-pipeline__step { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.75rem; background: var(--bp-surface); }
.re-pipeline__count { font-family: var(--bp-font-head); font-size: 1.25rem; font-weight: 600; color: var(--bp-text); }
.re-pipeline__label { font-size: 0.8125rem; color: var(--bp-text-muted); }
.re-pipeline__step.is-empty .re-pipeline__count { color: var(--bp-text-faint); }

.re-checklist { list-style: none; margin: 0 0 0.75rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 0.4rem 1.5rem; }
.re-checklist__item { display: flex; align-items: center; gap: 0.5rem; color: var(--bp-text); }
.re-checklist__icon { color: var(--bp-text-muted); }

/* ---- Dock -------------------------------------------------------------- */
.re-dockfield { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.8125rem; }

/* ---- Einstellungsmaske ------------------------------------------------- */
.re-set__rows { display: flex; flex-direction: column; }
.re-set__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(14rem, 22rem); gap: 1.5rem; padding: 0.75rem 0; border-bottom: 1px solid var(--bp-panel-border); align-items: start; }
.re-set__row:last-child { border-bottom: 0; }
.re-set__row.is-pending .re-set__label { color: var(--bp-yellow); }
.re-set__text { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.re-set__label { font-weight: 600; color: var(--bp-text); display: flex; align-items: center; gap: 0.5rem; }
.re-set__flag { font-weight: 400; font-size: 0.75rem; color: var(--bp-text-muted); border: 1px solid var(--bp-panel-border); border-radius: var(--bp-radius-ctl); padding: 0 0.35rem; }
.re-set__why { color: var(--bp-text-muted); font-size: 0.875rem; line-height: 1.5; max-width: 70ch; }
.re-set__input { display: flex; flex-direction: column; gap: 0.3rem; }
.re-set__num { display: flex; align-items: center; gap: 0.5rem; }
.re-set__default { font-size: 0.8125rem; color: var(--bp-text-muted); }
.re-set__reset { margin-left: 0.5rem; }
.re-setedit { display: flex; flex-direction: column; gap: 1rem; }
.re-setedit__bar { display: flex; align-items: center; gap: 0.75rem; justify-content: flex-end; }
.re-setedit__state { margin-right: auto; color: var(--bp-text-muted); font-size: 0.875rem; }

/* ---- Bilder (Reiter „Bilder") ------------------------------------------ */
/* Wie die Artikelgalerie: Karten ohne Schatten, das Titelbild trägt die Akzentkante als einzige Farbe. Fotos füllen
   die Kachel (cover, 4:3) — anders als Artikel-Freisteller sind Objektfotos randlose Aufnahmen. Grundrisse bleiben
   ganz sichtbar (contain), sonst fehlt ein Raum. */
.re-gallery-area { display: flex; flex-direction: column; gap: 1.25rem; padding-top: 0.25rem; }
.re-drop {
    display: flex; align-items: flex-end; gap: 0.75rem 1rem; flex-wrap: wrap; padding: 0.75rem;
    border: 1px dashed var(--bp-panel-border); border-radius: var(--bp-radius-lg);
}
.re-drop:focus-within { outline: 2px solid var(--bp-yellow); outline-offset: 2px; }
.re-drop__field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 11rem; }
.re-drop__label { color: var(--bp-text-muted); font-size: 0.8rem; }
.re-drop__file { display: flex; align-items: center; gap: 0.75rem; flex: 1 1 18rem; color: var(--bp-text-muted); font-size: 0.85rem; }
.re-drop__file input[type="file"] { color: var(--bp-text); font-size: 0.85rem; max-width: 100%; }
.re-drop__file input[type="file"]::file-selector-button {
    font: inherit; color: var(--bp-black); background: var(--bp-yellow); border: 0;
    border-radius: var(--bp-radius-ctl); padding: 0.4rem 0.9rem; margin-right: 0.75rem; cursor: pointer;
}
.re-gallery-level { display: flex; flex-direction: column; gap: 0.6rem; }
.re-gallery-level__title { margin: 0; font-family: var(--bp-font-head); font-size: 0.95rem; font-weight: 600; color: var(--bp-text); }
.re-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.75rem; }
.re-gallery__item {
    display: flex; flex-direction: column; margin: 0; min-width: 0;
    background: var(--bp-panel); border: 1px solid var(--bp-panel-border); border-radius: var(--bp-radius-lg); overflow: hidden;
}
.re-gallery__item.is-cover { border-color: var(--bp-yellow); }
/* Nicht im Exposé: zurückgenommen, aber lesbar — ein Hinweis, kein Fehler. */
.re-gallery__item.is-hidden .re-gallery__img { opacity: 0.45; }
.re-gallery__img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--bp-panel-solid-2); }
.re-gallery__meta { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.5rem 0.5rem 0; min-width: 0; }
.re-gallery__chips { display: flex; flex-wrap: wrap; gap: 0.25rem; min-height: 1.4rem; }
.re-gallery__name { color: var(--bp-text-muted); font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.re-gallery__title { width: 100%; font-size: 0.85rem; }
.re-gallery__flags { display: flex; align-items: center; gap: 0.25rem 0.75rem; flex-wrap: wrap; padding: 0.5rem 0.5rem 0; }
.re-gallery__kind { flex: 1 1 7rem; min-width: 0; font-size: 0.85rem; }
.re-gallery__bar { display: flex; align-items: center; gap: 0.25rem; padding: 0.5rem; }
.re-spacer { flex: 1; }
.re-check { display: inline-flex; align-items: center; gap: 0.35rem; color: var(--bp-text); font-size: 0.85rem; cursor: pointer; }
.re-check input { accent-color: var(--bp-yellow); }

/* ---- Exposé (Reiter „Exposé": Erzeugen und Versionen) ------------------- */
/* Unter den Texten, durch eine Linie getrennt: oben wird geschrieben, hier wird daraus ein Dokument. Hinweise als
   ruhige Liste — Gelb/Rot nur für die Lücke, die das Exposé betrifft. */
.re-expose { display: flex; flex-direction: column; gap: 0.9rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--re-line); }
.re-expose__title { margin: 0; font-family: var(--bp-font-head); font-size: 1rem; font-weight: 600; color: var(--bp-text); }
.re-expose__subtitle { margin: 0.5rem 0 0; font-family: var(--bp-font-head); font-size: 0.9rem; font-weight: 600; color: var(--bp-text); }
.re-expose__form { display: flex; align-items: flex-end; gap: 0.75rem 1rem; flex-wrap: wrap; }
.re-expose__actions { display: flex; gap: 0.5rem; margin-left: auto; }
.re-expose__notes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.re-expose__note { display: flex; align-items: flex-start; gap: 0.5rem; color: var(--bp-text-muted); font-size: 0.875rem; line-height: 1.45; }
.re-expose__note.is-warn { color: var(--bp-text); }
.re-expose__note.is-warn .re-expose__icon { color: var(--bp-warn); }
.re-expose__note.is-blocked { color: var(--bp-text); }
.re-expose__note.is-blocked .re-expose__icon { color: var(--bp-danger); }
.re-expose__icon { flex: 0 0 auto; margin-top: 0.15rem; }

/* ---- Versand-Dialog ------------------------------------------------------ */
/* Kopfzeilen wie im Mailprogramm (Muster Belegversand in betterSALES): Schlüssel links, Felder rechts. */
.re-dialog .e-dlg-content { display: flex; flex-direction: column; gap: 0.9rem; }
.re-dialog__lead { margin: 0; font-family: var(--bp-font-head); font-weight: 600; color: var(--bp-text); }
.re-dialog__warn,
.re-dialog__blocked { margin: 0; padding: 0.6rem 0.75rem; border-radius: var(--bp-radius-ctl); font-size: 0.875rem; line-height: 1.45; color: var(--bp-text); }
.re-dialog__warn { background: color-mix(in srgb, var(--bp-warn) 14%, transparent); }
.re-dialog__blocked { background: color-mix(in srgb, var(--bp-danger) 14%, transparent); }
.re-mailrows { display: grid; gap: 0.5rem; }
.re-mailrow { display: grid; grid-template-columns: 6rem minmax(0, 1fr); align-items: center; gap: 0.75rem; }
.re-mailrow__key { font-size: 0.8rem; color: var(--bp-text-muted); }
.re-mailbody { display: flex; flex-direction: column; gap: 0.35rem; }
.re-mailbody .re-note { min-height: 10rem; }

@media (max-width: 640px) {
    .re-mailrow { grid-template-columns: 1fr; gap: 0.25rem; }
    .re-expose__actions { margin-left: 0; }
}

/* ---- Unterlagen (Reiter „Unterlagen") ----------------------------------- */
/* Prüfliste: erledigt ruhig, fehlend als leiser Hinweis mit Aufforderung, abgelaufen warm — Farbe nur als Zustand. */
.re-docs { display: flex; flex-direction: column; gap: 1rem; }
.re-checklist__name { flex: 1 1 auto; }
.re-checklist__state { color: var(--bp-text-muted); font-size: 0.85rem; }
.re-checklist__item.is-done .re-checklist__icon { color: var(--bp-success); }
.re-checklist__item.is-expired .re-checklist__icon,
.re-checklist__item.is-expired .re-checklist__state { color: var(--bp-warn); }
.re-docs__file { display: block; margin-top: 0.2rem; font-size: 0.8rem; }
.re-linkbtn { background: none; border: 0; padding: 0; color: var(--bp-text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font: inherit; }
.re-linkbtn:focus-visible { outline: 2px solid var(--bp-yellow); outline-offset: 2px; }
.re-attach { display: flex; flex-direction: column; gap: 0.35rem; margin: 0; padding: 0; border: 0; }

/* ---- KI-Exposétext und Übersetzungen ------------------------------------ */
/* Der Vorschlag steht als eigene Fläche über den Feldern: erst lesen, dann übernehmen. Lila trägt nur der KI-Knopf
   (bp-ai) und das KI-Zeichen — die Fläche selbst bleibt ruhig, damit der Text lesbar ist. */
.re-aiassist { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.re-aiassist__bar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.re-aiassist__keywords { flex: 1 1 20rem; min-width: 0; }
.re-aiassist__proposal { border: 1px solid var(--bp-panel-border); border-left: 3px solid var(--bp-purple); border-radius: var(--bp-radius-lg); padding: 0.9rem 1rem; background: var(--bp-panel); }
.re-aiassist__head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.6rem; }
.re-aiassist__title { font-family: var(--bp-font-head); font-weight: 600; color: var(--bp-text); }
.re-aiassist__fields { margin: 0; display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 0.5rem 1rem; }
.re-aiassist__fields dt { color: var(--bp-text-muted); font-size: 0.85rem; }
.re-aiassist__fields dd { margin: 0; color: var(--bp-text); line-height: 1.5; max-width: 75ch; }
.re-aiassist__text { white-space: pre-line; }
.re-aiassist__actions { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.9rem; }
.re-trans { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--re-line); }
.re-trans__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.re-trans__item { border-bottom: 1px solid var(--re-line); padding: 0.5rem 0; }
.re-trans__row { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.re-trans__lang { min-width: 8rem; font-weight: 600; color: var(--bp-text); }
.re-trans__edit { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.75rem 0 0.25rem; }
@media (max-width: 640px) { .re-aiassist__fields { grid-template-columns: 1fr; } }

/* ---- Portal-Export (OpenImmo) ------------------------------------------- */
.re-oi__title { font-size: 1.5rem; font-weight: 600; color: var(--bp-text); margin: 0; }
.re-oi__lead { margin: 0.35rem 0 0; max-width: 70ch; }
.re-oi__actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.re-oi__check { width: 2.5rem; text-align: center; }
.re-oi__row--off td { color: var(--bp-text-muted); }
.re-oi__ok { color: var(--bp-success); }

.re-ov__gaps { display: flex; flex-wrap: wrap; gap: 0.25rem; }

/* ---- Sammelaktion Exposé ------------------------------------------------ */
.re-tabfoot--top { justify-content: space-between; margin: 0 0 0.75rem; }
.re-tabfoot--top .re-lead { margin: 0; }
.re-bulk__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 22rem; overflow: auto; }
.re-bulk__row { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--bp-panel-border); flex-wrap: wrap; }
.re-bulk__name { font-weight: 600; color: var(--bp-text); min-width: 10rem; }
.re-bulk__ok { color: var(--bp-success); }
.re-bulk__fail { color: var(--bp-warn); }

/* Datenraum-Dialog: Auswahl der Unterlagen, Versandzeile, Zugriffsprotokoll (aufklappbar). */
.re-drm__docs { margin: 0.75rem 0 0; padding: 0; border: 0; }
.re-drm__docs legend { margin-bottom: 0.35rem; }
.re-drm__send { display: grid; gap: 0.5rem; margin-top: 1rem; }
.re-drm__log { margin-top: 1rem; }
.re-drm__log summary { cursor: pointer; font-size: 0.85rem; color: var(--bp-text-muted); }
.re-drm__loglist { display: grid; gap: 0.25rem; margin: 0.5rem 0 0; padding: 0; list-style: none; font-size: 0.85rem; max-height: 14rem; overflow-y: auto; }
.re-drm__loglist li { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Verwaltung: Rückstand ist die eine Abweichung, die Farbe trägt (Muster: Farbe nur bei Abweichung). */
.re-arrears { color: var(--bp-danger); font-weight: 600; }
.re-ov__tile--alert .bp-stat-tile__value { color: var(--bp-danger); }
.re-ls__sums { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 0 0 0.75rem; font-size: 0.9rem; }
.re-ls__forms { display: grid; gap: 0.75rem; margin-top: 1rem; padding-top: 0.75rem; border-top: 1px solid var(--bp-panel-border); }

/* Anliegen aus dem Portal: der Wortlaut des Meldenden als Zitat, die gewählte Zeile leicht getönt. */
.re-pr__toggle { display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; font-size: 0.875rem; color: var(--bp-text-muted); cursor: pointer; }
.re-pr__message { margin: 0.75rem 0 1rem; padding: 0.75rem 1rem; white-space: pre-line; border-left: 3px solid var(--bp-panel-border); background: var(--re-tint); color: var(--bp-text); }
.re-table tbody tr.is-selected { background: var(--re-tint); }
.re-pr__photos { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 1rem; padding: 0; list-style: none; }
.re-pr__photos img { display: block; width: 9rem; height: 7rem; object-fit: cover; border: 1px solid var(--bp-panel-border); border-radius: var(--bp-radius-ctl); }
.re-pr__photos a:focus-visible img { outline: 2px solid var(--bp-focus, var(--bp-blue)); outline-offset: 2px; }
