/* =====================================================================
   Phase 2.11.1 — Komponenten-Library
   Lebt parallel zu app.css und nutzt deren CSS-Variablen.
   Aliases auf die Spec-Namen (--color-*) damit beide Patterns funktionieren.
   ===================================================================== */

:root {
    --color-bg-deep:        var(--bg-base);
    --color-bg-card:        var(--bg-surface);
    --color-bg-elevated:    var(--bg-surface-2);
    --color-accent-gold:        var(--accent-gold);
    --color-accent-gold-light:  var(--accent-gold-hover);
    --color-accent-champagne:   #d8c69a;
    --color-text-primary:   var(--text-primary);
    --color-text-secondary: var(--text-secondary);
    --color-text-muted:     var(--text-muted);
    --color-border-subtle:  rgba(201, 169, 110, 0.18);
    --color-success: var(--status-success);
    --color-warning: var(--status-warning);
    --color-danger:  var(--status-error);
    --color-info:    var(--status-info);
}

/* =====================================================================
   Buttons (erweitertes System)
   ===================================================================== */
.btn-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    border-radius: var(--radius-md);
}
.btn.is-loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}
.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 18px; height: 18px;
    top: 50%; left: 50%;
    margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 2px solid currentColor;
    border-top-color: transparent;
    animation: btn-spin 0.7s linear infinite;
    color: var(--accent-gold);
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

.btn-success {
    background: var(--color-success);
    color: var(--bg-base);
    border: 1px solid var(--color-success);
}
.btn-success:hover { filter: brightness(1.1); }

.btn-danger {
    background: var(--color-danger);
    color: white;
    border: 1px solid var(--color-danger);
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-sm { padding: 0.25rem 0.75rem; font-size: var(--text-sm); }
.btn-lg { padding: 0.875rem 1.5rem; font-size: var(--text-lg); }

/* =====================================================================
   Stat-Cards
   ===================================================================== */
.stat-card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.stat-card {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card-link {
    display: contents;
    color: inherit;
    text-decoration: none;
}
.stat-card-icon {
    width: 56px; height: 56px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center; justify-content: center;
    flex-shrink: 0;
}
.stat-card--gold    .stat-card-icon { background: linear-gradient(135deg, var(--color-accent-gold), var(--color-accent-champagne)); color: var(--bg-base); }
.stat-card--success .stat-card-icon { background: var(--color-success); color: var(--bg-base); }
.stat-card--warning .stat-card-icon { background: var(--color-warning); color: var(--bg-base); }
.stat-card--danger  .stat-card-icon { background: var(--color-danger);  color: white; }
.stat-card--info    .stat-card-icon { background: var(--color-info);    color: white; }

.stat-card-body { flex: 1; min-width: 0; }
.stat-card-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text-primary);
    font-family: var(--font-serif, inherit);
}
.stat-card-title {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}
.stat-card-trend {
    font-size: var(--text-xs);
    margin-top: 0.5rem;
    display: inline-flex;
    gap: 0.25rem;
    align-items: center;
}
.stat-card-trend--up   { color: var(--color-success); }
.stat-card-trend--down { color: var(--color-danger); }

@media (max-width: 640px) {
    .stat-card-grid    { grid-template-columns: 1fr; }
    .stat-card         { padding: 1rem; }
    .stat-card-value   { font-size: 1.5rem; }
    .stat-card-icon    { width: 44px; height: 44px; }
}

/* =====================================================================
   Empty-State
   ===================================================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--color-text-secondary);
}
.empty-state-icon {
    display: inline-flex;
    align-items: center; justify-content: center;
    width: 96px; height: 96px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(201,169,110,0.10), rgba(216,198,154,0.04));
    color: var(--color-accent-gold);
    margin-bottom: 1rem;
}
.empty-state-titel {
    color: var(--color-text-primary);
    margin: 0.5rem 0;
}
.empty-state-beschreibung {
    margin-bottom: 1.5rem;
    color: var(--color-text-secondary);
}

/* =====================================================================
   Skeleton Loaders
   ===================================================================== */
