/* ============================================================
   Aktensystem v2.0 – Custom Stylesheet
   Dark Mode, Sidebar-Layout, responsive Design
   ============================================================ */

/* ------------------------------------------------------------
   CSS Custom Properties (Light Mode)
   ------------------------------------------------------------ */
:root {
    --bg-primary:    #ffffff;
    --bg-secondary:  #f1f5f9;
    --bg-card:       #ffffff;
    --bg-hover:      #f8fafc;
    --text-primary:  #1e293b;
    --text-muted:    #64748b;
    --border-color:  #e2e8f0;
    --sidebar-bg:    #0f172a;
    --sidebar-hover: #1e293b;
    --sidebar-text:  #94a3b8;
    --sidebar-active-text: #ffffff;
    --sidebar-active-bg:   rgba(59,130,246,.15);
    --topbar-bg:     #ffffff;
    --primary:       #2563eb;
    --primary-hover: #1d4ed8;
    --success:       #16a34a;
    --danger:        #dc2626;
    --warning:       #d97706;
    --info:          #0284c7;
    --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg:     0 10px 25px rgba(0,0,0,.1);
    --border-radius: 8px;
    --border-radius-lg: 12px;
    --sidebar-width: 260px;
    --topbar-height: 60px;
    --transition:    all .2s ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --bg-primary:   #0f172a;
    --bg-secondary: #0f172a;
    --bg-card:      #1e293b;
    --bg-hover:     #334155;
    --text-primary: #e2e8f0;
    --text-muted:   #b0bec5;     /* Heller als im Light-Mode für bessere Lesbarkeit */
    --border-color: #334155;
    --topbar-bg:    #1e293b;
    --shadow:       0 1px 3px rgba(0,0,0,.3);
    --shadow-lg:    0 10px 25px rgba(0,0,0,.4);
}

/* ------------------------------------------------------------
   Reset & Base
   ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }

html { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    font-size: 0.9rem;
    line-height: 1.6;
    background: var(--bg-secondary);
    color: var(--text-primary);
    margin: 0;
    min-height: 100vh;
}

/* Smooth transition für Dark Mode */
body, .card, .topbar, .sidebar, .form-control, .form-select, .btn, table { transition: background-color .2s, border-color .2s, color .2s; }

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

/* ------------------------------------------------------------
   SIDEBAR
   ------------------------------------------------------------ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform .3s ease;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: var(--topbar-height);
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
    color: #ffffff;
    font-weight: 700;
    font-size: 1.05rem;
}

.brand-icon { font-size: 1.3rem; }
.brand-name { color: #ffffff; }

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    border-radius: var(--border-radius);
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #e2e8f0;
}

.nav-item.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    border-left: 3px solid var(--primary);
}

.nav-item i { font-size: 1rem; flex-shrink: 0; }

.nav-badge {
    margin-left: auto;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    min-width: 18px;
    text-align: center;
}

.nav-badge-danger { background: var(--danger); }

.sidebar-toggle-btn {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

/* Sidebar Footer */
.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 0.875rem 1rem;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    padding: 0.5rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.sidebar-user:hover { background: var(--sidebar-hover); }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-name { font-size: 0.825rem; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: var(--sidebar-text); }

/* Overlay für Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 999;
}

/* ------------------------------------------------------------
   MAIN CONTENT
   ------------------------------------------------------------ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}

/* ------------------------------------------------------------
   TOPBAR
   ------------------------------------------------------------ */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow);
}

.topbar-left { display: flex; align-items: center; gap: 1rem; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 0.5rem; }

.btn-hamburger {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-primary);
    padding: 6px;
    border-radius: var(--border-radius);
    display: none;
    transition: var(--transition);
}

.btn-hamburger:hover { background: var(--bg-hover); }

/* Suche */
.search-container { position: relative; flex: 1; max-width: 420px; }

.search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 0.45rem 0.75rem 0.45rem 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: var(--transition);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.search-input::placeholder { color: var(--text-muted); }

.search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    max-height: 350px;
    overflow-y: auto;
    display: none;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.search-result-item:hover { background: var(--bg-hover); }
.search-result-item:last-child { border-bottom: none; }

