/* ========== CSS Custom Properties ========== */
:root {
    /* Akzentfarbe (Buttons, Links, aktive Zustände). Wird über [data-accent] gesetzt. */
    --ahds-primary:      #0066cc;
    /* Dasselbe als r,g,b für rgba(); ohne [data-accent] (Anmeldung, Fehlerseiten) fehlte es. */
    --ahds-primary-rgb:  0,102,204;
    /* Grundfarbe/Chrome der Seitenleiste – unabhängig vom Akzent themebar. */
    --ahds-sidebar-bg:   #1a2035;
    /* Aktiver Sidebar-Eintrag folgt der Akzentfarbe. */
    --ahds-sidebar-active: var(--ahds-primary);
    --ahds-content-bg:   #f4f6f9;
    --ahds-border-color: #e2e8f0;
    /* Kopf-/Leisten-Chrome (Topbar). Standard: heller Kopf. Über [data-base] themebar. */
    --ahds-topbar-bg:     #ffffff;
    --ahds-topbar-fg:     #212529;
    --ahds-topbar-muted:  #6c757d;
    --ahds-topbar-border: #e5e7eb;
    --ahds-topbar-brand:  var(--ahds-primary);
}

/* ========== Base ========== */
body {
    background: var(--ahds-content-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 0.9rem;
    color: #212529;
}

.login-page {
    background: #1a2035 !important;
}

/* ========== Layout Wrapper ========== */
.wrapper {
    display: flex;
    /* Viewport-hohe App-Huelle: der Body scrollt NICHT mehr (keine
       Seiten-Scrollleiste, die z. B. die Chat-Bedienelemente verdeckt).
       Gescrollt wird stattdessen INNERHALB von .main-content bzw. .sidebar. */
    height: 100vh;
    overflow: hidden;
}

/* ========== Sidebar ========== */
.sidebar {
    width: 250px;
    min-width: 250px;
    background: var(--ahds-sidebar-bg);
    color: #fff;
    /* Die Sidebar selbst scrollt NICHT – gescrollt wird ausschliesslich im
       inneren .sidebar-nav (dessen Scrollleiste ist ausgeblendet). So bleibt
       kein sichtbarer Balken, genau wie im Content-Bereich. */
    overflow: hidden;
    transition: width 0.25s ease, min-width 0.25s ease;
    z-index: 1000;
    flex-shrink: 0;
}
/* Flex-Kind muss unter seine Inhaltshoehe schrumpfen duerfen, sonst wandert
   der Scroll (und damit der Balken) auf die aeussere .sidebar. */
.sidebar-nav {
    min-height: 0;
}

.sidebar.collapsed {
    width: 60px;
    min-width: 60px;
}

.sidebar.collapsed .nav-link span,
.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .sidebar-footer .fw-semibold,
.sidebar.collapsed .sidebar-footer .text-secondary,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .badge {
    display: none;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.72);
    padding: 0.34rem 0.85rem;
    border-radius: 6px;
    font-size: 0.88rem;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
/* Engere vertikale Abstände in der Seitenleiste */
.sidebar .nav-link.mb-1 { margin-bottom: 1px !important; }
.sidebar .nav-section.mt-2 { margin-top: 0.3rem !important; }

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

.sidebar .nav-link.active {
    background: var(--ahds-sidebar-active);
    color: #fff;
}

.sidebar .nav-section-label {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.5rem 1rem 0.25rem;
    display: block;
}

/* Einklappbare Navigations-Abschnitte */
.sidebar .nav-section-toggle {
    width: 100%;
    background: none;
    border: 0;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    border-radius: 6px;
}

.sidebar .nav-section-toggle:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.06);
}

.sidebar .nav-section-chevron {
    font-size: 0.6rem;
    transition: transform 0.2s ease;
}

.sidebar .nav-section.section-collapsed .nav-section-chevron {
    transform: rotate(-90deg);
}

.sidebar .nav-section-items {
    overflow: hidden;
}

.sidebar .nav-section.section-collapsed .nav-section-items {
    display: none;
}

/* Icon-only-Modus: Abschnitts-Header sind ausgeblendet, daher müssen
   alle Einträge sichtbar bleiben (sonst wären Module unerreichbar). */
.sidebar.collapsed .nav-section.section-collapsed .nav-section-items {
    display: flex;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
}

.sidebar.collapsed .nav-link i {
    margin-right: 0 !important;
}

.sidebar-collapse-btn {
    background: none;
    border: 0;
    color: rgba(255, 255, 255, 0.55);
    border-radius: 6px;
    padding: 0.25rem 0.45rem;
    align-items: center;
    cursor: pointer;
}

.sidebar-collapse-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar.collapsed .sidebar-collapse-btn i {
    transform: rotate(180deg);
}

/* ========== Main Content ========== */
.main-content {
    flex: 1;
    background: var(--ahds-content-bg);
    overflow-x: hidden;
    overflow-y: auto;   /* eigener Content-Scroller statt Body-Scrollbar */
    min-width: 0;
}
/* Scrollleisten komplett ausblenden – gescrollt wird trotzdem (Rad/Touch/
   Tastatur). Gilt für Content-Bereich, Sidebar und die inneren Scroller. */
.main-content, .sidebar, .sidebar-nav, .sidebar *,
#chatDock .cd-msgs, #chatDock .cd-list, #chatDock .cd-emoji-grid,
#chatDock .cd-gif-results, #chatDock .cd-searchresults {
    scrollbar-width: none;      /* Firefox */
    -ms-overflow-style: none;   /* alte Edge/IE */
}
.main-content::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .sidebar-nav::-webkit-scrollbar,
.sidebar *::-webkit-scrollbar,
#chatDock .cd-msgs::-webkit-scrollbar, #chatDock .cd-list::-webkit-scrollbar,
#chatDock .cd-emoji-grid::-webkit-scrollbar, #chatDock .cd-gif-results::-webkit-scrollbar,
#chatDock .cd-searchresults::-webkit-scrollbar {
    width: 0; height: 0; display: none;   /* Chrome/Safari/neues Edge */
}

/* Pflicht-Kennzeichnung "Powered by GIPHY" (Giphy-Nutzungsbedingungen). */
#chatDock .cd-gif-attr {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin-top: .35rem;
    padding-top: .3rem;
    border-top: 1px solid rgba(128, 128, 128, 0.2);
    font-size: .7rem;
    opacity: .75;
}
#chatDock .cd-gif-attr svg { display: block; }

