/* ═══ tokens.css ═══ */
/* ════════════════════════════════════════════════════════════════════════════
   tokens.css — Shared Design Tokens (Brand + Semantik + Typo + Spacing)
   ────────────────────────────────────────────────────────────────────────────
   Eine Datei, von ALLEN vier Surfaces geladen (Admin, Mieter-Portal,
   Eigentuemer-Portal, oeffentliche Homepage). Aenderungen hier propagieren
   ueberall.

   Layering:
     tokens.css           ← Foundation (DIESE Datei). Brand + Semantik + Typo.
     app.css              ← Bootstrap-Erweiterungen (Admin-Forms etc.)
     app.industrial.css   ← Admin-Theme-Override (Dark/Light, Neon-Akzent)
     portal.css           ← Portale: gemeinsame Komponenten ueber tokens
     (inline-Style)       ← Pro-Portal-Akzent (Mieter blau / Eigentuemer gruen)

   Brand-Entscheidung (Adrian):
     Aktuell sind --brand-* Platzhalter, die zu den bisher genutzten Werten
     passen. Sobald Adrian ein finales Logo + Hausfarbe hat, hier die fuenf
     ROOT-Variablen umstellen — alle vier Surfaces folgen automatisch.
   ════════════════════════════════════════════════════════════════════════════ */

:root {

  /* ── Brand ─────────────────────────────────────────────────────────────────
     Markenname entschieden 2026-05-08: "Rottensteiner Hausverwaltung"
     2026-05-16: Brand-Palette auf "Bodensee" geupdated (Audit-Befund: drei
     parallele Token-Namensraeume — siehe /docs/design-system/README.md).
     Neue Werte synchron mit public.css. Alle vier Surfaces sollen perspekti-
     visch auf --color-* migrieren. */
  --brand-name:                'Rottensteiner Hausverwaltung';
  --brand-primary:             #2D6B8E;     /* Bodensee-Mittelblau */
  --brand-primary-hover:       #1A4D6B;
  --brand-primary-on:          #FFFFFF;     /* Text auf Brand-Primary */

  /* ── Bodensee-Surface-Palette (NEUE Single-Source-of-Truth) ───────────────
     Semantische Namen statt Farbnamen ("ink" statt "dark" — bleibt stabil
     auch wenn die konkrete Farbe in Zukunft wechselt). */
  --color-ink:                 #15243C;     /* Haupttext + dunkle Surfaces */
  --color-ink-soft:            #6B5E4E;     /* Sekundaertext (warmer Erd-Ton) */
  --color-ink-faint:           #ACA193;     /* Captions, sehr leise */
  --color-brand:               #2D6B8E;     /* See-Blau, Haupt-Akzent */
  --color-brand-deep:          #1A4D6B;     /* See-Blau dunkel (Hover) */
  --color-brand-mist:          #B8D4E3;     /* Morgennebel-Hell, Highlight */
  --color-brand-haze:          #E5EFF5;     /* Sehr heller Brand-Hintergrund */
  --color-paper:               #F7F2EA;     /* Warmes Bodenseepapier */
  --color-paper-deep:          #EDE5D4;     /* Schilf-Beige */
  --color-line:                #DDD4C2;     /* Sanfter Trenner (warm) */
  --color-line-soft:           #ECE5D8;     /* Subtiler Trenner */
  --color-accent:              #C8553D;     /* Apfelblueten-Akzent (sparsam!) */
  --color-admin-accent:        #5BB0D9;     /* Helles See-Blau — Admin-Industrial Akzent (Dark) */
  --color-admin-accent-light:  #2D6B8E;     /* Bodensee-Blau — Admin-Industrial Akzent (Light) */

  --brand-accent-mieter:       #1E3A5F;     /* Akzent fuer Mieter-Portal */
  --brand-accent-eigentuemer:  #2D4A3E;     /* Akzent fuer Eigentuemer-Portal (gruen) */
  --brand-accent-industrial:   #5BB0D9;     /* Akzent fuer Admin-Industrial (helles See-Blau, Dark) */

  /* ── Semantische Statusfarben ──────────────────────────────────────────────
     Identisch ueber alle Surfaces. Werden ggf. pro Theme noch ge-tweaked. */
  --color-success:             #15803D;
  --color-success-bg:          #DCFCE7;
  --color-success-on:          #FFFFFF;
  --color-warning:             #B45309;
  --color-warning-bg:          #FEF3C7;
  --color-warning-on:          #1A1A1A;
  --color-danger:              #B91C1C;
  --color-danger-bg:           #FEE2E2;
  --color-danger-on:           #FFFFFF;
  --color-info:                #1D4ED8;
  --color-info-bg:             #DBEAFE;
  --color-info-on:             #FFFFFF;
  --color-muted:               #525252;
  --color-muted-bg:            #E5E5E5;
  --color-muted-on:            #FFFFFF;

  /* ── HITL-Ampel (Autonomie-Stufe) ──────────────────────────────────────────
     Bewusst nicht success/warning/danger nachgemalt — semantisch anders:
     gruen = autonom, gelb = HITL-Pflicht, rot = blockiert. Eine HITL-Pille
     "rot" ist KEIN Fehler, sondern eine bewusste Autonomie-Entscheidung. */
  --color-traffic-rot:         #7F1D1D;
  --color-traffic-rot-bg:      #FECACA;
  --color-traffic-rot-on:      #FFFFFF;
  --color-traffic-gelb:        #92400E;
  --color-traffic-gelb-bg:     #FDE68A;
  --color-traffic-gelb-on:     #1A1A1A;
  --color-traffic-gruen:       #14532D;
  --color-traffic-gruen-bg:    #BBF7D0;
  --color-traffic-gruen-on:    #FFFFFF;

  /* ── Typografie ────────────────────────────────────────────────────────────
     Sans-Stack: Geist (lokal) → System-UI. Mono-Stack: JetBrains Mono → ui-mono.
     Konvention (siehe app/CLAUDE.md): keine fonts.googleapis.com — privacy + offline. */
  --font-sans:                 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono:                 'JetBrains Mono', 'Geist Mono', ui-monospace, 'SF Mono', Consolas, monospace;
  --font-display:              var(--font-sans);

  --fs-xs:     0.75rem;
  --fs-sm:     0.85rem;
  --fs-base:   0.95rem;
  --fs-lg:     1.15rem;
  --fs-xl:     1.4rem;
  --fs-2xl:    1.85rem;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-bold:    600;

  /* ── Spacing-Skala (4px-Raster) ─────────────────────────────────────────── */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  /* ── Border-Radien ─────────────────────────────────────────────────────── */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-pill: 9999px;

  /* ── Schatten (sehr dezent, Industrial-tauglich) ──────────────────────── */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);

  /* ── Fokus-Ring (gilt fuer alle Surfaces) ───────────────────────────────── */
  --focus-ring-width: 2px;
  --focus-ring-offset: 2px;
  --focus-ring-color: var(--brand-accent-industrial);   /* Hoher Kontrast auch auf dunklen Themes */

  /* ════════════════════════════════════════════════════════════════════════
     Public-Surface-Tokens (Bodensee-Homepage)
     ────────────────────────────────────────────────────────────────────────
     Status 2026-05-28 nach UI-Audit: das Repo hat **zwei stabile**
     Token-Familien, KEINE laufende Migration mehr:

       --color-*       Foundation/Bodensee-Surface (semantisch, theme-stabil)
       --hv-*          Admin-Industrial (theme-variant: Light/Dark)

     Beide sind Single-Source-of-Truth fuer ihre Surface. Die Aliases unten
     (--dark/--blue/--cream/--surface/--border/--text/--text-muted/--accent-spark)
     werden von public.css + ~25 Homepage-Views aktiv genutzt — keine
     "Backward-Compat", sondern produktive API. Tot war nur --dark-soft (raus).

     Wenn du neuen Public-Homepage-Code schreibst: --color-*-Tokens nutzen
     (semantisch klarer). Bestehende --dark/--blue/--cream-Stellen muessen
     NICHT migriert werden — sind via Aliases korrekt resolved.
     ════════════════════════════════════════════════════════════════════════ */

  /* Public-Homepage-Surface-Tokens (Bodensee-Palette) */
  --dark:                      var(--color-ink);
  --blue:                      var(--color-brand);
  --blue-dark:                 var(--color-brand-deep);
  --blue-light:                var(--color-brand-haze);
  --blue-mid:                  var(--color-brand-mist);
  --cream:                     var(--color-paper);
  --cream-dark:                var(--color-paper-deep);
  --surface:                   #FFFFFF;
  --border:                    var(--color-line);
  --text:                      var(--color-ink);
  --text-muted:                var(--color-ink-soft);
  --accent-spark:              var(--color-accent);

  /* Typografie-Aliases (Public benutzt eigene Display-Font Fraunces) */
  --font-display-public:       'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans-public:          'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ════════════════════════════════════════════════════════════════════════════
   Globaler Fokus-Ring
   ────────────────────────────────────────────────────────────────────────────
   Konsistent ueber Admin und beide Portale. Nutzt :focus-visible (nur Tastatur),
   sodass Maus-Klicks keinen sichtbaren Ring triggern.
   ════════════════════════════════════════════════════════════════════════════ */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
  border-radius: var(--radius-sm);
}

/* ════════════════════════════════════════════════════════════════════════════
   .hv-skip-link — Skip-to-content-Link (BFSG / WCAG 2.4.1)
   ────────────────────────────────────────────────────────────────────────────
   Unsichtbar bis Tab-Fokus, dann oben links. Konsistent ueber alle Surfaces.
   Public-Layout hat seine eigene .skip-link mit Bodensee-Farben, die hier
   ist die universelle Variante fuer Admin + beide Portale + Auth.
   ════════════════════════════════════════════════════════════════════════════ */
.hv-skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  z-index: 10000;
  background: var(--color-ink, #15243C);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 var(--radius-md, 8px) 0;
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  transition: top 0.2s ease;
}
.hv-skip-link:focus,
.hv-skip-link:focus-visible {
  top: 0;
  outline: 3px solid var(--color-brand, #2D6B8E);
  outline-offset: 2px;
  color: #fff;
}

/* ════════════════════════════════════════════════════════════════════════════
   .hv-pill — Status-Pille (semantik + HITL-Ampel)
   ────────────────────────────────────────────────────────────────────────────
   Ersetzt Bootstrap-`badge bg-*` an allen Stellen, an denen ein Status oder
   eine Autonomie-Ampel angezeigt wird. Die Klasse setzt nur Layout (Padding,
   Radius, Schrift); die Variante (success / warning / danger / info / muted /
   traffic-*) bringt Hintergrund + Vordergrund.

   Nutzung:
     <span class="hv-pill hv-pill--success">Bezahlt</span>
     <span class="hv-pill hv-pill--traffic-gelb">HITL: gelb</span>

   Helper (Handlebars): {{statusPill domain wert}} — siehe server.js.
   Mapping siehe app/src/utils/statusPills.js.
   ════════════════════════════════════════════════════════════════════════════ */
.hv-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.15rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  font-family: var(--font-sans);
  line-height: 1.4;
  white-space: nowrap;
  vertical-align: baseline;
  letter-spacing: 0.01em;
}
.hv-pill--success      { background: var(--color-success-bg); color: var(--color-success); }
.hv-pill--warning      { background: var(--color-warning-bg); color: var(--color-warning); }
.hv-pill--danger       { background: var(--color-danger-bg);  color: var(--color-danger);  }
.hv-pill--info         { background: var(--color-info-bg);    color: var(--color-info);    }
.hv-pill--muted        { background: var(--color-muted-bg);   color: var(--color-muted);   }
.hv-pill--traffic-rot   { background: var(--color-traffic-rot-bg);   color: var(--color-traffic-rot);   }
.hv-pill--traffic-gelb  { background: var(--color-traffic-gelb-bg);  color: var(--color-traffic-gelb);  }
.hv-pill--traffic-gruen { background: var(--color-traffic-gruen-bg); color: var(--color-traffic-gruen); }

/* Dark-Theme-Override (Industrial Admin): Hintergruende sind im Dark-Mode
   sehr hell → Pille wird zu grell. Auf gedaempfte Versionen mit Alpha. */