/* Topbar Buttons */
.topbar-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    transition: var(--transition);
    position: relative;
}

.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.topbar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

/* Notifications Badge */
.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
}

/* Dropdown Panels */
.notification-wrapper,
.user-dropdown-wrapper { position: relative; }

.notification-dropdown,
.user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    display: none;
    min-width: 320px;
}

.notification-dropdown.show, .user-dropdown.show { display: block; }

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.875rem;
}

.mark-all-read { font-size: 0.78rem; color: var(--primary); text-decoration: none; }

.notif-list { max-height: 300px; overflow-y: auto; }

.notif-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.notif-item:hover { background: var(--bg-hover); }
.notif-item:last-child { border-bottom: none; }
.notif-item-unread { background: rgba(37,99,235,.04); }

.notif-empty { padding: 1.5rem; text-align: center; color: var(--text-muted); font-size: 0.875rem; }

.notif-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.notif-footer a { color: var(--primary); text-decoration: none; font-size: 0.875rem; }

.user-dropdown { min-width: 220px; padding: 0.5rem 0; }

.dropdown-user-info {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
}

.dropdown-user-info strong { font-size: 0.9rem; }
.dropdown-user-info span { font-size: 0.78rem; color: var(--text-muted); }

.dropdown-item-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
}

.dropdown-item-link:hover { background: var(--bg-hover); }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 0.25rem 0; }

/* ------------------------------------------------------------
   PAGE CONTENT
   ------------------------------------------------------------ */
.page-content {
    flex: 1;
    padding: 1.5rem 2rem;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin: 0.25rem 0 0;
}

.page-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }

/* ------------------------------------------------------------
   CARDS
   ------------------------------------------------------------ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.card-title { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); margin: 0; }
.card-action { font-size: 0.8rem; color: var(--primary); text-decoration: none; }
.card-body { padding: 1.25rem; }

/* Dashboard Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon-blue   { background: rgba(37,99,235,.12); color: var(--primary); }
.stat-icon-red    { background: rgba(220,38,38,.12);  color: var(--danger);  }
.stat-icon-orange { background: rgba(217,119,6,.12);  color: var(--warning); }
.stat-icon-green  { background: rgba(22,163,74,.12);  color: var(--success); }

.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.stat-meta  { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

.stat-card-sm {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
}

.stat-value-sm { font-size: 1.5rem; font-weight: 700; }

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------
   TABLES
   ------------------------------------------------------------ */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.875rem;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }

/* ------------------------------------------------------------
   BADGES
   ------------------------------------------------------------ */
.badge-status-open   { background: rgba(37,99,235,.12);  color: #1d4ed8; font-size: .72rem; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.badge-status-active { background: rgba(217,119,6,.12);  color: #92400e; font-size: .72rem; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.badge-status-done   { background: rgba(22,163,74,.12);  color: #14532d; font-size: .72rem; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.badge-status-arch   { background: rgba(100,116,139,.12); color: #475569; font-size: .72rem; padding: 3px 8px; border-radius: 20px; font-weight: 600; }

.badge-prio-low      { background: rgba(100,116,139,.12); color: #475569; font-size: .72rem; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.badge-prio-normal   { background: rgba(37,99,235,.12);  color: #1d4ed8; font-size: .72rem; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.badge-prio-high     { background: rgba(217,119,6,.12);  color: #92400e; font-size: .72rem; padding: 3px 8px; border-radius: 20px; font-weight: 600; }
.badge-prio-critical { background: rgba(220,38,38,.12);  color: #991b1b; font-size: .72rem; padding: 3px 8px; border-radius: 20px; font-weight: 600; }

/* ------------------------------------------------------------
   FORMS (Override Bootstrap)
   ------------------------------------------------------------ */
.form-control,
.form-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--border-radius);
}

.form-control:focus,
.form-select:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.form-control::placeholder { color: var(--text-muted); }
.form-label { font-weight: 500; font-size: 0.875rem; color: var(--text-primary); margin-bottom: 0.375rem; }
.form-text { color: var(--text-muted); font-size: 0.78rem; }
.input-group-text { background: var(--bg-secondary); border-color: var(--border-color); color: var(--text-muted); }

/* Bootstrap Alert Override */
.alert { border-radius: var(--border-radius); font-size: 0.875rem; }
.alert-icon { font-weight: 700; }

/* Bootstrap Tabs Override */
.nav-tabs { border-color: var(--border-color); }
.nav-tabs .nav-link { color: var(--text-muted); border: none; padding: 0.625rem 1rem; font-size: 0.875rem; font-weight: 500; }
.nav-tabs .nav-link:hover { color: var(--text-primary); border: none; }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom: 2px solid var(--primary); background: none; font-weight: 600; }

