/* IT-Billing App Styles */

/* ============================================================
   Base: 10% kleiner (14.4px statt 16px)
   Bootstrap nutzt rem → alles skaliert proportional
   ============================================================ */
html {
    font-size: 90%;
}

/* ============================================================
   App-Logo (Sidebar + Login)
   ============================================================ */
.app-logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-shadow:
        0 1px 0 rgba(255, 255, 255, 0.15),
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Dunkle Variante (Login-Seite) */
.app-logo-dark {
    text-shadow:
        0 1px 0 rgba(0, 0, 0, 0.05),
        0 2px 4px rgba(0, 0, 0, 0.15),
        0 4px 8px rgba(0, 0, 0, 0.08);
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
    width: 185px;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 50%, #084298 100%);
}

.sidebar .nav-link {
    border-radius: 0.375rem;
    margin-bottom: 2px;
    padding: 0.5rem 0.75rem;
    transition: background-color 0.15s;
    font-size: 0.9rem;
}

.sidebar .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-link:focus-visible {
    background-color: rgba(255, 255, 255, 0.1);
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: -2px;
}

.sidebar .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: 600;
}

.sidebar-toggle {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 101;
    border: none;
    padding: 0.4rem 0.6rem;
    border-radius: 0.375rem;
}

/* ============================================================
   Main Content
   ============================================================ */
.main-content {
    margin-left: 185px;
    height: 100vh;
    background-color: #f8f9fa;
}
.main-content > .container-fluid {
    overflow: auto;
    min-height: 0;
}

/* ============================================================
   Tabellen
   ============================================================ */
.table {
    font-size: 0.875rem;
}

.table th {
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.8rem;
}

.table td {
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.12);
}

/* Klickbare Zeilen */
.table tbody tr[data-href]:hover,
.table tbody tr.cursor-pointer:hover {
    background-color: rgba(13, 110, 253, 0.18);
}

.cursor-pointer {
    cursor: pointer;
}

/* Clipboard-Link: dezent, nur bei Hover sichtbar */
.clipboard-link {
    color: #6c757d;
    opacity: 0;
    transition: opacity 0.15s;
    font-size: 0.8rem;
    vertical-align: middle;
}
.clipboard-link:hover {
    color: #0d6efd;
}
.table tbody tr:hover .clipboard-link {
    opacity: 1;
}

/* Kompakte Inline-Dropdowns in Tabellen */
.table .form-select-sm {
    font-size: 0.8rem;
    padding: 0.2rem 1.8rem 0.2rem 0.4rem;
}

/* ============================================================
   Aktions-Buttons in Tabellen
   ============================================================ */
.btn-actions .btn {
    padding: 0.15rem 0.4rem;
    font-size: 0.8rem;
}

.btn-actions .btn:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 1px;
}

/* ============================================================
   Card-Widgets (Dashboard)
   ============================================================ */