.skeleton {
    background: linear-gradient(90deg,
        var(--color-bg-card) 0%,
        var(--color-bg-elevated) 50%,
        var(--color-bg-card) 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}
.skeleton-text   { height: 1em; }
.skeleton-line   { height: 0.875em; margin-bottom: 0.5em; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card   { padding: 1rem; }
@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* =====================================================================
   Tooltips
   ===================================================================== */
.custom-tooltip {
    position: fixed;
    background: var(--color-bg-elevated);
    color: var(--color-text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    line-height: 1.5;
    max-width: 340px;
    white-space: normal;
    z-index: 9999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    border: 1px solid var(--color-accent-gold);
}
.custom-tooltip.visible { opacity: 1; }
.custom-tooltip strong { color: var(--color-accent-gold); font-weight: 600; }
.custom-tooltip em     { color: var(--color-accent-champagne); font-style: italic; }
/* Status-Chip im Hover-Detail — hebt den Status farbig hervor */
.custom-tooltip .tt-status {
    display: inline-block;
    padding: 0.02rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.92em;
    background: rgba(216, 198, 154, 0.22);
    color: var(--color-accent-champagne);
    border: 1px solid rgba(216, 198, 154, 0.5);
}
.custom-tooltip .tt-status--ok   { background: rgba(58, 125, 68, 0.28);  color: #a7e0b0; border-color: rgba(58, 125, 68, 0.6); }
.custom-tooltip .tt-status--warn { background: rgba(200, 150, 60, 0.26); color: #e9c893; border-color: rgba(200, 150, 60, 0.6); }
.custom-tooltip .tt-status--bad  { background: rgba(200, 90, 85, 0.26);  color: #e6a9a4; border-color: rgba(200, 90, 85, 0.6); }
.custom-tooltip-arrow {
    position: absolute;
    width: 0; height: 0;
    border: 6px solid transparent;
}
.custom-tooltip[data-position="top"]    .custom-tooltip-arrow { bottom: -12px; left: 50%; transform: translateX(-50%); border-top-color: var(--color-accent-gold); }
.custom-tooltip[data-position="bottom"] .custom-tooltip-arrow { top: -12px;    left: 50%; transform: translateX(-50%); border-bottom-color: var(--color-accent-gold); }
.custom-tooltip[data-position="left"]   .custom-tooltip-arrow { right: -12px;  top: 50%;  transform: translateY(-50%); border-left-color: var(--color-accent-gold); }
.custom-tooltip[data-position="right"]  .custom-tooltip-arrow { left: -12px;   top: 50%;  transform: translateY(-50%); border-right-color: var(--color-accent-gold); }

/* =====================================================================
   Toast-Notifications
   ===================================================================== */
.toast-container {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    z-index: 10000;
    max-width: 360px;
}
@media (max-width: 640px) {
    .toast-container {
        right: 0.75rem; left: 0.75rem; bottom: 0.75rem;
        max-width: none;
    }
}
.toast {
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    border-left: 3px solid var(--color-accent-gold);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: toast-slide 0.25s ease-out;
}
@keyframes toast-slide {
    from { transform: translateX(110%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}
.toast.hide { animation: toast-out 0.25s ease-in forwards; }
@keyframes toast-out {
    from { transform: translateX(0);    opacity: 1; }
    to   { transform: translateX(110%); opacity: 0; }
}
.toast--success { border-left-color: var(--color-success); }
.toast--info    { border-left-color: var(--color-info); }
.toast--warning { border-left-color: var(--color-warning); }
.toast--danger  { border-left-color: var(--color-danger); }
.toast-icon  { flex-shrink: 0; }
.toast-body  { flex: 1; min-width: 0; font-size: var(--text-sm); }
.toast-close {
    background: none;
    border: 0;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.toast-close:hover { color: var(--color-text-primary); }

/* =====================================================================
   Mobile Navigation
   ===================================================================== */
.navbar-hamburger {
    display: none;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    color: var(--color-text-primary);
}
@media (max-width: 767px) {
    .navbar-hamburger { display: inline-flex; align-items: center; justify-content: center; }
    .navbar-links { display: none; }
}
.nav-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.nav-drawer-backdrop.visible { opacity: 1; pointer-events: auto; }

.nav-drawer {
    position: fixed;
    top: 0; right: 0;
    width: min(320px, 80vw);
    height: 100vh;
    background: var(--color-bg-card);
    border-left: 1px solid var(--color-border-subtle);
    box-shadow: var(--shadow-lg);
    transform: translateX(110%);
    transition: transform 0.25s ease;
    z-index: 9001;
    padding: 1rem;
    overflow-y: auto;
}
.nav-drawer.open { transform: translateX(0); }
.nav-drawer a {
    display: block;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid var(--color-border-subtle);
    color: var(--color-text-primary);
    text-decoration: none;
}
.nav-drawer a:hover { color: var(--color-accent-gold); }
.nav-drawer-close {
    background: none;
    border: 0;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.5rem;
    margin-bottom: 0.75rem;
}

/* =====================================================================
   Form-Elemente (Mobile-first)
   ===================================================================== */
@media (max-width: 640px) {
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 0.75rem;
        font-size: 16px; /* verhindert iOS-Zoom */
    }
    .btn { min-height: 44px; }
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-accent-gold);
    box-shadow: var(--shadow-gold-glow);
}

/* =====================================================================
   Kontakt-Picker (Phase 2.11.2)
   ===================================================================== */
.kp-root { position: relative; display: block; }
.kp-display {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: 0.375rem; padding: 0.375rem 0.5rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    min-height: 40px;
}
.kp-display:focus-within {
    border-color: var(--color-accent-gold);
    box-shadow: var(--shadow-gold-glow);
}
.kp-chips { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.kp-chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    background: rgba(201,169,110,0.12);
    color: var(--color-accent-gold);
    border: 1px solid var(--color-accent-gold);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: var(--text-sm);
}
.kp-chip-x {
    background: none; border: 0; color: inherit;
    cursor: pointer; font-size: 1.1em; line-height: 1; padding: 0 2px;
}
.kp-input {
    flex: 1; min-width: 180px;
    background: transparent; border: 0;
    padding: 4px 6px;
    color: var(--color-text-primary);
    font-family: inherit; font-size: var(--text-base);
    outline: none;
}

.kp-dropdown {
    position: absolute; top: calc(100% + 4px);
    left: 0; right: 0;
    background: var(--color-bg-card);
    border: 1px solid var(--color-accent-gold);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1500;
    max-height: 360px;
    overflow-y: auto;
}
.kp-result {
    display: flex; align-items: flex-start; gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border-subtle);
    min-height: 56px;
}
.kp-result:last-child { border-bottom: none; }
.kp-result:hover, .kp-result--hl { background: var(--color-bg-elevated); }
.kp-result-main { flex: 1; min-width: 0; }
.kp-result-label {
    color: var(--color-text-primary);
    font-weight: 500; word-break: break-word;
}
.kp-result-sub  { color: var(--color-text-secondary); font-size: var(--text-xs); margin-top: 2px; }
.kp-result-tert { color: var(--color-text-muted);     font-size: var(--text-xs); margin-top: 2px; }
.kp-result-more   { text-align: center; color: var(--color-accent-gold); font-style: italic; }
.kp-result-create { text-align: center; color: var(--color-accent-gold); font-weight: 600; }
.kp-badge {
    display: inline-block; padding: 1px 6px;
    border-radius: 4px; font-size: var(--text-xs); font-weight: 600;
    margin-left: 0.25rem;
}
.kp-badge-user { background: rgba(115,151,179,0.18); color: var(--color-info); }
.kp-badge-fav  { background: rgba(212,165,83,0.18);  color: var(--color-warning); }
.kp-empty {
    padding: 1.5rem 1rem; text-align: center;
    color: var(--color-text-muted); font-style: italic;
}

/* Picker-Modal (Sidepanel) */
.kp-modal { position: fixed; inset: 0; z-index: 9200; display: flex; align-items: stretch; justify-content: flex-end; }
.kp-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }
.kp-modal-content {
    position: relative;
    width: 480px; max-width: 100vw; height: 100vh;
    background: var(--color-bg-card);
    border-left: 1px solid var(--color-accent-gold);
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: kp-slide-in 0.2s ease-out;
}
@keyframes kp-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
.kp-modal-header   { display: flex; align-items: center; justify-content: space-between; padding: 0.75rem 1rem; border-bottom: 1px solid var(--color-border-subtle); }
.kp-modal-header h3 { margin: 0; color: var(--color-accent-gold); font-size: var(--text-lg); }
.kp-modal-close    { background: none; border: 0; color: var(--color-text-secondary); font-size: 24px; cursor: pointer; line-height: 1; padding: 0 4px; }
.kp-modal-toolbar  {
    padding: 0.75rem 1rem; border-bottom: 1px solid var(--color-border-subtle);
    display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap;
    position: sticky; top: 0; background: var(--color-bg-card); z-index: 2;
}
.kp-modal-search   {
    flex: 1; min-width: 200px; padding: 0.5rem 0.75rem;
    background: var(--color-bg-elevated); color: var(--color-text-primary);
    border: 1px solid var(--color-border-subtle); border-radius: var(--radius-sm);
    font-size: var(--text-base);
}
.kp-modal-toggle   { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--color-text-secondary); font-size: var(--text-sm); }
.kp-modal-list     { flex: 1; overflow-y: auto; padding: 0.25rem 0; }
.kp-modal-item     { padding: 0.875rem 1rem; border-bottom: 1px solid var(--color-border-subtle); cursor: pointer; min-height: 56px; }
.kp-modal-item:hover { background: var(--color-bg-elevated); }
.kp-modal-footer   { padding: 0.75rem 1rem; border-top: 1px solid var(--color-border-subtle); display: flex; justify-content: space-between; align-items: center; }
.kp-modal-count    { color: var(--color-text-muted); font-size: var(--text-sm); }

@media (max-width: 640px) {
    .kp-modal-content { width: 100vw; border-left: none; }
}

/* =====================================================================
   Icon-Katalog (Test-Seite)
   ===================================================================== */
.icon-catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.5rem;
}
.icon-catalog-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.75rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    text-align: center;
    background: var(--color-bg-card);
}
.icon-catalog-item code {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-top: 0.5rem;
    word-break: break-all;
}

/* =====================================================================
   UI-HOTFIX 2 — Generic Modal (confirmModal/alertModal/promptModal)
   ===================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.18s ease;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay.visible { opacity: 1; }

.modal-dialog {
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    max-width: 480px;
    width: 90%;
    transform: translateY(20px);
    transition: transform 0.18s ease;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}
.modal-overlay.visible .modal-dialog { transform: translateY(0); }

.modal-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--color-border-subtle);
}
.modal-title {
    margin: 0;
    font-size: 1.125rem;
    color: var(--color-accent-gold);
    font-weight: 600;
}
.modal-body {
    padding: 1.25rem 1.5rem;
    color: var(--color-text-primary);
    overflow-y: auto;
    flex: 1 1 auto;
}
.modal-body p { margin: 0 0 0.75rem; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body label { display: block; margin-bottom: 0.35rem; color: var(--color-text-secondary); font-size: var(--text-sm); }
.modal-body input[type="text"],
.modal-body textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-sm);
    color: var(--color-text-primary);
    font-size: var(--text-sm);
    font-family: inherit;
}
.modal-body input[type="text"]:focus,
.modal-body textarea:focus {
    outline: none;
    border-color: var(--color-accent-gold);
}
.modal-body .modal-error {
    margin-top: 0.4rem;
    color: var(--color-danger);
    font-size: var(--text-xs);
    min-height: 1em;
}
.modal-footer {
    padding: 0.9rem 1.5rem;
    border-top: 1px solid var(--color-border-subtle);
    display: flex;
    gap: 0.6rem;
    justify-content: flex-end;
}

.modal-confirm-danger .btn-confirm,
.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}
.modal-confirm-danger .btn-confirm:hover,
.btn-danger:hover { filter: brightness(1.1); }

@media (max-width: 480px) {
    .modal-dialog { width: 95%; }
}

/* Modal-XL fuer Dokument-Viewer (Phase 2.13 Etappe 2b) */
.modal-dialog--xl {
    max-width: 1100px;
    width: 92%;
    max-height: 92vh;
    transition: max-width 0.2s ease;
}
/* Edit-Mode: Modal wird breiter, Body wird Split-View */
.modal-dialog--xl.modal-dialog--edit-mode {
    max-width: 1500px;
}
.modal-dialog--xl .modal-body {
    padding: 0;
    background: #1a1a1a;
    flex: 1 1 auto;
    overflow: hidden;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    min-height: 60vh;
}
.dok-viewer-iframe-wrap {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    justify-content: center;
    overflow: auto;
    background: #1a1a1a;
}
.modal-dialog--xl .modal-body iframe {
    width: 100%;
    height: 70vh;
    border: none;
    background: #fff;
}
.modal-dialog--xl .modal-body img.dok-viewer-img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    display: block;
    margin: auto;
}

/* Edit-Panel rechts neben dem Viewer im edit-mode */
.dok-viewer-edit-panel {
    width: 0;
    flex: 0 0 auto;
    background: var(--color-bg-card);
    border-left: 1px solid var(--color-border-subtle);
    padding: 0;
    overflow-y: auto;
    transition: width 0.18s ease, padding 0.18s ease;
}
.modal-dialog--edit-mode .dok-viewer-edit-panel {
    width: 480px;
    padding: 1rem 1.25rem;
}
.modal-dialog--edit-mode .dok-viewer-edit-panel[hidden] {
    width: 0;
    padding: 0;
}
.dok-viewer-edit-panel h3 {
    margin: 0 0 0.25rem;
    color: var(--baustein-vertrag);
    font-size: 1rem;
}
.dok-edit-hint {
    font-size: var(--text-xs);
    margin: 0 0 0.85rem;
}
.dok-viewer-edit-panel .form-group {
    margin-bottom: 0.7rem;
}
.dok-viewer-edit-panel label {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}
.dok-viewer-edit-panel input,
.dok-viewer-edit-panel select,
.dok-viewer-edit-panel textarea {
    width: 100%;
    padding: 0.4rem 0.55rem;
    font-size: var(--text-sm);
    background: var(--color-bg-deep, var(--bg-base));
    border: 1px solid var(--color-border-subtle);
    border-radius: 3px;
    color: var(--color-text-primary);
}
.dok-viewer-edit-panel textarea { resize: vertical; }

/* Im edit-mode: iframe schmaler, weil das Panel rechts Platz nimmt */
@media (max-width: 1100px) {
    .modal-dialog--edit-mode { max-width: 95%; }
    .modal-dialog--edit-mode .modal-body { flex-direction: column; }
    .modal-dialog--edit-mode .dok-viewer-edit-panel { width: 100% !important; border-left: none; border-top: 1px solid var(--color-border-subtle); }
}
.dok-viewer-loading,
.dok-viewer-fallback {
    color: var(--color-text-secondary);
    padding: 3rem 1.5rem;
    text-align: center;
    font-size: var(--text-sm);
}
.dok-viewer-fallback strong { color: var(--color-text-primary); }
.modal-close {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    margin-left: auto;
    padding: 0 0.25rem;
}
.modal-close:hover { color: var(--color-accent-gold); }

.modal-header { display: flex; align-items: center; gap: 0.5rem; }
.modal-header .modal-title { flex: 1; }

/* Share-Submodal (Phase 2.13 Etappe 2b) */
.modal-share .modal-dialog { max-width: 460px; }
.modal-share .modal-overlay { z-index: 10100; }
.dok-share-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.dok-share-opt {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    background: var(--color-bg-card);
    color: var(--color-text-primary);
    text-decoration: none;
    cursor: pointer;
    text-align: left;
    font: inherit;
    transition: background 0.12s, border-color 0.12s;
}
.dok-share-opt:hover {
    background: var(--color-bg-elevated);
    border-color: var(--color-accent-gold);
}
.dok-share-opt--wa:hover   { border-color: #4caf50; }
.dok-share-opt--mail:hover { border-color: #5cb3ff; }
.dok-share-icon { font-size: 1.5rem; flex-shrink: 0; }
.dok-share-opt-titel { font-weight: 600; }
.dok-share-opt-sub { font-size: var(--text-xs); color: var(--color-text-secondary); }

/* =====================================================================
   UI-HOTFIX 2 — Danger Zone (Fall-Loeschung)
   ===================================================================== */
.danger-zone {
    margin-top: 2.5rem;
    padding: 1.25rem 1.5rem;
    border: 1px solid var(--color-danger);
    border-radius: var(--radius-md);
    background: rgba(220, 53, 69, 0.05);
}
.danger-zone h3 {
    margin: 0 0 0.25rem;
    color: var(--color-danger);
    font-size: 1rem;
}
.danger-zone p {
    margin: 0 0 1rem;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
}

/* =====================================================================
   Phase 2.13 (Etappe 10) — Collapsible Sections + Upload-Boxen
   ===================================================================== */
.collapsible > .collapsible-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: default;
}
.collapsible-toggle {
    background: transparent;
    border: 1px solid var(--color-border-subtle);
    color: var(--color-text-secondary);
    padding: 0.25rem 0.45rem;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-left: auto;
    line-height: 1;
    transition: background 0.12s, color 0.12s;
}
.collapsible-toggle:hover {
    background: var(--color-bg-elevated);
    color: var(--color-accent-gold);
    border-color: var(--color-accent-gold);
}

/* Info-Button in Section-Headers — Custom-Tooltip-Modal trigger */
.section-info-btn {
    background: transparent;
    border: 1px solid var(--color-border-subtle);
    color: var(--baustein-color, var(--color-text-secondary));
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    transition: background 0.12s;
    margin-left: 0.3rem;
}
.section-info-btn:hover {
    background: var(--baustein-color, var(--color-accent-gold));
    color: #fff;
    border-color: var(--baustein-color, var(--color-accent-gold));
}

/* Section-Info-Modal: Inhalt-Styling */
.modal-section-info .modal-body h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    color: var(--color-accent-gold);
}
.modal-section-info .modal-body p {
    margin: 0 0 0.7rem;
    line-height: 1.45;
    font-size: var(--text-sm);
}
.modal-section-info .modal-body ul {
    margin: 0 0 0.7rem;
    padding-left: 1.25rem;
    font-size: var(--text-sm);
    line-height: 1.45;
}
.modal-section-info .modal-body ul li { margin-bottom: 0.25rem; }
.modal-section-info .modal-body .info-hint {
    background: rgba(255, 193, 7, 0.10);
    border-left: 3px solid #FFC107;
    padding: 0.5rem 0.7rem;
    border-radius: 3px;
    color: var(--color-text-secondary);
    font-size: var(--text-sm);
    margin: 0.5rem 0 0;
}

/* =====================================================================
   Phase 2.13 UI-Polish — Hover-Preview in der Fall-Liste (Desktop only)
   ===================================================================== */
.fall-hover-preview {
    position: absolute;
    z-index: 5000;
    min-width: 280px;
    max-width: 360px;
    background: var(--color-bg-elevated, #1c1c1c);
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    padding: 0.75rem 0.85rem;
    font-size: var(--text-sm);
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.16s ease, transform 0.16s ease;
    pointer-events: none;
}
.fall-hover-preview.visible {
    opacity: 1;
    transform: translateY(0);
}
.fhp-header {
    margin-bottom: 0.55rem;
    border-bottom: 1px solid var(--color-border-subtle);
    padding-bottom: 0.4rem;
}
.fhp-nummer {
    font-family: var(--font-mono, monospace);
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.fhp-name {
    font-weight: 700;
    color: var(--color-text-primary);
    margin-top: 0.1rem;
}
.fhp-status {
    font-size: var(--text-xs);
    color: var(--color-accent-gold);
    margin-top: 0.2rem;
}
.fhp-bausteine {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.fhp-baustein {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: var(--text-xs);
}
.fhp-baustein-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: rgba(108, 117, 125, 0.25);
}
.fhp-baustein--vollstaendig[data-baustein="mandant"]    .fhp-baustein-dot { background: var(--baustein-mandant); }
.fhp-baustein--vollstaendig[data-baustein="vertrag"]    .fhp-baustein-dot { background: var(--baustein-vertrag); }
.fhp-baustein--vollstaendig[data-baustein="rsv"]        .fhp-baustein-dot { background: var(--baustein-rsv); }
.fhp-baustein--vollstaendig[data-baustein="gegenseite"] .fhp-baustein-dot { background: var(--baustein-gegenseite); }
.fhp-baustein--vollstaendig[data-baustein="vollmacht"]  .fhp-baustein-dot { background: var(--baustein-vollmacht); }
.fhp-baustein--unvollstaendig .fhp-baustein-dot { background: rgba(255, 193, 7, 0.6); }
.fhp-baustein--vollstaendig .fhp-baustein-glyph { color: var(--baustein-color, var(--color-accent-gold)); }
.fhp-baustein--unvollstaendig .fhp-baustein-glyph { color: #FFC107; }
.fhp-baustein--fehlt .fhp-baustein-glyph { color: var(--color-text-muted); }
.fhp-baustein-label { flex: 1; color: var(--color-text-primary); }
.fhp-baustein-glyph {
    font-weight: 700;
    margin-left: auto;
    font-size: 0.95rem;
    line-height: 1;
}
.fhp-extras {
    margin-top: 0.5rem;
    padding-top: 0.4rem;
    border-top: 1px solid var(--color-border-subtle);
    font-size: var(--text-xs);
    line-height: 1.45;
}
.fhp-row { color: var(--color-text-primary); margin-bottom: 0.15rem; }
.fhp-row--muted { color: var(--color-text-muted); }
.fhp-label { color: var(--color-text-secondary); font-weight: 600; margin-right: 0.25rem; }
.collapsible-toggle .chevron {
    transition: transform 0.18s ease;
    display: block;
}
.collapsible[data-collapsed="true"] > .collapsible-header .collapsible-toggle .chevron {
    transform: rotate(-90deg);
}

/* Body: alle direkten Kinder ausser dem Header ausblenden im collapsed-State.
   Bewusst KEIN Wrapper — bestehende JS-onclick-Handler mit DOM-Sibling-Logik
   in fall_show.php bleiben so funktional. */
.collapsible[data-collapsed="true"] > *:not(.collapsible-header) {
    display: none;
}
/* Section behaelt im collapsed-State minimal padding (nur Header) */
.collapsible[data-collapsed="true"].baustein-section {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

/* Toolbar oberhalb der Bausteine-Sections */
.bausteine-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: 0.5rem 0.75rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
}
.bausteine-toolbar-label {
    font-size: var(--text-xs);
    margin-right: 0.25rem;
}
.bausteine-toolbar-btn {
    padding: 0.3rem 0.7rem;
    font-size: var(--text-xs);
}
.bausteine-toolbar-btn .icon,
.bausteine-toolbar-btn svg {
    flex-shrink: 0;
}

/* =====================================================================
   Phase 2.13 — Sektion-Farbsystem (prägnant, klar unterscheidbar)
   Stand 2026-05-14: ersetzt die ursprünglichen Gold-Töne durch
   distinkte Farben pro Sektion — bessere Wiedererkennung auf Handy
   und Tablet, klare Hierarchie über Farbpsychologie.
   ===================================================================== */
:root {
    --baustein-mandant:     #C9A656;  /* Gold — Herzstück, bleibt */
    --baustein-vertrag:     #2E7D32;  /* Forest Green — Streitgegenstand */
    --baustein-rsv:         #00838F;  /* Teal — Rechtsschutz */
    --baustein-gegenseite:  #B71C1C;  /* Burgundy/Rot — Gegner */
    --baustein-vollmacht:   #1565C0;  /* Royal Blue — rechtlich verbindlich */
    --baustein-mail:        #0078D4;  /* Outlook-Blau — Mail-Verlauf */
    --baustein-deckung:     #6A1B9A;  /* Lila/Violett — Deckungsanfrage */

    --baustein-mandant-bg:    rgba(201, 166, 86, 0.10);
    --baustein-vertrag-bg:    rgba(46, 125, 50, 0.10);
    --baustein-rsv-bg:        rgba(0, 131, 143, 0.10);
    --baustein-gegenseite-bg: rgba(183, 28, 28, 0.10);
    --baustein-vollmacht-bg:  rgba(21, 101, 192, 0.10);
    --baustein-mail-bg:       rgba(0, 120, 212, 0.10);
    --baustein-deckung-bg:    rgba(106, 27, 154, 0.10);
}

/* --- Baustein-Section (kompakt für Handy/Tablet) --- */
.baustein-section {
    position: relative;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    padding: 0.55rem 0.85rem 0.65rem 1.25rem;
    margin-bottom: 0.55rem;
    overflow: hidden;
}
.baustein-section::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 6px;
    background: var(--baustein-color, var(--color-accent-gold));
}
.baustein-section[data-baustein="mandant"]    { --baustein-color: var(--baustein-mandant); }
.baustein-section[data-baustein="vertrag"]    { --baustein-color: var(--baustein-vertrag); }
.baustein-section[data-baustein="rsv"]        { --baustein-color: var(--baustein-rsv); }
.baustein-section[data-baustein="gegenseite"] { --baustein-color: var(--baustein-gegenseite); }
.baustein-section[data-baustein="vollmacht"]  { --baustein-color: var(--baustein-vollmacht); }
.baustein-section[data-baustein="mail"]       { --baustein-color: var(--baustein-mail); }
.baustein-section[data-baustein="deckung"]    { --baustein-color: var(--baustein-deckung); }

.baustein-section .section-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.baustein-section .section-header h2 {
    color: var(--baustein-color);
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.2;
}

.baustein-section .btn-baustein {
    background: var(--baustein-color);
    color: #fff;
    border: none;
    padding: 0.35rem 0.85rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: var(--text-sm);
    cursor: pointer;
    line-height: 1.3;
}
/* Mandant-Gold ist hell — schwarze Schrift fuer guten Kontrast */
.baustein-section[data-baustein="mandant"] .btn-baustein,
.baustein-section[data-baustein="mandant"] .btn-primary {
    color: #1a1a1a;
}
.baustein-section .btn-baustein:hover { filter: brightness(1.1); }
.baustein-section .btn-baustein-outline {
    background: transparent;
    border: 1.5px solid var(--baustein-color);
    color: var(--baustein-color);
}

/* Globale Button-Kompaktheit: alle .btn in Bausteine-Sections kompakter + fett */
.baustein-section .btn {
    padding: 0.35rem 0.85rem;
    font-size: var(--text-sm);
    font-weight: 700;
    line-height: 1.3;
}
.baustein-section .btn-primary {
    background: var(--baustein-color);
    border-color: var(--baustein-color);
    color: #fff;
}
.baustein-section .btn-primary:hover { filter: brightness(1.1); }
.baustein-section .btn-secondary {
    background: transparent;
    border: 1.5px solid var(--baustein-color);
    color: var(--baustein-color);
}
.baustein-section .btn-secondary:hover {
    background: var(--baustein-color);
    color: #fff;
}
.baustein-section .btn-ghost {
    font-weight: 600;
}

/* Markup-Margins innerhalb der Section kleiner */
.baustein-section .mb-3 { margin-bottom: 0.5rem !important; }
.baustein-section .mb-4 { margin-bottom: 0.6rem !important; }
.baustein-section .mt-3 { margin-top: 0.5rem !important; }
.baustein-section .mt-4 { margin-top: 0.6rem !important; }
.baustein-section .form-group { margin-bottom: 0.5rem; }
.baustein-section .alert { padding: 0.5rem 0.7rem; margin-bottom: 0.5rem; font-size: var(--text-sm); }

.baustein-status {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 3px;
    font-size: var(--text-xs, 0.75rem);
    font-weight: 600;
    letter-spacing: 0.02em;
}
.baustein-status[data-status="vollstaendig"] {
    background: var(--baustein-color, var(--color-accent-gold));
    color: var(--bg-base);
}
.baustein-status[data-status="unvollstaendig"] {
    background: rgba(255, 193, 7, 0.18);
    color: #FFC107;
}
.baustein-status[data-status="fehlt"] {
    background: rgba(108, 117, 125, 0.18);
    color: var(--color-text-muted, #9a9a9a);
}

/* --- Fortschritt-Widget: Segment-Farben je Baustein (Override der Default-Grün-Regel) --- */
.fortschritt-segment.completed[data-baustein="mandant"]    { background: var(--baustein-mandant); }
.fortschritt-segment.completed[data-baustein="vertrag"]    { background: var(--baustein-vertrag); }
.fortschritt-segment.completed[data-baustein="rsv"]        { background: var(--baustein-rsv); }
.fortschritt-segment.completed[data-baustein="gegenseite"] { background: var(--baustein-gegenseite); }
.fortschritt-segment.completed[data-baustein="vollmacht"]  { background: var(--baustein-vollmacht); }
.fortschritt-segment.completed[data-baustein="mail"]       { background: var(--baustein-mail); }
.fortschritt-segment.completed[data-baustein="deckung"]    { background: var(--baustein-deckung); }

/* --- Mini-Progress in Fall-Liste --- */
.mini-progress-segment.completed[data-baustein="mandant"]    { background: var(--baustein-mandant); }
.mini-progress-segment.completed[data-baustein="vertrag"]    { background: var(--baustein-vertrag); }
.mini-progress-segment.completed[data-baustein="rsv"]        { background: var(--baustein-rsv); }
.mini-progress-segment.completed[data-baustein="gegenseite"] { background: var(--baustein-gegenseite); }
.mini-progress-segment.completed[data-baustein="vollmacht"]  { background: var(--baustein-vollmacht); }
.mini-progress-segment.completed[data-baustein="mail"]       { background: var(--baustein-mail); }
.mini-progress-segment.completed[data-baustein="deckung"]    { background: var(--baustein-deckung); }

/* --- KI-erkannte Felder (Phase 2.13: visuell markieren) --- */
.field-ki-erkannt input,
.field-ki-erkannt textarea,
.field-ki-erkannt select {
    border-left: 3px solid var(--baustein-color, var(--color-accent-gold));
    background: linear-gradient(
        90deg,
        rgba(201, 166, 86, 0.06) 0%,
        transparent 30%
    );
}
.ki-badge {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    background: var(--baustein-color, var(--color-accent-gold));
    color: var(--bg-base);
    vertical-align: middle;
    margin-left: 0.4rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* =====================================================================
   Phase 2.13 — Inline-Upload pro Baustein (Etappe 5)
   ===================================================================== */
.baustein-upload {
    margin-top: 1rem;
    padding: 0.85rem 1rem;
    border: 1px dashed var(--baustein-color, var(--color-border-subtle));
    border-radius: 6px;
    background: var(--color-bg-card);
}
.baustein-upload-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--text-sm, 0.875rem);
    color: var(--baustein-color, var(--color-text-secondary));
    font-weight: 600;
    margin-bottom: 0.6rem;
}
.baustein-upload-header svg { flex-shrink: 0; }
.baustein-upload-typ {
    margin-left: auto;
    font-size: var(--text-xs, 0.75rem);
    padding: 0.2rem 0.45rem;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    color: var(--color-text-primary);
    border-radius: 3px;
}
/* Wenn Typ-Switcher vorhanden ist, dann setzt der margin-left:auto; sonst
   tut es der Toggle-Button automatisch. */
.baustein-upload-header .collapsible-toggle {
    margin-left: 0.4rem;
}

/* Hochladen-Button: kompakt + zentriert (statt btn-block) */
.upload-submit-wrap {
    display: flex;
    justify-content: center;
    margin-top: 0.6rem;
}
.upload-submit-wrap .upload-submit {
    padding: 0.5rem 1.75rem;
    min-width: 180px;
    max-width: 260px;
}

/* In der Baustein-Section: Upload-Component etwas kompakter,
   Trigger-Button in Baustein-Farbe. */
.baustein-section .baustein-upload .upload-component {
    margin-top: 0;
}
.baustein-section .baustein-upload .upload-trigger,
.baustein-section .baustein-upload .upload-submit {
    background: var(--baustein-color, var(--color-accent-gold));
    color: var(--bg-base);
    border-color: var(--baustein-color, var(--color-accent-gold));
}
.baustein-section .baustein-upload .upload-trigger:hover,
.baustein-section .baustein-upload .upload-submit:hover {
    filter: brightness(1.1);
}
.baustein-section .baustein-upload .upload-trigger:disabled,
.baustein-section .baustein-upload .upload-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* =====================================================================
   Phase 2.13 — Dokument-Liste (Etappe 2)
   ===================================================================== */
.dokument-liste-section {
    margin-top: 1.5rem;
}
.dokument-liste { width: 100%; }
.dokument-liste th,
.dokument-liste td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--color-border-subtle);
    text-align: left;
    font-size: var(--text-sm, 0.875rem);
    vertical-align: middle;
}
.dokument-liste tr:last-child td { border-bottom: none; }

.dokument-typ-badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 3px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--bg-base);
    white-space: nowrap;
}
.dokument-kurzbeschreibung {
    margin-top: 0.25rem;
    font-size: var(--text-xs, 0.75rem);
    line-height: 1.35;
    max-width: 60ch;
}