/* Bootstrap Table Override */
[data-theme="dark"] .table { color: var(--text-primary); }
[data-theme="dark"] .table-danger { background: rgba(220,38,38,.15); }
[data-theme="dark"] .table-warning { background: rgba(217,119,6,.15); }

/* Pagination */
.page-link { background: var(--bg-card); border-color: var(--border-color); color: var(--text-primary); }
.page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.page-link:hover { background: var(--bg-hover); color: var(--primary); }

/* ------------------------------------------------------------
   DASHBOARD COMPONENTS
   ------------------------------------------------------------ */

/* Task List */
.task-list { display: flex; flex-direction: column; }

.task-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.task-item:hover { background: var(--bg-hover); }
.task-item:last-child { border-bottom: none; }
.task-item.task-overdue { background: rgba(220,38,38,.04); }
.task-item.task-today   { background: rgba(217,119,6,.04); }

.task-check { flex-shrink: 0; padding-top: 2px; }

.btn-complete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0;
    transition: var(--transition);
}

.btn-complete:hover { color: var(--success); }

.task-title { font-size: 0.875rem; font-weight: 500; line-height: 1.4; }
.task-case-ref { font-size: 0.75rem; background: var(--bg-secondary); padding: 1px 6px; border-radius: 4px; margin-left: 6px; color: var(--text-muted); text-decoration: none; }
.task-meta { display: flex; align-items: center; margin-top: 3px; flex-wrap: wrap; gap: 4px; }

/* Activity Feed */
.activity-feed { padding: 0.5rem 0; }

.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
}

.activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-text { font-size: 0.85rem; line-height: 1.4; }
.activity-user { font-weight: 600; }
.activity-link { color: var(--primary); text-decoration: none; }
.activity-time { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ------------------------------------------------------------
   MAIL LIST
   ------------------------------------------------------------ */
.mail-list { display: flex; flex-direction: column; }

.mail-item {
    display: grid;
    grid-template-columns: 30px 180px 1fr 120px 120px;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.mail-item:hover { background: var(--bg-hover); }
.mail-item:last-child { border-bottom: none; }
.mail-unread { background: rgba(37,99,235,.03); }
.mail-unread .mail-subject { font-weight: 600; }

/* ------------------------------------------------------------
   TIMELINE
   ------------------------------------------------------------ */
.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
    display: flex;
    gap: 1rem;
    padding: 0.875rem 0;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 20px;
    top: 50px;
    bottom: 0;
    width: 1px;
    background: var(--border-color);
}

.timeline-item:last-child::before { display: none; }

.timeline-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    flex-shrink: 0;
    font-size: 0.875rem;
    z-index: 1;
}

.timeline-body { flex: 1; }
.timeline-title { font-size: 0.875rem; font-weight: 500; }
.timeline-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.timeline-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* ------------------------------------------------------------
   NOTES
   ------------------------------------------------------------ */
.note-card {
    background: var(--bg-secondary);
    border-left: 3px solid var(--primary);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
}

.note-meta { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 4px; }
.note-content { font-size: 0.875rem; line-height: 1.6; }

/* ------------------------------------------------------------
   META LIST (Detail-Ansicht)
   ------------------------------------------------------------ */