/* ========== Avatar ========== */
.avatar-circle {
    width: 36px;
    height: 36px;
    background: var(--ahds-primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
    user-select: none;
}

.avatar-circle.avatar-lg {
    width: 56px;
    height: 56px;
    font-size: 1.2rem;
}

/* ========== Cards ========== */
.card {
    border: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    /* Rundung folgt der Darstellungs-Einstellung (data-radius am <html>);
       der Kopf mit derselben Rundung, sonst standen seine Ecken über. */
    border-radius: var(--bs-border-radius-lg, 6px);
}

.card-header {
    border-bottom: 1px solid var(--ahds-border-color);
    border-radius: var(--bs-border-radius-lg, 6px) var(--bs-border-radius-lg, 6px) 0 0 !important;
}

/* Stat Cards */
.stat-card {
    border-left: 4px solid transparent;
}

.stat-card.primary { border-color: #0d6efd; }
.stat-card.warning { border-color: #fd7e14; }
.stat-card.danger  { border-color: #dc3545; }
.stat-card.success { border-color: #198754; }
.stat-card.purple  { border-color: #6f42c1; }

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    color: #6c757d;
    margin-top: 0.2rem;
}

/* ========== Tables ========== */
.table th {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    border-top: none;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    font-size: 0.88rem;
}

/* Kompakte Listen: knappes Zeilen-Padding, damit auch 100+ Eintraege
   uebersichtlich bleiben (gilt fuer alle Tabellen-Listen). */
.table > :not(caption) > * > * {
    padding-top: 0.3rem;
    padding-bottom: 0.3rem;
}

/* Aktions-Buttons in Tabellen flacher halten, damit sie die Zeilenhoehe
   nicht aufblaehen. */
.table td .btn-sm {
    --bs-btn-padding-y: 0.15rem;
    --bs-btn-padding-x: 0.4rem;
    line-height: 1.2;
}

.table-hover tbody tr:hover {
    background: rgba(var(--ahds-primary-rgb), 0.04);
}

/* ========== Priority Badges ========== */
.badge-priority-low      { background: #6c757d !important; color: #fff; }
.badge-priority-normal   { background: #0d6efd !important; color: #fff; }
.badge-priority-high     { background: #fd7e14 !important; color: #fff; }
.badge-priority-critical { background: #dc3545 !important; color: #fff; }

/* ========== Status Badges ========== */
.badge-status-open        { background: #0d6efd !important; color: #fff; }
.badge-status-in_progress { background: #fd7e14 !important; color: #fff; }
.badge-status-waiting     { background: #6f42c1 !important; color: #fff; }
.badge-status-resolved    { background: #198754 !important; color: #fff; }
.badge-status-closed      { background: #6c757d !important; color: #fff; }

/* ========== Timeline ========== */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.65rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #dee2e6;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-dot {
    position: absolute;
    left: -2rem;
    top: 0.25rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--ahds-primary);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--ahds-primary);
}

.timeline-item .card {
    border-left: 3px solid var(--ahds-primary);
}

/* ========== Checklist ========== */
.list-group-item.completed {
    text-decoration: line-through;
    opacity: 0.6;
}

.checklist-progress-bar {
    transition: width 0.3s ease;
}

/* ========== Planner Grid ========== */
/* Kein eigener Scrollcontainer: sonst würde der sticky Mitarbeiter-Namen an
   den (mitscrollenden) Grid gebunden statt an .planner-scroll. Das horizontale
   Scrollen übernimmt ausschließlich .planner-scroll. */
.planner-grid {
    overflow: visible;
}

.planner-table th {
    min-width: 160px;
    text-align: center;
    font-size: 0.8rem;
}

.planner-slot {
    min-height: 60px;
    vertical-align: top;
    padding: 4px;
}

.planner-event {
    background: var(--ahds-primary);
    color: #fff;
    border-radius: 4px;
    padding: 3px 7px;
    font-size: 0.76rem;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: default;
}

.planner-event.warning { background: #fd7e14; }
.planner-event.success { background: #198754; }
.planner-event.danger  { background: #dc3545; }

/* ========== Forms ========== */
.form-label {
    font-weight: 500;
    font-size: 0.88rem;
}

.required-mark {
    color: #dc3545;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--ahds-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--ahds-primary-rgb), 0.15);
}

/* ========== Buttons ========== */
.btn-primary {
    background-color: var(--ahds-primary);
    border-color: var(--ahds-primary);
}

/* Etwas dunkler als der Akzent; fest #0052a3 machte jeden Akzent beim Hover blau. */
.btn-primary:hover {
    background-color: #0052a3;
    border-color: #0052a3;
    background-color: color-mix(in srgb, var(--ahds-primary) 82%, #000);
    border-color: color-mix(in srgb, var(--ahds-primary) 82%, #000);
}

.btn-outline-primary {
    color: var(--ahds-primary);
    border-color: var(--ahds-primary);
}

.btn-outline-primary:hover {
    background-color: var(--ahds-primary);
    border-color: var(--ahds-primary);
}

/* ========== Navbar ========== */
.navbar {
    min-height: 58px;
}

.navbar-brand {
    font-size: 1rem;
}

/* ========== Login Card ========== */
.login-card {
    border-radius: 12px !important;
}

/* ========== Detail Views ========== */
.detail-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
}

.detail-value {
    font-size: 0.9rem;
}

/* ========== Pagination ========== */
.pagination .page-link {
    color: var(--ahds-primary);
    font-size: 0.85rem;
}

.pagination .page-item.active .page-link {
    background-color: var(--ahds-primary);
    border-color: var(--ahds-primary);
}

/* ========== Print ========== */
@media print {
    .sidebar,
    .navbar,
    .no-print {
        display: none !important;
    }

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

    /* Die App-Hülle ist bildschirmhoch und scrollt innen: gedruckt kam nur,
       was auf den Bildschirm passte (Lieferschein, Gerät). */
    .wrapper {
        display: block;
        height: auto;
        overflow: visible;
    }

    .main-content {
        overflow: visible;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }

    body {
        background: #fff;
    }
}

/* ========== Responsive (Mobile) ========== */
@media (max-width: 991.98px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        height: 100vh;
        z-index: 1050;
        box-shadow: 4px 0 15px rgba(0, 0, 0, 0.3);
    }

    .sidebar.show {
        left: 0;
    }

    /* Icon-only-Modus gilt nur am Desktop — mobil immer volle Off-Canvas-Breite */
    .sidebar.collapsed {
        width: 250px;
        min-width: 250px;
    }

    .sidebar.collapsed .nav-link span,
    .sidebar.collapsed .sidebar-brand span,
    .sidebar.collapsed .badge {
        display: inline;
    }

    .sidebar.collapsed .sidebar-footer .fw-semibold,
    .sidebar.collapsed .sidebar-footer .text-secondary {
        display: block;
    }

    .sidebar.collapsed .nav-section-toggle {
        display: flex;
    }

    .sidebar.collapsed .nav-section.section-collapsed .nav-section-items {
        display: none;
    }

    .sidebar.collapsed .nav-link {
        justify-content: flex-start;
    }

    .sidebar.collapsed .nav-link i {
        margin-right: 0.5rem !important;
    }

    .main-content {
        width: 100%;
    }
}

@media (max-width: 575.98px) {
    .stat-card .stat-number {
        font-size: 1.5rem;
    }

    .p-4 {
        padding: 1rem !important;
    }
}

/* ========== Drag & Drop Dropzone ========== */
.ahds-dropzone {
    border: 2px dashed #0d6efd;
    border-radius: 0.5rem;
    padding: 1.25rem 1rem;
    background: #f8f9ff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-align: center;
    position: relative;
}

.ahds-dropzone:hover,
.ahds-dropzone:focus-within {
    background: #e8eeff;
    border-color: #0a58ca;
}

.ahds-dropzone.dragover {
    background: #d0e4ff;
    border-color: #0a58ca;
    border-style: solid;
}

.ahds-dropzone.has-files {
    background: #f0fff4;
    border-color: #198754;
    text-align: left;
}

.ahds-dropzone-hint {
    color: #6c757d;
    font-size: 0.875rem;
    pointer-events: none;
}

.ahds-dropzone-hint i {
    display: block;
    font-size: 1.75rem;
    margin-bottom: 0.4rem;
    color: #0d6efd;
}

.ahds-dropzone.has-files .ahds-dropzone-hint {
    display: none;
}

.ahds-dropzone-preview {
    font-size: 0.85rem;
}

.ahds-dropzone-preview li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid #e9ecef;
}

.ahds-dropzone-preview li:last-child {
    border-bottom: none;
}

.ahds-dropzone-preview .file-icon {
    color: #0d6efd;
    width: 1.1em;
    text-align: center;
}

.ahds-dropzone-preview .file-size {
    color: #6c757d;
    margin-left: auto;
    white-space: nowrap;
    font-size: 0.78rem;
}

.ahds-dropzone-preview .btn-remove-file {
    background: none;
    border: none;
    color: #dc3545;
    padding: 0 0.2rem;
    font-size: 0.8rem;
    cursor: pointer;
    opacity: 0.7;
    line-height: 1;
}

.ahds-dropzone-preview .btn-remove-file:hover {
    opacity: 1;
}

.ahds-dropzone-add-more {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #0d6efd;
    cursor: pointer;
    text-decoration: underline;
}

/* ========== Tages-Zeitstrahl (Dashboard) ========== */
.day-timeline {
    overflow: hidden;
    border-radius: 6px;
}
.day-timeline-head {
    display: flex;
    align-items: center;
    gap: 12px;
    /* Kopf nur so hoch wie die Buttons darin (kein zusätzlicher vertikaler Wulst). */
    padding: 4px 12px;
    background: linear-gradient(180deg, #2b3450 0%, #1f273d 100%);
    color: #fff;
    font-size: 0.85rem;
}
.day-timeline-head .dt-title { font-weight: 600; position: relative; cursor: pointer; }
/* Datum ist selbst klickbar: transparentes date-Input liegt darüber und
   öffnet beim Klick den nativen Kalender – ohne separaten Button. */
.day-timeline-head .dt-title .dt-date-input {
    position: absolute; inset: 0; width: 100%; height: 100%;
    margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer;
    background: transparent; color: transparent;
}
.day-timeline-head .dt-title .dt-date-input::-webkit-calendar-picker-indicator {
    position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; opacity: 0;
}
.day-timeline-head .dt-title:hover { text-decoration: underline; }
.day-timeline-head .dt-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}
.dt-count { color: #aeb6cf; font-size: 0.8rem; white-space: nowrap; }
.dt-nav { display: flex; gap: 4px; }
.dt-btn {
    color: #cdd4e6;
    text-decoration: none;
    padding: 3px 9px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    line-height: 1.5;
    transition: background 0.15s ease, color 0.15s ease;
}
.dt-btn:hover { background: rgba(255, 255, 255, 0.2); color: #fff; }
.dt-btn.dt-today { font-weight: 600; }

.day-timeline-body { background: #fbfcfe; padding-bottom: 8px; }
.dt-axis {
    position: relative;
    height: 22px;
    border-bottom: 1px solid var(--ahds-border-color);
}
.dt-hour { position: absolute; top: 0; }
.dt-hour span {
    position: relative;
    top: 4px;
    margin-left: 4px;
    display: inline-block;
    font-size: 0.7rem;
    color: #8a93a6;
    white-space: nowrap;
}
/* Schmale Screens (Hochkant): kleinere Stundenlabels, damit sie sich bei
   grossem Zeitfenster nicht ueberlappen. Im Querformat ist wieder Platz. */
@media (max-width: 640px) {
    .dt-hour span { font-size: 0.6rem; margin-left: 2px; }
}
.dt-hour::before {
    content: "";
    position: absolute;
    top: 0;
    width: 1px;
    height: 22px;
    background: var(--ahds-border-color);
}
.dt-now {
    position: absolute;
    top: 0;
    width: 2px;
    height: 22px;
    background: #dc3545;
    z-index: 6;
}
.dt-now::after {
    content: "";
    position: absolute;
    top: -2px;
    left: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc3545;
}
.dt-track {
    position: relative;
    margin: 6px 0 0;
    background-image: repeating-linear-gradient(
        to right,
        var(--ahds-border-color) 0,
        var(--ahds-border-color) 1px,
        transparent 1px,
        transparent var(--dt-step, 8.3333%)
    );
}
.dt-event {
    position: absolute;
    height: 26px;
    /* Rundung folgt der Darstellungs-Einstellung (data-radius am <html>). */
    border-radius: var(--bs-border-radius-sm, 5px);
    overflow: hidden;
    background: var(--dt-color, #0066cc);
    border-left: 3px solid rgba(0, 0, 0, 0.28);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15), 0 1px 2px rgba(0, 0, 0, 0.2);
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 7px;
    font-size: 0.75rem;
    min-width: 0;
    transition: filter 0.12s ease, transform 0.12s ease;
}
.dt-event:hover { filter: brightness(1.1); transform: translateY(-1px); color: #fff; z-index: 5; }
/* Interne Einträge: dünner roter Streifen oben (max. 10 % der Elementhöhe). */
.dt-event.dt-internal::after {
    content: ""; position: absolute; top: 0; left: 0; right: 0;
    height: 2.5px; /* ~10 % von 26px */
    background: #dc3545;
    border-top-left-radius: inherit; border-top-right-radius: inherit;
    pointer-events: none; z-index: 3;
}
/* Anfahrt/Abfahrt: grauer, schraffierter Hüll-Bereich – Fahrtzeit als
   verbundener Teil desselben Blocks (liegt hinter dem farbigen Termin). */
.dt-travel {
    position: absolute;
    height: 26px;
    border-radius: var(--bs-border-radius-sm, 5px);
    z-index: 1;
    cursor: default;
    background: repeating-linear-gradient(45deg, #c3c9d2, #c3c9d2 5px, #d3d8df 5px, #d3d8df 10px);
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}
.dt-event { z-index: 2; }
[data-bs-theme="dark"] .dt-travel {
    background: repeating-linear-gradient(45deg, #3a4048, #3a4048 5px, #464d56 5px, #464d56 10px);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}
.dt-event-time { font-weight: 700; opacity: 0.9; flex-shrink: 0; }
.dt-event-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-empty { padding: 18px; text-align: center; color: #9aa3b5; font-size: 0.85rem; }

/* Zeitstrahl: durchgängige Now-Linie, Arbeitszeit-Ausgrauung, Drag-Handles */
.day-timeline-body { position: relative; overflow: hidden; }
.dt-shade {
    position: absolute; top: 0; bottom: 0;
    background: repeating-linear-gradient(45deg, rgba(108,117,125,0.10) 0, rgba(108,117,125,0.10) 6px, rgba(108,117,125,0.05) 6px, rgba(108,117,125,0.05) 12px);
    border-left: 1px dashed rgba(108,117,125,0.3);
    border-right: 1px dashed rgba(108,117,125,0.3);
    z-index: 0; pointer-events: none;
}
.dt-now-line {
    position: absolute; top: 0; bottom: 0;
    width: 2px; background: #dc3545; z-index: 7; pointer-events: none;
}
.dt-now-line::after {
    content: ""; position: absolute; top: 0; left: -3px;
    width: 8px; height: 8px; border-radius: 50%; background: #dc3545;
}
.dt-axis, .dt-track { position: relative; z-index: 1; }
/* Scroll-Pfeile am linken/rechten Rand des Zeitstrahls – vertikal mittig
   (relativ zur jeweiligen Zeitstrahlhöhe), als dezentes Overlay. */
.dt-edge {
    position: absolute; top: 50%; transform: translateY(-50%);
    z-index: 8; left: 4px;
    width: 26px; height: 46px; display: flex; align-items: center; justify-content: center;
    color: #fff; background: rgba(43,52,80,.5); border-radius: 6px;
    text-decoration: none; font-size: 1rem; transition: background .12s ease;
}
.dt-edge:hover { background: rgba(43,52,80,.82); color: #fff; }
.dt-edge-l { left: 4px; right: auto; }
.dt-edge-r { right: 4px; left: auto; }
[data-bs-theme="dark"] .dt-edge { background: rgba(255,255,255,.14); }
[data-bs-theme="dark"] .dt-edge:hover { background: rgba(255,255,255,.3); }
.dt-event { cursor: grab; }
.dt-event.dt-dragging { cursor: grabbing; opacity: 0.85; z-index: 20; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.dt-event.dt-locked { cursor: default; }
.dt-handle {
    width: 7px; align-self: stretch; flex-shrink: 0; cursor: ew-resize;
    border-radius: 5px; background: rgba(255,255,255,0.35);
    opacity: 0; transition: opacity 0.12s ease;
}
.dt-handle-l { margin-left: -4px; }
.dt-handle-r { margin-right: -4px; }
.dt-event:hover .dt-handle { opacity: 1; }
.dt-track { cursor: copy; }

/* Dark-Mode: Zeitstrahl-Body + helle Flächen an die Dark-Surface angleichen. */
[data-bs-theme="dark"] .day-timeline-body { background: var(--ahds-surface); }
[data-bs-theme="dark"] .dt-hour span { color: #9aa3b5; }
[data-bs-theme="dark"] .dt-empty { color: #7c869a; }
[data-bs-theme="dark"] .dt-shade {
    background: repeating-linear-gradient(45deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 6px, rgba(255,255,255,0.02) 6px, rgba(255,255,255,0.02) 12px);
    border-left-color: rgba(255,255,255,0.14); border-right-color: rgba(255,255,255,0.14);
}

/* Benutzermenü (Topbar-Dropdown): einheitliche Icon-Breite, damit alle Labels
   bündig stehen – wie in der Sidebar (kein „Schlängeln"). */
.dropdown-menu[aria-labelledby="userMenu"] .dropdown-item { display: flex; align-items: center; }
.dropdown-menu[aria-labelledby="userMenu"] .dropdown-item > i:first-child {
    width: 1.4rem; flex: 0 0 1.4rem; text-align: center; margin-right: .5rem;
}

/* ========== Panel-Feinschliff (AHdS/phpBB-Anmutung) ========== */
.card-header:not([class*="bg-"]) {
    /* Einheitlich weiße Titelleisten – wie die Dashboard-Widgets (bg-white),
       statt des früheren grau-metallic Verlaufs. */
    background: #ffffff;
    font-weight: 600;
    color: #2b3450;
    border-bottom: 1px solid var(--ahds-border-color, #d7dde8);
}

/* ========== Einheitlicher Leerzustand (Empty State) ========== */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: #9aa3b5;
}
.empty-state i {
    font-size: 2.25rem;
    opacity: 0.5;
    display: block;
    margin-bottom: 0.6rem;
}
.empty-state p { margin: 0; font-size: 0.9rem; }
.empty-state-action { margin-top: 0.85rem; }

/* ========== Tages-Zeitstrahl: mobil ========== */
/* Der Zeitstrahl ist vollständig prozentbasiert und füllt daher immer die
   aktuelle Breite (Hoch- wie Querformat) – KEIN horizontales Scrollen mit
   fester Mindestbreite mehr. So passt sich das Widget beim Drehen sofort an. */
@media (max-width: 768px) {
    .day-timeline-body { overflow-x: hidden; }
    .day-timeline-head { flex-wrap: wrap; gap: 8px; }
    .day-timeline-head .dt-meta { margin-left: 0; }
}
/* Sehr schmal (Hochkant-Handy): jedes zweite Stundenlabel ausblenden, damit
   sich die Beschriftungen bei großem Zeitfenster nicht überlappen. Die
   Tick-Striche (dt-hour::before) bleiben für alle Stunden erhalten. */
@media (max-width: 480px) {
    .day-timeline-body .dt-hour:nth-child(even) span { display: none; }
}

/* ========== Sticky Table-Header, Pflichtfeld-Marker, Sortier-Header ========== */
.table thead th {
    position: sticky;
    top: 0;
    z-index: 5;
}
.table:not(.table-dark) thead th { background: #eef1f6; }
.table-dark thead th { background: #212529; }
.req-mark { color: #dc3545; font-weight: 600; }

th.sortable a {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
}
th.sortable a:hover { color: var(--ahds-primary); }
th.sortable .sort-ind { opacity: 0.35; font-size: 0.75em; }
th.sortable.sorted .sort-ind { opacity: 1; color: var(--ahds-primary); }

/* ========== Tastatur-Navigation in Listen (j/k) ========== */
.table tbody tr.kb-focus {
    outline: 2px solid var(--ahds-primary, #0d6efd);
    outline-offset: -2px;
}

/* ========== Kompaktere Dichte (global) ========== */
/* Deutlich straffere Zeilenabstände/Polster app-weit. */
:root { --ahds-density: 1; }
body { font-size: .875rem; line-height: 1.35; }

/* Tabellen kompakter */
.table > :not(caption) > * > * { padding-top: .3rem; padding-bottom: .3rem; }
.table-sm > :not(caption) > * > * { padding-top: .18rem; padding-bottom: .18rem; }

/* Karten kompakter */
.card-body { padding: .6rem .8rem; }
.card-header { padding: .4rem .8rem; }
.card { margin-bottom: .7rem; }

/* Formulare kompakter */
.form-label { margin-bottom: .15rem; font-size: .85rem; }
.mb-3 { margin-bottom: .5rem !important; }
.mb-4 { margin-bottom: .7rem !important; }
.mt-4 { margin-top: .7rem !important; }
.my-4 { margin-top: .7rem !important; margin-bottom: .7rem !important; }
.g-3 { --bs-gutter-y: .5rem; --bs-gutter-x: .5rem; }
.row.g-4 { --bs-gutter-y: .7rem; --bs-gutter-x: .7rem; }
.gap-4 { gap: .8rem !important; }

/* Seiten-Container & Abschnitte enger */
.container-fluid { padding-top: .6rem; padding-bottom: .6rem; }
.container-fluid.py-4 { padding-top: .6rem !important; padding-bottom: .6rem !important; }
.py-4 { padding-top: .7rem !important; padding-bottom: .7rem !important; }
.py-3 { padding-top: .45rem !important; padding-bottom: .45rem !important; }

/* Listengruppen & Inputs */
.list-group-item { padding-top: .4rem; padding-bottom: .4rem; }
.form-control, .form-select { padding-top: .28rem; padding-bottom: .28rem; }
.form-control-sm, .form-select-sm { padding-top: .15rem; padding-bottom: .15rem; }

/* Überschriften mit weniger Abstand */
h1, .h1 { font-size: 1.5rem; }
h1.h3, h1.h4, .page-title { margin-bottom: .6rem; }
.mb-4.d-flex, .d-flex.mb-4 { margin-bottom: .7rem !important; }

/* ========== Dashboard-Widgets (Anpassen-Modus) ========== */
.dw-tools { display: none; position: absolute; top: 4px; right: 6px; z-index: 5; gap: 4px; }
.dw-editing .dw-tools { display: inline-flex; }
.dw-editing .dashboard-widget[data-active="1"] .dw-frame {
    outline: 1px dashed var(--ahds-primary, #0d6efd); outline-offset: 2px; border-radius: 6px;
}
/* Verschieben läuft nur über den Griff; das ganze Widget zeigt daher keinen
   grab-Cursor mehr (sonst wirkt es verschiebbar, wo es nicht zieht). */
.dw-editing .dashboard-widget[data-active="1"] { cursor: default; }
.dw-tools .dw-handle { color: #6c757d; padding: 2px 8px; cursor: grab; background: #fff; border: 1px solid #dee2e6; border-radius: 4px; }
.dw-tools .dw-handle:hover { color: #0d6efd; border-color: #0d6efd; }
.dw-tools .dw-handle:active { cursor: grabbing; }
.dw-tools .dw-remove { color: #dc3545; padding: 2px 7px; cursor: pointer; background: #fff; border: 1px solid #dee2e6; border-radius: 4px; line-height: 1; }
.dw-tools .dw-remove:hover { background: #dc3545; color: #fff; }
.dw-size { margin-right: 2px; }
.dw-size-btn { font-size: .7rem; line-height: 1; padding: 2px 6px; background: #fff; color: #6c757d; border: 1px solid #dee2e6; cursor: pointer; }
.dw-size-btn:first-child { border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.dw-size-btn:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }
.dw-size-btn + .dw-size-btn { border-left: 0; }
.dw-size-btn.active { background: var(--ahds-primary, #0d6efd); color: #fff; border-color: var(--ahds-primary, #0d6efd); }
.dw-dragging { opacity: .5; }
.dw-group-handle { cursor: grab; }

/* Kundensuche-Feld: garantiert einzeilig; Pille bricht nicht um und
   verschiebt keine Nachbar-Elemente (lange Firmennamen werden gekürzt). */
.cs-field { display: block; }
.cs-field input[data-customer-search] { width: 100%; }

/* ========== Farbschema (Akzentfarbe) ========== */
/* Akzent wirkt auf die App-eigene Primärfarbe und auf Bootstrap-Primärelemente. */
[data-accent="blue"]    { --ahds-primary:#0066cc; --ahds-primary-rgb:0,102,204; }
[data-accent="teal"]    { --ahds-primary:#0d9488; --ahds-primary-rgb:13,148,136; }
[data-accent="indigo"]  { --ahds-primary:#4f46e5; --ahds-primary-rgb:79,70,229; }
[data-accent="green"]   { --ahds-primary:#16a34a; --ahds-primary-rgb:22,163,74; }
[data-accent="rose"]    { --ahds-primary:#e11d48; --ahds-primary-rgb:225,29,72; }
[data-accent="amber"]   { --ahds-primary:#d97706; --ahds-primary-rgb:217,119,6; }
[data-accent="violet"]  { --ahds-primary:#7c3aed; --ahds-primary-rgb:124,58,237; }
[data-accent="cyan"]    { --ahds-primary:#0891b2; --ahds-primary-rgb:8,145,178; }
[data-accent="orange"]  { --ahds-primary:#ea580c; --ahds-primary-rgb:234,88,12; }
[data-accent="pink"]    { --ahds-primary:#db2777; --ahds-primary-rgb:219,39,119; }
[data-accent="emerald"] { --ahds-primary:#059669; --ahds-primary-rgb:5,150,105; }
[data-accent="slate"]   { --ahds-primary:#475569; --ahds-primary-rgb:71,85,105; }

/* Dark Mode: hellere Akzenttöne für ausreichenden Kontrast auf dunklem Grund. */
[data-bs-theme="dark"][data-accent="blue"]    { --ahds-primary:#60a5fa; --ahds-primary-rgb:96,165,250; }
[data-bs-theme="dark"][data-accent="teal"]    { --ahds-primary:#2dd4bf; --ahds-primary-rgb:45,212,191; }
[data-bs-theme="dark"][data-accent="indigo"]  { --ahds-primary:#818cf8; --ahds-primary-rgb:129,140,248; }
[data-bs-theme="dark"][data-accent="green"]   { --ahds-primary:#4ade80; --ahds-primary-rgb:74,222,128; }
[data-bs-theme="dark"][data-accent="rose"]    { --ahds-primary:#fb7185; --ahds-primary-rgb:251,113,133; }
[data-bs-theme="dark"][data-accent="amber"]   { --ahds-primary:#fbbf24; --ahds-primary-rgb:251,191,36; }
[data-bs-theme="dark"][data-accent="violet"]  { --ahds-primary:#a78bfa; --ahds-primary-rgb:167,139,250; }
[data-bs-theme="dark"][data-accent="cyan"]    { --ahds-primary:#22d3ee; --ahds-primary-rgb:34,211,238; }
[data-bs-theme="dark"][data-accent="orange"]  { --ahds-primary:#fb923c; --ahds-primary-rgb:251,146,60; }
[data-bs-theme="dark"][data-accent="pink"]    { --ahds-primary:#f472b6; --ahds-primary-rgb:244,114,182; }
[data-bs-theme="dark"][data-accent="emerald"] { --ahds-primary:#34d399; --ahds-primary-rgb:52,211,153; }
[data-bs-theme="dark"][data-accent="slate"]   { --ahds-primary:#94a3b8; --ahds-primary-rgb:148,163,184; }

[data-accent] { --ahds-sidebar-active: var(--ahds-primary); --bs-primary: var(--ahds-primary); --bs-primary-rgb: var(--ahds-primary-rgb); --bs-link-color: var(--ahds-primary); --bs-link-hover-color: var(--ahds-primary); }
[data-accent] .btn-primary {
    --bs-btn-bg: var(--ahds-primary); --bs-btn-border-color: var(--ahds-primary);
    --bs-btn-hover-bg: var(--ahds-primary); --bs-btn-hover-border-color: var(--ahds-primary);
    --bs-btn-active-bg: var(--ahds-primary); --bs-btn-active-border-color: var(--ahds-primary);
    --bs-btn-disabled-bg: var(--ahds-primary); --bs-btn-disabled-border-color: var(--ahds-primary);
}
[data-accent] .text-primary { color: var(--ahds-primary) !important; }
[data-accent] .bg-primary   { background-color: var(--ahds-primary) !important; }
[data-accent] .badge.bg-primary { background-color: var(--ahds-primary) !important; }
[data-accent] .btn-outline-primary {
    --bs-btn-color: var(--ahds-primary); --bs-btn-border-color: var(--ahds-primary);
    --bs-btn-hover-bg: var(--ahds-primary); --bs-btn-hover-border-color: var(--ahds-primary);
    --bs-btn-active-bg: var(--ahds-primary); --bs-btn-active-border-color: var(--ahds-primary);
}

/* ========== Grundfarbe / Chrome (Sidebar + Leisten) ========== */
/* Zweite Theming-Achse neben dem Akzent: färbt Seitenleiste UND Kopfleiste
   durchgängig. „default" = klassisch (dunkle Sidebar, heller Kopf). Alle
   weiteren Presets liefern eine vollflächig dunkle Chrome. */
.ahds-topbar {
    background: var(--ahds-topbar-bg);
    color: var(--ahds-topbar-fg);
    border-bottom: 1px solid var(--ahds-topbar-border);
    /* bleibt beim internen Scrollen von .main-content oben stehen */
    position: sticky;
    top: 0;
    z-index: 1020;
}
.ahds-topbar .navbar-brand,
.ahds-topbar .navbar-brand.text-primary { color: var(--ahds-topbar-brand) !important; }
/* Avatar im Topbar-Benutzermenü: Initialen + farbiger Ring = Zeiterfassungsstatus. */
.topbar-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px;
    background: var(--ahds-primary); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .72rem; font-weight: 700; letter-spacing: .02em;
    box-shadow: 0 0 0 2px var(--ts-color, transparent);
}
.ahds-topbar #userMenu { color: var(--ahds-topbar-fg); }
.ahds-topbar #userMenu::after { vertical-align: middle; }

/* Grundfarben-Presets: setzen Sidebar-, Topbar- UND Inhalts-Hintergrund gemeinsam.
   Der Inhalts-Hintergrund erhält einen dezenten Farbstich des Chromas, damit sich
   die Grundfarbe als durchgängiges Thema anfühlt (nicht nur an den Rändern). */
[data-base="navy"]       { --ahds-sidebar-bg:#16203a; --ahds-topbar-bg:#1c2947; --ahds-content-bg:#eef1f8; }
[data-base="slate"]      { --ahds-sidebar-bg:#273244; --ahds-topbar-bg:#313d52; --ahds-content-bg:#eef0f4; }
[data-base="anthracite"] { --ahds-sidebar-bg:#1b2028; --ahds-topbar-bg:#232a34; --ahds-content-bg:#eff0f2; }
[data-base="black"]      { --ahds-sidebar-bg:#0e0e10; --ahds-topbar-bg:#17171a; --ahds-content-bg:#f0f0f1; }
[data-base="forest"]     { --ahds-sidebar-bg:#0f2a22; --ahds-topbar-bg:#14352b; --ahds-content-bg:#ecf3ef; }

/* Vollflächig dunkle Chrome: Kopfleiste hell beschriften + Bedienelemente
   kontrastreich halten (alles außer „default"). */
[data-base="navy"], [data-base="slate"], [data-base="anthracite"],
[data-base="black"], [data-base="forest"] {
    --ahds-topbar-fg:#f1f5f9;
    --ahds-topbar-muted:rgba(255,255,255,.62);
    --ahds-topbar-border:rgba(255,255,255,.10);
    --ahds-topbar-brand:#f1f5f9;
}
[data-base="navy"] .ahds-topbar .text-muted,
[data-base="slate"] .ahds-topbar .text-muted,
[data-base="anthracite"] .ahds-topbar .text-muted,
[data-base="black"] .ahds-topbar .text-muted,
[data-base="forest"] .ahds-topbar .text-muted { color: var(--ahds-topbar-muted) !important; }
/* Sekundär-Umriss-Buttons in dunkler Kopfleiste hell zeichnen. */
[data-base="navy"] .ahds-topbar .btn-outline-secondary,
[data-base="slate"] .ahds-topbar .btn-outline-secondary,
[data-base="anthracite"] .ahds-topbar .btn-outline-secondary,
[data-base="black"] .ahds-topbar .btn-outline-secondary,
[data-base="forest"] .ahds-topbar .btn-outline-secondary {
    --bs-btn-color:rgba(255,255,255,.82); --bs-btn-border-color:rgba(255,255,255,.28);
    --bs-btn-hover-bg:rgba(255,255,255,.12); --bs-btn-hover-color:#fff; --bs-btn-hover-border-color:rgba(255,255,255,.45);
}

/* ========== Dark Mode ========== */
[data-bs-theme="dark"] {
    --ahds-content-bg: #14181d;
    --ahds-border-color: #2b3035;
    /* Oberfläche (Karten/weiße Flächen) – wird je Grundfarbe leicht getönt. */
    --ahds-surface: #1e2227;
}
/* Karten & „weiße" Flächen folgen der getönten Oberfläche (nur dunkel; hell
   bleiben Karten weiß und heben sich vom getönten Inhalt ab). */
[data-bs-theme="dark"] .card { --bs-card-bg: var(--ahds-surface); }
/* Titelleisten ohne eigene Farbe: hell sind sie weiß, dunkel blieben sie es auch. */
[data-bs-theme="dark"] .card-header:not([class*="bg-"]) { background: var(--ahds-surface); color: var(--bs-body-color); }
/* Grundfarben-Oberflächen: eine Stufe heller als der Inhalt = dezente Elevation. */
[data-bs-theme="dark"][data-base="navy"]       { --ahds-surface:#1a2130; }
[data-bs-theme="dark"][data-base="slate"]      { --ahds-surface:#1c2230; }
[data-bs-theme="dark"][data-base="anthracite"] { --ahds-surface:#1b1f26; }
[data-bs-theme="dark"][data-base="black"]      { --ahds-surface:#17171a; }
[data-bs-theme="dark"][data-base="forest"]     { --ahds-surface:#16261f; }
[data-bs-theme="dark"] body { color: var(--bs-body-color); }
/* Dunkler Modus: die klassische Grundfarbe („heller Kopf") bekommt eine dunkle
   Kopfleiste, damit sie sich nicht als weißer Streifen vom Dark Mode abhebt. */
[data-bs-theme="dark"][data-base="default"] {
    --ahds-topbar-bg:#1e2227; --ahds-topbar-fg:#e6e6e6;
    --ahds-topbar-muted:rgba(255,255,255,.55); --ahds-topbar-border:#2b3035;
    --ahds-topbar-brand:var(--ahds-primary);
}
/* Dunkler Modus: Inhalts-Hintergrund je Grundfarbe leicht tönen, damit das Thema
   auch dunkel durchgängig wirkt. Kombinierte Selektoren gewinnen gegen den
   generischen Dark-Hintergrund weiter oben. */
[data-bs-theme="dark"][data-base="navy"]       { --ahds-content-bg:#11151f; }
[data-bs-theme="dark"][data-base="slate"]      { --ahds-content-bg:#14171d; }
[data-bs-theme="dark"][data-base="anthracite"] { --ahds-content-bg:#13161a; }
[data-bs-theme="dark"][data-base="black"]      { --ahds-content-bg:#0c0c0e; }
[data-bs-theme="dark"][data-base="forest"]     { --ahds-content-bg:#0f1613; }
/* Häufig fest verdrahtete Utilities an den Dark Mode angleichen. */
[data-bs-theme="dark"] .bg-white { background-color: var(--ahds-surface) !important; }
[data-bs-theme="dark"] .bg-light { background-color: #2b3035 !important; }
[data-bs-theme="dark"] .text-dark { color: #e9ecef !important; }
[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-top,
[data-bs-theme="dark"] .border-bottom,
[data-bs-theme="dark"] .border-end,
[data-bs-theme="dark"] .border-start { border-color: var(--ahds-border-color) !important; }
[data-bs-theme="dark"] .table:not(.table-dark) thead th { background: #21262d; color: #e9ecef; }
[data-bs-theme="dark"] .table-light { --bs-table-bg: #21262d; --bs-table-color: #e9ecef; }
/* Sidebar bleibt in beiden Modi dunkel; nur den Rand etwas anpassen. */
[data-bs-theme="dark"] .navbar.bg-white { background-color: #1e2227 !important; border-color: var(--ahds-border-color) !important; }

/* ===== Tages-Zeitstrahl: Zusatz-Spuren (Zeiterfassung, Telefonate, Remote) ===== */
/* Zeiterfassungs-Buchungen: dünne graue Balken am oberen Rand. */
.day-timeline .dt-segbar {
    position: absolute; top: 3px; height: 6px; border-radius: var(--bs-border-radius-sm, 3px);
    background: #b6bcc4; opacity: .9; z-index: 1;
}
/* Telefonate & Remote-Sitzungen: nicht ziehbare Blöcke. */
.day-timeline .dt-extra {
    position: absolute; height: 24px; line-height: 24px; border-radius: var(--bs-border-radius-sm, 5px);
    font-size: .74rem; padding: 0 6px; overflow: hidden; white-space: nowrap;
    text-decoration: none; color: #0b4a7a; border: 1px solid rgba(13,110,253,.35); z-index: 2;
}
.day-timeline .dt-extra .dt-extra-label { vertical-align: middle; }
/* Telefonat: hellblau. */
.day-timeline .dt-call { background: #cfe8ff; }
/* Remote-Sitzung: pastellblau, hell-/pastell gestreift. */
.day-timeline .dt-remote {
    background-image: repeating-linear-gradient(45deg, #d8ecff, #d8ecff 6px, #eef6ff 6px, #eef6ff 12px);
}
[data-bs-theme="dark"] .day-timeline .dt-extra { color: #cfe8ff; border-color: rgba(120,170,255,.4); }
[data-bs-theme="dark"] .day-timeline .dt-call { background: #1d3a52; }
[data-bs-theme="dark"] .day-timeline .dt-remote {
    background-image: repeating-linear-gradient(45deg, #1d3a52, #1d3a52 6px, #16293a 6px, #16293a 12px);
}
[data-bs-theme="dark"] .day-timeline .dt-segbar { background: #5a6068; }

/* =====================================================================
   Darstellung: Ecken-Rundung (stufenweise) + Rahmen transparent schaltbar.
   Gesetzt via data-radius / data-borders am <html> (ThemeController).
   ===================================================================== */
html[data-radius="md"]{
    --bs-border-radius:.375rem;--bs-border-radius-sm:.25rem;--bs-border-radius-lg:.5rem;
    --bs-border-radius-xl:.625rem;--bs-border-radius-xxl:.75rem;--bs-border-radius-2xl:.75rem;--bs-border-radius-pill:.5rem;
}
html[data-radius="sm"]{
    --bs-border-radius:.2rem;--bs-border-radius-sm:.15rem;--bs-border-radius-lg:.25rem;
    --bs-border-radius-xl:.3rem;--bs-border-radius-xxl:.35rem;--bs-border-radius-2xl:.35rem;--bs-border-radius-pill:.25rem;
}
html[data-radius="none"]{
    --bs-border-radius:0;--bs-border-radius-sm:0;--bs-border-radius-lg:0;
    --bs-border-radius-xl:0;--bs-border-radius-xxl:0;--bs-border-radius-2xl:0;--bs-border-radius-pill:0;
}
/* „Aus" wirkt auch auf hartkodierte Rundungen – Kreise/Avatare/Spinner ausgenommen. */
html[data-radius="none"] .card,html[data-radius="none"] .btn,html[data-radius="none"] .form-control,
html[data-radius="none"] .form-select,html[data-radius="none"] .dropdown-menu,html[data-radius="none"] .modal-content,
html[data-radius="none"] .alert,html[data-radius="none"] .badge,html[data-radius="none"] .list-group,
html[data-radius="none"] .list-group-item,html[data-radius="none"] .offcanvas,html[data-radius="none"] .toast,
html[data-radius="none"] .input-group-text,html[data-radius="none"] .progress,html[data-radius="none"] .img-thumbnail,
html[data-radius="none"] .nav-pills .nav-link{border-radius:0!important}

html[data-borders="0"]{--bs-border-color:transparent;--bs-border-color-translucent:transparent}
html[data-borders="0"] .card,html[data-borders="0"] .border,html[data-borders="0"] .border-top,
html[data-borders="0"] .border-bottom,html[data-borders="0"] .border-start,html[data-borders="0"] .border-end,
html[data-borders="0"] .table,html[data-borders="0"] .table td,html[data-borders="0"] .table th,
html[data-borders="0"] .list-group-item,html[data-borders="0"] .dropdown-menu,html[data-borders="0"] .modal-content,
html[data-borders="0"] .input-group-text,html[data-borders="0"] .offcanvas,html[data-borders="0"] .toast{border-color:transparent!important}
/* Eingaben bleiben trotz transparentem Rahmen erkennbar. */
html[data-borders="0"] .form-control,html[data-borders="0"] .form-select{border-color:transparent!important;background-color:rgba(128,128,128,.08)}
/* Rahmen aus: Der Contentbereich bekommt die gleiche Fläche wie die Karten,
   damit die Lücken zwischen den Elementen nicht durch den (kontrastierenden)
   Seitenhintergrund getrennt wirken – alles liegt auf einer durchgehenden
   Fläche. Karten heben sich dann nur noch dezent per Schatten ab. */
html[data-borders="0"] body,
html[data-borders="0"] .main-content{background:#fff}
html[data-borders="0"][data-bs-theme="dark"] body,
html[data-borders="0"][data-bs-theme="dark"] .main-content{background:var(--ahds-surface)}
/* Karten auf der gemeinsamen Fläche minimal absetzen (nur Rahmen-aus-Modus). */
html[data-borders="0"] .card{box-shadow:0 1px 2px rgba(0,0,0,.06)}
html[data-borders="0"][data-bs-theme="dark"] .card{box-shadow:0 1px 2px rgba(0,0,0,.35)}

/* =====================================================================
   Menü-Icons einheitlich breit: In vertikalen Menüs (Dropdowns, Kontext-
   menüs) sollen alle Beschriftungen an derselben x-Position beginnen –
   unabhängig davon, wie breit das jeweilige Font-Awesome-Icon ist. Das
   führende Icon bekommt eine feste Breite (wie fa-fw = 1.25em) und wird
   zentriert. Die Sidebar regelt das bereits selbst. ==================== */
.dropdown-menu .dropdown-item > i:first-child,
.dropdown-menu .dropdown-item > svg.svg-inline--fa:first-child {
    display:inline-block;
    width:1.4rem;
    text-align:center;
    flex:0 0 1.4rem;
}
/* Auch senkrechte Pill-Menüs (z. B. Einstellungs-Navigation) ausrichten.
   Bewusst NICHT auf generische .list-group angewandt – die wird auch für
   Datenzeilen genutzt, nicht nur für Menüs. */
.nav-pills.flex-column .nav-link > i:first-child {
    display:inline-block;
    width:1.4rem;
    text-align:center;
}

/* Chat: aktives Ziel beim Datei-Ziehen direkt ins Nachrichtenfeld. */
#rsInput.rs-drop { outline: 2px dashed var(--ahds-primary, #0d6efd); outline-offset: 2px; background: rgba(13,110,253,.06); }

/* ── Skeleton-Loader + Toast-Animation (UX-Politur) ─────────────────────── */
@keyframes ahdsShimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skeleton {
    background: linear-gradient(90deg, rgba(0,0,0,.06) 25%, rgba(0,0,0,.12) 37%, rgba(0,0,0,.06) 63%);
    background-size: 400px 100%;
    animation: ahdsShimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
    display: block;
}
.skeleton-text { height: .85rem; margin: .45rem 0; }
.skeleton-wrap { display: flex; flex-direction: column; }
[data-bs-theme="dark"] .skeleton,
html[data-theme="dark"] .skeleton {
    background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.11) 37%, rgba(255,255,255,.05) 63%);
    background-size: 400px 100%;
}
.ahds-toast { animation: ahdsToastIn .22s ease-out; }
.ahds-toast-out { opacity: 0; transform: translateX(12px); transition: opacity .24s ease, transform .24s ease; }
@keyframes ahdsToastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
    .skeleton { animation: none; }
    .ahds-toast, .ahds-toast-out { animation: none; transition: none; }
}

/* ── Command-Palette (⌘K) + A11y ──────────────────────────────────────────── */
/* Skip-Link: erst sichtbar bei Tastatur-Fokus. */
.cmdk-skip-link {
    position: absolute; left: 8px; top: -48px; z-index: 2000;
    background: var(--ahds-primary); color: #fff; padding: .5rem .9rem;
    border-radius: 0 0 .4rem .4rem; text-decoration: none; font-size: .9rem;
    transition: top .15s ease;
}
.cmdk-skip-link:focus { top: 0; color: #fff; outline: 2px solid #fff; outline-offset: 2px; }

/* Deutlichere Tastatur-Fokus-Ringe (nur bei :focus-visible, nicht bei Maus). */
a:focus-visible, button:focus-visible, .btn:focus-visible,
.form-control:focus-visible, .form-select:focus-visible,
.dropdown-item:focus-visible, [tabindex]:focus-visible, summary:focus-visible {
    outline: 2px solid var(--ahds-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(var(--ahds-primary-rgb), .25);
}
#mainContent:focus { outline: none; }

/* ⌘K-Hinweis im Suchfeld der Topbar. */
.cmdk-kbd-hint {
    position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
    border: 0; background: transparent; padding: 0; line-height: 1; cursor: pointer;
}
.cmdk-kbd-hint kbd {
    font-size: .68rem; padding: .12rem .35rem; border-radius: .3rem;
    background: var(--bs-tertiary-bg, #eef1f5); color: var(--bs-secondary-color, #6c757d);
    border: 1px solid var(--bs-border-color, #dee2e6); box-shadow: none;
}
.cmdk-kbd-hint:hover kbd { color: var(--ahds-primary); border-color: var(--ahds-primary); }

/* Overlay + Box */
.cmdk-overlay {
    position: fixed; inset: 0; z-index: 1080;
    background: rgba(17, 24, 39, .5);
    display: flex; align-items: flex-start; justify-content: center;
    padding: 12vh 1rem 1rem;
    backdrop-filter: blur(2px);
}
.cmdk-overlay[hidden] { display: none; }
.cmdk-box {
    width: 100%; max-width: 640px;
    background: var(--bs-body-bg, #fff); color: var(--bs-body-color, #212529);
    border: 1px solid var(--bs-border-color, #dee2e6);
    border-radius: .75rem; box-shadow: 0 24px 60px rgba(0,0,0,.35);
    overflow: hidden; display: flex; flex-direction: column;
    max-height: 70vh; animation: cmdkPop .12s ease;
}
@keyframes cmdkPop { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }

.cmdk-header {
    display: flex; align-items: center; gap: .65rem;
    padding: .85rem 1rem; border-bottom: 1px solid var(--bs-border-color, #dee2e6);
}
.cmdk-search-icon { color: var(--bs-secondary-color, #6c757d); font-size: 1rem; }
.cmdk-input {
    flex: 1; border: 0; outline: none; background: transparent;
    font-size: 1.05rem; color: inherit;
}
.cmdk-input::placeholder { color: var(--bs-secondary-color, #9aa3b5); }

.cmdk-list { list-style: none; margin: 0; padding: .35rem; overflow-y: auto; flex: 1; }
.cmdk-group {
    font-size: .7rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--bs-secondary-color, #6c757d); padding: .5rem .75rem .25rem;
    font-weight: 600;
}
.cmdk-group-sep { border-top: 1px solid var(--bs-border-color, #e5e7eb); margin-top: .25rem; padding-top: .25rem; min-height: 0; }
.cmdk-item {
    display: flex; align-items: center; gap: .65rem;
    padding: .55rem .75rem; border-radius: .5rem; cursor: pointer;
    color: inherit;
}
.cmdk-item.is-active { background: rgba(var(--ahds-primary-rgb), .12); }
.cmdk-item-icon { width: 1.25rem; text-align: center; color: var(--ahds-primary); flex: none; }
.cmdk-label { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmdk-path {
    margin-left: .35rem; font-size: .8rem; color: var(--bs-secondary-color, #6c757d);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cmdk-badge {
    margin-left: auto; font-size: .68rem; padding: .1rem .45rem; border-radius: .3rem;
    background: var(--bs-tertiary-bg, #eef1f5); color: var(--bs-secondary-color, #6c757d);
    border: 1px solid var(--bs-border-color, #dee2e6); flex: none;
}
.cmdk-empty { padding: 1.5rem .75rem; text-align: center; color: var(--bs-secondary-color, #6c757d); }

.cmdk-footer {
    display: flex; gap: 1.1rem; padding: .55rem 1rem;
    border-top: 1px solid var(--bs-border-color, #dee2e6);
    font-size: .78rem; color: var(--bs-secondary-color, #6c757d);
}
.cmdk-footer kbd {
    font-size: .72rem; padding: .08rem .3rem; margin-right: .15rem; border-radius: .25rem;
    background: var(--bs-tertiary-bg, #eef1f5); color: var(--bs-secondary-color, #6c757d);
    border: 1px solid var(--bs-border-color, #dee2e6); box-shadow: none;
}
body.cmdk-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
    .cmdk-box { animation: none; }
    .cmdk-skip-link { transition: none; }
}

/* A11y: größere Tap-Ziele auf Touch-Geräten (WCAG Zielgröße). Nur bei grobem
   Zeiger (Touch), damit die Desktop-Dichte unverändert bleibt. */
@media (pointer: coarse) {
    .btn-sm,
    .btn-group-sm > .btn { min-height: 40px; }
    .btn-close { min-width: 36px; min-height: 36px; }
}

/* ========== Handy: nichts abschneiden, nicht seitwärts scrollen ==========
   .main-content hat overflow-x:hidden und die Scrollleisten sind aus: was
   breiter ist als der Bildschirm, war bisher einfach weg. Leisten brechen
   deshalb um, und Tabellen, die nicht passen, werden zu Karten
   (public/js/mobil-tabellen.js setzt dafür .tabelle-karten und data-label). */
@media (max-width: 767.98px) {
    .pagination, .btn-toolbar, .nav-tabs, .nav-pills,
    .d-flex.gap-1, .d-flex.gap-2, .d-flex.gap-3, .d-flex.gap-4 { flex-wrap: wrap; }
    /* Kopfzeilen (Titel links, Aktionen rechts): Aktionen rutschen unter den Titel. */
    .d-flex.justify-content-between { flex-wrap: wrap; row-gap: .5rem; }
    .btn-group:not(.btn-group-vertical) { flex-wrap: wrap; }
    .main-content pre { white-space: pre-wrap; overflow-wrap: anywhere; }
    .main-content img, .main-content video, .main-content iframe { max-width: 100%; }

    .table-responsive:has(> table.tabelle-karten) { overflow: visible; }
    table.tabelle-karten, table.tabelle-karten > tbody, table.tabelle-karten > tfoot,
    table.tabelle-karten > tbody > tr, table.tabelle-karten > tfoot > tr { display: block; width: 100%; }
    table.tabelle-karten > thead { display: none; }
    table.tabelle-karten > tbody > tr, table.tabelle-karten > tfoot > tr {
        border: 1px solid var(--bs-border-color); border-radius: .5rem;
        margin-bottom: .6rem; padding: .35rem .65rem; background: var(--bs-body-bg);
    }
    table.tabelle-karten > tbody > tr > td, table.tabelle-karten > tbody > tr > th,
    table.tabelle-karten > tfoot > tr > td, table.tabelle-karten > tfoot > tr > th {
        display: flex; flex-wrap: wrap; align-items: baseline; justify-content: flex-end; gap: .1rem .75rem;
        width: 100%; max-width: none !important; min-width: 0;
        border: 0; padding: .2rem 0; text-align: right; overflow-wrap: anywhere; white-space: normal;
        background: transparent; box-shadow: none;
    }
    table.tabelle-karten > tbody > tr > [data-label]:not([data-label=""])::before,
    table.tabelle-karten > tfoot > tr > [data-label]:not([data-label=""])::before {
        content: attr(data-label); font-weight: 600; color: var(--bs-secondary-color); text-align: left; margin-right: auto;
    }
    /* Ohne Beschriftung (Spalte ohne Überschrift, colspan): linksbündig über die ganze Breite. */
    table.tabelle-karten > tbody > tr > :not([data-label]), table.tabelle-karten > tbody > tr > [data-label=""] { justify-content: flex-start; text-align: left; }
    table.tabelle-karten > tbody > tr > :empty { display: none; }
    table.tabelle-karten .text-truncate, table.tabelle-karten .text-nowrap { white-space: normal !important; overflow: visible; text-overflow: clip; }
    /* Tageszeitleiste: die letzte Stundenmarke steht bei 100 % und ragte über den Rand. */
    .day-timeline-body .dt-hour:last-child span { display: none; }
}

/* ── Handbuch (/hilfe) ───────────────────────────────────────────────────── */
.hilfe-inhalt { max-width: 80ch; line-height: 1.6; }
.hilfe-inhalt h1 { font-size: 1.75rem; margin-bottom: 1rem; }
.hilfe-inhalt h2 { font-size: 1.35rem; margin-top: 2rem; padding-top: .5rem; border-top: 1px solid var(--bs-border-color); }
.hilfe-inhalt h3 { font-size: 1.1rem; margin-top: 1.5rem; }
.hilfe-inhalt h2, .hilfe-inhalt h3 { scroll-margin-top: 4.5rem; }
.hilfe-inhalt ul, .hilfe-inhalt ol { padding-left: 1.4rem; }
.hilfe-inhalt kbd { font-size: .8em; }
.hilfe-bild { margin: 1rem 0 1.5rem; }
.hilfe-bild img { max-width: 100%; height: auto; border: 1px solid var(--bs-border-color); border-radius: .5rem; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.hilfe-bild figcaption { font-size: .85rem; color: var(--bs-secondary-color); margin-top: .35rem; }
.hilfe-tabelle { font-size: .92rem; }
.hilfe-code { background: var(--bs-tertiary-bg); padding: .75rem 1rem; border-radius: .5rem; font-size: .85rem; overflow-x: auto; }
.hilfe-toc { background: var(--bs-tertiary-bg); border-radius: .5rem; padding: .75rem 1rem; margin-bottom: 1.25rem; }
@media (min-width: 768px) { .hilfe-toc ul { columns: 2; column-gap: 2rem; } .hilfe-toc li { break-inside: avoid; } }
.hilfe-navi a { display: block; padding: .2rem .5rem; border-radius: .35rem; text-decoration: none; }
.hilfe-navi a.aktiv { background: var(--bs-primary-bg-subtle); font-weight: 600; }
.hilfe-treffer mark { padding: 0 .1em; }
@media (min-width: 992px) { .hilfe-seitenleiste { position: sticky; top: 4.5rem; align-self: flex-start; } }

/* ========== Fokus-Modus (D3): Seitenleiste und Nebenpanels weg ========== */
body.fokus-modus #sidebar { display: none !important; }
body.fokus-modus #ticketNebenpanel { display: none !important; }
body.fokus-modus #ticketHaupt { flex: 0 0 100%; max-width: 100%; }
#fokusToggle.active { background: var(--bs-dark, #212529); color: #fff; }

/* ========== Ladebalken (P5): erscheint nach zwei Sekunden oben ========== */
#ahdsLadebalken {
    position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 3000;
    background: linear-gradient(90deg, #0d6efd, #6ea8fe);
    transform: scaleX(0); transform-origin: left; opacity: 0; transition: opacity .2s;
    pointer-events: none;
}
#ahdsLadebalken.an { opacity: 1; animation: ahds-laden 1.2s ease-in-out infinite; }
@keyframes ahds-laden {
    0%   { transform: scaleX(0); transform-origin: left; }
    50%  { transform: scaleX(1); transform-origin: left; }
    51%  { transform-origin: right; }
    100% { transform: scaleX(0); transform-origin: right; }
}

/* ========== Glossar (M6): Fachbegriffe mit Erklärung beim Überfahren ========== */
abbr.glossar { text-decoration: underline dotted; text-underline-offset: 2px; cursor: help; }