/* Phase 2.13 — Belege-Liste im Streitgegenstand-Bauteil */
.vertrag-belege {
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border-subtle);
}
.vertrag-belege-titel {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    color: var(--baustein-vertrag);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 600;
}
.vertrag-belege-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.vertrag-belege-item {
    padding: 0.5rem 0.7rem;
    border-left: 3px solid var(--baustein-vertrag);
    background: rgba(212, 184, 136, 0.05);
    border-radius: 3px;
}
.vertrag-belege-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.vertrag-belege-name {
    font-weight: 500;
}
.vertrag-belege-item--relevant {
    border-left-width: 4px;
    background: rgba(212, 184, 136, 0.09);
}
.vertrag-belege-wert {
    margin-left: auto;
    font-weight: 600;
    color: var(--baustein-vertrag);
    font-size: var(--text-sm);
    white-space: nowrap;
}
.vertrag-belege-wert--leer {
    color: var(--color-text-muted);
    font-weight: normal;
}
.vertrag-belege-summe {
    margin-top: 0.75rem;
    padding: 0.7rem 0.85rem;
    background: rgba(212, 184, 136, 0.15);
    border-left: 4px solid var(--baustein-vertrag);
    border-radius: 3px;
}
.vertrag-belege-summe-zeile {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.vertrag-belege-summe-wert {
    color: var(--baustein-vertrag);
    font-size: 1.05rem;
}
.vertrag-belege-summe-aktion {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
    flex-wrap: wrap;
}
.dokument-typ-badge--neutral {
    background: rgba(108, 117, 125, 0.3);
    color: var(--color-text-primary);
}

.dokument-aktionen { white-space: nowrap; }

.btn-icon {
    background: transparent;
    border: 1px solid var(--color-border-subtle);
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    margin: 0 1px;
    color: var(--color-text-primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    line-height: 1;
}
.btn-icon:hover {
    background: var(--color-bg-elevated);
    color: var(--color-accent-gold);
    border-color: var(--color-accent-gold);
}
.btn-icon-danger:hover {
    background: rgba(220, 53, 69, 0.12);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

@media (max-width: 768px) {
    .dokument-liste thead { display: none; }
    .dokument-liste,
    .dokument-liste tbody,
    .dokument-liste tr,
    .dokument-liste td { display: block; }
    .dokument-liste tr {
        margin-bottom: 0.75rem;
        padding: 0.5rem 0.75rem;
        border: 1px solid var(--color-border-subtle);
        border-radius: 6px;
    }
    .dokument-liste td {
        border: none;
        padding: 0.25rem 0;
    }
    .dokument-liste td::before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--color-text-secondary);
        margin-right: 0.4rem;
    }
}

/* =====================================================================
   Phase 2.13 UI-Compact — globaler Kompakt-Pass (Stand 2026-05-14)
   Overridet die großzügigen Defaults in app.css. Mobile-First Footprint,
   2-zeilige Buttons sind nicht mehr drin, Text-Kontrast hochgezogen.
   ===================================================================== */

/* Text-Kontrast: text-muted heller (80%-Regel Lesbarkeit) */
:root {
    --text-muted:           #b3a584;
    --color-text-muted:     #b3a584;
}

/* Inputs / Textarea / Select kompakt — 16px font (iOS-Zoom-Schutz) bleibt */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
textarea,
select {
    padding: 0.4rem 0.6rem;
    line-height: 1.3;
    border-radius: 4px;
}
textarea { line-height: 1.4; min-height: 2.2rem; }

/* Form-Group und Label-Abstände runter */
.form-group {
    margin-bottom: 0.5rem;
}
label {
    margin-bottom: 0.2rem;
    font-size: var(--text-xs);
}
.helper {
    margin-top: 0.2rem;
    font-size: var(--text-xs);
}

/* Buttons global kompakt */
.btn {
    padding: 0.35rem 0.85rem;
    font-size: var(--text-sm);
    line-height: 1.25;
    border-radius: 4px;
    font-weight: 600;
}
@media (min-width: 768px) {
    .btn { padding: 0.35rem 1rem; }
}
.btn-with-icon { gap: 0.4rem; }
.btn-block {
    /* btn-block soll nicht mehr riesig sein — auch wenn full-width, dann kompakt */
    padding: 0.45rem 0.85rem;
}

/* Panels generell kompakter */
.panel {
    padding: 0.7rem 0.9rem;
    border-radius: 6px;
}

/* Alerts kompakt */
.alert {
    padding: 0.45rem 0.7rem;
    margin-bottom: 0.5rem;
    font-size: var(--text-sm);
    border-radius: 4px;
}

/* Modal — Header/Body/Footer Padding deutlich runter */
.modal-dialog { border-radius: 6px; }
.modal-header {
    padding: 0.55rem 0.85rem;
}
.modal-header .modal-title { font-size: 1rem; font-weight: 700; }
.modal-body {
    padding: 0.7rem 0.9rem;
}
.modal-body p { margin: 0 0 0.5rem; line-height: 1.4; }
.modal-body label { margin-bottom: 0.2rem; }
.modal-body input[type="text"],
.modal-body textarea {
    padding: 0.35rem 0.55rem;
}
.modal-body .modal-error {
    margin-top: 0.3rem;
    min-height: 0.9em;
}
.modal-footer {
    padding: 0.5rem 0.85rem;
    gap: 0.4rem;
}

/* Section-Info-Modal: Listen kompakter */
.modal-section-info .modal-body ul { margin: 0 0 0.5rem; padding-left: 1.1rem; }
.modal-section-info .modal-body ul li { margin-bottom: 0.15rem; line-height: 1.35; }
.modal-section-info .modal-body p { margin: 0 0 0.4rem; line-height: 1.4; }
.modal-section-info .modal-body .info-hint { padding: 0.4rem 0.6rem; }

/* Mandant-Readout / Detail-Anzeigen kompakter */
.mandant-readout { padding: 0; }
.mandant-line { line-height: 1.35; }
.mandant-readout .mandant-line.mt-2 { margin-top: 0.25rem !important; }
.mandant-readout .mandant-line.mt-3 { margin-top: 0.35rem !important; }

/* Generelle margin-Klassen in der gesamten App komprimieren wo unnötig groß */
.mb-5 { margin-bottom: 0.85rem !important; }
.mt-5 { margin-top: 0.85rem !important; }
.mb-6 { margin-bottom: 1rem !important; }

/* Helper-Text in Mandant-Form: kompakter */
.field-ki-erkannt input,
.field-ki-erkannt textarea {
    border-left-width: 3px;
}

/* Ki-Badge kompakter */
.ki-badge {
    font-size: 0.65rem;
    padding: 0.05rem 0.35rem;
    margin-left: 0.3rem;
}

/* Kleiner Edit-Button neben Aussendienst/Sachbearbeiter (Modal-Trigger) */
.btn-icon-edit {
    background: transparent;
    border: 1px solid var(--color-border-subtle);
    color: var(--color-text-secondary);
    padding: 0.15rem 0.35rem;
    margin-left: 0.4rem;
    border-radius: 3px;
    cursor: pointer;
    line-height: 1;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.btn-icon-edit:hover {
    background: var(--color-accent-gold);
    color: var(--bg-base);
    border-color: var(--color-accent-gold);
}

/* Form-Felder: exakte gleiche Höhe für input + select (Anrede-Bugfix) */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
select {
    height: 2.25rem;
    box-sizing: border-box;
    line-height: 1.3;
}
/* Select braucht eigene Padding-Werte: Browser zentriert die selektierte
   Option ueber height; padding-top/-bottom 0.4rem aus der generischen Regel
   verschoben sonst den Text nach unten -> halb abgeschnitten. */
select {
    padding-top: 0;
    padding-bottom: 0;
    padding-right: 1.8rem; /* Platz fuer den nativen Caret-Indikator */
    line-height: 2.25rem;  /* vertikale Zentrierung in der vollen Hoehe */
}
textarea {
    min-height: 2.5rem;
    box-sizing: border-box;
}

/* Dashboard-Header: Titel links, Neuer-Fall-Button rechts (responsive) */
.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.dashboard-header .btn { flex-shrink: 0; }
@media (max-width: 480px) {
    .dashboard-header .btn { width: 100%; }
}

/* =====================================================================
   Mobile-Navigation: Hamburger + Slide-In-Drawer
   ===================================================================== */
.navbar-hamburger {
    display: none;          /* Desktop default: weg */
    background: transparent;
    border: 1px solid var(--color-border-subtle);
    border-radius: 4px;
    padding: 0.4rem 0.5rem;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin-left: auto;
}
.hamburger-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-text-primary);
    border-radius: 1px;
}
@media (max-width: 767px) {
    .navbar-hamburger { display: inline-flex; }
    .navbar-links     { display: none; }
}