.meta-list { display: grid; grid-template-columns: auto 1fr; gap: 0.375rem 1rem; font-size: 0.875rem; }
.meta-list dt { color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.meta-list dd { margin: 0; color: var(--text-primary); }

/* ------------------------------------------------------------
   UPLOAD DROPZONE
   ------------------------------------------------------------ */
.upload-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.upload-dropzone:hover, .upload-dropzone.dragging {
    border-color: var(--primary);
    background: rgba(37,99,235,.04);
}

.upload-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.upload-label { pointer-events: none; }
.upload-label p { font-size: 0.875rem; margin: 0; }

/* ------------------------------------------------------------
   AI Result Box
   ------------------------------------------------------------ */
.ai-result-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    min-height: 200px;
    font-size: 0.875rem;
    line-height: 1.7;
}

.ai-text { white-space: pre-wrap; }

/* ------------------------------------------------------------
   NOTIFICATION PAGE
   ------------------------------------------------------------ */
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.notification-item:hover { background: var(--bg-hover); }
.notification-item:last-child { border-bottom: none; }
.notif-unread { background: rgba(37,99,235,.04); }
.notif-icon { color: var(--primary); font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }
.notif-title { font-size: 0.875rem; line-height: 1.4; }
.notif-message { margin-top: 2px; }
.notif-time { margin-top: 4px; }
.notif-actions { display: flex; flex-shrink: 0; }

/* ------------------------------------------------------------
   USER AVATARS
   ------------------------------------------------------------ */
.user-avatar-sm {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.user-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
}

/* ------------------------------------------------------------
   EMPTY STATE
   ------------------------------------------------------------ */
.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-state i { display: block; margin: 0 auto 0.75rem; }

/* ------------------------------------------------------------
   RESPONSIVE
   ------------------------------------------------------------ */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
    .btn-hamburger { display: flex; }
    .page-content { padding: 1rem; }
    .mail-item { grid-template-columns: 30px 1fr 100px; }
    .mail-from, .mail-status { display: none; }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
    .search-container { display: none; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Bootstrap 5 CSS-Variablen im Dark Mode überschreiben
   Bootstrap erkennt data-theme="dark" nicht – wir müssen
   Bootstrap's eigene Variablen manuell setzen.
   ============================================================ */
[data-theme="dark"] {
    color-scheme: dark;

    /* Bootstrap Body-Variablen überschreiben */
    --bs-body-color:          #e2e8f0;
    --bs-body-bg:             #0f172a;
    --bs-secondary-color:     #94a3b8;  /* .text-muted / .form-text */
    --bs-tertiary-color:      #64748b;
    --bs-border-color:        #334155;
    --bs-secondary-bg:        #1e293b;
    --bs-tertiary-bg:         #0f172a;
    --bs-emphasis-color:      #f1f5f9;
    --bs-link-color:          #60a5fa;
    --bs-link-hover-color:    #93c5fd;

    /* Bootstrap Form-Variablen */
    --bs-form-control-bg:               #1e293b;
    --bs-form-control-disabled-bg:      #0f172a;
    --bs-form-control-border-color:     #334155;
    --bs-form-select-bg-img:            url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");

    /* Bootstrap Input-Group */
    --bs-input-group-addon-bg:          #334155;
    --bs-input-group-addon-color:       #94a3b8;
    --bs-input-group-addon-border-color:#475569;

    /* Bootstrap Card */
    --bs-card-bg:             #1e293b;
    --bs-card-border-color:   #334155;
    --bs-card-cap-bg:         rgba(255,255,255,.04);

    /* Bootstrap Table */
    --bs-table-bg:            transparent;
    --bs-table-striped-bg:    rgba(255,255,255,.025);
    --bs-table-hover-bg:      rgba(255,255,255,.04);
    --bs-table-border-color:  #334155;

    /* Bootstrap Nav */
    --bs-nav-tabs-border-color:         #334155;
    --bs-nav-tabs-link-hover-border-color: #334155;
    --bs-nav-tabs-link-active-bg:       transparent;
    --bs-nav-tabs-link-active-border-color: transparent transparent var(--primary);

    /* Bootstrap Pagination */
    --bs-pagination-bg:               #1e293b;
    --bs-pagination-border-color:     #334155;
    --bs-pagination-color:            #e2e8f0;
    --bs-pagination-hover-bg:         #334155;
    --bs-pagination-hover-border-color: #475569;
    --bs-pagination-hover-color:      #e2e8f0;
    --bs-pagination-active-bg:        var(--primary);
    --bs-pagination-active-border-color: var(--primary);
    --bs-pagination-disabled-bg:      #1e293b;
    --bs-pagination-disabled-border-color: #334155;
    --bs-pagination-disabled-color:   #475569;
}

[data-theme="dark"] .btn-outline-primary {
    color: #60a5fa;
    border-color: #3b82f6;
}

[data-theme="dark"] .btn-outline-primary:hover {
    background: #3b82f6;
    color: white;
}

[data-theme="dark"] .btn-outline-secondary {
    color: #94a3b8;
    border-color: #475569;
}

[data-theme="dark"] .btn-close {
    filter: invert(1);
}

[data-theme="dark"] .alert-info {
    background: rgba(2,132,199,.15);
    border-color: rgba(2,132,199,.3);
    color: #7dd3fc;
}

[data-theme="dark"] .alert-warning {
    background: rgba(217,119,6,.15);
    border-color: rgba(217,119,6,.3);
    color: #fde68a;
}

[data-theme="dark"] .alert-danger {
    background: rgba(220,38,38,.15);
    border-color: rgba(220,38,38,.3);
    color: #fca5a5;
}

[data-theme="dark"] .alert-success {
    background: rgba(22,163,74,.15);
    border-color: rgba(22,163,74,.3);
    color: #86efac;
}

[data-theme="dark"] code {
    color: #93c5fd;
    background: rgba(147,197,253,.1);
    padding: 1px 5px;
    border-radius: 4px;
}

/* ============================================================
   DARK MODE – Vollständige Textfarben-Korrekturen
   ============================================================ */

/* Alle Eingabefelder: Textfarbe + Hintergrund */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="url"],
[data-theme="dark"] input[type="search"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    color: var(--text-primary) !important;
    background-color: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] select:focus {
    color: var(--text-primary) !important;
    background-color: var(--bg-card) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(59,130,246,.15) !important;
}

