.status-badge.status-deleted {
    background: #e2e8f0 !important;
    color: #64748b !important;
    border: 1px solid #64748b !important;
}
html.dark-mode .status-badge.status-deleted {
    background: #1e293b !important;
    color: #cbd5e1 !important;
    border-color: #64748b !important;
}
/* ===== MOBILE FIRST: Grundlegende Optimierungen ===== */
html {
    scroll-behavior: smooth;
}

body {
    -webkit-tap-highlight-color: rgba(0,0,0,0.05);
}

@media (max-width: 480px) {
    .container {
        padding: 0 4vw;
        max-width: 100vw;
    }
    .navbar {
        flex-direction: column;
        align-items: flex-start;
        padding: 8px 4vw;
        gap: 8px;
    }
    .navbar-brand {
        width: 100%;
        justify-content: flex-start;
    }
    .navbar-brand h1 {
        font-size: 18px;
        margin-bottom: 2px;
    }
    .navbar-logo {
        height: 44px;
    }
    .navbar-menu {
        flex-direction: column;
        width: 100%;
        gap: 8px;
        align-items: flex-start;
    }
    .btn, .btn-primary, .btn-logout {
        width: 100%;
        font-size: 16px;
        padding: 14px 0;
        margin-bottom: 8px;
        border-radius: 8px;
    }
    .form-control {
        font-size: 18px;
        padding: 14px 10px;
        border-radius: 8px;
    }
    .form-group label {
        font-size: 16px;
    }
    .alert {
        font-size: 15px;
        padding: 16px 10px;
    }
    .status-badge, .priority-badge, .group-badge, .group-tag, .admin-badge {
        font-size: 14px;
        padding: 6px 10px;
        border-radius: 6px !important;
    }
    .ticket-card-priority {
        font-size: 12px;
        padding: 4px 8px;
        border-radius: 6px;
    }
    .nav-user-btn {
        font-size: 16px;
        padding: 10px 14px;
        border-radius: 8px;
    }
    .nav-user-dropdown {
        min-width: 90vw;
        left: 0;
        right: 0;
        margin: 0 auto;
    }
    .nav-user-dropdown-item {
        font-size: 16px;
        padding: 14px 18px;
    }
    .nav-user-dropdown-logout {
        font-size: 16px;
    }
    .dashboard, .admin-content, .ticket-detail, .login-container, .home-page {
        padding: 0 2vw;
    }
    table, th, td {
        font-size: 14px;
    }
    .hidden-mobile {
        display: none !important;
    }
}

/* Touch-optimierte große Klickflächen für Buttons und Links */
a, button, .btn, .nav-link, .nav-user-btn, .nav-user-dropdown-item {
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

/* Hamburger-Menü für kleine Screens (optional, falls JS vorhanden) */
.navbar-toggle {
    display: none;
}
@media (max-width: 640px) {
    .navbar-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 28px;
        color: white;
        margin-left: auto;
        cursor: pointer;
    }
    .navbar-menu {
        display: none;
    }
    .navbar-menu.active {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 10px;
        background: #C1121C;
        border-radius: 0 0 12px 12px;
        margin-top: 8px;
        padding: 10px 0;
    }
}
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Navigation */
.navbar {
    background: linear-gradient(135deg, #C1121C 0%, #8B0A15 100%);
    color: white;
    padding: 15px 30px;
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: visible;
}

.navbar-logo {
    height: 56px;
    width: auto;
    margin-right: 12px;
    flex-shrink: 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
    color: inherit;
    text-decoration: none;
    min-width: 0;
    flex-shrink: 1;
}

.navbar-brand:hover {
    opacity: 0.95;
}

.navbar-brand h1 {
    font-size: 24px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.navbar-menu {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.nav-link {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.nav-link:hover {
    opacity: 0.8;
}

.nav-user {
    color: rgba(255, 255, 255, 0.8);
}

/* User dropdown menu in navbar */
.nav-user-menu {
    position: relative;
}

.nav-user-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s, border-color 0.2s;
}

.nav-user-btn:hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.65);
    color: #ffffff;
}

.nav-user-caret {
    opacity: 0.7;
    transition: transform 0.2s;
}

.nav-user-btn[aria-expanded="true"] .nav-user-caret {
    transform: rotate(180deg);
}

.nav-user-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 160px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.13);
    z-index: 200;
    overflow: hidden;
}