.widget-card {
    border-left: 4px solid;
    transition: transform 0.15s, box-shadow 0.15s;
}
.widget-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.widget-card.border-primary { border-left-color: #0d6efd; }
.widget-card.border-success { border-left-color: #198754; }
.widget-card.border-warning { border-left-color: #ffc107; }
.widget-card.border-info    { border-left-color: #0dcaf0; }
.widget-card.border-danger  { border-left-color: #dc3545; }
.widget-card.border-secondary { border-left-color: #6c757d; }
#kpiGrid .col-md-4 { cursor: grab; }
#kpiGrid .col-md-4:active { cursor: grabbing; }
.sortable-ghost { opacity: 0.4; }
.sortable-chosen { cursor: grabbing; }

/* ============================================================
   Focus-States (Accessibility)
   ============================================================ */
.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.btn:focus-visible {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

/* ============================================================
   Margin Info (Material-Formular)
   ============================================================ */
#margin_info {
    font-size: 0.8rem;
    font-weight: 500;
    min-height: 1.25rem;
}

/* ============================================================
   Tabellen: Status-Zellen farbig (Material + Stunden)
   ============================================================ */
.material-table td.status-cell[data-color="warning"],
.time-table td.status-cell[data-color="warning"] { background-color: #fff3cd !important; }
.material-table td.status-cell[data-color="info"],
.time-table td.status-cell[data-color="info"] { background-color: #cff4fc !important; }
.material-table td.status-cell[data-color="secondary"],
.time-table td.status-cell[data-color="secondary"] { background-color: #e2e3e5 !important; }
.material-table td.status-cell[data-color="success"],
.time-table td.status-cell[data-color="success"] { background-color: #d1e7dd !important; }
.material-table td.status-cell[data-color="primary"],
.time-table td.status-cell[data-color="primary"] { background-color: #cfe2ff !important; }
.material-table td.status-cell[data-color="danger"],
.time-table td.status-cell[data-color="danger"] { background-color: #f8d7da !important; }

/* Zellen-Trennung besser sichtbar */
.material-table td, .material-table th,
.time-table td, .time-table th,
.customer-table td, .customer-table th {
    border-color: #adb5bd !important;
}
.material-table thead th,
.time-table thead th,
.customer-table thead th {
    border-bottom-width: 2px !important;
    border-bottom-color: #6c757d !important;
}

/* Sortierbare Headers (Material + Stunden + Kunden) — sticky */
.material-table thead th,
.time-table thead th,
.customer-table thead th {
    text-align: center;
    vertical-align: middle;
    position: sticky;
    top: 0;
    z-index: 1019;
    background: var(--bs-table-bg, var(--bs-body-bg, #fff));
}
.material-table th[data-sortable],
.time-table th[data-sortable],
.customer-table th[data-sortable] {
    cursor: pointer;
    user-select: none;
}
.material-table th .th-content,
.time-table th .th-content,
.customer-table th .th-content {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}
.material-table th .sort-icon,
.time-table th .sort-icon,
.customer-table th .sort-icon {
    display: inline-flex;
    align-items: center;
}
.material-table th .filter-trigger,
.time-table th .filter-trigger,
.customer-table th .filter-trigger {
    background: none;
    border: none;
    line-height: 1;
    vertical-align: middle;
}
.filter-trigger.active i {
    color: #0d6efd !important;
}

/* Material-Tabelle: Spaltenbreiten */
.material-table th[data-col="checkbox"],
.material-table td[data-col="checkbox"] { width: 30px; }
.material-table th[data-col="beschreibung"],
.material-table td[data-col="beschreibung"] { width: 50px; }
.material-table th[data-col="menge"],
.material-table td[data-col="menge"] { width: 50px; }
.material-table th[data-col="vk_gesamt"],
.material-table td[data-col="vk_gesamt"] { width: 90px; }
.material-table th[data-col="billing_mode"],
.material-table td[data-col="billing_mode"] { width: 80px; }
.material-table th[data-col="logistics_status"],
.material-table td[data-col="logistics_status"] { width: 130px; }
.material-table th[data-col="invoice_status"],
.material-table td[data-col="invoice_status"] { width: 130px; }
.material-table th[data-col="invoice_number"],
.material-table td[data-col="invoice_number"] { width: 100px; }
.material-table th[data-col="actions"],
.material-table td[data-col="actions"] { width: 40px; }

/* Inline Invoice Number Input (Material + Stunden) */
.material-table .invoice-number-input,
.time-table .invoice-number-input {
    padding: 0.15rem 0.3rem;
}

/* RE-Badge (klickbar, ersetzt Input wenn RE-Nr gesetzt) */
.re-badge {
    font-size: 0.8rem;
    cursor: pointer;
}

/* Bezahlte Zeilen (leicht transparent) */
tr.row-paid {
    opacity: 0.5;
}

/* Erledigte Zeilen (ausgegraut) */
tr.row-completed {
    opacity: 0.5;
}

/* Stunden-Tabelle: Spaltenbreiten */
.time-table th[data-col="checkbox"],
.time-table td[data-col="checkbox"] { width: 30px; }
.time-table th[data-col="taetigkeit"],
.time-table td[data-col="taetigkeit"] { width: 50px; }
.time-table th[data-col="start"],
.time-table td[data-col="start"] { width: 50px; }
.time-table th[data-col="ende"],
.time-table td[data-col="ende"] { width: 50px; }
.time-table th[data-col="pause"],
.time-table td[data-col="pause"] { width: 40px; }
.time-table th[data-col="dauer"],
.time-table td[data-col="dauer"] { width: 60px; }
.time-table th[data-col="betrag"],
.time-table td[data-col="betrag"] { width: 80px; }
.time-table th[data-col="billing_mode"],
.time-table td[data-col="billing_mode"] { width: 80px; }
.time-table th[data-col="billing_status"],
.time-table td[data-col="billing_status"] { width: 130px; }
.time-table th[data-col="invoice_status"],
.time-table td[data-col="invoice_status"] { width: 130px; }
.time-table th[data-col="invoice_number"],
.time-table td[data-col="invoice_number"] { width: 100px; }
.time-table th[data-col="actions"],
.time-table td[data-col="actions"] { width: 40px; }

/* Sticky Toolbar (Material, Stunden, Kunden) */
.table-toolbar-sticky {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: var(--bs-body-bg, #fff);
    padding-bottom: 0.25rem;
}

/* Spaltenfilter-Dropdown */
.col-filter-panel {
    position: fixed;
    z-index: 1060;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0.5rem;
    min-width: 180px;
    max-height: 340px;
    overflow: hidden;
}
.col-filter-panel .filter-search {
    width: 100%;
    margin-bottom: 0.4rem;
    font-size: 0.75rem;
    padding: 0.2rem 0.4rem;
}
.col-filter-panel label {
    display: block;
    padding: 0.15rem 0.25rem;
    font-size: 0.8rem;
    cursor: pointer;
    white-space: nowrap;
    border-radius: 0.2rem;
}
.col-filter-panel label:hover {
    background-color: #f8f9fa;
}
.col-filter-panel .filter-cb-list {
    min-height: 40px;
    max-height: 220px;
    overflow-y: auto;
}
.col-filter-panel .filter-actions {
    border-top: 1px solid #dee2e6;
    margin-top: 0.3rem;
    padding-top: 0.3rem;
    font-size: 0.75rem;
}

/* Filter-Chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    background-color: #e9ecef;
    border-radius: 1rem;
    white-space: nowrap;
}
.filter-chip .chip-remove {
    cursor: pointer;
    font-size: 0.85rem;
    color: #6c757d;
    line-height: 1;
}
.filter-chip .chip-remove:hover {
    color: #dc3545;
}
.filter-reset-link {
    font-size: 0.75rem;
    cursor: pointer;
    color: #6c757d;
    text-decoration: underline;
}
.filter-reset-link:hover {
    color: #dc3545;
}

/* Summen-Anzeige in Filter-Leiste */
.filter-summary {
    font-size: 0.75rem;
    color: #495057;
    white-space: nowrap;
    margin-left: auto;
}
.filter-summary .filter-summary-amount {
    font-weight: 600;
}

/* Info-Badge "Erledigte ausgeblendet" */
.filter-hidden-info {
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Kunden-Gruppierung: Gruppen-Header */
.group-header td {
    background-color: #e9ecef !important;
    padding: 0.4rem 0.75rem !important;
    border-bottom: 2px solid #dee2e6 !important;
    font-size: 0.85rem;
}
.group-header:hover {
    background-color: #e9ecef !important;
}

/* ============================================================
   Responsive: Tablet (< 992px)
   ============================================================ */
@media (max-width: 991.98px) {
    .table-responsive,
    .material-table,
    .time-table,
    .customer-table {
        font-size: 0.8rem;
    }
    .table .form-select-sm {
        min-width: 100px !important;
    }
    /* Material-Tabelle: Modus und Beschreibung ausblenden */
    .material-table [data-col="billing_mode"],
    .material-table [data-col="beschreibung"] {
        display: none !important;
    }
    /* Stunden-Tabelle: Tarif, Modus, Pause ausblenden */
    .time-table [data-col="tarif"],
    .time-table [data-col="billing_mode"],
    .time-table [data-col="pause"] {
        display: none !important;
    }
}

/* ============================================================
   Responsive: Mobil (< 768px)
   ============================================================ */
@media (max-width: 767.98px) {
    html {
        font-size: 87.5%;
    }
    .sidebar {
        width: 260px;
        min-height: 100vh;
        position: fixed;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .container-fluid {
        padding: 0.75rem !important;
    }
    /* Tabellen horizontal scrollbar */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    /* Cards einspaltig */
    .card .row > [class*="col-md"] {
        flex: 0 0 100%;
        max-width: 100%;
    }
    /* Header kompakter */
    h2 {
        font-size: 1.25rem;
    }
    /* Filter untereinander */
    .row.g-2 > .col-auto {
        flex: 1 1 100%;
    }
    /* Material-Tabelle: Kompakte Card-Ansicht */
    .material-table thead { display: none; }
    .material-table #filterChipsRow { display: none !important; }
    .material-table tbody#materialBody tr {
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        margin-bottom: 0.5rem;
        padding: 0.5rem;
    }
    .material-table tbody#materialBody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.25rem 0;
        border: none;
    }
    .material-table tbody#materialBody td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 0.5rem;
        color: #6c757d;
        font-size: 0.75rem;
        flex-shrink: 0;
    }
    .material-table tbody#materialBody td[data-col="checkbox"] { display: block; }
    .material-table tbody#materialBody td[data-col="checkbox"]::before { content: none; }
    .material-table tbody#materialBody td[data-col="beschreibung"],
    .material-table tbody#materialBody td[data-col="billing_mode"] { display: none; }
    .material-table tbody#materialBody td[data-col="actions"]::before { content: none; }

    /* Stunden-Tabelle: Kompakte Card-Ansicht */
    .time-table thead { display: none; }
    .time-table #filterChipsRowTime { display: none !important; }
    .time-table tbody#timeBody tr {
        display: block;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
        margin-bottom: 0.5rem;
        padding: 0.5rem;
    }
    .time-table tbody#timeBody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.25rem 0;
        border: none;
    }
    .time-table tbody#timeBody td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 0.5rem;
        color: #6c757d;
        font-size: 0.75rem;
        flex-shrink: 0;
    }
    .time-table tbody#timeBody td[data-col="checkbox"] { display: block; }
    .time-table tbody#timeBody td[data-col="checkbox"]::before { content: none; }
    .time-table tbody#timeBody td[data-col="taetigkeit"],
    .time-table tbody#timeBody td[data-col="pause"],
    .time-table tbody#timeBody td[data-col="billing_mode"] { display: none; }
    .time-table tbody#timeBody td[data-col="actions"]::before { content: none; }
}

/* ============================================================
   Einstellungen-Untermenü (Sidebar)
   ============================================================ */
.settings-toggle {
    display: flex;
    align-items: center;
}

.settings-toggle .caret {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.settings-toggle.collapsed .caret {
    transform: rotate(-90deg);
}

.settings-submenu .nav-link {
    padding-left: 1.5rem;
    font-size: 0.85rem;
    margin-bottom: 0;
}

/* Globale Kundensuche */
#globalSearch::placeholder { color: #888; }
#globalSearchResults { font-size: 0.85rem; }
#globalSearchResults .dropdown-item.active { background-color: var(--bs-primary); color: #fff; }
#globalSearchResults .dropdown-item:hover { background-color: var(--bs-primary); color: #fff; }
[data-bs-theme="dark"] #globalSearchResults { background-color: #2b2b2b; border-color: #444; }

/* Übersichten-Untermenü (Sidebar) */
.uebersicht-toggle {
    display: flex;
    align-items: center;
}

.uebersicht-toggle .caret {
    font-size: 0.7rem;
    transition: transform 0.2s;
}

.uebersicht-toggle.collapsed .caret {
    transform: rotate(-90deg);
}

.uebersicht-submenu .nav-link {
    padding-left: 1.5rem;
    font-size: 0.85rem;
    margin-bottom: 0;
}

@media (min-width: 768px) {
    .sidebar-toggle {
        display: none !important;
    }
}

/* ============================================================
   Druckansicht
   ============================================================ */
@media print {
    html {
        font-size: 80%;
    }
    .sidebar,
    .sidebar-toggle,
    .btn-actions,
    .alert-dismissible .btn-close {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
    }
    .widget-card {
        break-inside: avoid;
    }
}

/* ============================================================
   Auth Pages (Login, 2FA Verify, 2FA Setup)
   ============================================================ */
.auth-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 50%, #084298 100%);
    padding: 1rem;
    font-size: 100%;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
    padding: 2.5rem 2rem 2rem;
    animation: authFadeIn 0.5s ease-out;
}

.auth-card.auth-card-wide {
    max-width: 480px;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-logo {
    display: block;
    margin: 0 auto 1rem;
    max-height: 80px;
    width: auto;
}

.auth-title {
    text-align: center;
    font-weight: 700;
    color: #212529;
    margin-bottom: 1.25rem;
    font-size: 1.5rem;
}

.auth-subtitle {
    text-align: center;
    color: #6c757d;
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
}

/* Input mit Icon-Prefix */
.auth-input-group {
    position: relative;
    margin-bottom: 1rem;
}

.auth-input-group i {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 1rem;
    z-index: 2;
    pointer-events: none;
}

.auth-input-group input {
    width: 100%;
    padding: 0.625rem 0.875rem 0.625rem 2.5rem;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: #f8f9fa;
}

.auth-input-group input:focus {
    outline: none;
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    background: #fff;
}

.auth-input-group input::placeholder {
    color: #adb5bd;
}

/* Gradient-Button */
.auth-btn {
    display: block;
    width: 100%;
    padding: 0.625rem;
    border: none;
    border-radius: 0.5rem;
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
    transition: box-shadow 0.2s, transform 0.15s;
    margin-top: 0.5rem;
}

.auth-btn:hover {
    box-shadow: 0 6px 16px rgba(13, 110, 253, 0.4);
    transform: translateY(-1px);
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.3);
}

.auth-btn i {
    margin-right: 0.25rem;
}

/* Footer unter der Card */
.auth-footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    margin-top: 1.5rem;
}

.auth-footer a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
}

.auth-footer a:hover {
    color: #fff;
}

/* Alert in Auth-Card */
.auth-card .alert {
    border-radius: 0.5rem;
    font-size: 0.9rem;
}

/* 2FA-spezifisch: TOTP-Feld */
.auth-card .totp-field {
    font-size: 2rem;
    font-weight: bold;
    letter-spacing: 0.75rem;
    text-align: center;
    padding-left: 1rem;
    border-radius: 0.5rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.auth-card .totp-field:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
    background: #fff;
}

/* 2FA Icon-Header */
.auth-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

/* 2FA Setup: abgerundete Elemente */
.auth-card .form-control-rounded,
.auth-card .input-group .form-control,
.auth-card .input-group .btn {
    border-radius: 0.5rem;
}

.auth-card .form-control-rounded {
    background: #f8f9fa;
}

.auth-card .input-group .form-control {
    border-radius: 0.5rem 0 0 0.5rem;
    background: #f8f9fa;
}

.auth-card .input-group .btn {
    border-radius: 0 0.5rem 0.5rem 0;
}

.auth-card .qr-code {
    max-width: 200px;
    border-radius: 0.5rem;
}

.auth-card .code-input {
    border-radius: 0.5rem;
    background: #f8f9fa;
    letter-spacing: 0.5rem;
}

/* ============================================================
   Farbpunkte (Lookup-Verwaltung)
   ============================================================ */
.color-dot {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s;
}
.color-dot:hover {
    transform: scale(1.2);
}
.color-dot.active {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px #0d6efd;
}

/* ============================================================
   Tom Select: Anpassungen für kompakte Darstellung
   ============================================================ */
.ts-wrapper.form-select-sm .ts-control {
    min-height: calc(1.5em + 0.5rem + 2px);
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
}

.ts-wrapper .ts-control {
    border-color: #dee2e6;
}

.ts-wrapper .ts-control:focus-within {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.ts-dropdown {
    z-index: 1060;
}

/* Responsive Auth */
@media (max-width: 480px) {
    .auth-card {
        padding: 2rem 1.5rem 1.5rem;
    }
    .auth-logo {
        max-height: 48px;
    }
}

/* ============================================================
   Kanban-Board
   ============================================================ */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.kanban-column {
    background: #f8f9fa;
    border-radius: 0.5rem;
    min-height: 200px;
    padding: 0.75rem;
}
.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
}
.kanban-column-header.bg-warning-subtle { background: #fff3cd; color: #664d03; }
.kanban-column-header.bg-info-subtle    { background: #cff4fc; color: #055160; }
.kanban-column-header.bg-success-subtle { background: #d1e7dd; color: #0f5132; }
.kanban-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    padding: 0.65rem 0.75rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.15s;
}
.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}
.kanban-card:active { cursor: grabbing; }
.kanban-card .card-customer {
    font-size: 0.75rem;
    color: #6c757d;
}
.kanban-card .card-due {
    font-size: 0.75rem;
    margin-top: 0.25rem;
}
.kanban-card .card-due.overdue {
    color: #dc3545;
    font-weight: 600;
}
.kanban-card.sortable-ghost {
    opacity: 0.4;
    background: #e9ecef;
}
.kanban-card.sortable-chosen {
    cursor: grabbing;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.kanban-customer-divider {
    border-top: 1px solid #dee2e6;
    padding: 0.35rem 0.5rem 0.15rem;
    margin-top: 0.25rem;
}
.kanban-customer-divider:first-child {
    border-top: none;
    margin-top: 0;
}
@media (max-width: 767.98px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Attachment Thumbnails & Preview
   ============================================================ */
.att-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}
.att-thumb-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 4px;
    text-decoration: none;
    transition: opacity 0.15s;
}
.att-thumb-link:hover {
    opacity: 0.8;
}
.att-thumb-pdf {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #dc2626;
    font-size: 1.4rem;
}
.att-thumb-file {
    background: #f3f4f6;
    border: 1px solid #dee2e6;
    color: #6b7280;
    font-size: 1.4rem;
}
.att-thumb-inline {
    height: 24px;
    width: auto;
    border-radius: 3px;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}
.att-card {
    position: relative;
}
.att-card-delete {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid #dc3545;
    border-radius: 50%;
    background: #fff;
    color: #dc3545;
    font-size: 0.55rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
}
.att-card:hover .att-card-delete {
    opacity: 1;
}
.att-card-delete:hover {
    background: #dc3545;
    color: #fff;
}
.att-card-name {
    font-size: 0.7rem;
    color: #6b7280;
    max-width: 48px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ============================================================
   Dark Mode Overrides (Bootstrap 5.3 data-bs-theme="dark")
   ============================================================ */
html[data-bs-theme="dark"] .main-content {
    background-color: #1a1d21;
}

html[data-bs-theme="dark"] .sidebar {
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2744 50%, #0a1929 100%);
}

/* Tabellen */
html[data-bs-theme="dark"] .table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.15);
}
html[data-bs-theme="dark"] .table tbody tr[data-href]:hover,
html[data-bs-theme="dark"] .table tbody tr.cursor-pointer:hover {
    background-color: rgba(13, 110, 253, 0.25);
}

/* Status-Zellen (Material + Stunden) — dunklere Pastellfarben */
html[data-bs-theme="dark"] .material-table td.status-cell[data-color="warning"],
html[data-bs-theme="dark"] .time-table td.status-cell[data-color="warning"] { background-color: #332701 !important; }
html[data-bs-theme="dark"] .material-table td.status-cell[data-color="info"],
html[data-bs-theme="dark"] .time-table td.status-cell[data-color="info"] { background-color: #032830 !important; }
html[data-bs-theme="dark"] .material-table td.status-cell[data-color="secondary"],
html[data-bs-theme="dark"] .time-table td.status-cell[data-color="secondary"] { background-color: #2b2f33 !important; }
html[data-bs-theme="dark"] .material-table td.status-cell[data-color="success"],
html[data-bs-theme="dark"] .time-table td.status-cell[data-color="success"] { background-color: #0a3622 !important; }
html[data-bs-theme="dark"] .material-table td.status-cell[data-color="primary"],
html[data-bs-theme="dark"] .time-table td.status-cell[data-color="primary"] { background-color: #0a1f3f !important; }
html[data-bs-theme="dark"] .material-table td.status-cell[data-color="danger"],
html[data-bs-theme="dark"] .time-table td.status-cell[data-color="danger"] { background-color: #3b1114 !important; }

/* Tabellen-Borders */
html[data-bs-theme="dark"] .material-table td, html[data-bs-theme="dark"] .material-table th,
html[data-bs-theme="dark"] .time-table td, html[data-bs-theme="dark"] .time-table th,
html[data-bs-theme="dark"] .customer-table td, html[data-bs-theme="dark"] .customer-table th {
    border-color: #495057 !important;
}
html[data-bs-theme="dark"] .material-table thead th,
html[data-bs-theme="dark"] .time-table thead th,
html[data-bs-theme="dark"] .customer-table thead th {
    border-bottom-color: #adb5bd !important;
    background: #1a1d21 !important;
}

/* Filter-Panel */
html[data-bs-theme="dark"] .col-filter-panel {
    background: #212529;
    border-color: #495057;
}
html[data-bs-theme="dark"] .col-filter-panel label:hover {
    background-color: #2b3035;
}
html[data-bs-theme="dark"] .col-filter-panel .filter-actions {
    border-color: #495057;
}

/* Filter-Chips */
html[data-bs-theme="dark"] .filter-chip {
    background-color: #343a40;
}

/* Gruppen-Header */
html[data-bs-theme="dark"] .group-header td {
    background-color: #2b3035 !important;
    border-color: #495057 !important;
}

/* Kanban */
html[data-bs-theme="dark"] .kanban-column {
    background: #212529;
}
html[data-bs-theme="dark"] .kanban-card {
    background: #2b3035;
    border-color: #495057;
}
html[data-bs-theme="dark"] .kanban-column-header.bg-warning-subtle { background: #332701; color: #ffda6a; }
html[data-bs-theme="dark"] .kanban-column-header.bg-info-subtle    { background: #032830; color: #6edff6; }
html[data-bs-theme="dark"] .kanban-column-header.bg-success-subtle { background: #0a3622; color: #75b798; }
html[data-bs-theme="dark"] .kanban-customer-divider {
    border-color: #495057;
}
html[data-bs-theme="dark"] .kanban-card.sortable-ghost {
    background: #343a40;
}

/* Auth Pages */
html[data-bs-theme="dark"] .auth-page {
    background: linear-gradient(135deg, #1a3a5c 0%, #0f2744 50%, #0a1929 100%);
}
html[data-bs-theme="dark"] .auth-card {
    background: #212529;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
html[data-bs-theme="dark"] .auth-title {
    color: #e9ecef;
}
html[data-bs-theme="dark"] .auth-input-group input {
    background: #2b3035;
    border-color: #495057;
    color: #e9ecef;
}
html[data-bs-theme="dark"] .auth-input-group input:focus {
    background: #343a40;
}
html[data-bs-theme="dark"] .auth-input-group i {
    color: #adb5bd;
}

/* Attachment Thumbnails */
html[data-bs-theme="dark"] .att-thumb {
    border-color: #495057;
}
html[data-bs-theme="dark"] .att-thumb-pdf {
    background: #3b1114;
    border-color: #842029;
}
html[data-bs-theme="dark"] .att-thumb-file {
    background: #2b3035;
    border-color: #495057;
}
html[data-bs-theme="dark"] .att-card-delete {
    background: #212529;
}
html[data-bs-theme="dark"] .att-card-delete:hover {
    background: #dc3545;
}

/* Tom Select */
html[data-bs-theme="dark"] .ts-wrapper .ts-control {
    border-color: #495057;
    background: #212529;
    color: #e9ecef;
}
html[data-bs-theme="dark"] .ts-dropdown {
    background: #212529;
    border-color: #495057;
}
html[data-bs-theme="dark"] .ts-dropdown .option:hover,
html[data-bs-theme="dark"] .ts-dropdown .active {
    background: #2b3035;
}

/* Farbpunkte aktiv-Ring */
html[data-bs-theme="dark"] .color-dot.active {
    box-shadow: 0 0 0 2px #212529, 0 0 0 4px #0d6efd;
}

/* Filter-Summary */
html[data-bs-theme="dark"] .filter-summary {
    color: #adb5bd;
}

/* Bootstrap Utility Overrides für Dark Mode
   Bootstrap nutzt box-shadow: inset 0 0 0 9999px var(--bs-table-accent-bg) für
   table-striped/hover/active. Alle Varianten-Variablen müssen überschrieben werden. */
html[data-bs-theme="dark"] .table-light {
    --bs-table-bg: rgba(255, 255, 255, 0.04) !important;
    --bs-table-color: var(--bs-body-color) !important;
    --bs-table-border-color: var(--bs-border-color) !important;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.06) !important;
    --bs-table-striped-color: var(--bs-body-color) !important;
    --bs-table-hover-bg: rgba(13, 110, 253, 0.15) !important;
    --bs-table-hover-color: var(--bs-body-color) !important;
    --bs-table-active-bg: rgba(255, 255, 255, 0.06) !important;
    --bs-table-active-color: var(--bs-body-color) !important;
    color: var(--bs-body-color) !important;
}
html[data-bs-theme="dark"] .table-secondary {
    --bs-table-bg: rgba(255, 255, 255, 0.05) !important;
    --bs-table-color: var(--bs-body-color) !important;
    --bs-table-border-color: var(--bs-border-color) !important;
    --bs-table-striped-bg: rgba(255, 255, 255, 0.07) !important;
    --bs-table-striped-color: var(--bs-body-color) !important;
    --bs-table-hover-bg: rgba(13, 110, 253, 0.15) !important;
    --bs-table-hover-color: var(--bs-body-color) !important;
    --bs-table-active-bg: rgba(255, 255, 255, 0.07) !important;
    --bs-table-active-color: var(--bs-body-color) !important;
    color: var(--bs-body-color) !important;
}
html[data-bs-theme="dark"] .table-warning {
    --bs-table-bg: #332701 !important;
    --bs-table-color: #ffda6a !important;
    --bs-table-border-color: var(--bs-border-color) !important;
    --bs-table-striped-bg: #3d2e01 !important;
    --bs-table-striped-color: #ffda6a !important;
    --bs-table-hover-bg: rgba(13, 110, 253, 0.15) !important;
    --bs-table-hover-color: #ffda6a !important;
    --bs-table-active-bg: #3d2e01 !important;
    --bs-table-active-color: #ffda6a !important;
    color: #ffda6a !important;
}
html[data-bs-theme="dark"] .bg-light {
    background-color: #2b3035 !important;
}
html[data-bs-theme="dark"] .text-dark {
    color: #e9ecef !important;
}
html[data-bs-theme="dark"] .bg-white {
    background-color: #2b3035 !important;
}

/* Mobile Card-Ansicht (Material + Stunden) */
html[data-bs-theme="dark"] .material-table tbody#materialBody tr,
html[data-bs-theme="dark"] .time-table tbody#timeBody tr {
    border-color: #495057;
}
html[data-bs-theme="dark"] .material-table tbody#materialBody td::before,
html[data-bs-theme="dark"] .time-table tbody#timeBody td::before {
    color: #adb5bd;
}

/* 2FA-Felder */
html[data-bs-theme="dark"] .auth-card .totp-field {
    background: #2b3035;
    border-color: #495057;
    color: #e9ecef;
}
html[data-bs-theme="dark"] .auth-card .totp-field:focus {
    background: #343a40;
}
html[data-bs-theme="dark"] .auth-card .code-input {
    background: #2b3035;
    border-color: #495057;
    color: #e9ecef;
}

/* ── UI-Komponenten: Filter ──────────────────────── */

/* Filter-Collapse-Bereich */
.filter-collapse .card-body {
    padding: 0.75rem;
}
.filter-collapse .form-label {
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
    font-weight: 500;
}

/* Filter-Chips (aktive Filter) */
.filter-chip {
    font-size: 0.8rem;
    padding: 0.25em 0.6em;
}
.filter-chip .bi-x {
    font-size: 0.7rem;
    cursor: pointer;
    opacity: 0.8;
}
.filter-chip .bi-x:hover {
    opacity: 1;
}

/* ── UI-Komponenten: Sticky Table Header ─────────── */

.table thead.sticky-top th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bs-body-bg, #fff);
    box-shadow: 0 1px 0 var(--bs-border-color);
}

/* ── UI-Komponenten: Pagination ──────────────────── */

.pagination-sm .page-link {
    min-width: 2rem;
    text-align: center;
}

/* ============================================================
   Dashboard Widgets
   ============================================================ */

/* Sparkline SVGs responsive */
.sparkline {
    display: inline-block;
    vertical-align: middle;
}

/* Widget-Grid: Drag-Placeholder */
#widgetSortableGrid .sortable-ghost {
    opacity: 0.4;
    background: var(--bs-primary-bg-subtle) !important;
}

/* Bearbeitungsmodus: drag-handle hover */
.drag-handle:hover {
    color: var(--bs-primary) !important;
}

/* Handlungsbedarf: farbige linke Raender */
.list-group-item.border-start.border-danger { border-left-color: var(--bs-danger) !important; }
.list-group-item.border-start.border-warning { border-left-color: var(--bs-warning) !important; }
.list-group-item.border-start.border-info { border-left-color: var(--bs-info) !important; }

/* KPI-Kacheln: border-start dicker */
.card.border-start.border-4 {
    border-left-width: 4px !important;
}

/* Recent Activity: scrollbar styling */
.list-group[style*="max-height"] {
    scrollbar-width: thin;
}