/* Drawer rechts-rein — kompakt + scrollbar */
.nav-drawer {
    position: fixed;
    top: 0; right: 0; bottom: 0;
    width: 84%;
    max-width: 290px;
    background: var(--color-bg-elevated, #1a1a1a);
    border-left: 1px solid var(--color-border-subtle);
    box-shadow: -8px 0 24px rgba(0,0,0,0.4);
    transform: translateX(100%);
    transition: transform 0.22s ease;
    z-index: 10500;
    display: flex;
    flex-direction: column;
    overflow: hidden;     /* wrapper selbst scrollt nicht */
}
.nav-drawer.open { transform: translateX(0); }

.nav-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    z-index: 10400;
    opacity: 0;
    transition: opacity 0.18s ease;
    pointer-events: none;
}
.nav-drawer-backdrop.visible { opacity: 1; pointer-events: auto; }

.nav-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid var(--color-border-subtle);
    flex-shrink: 0;
}
.nav-drawer-titel {
    font-weight: 700;
    color: var(--color-accent-gold);
}
.nav-drawer-close {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}
.nav-drawer-close:hover { color: var(--color-accent-gold); }

.nav-drawer-links {
    display: flex;
    flex-direction: column;
    padding: 0.25rem 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
}
.nav-drawer-links a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    color: var(--color-text-primary);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--text-sm);
    border-left: 3px solid transparent;
    line-height: 1.3;
}
.nav-drawer-links a:hover,
.nav-drawer-links a:active {
    background: rgba(255,255,255,0.04);
    border-left-color: var(--color-accent-gold);
    color: var(--color-accent-gold);
}
.nav-drawer-links a.nav-drawer-cta {
    background: var(--color-accent-gold);
    color: var(--bg-base);
    margin: 0.25rem 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    border-left: none;
    justify-content: center;
}
.nav-drawer-links a.nav-drawer-cta:hover {
    filter: brightness(1.1);
    color: var(--bg-base);
    border-left: none;
}
.nav-drawer-section {
    padding: 0.4rem 0.75rem 0.15rem;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-top: 1px solid var(--color-border-subtle);
    margin-top: 0.2rem;
    font-weight: 700;
}
.nav-drawer-section:first-child { border-top: none; margin-top: 0; }

/* =====================================================================
   Phase 2.13 — Aussendienst-Dashboard (eigene KPI-Kacheln + Filter + Liste)
   ===================================================================== */
.ad-kacheln {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}
.ad-kachel {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    text-decoration: none;
    color: var(--color-text-primary);
    border-left: 4px solid var(--color-accent-gold);
}
.ad-kachel:hover {
    background: var(--color-bg-elevated);
    border-color: var(--color-accent-gold);
}
.ad-kachel--placeholder {
    opacity: 0.6;
    cursor: default;
    border-left-color: var(--color-text-muted);
}
.ad-kachel--placeholder:hover { background: var(--color-bg-card); }
.ad-kachel--faelle  { border-left-color: var(--baustein-mandant); }
.ad-kachel--mail    { border-left-color: var(--baustein-mail); }
.ad-kachel--euro    { border-left-color: var(--baustein-vertrag); }
.ad-kachel--stats   { border-left-color: var(--baustein-rsv); }

.ad-kachel-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: rgba(255,255,255,0.04);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent-gold);
    flex-shrink: 0;
}
.ad-kachel--faelle  .ad-kachel-icon { color: var(--baustein-mandant); }
.ad-kachel--mail    .ad-kachel-icon { color: var(--baustein-mail); }
.ad-kachel--euro    .ad-kachel-icon { color: var(--baustein-vertrag); }
.ad-kachel--stats   .ad-kachel-icon { color: var(--baustein-rsv); }