/* Placeholder-Text: sichtbar aber gedämpft */
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #64748b !important;
    opacity: 1;
}

/* Read-only & disabled Felder */
[data-theme="dark"] input[readonly],
[data-theme="dark"] input:disabled,
[data-theme="dark"] textarea[readonly],
[data-theme="dark"] textarea:disabled {
    background-color: rgba(255,255,255,.04) !important;
    color: #94a3b8 !important;
}

/* Bootstrap .text-muted – im Dark Mode aufhellen */
[data-theme="dark"] .text-muted,
[data-theme="dark"] .form-text,
[data-theme="dark"] .hint {
    color: #94a3b8 !important;
}

/* Bootstrap small-Tags und sub-Texte */
[data-theme="dark"] small,
[data-theme="dark"] .small {
    color: #94a3b8;
}

/* Größere Leseschilder / Beschreibungen */
[data-theme="dark"] .page-subtitle,
[data-theme="dark"] .subtitle,
[data-theme="dark"] .card-action,
[data-theme="dark"] .activity-time,
[data-theme="dark"] .timeline-meta,
[data-theme="dark"] .note-meta,
[data-theme="dark"] .task-meta,
[data-theme="dark"] .notif-time {
    color: #94a3b8 !important;
}

/* input-group-text (Icons neben Inputs) */
[data-theme="dark"] .input-group-text {
    background-color: #334155 !important;
    border-color: var(--border-color) !important;
    color: #94a3b8 !important;
}

/* Dropzone Upload-Bereich */
[data-theme="dark"] .upload-dropzone {
    border-color: var(--border-color);
    background: rgba(255,255,255,.02);
    color: var(--text-primary);
}
[data-theme="dark"] .upload-dropzone:hover,
[data-theme="dark"] .upload-dropzone.dragging {
    border-color: var(--primary);
    background: rgba(59,130,246,.06);
}
[data-theme="dark"] .upload-label p {
    color: #94a3b8;
}