[data-theme="dark"] .hv-pill--success      { background: rgba(34, 197, 94, 0.18); color: #6EE7A7; }
[data-theme="dark"] .hv-pill--warning      { background: rgba(245, 158, 11, 0.18); color: #FCD34D; }
[data-theme="dark"] .hv-pill--danger       { background: rgba(239, 68, 68, 0.18);  color: #FCA5A5; }
[data-theme="dark"] .hv-pill--info         { background: rgba(59, 130, 246, 0.18); color: #93C5FD; }
[data-theme="dark"] .hv-pill--muted        { background: rgba(160, 160, 160, 0.18); color: #D4D4D4; }
[data-theme="dark"] .hv-pill--traffic-rot   { background: rgba(220, 38, 38, 0.22);  color: #FCA5A5; }
[data-theme="dark"] .hv-pill--traffic-gelb  { background: rgba(234, 179, 8, 0.22);  color: #FDE047; }
[data-theme="dark"] .hv-pill--traffic-gruen { background: rgba(34, 197, 94, 0.22);  color: #86EFAC; }

@media print {
  .hv-pill {
    background: transparent !important;
    color: #000 !important;
    border: 1px solid #000;
    padding: 0.05rem 0.4rem;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   Field-Level-Validation (CSS-only, kein JS)
   ────────────────────────────────────────────────────────────────────────────
   Pattern: <input required pattern="..." />
            <small class="hv-field-error">Bitte E-Mail im Format ... eingeben</small>

   Sichtbarkeitslogik nutzt :user-invalid (Browser-native, greift erst nach
   Blur oder Submit-Versuch — kein roter Initial-Hint bei leeren Feldern).
   Fallback fuer Browser ohne :user-invalid: :invalid:not(:placeholder-shown)
   :not(:focus). Damit der Fallback greift, sollte das Eingabefeld einen
   placeholder haben (z.B. " " als Spacer fuer Floating-Labels).

   Die Klasse .hv-form-error markiert serverseitige Validation-Fehler — die
   bleibt unabhaengig vom user-invalid-Zustand sichtbar.
   ════════════════════════════════════════════════════════════════════════════ */
.hv-field-error {
  display: none;
  font-size: var(--fs-xs);
  color: var(--color-danger);
  margin-top: 0.25rem;
  line-height: 1.35;
}

/* :user-invalid (modern) — greift nach User-Interaktion */
.form-control:user-invalid + .hv-field-error,
.form-select:user-invalid + .hv-field-error,
textarea:user-invalid + .hv-field-error {
  display: block;
}

/* Fallback :invalid + :not(:placeholder-shown) :not(:focus) */
.form-control:invalid:not(:placeholder-shown):not(:focus) + .hv-field-error,
.form-select:invalid:not(:focus) + .hv-field-error,
textarea:invalid:not(:placeholder-shown):not(:focus) + .hv-field-error {
  display: block;
}

/* Border-Akzent fuer invalid Eingaben (gleiche Sichtbarkeitslogik) */
.form-control:user-invalid,
.form-select:user-invalid,
textarea:user-invalid {
  border-color: var(--color-danger);
}
.form-control:invalid:not(:placeholder-shown):not(:focus),
textarea:invalid:not(:placeholder-shown):not(:focus) {
  border-color: var(--color-danger);
}

/* Server-seitige Inline-Fehler (immer sichtbar wenn die Klasse gesetzt ist) */
.hv-form-error {
  display: block;
  font-size: var(--fs-xs);
  color: var(--color-danger);
  margin-top: 0.25rem;
  line-height: 1.35;
}
.hv-form-error::before {
  content: '⚠ ';
  font-weight: var(--fw-bold);
}

/* Form-Field mit Server-Fehler: Container bekommt eine ID, die im
   form-errors-Partial als Anchor-Link verlinkt ist. Scroll-Margin-Top
   sorgt dafuer, dass der Anchor nicht hinter der Sidebar-Header verschwindet. */
.hv-field--error {
  scroll-margin-top: 80px;
}
.hv-field--error .form-control,
.hv-field--error .form-select,
.hv-field--error textarea {
  border-color: var(--color-danger);
}

/* ════════════════════════════════════════════════════════════════════════════
   Tabellen-Pattern (Phase 2.2)
   ────────────────────────────────────────────────────────────────────────────
   .hv-num         numerische Zelle (rechtsbuendig + Mono + tabular-nums)
   .hv-table-clickable  ganze Zeile als Click-Target (data-href)
   [data-density]  Density-Toggle (compact | cozy | comfy)
   ════════════════════════════════════════════════════════════════════════════ */
.hv-num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hv-table-clickable tbody tr[data-href] {
  cursor: pointer;
  transition: background-color 120ms ease;
}
.hv-table-clickable tbody tr[data-href]:hover {
  background-color: rgba(0, 0, 0, 0.025);
}
[data-theme="dark"] .hv-table-clickable tbody tr[data-href]:hover {
  background-color: rgba(255, 255, 255, 0.04);
}

/* Density-Toggle: globale Einstellung in localStorage 'hv-density'.
   Default = cozy (Bootstrap-Default). Compact spart 30 % Vertikal-Raum,
   Comfy ist fuer Lese-Modus. */
[data-density="compact"] .table > :not(caption) > * > *,
[data-density="compact"] table > :not(caption) > * > * {
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}
[data-density="compact"] .table,
[data-density="compact"] table.table-sm {
  font-size: var(--fs-xs);
}
[data-density="comfy"] .table > :not(caption) > * > *,
[data-density="comfy"] table > :not(caption) > * > * {
  padding-top: 0.85rem;
  padding-bottom: 0.85rem;
}

/* Density-Toggle-Button selbst (in Sidebar-Footer einsetzbar) */
.hv-density-toggle {
  display: inline-flex;
  gap: 1px;
  background: var(--color-muted-bg, #E5E5E5);
  border-radius: var(--radius-pill);
  padding: 2px;
}
.hv-density-toggle button {
  background: transparent;
  border: 0;
  padding: 0.15rem 0.55rem;
  font-size: var(--fs-xs);
  color: var(--color-muted);
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.hv-density-toggle button[aria-pressed="true"] {
  background: var(--brand-primary, #1E3A5F);
  color: var(--brand-primary-on, #fff);
}
[data-theme="dark"] .hv-density-toggle {
  background: rgba(255, 255, 255, 0.06);
}
[data-theme="dark"] .hv-density-toggle button[aria-pressed="true"] {
  background: var(--brand-accent-industrial);
  color: #0A0A0B;
}

/* ════════════════════════════════════════════════════════════════════════════
   Mobile-Bottom-Nav (Phase 2.3)
   ────────────────────────────────────────────────────────────────────────────
   Fixe Navigation am unteren Bildschirmrand auf Mobile (<768px). Verdeckt
   die Sidebar nicht — Sidebar bleibt als Hamburger/Offcanvas verfuegbar.
   Touch-Targets mindestens 44x44 px (Apple/Google-Guideline).
   ════════════════════════════════════════════════════════════════════════════ */
.hv-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1030;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  background: var(--brand-primary, #1E3A5F);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.25rem 0 max(0.25rem, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
}
[data-theme="dark"] .hv-bottom-nav {
  background: #0F1418;
  border-top-color: rgba(255, 255, 255, 0.08);
}
.hv-bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.35rem 0.5rem;
  background: transparent;
  border: 0;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.65);
  font-size: var(--fs-xs);
  line-height: 1.1;
  transition: color 100ms ease;
  cursor: pointer;
}
.hv-bottom-nav-item:hover,
.hv-bottom-nav-item:focus-visible {
  color: rgba(255, 255, 255, 0.92);
}
.hv-bottom-nav-item.active {
  color: var(--brand-accent-industrial, #5BB0D9);
}
.hv-bottom-nav-item i {
  font-size: 1.15rem;
  margin-bottom: 2px;
}
.hv-bottom-nav-item span {
  font-size: 0.65rem;
  letter-spacing: 0.02em;
}

/* Bottom-Nav verdeckt unteren Content — Padding fuer den Content auf Mobile */
@media (max-width: 767.98px) {
  body:has(.hv-bottom-nav) .hv-content,
  body:has(.hv-bottom-nav) main {
    padding-bottom: 4.5rem;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   Tabellen-Mobile-Card-Layout (Phase 2.3)
   ────────────────────────────────────────────────────────────────────────────
   <table class="hv-table-mobile"> klappt unter 768px in Card-Layout um.
   Voraussetzung: jedes <td> hat data-label="Spaltenname".
   ════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767.98px) {
  table.hv-table-mobile thead {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }
  table.hv-table-mobile tbody tr {
    display: block;
    margin-bottom: 0.75rem;
    border: 1px solid var(--hv-border, #e5e7eb);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    background: var(--hv-surface, #ffffff);
  }
  table.hv-table-mobile tbody td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    padding: 0.25rem 0;
    border: 0;
  }
  table.hv-table-mobile tbody td::before {
    content: attr(data-label);
    font-size: var(--fs-xs);
    color: var(--color-muted, #525252);
    font-weight: var(--fw-medium);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
  }
  table.hv-table-mobile tbody td:not([data-label]):empty {
    display: none;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   Inline-Hilfe — Tooltip-Popover (Phase 2.5)
   ────────────────────────────────────────────────────────────────────────────
   Klick-getriggertes Popover fuer komplexe Felder (Kappungsgrenze,
   Verteilerschluessel, AfA-Restwert, Mietspiegel). Kein Hover, weil Mobile
   das nicht hat. Keine Wall-of-Text — max. 2-3 Saetze pro Tip.
   ════════════════════════════════════════════════════════════════════════════ */
.hv-tip {
  cursor: pointer;
  color: var(--color-muted, #525252);
  margin-left: 0.25rem;
  font-size: 0.95em;
  vertical-align: middle;
  transition: color 100ms ease;
}
.hv-tip:hover,
.hv-tip:focus-visible {
  color: var(--brand-primary, #1E3A5F);
}
[data-theme="dark"] .hv-tip:hover,
[data-theme="dark"] .hv-tip:focus-visible {
  color: var(--brand-accent-industrial, #5BB0D9);
}

/* Popover-Variante: schmaler + im Industrial-Look */
.popover.hv-tip-popover {
  max-width: 300px;
  font-size: var(--fs-sm);
  border: 1px solid var(--hv-border, #e5e7eb);
  box-shadow: var(--shadow-lg);
}
.popover.hv-tip-popover .popover-header {
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  background: var(--color-muted-bg, #f1f5f9);
  border-bottom: 0;
}
.popover.hv-tip-popover .popover-body {
  font-size: var(--fs-sm);
  line-height: 1.5;
}
[data-theme="dark"] .popover.hv-tip-popover {
  background: #1A1A1B;
  border-color: rgba(255, 255, 255, 0.12);
  color: #E5E5E5;
}
[data-theme="dark"] .popover.hv-tip-popover .popover-header {
  background: #0F1418;
  color: #fff;
}
[data-theme="dark"] .popover.hv-tip-popover .popover-arrow::after {
  border-top-color: #1A1A1B;
  border-bottom-color: #1A1A1B;
}

/* ════════════════════════════════════════════════════════════════════════════
   Auto-Save-Indikator (Phase 2.1)
   ────────────────────────────────────────────────────────────────────────────
   Wird in Wizard-Steps (Mieterhoehung, NK, Onboarding) eingesetzt.
   ════════════════════════════════════════════════════════════════════════════ */
.hv-autosave {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-xs);
  color: var(--color-success);
  opacity: 0;
  transition: opacity 200ms ease;
  pointer-events: none;
}
.hv-autosave.hv-autosave-visible {
  opacity: 1;
}
.hv-autosave::before {
  content: '✓';
  font-weight: var(--fw-bold);
}
[data-theme="dark"] .hv-autosave {
  color: #6EE7A7;
}

/* ════════════════════════════════════════════════════════════════════════════
   Step-Wizard (Phase 3.1)
   ────────────────────────────────────────────────────────────────────────────
   Fortschrittsanzeige fuer Multi-Step-Forms. Status:
   done = grün + Haken + klickbar; active = Brand + fett; todo = muted.
   ════════════════════════════════════════════════════════════════════════════ */
.hv-step-wizard-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: var(--fs-sm);
}
.hv-step-wizard-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  background: transparent;
}
.hv-step-wizard-item + .hv-step-wizard-item::before {
  content: '›';
  color: var(--color-muted);
  margin-right: 0.25rem;
  font-size: 1.1em;
}
.hv-step-wizard-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  background: var(--color-muted-bg);
  color: var(--color-muted);
}
.hv-step-wizard-item.done .hv-step-wizard-num {
  background: var(--color-success);
  color: var(--color-success-on);
}
.hv-step-wizard-item.active .hv-step-wizard-num {
  background: var(--brand-primary);
  color: var(--brand-primary-on);
}
.hv-step-wizard-titel {
  color: var(--color-muted);
  text-decoration: none;
}
.hv-step-wizard-item.done .hv-step-wizard-titel { color: var(--color-success); }
.hv-step-wizard-item.done a.hv-step-wizard-titel:hover { text-decoration: underline; }
.hv-step-wizard-item.active .hv-step-wizard-titel {
  color: var(--brand-primary);
  font-weight: var(--fw-bold);
}
[data-theme="dark"] .hv-step-wizard-num {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
}
[data-theme="dark"] .hv-step-wizard-item.done .hv-step-wizard-num {
  background: rgba(34, 197, 94, 0.3);
  color: #6EE7A7;
}
[data-theme="dark"] .hv-step-wizard-item.done .hv-step-wizard-titel { color: #6EE7A7; }
[data-theme="dark"] .hv-step-wizard-item.active .hv-step-wizard-num {
  background: var(--brand-accent-industrial);
  color: #0A0A0B;
}
[data-theme="dark"] .hv-step-wizard-item.active .hv-step-wizard-titel {
  color: var(--brand-accent-industrial);
}

/* ════════════════════════════════════════════════════════════════════════════
   Onboarding-Tour-Spotlight (Phase 3.6)
   ────────────────────────────────────────────────────────────────────────────
   Dunkler Backdrop mit "ausgeschnittenem" Spotlight um das Tour-Ziel-Element.
   Bubble (.hv-tour-bubble) zeigt Titel + Markdown-Body + Skip/Weiter.
   ════════════════════════════════════════════════════════════════════════════ */
.hv-tour-overlay {
  position: fixed;
  inset: 0;
  z-index: 1090;
  pointer-events: none;
}
.hv-tour-overlay::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(10, 10, 11, 0.55);
  backdrop-filter: blur(2px);
  pointer-events: auto;
}
.hv-tour-spotlight {
  position: absolute;
  border-radius: var(--radius-md);
  box-shadow: 0 0 0 9999px rgba(10, 10, 11, 0.55), 0 0 0 3px var(--brand-accent-industrial);
  pointer-events: none;
  transition: all 200ms ease;
}
.hv-tour-bubble {
  position: absolute;
  max-width: 360px;
  background: #fff;
  color: #1A1A1A;
  border-radius: var(--radius-md);
  padding: 1rem 1.15rem;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.hv-tour-bubble h3 {
  margin: 0 0 0.5rem 0;
  font-size: var(--fs-base);
  font-weight: var(--fw-bold);
}
.hv-tour-bubble p { margin: 0 0 0.5rem 0; }
.hv-tour-bubble p:last-child { margin-bottom: 0; }
.hv-tour-bubble ul { margin: 0 0 0.75rem 0; padding-left: 1.25rem; }
.hv-tour-bubble strong { color: var(--brand-primary); }
.hv-tour-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--hv-border, #e5e7eb);
}
.hv-tour-progress {
  font-size: var(--fs-xs);
  color: var(--color-muted);
  margin-right: auto;
}
[data-theme="dark"] .hv-tour-bubble {
  background: #1A1A1B;
  color: #E5E5E5;
}
[data-theme="dark"] .hv-tour-bubble strong { color: var(--brand-accent-industrial); }
[data-theme="dark"] .hv-tour-actions { border-top-color: rgba(255, 255, 255, 0.1); }

/* ════════════════════════════════════════════════════════════════════════════
   A11y: prefers-reduced-motion (Phase 3.5)
   ────────────────────────────────────────────────────────────────────────────
   Wenn der User reduced-motion eingestellt hat, schalten wir Animationen
   + Transitions global ab. Greift auf alle hv-* Komponenten, Bootstrap
   (.fade, .collapse) UND inline transition-Werte.
   ════════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   S-NAV — Klick-Feedback bei klassischer Navigation (alle 4 Surfaces)
   ──────────────────────────────────────────────────────────────────────────── */

/* Top-Progress-Bar (gesteuert von public/js/nav-progress.js). */
.hv-nav-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--brand-primary, #2D6B8E);
  box-shadow: 0 0 8px rgba(45, 107, 142, 0.55);
  opacity: 0;
  z-index: 2000;
  pointer-events: none;
  transition: width 0.2s ease, opacity 0.2s ease;
}
@media (prefers-reduced-motion: reduce) {
  /* Balken bleibt als reines „läuft"-Signal, aber ohne laufende Animation. */
  .hv-nav-progress { transition: none; }
}

/* View-Transitions: BEWUSST DEAKTIVIERT (Entscheidung 2026-06-10 nach 3
   Guard-Iterationen). @view-transition { navigation: auto } erzeugt in Chromium
   beim Browser-Teardown/Viewport-Resize einen in-page NICHT abfangbaren
   "Transition was aborted"-pageerror (weder pagereveal/pageswap-Catch noch
   früher unhandledrejection-Filter noch skipTransition halfen — die Seite ist
   beim Abort bereits in Zerstörung). Das verschmutzt jeden automatisierten
   Browser-Lauf und maskiert echte Fehler. Der Weiß-Blitz ist stattdessen über
   den dunklen Erst-Paint (Inline-Style in main.handlebars) gelöst, das
   Klick-Feedback über die Top-Progress-Bar (nav-progress.js). Die vt-guard-/
   skipTransition-Mechanik bleibt harmlos bestehen, falls VT später (besserer
   Browser-Support) reaktiviert wird. */

/* ════════════════════════════════════════════════════════════════════════════
   S-CHART/S-LOAD — Skeleton-Platzhalter (alle Surfaces; .hv-skeleton liegt sonst
   nur in app.css = Admin, fehlt aber im Portal/Public). Theme-neutral.
   ──────────────────────────────────────────────────────────────────────────── */
.hv-skeleton {
  position: relative;
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg,
    rgba(128, 128, 128, 0.06) 0%,
    rgba(128, 128, 128, 0.12) 50%,
    rgba(128, 128, 128, 0.06) 100%);
  background-size: 200% 100%;
  animation: hv-skeleton-pulse 1.5s ease-in-out infinite;
}
.hv-skeleton-msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  color: var(--color-ink-soft, #6c757d);
  white-space: nowrap;
}
@keyframes hv-skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hv-skeleton { animation: none; }
}

/* Chart-Container: reserviert Platz (kein CLS/Leerblitz) + Skeleton liegt als
   Overlay über dem Canvas, bis nav die [data-chart-skeleton]-Elemente entfernt. */
.hv-chart-wrap { position: relative; }
.hv-chart-skeleton {
  position: absolute;
  inset: 0;
  height: auto !important;
  border-radius: 8px;
}

/* ════════════════════════════════════════════════════════════════════════════
   S-FILE — gestylter Datei-Upload (deutsch + Dateiname). Ersetzt das native,
   teils englische <input type=file>. Label umschließt das visuell versteckte
   Input; JS (app.js / portal-init.js) füllt [data-upload-name].
   ──────────────────────────────────────────────────────────────────────────── */
.hv-upload { position: relative; display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; max-width: 100%; }
.hv-upload__input {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); border: 0;
}
.hv-upload__btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0.45rem 0.9rem; border-radius: 8px;
  border: 1px solid var(--color-line, #ced4da);
  background: var(--color-paper-deep, #f1f3f5);
  color: var(--color-ink, #15243C);
  font-size: 0.9rem; font-weight: 500; white-space: nowrap;
}
.hv-upload:hover .hv-upload__btn,
.hv-upload:focus-within .hv-upload__btn {
  border-color: var(--brand-primary, #2D6B8E);
  background: var(--color-brand-haze, #E5EFF5);
}
.hv-upload__name { font-size: 0.85rem; color: var(--color-ink-soft, #6c757d); word-break: break-word; }


/* ═══ app.css ═══ */
/* ════════════════════════════════════════════════════════════════════════════
   Hausverwaltung — App Styles
   ════════════════════════════════════════════════════════════════════════════ */

/* ── CSS-Variablen ───────────────────────────────────────────────────────── */
/* Brand-Drift gefixt: --hv-primary etc. sind jetzt auf die zentralen
   Brand-Tokens aus tokens.css gemappt. Indigo (#4f46e5) ist raus. */
:root {
  /* Farben — Light Theme (uebernimmt Brand aus tokens.css) */
  --hv-primary:       var(--brand-primary);        /* Tiefblau #1E3A5F */
  --hv-primary-light: var(--brand-primary-hover);  /* Etwas dunklerer Hover */
  --hv-secondary:     var(--brand-primary);
  --hv-accent:        var(--brand-accent-industrial); /* Helles See-Blau #5BB0D9 */
  --hv-success:       var(--color-success);
  --hv-warning:       var(--color-warning);
  --hv-danger:        var(--color-danger);
  --hv-bg:            #f8fafc;
  --hv-surface:       #ffffff;
  --hv-sidebar-bg:    #ffffff;
  --hv-sidebar-border:#eef0f4;
  --hv-sidebar-text:  #475569;
  --hv-sidebar-muted: #94a3b8;
  --hv-sidebar-active-bg: #E8EEF5;        /* Tiefblau, sehr hell */
  --hv-sidebar-active-text: var(--brand-primary);
  --hv-sidebar-hover: #f1f5f9;
  --hv-text:          #0f172a;
  --hv-text-muted:    #64748b;
  --hv-border:        #e5e7eb;
  --hv-border-soft:   #f1f5f9;

  /* Schatten — subtil */
  --hv-shadow-sm:  0 1px 2px rgba(15, 23, 42, 0.04);
  --hv-shadow-md:  0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
  --hv-shadow-lg:  0 4px 12px rgba(15, 23, 42, 0.06), 0 2px 4px rgba(15, 23, 42, 0.04);
  --hv-shadow-xl:  0 20px 40px rgba(15, 23, 42, 0.12);

  /* Layout */
  --hv-sidebar-w:     244px;
  --hv-topbar-h:      56px;

  /* Spacing-Skala */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;

  /* Typografie */
  --hv-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --hv-font-xs: 0.7rem;
  --hv-font-sm: 0.8rem;
  --hv-font-base: 0.9rem;
  --hv-font-md: 0.95rem;
  --hv-font-lg: 1.1rem;

  /* Radien */
  --hv-radius-sm: 6px;
  --hv-radius-md: 10px;
  --hv-radius-lg: 14px;
}

/* ── Dark Theme ─────────────────────────────────────────────────────────── */
[data-theme="dark"] {
  --hv-primary:       #818cf8;
  --hv-primary-light: #a5b4fc;
  --hv-secondary:     #818cf8;
  --hv-accent:        #a5b4fc;
  --hv-success:       #34d399;
  --hv-warning:       #fbbf24;
  --hv-danger:        #f87171;
  --hv-bg:            #0b1120;
  --hv-surface:       #111827;
  --hv-sidebar-bg:    #0f172a;
  --hv-sidebar-border:#1f2937;
  --hv-sidebar-text:  #cbd5e1;
  --hv-sidebar-muted: #64748b;
  --hv-sidebar-active-bg: rgba(129, 140, 248, 0.15);
  --hv-sidebar-active-text: #a5b4fc;
  --hv-sidebar-hover: rgba(255,255,255,0.05);
  --hv-text:          #e2e8f0;
  --hv-text-muted:    #94a3b8;
  --hv-border:        #1f2937;
  --hv-border-soft:   #1e293b;

  --hv-shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.3);
  --hv-shadow-md:  0 2px 4px rgba(0, 0, 0, 0.3);
  --hv-shadow-lg:  0 4px 12px rgba(0, 0, 0, 0.4);
  --hv-shadow-xl:  0 20px 40px rgba(0, 0, 0, 0.5);
}

/* ── Skip-Link (a11y) ─────────────────────────────────────────────────────
   Fuer Tastatur-User: erstes fokussierbares Element auf der Seite, springt
   in den Hauptinhalt und ueberspringt die Sidebar-Navigation.
   ────────────────────────────────────────────────────────────────────── */
.hv-skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  background: var(--hv-primary, #5BB0D9);
  color: #000;
  padding: 0.6rem 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 6px 0;
}
.hv-skip-link:focus {
  left: 0;
}

/* ── Basis ───────────────────────────────────────────────────────────────── */
html { font-family: var(--hv-font-sans); }
body {
  background: var(--hv-bg);
  color: var(--hv-text);
  font-size: var(--hv-font-base);
  font-family: var(--hv-font-sans);
  margin: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.2s ease, color 0.2s ease;
}

[data-theme="dark"] body {
  color-scheme: dark;
}

/* ── Layout-Wrapper ──────────────────────────────────────────────────────── */
.hv-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.hv-sidebar {
  width: var(--hv-sidebar-w);
  background: var(--hv-sidebar-bg);
  border-right: 1px solid var(--hv-sidebar-border);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow: hidden;     /* Scroll lebt jetzt im .hv-sidebar-nav, damit der */
  z-index: 1040;        /* Footer (Theme-Toggle, Einstellungen, Logout)    */
  display: flex;        /* immer sichtbar bleibt — vorher scrollte der     */
  flex-direction: column; /* Footer mit weg sobald die Nav lang wurde.    */
  transition: background 0.2s ease, border-color 0.2s ease;
}

.hv-sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
  color: var(--hv-text);
  font-weight: 700;
  font-size: 1rem;
  border-bottom: 1px solid var(--hv-sidebar-border);
  text-decoration: none;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
.hv-sidebar-brand i { font-size: 1.3rem; color: var(--hv-primary); }
.hv-sidebar-brand:hover { color: var(--hv-text); }

.hv-sidebar-nav {
  flex: 1;
  min-height: 0;        /* fuer overflow-y in flex child */
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--sp-2) var(--sp-2);
  scrollbar-width: none;
}
.hv-sidebar-nav::-webkit-scrollbar { display: none; }

.hv-nav-section {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--hv-sidebar-muted);
  text-transform: uppercase;
  padding: 1.1rem var(--sp-3) 0.35rem;
  user-select: none;
}

.hv-nav-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--hv-sidebar-muted);
  text-transform: uppercase;
  padding: var(--sp-3) var(--sp-3) var(--sp-1);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: color 0.15s;
  outline: none;
  border-radius: var(--hv-radius-sm);
}
.hv-nav-label:hover { color: var(--hv-sidebar-text); }
.hv-nav-label:focus-visible { color: var(--hv-sidebar-active-text); }
.hv-nav-label .bi { font-size: 0.6rem; transition: transform 0.2s; }
.hv-nav-label.collapsed .bi { transform: rotate(-90deg); }

.hv-nav-group { overflow: hidden; }
.hv-nav-group.collapsed { display: none; }

.hv-nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1px 0;
  padding: 0.48rem 0.7rem;
  color: var(--hv-sidebar-text);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--hv-radius-sm);
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}
.hv-nav-item i { font-size: 1rem; width: 1.1rem; flex-shrink: 0; color: var(--hv-sidebar-muted); transition: color 0.12s; }
.hv-nav-item:hover {
  background: var(--hv-sidebar-hover);
  color: var(--hv-text);
}
.hv-nav-item:hover i { color: var(--hv-sidebar-text); }
.hv-nav-item.active {
  background: var(--hv-sidebar-active-bg);
  color: var(--hv-sidebar-active-text);
  font-weight: 600;
}
.hv-nav-item.active i { color: var(--hv-sidebar-active-text); }

.hv-nav-subitem {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1px 0;
  padding: 0.36rem 0.7rem 0.36rem 2.2rem;
  color: var(--hv-sidebar-muted);
  text-decoration: none;
  font-size: var(--hv-font-sm);
  border-radius: var(--hv-radius-sm);
  transition: background 0.12s, color 0.12s;
}
.hv-nav-subitem i { font-size: 0.85rem; width: 1rem; flex-shrink: 0; }
.hv-nav-subitem:hover { background: var(--hv-sidebar-hover); color: var(--hv-sidebar-text); }
.hv-nav-subitem.active { color: var(--hv-sidebar-active-text); font-weight: 600; }

/* Sidebar-Badges */
.hv-nav-badge {
  background: var(--hv-danger);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  margin-left: auto;
  line-height: 1.3;
  min-width: 1.1rem;
  text-align: center;
}

.hv-sidebar-footer {
  padding: var(--sp-2);
  border-top: 1px solid var(--hv-sidebar-border);
}

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.hv-topbar {
  height: var(--hv-topbar-h);
  background: var(--hv-surface);
  border-bottom: 1px solid var(--hv-border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-5);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: var(--sp-3);
}
.hv-hamburger {
  background: none;
  border: none;
  padding: 0.3rem 0.5rem;
  color: var(--hv-text);
  cursor: pointer;
  border-radius: var(--hv-radius-sm);
  line-height: 1;
}
.hv-hamburger:hover { background: var(--hv-bg); }

/* Theme Toggle Button */
.hv-theme-toggle {
  background: transparent;
  border: 1px solid var(--hv-border);
  color: var(--hv-text-muted);
  width: 34px;
  height: 34px;
  border-radius: var(--hv-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-size: 1rem;
  padding: 0;
  flex-shrink: 0;
}
.hv-theme-toggle:hover {
  background: var(--hv-bg);
  color: var(--hv-text);
  border-color: var(--hv-primary-light);
}
.hv-theme-toggle .bi-sun-fill { display: none; }
.hv-theme-toggle .bi-moon-stars-fill { display: inline-block; }
[data-theme="dark"] .hv-theme-toggle .bi-sun-fill { display: inline-block; }
[data-theme="dark"] .hv-theme-toggle .bi-moon-stars-fill { display: none; }

/* ── Haupt-Content ───────────────────────────────────────────────────────── */
.hv-content {
  margin-left: var(--hv-sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.hv-main {
  flex: 1;
  padding: var(--sp-5) var(--sp-6);  /* 1.25rem 1.5rem — vorher 1.5/2rem, war zu breit auf schmalen Bildschirmen */
  max-width: 100%;
  min-width: 0;                       /* erlaubt flex-children zu shrinken */
}

/* Sidebar-Overlay (mobile) */
.hv-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 1039;
}
.hv-overlay.show { display: block; }

/* ── Karten ──────────────────────────────────────────────────────────────── */
.card {
  border-radius: var(--hv-radius-lg);
  border: 1px solid var(--hv-border);
  background: var(--hv-surface);
  box-shadow: var(--hv-shadow-sm);
  color: var(--hv-text);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.card-body { padding: var(--sp-6); }
.card-header {
  border-radius: var(--hv-radius-lg) var(--hv-radius-lg) 0 0;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--hv-border-soft);
  background: var(--hv-surface);
}
.card-header h6 { font-size: 0.85rem; font-weight: 600; letter-spacing: -0.01em; margin: 0; }

/* ── Tabellen ────────────────────────────────────────────────────────────── */
.table {
  color: var(--hv-text);
  --bs-table-bg: transparent;
}
.table th {
  font-size: var(--hv-font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hv-text-muted);
  border-bottom-color: var(--hv-border);
}
.table td { border-bottom-color: var(--hv-border-soft); color: var(--hv-text); }
.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr[data-href] { cursor: pointer; }
.table-hover tbody tr[data-href]:hover,
.table-hover > tbody > tr:hover > * { background: var(--hv-sidebar-hover); color: var(--hv-text); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--hv-primary);
  border-color: var(--hv-primary);
}
.btn-primary:hover,
.btn-primary:focus { background: #4338ca; border-color: #4338ca; }
[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-primary:focus { background: #6366f1; border-color: #6366f1; }

.btn-outline-secondary {
  color: var(--hv-text-muted);
  border-color: var(--hv-border);
}
.btn-outline-secondary:hover {
  background: var(--hv-bg);
  color: var(--hv-text);
  border-color: var(--hv-border);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { font-weight: 500; }

/* ── Flash-Alerts ────────────────────────────────────────────────────────── */
.alert {
  border-radius: var(--hv-radius-sm);
  border-left: 4px solid;
  font-size: 0.875rem;
}
.alert-success { border-left-color: var(--hv-success); }
.alert-danger  { border-left-color: var(--hv-danger); }
.alert-warning { border-left-color: var(--hv-warning); }
.alert-info    { border-left-color: var(--hv-accent); }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.hv-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--hv-font-sm);
  color: var(--hv-text-muted);
  margin-bottom: var(--sp-3);
}
.hv-breadcrumb a { color: var(--hv-text-muted); text-decoration: none; }
.hv-breadcrumb a:hover { color: var(--hv-secondary); }
.hv-breadcrumb .sep { opacity: 0.5; }
.hv-breadcrumb .current { color: var(--hv-text); font-weight: 500; }

/* ── KPI-Karten ──────────────────────────────────────────────────────────── */
.kpi-card { transition: transform 0.15s; }
.kpi-card:hover { transform: translateY(-2px); }

/* ── Heute-Kacheln (Dashboard) ───────────────────────────────────────────── */
.heute-tile { color: inherit; transition: transform 0.15s, box-shadow 0.15s; }
.heute-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); color: inherit; }
.kpi-primary { border-left: 4px solid var(--hv-primary); }
.kpi-primary i { color: var(--hv-primary); }
.kpi-success { border-left: 4px solid var(--hv-success); }
.kpi-success i { color: var(--hv-success); }
.kpi-warning { border-left: 4px solid var(--hv-warning); }
.kpi-warning i { color: var(--hv-warning); }
.kpi-danger { border-left: 4px solid var(--hv-danger); }
.kpi-danger i { color: var(--hv-danger); }
.kpi-neutral { border-left: 4px solid var(--hv-border); }
.kpi-neutral i { color: var(--hv-text-muted); }

/* ── Formulare ───────────────────────────────────────────────────────────── */
.form-label { font-size: var(--hv-font-sm); font-weight: 500; margin-bottom: 0.3rem; color: var(--hv-text); }
.form-control, .form-select {
  font-size: 0.875rem;
  border-color: var(--hv-border);
  background: var(--hv-surface);
  color: var(--hv-text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--hv-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.15);
  background: var(--hv-surface);
  color: var(--hv-text);
}
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
  background: var(--hv-bg);
  border-color: var(--hv-border);
  color: var(--hv-text);
}
[data-theme="dark"] .form-control::placeholder { color: var(--hv-text-muted); }
/* Validierungs-Marker: NUR nach Submit (Bootstrap-Konvention via .was-validated).
   Vorher matcht :invalid sonst direkt nach Render — leere required-Felder
   sehen dann aus wie Validierungsfehler, obwohl der User noch nichts getan hat. */
.was-validated .form-control:invalid,
.was-validated .form-select:invalid {
  border-color: var(--hv-danger);
  background-image: none;
}
.was-validated .form-control:invalid:focus,
.was-validated .form-select:invalid:focus {
  box-shadow: 0 0 0 3px rgba(220,38,38,0.12);
}
.was-validated .form-control:valid,
.was-validated .form-select:valid {
  border-color: var(--hv-success);
}

/* ── Leere Zustände ──────────────────────────────────────────────────────── */
.empty-state {
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
  color: var(--hv-text-muted);
}
.empty-state .bi {
  font-size: 2.5rem;
  opacity: 0.2;
  display: block;
  margin-bottom: var(--sp-2);
}

/* ── Fristen-Farben ──────────────────────────────────────────────────────── */
.frist-rot   { color: var(--hv-danger);  font-weight: 600; }
.frist-gelb  { color: var(--hv-warning); }
.frist-gruen { color: var(--hv-success); }

/* ── btn-xs ──────────────────────────────────────────────────────────────── */
.btn-xs {
  padding: 0.1rem 0.4rem;
  font-size: var(--hv-font-xs);
  border-radius: 0.2rem;
  line-height: 1.4;
}

/* ── Jahresansicht Zahlungsgrid ──────────────────────────────────────────── */
.zahlungs-grid th, .zahlungs-grid td {
  font-size: var(--hv-font-xs);
  padding: 0.3rem 0.4rem;
  white-space: nowrap;
}
.zelle-ok    { background: rgba(22,163,74,0.13);  color: #15803d; font-weight: 600; }
.zelle-teil  { background: rgba(217,119,6,0.13);  color: #b45309; }
.zelle-offen { background: rgba(220,53,69,0.1);   color: #b91c1c; font-weight: 600; }
.zelle-leer  { background: #f8f9fa; color: #adb5bd; }

/* ── Konfidenz-Import ────────────────────────────────────────────────────── */
tr.konfidenz-hoch    { background: rgba(22,163,74,0.05); }
tr.konfidenz-mittel  { background: rgba(217,119,6,0.07); }
tr.konfidenz-niedrig { background: rgba(220,53,69,0.05); }

/* ── Bulk Import ─────────────────────────────────────────────────────────── */
.import-progress-bar { transition: width 0.4s ease; }
.dropzone {
  border: 2px dashed var(--hv-border);
  border-radius: var(--hv-radius-sm);
  padding: var(--sp-8);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--hv-secondary);
  background: rgba(37,99,235,0.04);
}

/* ── Spinner Button ──────────────────────────────────────────────────────── */
.btn-loading .spinner-border { width: 0.85rem; height: 0.85rem; border-width: 0.15em; }
.btn-loading { cursor: wait !important; opacity: 0.85; }

/* ── KI-Agent-Live-Banner (agent-status.js) ──────────────────────────────── */
.hv-agent-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1rem;
  margin: 0 0 var(--sp-3, 12px) 0;
  background: linear-gradient(90deg, #eff6ff, #f0f9ff);
  border: 1px solid #bfdbfe;
  border-radius: var(--hv-radius-sm, 6px);
  color: #1e40af;
  font-size: var(--hv-font-sm, 0.9rem);
}
.hv-agent-banner[hidden] { display: none; }
.hv-agent-banner .spinner-border {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
  color: #2563eb;
}
.hv-agent-banner a {
  color: #1e40af;
  text-decoration: none;
  font-weight: 600;
}
.hv-agent-banner a:hover { text-decoration: underline; }

[data-theme='dark'] .hv-agent-banner {
  background: linear-gradient(90deg, #1e3a5f33, #0c4a6e33);
  border-color: #1e40af55;
  color: #93c5fd;
}
[data-theme='dark'] .hv-agent-banner a { color: #93c5fd; }

/* ── Toast-Container (window.feedback) ───────────────────────────────────── */
.hv-toast-container {
  position: fixed;
  top: var(--sp-3, 12px);
  right: var(--sp-3, 12px);
  z-index: 2050;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}
.hv-toast {
  pointer-events: auto;
  margin: 0;
  padding: 0.6rem 0.85rem;
  border-radius: var(--hv-radius-sm, 6px);
  font-size: var(--hv-font-sm, 0.9rem);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.hv-toast .btn-close {
  font-size: 0.7rem;
  padding: 0.25rem;
  margin-top: 0.05rem;
}
.hv-toast .spinner-border {
  width: 1rem;
  height: 1rem;
  border-width: 0.15em;
  margin-top: 0.15rem;
}
.hv-toast .bi {
  font-size: 1.05rem;
  line-height: 1.2;
}
@media (max-width: 575.98px) {
  .hv-toast-container {
    top: 8px;
    right: 8px;
    left: 8px;
    max-width: none;
  }
}

/* ── Responsive: Mobile ──────────────────────────────────────────────────── */
@media (max-width: 767.98px) {
  .hv-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .hv-sidebar.open { transform: translateX(0); }
  .hv-content { margin-left: 0; }
  .hv-topbar { display: flex; }
  .hv-main { padding: var(--sp-4); }
  h1.h3 { font-size: var(--hv-font-lg); }
  .table-responsive { font-size: var(--hv-font-sm); }
}

/* ── Responsive: Tablet ──────────────────────────────────────────────────── */
@media (min-width: 768px) and (max-width: 991.98px) {
  .hv-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }
  .hv-sidebar.open { transform: translateX(0); }
  .hv-content { margin-left: 0; }
  .hv-topbar { display: flex; }
  .hv-main { padding: var(--sp-4) var(--sp-5); }
  .hv-overlay.show { display: block; }
}

/* ── Responsive: Desktop ─────────────────────────────────────────────────── */
@media (min-width: 992px) {
  .hv-topbar { display: none; }
}

/* ── Globale Suche ───────────────────────────────────────────────────────── */
.hv-search-trigger {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: calc(100% - var(--sp-3) * 2);
  margin: var(--sp-2) var(--sp-3);
  padding: 0.45rem 0.7rem;
  background: var(--hv-bg);
  border: 1px solid var(--hv-border);
  border-radius: var(--hv-radius-sm);
  color: var(--hv-text-muted);
  font-size: var(--hv-font-sm);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.hv-search-trigger:hover {
  background: var(--hv-surface);
  color: var(--hv-text);
  border-color: var(--hv-primary-light);
}
.hv-search-trigger .bi { font-size: 0.9rem; }
.hv-search-kbd {
  margin-left: auto;
  background: var(--hv-surface);
  border: 1px solid var(--hv-border);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: var(--hv-text-muted);
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

.hv-search-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 2000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  backdrop-filter: blur(4px);
}
[data-theme="dark"] .hv-search-overlay { background: rgba(0,0,0,0.7); }

.hv-search-container {
  background: var(--hv-surface);
  border: 1px solid var(--hv-border);
  border-radius: var(--hv-radius-lg);
  box-shadow: var(--hv-shadow-xl);
  width: min(600px, 92vw);
  overflow: hidden;
}

.hv-search-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-bottom: 1px solid var(--hv-border);
}

.hv-search-icon {
  font-size: 1.2rem;
  color: var(--hv-text-muted);
  flex-shrink: 0;
}

.hv-search-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--hv-text);
  background: transparent;
}
.hv-search-input::placeholder { color: var(--hv-text-muted); }

.hv-search-esc-hint {
  flex-shrink: 0;
  border: 1px solid var(--hv-border);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.65rem;
  color: var(--hv-text-muted);
  font-family: monospace;
}

.hv-search-results {
  max-height: 360px;
  overflow-y: auto;
}

.hv-search-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 0.65rem var(--sp-4);
  color: var(--hv-text);
  text-decoration: none;
  border-bottom: 1px solid var(--hv-border);
  transition: background 0.1s;
}
.hv-search-item:last-child { border-bottom: none; }
.hv-search-item:hover, .hv-search-item.active {
  background: var(--hv-bg);
  color: var(--hv-text);
}
.hv-search-item i { font-size: 1rem; flex-shrink: 0; }
.hv-search-item-title { flex: 1; font-size: var(--hv-font-base); }
.hv-search-item-title mark {
  background: #fef08a;
  border-radius: 2px;
  padding: 0 2px;
}
.hv-search-item-typ {
  font-size: var(--hv-font-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.hv-search-empty {
  padding: var(--sp-6) var(--sp-4);
  text-align: center;
  color: var(--hv-text-muted);
  font-size: var(--hv-font-sm);
}

/* Recent-Items in der Sidebar (Polish-Hebel 5) */
.hv-nav-recent-titel {
  display: inline-block;
  max-width: 14rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

/* System-Status-Footer (Polish-Hebel 6) — fixed Bottom-Strip */
.hv-status-strip {
  position: fixed;
  bottom: 0;
  left: var(--hv-sidebar-w, 240px);
  right: 0;
  height: 26px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.85rem;
  background: var(--hv-bg-elevated, var(--hv-surface, #f7f7f7));
  border-top: 1px solid var(--hv-border);
  font-family: var(--hv-font-mono, ui-monospace, monospace);
  font-size: 0.72rem;
  color: var(--hv-text-muted);
  z-index: 90;
  pointer-events: auto;
  user-select: none;
}
.hv-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #94a3b8;
  box-shadow: 0 0 0 2px rgba(148, 163, 184, .15);
  transition: background-color .2s, box-shadow .2s;
}
.hv-status-strip[data-ampel="gruen"] .hv-status-dot {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34,197,94,.18);
}
.hv-status-strip[data-ampel="gelb"] .hv-status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245,158,11,.2);
}
.hv-status-strip[data-ampel="rot"] .hv-status-dot {
  background: #ef4444;
  box-shadow: 0 0 0 2px rgba(239,68,68,.22);
  /* S-STRIP: nur kurz pulsen (Aufmerksamkeit), dann ruhig rot bleiben — kein
     Dauer-Alarm/Banner-Blindness. Rot-Farbe bleibt; nur die Animation endet. */
  animation: hv-status-pulse 1.6s ease-in-out 6;
}
@keyframes hv-status-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(239,68,68,.22); }
  50%      { box-shadow: 0 0 0 5px rgba(239,68,68,.10); }
}
.hv-status-label { font-weight: 700; color: var(--hv-text); }
.hv-status-detail { color: var(--hv-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 992px) {
  .hv-status-strip { left: 0; }
}

/* Content-Bereich braucht etwas Luft, damit der Status-Strip nichts überdeckt */
.hv-main { padding-bottom: 36px; }

/* Command-Palette: Gruppen-Header (Tun / Springen / Suchen) und Sub-Hinweise */
.hv-search-group-label {
  padding: 0.55rem var(--sp-4) 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hv-text-muted);
  background: var(--hv-bg);
  border-bottom: 1px solid var(--hv-border);
  position: sticky;
  top: 0;
  z-index: 1;
}
.hv-search-item-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.hv-search-item-sub {
  font-size: 0.72rem;
  color: var(--hv-text-muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hv-search-footer {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  border-top: 1px solid var(--hv-border);
  background: var(--hv-bg);
  font-size: var(--hv-font-xs);
  color: var(--hv-text-muted);
}
.hv-search-footer kbd {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--hv-border);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 0.65rem;
  font-family: monospace;
  line-height: 1.6;
}

/* ── Sortierbare Tabellen ─────────────────────────────────────────────────── */
table[data-sortable] thead th,
table.table-sortable thead th {
  user-select: none;
  white-space: nowrap;
}
table[data-sortable] thead th::after,
table.table-sortable thead th::after {
  content: ' ⇅';
  font-size: 0.65rem;
  opacity: 0.35;
}
table[data-sortable] thead th.sort-asc::after,
table.table-sortable thead th.sort-asc::after {
  content: ' ↑';
  opacity: 0.8;
  color: var(--hv-secondary);
}
table[data-sortable] thead th.sort-desc::after,
table.table-sortable thead th.sort-desc::after {
  content: ' ↓';
  opacity: 0.8;
  color: var(--hv-secondary);
}

/* ── Dark Mode: Bootstrap-Komponenten ────────────────────────────────────── */
[data-theme="dark"] .modal-content {
  background: var(--hv-surface);
  border: 1px solid var(--hv-border);
  color: var(--hv-text);
}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
  border-color: var(--hv-border);
}
[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}
[data-theme="dark"] .dropdown-menu {
  background: var(--hv-surface);
  border-color: var(--hv-border);
  color: var(--hv-text);
  box-shadow: var(--hv-shadow-lg);
}
[data-theme="dark"] .dropdown-item { color: var(--hv-text); }
[data-theme="dark"] .dropdown-item:hover,
[data-theme="dark"] .dropdown-item:focus {
  background: var(--hv-sidebar-hover);
  color: var(--hv-text);
}
[data-theme="dark"] .list-group-item {
  background: var(--hv-surface);
  border-color: var(--hv-border);
  color: var(--hv-text);
}
[data-theme="dark"] .nav-tabs {
  border-bottom-color: var(--hv-border);
}
[data-theme="dark"] .nav-tabs .nav-link {
  color: var(--hv-text-muted);
  border: none;
}
[data-theme="dark"] .nav-tabs .nav-link.active {
  background: transparent;
  color: var(--hv-primary);
  border-bottom: 2px solid var(--hv-primary);
}
[data-theme="dark"] .alert-success { background: rgba(16,185,129,0.12); color: #6ee7b7; border-left-color: var(--hv-success); }
[data-theme="dark"] .alert-danger  { background: rgba(239,68,68,0.12);  color: #fca5a5; border-left-color: var(--hv-danger); }
[data-theme="dark"] .alert-warning { background: rgba(245,158,11,0.12); color: #fcd34d; border-left-color: var(--hv-warning); }
[data-theme="dark"] .alert-info    { background: rgba(99,102,241,0.12); color: #c7d2fe; border-left-color: var(--hv-accent); }
[data-theme="dark"] .text-muted { color: var(--hv-text-muted) !important; }
[data-theme="dark"] .border { border-color: var(--hv-border) !important; }
[data-theme="dark"] .bg-light { background: var(--hv-bg) !important; color: var(--hv-text); }
[data-theme="dark"] .bg-white { background: var(--hv-surface) !important; color: var(--hv-text); }
[data-theme="dark"] a { color: var(--hv-primary); }
[data-theme="dark"] a:hover { color: var(--hv-primary-light); }
[data-theme="dark"] .hv-breadcrumb a { color: var(--hv-text-muted); }
[data-theme="dark"] .table-hover tbody tr[data-href]:hover { background: var(--hv-sidebar-hover); }
[data-theme="dark"] .kpi-neutral { border-left-color: var(--hv-border); }
[data-theme="dark"] .zelle-leer { background: rgba(255,255,255,0.03); color: var(--hv-text-muted); }

/* ── Print ─────────────────────────────────────────────────────────────────
   Wir zwingen den Print-Output auf weisses Papier mit schwarzem Text,
   unabhaengig vom aktiven Theme. Vorher hat das Industrial-Dark-Theme
   die Print-Regeln dominiert (schwarzer Hintergrund -> Tinten-Verschwendung
   und Lesbarkeitsproblem). Reihenfolge der Selektoren ist wichtig: erst
   alles platt machen, dann gezielt Borders/Strukturen wieder zulassen.
   ────────────────────────────────────────────────────────────────────── */
@media print {
  /* Off-Canvas-/Navigation-Komponenten verschwinden */
  .hv-sidebar, .hv-topbar, .hv-overlay,
  .hv-sidebar-footer, .btn, .hv-hamburger,
  form, .hv-breadcrumb, .alert-dismissible,
  .ind-head .actions, .hv-search-trigger,
  .fab-whatsapp, .cookie-banner, .sticky-cta-mobile { display: none !important; }

  /* Theme komplett uebersteuern: weiss + schwarz, egal ob data-theme=dark */
  html, html[data-theme="dark"], html[data-theme="light"],
  body, .hv-wrapper, .hv-content, .hv-main {
    background: #FFFFFF !important;
    color: #000000 !important;
  }

  /* Alle Karten / Surfaces auf Papier-Weiss, schwarzer Text */
  .card, .ind-card, .karte, article, section,
  .ind-grid, .ind-tasks, .ind-task, .ind-stream {
    background: #FFFFFF !important;
    color: #000000 !important;
    box-shadow: none !important;
    border: 1px solid #CCCCCC !important;
    break-inside: avoid;
  }

  .hv-content { margin-left: 0 !important; }
  .hv-main { padding: 0 !important; }

  .table th, .table td { color: #000 !important; background: transparent !important; }
  .table th { font-size: 0.7rem; }
  .table td { font-size: 0.8rem; }
  /* Tabellen-Header pro Seite wiederholen, Zeilen nicht mitten durchschneiden */
  .table thead, thead { display: table-header-group; }
  .table tr, table tr { page-break-inside: avoid; break-inside: avoid; }

  body { font-size: 0.8rem; }
  a, a * { color: #000 !important; text-decoration: underline; }
  .badge { border: 1px solid #999 !important; background: none !important; color: #000 !important; }

  /* Status-Farben dezent erhalten — Text-Farbe darf bleiben (semantisch),
     aber kein Block-Background. */
  .text-success, .saldo-positiv { color: #15803D !important; }
  .text-danger,  .saldo-negativ { color: #B91C1C !important; }
  .text-warning                  { color: #B45309 !important; }
  .text-muted                    { color: #555555 !important; }

  /* Page-Setup: DIN A4 mit asymmetrischen Rändern (oben/unten 1.8cm, seitlich 2cm) */
  @page { size: A4; margin: 1.8cm 2cm; }
}

/* ──────────────────────────────────────────────────────────────────
   Pflichtfeld-Marker — global
   Markiert Labels neben einem [required]-Input/Select/Textarea mit *.
   Eingefuehrt 2026-04-30: war pro Form inkonsistent (manche hatten *,
   manche nicht). Diese Regel macht es einheitlich, ohne 30+ Templates
   anfassen zu muessen.
   ────────────────────────────────────────────────────────────────── */

/* Direkte Sibling-Selektoren: <label>...<input required> */
.form-label:has(+ input[required]),
.form-label:has(+ select[required]),
.form-label:has(+ textarea[required]),
.form-label:has(+ * input[required]),
.form-label:has(+ * select[required]),
label.form-label:has(~ input[required]),
label.form-label:has(~ select[required]),
label.form-label:has(~ textarea[required]) {
  position: relative;
}
.form-label:has(+ input[required])::after,
.form-label:has(+ select[required])::after,
.form-label:has(+ textarea[required])::after,
.form-label:has(+ * input[required])::after,
.form-label:has(+ * select[required])::after,
label.form-label:has(~ input[required])::after,
label.form-label:has(~ select[required])::after,
label.form-label:has(~ textarea[required])::after {
  content: " *";
  color: var(--color-danger, #dc2626);
  font-weight: 600;
  margin-left: 0.15em;
}

/* ──────────────────────────────────────────────────────────────────
   Skeleton-Loader (fuer Charts/Listen/KPI-Tiles)
   Wird vom partials/loading-state.handlebars genutzt.
   ────────────────────────────────────────────────────────────────── */
.hv-skeleton {
  position: relative;
  width: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg,
    rgba(128, 128, 128, 0.06) 0%,
    rgba(128, 128, 128, 0.12) 50%,
    rgba(128, 128, 128, 0.06) 100%);
  background-size: 200% 100%;
  animation: hv-skeleton-pulse 1.5s ease-in-out infinite;
}
.hv-skeleton-msg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  color: var(--hv-text-muted, #6c757d);
  white-space: nowrap;
}
@keyframes hv-skeleton-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .hv-skeleton { animation: none; }
}


/* ═══ app.industrial.css ═══ */
/* ════════════════════════════════════════════════════════════════════════════
   Hausverwaltung — Industrial Theme
   ────────────────────────────────────────────────────────────────────────────
   Override-Layer für app.css. Tauscht Farben, Schriften und Komponenten-Look
   gegen einen Linear/Vercel-Pro-Stil aus.
   • Dark-First, Light-Variant via [data-theme="light"]
   • Akzent: Helles See-Blau (Bodensee) #5BB0D9 (Dark) / #2D6B8E (Light)
   • Mono-Font für alle Zahlen
   ════════════════════════════════════════════════════════════════════════════ */

/* ── Schriften: lokal/System (kein CDN — Privacy + Offline) ─────────────────
   'Geist' / 'JetBrains Mono' werden im Stack zuerst probiert; falls nicht
   installiert/lokal hinterlegt, fällt der Browser auf System-UI zurück.
   Konvention: keine fonts.googleapis.com (siehe app/CLAUDE.md). */

/* ── Token-Override: Dark (Default) ──────────────────────────────────────── */
:root,
[data-theme="dark"] {
  --hv-primary:           #5BB0D9;
  --hv-primary-light:     #7FC4E5;
  --hv-secondary:         #5BB0D9;
  --hv-accent:            #B8D4E3;
  --hv-success:           #00E08F;
  --hv-warning:           #FFA800;
  --hv-danger:            #FF4D4D;

  --hv-bg:                #0A0A0B;
  --hv-surface:           #111113;
  --hv-sidebar-bg:        #0F0F11;
  --hv-sidebar-border:    #1F1F23;
  --hv-sidebar-text:      #D8D8DC;
  --hv-sidebar-muted:     #88888F;   /* WCAG AA: 5.1:1 auf surface-2 (vorher #7A7A82 = 4.2) */
  --hv-sidebar-active-bg: #16161A;
  --hv-sidebar-active-text:#EDEDED;
  --hv-sidebar-hover:     #16161A;
  --hv-text:              #EDEDED;
  --hv-text-muted:        #8A8A92;
  --hv-border:            #1F1F23;
  --hv-border-soft:       #18181B;

  --hv-shadow-sm: 0 0 0 1px rgba(255,255,255,0.02);
  --hv-shadow-md: 0 0 0 1px rgba(255,255,255,0.03);
  --hv-shadow-lg: 0 0 0 1px rgba(255,255,255,0.04), 0 8px 24px rgba(0,0,0,0.5);
  --hv-shadow-xl: 0 0 0 1px rgba(255,255,255,0.05), 0 24px 48px rgba(0,0,0,0.6);

  --hv-font-sans: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --hv-font-mono: 'JetBrains Mono', 'Geist Mono', ui-monospace, monospace;

  --hv-radius-sm: 4px;
  --hv-radius-md: 6px;
  --hv-radius-lg: 8px;

  /* Industrial-spezifische Tokens */
  --ind-accent:           #5BB0D9;
  --ind-accent-soft:      rgba(91, 176, 217, 0.12);
  --ind-line:             #1F1F23;
  --ind-line-2:           #2A2A30;
  --ind-surface-2:        #16161A;
  --ind-text-subtle:      #7E7E86;   /* WCAG AA: 4.7:1 auf surface (vorher #5A5A62 = 2.8 — Mail-Snippets/Zeitstempel) */
  color-scheme: dark;
}

/* ── Token-Override: Light ───────────────────────────────────────────────── */
[data-theme="light"] {
  --hv-primary:           #1A1A1A;          /* Schwarz statt Lime im Hellmodus */
  --hv-primary-light:     #2D2D2D;
  --hv-secondary:         #1A1A1A;
  --hv-accent:            #1A1A1A;
  --hv-success:           #15803D;
  --hv-warning:           #B45309;
  --hv-danger:            #B91C1C;

  --hv-bg:                #FAFAFA;
  --hv-surface:           #FFFFFF;
  --hv-sidebar-bg:        #FFFFFF;
  --hv-sidebar-border:    #E5E5E5;
  --hv-sidebar-text:      #404040;
  --hv-sidebar-muted:     #6E6E78;   /* WCAG AA: 4.6:1 auf surface-2 (vorher #A1A1AA = 2.3 — Such-Trigger/Sektionen) */
  --hv-sidebar-active-bg: #1A1A1A;
  --hv-sidebar-active-text:#FAFAFA;
  --hv-sidebar-hover:     #F4F4F5;
  --hv-text:              #18181B;
  --hv-text-muted:        #66666F;   /* WCAG AA auch auf getönten Flächen: 4.5:1 auf #E5E5E5, 5.2:1 auf #F5F5F5 (vorher #71717A = 3.8–4.4) */
  --hv-border:            #E5E5E5;
  --hv-border-soft:       #F4F4F5;

  --hv-shadow-sm: 0 0 0 1px rgba(0,0,0,0.02);
  --hv-shadow-md: 0 0 0 1px rgba(0,0,0,0.04);
  --hv-shadow-lg: 0 0 0 1px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);

  --ind-accent:           #2D6B8E;          /* Bodensee-Blau als Akzent-Highlight */
  --ind-accent-soft:      rgba(45, 107, 142, 0.15);
  --ind-line:             #E5E5E5;
  --ind-line-2:           #D4D4D8;
  --ind-surface-2:        #F4F4F5;
  --ind-text-subtle:      #74747E;   /* WCAG AA: 4.6:1 auf Weiß (vorher #A1A1AA = 2.6 — Mail-Snippets/Zeitstempel) */
  color-scheme: light;
}

/* ── Globale Typografie & Body ───────────────────────────────────────────── */
html, body {
  font-family: var(--hv-font-sans);
  font-feature-settings: "ss01", "cv11";
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--hv-topbar-h, 56px) + 8px);
}
body {
  font-size: 0.9rem;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
}

/* Modals/Sidebars/Offcanvas: kein Bounce auf den Body */
.modal-body,
.offcanvas-body,
.hv-sidebar,
.dropdown-menu {
  overscroll-behavior: contain;
}

/* Zahlen monospace + tabular-nums */
.num,
.tabular,
.fw-bold .num,
.kpi-card .display-6,
.heute-tile .fs-3,
.heute-tile .fw-bold,
td.num, .num td,
.frist-rot, .frist-orange, .frist-grun {
  font-family: var(--hv-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Selection */
::selection { background: var(--ind-accent); color: #000; }

/* Focus-visible */
:focus-visible {
  outline: 2px solid var(--ind-accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Scrollbar Industrial */
* { scrollbar-width: thin; scrollbar-color: var(--ind-line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ind-line);
  border: 2px solid var(--hv-bg);
  border-radius: 5px;
  transition: background 0.15s ease;
}
::-webkit-scrollbar-thumb:hover { background: var(--ind-accent); }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.hv-sidebar { font-size: 0.85rem; }
.hv-sidebar-brand {
  font-family: var(--hv-font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: -0.02em;
  text-transform: lowercase;
  border-bottom-color: var(--ind-line);
}
.hv-sidebar-brand i {
  color: transparent;
  background: var(--ind-accent);
  width: 8px; height: 8px;
  border-radius: 50%;
  font-size: 0;
  display: inline-block;
  box-shadow: 0 0 12px var(--ind-accent);
}
[data-theme="light"] .hv-sidebar-brand i { box-shadow: none; }

.hv-search-trigger {
  background: var(--ind-surface-2);
  border: 1px solid var(--ind-line);
  color: var(--hv-sidebar-muted);
  font-size: 0.78rem;
  padding: 0.5rem 0.7rem;
  border-radius: var(--hv-radius-sm);
  width: 100%;
  display: flex; align-items: center; gap: 0.5rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
  font-family: var(--hv-font-sans);
  margin-bottom: 0.5rem;
}
.hv-search-trigger:hover { border-color: var(--ind-line-2); color: var(--hv-text); }
.hv-search-kbd {
  margin-left: auto;
  font-family: var(--hv-font-mono);
  font-size: 0.65rem;
  padding: 1px 5px;
  background: var(--ind-line);
  border-radius: 2px;
  color: var(--hv-sidebar-muted);
}
[data-theme="light"] .hv-search-kbd { background: var(--ind-surface-2); }
/* S-MOBILE-HINT: „Ctrl K" auf Touch-Geräten ausblenden (kein Ctrl am Handy). */
@media (hover: none) and (pointer: coarse) { .hv-search-kbd { display: none; } }

.hv-nav-section,
.hv-nav-label {
  font-family: var(--hv-font-sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--ind-text-subtle);
  text-transform: uppercase;
  padding: 1.1rem 0.7rem 0.4rem;
}

.hv-nav-item {
  font-family: var(--hv-font-sans);
  font-size: 0.815rem;
  font-weight: 500;
  border-radius: var(--hv-radius-sm);
  padding: 0.42rem 0.7rem;
  transition: background 0.12s, color 0.12s;
}
.hv-nav-item i { font-size: 0.92rem; opacity: 0.8; }
.hv-nav-item:hover {
  background: var(--hv-sidebar-hover);
  color: var(--hv-text);
}
.hv-nav-item.active {
  background: var(--hv-sidebar-active-bg);
  color: var(--hv-sidebar-active-text);
  font-weight: 600;
  box-shadow: inset 2px 0 0 var(--ind-accent);
}
.hv-nav-item.active i { color: var(--hv-sidebar-active-text); opacity: 1; }
[data-theme="light"] .hv-nav-item.active { background: var(--hv-sidebar-active-bg); color: var(--hv-sidebar-active-text); }

.hv-nav-subitem {
  font-family: var(--hv-font-sans);
  font-size: 0.78rem;
  padding: 0.32rem 0.7rem 0.32rem 2rem;
  color: var(--hv-sidebar-muted);
  border-radius: var(--hv-radius-sm);
}
.hv-nav-subitem:hover { background: var(--hv-sidebar-hover); color: var(--hv-text); }
.hv-nav-subitem.active { color: var(--hv-sidebar-active-text); font-weight: 600; }
[data-theme="light"] .hv-nav-subitem.active { color: var(--hv-text); }

/* Badge im Sidebar — monospace, sharp */
.hv-nav-badge {
  background: transparent;
  color: var(--hv-danger);
  font-family: var(--hv-font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0;
  border-radius: 0;
  font-variant-numeric: tabular-nums;
}

.hv-sidebar-footer { border-top-color: var(--ind-line); }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
.hv-topbar {
  background: var(--hv-surface);
  border-bottom-color: var(--ind-line);
}
.hv-theme-toggle {
  border-color: var(--ind-line);
  color: var(--hv-text-muted);
  border-radius: var(--hv-radius-sm);
}
.hv-theme-toggle:hover {
  background: var(--ind-surface-2);
  border-color: var(--ind-line-2);
  color: var(--hv-text);
}

/* ── Karten ──────────────────────────────────────────────────────────────── */
.card {
  border-radius: var(--hv-radius-md);
  border: 1px solid var(--ind-line);
  background: var(--hv-surface);
  box-shadow: none;
  transition: border-color 0.15s ease;
}
.card:hover { border-color: var(--ind-line-2); }

.card-body { padding: 1.25rem; }
.card-header {
  background: transparent;
  border-bottom-color: var(--ind-line);
  border-radius: var(--hv-radius-md) var(--hv-radius-md) 0 0;
  padding: 0.85rem 1.25rem;
}
.card-header h6, .card-header h5 {
  font-family: var(--hv-font-sans);
  font-size: 0.78rem !important;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--hv-text-muted);
  margin: 0;
}

/* Border-Left-KPI-Karten — als 2px-line, lime-akzent */
.kpi-primary, .kpi-success, .kpi-warning, .kpi-danger, .kpi-neutral {
  border-left-width: 2px;
}
.kpi-primary { border-left-color: var(--ind-accent) !important; }
.kpi-primary i { color: var(--ind-accent) !important; }
.kpi-success { border-left-color: var(--hv-success) !important; }
.kpi-warning { border-left-color: var(--hv-warning) !important; }
.kpi-danger  { border-left-color: var(--hv-danger) !important; }

/* Heute-Tiles */
.heute-tile {
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-md);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.heute-tile:hover {
  transform: none;
  border-color: var(--ind-accent);
  box-shadow: none;
}
.heute-tile .fs-3 {
  font-family: var(--hv-font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.kpi-card { transition: border-color 0.15s ease; }
.kpi-card:hover { transform: none; border-color: var(--ind-line-2); }
.kpi-card .display-6 {
  font-family: var(--hv-font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  letter-spacing: -0.03em;
}

/* ── Tabellen ────────────────────────────────────────────────────────────── */
.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--hv-text);
  --bs-table-hover-bg: var(--ind-surface-2);
  --bs-table-hover-color: var(--hv-text);
  font-size: 0.85rem;
}
.table th {
  font-family: var(--hv-font-sans);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hv-text-muted);
  border-bottom: 1px solid var(--ind-line);
  padding: 0.6rem 0.75rem;
}
.table td {
  padding: 0.7rem 0.75rem;
  border-bottom-color: var(--ind-line);
  vertical-align: middle;
}
.table tbody tr:hover { background: var(--ind-surface-2); }
.table tbody tr:last-child td { border-bottom: none; }

/* Beträge in Tabellen */
.table .text-end,
.table .text-end-num {
  font-family: var(--hv-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  font-family: var(--hv-font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  border-radius: var(--hv-radius-sm);
  padding: 0.42rem 0.85rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  letter-spacing: -0.005em;
}
.btn-sm { padding: 0.28rem 0.7rem; font-size: 0.75rem; }
.btn-lg { padding: 0.6rem 1.1rem; font-size: 0.9rem; }

.btn-primary {
  background: var(--ind-accent);
  border-color: var(--ind-accent);
  color: #000;
  font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus {
  background: #7FC4E5;
  border-color: #7FC4E5;
  color: #000;
}
[data-theme="light"] .btn-primary {
  background: var(--hv-text);
  border-color: var(--hv-text);
  color: var(--hv-bg);
}
[data-theme="light"] .btn-primary:hover {
  background: #2D2D2D;
  border-color: #2D2D2D;
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-info {
  background: transparent;
  color: var(--hv-text);
  border-color: var(--ind-line-2);
}
.btn-outline-secondary:hover,
.btn-outline-primary:hover,
.btn-outline-info:hover {
  background: var(--ind-surface-2);
  color: var(--hv-text);
  border-color: var(--ind-line-2);
}
.btn-outline-danger {
  color: var(--hv-danger);
  border-color: var(--hv-danger);
}
.btn-outline-danger:hover {
  background: var(--hv-danger);
  color: #fff;
  border-color: var(--hv-danger);
}
.btn-outline-success {
  color: var(--hv-success);
  border-color: var(--hv-success);
}
.btn-outline-success:hover {
  background: var(--hv-success);
  color: #000;
  border-color: var(--hv-success);
}

.btn-success {
  background: var(--hv-success);
  border-color: var(--hv-success);
  color: #000;
  font-weight: 600;
}
.btn-danger {
  background: var(--hv-danger);
  border-color: var(--hv-danger);
}
.btn-warning {
  background: var(--hv-warning);
  border-color: var(--hv-warning);
  color: #000;
  font-weight: 600;
}

/* ── Button-Variants: Konsolidierung Stage 3 (2026-05-16) ─────────────── */
.btn-info {
  background: var(--hv-accent, #00E5C8);
  border-color: var(--hv-accent, #00E5C8);
  color: #000;
  font-weight: 600;
}
.btn-info:hover { background: #00CFB5; border-color: #00CFB5; color: #000; }

.btn-secondary {
  background: var(--hv-surface-2, #18181B);
  border-color: var(--hv-border, #1F1F23);
  color: var(--hv-text);
  font-weight: 500;
}
.btn-secondary:hover { background: var(--hv-border, #1F1F23); border-color: var(--hv-border-soft, #18181B); color: var(--hv-text); }

.btn-dark {
  background: var(--hv-bg, #0A0A0B);
  border-color: var(--hv-border, #1F1F23);
  color: var(--hv-text);
}
.btn-dark:hover { background: #000; color: var(--hv-text); }

.btn-outline-warning {
  background: transparent;
  color: var(--hv-warning);
  border-color: var(--hv-warning);
}
.btn-outline-warning:hover {
  background: var(--hv-warning);
  color: #000;
  border-color: var(--hv-warning);
}

.btn-outline-dark {
  background: transparent;
  color: var(--hv-text);
  border-color: var(--hv-text-muted, #8A8A92);
}
.btn-outline-dark:hover {
  background: var(--hv-text);
  color: var(--hv-bg);
  border-color: var(--hv-text);
}

.btn-outline-light {
  background: transparent;
  color: var(--hv-text);
  border-color: var(--hv-border-soft, #18181B);
}
.btn-outline-light:hover {
  background: var(--hv-surface-2, #18181B);
  color: var(--hv-text);
}

.btn-link {
  background: transparent;
  border-color: transparent;
  color: var(--hv-text);
  text-decoration: none;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.btn-link:hover {
  color: var(--ind-accent, #5BB0D9);
  text-decoration: underline;
  background: transparent;
}

/* ── Universelle Button-States ───────────────────────────────────────────── */
.btn:focus-visible {
  outline: 2px solid var(--ind-accent, #5BB0D9);
  outline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled="true"],
.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading-State: <button data-loading="true">Speichern</button>
   blendet Text aus, zeigt Spinner. */
.btn[data-loading="true"] {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn[data-loading="true"]::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: 1rem;
  height: 1rem;
  margin: -0.5rem 0 0 -0.5rem;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  color: var(--hv-text);
  animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Reduzierte Bewegung respektieren */
@media (prefers-reduced-motion: reduce) {
  .btn[data-loading="true"]::after { animation: none; }
  .btn { transition: none; }
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  font-family: var(--hv-font-sans);
  font-size: 0.68rem !important;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2em 0.55em;
  border-radius: 3px;
}
.badge.bg-primary {
  background: var(--ind-surface-2) !important;
  color: var(--hv-text) !important;
  border: 1px solid var(--ind-line);
}
[data-theme="light"] .badge.bg-primary {
  background: #18181B !important;
  color: #FAFAFA !important;
  border: none;
}
.badge.bg-danger {
  background: rgba(255,77,77,0.12) !important;
  color: var(--hv-danger) !important;
}
[data-theme="light"] .badge.bg-danger {
  background: #FEE2E2 !important;
  color: #B91C1C !important;
}
.badge.bg-warning {
  background: rgba(255,168,0,0.14) !important;
  color: var(--hv-warning) !important;
}
[data-theme="light"] .badge.bg-warning {
  background: #FEF3C7 !important;
  color: #B45309 !important;
}
.badge.bg-success {
  background: rgba(0,224,143,0.14) !important;
  color: var(--hv-success) !important;
}
[data-theme="light"] .badge.bg-success {
  background: #DCFCE7 !important;
  color: #15803D !important;
}
.badge.bg-info {
  background: rgba(0,229,200,0.14) !important;
  color: var(--hv-accent) !important;
}
[data-theme="light"] .badge.bg-info {
  background: #DBEAFE !important;
  color: #1E40AF !important;
}
.badge.bg-light, .badge.bg-secondary {
  background: var(--ind-surface-2) !important;
  color: var(--hv-text-muted) !important;
  border: 1px solid var(--ind-line);
}
[data-theme="light"] .badge.bg-light,
[data-theme="light"] .badge.bg-secondary {
  background: var(--ind-surface-2) !important;
  color: var(--hv-text-muted) !important;
}

/* ── Formulare ───────────────────────────────────────────────────────────── */
.form-control, .form-select {
  background: var(--ind-surface-2);
  border-color: var(--ind-line);
  color: var(--hv-text);
  border-radius: var(--hv-radius-sm);
  font-size: 0.85rem;
  font-family: var(--hv-font-sans);
}
[data-theme="light"] .form-control,
[data-theme="light"] .form-select {
  background: var(--hv-surface);
}
.form-control:focus, .form-select:focus {
  background: var(--ind-surface-2);
  border-color: var(--ind-accent);
  box-shadow: 0 0 0 2px var(--ind-accent-soft);
  color: var(--hv-text);
}
[data-theme="light"] .form-control:focus, [data-theme="light"] .form-select:focus {
  background: var(--hv-surface);
}
.form-label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--hv-text-muted);
}

/* ── Alerts/Flash ────────────────────────────────────────────────────────── */
.alert {
  background: var(--ind-surface-2);
  border: 1px solid var(--ind-line);
  border-left-width: 2px;
  color: var(--hv-text);
  border-radius: var(--hv-radius-sm);
  font-size: 0.85rem;
}
.alert-success { border-left-color: var(--hv-success); }
.alert-danger  { border-left-color: var(--hv-danger); color: var(--hv-text); }
.alert-warning { border-left-color: var(--hv-warning); }
.alert-info    { border-left-color: var(--ind-accent); }

/* ── Breadcrumb ──────────────────────────────────────────────────────────── */
.hv-breadcrumb {
  font-family: var(--hv-font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--hv-text-muted);
}
.hv-breadcrumb a:hover { color: var(--ind-accent); }
[data-theme="light"] .hv-breadcrumb a:hover { color: var(--hv-text); }

/* ── Headlines ───────────────────────────────────────────────────────────── */
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 {
  font-family: var(--hv-font-sans);
  letter-spacing: -0.02em;
  font-weight: 600;
}
h1, .h1 { font-size: 1.6rem; }
h2, .h2 { font-size: 1.35rem; }
h3, .h3 { font-size: 1.15rem; }
h4, .h4 { font-size: 1rem; font-weight: 600; }
h5, .h5 { font-size: 0.92rem; font-weight: 600; }

/* Display-Numerik — Hero-Zahlen */
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
  font-family: var(--hv-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.04em;
  font-weight: 500;
}

/* ── Suche-Overlay ───────────────────────────────────────────────────────── */
.hv-search-overlay {
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
}
[data-theme="light"] .hv-search-overlay {
  background: rgba(0,0,0,0.4);
}
.hv-search-container {
  background: var(--hv-surface);
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-md);
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
}
.hv-search-input {
  font-family: var(--hv-font-sans);
  background: transparent;
  color: var(--hv-text);
}
.hv-search-input:focus { outline: none; }

/* ── List-Group (Tagesplan etc.) ─────────────────────────────────────────── */
.list-group-item {
  background: transparent;
  border-color: var(--ind-line);
  color: var(--hv-text);
  font-size: 0.85rem;
}
.list-group-item-action:hover {
  background: var(--ind-surface-2);
  color: var(--hv-text);
}
.list-group-flush .list-group-item {
  border-bottom-color: var(--ind-line);
}

/* ── Confirm Modal ───────────────────────────────────────────────────────── */
.modal-content {
  background: var(--hv-surface);
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-md);
  color: var(--hv-text);
}
.modal-header { border-bottom-color: var(--ind-line); }
.modal-footer { border-top-color: var(--ind-line); }

/* ── Tabs / Nav-Pills ────────────────────────────────────────────────────── */
.nav-tabs {
  border-bottom-color: var(--ind-line);
}
.nav-tabs .nav-link {
  color: var(--hv-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.6rem 0.9rem;
  transition: color 0.15s, border-color 0.15s;
}
.nav-tabs .nav-link:hover { color: var(--hv-text); border-color: transparent; }
.nav-tabs .nav-link.active {
  background: transparent;
  color: var(--ind-accent);
  border-bottom-color: var(--ind-accent);
}
[data-theme="light"] .nav-tabs .nav-link.active {
  color: var(--hv-text);
  border-bottom-color: var(--hv-text);
}

/* ── Frist-Farben (monospace + sharp) ────────────────────────────────────── */
.frist-rot   { color: var(--hv-danger); font-weight: 600; }
.frist-orange{ color: var(--hv-warning); font-weight: 500; }
.frist-grun  { color: var(--hv-success); }

/* ── Brand-Mark in Sidebar (custom text marker) ──────────────────────────── */
.hv-sidebar-brand::before {
  content: "";
}

/* ── Light-Mode-Spezifika (Mehr Kontrast/Härte) ──────────────────────────── */
[data-theme="light"] body {
  background: var(--hv-bg);
}
[data-theme="light"] .card { background: var(--hv-surface); }
[data-theme="light"] .heute-tile:hover { border-color: var(--hv-text); }
[data-theme="light"] .hv-nav-item.active i { color: var(--hv-sidebar-active-text); }

/* ── Utility-Klassen Industrial ──────────────────────────────────────────── */
.text-mono { font-family: var(--hv-font-mono) !important; font-variant-numeric: tabular-nums; }
.text-eyebrow {
  font-family: var(--hv-font-sans);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hv-text-muted);
}
.ind-divider {
  border-top: 1px solid var(--ind-line);
  margin: 1.5rem 0;
}

/* ── KPI-Stripe (Dashboard, kompakter Ersatz fuer 4 KPI-Cards) ──────────
   4 Zellen in einer Zeile, klickbar als Ganzes, keine eigenen CTAs.
   Stack auf Mobile in 2x2. */
.ind-kpi-stripe {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--ind-line);
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-md);
  overflow: hidden;
  margin-bottom: 1rem;
}
@media (max-width: 768px) {
  .ind-kpi-stripe { grid-template-columns: repeat(2, 1fr); }
}
.ind-kpi-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  background: var(--hv-surface);
  text-decoration: none;
  color: var(--hv-text);
  transition: background 120ms ease;
}
.ind-kpi-cell:hover,
.ind-kpi-cell:focus-visible {
  background: var(--ind-surface-2);
  color: var(--hv-text);
}
.ind-kpi-cell .label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--hv-text-muted);
}
.ind-kpi-cell .figure {
  font-family: var(--hv-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--hv-text);
}
.ind-kpi-cell .figure .unit {
  font-size: 0.75em;
  color: var(--hv-text-muted);
  margin-left: 0.1rem;
}
.ind-kpi-cell .meta {
  font-size: 0.72rem;
  color: var(--hv-text-muted);
  font-family: var(--hv-font-mono);
}
.ind-kpi-cell.is-warn .figure { color: var(--hv-warning); }

/* ── Filter-Select (Bereichs-Subbar, Listen-Header) ────────────────────── */
.hv-filter-select {
  width: auto;
  font-size: 0.74rem;
  padding: 4px 24px 4px 10px;
  background: transparent;
  border: 1px solid var(--ind-line);
  border-radius: 999px;
  color: var(--hv-text-muted);
  margin-left: 6px;
}

/* ── Text-Sizes (extra-klein, fuer Etagen-Suffixe etc.) ─────────────── */
.hv-text-xxs { font-size: 0.7rem; }

/* ── Status-Dot in ind-tag (Mieter-Liste "Aktiv" o.ae.) ─────────────── */
.hv-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ── Progress-Bar (Mini, Dashboard-Objektliste) ────────────────────── */
.hv-progress-mini {
  height: 3px;
  width: 60px;
  background: var(--ind-line);
  border-radius: 2px;
  overflow: hidden;
}
.hv-progress-mini__bar {
  height: 100%;
  width: var(--pct, 0%);
  transition: width 200ms ease;
}
.hv-progress-mini__bar.is-full    { background: var(--hv-success); }
.hv-progress-mini__bar.is-partial { background: var(--hv-warning); }

/* ── Progressive-Disclosure Form-Section (<details>-basiert) ──────────
   Pattern fuer optionale Form-Sektionen (Kaution, Sozialprofil, etc.).
   Klick auf <summary> klappt auf/zu. Disclosure-Pfeil rotiert.
   Markup:
     <details class="hv-form-section" [open]>
       <summary>
         <h3 class="hv-form-section__h"><i class="bi bi-..."></i> Titel</h3>
         <span class="hv-form-section__hint">Kurz-Hinweis</span>
       </summary>
       <div class="row g-3 mt-1">...</div>
     </details>
   ─────────────────────────────────────────────────────────────────── */
.hv-form-section {
  border-top: 1px solid var(--ind-line);
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}
.hv-form-section:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.hv-form-section > summary {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  cursor: pointer;
  list-style: none;
  padding: 0.3rem 0;
  border-radius: var(--hv-radius-sm);
  user-select: none;
}
.hv-form-section > summary::-webkit-details-marker { display: none; }
.hv-form-section > summary::before {
  content: '▸';
  display: inline-block;
  font-size: 0.8em;
  color: var(--hv-text-muted);
  width: 1em;
  transition: transform 150ms ease;
}
.hv-form-section[open] > summary::before {
  transform: rotate(90deg);
}
.hv-form-section > summary:hover::before {
  color: var(--ind-accent);
}
.hv-form-section__h {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.hv-form-section__h--sm { font-size: 0.95rem; }
.hv-form-section__hint {
  font-size: 0.75rem;
  color: var(--hv-text-muted);
}
.hv-form-section--inline {
  border-top: 1px dashed var(--ind-line);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

@media (prefers-reduced-motion: reduce) {
  .hv-form-section > summary::before { transition: none; }
}

/* ── Shortcut-Hilfe-Tabelle (Lazy-Modal aus #hilfeModalTemplate) ──── */
.hv-shortcut-table { margin: 0; }
.hv-shortcut-key-col { width: 25%; }
.hv-shortcut-section { background: transparent; }

/* ── Clip-Summary (Mehrzeilige Preview, max 120px Hoehe) ────────────── */
.hv-clip-summary {
  max-height: 120px;
  overflow: hidden;
  white-space: pre-wrap;
  position: relative;
}
.hv-clip-summary::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 24px;
  background: linear-gradient(transparent, var(--hv-surface));
  pointer-events: none;
}

/* Utility: Pre-Wrap fuer Multi-Line-Text (Nachrichten, Notizen) */
.text-pre-wrap { white-space: pre-wrap; }
/* Inline-Passwort-Feld (Portal-Zugang) — verhindert Schrumpfen unter 200px */
.portal-pass-field { min-width: 200px; }
/* Utility: horizontales Scrollen (z.B. Bereichs-Tabs auf Mobile) */
.ind-scroll-x { overflow-x: auto; }

/* ── Objekt-Tile (Listen-View Stammdaten/Objekte) ──────────────────────── */
.obj-tile__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 8px;
}
.obj-tile__title {
  margin: 0;
  font-size: 1rem;
}
.obj-tile__meta {
  font-size: 0.78rem;
  margin-bottom: 6px;
}
.obj-tile__meta--owner { margin-bottom: 14px; }
.obj-tile__stat {
  padding: 10px 12px;
  background: var(--ind-surface-2);
  border-radius: var(--hv-radius-sm);
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.obj-tile__stat-figure {
  font-size: 1.1rem;
  font-weight: 500;
}
.obj-tile__progress { width: 60px; }
.obj-tile__progress-bar {
  height: 3px;
  background: var(--ind-line);
}
.obj-tile__progress--full    { background: var(--hv-success); }
.obj-tile__progress--partial { background: var(--hv-warning); }
.obj-tile__progress-label {
  font-size: 0.65rem;
  text-align: right;
  margin-top: 2px;
}

/* ── Bootstrap-Override: text-muted etc. ─────────────────────────────────── */
.text-muted { color: var(--hv-text-muted) !important; }
.text-primary { color: var(--hv-text) !important; }
[data-theme="light"] .text-primary { color: var(--hv-text) !important; }
.text-danger  { color: var(--hv-danger) !important; }
.text-success { color: var(--hv-success) !important; }
.text-warning { color: var(--hv-warning) !important; }
.text-info    { color: var(--hv-accent) !important; }

.bg-light { background: var(--ind-surface-2) !important; }
.bg-primary { background: var(--ind-accent) !important; color: #000 !important; }
[data-theme="light"] .bg-primary { background: var(--hv-text) !important; color: var(--hv-bg) !important; }

/* bg-white wäre im Dark-Mode weiß — neutralisieren (für Card-Header etc.) */
.card-header.bg-white,
.card-footer.bg-white,
.card .bg-white,
.bg-white {
  background: transparent !important;
}
[data-theme="light"] .card-header.bg-white,
[data-theme="light"] .card-footer.bg-white {
  background: var(--hv-surface) !important;
}

/* table-light in Tabellen-Header → Industrial */
.table > :not(caption) > * > .table-light,
.table > thead.table-light,
thead.table-light th,
.table-light {
  --bs-table-bg: transparent;
  --bs-table-color: var(--hv-text-muted);
  background: transparent !important;
  color: var(--hv-text-muted) !important;
}

.border { border-color: var(--ind-line) !important; }
.border-bottom { border-bottom-color: var(--ind-line) !important; }
.border-top { border-top-color: var(--ind-line) !important; }
.border-start { border-left-color: var(--ind-line) !important; }
.border-end { border-right-color: var(--ind-line) !important; }

/* ── Theme-Toggle-Icons stimmig setzen ───────────────────────────────────── */
[data-theme="dark"] .hv-theme-toggle .bi-sun-fill { color: var(--ind-accent); }
[data-theme="light"] .hv-theme-toggle .bi-moon-stars-fill { color: var(--hv-text); }

/* ── Anchor-Farbe ÜBERSCHREIBEN ──────────────────────────────────────────
   app.css setzt im Dark-Mode `a { color: var(--hv-primary) }` — das ist
   nun lime und färbt alle Links grün. Hier neutralisieren. */
[data-theme="dark"] a { color: inherit; }
[data-theme="dark"] a:hover { color: var(--ind-accent); }
[data-theme="dark"] .hv-nav-item,
[data-theme="dark"] .hv-nav-subitem,
[data-theme="dark"] .ind-task,
[data-theme="dark"] .hv-sidebar-brand,
[data-theme="dark"] .hv-breadcrumb a {
  color: var(--hv-sidebar-text);
}
[data-theme="dark"] .hv-nav-item:hover,
[data-theme="dark"] .hv-nav-subitem:hover,
[data-theme="dark"] .ind-task:hover {
  color: var(--hv-text);
}
[data-theme="dark"] .hv-nav-item.active {
  color: var(--hv-sidebar-active-text);
}
[data-theme="dark"] .hv-sidebar-brand { color: var(--hv-text); }
[data-theme="dark"] .ind-task .ttl { color: var(--hv-text); }
[data-theme="dark"] .ind-stream a, [data-theme="dark"] .ind-list a { color: inherit; }

/* btn-primary darf weiterhin schwarzen Text auf Lime haben */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] a.btn-primary { color: #000 !important; }

/* ════════════════════════════════════════════════════════════════════════════
   Industrial-Page-Layout-Klassen
   ──────────────────────────────────────────────────────────────────────────── */

/* ── Page-Header ─────────────────────────────────────────────────────────── */
.ind-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px; flex-wrap: wrap;
  border-bottom: 1px solid var(--ind-line);
  padding-bottom: 18px;
  margin-bottom: 24px;
}
.ind-head .crumb {
  font-family: var(--hv-font-mono);
  font-size: 0.72rem;
  color: var(--hv-text-muted);
  letter-spacing: 0.02em;
}
.ind-head .crumb .sep { color: var(--ind-text-subtle); margin: 0 8px; }
/* Crumb-Links: Brand-Akzent statt Bootstrap-Default-Blau (#0d6efd = 4.3:1 auf
   #FAFAFA, axe serious) — Akzent ist on-brand und kontraststark (5.6:1 / dark 8:1). */
.ind-head .crumb a { color: var(--ind-accent); }
.ind-head h1 {
  margin: 6px 0 0;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.ind-head .desc {
  font-family: var(--hv-font-mono);
  font-size: 0.78rem;
  color: var(--hv-text-muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.ind-head .actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 600px) {
  .ind-head { padding-bottom: 12px; margin-bottom: 16px; }
  .ind-head h1 { font-size: 1.2rem; }
  .ind-head .actions { width: 100%; justify-content: flex-start; }
  .ind-head .actions .btn { min-height: 38px; }
}

/* ── Industrial-Grid (12 Spalten, Hairline-Gaps) ─────────────────────────── */
.ind-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.ind-c12 { grid-column: span 12; }
.ind-c8  { grid-column: span 8; }
.ind-c7  { grid-column: span 7; }
.ind-c6  { grid-column: span 6; }
.ind-c5  { grid-column: span 5; }
.ind-c4  { grid-column: span 4; }
.ind-c3  { grid-column: span 3; }

/* Center-Modifier: horizontale Zentrierung einer Card im 12-Spalten-Grid.
   Aktuell sinnvoll fuer .ind-c8 (Spalte 3-10) und .ind-c6 (Spalte 4-9).
   Auf Mobile (< 1100px) wird sowieso volle Breite gespanned, dann egal. */
.ind-c-center.ind-c8 { grid-column: 3 / span 8; }
.ind-c-center.ind-c6 { grid-column: 4 / span 6; }
.ind-c-center.ind-c4 { grid-column: 5 / span 4; }
@media (max-width: 1100px) {
  .ind-c8, .ind-c7, .ind-c6, .ind-c5, .ind-c4 { grid-column: span 12; }
  .ind-c3 { grid-column: span 6; }
}
@media (max-width: 600px) {
  .ind-c3 { grid-column: span 12; }
}

/* ── Industrial-Card ─────────────────────────────────────────────────────── */
.ind-card {
  background: var(--hv-surface);
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.ind-card .label {
  font-family: var(--hv-font-sans);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hv-text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.ind-card h3 {
  font-family: var(--hv-font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

/* ── Industrial-Stat-Tile ────────────────────────────────────────────────── */
.ind-stat .figure {
  font-family: var(--hv-font-mono);
  font-size: 1.75rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: var(--hv-text);
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
}
.ind-stat .figure .unit {
  font-size: 0.95rem;
  color: var(--hv-text-muted);
  margin-left: 2px;
  font-weight: 500;
}
/* Fliesstext-Variante: fuer Werte, die KEINE Zahl sind (Energieausweis,
   Heizungstyp etc.). Normale Sans-Schrift statt grosser Mono-Ziffern. */
.ind-stat .figure-text {
  font-family: var(--hv-font-sans);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: normal;
  color: var(--hv-text);
}
.ind-stat .delta {
  font-family: var(--hv-font-mono);
  font-size: 0.7rem;
  color: var(--hv-text-muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.ind-stat .delta.down { color: var(--hv-danger); }
.ind-stat .delta.up   { color: var(--hv-text); }
.ind-stat .delta.muted { color: var(--hv-text-muted); }

.ind-stat-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--hv-text-muted);
  text-decoration: none;
  border-top: 1px solid var(--ind-line);
  padding-top: 0.5rem;
  width: 100%;
  transition: color 0.12s ease;
}
.ind-stat-cta:hover { color: var(--hv-text); text-decoration: none; }
.ind-stat-cta i { font-size: 0.7rem; opacity: 0.7; transition: transform 0.12s ease; }
.ind-stat-cta:hover i { transform: translateX(2px); opacity: 1; }

/* ── Industrial-Task-List ────────────────────────────────────────────────── */
.ind-tasks { display: flex; flex-direction: column; gap: 1px; background: var(--ind-line); }
.ind-task {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--hv-surface);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background-color 140ms ease;
}
.ind-task:hover { background: var(--ind-surface-2); color: inherit; }
.ind-task .icn {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 3px; font-size: 0.72rem;
  flex-shrink: 0;
}
.ind-task .icn.danger { background: var(--hv-danger); color: #000; }
.ind-task .icn.warn   { background: var(--hv-warning); color: #000; }
.ind-task .icn.accent { background: var(--ind-accent); color: #000; }
.ind-task .icn.ok     { background: var(--hv-success); color: #000; }
[data-theme="light"] .ind-task .icn.danger { background: var(--hv-danger); color: #fff; }
[data-theme="light"] .ind-task .icn.warn   { background: var(--hv-warning); color: #fff; }
[data-theme="light"] .ind-task .icn.accent { background: var(--ind-accent); color: #000; }
[data-theme="light"] .ind-task .icn.ok     { background: var(--hv-success); color: #fff; }
.ind-task .ttl { font-weight: 500; }
.ind-task .meta {
  font-family: var(--hv-font-mono);
  color: var(--hv-text-muted);
  font-size: 0.72rem;
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.ind-task .arr { color: var(--ind-text-subtle); font-family: var(--hv-font-mono); }

/* ── Industrial-Activity-Stream ──────────────────────────────────────────── */
.ind-stream { list-style: none; padding: 0; margin: 0; }
.ind-stream li {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  padding: 7px 0;
  font-size: 0.8rem;
  align-items: baseline;
  border-bottom: 1px solid var(--hv-border-soft);
}
.ind-stream li:last-child { border-bottom: none; }
.ind-stream .when {
  font-family: var(--hv-font-mono);
  font-size: 0.7rem;
  color: var(--ind-text-subtle);
  font-variant-numeric: tabular-nums;
}
.ind-stream .what { color: var(--hv-text); line-height: 1.45; }
.ind-stream .what b, .ind-stream .what strong {
  color: var(--hv-text);
  font-weight: 600;
}

/* ── Industrial-Bars-Chart (CSS-Only Mini) ───────────────────────────────── */
.ind-bars { display: flex; align-items: flex-end; gap: 2px; height: 80px; margin-top: 10px; }
.ind-bars .bar {
  flex: 1;
  background: var(--ind-line-2);
  transition: background-color 180ms ease;
  min-height: 4px;
}
.ind-bars .bar:hover { background: var(--ind-accent); }

/* ── Industrial-Tag (klein, monospace) ───────────────────────────────────── */
.ind-tag {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--hv-font-mono);
  font-size: 0.65rem;
  padding: 1px 6px;
  background: var(--ind-line);
  color: var(--hv-text-muted);
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.ind-tag.danger { background: rgba(255,77,77,0.14); color: var(--hv-danger); }
.ind-tag.warn   { background: rgba(255,168,0,0.16); color: var(--hv-warning); }
.ind-tag.accent { background: var(--ind-surface-2); color: var(--hv-text); border: 1px solid var(--ind-line); }
.ind-tag.ok     { background: rgba(0,224,143,0.14); color: var(--hv-success); }
[data-theme="light"] .ind-tag.danger { background: #FEE2E2; color: #B91C1C; }
[data-theme="light"] .ind-tag.warn   { background: #FEF3C7; color: #B45309; }
[data-theme="light"] .ind-tag.accent { background: #18181B; color: #FAFAFA; }
[data-theme="light"] .ind-tag.ok     { background: #DCFCE7; color: #15803D; }

/* ── Industrial-Mini-List (Fristen/Mängel/Zahlungen) ─────────────────────── */
.ind-list { list-style: none; padding: 0; margin: 0; }
.ind-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hv-border-soft);
  font-size: 0.82rem;
  align-items: center;
}
.ind-list li:last-child { border-bottom: none; }
.ind-list .name { font-weight: 500; }
.ind-list .meta {
  font-family: var(--hv-font-mono);
  font-size: 0.7rem;
  color: var(--hv-text-muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.ind-list .amt {
  font-family: var(--hv-font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.ind-list .amt.ok { color: var(--hv-success); }
.ind-list .amt.danger { color: var(--hv-danger); }

/* ── Demo-Mode-Banner (DEMO_MODE=1) ──────────────────────────────────────────
   Sticky oben, leuchtend, damit beim Demo-Walkthrough sofort klar ist:
   das ist die Sandbox, nicht die Produktiv-DB. Tritt nur auf, wenn
   config.demo.aktiv = true. */
.hv-demo-banner {
  position: sticky;
  top: 0;
  z-index: 1080;
  background: repeating-linear-gradient(
    -45deg,
    #FF4D4D,
    #FF4D4D 12px,
    #B91C1C 12px,
    #B91C1C 24px
  );
  color: #fff;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 6px 16px;
  letter-spacing: 0.01em;
  border-bottom: 2px solid #7F1D1D;
  text-shadow: 0 1px 0 rgba(0,0,0,0.35);
}
.hv-demo-banner i { margin-right: 6px; }
.hv-demo-banner code {
  background: rgba(0,0,0,0.25);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  color: #fff;
}

/* ── Hub-Tabs (Bereichs-Navigation, ueber dem Main-Content) ─────────────────
   Wird via partials/hub-tabs.handlebars eingeblendet, wenn der aktuelle
   Bereich einem Hub angehoert (siehe src/utils/hubTabs.js). Optisch eine
   Pill-Reihe wie .ind-subbar, aber als sticky Sekundaer-Nav. */
.hv-hub-tabs {
  display: flex; gap: 6px; flex-wrap: wrap;   /* wrap statt nowrap — sonst clippt overflow-x das Mehr-Dropdown */
  padding: 10px 0 14px 0;
  margin: -8px 0 16px 0;
  border-bottom: 1px solid var(--ind-line);
}
/* Mobile: kompaktere Hub-Reiter → weniger Umbruch, weniger vertikaler Platz.
   (Auf Cockpit-Detailseiten entfaellt der Streifen ganz, siehe versteckeHubTabs.) */
@media (max-width: 767px) {
  .hv-hub-tabs { gap: 4px; padding: 8px 0 10px; margin: -6px 0 12px; }
  .hv-hub-tab { padding: 4px 9px; font-size: 0.72rem; }
}
.hv-hub-tab {
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  font-family: var(--hv-font-sans);
  background: transparent;
  border: 1px solid var(--ind-line);
  color: var(--hv-text-muted);
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.hv-hub-tab:hover { border-color: var(--ind-line-2); color: var(--hv-text); }
.hv-hub-tab.active {
  background: var(--hv-text);
  color: var(--hv-bg);
  border-color: var(--hv-text);
}
.hv-hub-tab-badge {
  font-family: var(--hv-font-mono);
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--hv-danger, #d33);
  color: #fff;
}
.hv-hub-tab.active .hv-hub-tab-badge { background: var(--hv-bg); color: var(--hv-text); }

/* ── Hub-Mehr-Dropdown (IA-Sprint 2026-05-28) ───────────────────────────
   Klick auf "Mehr ▾" oeffnet ein Panel mit den selteneren Tabs. <details>
   = nativ, kein JS noetig, A11y-tauglich (Enter/Space klappt auf). */
.hv-hub-more { position: relative; flex-shrink: 0; }
.hv-hub-more__trigger {
  list-style: none;        /* default <summary>-Marker weg */
  cursor: pointer;
}
.hv-hub-more__trigger::-webkit-details-marker { display: none; }
.hv-hub-more__caret {
  font-size: 0.7em;
  margin-left: 2px;
  transition: transform 150ms ease;
}
.hv-hub-more[open] .hv-hub-more__caret { transform: rotate(180deg); }

.hv-hub-more__panel {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 240px;
  max-width: 360px;
  background: var(--hv-surface);
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-md);
  box-shadow: var(--hv-shadow-lg);
  padding: 6px;
  z-index: 1050;                     /* ueber Sidebar (1040), unter Modal-Backdrop (1055) */
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 70vh;
  overflow-y: auto;
}
/* Falls Panel rechts aus dem Viewport rausragt: rechts-buendig statt links */
@media (min-width: 768px) {
  .hv-hub-more__panel { right: auto; }
}
.hv-hub-more__item {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--hv-radius-sm);
  text-decoration: none;
  color: var(--hv-text);
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.hv-hub-more__item:hover,
.hv-hub-more__item:focus-visible {
  background: var(--ind-surface-2);
}
.hv-hub-more__item.active {
  background: var(--ind-surface-2);
  font-weight: 600;
}
.hv-hub-more__label { flex: 0 0 auto; }
.hv-hub-more__hint {
  flex: 1 1 100%;
  font-size: 0.72rem;
  color: var(--hv-text-muted);
  line-height: 1.35;
}

/* Schliessen wenn ausserhalb geklickt — wird von app.js per JS gehandhabt
   (Bootstrap-Dropdown-Behavior ist drauf nicht angewandt). Fallback: User
   klickt nochmal das Trigger oder ESC. */

/* ── Industrial Sub-Bar (Filter-Pills + Suche) ───────────────────────────── */
.ind-subbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--ind-line);
  margin-bottom: 16px;
}
.ind-pill {
  padding: 4px 11px;
  font-size: 0.74rem;
  font-weight: 500;
  font-family: var(--hv-font-sans);
  background: transparent;
  border: 1px solid var(--ind-line);
  color: var(--hv-text-muted);
  cursor: pointer;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.ind-pill:hover { border-color: var(--ind-line-2); color: var(--hv-text); }
.ind-pill.active {
  background: var(--hv-text);
  color: var(--hv-bg);
  border-color: var(--hv-text);
}
[data-theme="dark"] .ind-pill.active { color: var(--hv-bg); }
.ind-pill .num {
  font-family: var(--hv-font-mono);
  font-size: 0.65rem;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}
.ind-find {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px;
  background: var(--ind-surface-2);
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-sm);
  width: 280px;
  transition: border-color 0.15s ease;
}
.ind-find:focus-within { border-color: var(--ind-line-2); }
.ind-find i { color: var(--hv-text-muted); font-size: 0.85rem; }
.ind-find input {
  border: none; background: transparent; outline: none;
  flex: 1; font-family: inherit; font-size: 0.78rem;
  color: var(--hv-text);
}

/* ── Industrial Inbox: Three-Pane ────────────────────────────────────────── */
.ind-inbox {
  display: grid;
  grid-template-columns: 320px 1fr 320px;
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-md);
  background: var(--hv-surface);
  overflow: hidden;
  height: calc(100vh - 280px);
  min-height: 540px;
}
@media (max-width: 1300px) {
  .ind-inbox { grid-template-columns: 280px 1fr 280px; }
}
@media (max-width: 1100px) {
  .ind-inbox { grid-template-columns: 280px 1fr; }
  .ind-inbox-context { display: none; }
}

.ind-inbox-list {
  border-right: 1px solid var(--ind-line);
  overflow-y: auto;
  background: var(--ind-surface-2);
}
.ind-inbox-list-head {
  position: sticky; top: 0; z-index: 1;
  background: var(--ind-surface-2);
  padding: 10px 14px;
  border-bottom: 1px solid var(--ind-line);
  font-family: var(--hv-font-mono);
  font-size: 0.7rem;
  color: var(--hv-text-muted);
  display: flex; justify-content: space-between; align-items: center;
}

.ind-mail {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hv-border-soft);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.12s ease;
  border-left: 2px solid transparent;
}
.ind-mail:hover { background: var(--hv-sidebar-hover); }
.ind-mail.active {
  background: var(--hv-surface);
  border-left-color: var(--ind-accent);
}
.ind-mail.unread .ind-mail-from { font-weight: 600; color: var(--hv-text); }
.ind-mail.unread .ind-mail-subj { color: var(--hv-text); font-weight: 500; }
.ind-mail-row1 {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
  gap: 8px;
}
.ind-mail-from {
  font-size: 0.78rem;
  color: var(--hv-text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
}
.ind-mail-from .dot {
  width: 6px; height: 6px;
  background: var(--ind-accent);
  border-radius: 50%;
  flex-shrink: 0;
}
.ind-mail-when {
  font-family: var(--hv-font-mono);
  font-size: 0.66rem;
  color: var(--ind-text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.ind-mail-subj {
  font-size: 0.82rem;
  color: var(--hv-text-muted);
  margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ind-mail-snip {
  font-size: 0.73rem;
  color: var(--ind-text-subtle);
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical;
  overflow: hidden; min-width: 0;
}
.ind-mail-tags { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }

.ind-inbox-detail {
  overflow-y: auto;
  padding: 24px 28px;
  display: flex; flex-direction: column;
}
.ind-inbox-empty {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--hv-text-muted); font-family: var(--hv-font-mono);
  font-size: 0.82rem;
}
.ind-inbox-empty i { font-size: 2.2rem; margin-bottom: 12px; opacity: 0.4; }

.ind-mail-head h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ind-mail-meta {
  font-family: var(--hv-font-mono);
  font-size: 0.72rem;
  color: var(--hv-text-muted);
  padding-bottom: 16px;
  border-bottom: 1px solid var(--ind-line);
  margin-bottom: 16px;
  display: flex; flex-wrap: wrap; gap: 8px;
}
.ind-mail-body {
  white-space: pre-wrap;
  font-size: 0.86rem;
  line-height: 1.65;
  color: var(--hv-text);
  flex: 1;
  font-family: var(--hv-font-sans);
}

.ind-kbd-bar {
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid var(--ind-line);
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 0.7rem;
  color: var(--hv-text-muted);
  font-family: var(--hv-font-mono);
}
.ind-kbd-bar kbd {
  font-family: inherit;
  font-size: 0.65rem;
  padding: 1px 5px;
  border: 1px solid var(--ind-line-2);
  border-bottom-width: 2px;
  border-radius: 3px;
  margin-right: 4px;
  color: var(--hv-text);
  background: var(--ind-surface-2);
}

.ind-inbox-context {
  border-left: 1px solid var(--ind-line);
  background: var(--ind-surface-2);
  padding: 16px;
  overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.ind-inbox-context .ctx-title {
  font-family: var(--hv-font-mono);
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--hv-text-muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.ind-ai-card {
  background: var(--hv-surface);
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-sm);
  padding: 12px;
}
.ind-ai-card .ai-eyebrow {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--hv-text-muted);
  font-weight: 600;
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.ind-ai-card .ai-text {
  font-size: 0.82rem;
  line-height: 1.55;
  margin: 0 0 10px;
  color: var(--hv-text);
}
.ind-ai-card .ai-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.ind-ai-suggest-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 0;
  font-size: 0.78rem;
  color: var(--hv-text);
  border-bottom: 1px solid var(--hv-border-soft);
}
.ind-ai-suggest-row:last-child { border-bottom: none; }
.ind-ai-suggest-row i { color: var(--hv-text-muted); margin-top: 2px; flex-shrink: 0; }

.ind-fact {
  background: var(--hv-surface);
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-sm);
  padding: 12px;
}
.ind-fact dt {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--hv-text-muted);
  font-weight: 600;
  margin-top: 8px;
}
.ind-fact dt:first-child { margin-top: 0; }
.ind-fact dd {
  margin: 2px 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--hv-text);
}

/* ── Industrial Detail-Hero ──────────────────────────────────────────────── */
.ind-detail-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 24px;
  background: var(--ind-surface-2);
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-md);
  margin-bottom: 16px;
}
@media (max-width: 800px) {
  .ind-detail-hero { grid-template-columns: 1fr; }
}
.ind-detail-hero .mark {
  width: 56px; height: 56px;
  border-radius: var(--hv-radius-md);
  background: var(--hv-text);
  color: var(--hv-bg);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--hv-font-mono);
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  text-transform: uppercase;
}
[data-theme="dark"] .ind-detail-hero .mark {
  background: var(--ind-accent); color: #000;
}
.ind-detail-hero .info h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.ind-detail-hero .info .sub {
  font-size: 0.82rem;
  color: var(--hv-text-muted);
  margin-top: 4px;
  display: flex; flex-wrap: wrap; gap: 12px;
}
.ind-detail-hero .stats {
  display: flex; gap: 24px;
  text-align: right;
}
.ind-detail-hero .stats .lab {
  font-size: 0.62rem; text-transform: uppercase;
  letter-spacing: 0.12em; font-weight: 600;
  color: var(--hv-text-muted);
}
.ind-detail-hero .stats .val {
  font-family: var(--hv-font-mono);
  font-size: 1.05rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  margin-top: 2px;
}

/* ── Industrial Tabs ─────────────────────────────────────────────────────── */
.ind-tabs {
  display: flex;
  border-bottom: 1px solid var(--ind-line);
  margin-bottom: 16px;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.ind-tabs::-webkit-scrollbar { display: none; }
.ind-tab {
  padding: 10px 14px;
  font-family: var(--hv-font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--hv-text-muted);
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  flex-shrink: 0;   /* sonst schrumpfen die Reiter unter ihre Textbreite → Überlappung auf schmalen Screens; mit overflow-x:auto scrollen sie stattdessen */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}
.ind-tab:hover { color: var(--hv-text); }
.ind-tab.active {
  color: var(--hv-text);
  border-bottom-color: var(--ind-accent);
  font-weight: 600;
}
[data-theme="light"] .ind-tab.active { border-bottom-color: var(--hv-text); }
.ind-tab .num {
  font-family: var(--hv-font-mono);
  font-size: 0.65rem;
  background: var(--ind-line);
  color: var(--hv-text-muted);
  padding: 1px 6px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.ind-tab.active .num { background: var(--ind-accent-soft); color: var(--ind-accent); }
[data-theme="light"] .ind-tab.active .num { background: var(--hv-text); color: var(--hv-bg); }

/* Mobile-Affordance: visueller Hinweis dass Tabs scrollen */
@media (max-width: 768px) {
  .ind-tabs {
    position: relative;
    -webkit-overflow-scrolling: touch;
    mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 24px), transparent);
  }
  .ind-tab { padding: 12px 12px; font-size: 0.78rem; }
  .ind-tab i { font-size: 0.95rem; }
}

.ind-tab-pane { display: none; }
.ind-tab-pane.active { display: block; animation: fadein 240ms ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }

/* ── Industrial Timeline ─────────────────────────────────────────────────── */
.ind-timeline { list-style: none; padding: 0; margin: 0; }
.ind-timeline li {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 24px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hv-border-soft);
  align-items: baseline;
}
.ind-timeline li:last-child { border-bottom: none; }
.ind-timeline .when {
  font-family: var(--hv-font-mono);
  font-size: 0.7rem;
  color: var(--hv-text-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.ind-timeline .what .head {
  font-weight: 500;
  font-size: 0.85rem;
  margin-bottom: 2px;
}
.ind-timeline .what .desc {
  font-size: 0.78rem;
  color: var(--hv-text-muted);
}

/* ── Industrial KV-List (Definition-List-Stil) ───────────────────────────── */
.ind-kv {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px 24px;
  margin: 0;
}
.ind-kv > div { display: flex; flex-direction: column; }
.ind-kv dt {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--hv-text-muted);
  font-weight: 600;
}
.ind-kv dd {
  margin: 4px 0 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--hv-text);
}
.ind-kv dd.num {
  font-family: var(--hv-font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ── Responsive Tables: Mobile-Stacking ─────────────────────────────────────
   Aktivierung:
     <table class="table hv-table-stack">
       <thead><tr><th>Mieter</th>...</tr></thead>
       <tbody>
         <tr>
           <td data-label="Mieter">Müller</td>
           ...
   Bis 768px wird jede Zeile zu einem Block, und vor jeder Zelle erscheint
   das data-label aus dem zugehoerigen <th>. data-label="" auf einer Zelle
   unterdrueckt das Label (z.B. fuer reine Action-Spalten). */
@media (max-width: 768px) {
  .hv-table-stack { border: 0; }
  .hv-table-stack thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px; margin: -1px; overflow: hidden;
    padding: 0; position: absolute; width: 1px;
  }
  .hv-table-stack tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--hv-border);
    border-radius: var(--hv-radius-md);
    background: var(--hv-surface);
    padding: 8px 12px;
  }
  .hv-table-stack tbody tr + tr { border-top: 1px solid var(--hv-border); }
  .hv-table-stack tbody td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
    border: none;
    border-bottom: 1px solid var(--hv-border-soft);
    text-align: right;
    word-break: break-word;
  }
  .hv-table-stack tbody td:last-child { border-bottom: none; }
  .hv-table-stack tbody td::before {
    content: attr(data-label);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--hv-text-muted);
    font-weight: 600;
    text-align: left;
    flex: 0 0 auto;
    min-width: 38%;
  }
  .hv-table-stack tbody td[data-label=""]::before { content: none; }
  .hv-table-stack tbody td[data-label=""] { justify-content: flex-end; }
  /* Fallback: TD ohne data-label — kein leerer Vor-Block */
  .hv-table-stack tbody td:not([data-label])::before { content: none; }
  .hv-table-stack tbody td:not([data-label]) { justify-content: flex-start; text-align: left; }
  /* Aktions-Buttonleiste in einer Stack-Zelle nicht zerreissen */
  .hv-table-stack tbody td .d-flex.gap-1,
  .hv-table-stack tbody td .d-flex.gap-2 { flex-wrap: wrap; justify-content: flex-end; }
  /* sortierbare Tabellen: Pfeile im Stack-Modus deaktivieren */
  .hv-table-stack thead th[role="columnheader"] { cursor: default; }
}

/* ── Industrial Inset-Box (eingelegte Subsection in Card, z.B. inline-Form) ── */
.ind-inset {
  padding: 12px;
  background: var(--ind-surface-2);
  border: 1px solid var(--ind-line);
  border-radius: var(--hv-radius-sm);
}

/* ── Schnellzugriff-Buttons als Industrial-Pills ─────────────────────────── */
.ind-quick { display: flex; flex-wrap: wrap; gap: 6px; }
/* Modifier: vertikale, links-buendige Stack-Liste (z.B. Schnellaktionen-Spalte) */
.ind-quick--stack { flex-direction: column; align-items: stretch; }
.ind-quick--stack a, .ind-quick--stack button.quickadd-btn { justify-content: flex-start; }
.ind-quick a, .ind-quick button.quickadd-btn {
  font-family: var(--hv-font-sans);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--ind-line-2);
  color: var(--hv-text);
  border-radius: var(--hv-radius-sm);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.ind-quick a:hover, .ind-quick button.quickadd-btn:hover {
  border-color: var(--ind-line-2);
  background: var(--ind-surface-2);
  color: var(--hv-text);
}
.ind-quick button.quickadd-btn { cursor: pointer; }

/* ── Generische Detail-View-Helper (2026-05-16 Inline-Style-Migration) ─────
   Werden in Detail-Views (Versicherungsschaden, Mahnwesen, Quartalsgespraech,
   Abnahme) genutzt, um <pre>-Text und Korrespondenz-Items konsistent zu
   gestalten - ersetzen vorher inline-style-Patterns. */
.hv-pre-wrap {
  white-space: pre-wrap;
  font-family: inherit;
}
.hv-korr-item {
  border-left: 3px solid var(--ind-line);
  padding: 8px 12px;
  margin-bottom: 10px;
}
.hv-figure-text-success { color: var(--hv-success) !important; }
.hv-figure-text-danger  { color: var(--hv-danger)  !important; }
.hv-thumb-120 {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--ind-line);
}
.hv-code-block {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  font-size: 0.85rem;
  word-break: break-all;
}
.hv-card-narrow { max-width: 780px; }
.hv-accent-success { border-left: 4px solid var(--hv-success); }
.hv-accent-danger  { border-left: 4px solid var(--hv-danger); }



/* ═══ admin-forms.css ═══ */
/* ════════════════════════════════════════════════════════════════════════════
   admin-forms.css — Vereinheitlichtes Form-Pattern fuer Admin-Surface
   ────────────────────────────────────────────────────────────────────────────
   2026-05-16 Audit-Folge: 160 Admin-Views haben Bootstrap-`form-control`,
   keine durchgaengige Form-Struktur. Diese Datei liefert ein konsistentes
   Pattern, das mit dem Industrial-Theme (app.industrial.css) harmoniert.

   Pendant zu `forms.css` (Public-Surface).

   Verwendung:
     <form class="adm-form" method="post" action="...">
       <input type="hidden" name="_csrf" value="{{csrfToken}}">

       <div class="adm-form__section">
         <div class="adm-form__section-title">Grunddaten</div>

         <div class="adm-field adm-field--required">
           <label for="bezeichnung">Bezeichnung</label>
           <input id="bezeichnung" name="bezeichnung" type="text" class="form-control"
                  required placeholder="z.B. MFH Musterstrasse 5">
         </div>

         <div class="adm-form__row adm-form__row--cols-3">
           <div class="adm-field"><label for="x">X</label><input ...></div>
           <div class="adm-field"><label for="y">Y</label><input ...></div>
           <div class="adm-field"><label for="z">Z</label><input ...></div>
         </div>
       </div>

       <div class="adm-form__actions">
         <a href="..." class="btn btn-outline-secondary">Abbrechen</a>
         <button type="submit" class="btn btn-primary">Speichern</button>
       </div>
     </form>

   Bootstrap-`form-control`/`form-select` werden BEIBEHALTEN — sie kriegen via
   .adm-form-Scope nur frische Margins + Industrial-Borders.
   ════════════════════════════════════════════════════════════════════════════ */

.adm-form {
  display: flex;
  flex-direction: column;
  gap: var(--hv-space-md, 1rem);
}

/* ── Section: zusammenhaengende Feldgruppen ───────────────────────────────── */
.adm-form__section {
  display: flex;
  flex-direction: column;
  gap: var(--hv-space-md, 1rem);
  padding-bottom: var(--hv-space-md, 1rem);
}
.adm-form__section + .adm-form__section {
  border-top: 1px solid var(--hv-border, #1F1F23);
  padding-top: var(--hv-space-md, 1rem);
}

.adm-form__section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--hv-text-muted, #8A8A92);
  margin-bottom: 0.25rem;
}

/* ── Row: horizontale Feld-Gruppen (Spalten) ─────────────────────────────── */
.adm-form__row {
  display: grid;
  gap: var(--hv-space-md, 1rem);
}
.adm-form__row--cols-2 { grid-template-columns: 1fr 1fr; }
.adm-form__row--cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.adm-form__row--cols-4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.adm-form__row--cols-2-1 { grid-template-columns: 2fr 1fr; }
.adm-form__row--cols-3-1 { grid-template-columns: 3fr 1fr; }
@media (max-width: 768px) {
  .adm-form__row,
  .adm-form__row--cols-2,
  .adm-form__row--cols-3,
  .adm-form__row--cols-4,
  .adm-form__row--cols-2-1,
  .adm-form__row--cols-3-1 { grid-template-columns: 1fr; }
}

/* ── Field: ein Label + Input + Helper-Text ──────────────────────────────── */
.adm-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;       /* erlaubt Schrumpfen im Grid */
}

.adm-field > label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--hv-text, #EDEDED);
  letter-spacing: 0.005em;
}

/* Required-Stern automatisch */
.adm-field--required > label::after {
  content: ' *';
  color: var(--hv-warning, #FFA800);
  font-weight: 700;
}

/* Bootstrap-Inputs werden gescoped uebernommen — keine eigenen Form-Controls */
.adm-form .form-control,
.adm-form .form-select {
  background: var(--hv-surface, #111113);
  color: var(--hv-text, #EDEDED);
  border: 1px solid var(--hv-border, #1F1F23);
  border-radius: var(--hv-radius-md, 6px);
  padding: 0.55rem 0.75rem;
  font-size: 0.92rem;
  font-family: var(--hv-font-sans);
  line-height: 1.4;
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.adm-form .form-control:hover,
.adm-form .form-select:hover {
  border-color: var(--hv-border-soft, #18181B);
}
.adm-form .form-control:focus,
.adm-form .form-select:focus {
  border-color: var(--hv-primary, #5BB0D9);
  outline: none;
  box-shadow: 0 0 0 3px rgba(91, 176, 217, 0.18);
}
.adm-form .form-control::placeholder { color: var(--hv-text-muted); opacity: 0.55; }

/* Mono-Font fuer IBANs, Steuernummern, Beträge */
.adm-form .font-monospace {
  font-family: var(--hv-font-mono, ui-monospace, monospace);
  letter-spacing: 0.02em;
}

/* Textarea */
.adm-form textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

/* Validation: subtiler roter Rand bei :user-invalid */
.adm-form .form-control:user-invalid,
.adm-form .form-select:user-invalid,
.adm-form textarea:user-invalid { border-color: var(--hv-danger, #FF4D4D); }

/* Server-Fehler-State (immer sichtbar) */
.adm-field--server-error > .form-control,
.adm-field--server-error > .form-select {
  border-color: var(--hv-danger, #FF4D4D);
  background: rgba(255, 77, 77, 0.06);
}

.adm-field__error {
  font-size: 0.78rem;
  color: var(--hv-danger, #FF4D4D);
  margin-top: 0.15rem;
  line-height: 1.4;
}

.adm-field__helper {
  font-size: 0.75rem;
  color: var(--hv-text-muted, #8A8A92);
  line-height: 1.5;
  margin-top: 0.15rem;
}
/* Wenn der Helper-Text eine Warnung ist (Pflicht-Hinweis), in danger faerben */
.adm-field__helper--warn {
  color: var(--hv-warning, #FFA800);
}

/* Checkbox-Field: Checkbox + Label nebeneinander */
.adm-field--check {
  flex-direction: row;
  align-items: flex-start;
  gap: 0.6rem;
}
.adm-field--check > input[type="checkbox"],
.adm-field--check > input[type="radio"] {
  width: 1.1rem;
  height: 1.1rem;
  margin-top: 0.15rem;
  accent-color: var(--hv-primary, #5BB0D9);
  flex-shrink: 0;
}
.adm-field--check > label {
  font-size: 0.88rem;
  color: var(--hv-text);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0;
}

/* ── Actions: Button-Leiste am Ende ──────────────────────────────────────── */
.adm-form__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding-top: var(--hv-space-md, 1rem);
  border-top: 1px solid var(--hv-border, #1F1F23);
  margin-top: var(--hv-space-md, 1rem);
}
.adm-form__actions--start { justify-content: flex-start; }
.adm-form__actions--between { justify-content: space-between; }

@media (max-width: 768px) {
  .adm-form__actions {
    flex-direction: column-reverse;
  }
  .adm-form__actions .btn { width: 100%; }
}

/* ── Inline-Fehler-Block oben (Server-Validation-Zusammenfassung) ────────── */
.adm-form__error-summary {
  background: rgba(255, 77, 77, 0.08);
  border: 1px solid rgba(255, 77, 77, 0.25);
  border-radius: var(--hv-radius-md);
  padding: 0.75rem 1rem;
  color: var(--hv-text);
  margin-bottom: var(--hv-space-md);
}
.adm-form__error-summary strong {
  color: var(--hv-danger);
}

/* ── Hint-Box innerhalb des Forms (z.B. "Pflicht fuer CO2-Umlage") ───────── */
.adm-form__hint {
  background: rgba(91, 176, 217, 0.06);
  border-left: 3px solid var(--hv-primary, #5BB0D9);
  padding: 0.6rem 0.85rem;
  border-radius: 0 var(--hv-radius-sm, 4px) var(--hv-radius-sm, 4px) 0;
  font-size: 0.85rem;
  color: var(--hv-text-muted);
  line-height: 1.5;
}


/* ═══ touch.css ═══ */
/* ════════════════════════════════════════════════════════════════════════════
   touch.css — Touch-First-Layout-Audit (Track G, 2026-05-26)
   ────────────────────────────────────────────────────────────────────────────
   Ergaenzung zu tokens.css (Track D arbeitet dort). Zielt auf 10 wichtigste
   Cockpit-Routes:
     /heute, /hitl/queue, /eingang/uebersicht, /zahlungen, /maengel,
     /mahnwesen, /system-health, /cockpit, /compliance, /stammdaten/mieter-liste

   Sourcen:
     - Apple HIG: min. 44x44 px Touch-Target
     - WCAG 2.5.5 (Target Size): min. 44x44 px
     - Material Design: min. 48x48 dp empfohlen
   Wir folgen Apple/WCAG = 44 px.

   tokens.css enthaelt bereits die Bottom-Nav (Phase 2.3, Track D).
   Wir ergaenzen:
     1. .btn-touch Utility-Klasse
     2. Mindest-Hoehe fuer alle Buttons in Bottom-Nav + HITL-Aktionen
     3. Tabellen-Zeilen-Klick-Targets mit cursor:pointer (data-url Pattern)
     4. Padding zwischen interaktiven Elementen (>= 8 px)
     5. iOS-Safari Tap-Highlight + Touch-Action
   ════════════════════════════════════════════════════════════════════════════ */

/* ── 1. Utility-Klasse .btn-touch — 44 px Mindestmasse ────────────────────── */
.btn-touch,
button.btn-touch,
a.btn-touch {
  min-height: 44px;
  min-width: 44px;
  padding: 0.625rem 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  /* iOS-Safari: Tap-Highlight entfernen, ueber CSS handhaben */
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── 2. Auf Mobile: alle btn-Klassen automatisch >= 44 px ────────────────── */
@media (max-width: 767.98px) {
  .btn,
  .btn-sm,
  button[type="submit"],
  button[type="button"]:not(.btn-close):not(.hv-bottom-nav-item),
  input[type="submit"],
  a.btn {
    min-height: 44px;
    /* Bestehende Buttons behalten ihr Padding aber kriegen Mindest-Hoehe */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* Icon-only Buttons auch breit genug */
    min-width: 44px;
  }
  /* Ausnahme: btn-close ist Bootstrap-Schliessen-X — typischerweise klein. */
  button.btn-close { min-height: auto; min-width: auto; }

  /* Form-Inputs auf Mobile auch >= 44px (Touch-Treffer-Sicherheit) */
  .form-control,
  .form-select,
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="date"],
  select {
    min-height: 44px;
  }
  /* Checkbox + Radio bleiben kompakt, brauchen aber groessere Label-Klick-Flaeche */
  .form-check {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-left: 1.75rem;
  }
}

/* ── 3. Tabellen-Zeilen-Klick-Targets (data-url-Pattern) ─────────────────── */
tr[data-url],
tr[data-href],
[data-keynav-item][data-url] {
  cursor: pointer;
}
/* Mobile: Zeilen-Padding groesser, damit Finger nicht zwischen Zellen rutscht */
@media (max-width: 767.98px) {
  tr[data-url] > td,
  tr[data-href] > td,
  [data-keynav-item][data-url] > td {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }
  /* Komplette Zeile als grosses Touch-Target */
  tr[data-url],
  tr[data-href] {
    min-height: 44px;
  }
}
/* Hover-Feedback fuer Klickbarkeit */
tr[data-url]:hover,
tr[data-href]:hover {
  background-color: rgba(0, 0, 0, 0.04);
}
[data-theme="dark"] tr[data-url]:hover,
[data-theme="dark"] tr[data-href]:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

/* ── 4. Padding zwischen interaktiven Elementen (mind. 8 px) ─────────────── */
.hv-actions,
.actions,
.btn-group-touch {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem; /* 8px */
}
/* Button-Gruppen bei beengtem Platz horizontal scrollen statt zerquetschen */
@media (max-width: 767.98px) {
  .actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .actions .btn {
    flex: 1 1 auto;  /* fuellt verfuegbare Breite */
    min-width: 0;
  }
  /* Inline-Forms (z.B. HITL-Freigabe-Buttons in Liste): Buttons untereinander */
  form.hv-inline-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }
  form.hv-inline-actions .btn {
    width: 100%;
  }
}

/* ── 5. Mobile: Inline-Edit-Buttons in Listen werden 44x44 ───────────────── */
@media (max-width: 767.98px) {
  /* Icon-Buttons "✏️ ⚙️ 🗑️" am Zeilen-Ende */
  td.actions .btn,
  td .btn-edit,
  td .btn-delete,
  td a.btn-link {
    min-width: 44px;
    min-height: 44px;
    padding: 0.5rem;
  }
}

/* ── 6. Klick-Targets in Cards (KPI-Tiles, Heute-Dashboard) ──────────────── */
@media (max-width: 767.98px) {
  .ind-card a:not(.btn),
  .hv-card a:not(.btn),
  .kpi-tile a {
    /* Anker in Cards bekommen Padding fuer groesseren Touch-Bereich */
    display: inline-block;
    padding: 0.4rem 0;
  }
  /* Komplette Karten als Klick-Target wenn data-url gesetzt */
  .ind-card[data-url],
  .hv-card[data-url] {
    cursor: pointer;
    transition: transform 100ms ease;
  }
  .ind-card[data-url]:active,
  .hv-card[data-url]:active {
    transform: scale(0.98);
  }
}

/* ── 7. Bottom-Nav: bereits in tokens.css (Phase 2.3) — hier nur ergaenzen
       falls Track D Aenderungen wegputzt: defensive 44-px-Garantie. ───────── */
.hv-bottom-nav-item {
  min-height: 44px;
  min-width: 44px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* ── 8. Klickbare Zeilen-Handler (JS-Helper-Hook) ────────────────────────── */
/* Stellt sicher dass alle <tr data-url> auch wirklich Klick-Events ausloesen.
   Der JS-Snippet wird in main.handlebars via inline-script eingehaengt
   (Privacy-konform, kein CDN). */

/* ── 9. Reduzierte Motion respektieren (a11y) ────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ind-card[data-url]:active,
  .hv-card[data-url]:active {
    transform: none;
  }
}


/* ═══ floating-labels.css ═══ */
/* floating-labels.css — Bootstrap-Floating-Label-Stil ohne Bootstrap-JS.
 *
 * BACKLOG: 2.1 Floating-Labels Refactor. Pilot fuer Top-Forms; iterativ
 * auf weitere Forms ausrollen.
 *
 * Anwendung in Handlebars:
 *   <div class="form-floating mb-3">
 *     <input type="text" class="form-control" id="vorname" name="vorname" placeholder=" " value="{{vorname}}">
 *     <label for="vorname">Vorname</label>
 *   </div>
 *
 * Wichtig: `placeholder=" "` (1 Leerzeichen) ist Pflicht, sonst floated das
 * Label nicht. Falls Bootstrap 5 Floating-Labels bereits eingebunden sind,
 * ueberschreibt diese Datei nichts (gleiches Class-Schema, also Drop-In).
 */

.form-floating {
  position: relative;
}

.form-floating > .form-control,
.form-floating > .form-select {
  height: calc(3.5rem + 2px);
  padding: 1rem 0.75rem;
  line-height: 1.25;
}

.form-floating > label {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  padding: 1rem 0.75rem;
  pointer-events: none;
  border: 1px solid transparent;
  transform-origin: 0 0;
  transition: opacity .15s ease-in-out, transform .15s ease-in-out;
  color: var(--text-muted, #6c757d);
  font-size: 1rem;
}

.form-floating > .form-control:focus,
.form-floating > .form-control:not(:placeholder-shown),
.form-floating > .form-select {
  padding-top: 1.625rem;
  padding-bottom: 0.625rem;
}

.form-floating > .form-control:focus ~ label,
.form-floating > .form-control:not(:placeholder-shown) ~ label,
.form-floating > .form-select ~ label {
  opacity: 0.65;
  transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
}

.form-floating > .form-control:focus ~ label {
  color: var(--color-brand, #2D6B8E);
}

/* Disabled / Readonly */
.form-floating > .form-control[disabled],
.form-floating > .form-control:read-only {
  background-color: var(--cream-dark, #e9e7e2);
}

/* Validity indicators */
.form-floating > .form-control.is-invalid ~ label {
  color: #dc3545;
}
.form-floating > .form-control.is-invalid {
  border-color: #dc3545;
}


/* ═══ eingang-sidebar.css ═══ */
/* eingang-sidebar.css — Outlook-Style Side-Navigation fuer Posteingang. */

.eingang-layout {
  display: grid;
  grid-template-columns: 248px 1fr;
  gap: 1.75rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .eingang-layout {
    grid-template-columns: 1fr;
  }
  .eingang-sidebar { order: 2; max-height: 320px; overflow-y: auto; }
}

/* Schlicht + modern: heller Hintergrund, dezenter Rand, viel Luft.
   Nutzt die globalen Tokens (kein bespoke Beige mehr) → konsistent + Dark-Mode. */
.eingang-sidebar {
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 0.5rem;
  background: var(--hv-surface, #fff);
  border: 1px solid var(--hv-border, #ececec);
  border-radius: 12px;
  font-size: 0.9rem;
}

.eingang-sidebar__section { margin-bottom: 1.4rem; }
.eingang-sidebar__section:last-child { margin-bottom: 0.25rem; }
.eingang-sidebar__title {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--hv-text-muted, #8a8a8a);
  margin: 0 0 0.4rem 0.6rem;
}
.eingang-sidebar__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.eingang-sidebar__list li { margin-bottom: 2px; }

.eingang-sidebar__item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--hv-text, #2d2d2d);
  min-height: 34px;
  transition: background-color .12s ease, color .12s ease;
}
.eingang-sidebar__item:hover {
  background-color: var(--hv-bg-elevated, rgba(0, 0, 0, 0.045));
  text-decoration: none;
  color: inherit;
}
.eingang-sidebar__item.aktiv {
  background-color: var(--color-brand, #2D6B8E);
  color: #fff;
  font-weight: 600;
}
.eingang-sidebar__item.aktiv:hover {
  background-color: var(--color-brand-deep, #1A4D6B);
  color: #fff;
}
.eingang-sidebar__item--inaktiv .eingang-sidebar__label {
  opacity: 0.55;
  font-style: italic;
}

.eingang-sidebar__icon { font-size: 1rem; flex-shrink: 0; line-height: 1; }
.eingang-sidebar__label {
  flex-grow: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.eingang-sidebar__count {
  font-size: 0.72rem;
  font-weight: 600;
  background-color: var(--hv-bg-elevated, rgba(0, 0, 0, 0.07));
  color: var(--hv-text-muted, #777);
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  min-width: 1.5em;
  text-align: center;
  flex-shrink: 0;
}
.eingang-sidebar__item.aktiv .eingang-sidebar__count {
  background-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}
.eingang-sidebar__count.danger {
  background-color: #dc3545;
  color: white;
}
.eingang-sidebar__filter {
  font-size: 0.85rem;
  border-radius: 8px;
}

/* Bulk-Action-Bar oben (sticky) wenn Eintraege ausgewaehlt */
.eingang-bulk-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--hv-surface, #fff);
  border: 1px solid var(--hv-border, #ececec);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  display: none;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.eingang-bulk-bar.aktiv { display: flex; }
.eingang-bulk-bar__count { font-weight: 600; margin-right: auto; }


/* ═══ mieter-profilkarte.css ═══ */
/*
 * mieter-profilkarte.css
 * Kompakte Sticky-Profilkarte fuer Mieter (HITL-Detail, Mieter-Kommunikation,
 * Posteingang-Detail). Wird als Partial `mieter-profilkarte` aus dem Service
 * `mieterProfilKarteService.holeKarte(mieterId)` gerendert.
 *
 * Layout:
 *   Desktop (>=992px): 280px breite Sticky-Side-Column.
 *   Mobile  (<992px) : Compact-Modus, full-width vor dem Content.
 *
 * Farben kommen aus tokens.css falls vorhanden; harte Fallbacks fuer
 * Ampeln (gruen/gelb/rot) sind hier definiert.
 */

.mieter-profilkarte {
  width: 100%;
  max-width: 280px;
  background: var(--card-bg, #fff);
  border: 1px solid var(--card-border, #e5e7eb);
  border-radius: 10px;
  padding: 14px 14px 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 1rem;
  font-size: 0.875rem;
  color: var(--text, #111827);
}

.mieter-profilkarte--compact {
  position: static;
  max-width: 100%;
  margin-bottom: 1rem;
}

.mieter-profilkarte--leer {
  background: transparent;
  border-style: dashed;
  box-shadow: none;
  padding: 10px 12px;
  text-align: center;
}

/* ── Header ───────────────────────────────────────────────────────────── */
.mieter-profilkarte__header {
  border-bottom: 1px solid var(--card-border, #e5e7eb);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.mieter-profilkarte__name a {
  color: inherit;
  font-size: 0.95rem;
}

.mieter-profilkarte__name a:hover {
  color: var(--accent, #0d6efd);
}

.mieter-profilkarte__sub {
  margin-top: 2px;
}

/* ── Badges (Status-Indikatoren) ──────────────────────────────────────── */
.mieter-profilkarte__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.mieter-profilkarte__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 0.74rem;
  font-weight: 500;
  border-radius: 999px;
  line-height: 1.4;
  border: 1px solid transparent;
}

.mieter-profilkarte__badge--gruen {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.mieter-profilkarte__badge--gelb {
  background: #fef3c7;
  color: #92400e;
  border-color: #fde68a;
}

.mieter-profilkarte__badge--rot {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

/* ── Datenzeilen ──────────────────────────────────────────────────────── */
.mieter-profilkarte__zeilen {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin: 0 0 10px 0;
}

.mieter-profilkarte__zeile {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 6px;
}

.mieter-profilkarte__zeile > dt {
  color: var(--muted, #6b7280);
  font-weight: 500;
  font-size: 0.78rem;
}

.mieter-profilkarte__zeile > dd {
  margin: 0;
  font-size: 0.85rem;
  text-align: right;
  word-break: break-word;
}

/* ── Saldo-Ampel ──────────────────────────────────────────────────────── */
.mieter-profilkarte__saldo {
  font-weight: 600;
}

.mieter-profilkarte__saldo--gruen {
  color: #166534;
}

.mieter-profilkarte__saldo--gelb {
  color: #92400e;
}

.mieter-profilkarte__saldo--rot {
  color: #991b1b;
}

/* ── Pills ────────────────────────────────────────────────────────────── */
.mieter-profilkarte__pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 500;
  line-height: 1.5;
}

.mieter-profilkarte__pill--gruen {
  background: #dcfce7;
  color: #166534;
}

.mieter-profilkarte__pill--gelb {
  background: #fef3c7;
  color: #92400e;
}

.mieter-profilkarte__pill--rot {
  background: #fee2e2;
  color: #991b1b;
}

/* ── Footer-Links ─────────────────────────────────────────────────────── */
.mieter-profilkarte__footer {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--card-border, #e5e7eb);
  padding-top: 10px;
}

.mieter-profilkarte__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent, #0d6efd);
  text-decoration: none;
  font-size: 0.82rem;
}

.mieter-profilkarte__link:hover {
  text-decoration: underline;
}

/* ── Mobile-Fallback (<992px): single column ohne Sticky ──────────────── */
@media (max-width: 991.98px) {
  .mieter-profilkarte {
    position: static;
    max-width: 100%;
    margin-bottom: 1rem;
  }
  .mieter-profilkarte__zeile {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Dark-Mode (data-theme="dark", tokens.css) ────────────────────────── */
[data-theme="dark"] .mieter-profilkarte {
  background: #111827;
  border-color: #1f2937;
  color: #f3f4f6;
}

[data-theme="dark"] .mieter-profilkarte__header,
[data-theme="dark"] .mieter-profilkarte__footer {
  border-color: #1f2937;
}

[data-theme="dark"] .mieter-profilkarte__zeile > dt {
  color: #9ca3af;
}