.ad-kachel-body { display: flex; flex-direction: column; min-width: 0; }
.ad-kachel-wert {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    color: var(--color-text-primary);
}
.ad-kachel-titel {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    margin-top: 0.2rem;
    font-weight: 600;
}
.ad-kachel-sub {
    font-size: 0.7rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
}

/* Filter-Bar — kompakte einzeilige Form, gestapelt auf Mobile */
.ad-filter {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.6rem;
    flex-wrap: wrap;
    padding: 0.45rem 0.55rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
}
.ad-filter-suche {
    position: relative;
    flex: 1 1 220px;
    min-width: 150px;
    max-width: 360px;
}
/* Such-Span im Markup wird komplett ausgeblendet — die Lupe kommt jetzt
   als background-image direkt am Input. Das ist auf alten Android-Chromes
   stabiler als ein absolut positioniertes Span (das dort manchmal in den
   Layoutfluss ausbricht und eine eigene Zeile bekommt). */
.ad-filter-suche-icon { display: none !important; }
.ad-filter-suche input[type="text"] {
    width: 100%;
    padding-left: 2rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><path d='m21 21-4.3-4.3'/></svg>");
    background-repeat: no-repeat;
    background-position: 0.55rem center;
    background-size: 14px 14px;
}
.ad-filter select {
    width: auto;
    flex: 1 1 160px;
    min-width: 140px;
    max-width: 260px;
}
@media (max-width: 480px) {
    .ad-filter { flex-direction: column; align-items: stretch; }
    /* In column-Flex wird flex-basis zur HÖHE — daher hier zurückdrehen. */
    .ad-filter-suche,
    .ad-filter select {
        flex: 0 0 auto;
        width: 100%;
        max-width: none;
        min-width: 0;
        height: 2.25rem;
    }
}

/* Fall-Liste (AD-optimiert) — als Karten statt Tabelle */
.ad-fall-list {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.ad-fall-row {
    display: block;
    padding: 0.5rem 0.7rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: 5px;
    text-decoration: none;
    color: var(--color-text-primary);
    border-left: 3px solid var(--color-accent-gold);
}
.ad-fall-row:hover {
    background: var(--color-bg-elevated);
}
.ad-fall-row-head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: space-between;
    margin-bottom: 0.15rem;
}
.ad-fall-nummer {
    font-family: var(--font-mono, monospace);
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}
.ad-fall-row-name {
    font-weight: 600;
    font-size: var(--text-sm);
    line-height: 1.25;
}
.ad-fall-row-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.2rem;
    font-size: var(--text-xs);
    flex-wrap: wrap;
    color: var(--color-text-secondary);
}
.ad-fall-progress {
    display: inline-flex;
    gap: 2px;
    margin-left: auto;
}
.ad-fall-progress-seg {
    width: 14px;
    height: 4px;
    border-radius: 2px;
    background: rgba(108,117,125,0.25);
}
.ad-fall-progress-seg.completed[data-baustein="mandant"]    { background: var(--baustein-mandant); }
.ad-fall-progress-seg.completed[data-baustein="vertrag"]    { background: var(--baustein-vertrag); }
.ad-fall-progress-seg.completed[data-baustein="rsv"]        { background: var(--baustein-rsv); }
.ad-fall-progress-seg.completed[data-baustein="gegenseite"] { background: var(--baustein-gegenseite); }
.ad-fall-progress-seg.completed[data-baustein="vollmacht"]  { background: var(--baustein-vollmacht); }
.ad-fall-progress-seg.pending { background: rgba(255,193,7,0.55); }
.ad-fall-updated { font-size: 0.7rem; }

/* =====================================================================
   Avatar (Bild oder Initialen-Kreis)
   ===================================================================== */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    vertical-align: middle;
    line-height: 1;
}
.avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.avatar--initials {
    font-weight: 700;
    letter-spacing: 0.02em;
}
.avatar-navbar { margin-right: 0.4rem; }
.avatar-profile-header { box-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.navbar-user-name { font-weight: 600; }

/* Avatar-Spalten in der Fall-Liste: schmal, zentriert */
.table-data th.col-avatar,
.table-data td.col-avatar,
.table-data th.col-avatar + td,
.table-data .col-avatar {
    width: 1%;
    white-space: nowrap;
    text-align: center;
}
.table-data th.col-avatar {
    font-size: var(--text-xs);
    letter-spacing: 0.05em;
    cursor: help;
}

/* Avatar oben links neben der Seiten-Überschrift */
.page-avatar-corner {
    float: left;
    margin-right: 0.7rem;
    margin-bottom: 0.3rem;
    margin-top: 0.05rem;
    text-decoration: none;
    line-height: 0;
}
.page-avatar-corner:hover .avatar {
    box-shadow: 0 0 0 2px var(--color-accent-gold);
}
.avatar-page-corner {
    transition: box-shadow 0.12s;
}
/* "Container" Clearfix damit die Header rechts wieder normal fließen */
.container::after { content: ''; display: table; clear: none; }

/* =====================================================================
   Phase 2.13 — Erfassungs-Wizard (Aussendienst)
   ===================================================================== */
.wizard-header {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
    margin-bottom: 0.6rem;
}
.wizard-progress {
    display: flex;
    align-items: center;
    gap: 0.2rem;
    flex-wrap: nowrap;
    overflow-x: auto;
}
.wizard-step {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    text-decoration: none;
    color: var(--color-text-secondary);
    font-size: var(--text-xs);
    border: 1px solid var(--color-border-subtle);
    background: transparent;
    flex-shrink: 0;
}
.wizard-step-no {
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--color-bg-elevated);
    border: 1px solid var(--color-border-subtle);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
.wizard-step.aktiv {
    background: var(--color-accent-gold);
    color: var(--bg-base);
    border-color: var(--color-accent-gold);
    font-weight: 700;
}
.wizard-step.aktiv .wizard-step-no {
    background: var(--bg-base);
    color: var(--color-accent-gold);
    border-color: var(--bg-base);
}
.wizard-step.erledigt {
    color: var(--color-text-primary);
    background: rgba(46, 125, 50, 0.10);
    border-color: rgba(46, 125, 50, 0.6);
}
.wizard-step.done .wizard-step-no {
    background: #2E7D32;
    color: #fff;
    border-color: #2E7D32;
}
.wizard-step-sep {
    width: 12px;
    height: 1px;
    background: var(--color-border-subtle);
    flex-shrink: 0;
}
.wizard-step-titel {
    white-space: nowrap;
}
@media (max-width: 480px) {
    .wizard-step-titel { display: none; }
    .wizard-step.aktiv .wizard-step-titel { display: inline; }
}

.wizard-fallinfo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--color-border-subtle);
    font-size: var(--text-xs);
    gap: 0.5rem;
}
.wizard-fallinfo code {
    background: var(--color-bg-elevated);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.55rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    margin-top: 0.5rem;
}
.wizard-nav .helper { width: 100%; font-size: var(--text-xs); }
.wizard-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

/* Vollmacht-Schritt: Vorschau + Signatur-Canvas */
.vollmacht-preview-box {
    background: #f6efe0;
    color: #1a1a1a;
    border: 1px solid #d4b888;
    border-radius: 4px;
    padding: 0.55rem 0.7rem;
    font-size: var(--text-sm);
}
.vollmacht-preview-box p { color: #1a1a1a; }
.signatur-pad-wrap {
    border: 2px dashed var(--baustein-vollmacht);
    border-radius: 6px;
    overflow: hidden;
    background: #fff;
    position: relative;
}
.signatur-pad-wrap canvas {
    width: 100%;
    height: 200px;
    display: block;
    touch-action: none;
    background: #fff;
    cursor: crosshair;
}
.signatur-hint {
    position: absolute;
    bottom: 0.3rem;
    right: 0.5rem;
    font-size: 0.7rem;
    color: #999;
    pointer-events: none;
    user-select: none;
}
.signatur-actions {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.4rem;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Abschluss-Übersicht */
.wizard-summary {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.wizard-summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.55rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: 4px;
    font-size: var(--text-sm);
}
.wizard-summary-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: rgba(108,117,125,0.3);
    flex-shrink: 0;
}
.wizard-summary-item.done .wizard-summary-dot    { background: var(--baustein-vertrag); }
.wizard-summary-item.partial .wizard-summary-dot { background: #FFC107; }
.wizard-summary-item.missing .wizard-summary-dot { background: var(--color-text-muted); }
.wizard-summary-titel { font-weight: 600; min-width: 110px; }
.wizard-summary-detail { flex: 1; font-size: var(--text-xs); }
.wizard-summary-status {
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.wizard-summary-item.done    .wizard-summary-status { color: var(--baustein-vertrag); }
.wizard-summary-item.partial .wizard-summary-status { color: #FFC107; }
.wizard-summary-item.missing .wizard-summary-status { color: var(--color-text-muted); }

/* Toggle "Gefuehrter Modus" im Profil */
.wizard-pref-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border-subtle);
    border-radius: 4px;
}
.wizard-pref-switch {
    position: relative;
    display: inline-block;
    width: 40px; height: 22px;
    flex-shrink: 0;
}
.wizard-pref-switch input { opacity: 0; width: 0; height: 0; }
.wizard-pref-slider {
    position: absolute; inset: 0;
    background: #6b7280;
    border-radius: 12px;
    transition: background 0.2s;
}
.wizard-pref-slider::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}
.wizard-pref-switch input:checked + .wizard-pref-slider { background: var(--color-accent-gold); }
.wizard-pref-switch input:checked + .wizard-pref-slider::before { transform: translateX(18px); }

/* ============================================================
   UI-Kompaktheit weiter: Ränder, Abstände
   ============================================================ */
.panel { padding: 0.55rem 0.75rem; }
.alert { padding: 0.4rem 0.65rem; margin-bottom: 0.4rem; }
.baustein-section { padding: 0.5rem 0.75rem 0.55rem 1.2rem; margin-bottom: 0.5rem; }
.baustein-section .section-header { margin-bottom: 0.3rem; }
.baustein-section .form-group { margin-bottom: 0.4rem; }
.form-group { margin-bottom: 0.4rem; }
.modal-body { padding: 0.6rem 0.8rem; }
.modal-header { padding: 0.45rem 0.8rem; }
.modal-footer { padding: 0.45rem 0.8rem; }

/* ============================================================
   Phase N1: Nachrichten-Thread + Inbox
   ============================================================ */
.baustein-section[data-baustein="nachrichten"] {
    border-left-color: #6366f1; /* Indigo — internal messaging */
}
.baustein-section[data-baustein="nachrichten"] .section-header h2 {
    color: #6366f1;
}

.nachrichten-thread {
    max-height: 360px;
    overflow-y: auto;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    padding: 0.5rem;
    background: rgba(255,255,255,0.02);
}
.nachricht-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: flex-start;
}
.nachricht-row.is-mine { flex-direction: row-reverse; }
.nachricht-row.is-mine .nachricht-bubble {
    background: rgba(99,102,241,0.12);
    border-color: rgba(99,102,241,0.3);
}
.nachricht-avatar { flex-shrink: 0; }
.nachricht-bubble {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    padding: 0.4rem 0.6rem;
    max-width: 80%;
    font-size: var(--text-sm);
}
.nachricht-meta {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    margin-bottom: 0.15rem;
}
.nachricht-body { white-space: pre-wrap; word-break: break-word; }

.nachricht-form { display: flex; flex-direction: column; gap: 0.35rem; }
.nachricht-form-zeile { display: flex; align-items: center; gap: 0.5rem; }
.nachricht-form .nachricht-textarea {
    width: 100%;
    font-family: inherit;
    font-size: var(--text-sm);
    resize: vertical;
    min-height: 2.5rem;
}
.nachricht-form-actions { display: flex; align-items: center; gap: 0.5rem; }