/* Bootstrap Form-Check Labels */
[data-theme="dark"] .form-check-label {
    color: var(--text-primary);
}
[data-theme="dark"] .form-check-input {
    background-color: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

/* Bootstrap Select Options */
[data-theme="dark"] select option {
    background-color: #1e293b;
    color: #e2e8f0;
}

/* Tabellen-Header im Dark Mode */
[data-theme="dark"] .data-table th {
    background: #0f172a;
    color: #94a3b8;
    border-bottom-color: var(--border-color);
}
[data-theme="dark"] .data-table td {
    border-bottom-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .data-table tr:hover td {
    background: rgba(255,255,255,.04);
}

/* Pagination */
[data-theme="dark"] .page-link {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}
[data-theme="dark"] .page-link:hover {
    background-color: var(--bg-hover);
    color: var(--primary);
}
[data-theme="dark"] .page-item.disabled .page-link {
    background-color: var(--bg-card);
    border-color: var(--border-color);
    color: #475569;
}

/* Bootstrap Nav-Tabs */
[data-theme="dark"] .nav-tabs {
    border-color: var(--border-color);
}
[data-theme="dark"] .nav-tabs .nav-link {
    color: #94a3b8;
}
[data-theme="dark"] .nav-tabs .nav-link:hover {
    color: var(--text-primary);
    border-color: transparent;
}
[data-theme="dark"] .nav-tabs .nav-link.active {
    background: transparent;
    border-color: transparent;
    border-bottom-color: var(--primary);
    color: var(--primary);
}

/* Bootstrap Labels */
[data-theme="dark"] label,
[data-theme="dark"] .form-label {
    color: var(--text-primary);
}

/* Dropdown-Item Links im User-Dropdown */
[data-theme="dark"] .dropdown-item-link {
    color: var(--text-primary);
}
[data-theme="dark"] .dropdown-item-link:hover {
    background: var(--bg-hover);
}
[data-theme="dark"] .dropdown-user-info strong {
    color: var(--text-primary);
}
[data-theme="dark"] .dropdown-user-info span {
    color: #94a3b8;
}
[data-theme="dark"] .dropdown-divider {
    background: var(--border-color);
}

/* Suche */
[data-theme="dark"] .search-input {
    background: rgba(255,255,255,.06);
    color: var(--text-primary);
    border-color: var(--border-color);
}
[data-theme="dark"] .search-input:focus {
    background: var(--bg-card);
}
[data-theme="dark"] .search-result-item {
    color: var(--text-primary);
    border-bottom-color: var(--border-color);
}
[data-theme="dark"] .search-result-item:hover {
    background: var(--bg-hover);
}

/* KI-Ergebnis-Box */
[data-theme="dark"] .ai-result-box {
    background: rgba(255,255,255,.03);
    border-color: var(--border-color);
    color: var(--text-primary);
}

/* Meta-Liste (Fall-Detail-Seite) */
[data-theme="dark"] .meta-list dt {
    color: #94a3b8;
}
[data-theme="dark"] .meta-list dd {
    color: var(--text-primary);
}

/* Stat-Cards */
[data-theme="dark"] .stat-card,
[data-theme="dark"] .stat-card-sm {
    background: var(--bg-card);
    border-color: var(--border-color);
}
[data-theme="dark"] .stat-label,
[data-theme="dark"] .stat-meta {
    color: #94a3b8 !important;
}

/* Notizen */
[data-theme="dark"] .note-card {
    background: rgba(255,255,255,.04);
    border-left-color: var(--primary);
}
[data-theme="dark"] .note-content {
    color: var(--text-primary);
}

/* Bootstrap badge defaults */
[data-theme="dark"] .badge.bg-light {
    background: #334155 !important;
    color: #e2e8f0 !important;
}
[data-theme="dark"] .badge.bg-secondary {
    background: #475569 !important;
}

/* Bootstrap modal (falls verwendet) */
[data-theme="dark"] .modal-content {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-footer {
    border-color: var(--border-color);
}

/* Breadcrumbs / Pfade */
[data-theme="dark"] .breadcrumb-item,
[data-theme="dark"] .breadcrumb-item a {
    color: #94a3b8;
}
[data-theme="dark"] .breadcrumb-item.active {
    color: var(--text-primary);
}

/* Bootstrap hr */
[data-theme="dark"] hr {
    border-color: var(--border-color);
    opacity: 1;
}