.nav-user-dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    color: #333;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.15s;
}

.nav-user-dropdown-item:hover {
    background: #f0f4ff;
    color: #1a237e;
}

.nav-user-dropdown-logout {
    border-top: 1px solid #eee;
    color: #c0392b;
}

.nav-user-dropdown-logout:hover {
    background: #fff0f0;
    color: #922b21;
}

/* Unified badge style: match Kanban board look across all pages */
.status-badge,
.priority-badge,
.group-badge,
.group-tag,
.admin-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px !important;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.ticket-card-priority {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 3px;
    line-height: 1;
}

.status-badge.status-open {
    background: #f4c2d7 !important;
    color: #6f1d1d !important;
}

.status-badge.status-in_progress {
    background: #b9d8f8 !important;
    color: #163a69 !important;
}

.status-badge.status-pending {
    background: #f6d7a8 !important;
    color: #6c3410 !important;
}

.status-badge.status-closed {
    background: #b9e3cc !important;
    color: #18503c !important;
}

.priority-badge.priority-low,
.ticket-card.priority-low .ticket-card-priority {
    background: #e9ecef !important;
    color: #495057 !important;
}

.priority-badge.priority-medium,
.ticket-card.priority-medium .ticket-card-priority {
    background: #e9ecef !important;
    color: #495057 !important;
}

.priority-badge.priority-high,
.ticket-card.priority-high .ticket-card-priority {
    background: #f8d7da !important;
    color: #721c24 !important;
}

.priority-badge.priority-critical,
.ticket-card.priority-critical .ticket-card-priority {
    background: #d93025 !important;
    color: #ffffff !important;
}

.group-tag,
.group-badge {
    background: #e7f1ff;
    color: #0c63e4;
}

.admin-badge {
    background: #fff3cd !important;
    color: #856404 !important;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: #C1121C;
    color: white;
}

.btn-primary:hover {
    background-color: #8B0A15;
}

.btn-logout {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-logout:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: #C1121C;
    box-shadow: 0 0 5px rgba(193, 18, 28, 0.3);
}