/* Inbox-Gruppen */
.nachrichten-gruppen { display: flex; flex-direction: column; gap: 0.5rem; }
.nachrichten-gruppe {
    display: block;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    padding: 0.6rem 0.8rem;
    background: rgba(255,255,255,0.02);
    transition: background 0.12s;
}
.nachrichten-gruppe:hover { background: rgba(255,255,255,0.05); }
.nachrichten-gruppe.has-unread { border-left: 3px solid #6366f1; }
.nachrichten-gruppe-head {
    display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
    margin-bottom: 0.3rem;
}
.nachrichten-gruppe-meta { font-size: var(--text-xs); }
.nachrichten-gruppe-list {
    list-style: none; padding: 0; margin: 0;
    font-size: var(--text-sm);
}
.nachrichten-gruppe-list li { padding: 0.15rem 0; opacity: 0.8; }
.nachrichten-gruppe-list li.is-unread { opacity: 1; font-weight: 500; }

/* ============================================================
   Phase A-Polish: Maps-Link / vCard / Sprachdiktat
   ============================================================ */
.adresse-maps-link, .vcard-link {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    margin-left: 0.5rem;
    padding: 0.1rem 0.45rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: 4px;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    text-decoration: none;
    background: rgba(255,255,255,0.03);
}
.adresse-maps-link:hover, .vcard-link:hover {
    background: rgba(255,255,255,0.08);
    color: var(--color-text);
}

.sprachdiktat-wrap {
    position: relative;
}
.sprachdiktat-btn {
    position: absolute;
    right: 4px;
    top: 4px;
    width: 28px;
    height: 28px;
    border: 1px solid var(--color-border-subtle);
    border-radius: 4px;
    background: rgba(255,255,255,0.04);
    cursor: pointer;
    padding: 0;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.15s;
}
.sprachdiktat-btn:hover { background: rgba(255,255,255,0.10); }
.sprachdiktat-btn.is-listening {
    background: rgba(239, 68, 68, 0.25);
    border-color: #ef4444;
    animation: sprachdiktat-pulse 1.4s ease-in-out infinite;
}
.sprachdiktat-icon { font-size: 14px; line-height: 1; }
@keyframes sprachdiktat-pulse {
    0%, 100% { transform: scale(1);    box-shadow: 0 0 0 0 rgba(239,68,68,0.45); }
    50%      { transform: scale(1.08); box-shadow: 0 0 0 6px rgba(239,68,68,0); }
}

/* Form-Subgroup als kompaktes Klapp-Element */
.form-subgroup {
    border: 1px solid var(--color-border-subtle);
    border-radius: 4px;
    padding: 0.35rem 0.6rem;
    margin: 0.4rem 0;
    background: rgba(255,255,255,0.015);
}
.form-subgroup > summary {
    cursor: pointer;
    padding: 0.15rem 0;
    font-size: var(--text-sm);
    user-select: none;
}
.form-subgroup[open] > summary { margin-bottom: 0.3rem; }

/* ============================================================
   Phase A-Polish: Kompaktheits-Schliff + Pulse fuer Unread-Kacheln
   ============================================================ */
.ad-kachel.has-pulse {
    box-shadow: 0 0 0 0 rgba(99,102,241,0.35);
    animation: ad-kachel-pulse 2s ease-in-out infinite;
    border-color: #6366f1;
}
@keyframes ad-kachel-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.0); }
    50%      { box-shadow: 0 0 0 6px rgba(99,102,241,0.18); }
}

/* Vollbild-Layout (z.B. Konsolidierungs-Workbench): kein max-width, kein padding */
.container-fullscreen {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

/* Form-Rows: mehrspaltig auf Desktop, umbrechen auf schmalen Viewports.
   Die Inline-Styles `flex:1 1 NNNpx` der Felder bestimmen Mindest-Spaltenbreite. */
.form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.5rem 0.8rem;
    margin-bottom: 0.35rem;
}
.form-row > .form-group { min-width: 0; }
.form-row > .form-group input,
.form-row > .form-group select,
.form-row > .form-group textarea { width: 100%; box-sizing: border-box; }
.form-group label { margin-bottom: 0.15rem; }

/* Compact: Navbar + dashboard-header */
.navbar-inner { padding-top: 0.3rem; padding-bottom: 0.3rem; }
.dashboard-header { margin-bottom: 0.6rem !important; }
.dashboard-header h1 { font-size: 1.4rem; }

/* Section-Header etwas kompakter */
.section-header h2 { font-size: 1.05rem; }

/* Inputs, selects: weiter dichter */
.form-group .helper { font-size: var(--text-xs); margin-top: 0.1rem; line-height: 1.2; }

/* ============================================================
   Admin-Password-Reset: Mode-Auswahl
   ============================================================ */
.pwreset-mode-option {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: 4px;
    margin-bottom: 0.3rem;
    cursor: pointer;
    font-size: var(--text-sm);
}
.pwreset-mode-option:hover { background: rgba(255,255,255,0.04); }
.pwreset-mode-option input[type="radio"] { margin-top: 0.2rem; }
.pwreset-mode-option strong { color: var(--color-text); }

/* Pwd-Reset Inline-Hint (kein Modal, kein Alert) */
.pwreset-inline-hint.is-info { color: var(--color-text-secondary); }
.pwreset-inline-hint.is-warn { color: #f59e0b; }
.pwreset-inline-hint.is-ok   { color: #22c55e; }

/* ============================================================
   Phase N1b: Quill-Editor Dark-Mode + Compose-Modal
   ============================================================ */
.nachricht-editor {
    min-height: 140px;
    background: rgba(255,255,255,0.02);
}
/* ===== Quill-Editor — dunkles Gold-Theme, passend zum Portal ===== */
.ql-toolbar.ql-snow {
    border: 1px solid var(--color-border-subtle, #2a2e3a);
    border-bottom: 0;
    background: var(--color-bg-card-2, #202430);
    border-radius: 6px 6px 0 0;
    padding: 5px 6px !important;
    display: flex; flex-wrap: wrap; gap: 2px;
}
.ql-toolbar.ql-snow .ql-formats {
    margin-right: 6px !important;
    display: inline-flex; align-items: center; gap: 1px;
    border-right: 1px solid var(--color-border-subtle, #2a2e3a);
    padding-right: 6px;
}
.ql-toolbar.ql-snow .ql-formats:last-child { border-right: 0; padding-right: 0; }
.ql-toolbar.ql-snow button {
    width: 26px; height: 24px;
    border-radius: 4px;
    transition: background .12s, color .12s;
}
.ql-toolbar.ql-snow button:hover {
    background: rgba(193,181,150,.12);
}
.ql-toolbar.ql-snow button.ql-active {
    background: rgba(193,181,150,.2);
}
.ql-container.ql-snow {
    border: 1px solid var(--color-border-subtle, #2a2e3a);
    border-top: 0;
    border-radius: 0 0 6px 6px;
    color: var(--color-text);
    font-family: inherit;
    font-size: var(--text-sm);
    background: #0a0d14;
    min-height: 120px;
}
.ql-editor {
    color: var(--color-text);
    min-height: 120px;
    padding: 10px 12px !important;
}
.ql-editor.ql-blank::before {
    color: var(--color-text-muted, #98a1ad);
    font-style: normal;
    left: 12px !important;
    right: 12px;
}
.ql-snow .ql-stroke { stroke: var(--color-text-secondary, #98a1ad); }
.ql-snow .ql-fill   { fill:   var(--color-text-secondary, #98a1ad); }
.ql-snow .ql-picker-label { color: var(--color-text-secondary, #98a1ad); }
.ql-snow .ql-picker-label:hover,
.ql-snow .ql-picker-item:hover,
.ql-snow .ql-picker-item.ql-selected { color: var(--color-accent-gold, #C1B596); }
.ql-toolbar.ql-snow .ql-formats button:hover .ql-stroke,
.ql-toolbar.ql-snow .ql-formats button.ql-active .ql-stroke,
.ql-toolbar.ql-snow .ql-formats button:focus .ql-stroke { stroke: var(--color-accent-gold, #C1B596); }
.ql-toolbar.ql-snow .ql-formats button:hover .ql-fill,
.ql-toolbar.ql-snow .ql-formats button.ql-active .ql-fill,
.ql-toolbar.ql-snow .ql-formats button:focus .ql-fill   { fill:   var(--color-accent-gold, #C1B596); }
.ql-snow .ql-picker-options {
    background: var(--color-bg-card, #1a1d26) !important;
    border: 1px solid var(--color-border, #2a2e3a) !important;
    color: var(--color-text);
    box-shadow: 0 6px 16px rgba(0,0,0,.4);
}

/* Link-Tooltip (Bearbeiten/Einfuegen) komplett umstylen */
.ql-snow .ql-tooltip,
.ql-snow .ql-tooltip.ql-editing {
    background: var(--color-bg-card, #1a1d26) !important;
    color: var(--color-text, #e8ebf0) !important;
    border: 1px solid var(--color-accent-gold, #C1B596) !important;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
    padding: 6px 10px !important;
    z-index: 1000;
}
.ql-snow .ql-tooltip input[type="text"] {
    background: #0a0d14 !important;
    color: var(--color-text) !important;
    border: 1px solid var(--color-border, #2a2e3a) !important;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    margin: 0 6px;
}
.ql-snow .ql-tooltip input[type="text"]:focus {
    outline: 0;
    border-color: var(--color-accent-gold, #C1B596) !important;
}
.ql-snow .ql-tooltip a.ql-action,
.ql-snow .ql-tooltip a.ql-remove {
    color: var(--color-accent-gold, #C1B596) !important;
    font-weight: 600;
    text-decoration: none;
    padding: 0 6px;
}
.ql-snow .ql-tooltip a.ql-action:hover,
.ql-snow .ql-tooltip a.ql-remove:hover {
    color: var(--gold-bright, #dccb9d) !important;
    text-decoration: underline;
}
.ql-snow .ql-tooltip a.ql-action::before { content: 'Speichern'; }
.ql-snow .ql-tooltip a.ql-remove::before { content: 'Entfernen'; }
.ql-snow .ql-tooltip.ql-editing a.ql-action::before { content: 'Übernehmen'; }
.ql-snow .ql-tooltip::before { color: var(--color-text-secondary, #98a1ad); content: 'Link:'; margin-right: 6px; }
.ql-snow .ql-tooltip.ql-editing::before { content: 'URL:'; }

/* ===== Responsive Modal + Quill — Mobile First ===== */
/* Tablet & kleiner */
@media (max-width: 900px) {
    .modal-dialog,
    .modal-dialog--wide {
        max-width: 100%; width: 96%;
    }
    .modal-header { padding: .8rem 1rem; }
    .modal-body   { padding: .85rem 1rem; }
    .modal-footer { padding: .7rem 1rem; }
}

/* Handy */
@media (max-width: 600px) {
    .modal-overlay { padding: 6px; align-items: flex-start; }
    .modal-dialog,
    .modal-dialog--wide {
        width: 100%; max-width: 100%;
        max-height: 95vh;
        border-radius: 8px;
        margin-top: 8px;
    }
    .modal-header { padding: .6rem .75rem; }
    .modal-title  { font-size: .95rem; }
    .modal-body   { padding: .65rem .75rem; }
    .modal-footer { padding: .55rem .75rem; gap: .35rem; flex-wrap: wrap; }
    .modal-footer .btn { padding: 6px 10px; font-size: .82rem; }

    /* Quill kompakter auf dem Handy — Toolbar darf wrappen, kleine Touch-Targets */
    .ql-toolbar.ql-snow {
        padding: 3px 4px !important;
        gap: 2px;
        flex-wrap: wrap; row-gap: 2px;
        position: sticky; top: 0; z-index: 5;
        background: var(--color-bg-card-2, #202430);
    }
    .ql-toolbar.ql-snow .ql-formats {
        margin-right: 4px !important;
        padding-right: 4px;
        gap: 0;
    }
    .ql-toolbar.ql-snow button {
        width: 30px; height: 28px;  /* Touch-Target ≥28px */
        padding: 0 2px !important;
    }
    .ql-toolbar.ql-snow .ql-picker.ql-header {
        height: 28px;
    }
    .ql-toolbar.ql-snow .ql-picker-label {
        padding: 0 16px 0 6px !important;
        font-size: 12px;
    }
    .ql-container.ql-snow { min-height: 100px; font-size: 14px !important; }
    .ql-editor {
        min-height: 100px;
        max-height: 220px;
        padding: 8px 10px !important;
        font-size: 14px;
    }

    /* Aufgabe-Modal-spezifisch noch kompakter */
    .aufg-modal-body { padding: 10px 12px !important; font-size: 13px; }
    .aufg-modal-body label { font-size: 10px; }
    .aufg-modal-body input[type="text"],
    .aufg-modal-body input[type="date"],
    .aufg-modal-body input[type="email"],
    .aufg-modal-body select { padding: 6px 8px; font-size: 14px; min-height: 36px; }
    .aufg-grid {
        grid-template-columns: 1fr 1fr;   /* 2 Spalten auf dem Handy statt auto-fit */
        gap: 7px 8px;
    }
    .aufg-share-buttons { gap: 4px; }
    .aufg-share-btn { padding: 6px 8px !important; font-size: 11px !important; }
    .aufg-share { padding: 8px 10px; }

    /* Tooltip: bei kleinen Screens nicht abgeschnitten */
    .ql-snow .ql-tooltip {
        left: 6px !important; right: 6px;
        width: auto; max-width: calc(100vw - 24px);
    }
    .ql-snow .ql-tooltip input[type="text"] {
        width: 100%; margin: 4px 0; box-sizing: border-box;
    }
}

.nachricht-body img { max-width: 100%; height: auto; border-radius: 4px; margin: 0.3rem 0; }
.nachricht-body p   { margin: 0.2rem 0; }
.nachricht-body blockquote {
    border-left: 3px solid var(--color-border-subtle);
    padding-left: 0.5rem;
    color: var(--color-text-secondary);
    margin: 0.3rem 0;
}
.nachricht-body pre, .nachricht-body code {
    font-family: var(--font-mono);
    background: rgba(255,255,255,0.05);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.85em;
}
.nachricht-body pre { padding: 0.4rem 0.6rem; overflow-x: auto; }
.nachricht-body a   { color: var(--color-accent-gold); }

/* Compose-Modal: breiter Dialog */
.modal-dialog--wide { max-width: 760px; width: 96%; }

/* Static-Modal visible-Klasse für Fade-In (analog zum modal.js-confirm) */
.modal-overlay {
    opacity: 0;
    transition: opacity 0.18s;
}
.modal-overlay.visible { opacity: 1; }
.modal-overlay[hidden] { display: none; }
body.modal-open { overflow: hidden; }

/* ============================================================
   Statistik-Komponenten (KPIs, Donut, Bars, Monatsraster)
   ============================================================ */
.stat-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.6rem;
}
.stat-kpi {
    padding: 0.6rem 0.8rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    background: rgba(255,255,255,0.03);
}
.stat-kpi--accent {
    border-color: var(--color-accent-gold);
    background: rgba(255, 192, 71, 0.06);
}
.stat-kpi-label { font-size: var(--text-xs); color: var(--color-text-muted); }
.stat-kpi-value { font-size: 1.7rem; font-weight: 700; line-height: 1.15; }
.stat-kpi-sub   { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 0.1rem; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.6rem;
}

.stat-donut-wrap { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; }
.stat-donut {
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}
.stat-donut-hole {
    position: absolute;
    inset: 22%;
    border-radius: 50%;
    background: var(--color-bg, #1a1a1a);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: var(--text-xs);
    color: var(--color-text-muted);
}
.stat-donut-hole strong { color: var(--color-text); font-size: 1.2rem; line-height: 1; }
.stat-legend {
    list-style: none; padding: 0; margin: 0;
    font-size: var(--text-xs);
    flex: 1 1 140px;
    min-width: 0;
}
.stat-legend li {
    display: flex; align-items: center; gap: 0.3rem;
    margin-bottom: 0.15rem;
    line-height: 1.3;
}
.stat-legend-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex-shrink: 0; }

.stat-bar-list { list-style: none; padding: 0; margin: 0; font-size: var(--text-sm); }
.stat-bar-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 80px auto;
    gap: 0.5rem;
    align-items: center;
    padding: 0.15rem 0;
}
.stat-bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-bar-track {
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: hidden;
}
.stat-bar-fill { display: block; height: 100%; transition: width 0.3s; }
.stat-bar-value { font-variant-numeric: tabular-nums; color: var(--color-text-muted); }

.stat-month-bars {
    display: flex;
    gap: 0.25rem;
    align-items: flex-end;
    height: 120px;
}
.stat-month-col {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
    height: 100%;
}
.stat-month-bar {
    width: 100%;
    background: #6366f1;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: background 0.15s;
}
.stat-month-col:hover .stat-month-bar { background: var(--color-accent-gold); }
.stat-month-lbl { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 0.2rem; }

/* ============================================================
   Wizard Step 2: Vollmacht-PDF + Upload-Fallback
   ============================================================ */
.vollmacht-pdf-wrap {
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255,255,255,0.02);
}
.vollmacht-pdf-toolbar {
    display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
    padding: 0.35rem 0.6rem;
    border-bottom: 1px solid var(--color-border-subtle);
    background: rgba(255,255,255,0.04);
    flex-wrap: wrap;
}
.vollmacht-pdf-frame {
    width: 100%;
    height: 540px;
    border: 0;
    display: block;
    background: #fff;
}
@media (max-width: 720px) {
    .vollmacht-pdf-frame { height: 380px; }
}

/* Fallback-Upload soll wenig Aufmerksamkeit ziehen */
.vollmacht-upload-fallback {
    margin-top: 0.4rem;
    padding: 0.25rem 0.6rem;
    border: 1px dashed var(--color-border-subtle);
    border-radius: 4px;
    background: transparent;
    font-size: var(--text-xs);
    opacity: 0.75;
    transition: opacity 0.15s;
}
.vollmacht-upload-fallback:hover { opacity: 1; }
.vollmacht-upload-fallback > summary {
    cursor: pointer;
    color: var(--color-text-secondary);
    list-style: none;
    padding: 0.15rem 0;
}
.vollmacht-upload-fallback > summary::-webkit-details-marker { display: none; }
.vollmacht-upload-fallback[open] {
    opacity: 1;
    background: rgba(255,255,255,0.02);
    padding: 0.4rem 0.8rem;
}
.vollmacht-upload-fallback-body {
    padding-top: 0.35rem;
    border-top: 1px solid var(--color-border-subtle);
    margin-top: 0.3rem;
}

/* Dokument-Viewer: PDF-iframe (Chrome rendert hierin PDFium inline). */
.modal-dialog--xl .modal-body iframe.dok-viewer-pdf-frame {
    width: 100%;
    height: 75vh;
    border: 0;
    background: #fff;
    display: block;
}
.dok-viewer-fallback {
    padding: 1.5rem;
    color: var(--color-text);
    background: rgba(255,255,255,0.02);
    text-align: center;
}

/* ============================================================
   PDF.js-Viewer im Dokument-Modal
   ============================================================ */
.dok-viewer-pdfjs-container {
    width: 100%;
    height: 75vh;
    background: #2a2a2a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.pdfjs-viewer {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}
.pdfjs-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
    background: #1a1a1a;
    border-bottom: 1px solid var(--color-border-subtle);
    flex-shrink: 0;
    flex-wrap: wrap;
}
.pdfjs-btn {
    background: rgba(255,255,255,0.06);
    color: var(--color-text);
    border: 1px solid var(--color-border-subtle);
    border-radius: 4px;
    padding: 0.2rem 0.55rem;
    font-size: var(--text-sm);
    cursor: pointer;
    line-height: 1.2;
    min-width: 2rem;
}
.pdfjs-btn:hover { background: rgba(255,255,255,0.12); }
.pdfjs-btn:active { background: var(--color-accent-gold); color: #1a1a1a; }
.pdfjs-pageinfo, .pdfjs-zoom-label {
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
    min-width: 4rem;
    text-align: center;
}
.pdfjs-spacer { flex: 1 1 auto; }
.pdfjs-pages {
    flex: 1 1 auto;
    overflow-y: auto;
    background: #2a2a2a;
    padding: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}
.pdfjs-page {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
    border-radius: 2px;
    max-width: 100%;
    height: auto;
}
.pdfjs-error {
    padding: 1.5rem;
    text-align: center;
    color: var(--color-text);
}
.pdfjs-error a { color: var(--color-accent-gold); }

/* ============================================================
   Phase ID-1: Geräte-Modus — Toggle + Profil-Auswahl
   ============================================================ */
.navbar-device-toggle { display: inline-flex; align-items: center; }
.navbar-device-btn {
    background: transparent;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    padding: 0.25rem 0.4rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    margin-left: 0.3rem;
}
.navbar-device-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--color-accent-gold);
    border-color: var(--color-accent-gold);
}
.navbar-device-btn svg { display: block; }

/* Profil: Geräte-Modus-Radio-Optionen als anklickbare Kacheln */
.geraete-modus-option {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    cursor: pointer;
    background: rgba(255,255,255,0.02);
    font-size: var(--text-sm);
    transition: background 0.12s, border-color 0.12s;
    min-width: 140px;
}
.geraete-modus-option:hover { background: rgba(255,255,255,0.06); }
.geraete-modus-option.is-active {
    border-color: var(--color-accent-gold);
    background: rgba(201, 166, 86, 0.08);
}
.geraete-modus-option input[type="radio"] { margin: 0; }
.geraete-modus-option svg { color: var(--color-text-secondary); }
.geraete-modus-option.is-active svg { color: var(--color-accent-gold); }

/* Device-Hooks: per body[data-device-mode] können wir spaeter Layouts steuern.
   Aktuell unauffaellig — Components reagieren bisher noch nicht darauf.
   Zukunftsmuster:
     body[data-device-mode="desktop"] .ad-kacheln { ... }
     body[data-device-mode="handy"]   .nur-desktop { display: none; }
*/

/* ============================================================
   Phase ID-2: Innendienst-Dashboard
   ============================================================ */
.id-kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.55rem;
}
.id-kpi {
    display: flex;
    gap: 0.55rem;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    background: rgba(255,255,255,0.025);
}
.id-kpi--accent { border-left: 3px solid #6366f1; background: rgba(99,102,241,0.06); }
.id-kpi--good   { border-left: 3px solid #22c55e; background: rgba(34,197,94,0.06); }
.id-kpi-icon { color: var(--color-text-secondary); flex-shrink: 0; padding-top: 0.15rem; }
.id-kpi-body { flex: 1; min-width: 0; }
.id-kpi-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.id-kpi-label { font-size: var(--text-xs); color: var(--color-text-muted); }
.id-kpi-sub   { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 0.1rem; }
.id-kpi-link  { font-size: var(--text-xs); color: var(--color-accent-gold); text-decoration: none; }
.id-kpi-link:hover { text-decoration: underline; }
.text-danger { color: #ef4444 !important; }

.id-dash-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0.6rem;
}
@media (max-width: 900px) {
    .id-dash-grid { grid-template-columns: 1fr; }
}
.id-dash-grid .panel { margin-bottom: 0; }
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}
.panel-head h2 {
    margin: 0;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.id-nachr-list { list-style: none; padding: 0; margin: 0; }
.id-nachr-list li {
    border-bottom: 1px solid var(--color-border-subtle);
    padding: 0.4rem 0;
}
.id-nachr-list li:last-child { border-bottom: 0; }
.id-nachr-list li.is-unread { background: rgba(99,102,241,0.06); padding-left: 0.4rem; border-left: 2px solid #6366f1; }
.id-nachr-list a {
    display: block;
    color: inherit;
    text-decoration: none;
}
.id-nachr-list a:hover { background: rgba(255,255,255,0.04); }
.id-nachr-meta { display: block; font-size: var(--text-xs); margin-bottom: 0.15rem; }
.id-nachr-body { display: block; font-size: var(--text-sm); color: var(--color-text); }

.id-fall-tabelle tbody tr:hover { background: rgba(255,255,255,0.04); }
.id-fall-tabelle td { padding: 0.35rem 0.6rem; }

/* Phase ID-3: Scope-Tabs in der Nachrichten-Inbox */
.nachrichten-scope-tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--color-border-subtle);
}
.nachrichten-scope-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.45rem 0.85rem;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    margin-bottom: -1px;
}
.nachrichten-scope-tabs a:hover { background: rgba(255,255,255,0.04); color: var(--color-text); }
.nachrichten-scope-tabs a.is-active {
    background: var(--color-bg, #1a1a1a);
    border-color: var(--color-border-subtle);
    color: var(--color-accent-gold);
    font-weight: 600;
}

/* ============================================================
   Phase ID-4: Posteingangs-Wizard
   ============================================================ */
.ide-wizard-progress {
    display: flex;
    gap: 0.3rem;
    align-items: center;
    flex-wrap: wrap;
}
.ide-wizard-step {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: 18px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--text-xs);
    background: rgba(255,255,255,0.02);
}
.ide-wizard-step.aktiv {
    background: var(--color-accent-gold);
    color: #1a1a1a;
    border-color: var(--color-accent-gold);
    font-weight: 600;
}
.ide-wizard-step.done {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #22c55e;
}
.ide-wizard-step.pending { opacity: 0.55; }
.ide-wizard-step-nr {
    background: rgba(0,0,0,0.18);
    border-radius: 50%;
    width: 18px; height: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700;
}
.ide-wizard-step.aktiv .ide-wizard-step-nr { background: rgba(255,255,255,0.25); }

.ide-quelle-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.7rem;
}
.ide-quelle-card {
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border-subtle);
    border-radius: 8px;
    background: rgba(255,255,255,0.025);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.ide-quelle-card h2 { margin: 0; font-size: 1.1rem; }
.ide-quelle-icon { color: var(--color-accent-gold); }

.ide-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1.4rem 1rem;
    border: 2px dashed var(--color-border-subtle);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    text-align: center;
    background: rgba(255,255,255,0.01);
    color: var(--color-text-secondary);
}
.ide-drop-zone:hover { background: rgba(255,255,255,0.04); border-color: var(--color-accent-gold); }
.ide-drop-zone.is-dragover {
    background: rgba(201, 166, 86, 0.1);
    border-color: var(--color-accent-gold);
    color: var(--color-accent-gold);
}
.ide-drop-icon { color: var(--color-accent-gold); }
.ide-drop-text small { color: var(--color-text-muted); font-size: var(--text-xs); }
.ide-upload-status { font-size: var(--text-sm); min-height: 1.2em; padding-top: 0.3rem; }

/* Phase ID-6: Sorgfältigkeit-Bar */
.sorgfalt-bar {
    display: inline-block;
    width: 70px;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
    vertical-align: middle;
}
.sorgfalt-bar-fill { display: block; height: 100%; transition: width 0.2s; }

/* ============================================================
   Phase Projekt-DB: Projektstatus-Seiten
   ============================================================ */
.projekt-nav {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--color-border-subtle);
    margin-bottom: 0.6rem;
}
.projekt-nav a {
    padding: 0.4rem 0.75rem;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    margin-bottom: -1px;
}
.projekt-nav a:hover { background: rgba(255,255,255,0.04); color: var(--color-text); }
.projekt-nav a.is-active {
    background: var(--color-bg, #1a1a1a);
    border-color: var(--color-border-subtle);
    color: var(--color-accent-gold);
    font-weight: 600;
}
.projekt-markdown h1 { margin-top: 0.4rem; }
.projekt-markdown h2 { margin-top: 1rem; padding-bottom: 0.2rem; border-bottom: 1px solid var(--color-border-subtle); }
.projekt-markdown h3 { margin-top: 0.8rem; color: var(--color-accent-gold); }
.projekt-markdown table { width: 100%; margin: 0.5rem 0; border-collapse: collapse; }
.projekt-markdown th, .projekt-markdown td { padding: 0.35rem 0.55rem; border-bottom: 1px solid var(--color-border-subtle); text-align: left; }
.projekt-markdown th { background: rgba(255,255,255,0.04); }
.projekt-markdown code { background: rgba(255,255,255,0.06); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.88em; }
.projekt-markdown pre { background: #1a1a1a; padding: 0.6rem 0.8rem; border-radius: 4px; overflow-x: auto; font-size: var(--text-sm); }
.projekt-markdown pre code { background: transparent; padding: 0; }
.projekt-markdown a { color: var(--color-accent-gold); }

/* ============================================================
   Phase Aufgaben-Modul
   ============================================================ */
.aufgaben-tabs {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--color-border-subtle);
}
.aufgaben-tabs a {
    padding: 0.4rem 0.75rem;
    border: 1px solid transparent;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: var(--text-sm);
    margin-bottom: -1px;
}
.aufgaben-tabs a:hover { background: rgba(255,255,255,0.04); color: var(--color-text); }
.aufgaben-tabs a.is-active {
    background: var(--color-bg, #1a1a1a);
    border-color: var(--color-border-subtle);
    color: var(--color-accent-gold);
    font-weight: 600;
}

.aufgaben-tabelle tr.is-overdue { background: rgba(239, 68, 68, 0.06); }

/* Aufgabe-Modal (Neu + Edit) — kompakt + grid statt verschwenderisch */
.aufg-modal-body { padding: 12px 16px !important; font-size: 13px; }
.aufg-modal-body label {
    display: block; font-size: 11px; text-transform: uppercase;
    letter-spacing: 0.04em; color: var(--color-text-secondary, #98a1ad);
    margin: 0 0 3px; font-weight: 600;
}
.aufg-modal-body input[type="text"],
.aufg-modal-body input[type="date"],
.aufg-modal-body input[type="email"],
.aufg-modal-body select {
    width: 100%; padding: 5px 8px; font-size: 13px; border-radius: 5px;
    border: 1px solid var(--color-border, #2a2e3a);
    background: #0a0d14; color: var(--text, #e8ebf0);
}
.aufg-modal-body input:focus, .aufg-modal-body select:focus {
    outline: 0; border-color: var(--gold, #C1B596);
}
.aufg-row { margin-bottom: 10px; }
.aufg-row:last-child { margin-bottom: 0; }
.aufg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px 10px;
    margin-bottom: 10px;
}
.aufg-frist-toggle {
    display: inline-flex; align-items: center; gap: 6px;
    cursor: pointer; font-size: 12px; font-weight: 500;
}
.aufg-reminder-wrap {
    margin-top: 6px; padding-left: 22px;
}
.aufg-reminder-wrap input {
    max-width: 200px;
}
/* Quill kompakt im Aufgabe-Modal */
.aufg-modal-body .nachricht-editor { font-size: 13px; }
.aufg-modal-body .ql-toolbar { padding: 3px 6px !important; }
.aufg-modal-body .ql-toolbar button { width: 24px; height: 22px; }
.aufg-modal-body .ql-container { font-size: 13px !important; }
.aufg-modal-body .ql-editor {
    min-height: 90px; max-height: 200px;
    padding: 8px 10px !important; line-height: 1.5;
}

/* Teilen-Sektion im Aufgabe-Edit-Modal */
.aufg-share {
    margin-top: 14px;
    padding: 10px 12px;
    background: rgba(193,181,150,.04);
    border: 1px solid var(--color-border, #2a2e3a);
    border-radius: 7px;
}
.aufg-share-head {
    font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--gold-dim, #8a8270); font-weight: 600;
    margin-bottom: 8px; display: flex; align-items: center; gap: 5px;
}
.aufg-share-buttons {
    display: flex; flex-wrap: wrap; gap: 5px;
}
.aufg-share-btn { font-family: inherit; }
.aufg-share-btn.is-loading { opacity: .5; pointer-events: none; }
.aufg-share-btn.copied {
    background: #6ba368 !important; border-color: #6ba368 !important; color: #fff !important;
}
.aufg-share-hint {
    margin: 8px 0 0; font-size: 10.5px; color: var(--color-text-secondary, #98a1ad);
    line-height: 1.4;
}
.aufgabe-neu-form .form-row { margin-bottom: 0.4rem; }

.id-aufgaben-list { list-style: none; padding: 0; margin: 0; }
.id-aufgaben-list li {
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--color-border-subtle);
    font-size: var(--text-sm);
}
.id-aufgaben-list li:last-child { border-bottom: 0; }
.id-aufgaben-list li.is-overdue { background: rgba(239,68,68,0.06); padding-left: 0.4rem; border-left: 2px solid #ef4444; }
.id-aufgabe-meta { display: block; font-size: var(--text-xs); margin-top: 0.1rem; }

/* ============================================================
   Phase Search: Quicksearch-Overlay + Header-Button + Zuletzt-Widget
   ============================================================ */
#quicksearch-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.65);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 9999;
    padding-top: 8vh;
}
#quicksearch-overlay.visible { display: flex; }
.quicksearch-dialog {
    background: var(--color-bg, #1a1a1a);
    border: 1px solid var(--color-border-subtle);
    border-radius: 10px;
    width: 92%;
    max-width: 640px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.5);
}
#quicksearch-input {
    width: 100%;
    border: 0;
    background: transparent;
    color: var(--color-text);
    padding: 1rem 1.2rem;
    font-size: 1.1rem;
    outline: none;
    border-bottom: 1px solid var(--color-border-subtle);
}
.quicksearch-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 60vh;
    overflow-y: auto;
}
.quicksearch-list .quicksearch-item {
    padding: 0.55rem 1.1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--color-border-subtle);
}
.quicksearch-list .quicksearch-item:last-child { border-bottom: 0; }
.quicksearch-list .quicksearch-item:hover,
.quicksearch-list .quicksearch-item.is-selected {
    background: rgba(201, 166, 86, 0.12);
}
.quicksearch-list .qs-row1 { font-size: var(--text-sm); }
.quicksearch-list .qs-row2 { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 0.15rem; }
.quicksearch-list .qs-status { color: var(--color-accent-gold); }
.quicksearch-list .quicksearch-empty { padding: 1rem; text-align: center; color: var(--color-text-muted); }
.quicksearch-hint { padding: 0.5rem 1rem; font-size: var(--text-xs); color: var(--color-text-muted); border-top: 1px solid var(--color-border-subtle); }

.navbar-quicksearch-btn {
    background: transparent;
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    padding: 0.25rem 0.55rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-right: 0.4rem;
    font-size: var(--text-xs);
}
.navbar-quicksearch-btn:hover { background: rgba(255,255,255,0.06); color: var(--color-accent-gold); border-color: var(--color-accent-gold); }
.quicksearch-hotkey { color: var(--color-text-muted); font-size: 0.75em; }
@media (max-width: 768px) { .quicksearch-hotkey { display: none; } }

/* Zuletzt-angesehen-Liste */
.zuletzt-list { list-style: none; padding: 0; margin: 0; }
.zuletzt-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--color-border-subtle); }
.zuletzt-list li:last-child { border-bottom: 0; }
.zuletzt-list a {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
    color: inherit;
    text-decoration: none;
}
.zuletzt-list a:hover { color: var(--color-accent-gold); }

/* ============================================================
   Phase Theme: Light-Mode (Override der dunklen Variablen)
   ============================================================ */
body[data-theme="light"] {
    --color-bg: #f5f5f4;
    --color-bg-card: #ffffff;
    --color-bg-elev-1: #fafafa;
    --color-bg-elev-2: #f0f0ef;
    --color-bg-elevated: #ffffff;
    --color-text: #1a1a1a;
    --color-text-primary: #1a1a1a;
    --color-text-secondary: #4a4a4a;
    --color-text-muted: #777;
    --color-border-subtle: #d4d4d3;
    background: #f5f5f4;
    color: #1a1a1a;
}
body[data-theme="light"] .navbar { background: #ffffff; border-bottom: 1px solid #e2e2e1; }
body[data-theme="light"] .navbar a, body[data-theme="light"] .navbar-user-name { color: #1a1a1a; }
body[data-theme="light"] .panel { background: #ffffff; border: 1px solid #e2e2e1; box-shadow: 0 1px 3px rgba(0,0,0,0.04); }
body[data-theme="light"] .table-data th { background: #f0f0ef; }
body[data-theme="light"] .table-data tr:hover { background: #f5f5f4; }
body[data-theme="light"] input, body[data-theme="light"] select, body[data-theme="light"] textarea {
    background: #ffffff; color: #1a1a1a; border: 1px solid #d4d4d3;
}
body[data-theme="light"] code { background: #f0f0ef; color: #1a1a1a; }
body[data-theme="light"] .dok-viewer-pdfjs-container { background: #e8e8e7; }
body[data-theme="light"] .nav-drawer { background: #ffffff; }
body[data-theme="light"] #quicksearch-overlay { background: rgba(0,0,0,0.4); }
body[data-theme="light"] .quicksearch-dialog { background: #ffffff; }
body[data-theme="light"] #quicksearch-input { color: #1a1a1a; }
body[data-theme="light"] .modal-dialog { background: #ffffff; color: #1a1a1a; }
body[data-theme="light"] .ql-toolbar.ql-snow { background: #f5f5f4; }
body[data-theme="light"] .ql-container.ql-snow { background: #fff; color: #1a1a1a; }
@media print { body[data-theme="light"] { background: #fff !important; } }