textarea.form-control {
    resize: vertical;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Alerts */
.alert {
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.alert-error, .alert-danger {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
}

.alert-info {
    background-color: #cfe2ff;
    color: #084298;
    border: 1px solid #b6d4fe;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: #999;
}

/* Utils */
.hidden {
    display: none;
}

.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

@media (max-width: 980px) {
    .container {
        padding: 0 10px;
    }

    .navbar {
        padding: 12px 14px;
        gap: 10px;
    }

    .navbar-brand h1 {
        font-size: 18px;
    }

    .navbar-logo {
        height: 80px;
    }

    .navbar-menu {
        justify-content: flex-end;
        gap: 12px;
    }
}

@media (max-width: 640px) {
    .navbar {
        padding: 10px 12px;
    }

    .navbar-brand h1 {
        font-size: 0;
    }

    .navbar-menu {
        justify-content: flex-end;
        gap: 10px;
    }

    .btn {
        padding: 9px 12px;
        font-size: 13px;
    }

    .form-control {
        font-size: 16px;
    }
}

/* ===== DARK MODE ===== */
html.dark-mode,
html.dark-mode body {
    background-color: #0f1117;
    color: #e2e8f0;
}

html.dark-mode .container {
    background-color: #0f1117;
}

/* Cards / panels */
html.dark-mode .card,
html.dark-mode .ticket-card,
html.dark-mode .modal-content,
html.dark-mode .form-card,
html.dark-mode .admin-panel,
html.dark-mode .ticket-detail,
html.dark-mode .ticket-header,
html.dark-mode .ticket-body,
html.dark-mode .ticket-sidebar,
html.dark-mode .comment-section,
html.dark-mode .comment,
html.dark-mode .attachment-section,
html.dark-mode .dashboard-column,
html.dark-mode .kanban-column,
html.dark-mode .filter-bar,
html.dark-mode .ticket-form,
html.dark-mode .admin-table-wrapper,
html.dark-mode .panel-section {
    background-color: #1e2330;
    border-color: #2d3448;
    color: #e2e8f0;
}

/* Navbar dropdown */
html.dark-mode .nav-user-dropdown {
    background: #1e2330;
    border-color: #2d3448;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

html.dark-mode .nav-user-dropdown-item {
    color: #cbd5e1;
}

html.dark-mode .nav-user-dropdown-item:hover {
    background: #2d3448;
    color: #e2e8f0;
}

html.dark-mode .nav-user-dropdown-logout {
    border-top-color: #2d3448;
    color: #f87171;
}

html.dark-mode .nav-user-dropdown-logout:hover {
    background: #3b1f1f;
    color: #fca5a5;
}

/* Forms */
html.dark-mode .form-control,
html.dark-mode select.form-control,
html.dark-mode textarea.form-control {
    background-color: #252b3b;
    border-color: #3d4560;
    color: #e2e8f0;
}

html.dark-mode .form-control:focus {
    border-color: #e05a60;
    box-shadow: 0 0 5px rgba(224, 90, 96, 0.4);
}

html.dark-mode .form-group label {
    color: #94a3b8;
}

/* Alerts */
html.dark-mode .alert-success {
    background-color: #14532d;
    color: #86efac;
    border-color: #166534;
}

html.dark-mode .alert-error,
html.dark-mode .alert-danger {
    background-color: #450a0a;
    color: #fca5a5;
    border-color: #7f1d1d;
}

html.dark-mode .alert-warning {
    background-color: #431407;
    color: #fdba74;
    border-color: #7c2d12;
}

html.dark-mode .alert-info {
    background-color: #0c1e3f;
    color: #93c5fd;
    border-color: #1e3a5f;
}

/* Tables */
html.dark-mode table,
html.dark-mode .admin-table {
    color: #e2e8f0;
}

html.dark-mode th {
    background-color: #252b3b;
    color: #94a3b8;
    border-color: #2d3448;
}

html.dark-mode td {
    border-color: #2d3448;
}

html.dark-mode tr:hover td {
    background-color: #252b3b;
}

/* Links */
html.dark-mode a:not(.btn):not(.nav-link):not(.navbar-brand):not(.nav-user-dropdown-item) {
    color: #7dd3fc;
}

/* Buttons - secondary/outline variants */
html.dark-mode .btn-secondary,
html.dark-mode .btn-outline {
    background-color: #2d3448;
    color: #e2e8f0;
    border-color: #3d4560;
}

html.dark-mode .btn-secondary:hover,
html.dark-mode .btn-outline:hover {
    background-color: #3d4560;
}

/* Headings and text */
html.dark-mode h1, html.dark-mode h2, html.dark-mode h3,
html.dark-mode h4, html.dark-mode h5, html.dark-mode h6 {
    color: #f1f5f9;
}

html.dark-mode p, html.dark-mode span, html.dark-mode li {
    color: #cbd5e1;
}

/* Kanban column headers keep their pastel gradient but slightly dimmed */
html.dark-mode .kanban-column-header,
html.dark-mode .column-header {
    filter: brightness(0.75) saturate(0.8);
}

/* Scrollbars */
html.dark-mode ::-webkit-scrollbar {
    background: #1e2330;
}
html.dark-mode ::-webkit-scrollbar-thumb {
    background: #3d4560;
    border-radius: 4px;
}

/* Modal overlay */
html.dark-mode .modal-overlay,
html.dark-mode .modal-backdrop {
    background: rgba(0,0,0,0.65);
}

/* Strong fallback overrides for template-local light styles */
html.dark-mode body,
html.dark-mode .dashboard,
html.dark-mode .admin-container,
html.dark-mode .admin-content,
html.dark-mode .ticket-detail,
html.dark-mode .login-container,
html.dark-mode .home-page,
html.dark-mode .test-page,
html.dark-mode .not-found-page {
    background: #0f1117 !important;
    color: #e2e8f0 !important;
}

html.dark-mode .home-card,
html.dark-mode .login-box,
html.dark-mode .admin-sidebar,
html.dark-mode .admin-section,
html.dark-mode .stat-card,
html.dark-mode .ticket-header,
html.dark-mode .ticket-info,
html.dark-mode .info-section,
html.dark-mode .comments-section,
html.dark-mode .add-comment,
html.dark-mode .modal-content,
html.dark-mode .kanban-column,
html.dark-mode .ticket-card {
    background: #1a2130 !important;
    border-color: #2f3a50 !important;
    color: #e2e8f0 !important;
}

html.dark-mode .kanban-column-content,
html.dark-mode .kanban-column-empty,
html.dark-mode .attachments-list,
html.dark-mode .attachment-item,
html.dark-mode .comment-item,
html.dark-mode .filters,
html.dark-mode .search-box {
    background: #141b28 !important;
    border-color: #2a3448 !important;
    color: #dbe5f2 !important;
}

html.dark-mode .admin-table,
html.dark-mode .admin-table thead,
html.dark-mode .admin-table tbody,
html.dark-mode .admin-table tr,
html.dark-mode .admin-table th,
html.dark-mode .admin-table td,
html.dark-mode .admin-table-wrapper table,
html.dark-mode .admin-table-wrapper thead,
html.dark-mode .admin-table-wrapper th,
html.dark-mode .admin-table-wrapper td {
    background: #1a2130 !important;
    color: #dbe5f2 !important;
    border-color: #2f3a50 !important;
}

html.dark-mode .admin-table tbody tr:hover,
html.dark-mode .admin-table tbody tr:hover td,
html.dark-mode .ticket-card:hover {
    background: #243047 !important;
}

html.dark-mode .ticket-card-title,
html.dark-mode .ticket-card-meta,
html.dark-mode .ticket-card-creator,
html.dark-mode .ticket-card-date,
html.dark-mode .ticket-card-group,
html.dark-mode .section-header,
html.dark-mode .info-row,
html.dark-mode .comment-author,
html.dark-mode .comment-content,
html.dark-mode .attachment-link,
html.dark-mode .home-content,
html.dark-mode .home-option,
html.dark-mode .admin-nav-link,
html.dark-mode .login-info,
html.dark-mode .muted,
html.dark-mode small {
    color: #cbd5e1 !important;
}

html.dark-mode .ticket-id,
html.dark-mode .ticket-number,
html.dark-mode .stat-number,
html.dark-mode .nav-link,
html.dark-mode .navbar-brand,
html.dark-mode .btn,
html.dark-mode .btn-primary {
    color: #f8fafc;
}

html.dark-mode .admin-nav-link:hover,
html.dark-mode .admin-nav-link.active {
    background: #334155 !important;
    color: #f8fafc !important;
}

html.dark-mode .form-control,
html.dark-mode input.form-control,
html.dark-mode select.form-control,
html.dark-mode textarea.form-control,
html.dark-mode input,
html.dark-mode select,
html.dark-mode textarea {
    background: #111827 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

html.dark-mode input::placeholder,
html.dark-mode textarea::placeholder {
    color: #94a3b8 !important;
}

html.dark-mode .close {
    color: #cbd5e1 !important;
}

html.dark-mode .close:hover {
    color: #ffffff !important;
}

/* Board headers: keep pastel identity but readable in dark mode */
html.dark-mode .kanban-column-header,
html.dark-mode .kanban-column-header.open,
html.dark-mode .kanban-column-header.in_progress,
html.dark-mode .kanban-column-header.pending,
html.dark-mode .kanban-column-header.closed {
    color: #0f172a !important;
    border-color: rgba(15, 23, 42, 0.2) !important;
    filter: brightness(0.92) saturate(0.95);
}

html.dark-mode .kanban-column-title,
html.dark-mode .kanban-column-count,
html.dark-mode .kanban-column-toggle {
    color: #0f172a !important;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

html.dark-mode .kanban-column.collapsed .kanban-column-header {
    border-radius: 12px;
}

/* Badge system: explicit dark-mode palette for contrast */
html.dark-mode .status-badge,
html.dark-mode .priority-badge,
html.dark-mode .group-badge,
html.dark-mode .ticket-card-priority {
    border: 1px solid transparent;
    font-weight: 700;
}

html.dark-mode .status-badge.status-open {
    background: #3a2f00 !important;
    color: #fde68a !important;
    border-color: #b45309 !important;
}

html.dark-mode .status-badge.status-in_progress {
    background: #0b2f4a !important;
    color: #93c5fd !important;
    border-color: #2563eb !important;
}

html.dark-mode .status-badge.status-pending {
    background: #3a2f00 !important;
    color: #fcd34d !important;
    border-color: #d97706 !important;
}

html.dark-mode .status-badge.status-closed {
    background: #0f3a2a !important;
    color: #86efac !important;
    border-color: #15803d !important;
}

html.dark-mode .priority-badge.priority-low {
    background: #0f2f4a !important;
    color: #93c5fd !important;
    border-color: #2563eb !important;
}

html.dark-mode .priority-badge.priority-medium {
    background: #3a2f00 !important;
    color: #fde68a !important;
    border-color: #ca8a04 !important;
}

html.dark-mode .priority-badge.priority-high {
    background: #3f1d1d !important;
    color: #fca5a5 !important;
    border-color: #dc2626 !important;
}

html.dark-mode .priority-badge.priority-critical {
    background: #7f1d1d !important;
    color: #fee2e2 !important;
    border-color: #ef4444 !important;
}

html.dark-mode .group-badge {
    background: #27364b;
    color: #cbd5e1;
    border-color: #3b4f6a;
}

/* Dashboard card priority chips in dark mode */
html.dark-mode .ticket-card.priority-low .ticket-card-priority {
    background: #0f2f4a !important;
    color: #93c5fd !important;
    border-color: #2563eb !important;
}

html.dark-mode .ticket-card.priority-medium .ticket-card-priority {
    background: #3a2f00 !important;
    color: #fde68a !important;
    border-color: #ca8a04 !important;
}

html.dark-mode .ticket-card.priority-high .ticket-card-priority {
    background: #3f1d1d !important;
    color: #fca5a5 !important;
    border-color: #dc2626 !important;
}

html.dark-mode .ticket-card.priority-critical .ticket-card-priority {
    background: #7f1d1d !important;
    color: #fee2e2 !important;
    border-color: #ef4444 !important;
}

/* Admin users badges */
html.dark-mode .admin-content .user-groups .group-tag {
    background: #0f2f4a;
    color: #bfdbfe;
    border: 1px solid #1d4ed8;
}

html.dark-mode .admin-badge {
    background: #3a2f00 !important;
    color: #fde68a !important;
    border: 1px solid #d97706 !important;
}

html.dark-mode .user-groups span[style*="color: #999"] {
    color: #94a3b8 !important;
}

/* Keep dashboard cards neutral in dark mode; only chip/border should indicate priority */
html.dark-mode .ticket-card.priority-low,
html.dark-mode .ticket-card.priority-medium,
html.dark-mode .ticket-card.priority-high,
html.dark-mode .ticket-card.priority-critical {
    background: #1a2130 !important;
    color: #e2e8f0 !important;
}

/* Ticket detail description readability */
html.dark-mode .description-view {
    background: #111827 !important;
    border-color: #334155 !important;
}

html.dark-mode .description-view p {
    color: #e2e8f0 !important;
}

html.dark-mode .description-edit textarea {
    background: #111827 !important;
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}
