/* 
  Tupiano Support System CSS
  Premium, modern design with glassmorphism and smooth animations.
*/

:root {
    /* Colors - Dark Mode Base */
    --bg-dark: #22201d;
    --bg-darker: #1a1816;
    --surface-light: rgba(43, 40, 36, 0.7);
    --surface-border: rgba(255, 255, 255, 0.08);
    --surface-hover: rgba(58, 55, 50, 0.6);
    
    /* Branding */
    --primary: #d97706;
    --primary-hover: #b45309;
    --primary-rgb: 217, 119, 6;
    --secondary: #334155;
    --secondary-hover: #475569;
    
    /* Status Colors */
    --color-open: #94a3b8;
    --color-inprogress: #f59e0b;
    --color-done: #10b981;
    --color-billed: #059669; /* Darker green */
    --billed-rgb: 5, 150, 105;
    --billed-text: #a7f3d0;
    
    --color-purple: #8b5cf6;
    --purple-rgb: 139, 92, 246;
    --purple-text: #ddd6fe;
    
    /* Typography */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Structural */
    --sidebar-width: 260px;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Light Mode Theme */
body.light-mode {
    --bg-dark: #f8fafc;
    --bg-darker: #f1f5f9;
    --surface-light: rgba(255, 255, 255, 0.9);
    --surface-border: rgba(0, 0, 0, 0.1);
    --surface-hover: rgba(241, 245, 249, 0.8);
    
    --text-main: #1e293b;
    --text-muted: #64748b;
    
    --primary: #1e293b; /* Matched to dark slate tone of the sidebar buttons */
    --primary-hover: #0f172a;
    --primary-rgb: 51, 65, 85;
    --color-billed: #166534; /* Darker green for light mode */
    --billed-rgb: 5, 150, 105;
    --billed-text: #6ee7b7;
    
    --color-purple: #7c3aed;
    --purple-rgb: 124, 58, 237;
    --purple-text: #c4b5fd;
    
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(var(--primary-rgb), 0.05), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(var(--billed-rgb), 0.05), transparent 25%);
}

body.light-mode .modern-input {
    background-color: #ffffff;
    color: var(--text-main);
    border: 1px solid #cbd5e1;
}

body.light-mode .sidebar {
    background-color: rgba(255, 255, 255, 0.8);
}

body.light-mode .top-bar {
    background-color: rgba(255, 255, 255, 0.8);
}

body.light-mode .logo {
    color: #0f172a;
}

body.light-mode .ticket-card, body.light-mode .modal-content, body.light-mode .kanban-header {
    background-color: #ffffff;
}

body.light-mode .kanban-column {
    background: rgba(248, 250, 252, 0.8);
}

body.light-mode .badge-gray { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
body.light-mode .badge-yellow { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
body.light-mode .badge-green { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
body.light-mode .badge-purple { background: #faf5ff; color: #6d28d9; border: 1px solid #e9d5ff; }
body.light-mode .badge-billed { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
body.light-mode .badge-blue { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
body.light-mode .badge-cyan { background: #ecfeff; color: #0e7490; border: 1px solid #a5f3fc; }

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-darker);
    color: var(--text-main);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    /* Soft gradient background */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(var(--primary-rgb), 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(var(--billed-rgb), 0.08), transparent 25%);
}

/* Typography Utility */
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-red { color: #ef4444; }
.text-blue { color: #3b82f6; }
.text-yellow { color: var(--color-inprogress); }
.text-green { color: var(--color-done); }
.text-purple { color: var(--color-purple); }
.text-billed { color: var(--color-billed); }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; }

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

.sidebar {
    width: var(--sidebar-width);
    background-color: rgba(36, 34, 31, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--surface-border);
    display: flex;
    flex-direction: column;
    padding: 0;
    z-index: 10;
}

.sidebar-header {
    height: 70px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(0,0,0,0.05); /* Match top bar border feel */
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    margin-top: 4px; /* Optical baseline correction vs h1 */
}

.logo h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0; /* Important for vertical centering! */
    line-height: 1;
}

.logo i {
    color: var(--primary);
    font-size: 1.5rem;
}

.app-logo {
    max-width: 40px;
    height: auto;
    border-radius: var(--border-radius-sm);
}



.sidebar-nav {
    padding: 0 1.5rem;
}

/* (removed duplicate .online-users-sidebar here) */

.user-display-container {
    margin: 1rem 1.5rem !important; /* using !important to override inline margin if needed, but horizontal margin works */
}

.sidebar .nav-links {
    list-style: none;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    color: var(--text-muted);
    text-decoration: none;
    transition: all var(--transition-fast);
    font-weight: 500;
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    background-color: var(--surface-hover);
    color: var(--text-main);
}

.nav-item.active {
    background-color: rgba(var(--primary-rgb), 0.15);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

.project-legend {
    /* now handled mostly by inline flex styles in the topbar */
}

.project-legend h4 {
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.project-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.bg-blue { background-color: #3b82f6 !important; }
.bg-cyan { background-color: #06b6d4 !important; }
.bg-green { background-color: #059669 !important; }
.bg-yellow { background-color: var(--color-inprogress) !important; }
.bg-red { background-color: #ef4444 !important; }
.bg-gray { background-color: #94a3b8 !important; }
.bg-purple { background-color: var(--color-purple) !important; }
.bg-billed { background-color: var(--color-billed) !important; }
.bg-orange { background-color: #f97316 !important; }
.bg-pink { background-color: #ec4899 !important; }
.bg-teal { background-color: #14b8a6 !important; }
.bg-indigo { background-color: #6366f1 !important; }
.bg-lime { background-color: #84cc16 !important; }
.bg-amber { background-color: #fbbf24 !important; }

.sidebar-footer {
    margin-top: auto;
    padding: 1.5rem;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-bar {
    min-height: 70px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--surface-border);
    background-color: rgba(36, 34, 31, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    margin-bottom: 4px; /* Optical baseline correction vs smaller components */
}

.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 6px;  /* Optical baseline correction vs h1 */
}

/* Filter Select Dropdowns (Match Dashboard Project Legend) */
select.filter-select {
    padding: 0.25rem 0.6rem !important;
    font-size: 0.8rem !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
    color: var(--text-muted) !important;
    height: auto !important;
    min-width: 140px !important;
}

/* Sidebar Online Users (reused legend-item styles) */
.online-users-sidebar {
    padding: 0.5rem 1.5rem;
    margin-top: 1rem;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-right: 3rem;
    font-weight: 500;
}

.ticker-item i {
    color: var(--color-done);
    font-size: 0.5rem;
    animation: pulseTicker 2s infinite;
}

.badge-ticker-ticket {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-ticker-toggle {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 1rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    border-left: 1px solid var(--surface-border);
}

.btn-ticker-toggle:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.online-ticker-container.ticker-hidden .btn-ticker-toggle {
    border-left: none;
    border-radius: 50%;
    background: rgba(36, 34, 31, 0.4);
    border: 1px solid var(--surface-border);
    width: 38px;
    padding: 0;
}

@keyframes scrollTicker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); } 
}

@keyframes pulseTicker {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
    100% { opacity: 1; transform: scale(1); }
}

/* Views */
.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
}

.view {
    display: none;
    animation: fadeIn 0.4s ease-out forwards;
}

.view.active {
    display: block;
}

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

/* Glassmorphism Components */
.glass-card {
    background: var(--surface-light);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 1.5rem;
}

.full-height {
    height: 100%;
}

/* Buttons and Inputs */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(var(--primary-rgb), 0.39);
}

.btn-primary:not(:disabled):hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px 0 rgba(var(--primary-rgb), 0.5);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:not(:disabled):hover {
    background-color: var(--secondary-hover);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-danger:not(:disabled):hover {
    background-color: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px 0 rgba(239, 68, 68, 0.39);
}

.btn-green {
    background-color: var(--color-done);
    color: white;
}

.btn-green:not(:disabled):hover {
    background-color: #059669; /* deeper green */
    transform: translateY(-2px);
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.block {
    display: block;
}

.full-width {
    width: 100%;
}

.modern-input {
    width: 100%;
    background-color: rgba(36, 34, 31, 0.8);
    border: 1px solid var(--surface-border);
    color: var(--text-main);
    border-radius: var(--border-radius-sm);
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.modern-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.2);
}

.modern-input:disabled,
.modern-input[readonly] {
    opacity: 0.7;
    cursor: not-allowed;
    background-color: var(--surface-hover);
}

select.modern-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%2394a3b8%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem top 50%;
    background-size: 0.65rem auto;
    padding-right: 2.5rem;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 400px;
    text-align: center;
}

.empty-state .icon-wrapper {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h2 {
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
}

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

.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
    border-bottom: 4px solid transparent;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.stat-card.border-open { border-bottom-color: var(--color-open); }
.stat-card.border-inprogress { border-bottom-color: var(--color-inprogress); }
.stat-card.border-done { border-bottom-color: var(--color-done); }
.stat-card.border-billed { border-bottom-color: var(--color-billed); }

.mobile-only {
    display: none !important;
}

.mobile-flex-only {
    display: none !important;
}

/* --- RESPONSIVE DESIGN FOR MOBILE --- */
@media (max-width: 900px) {
    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }
    
    .mobile-only {
        display: block !important;
    }

    .mobile-flex-only {
        display: flex !important;
    }
    
    .hide-on-mobile {
        display: none !important;
    }
    
    .floating-timer {
        min-width: 0 !important;
        width: calc(100vw - 2rem) !important;
        left: 1rem !important;
        right: auto !important;
        bottom: 1rem !important;
        padding: 0.75rem 1rem !important;
        max-width: none !important;
        justify-content: space-between !important;
    }
    
    .floating-timer .timer-display {
        font-size: 1.25rem !important;
    }
    
    /* Time-Tracking Layout auf dem Handy kompakter machen (Datum/Zeit nebeneinander) */
    .time-tracking-row {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
        align-items: flex-start !important;
    }
    
    .time-tracking-row > .timer-buttons-container {
        width: 100% !important; /* Timer actions volle Breite */
        margin-bottom: 0.25rem !important;
        flex-wrap: wrap;
    }
    
    .time-tracking-row > .form-group {
        width: calc(33.333% - 0.5rem) !important;
        flex: 1 1 calc(33.333% - 0.5rem) !important;
        min-width: 80px !important;
    }
    
    /* Linear Sidebar Header (No Hamburger Menu) */
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        z-index: 100;
        background-color: var(--bg-dark);
        border-right: none;
        border-bottom: 1px solid var(--surface-border);
        display: flex;
        flex-direction: column;
        padding-bottom: 1rem;
        transform: none;
        transition: none;
        overflow: visible;
    }
    
    .sidebar-header {
        order: 1;
        margin-bottom: 0;
        padding-top: 1rem;
        padding-bottom: 0;
    }
    
    .online-users-sidebar {
        order: 2;
        display: block !important;
        margin-top: 1rem;
        margin-bottom: 1rem;
        padding: 0 1.5rem;
    }
    
    .online-users-sidebar h4 {
        font-size: 0.9rem;
    }
    
    .sidebar-nav {
        order: 3;
        margin: 0 1.5rem 0.5rem 1.5rem !important;
    }
    
    ul.nav-links {
        display: none !important;
    }
    
    .nav-item {
        white-space: normal;
        padding: 0.75rem 1rem;
    }
    
    .user-display-container {
        margin: auto 1.5rem 0.5rem 1.5rem !important;
    }
    
    .sidebar-footer {
        padding: 0 1.5rem;
        margin-top: 1rem;
    }
    
    /* Top Bar & Content */
    .top-bar {
        position: sticky;
        top: 0;
        padding: 0.75rem 1rem !important;
        z-index: 50;
    }
    
    .top-bar-actions {
        width: 100%;
        margin-top: 0.5rem;
        justify-content: flex-start;
    }
    
    .project-filter {
        flex-direction: column;
        align-items: stretch !important;
        width: 100%;
    }
    
    .project-legend {
        flex-wrap: wrap;
        margin-right: 0 !important;
        margin-bottom: 0.5rem;
    }
    
    select.filter-select {
        width: 100% !important;
    }
    
    .view-container {
        padding: 1rem 1rem !important;
        overflow-y: visible;
    }
    
    #view-tickets > .glass-card {
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    body {
        overflow-y: auto;
        height: auto;
    }
    
    html {
        overflow-y: auto;
    }
    
    .main-content {
        overflow: visible;
    }
    
    /* Stats grid */
    .stats-row {
        display: none !important; /* Users requested to ditch redundant big-cards in favor of Kanban tabs */
    }
    
    /* Responsive Modals */
    .modal-content {
        margin: 0;
        width: 100vw !important;
        max-width: 100vw !important;
        height: 100vh !important;
        border-radius: 0;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        flex: 1;
        overflow-y: auto;
        padding: 1rem !important;
    }
    
    /* Modal Form Grid Layout für Mobile */
    #formTicket {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); /* Verhindert das Aufklappen der Grid-Breite durch Formularfelder */
        gap: 0 0.75rem;
    }
    
    #formTicket > .form-row {
        display: contents;
    }
    
    .form-row:not(#formTicket > .form-row) {
        flex-direction: column;
        gap: 0.5rem !important;
        align-items: stretch !important;
    }
    
    .form-group {
        grid-column: span 2;
        width: 100% !important;
        flex: none !important;
        margin-bottom: 0.75rem !important;
        min-width: 0 !important;
    }
    
    #formTicket .form-group.mobile-half {
        grid-column: span 1;
    }
    
    #editOnlyFields,
    #formTicket > .modal-actions,
    #formTicket > .history-container,
    #formTicket > .comments-container {
        grid-column: span 2;
    }
    
    .modern-input {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 35px; /* Verhindert das iOS Safari die vertikale Höhe bei date-Feldern kollabieren lässt */
        -webkit-appearance: none;
        appearance: none;
    }
    
    .modal-actions {
        flex-wrap: wrap;
        justify-content: stretch !important;
        padding: 1rem !important;
        background: var(--surface-light);
        border-top: 1px solid var(--surface-border);
    }
    
    .modal-actions .btn {
        flex: 1;
        text-align: center;
        margin-bottom: 0.25rem;
    }
    
    /* Tabular data to Cards trick */
    .table-container {
        overflow-x: auto;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .modern-table {
        min-width: 700px; /* force horizontal scroll for massive tables */
    }
    
    /* Dashboard Table explicitly turns into mobile cards */
    #dashboardTicketTable {
        min-width: auto;
    }
    
    #dashboardTicketTable thead {
        display: none;
    }
    
    #dashboardTicketTable tbody td {
        display: block;
        width: 100% !important;
        text-align: left !important;
        padding: 0.25rem 0.5rem;
        border-bottom: none;
    }
    #dashboardTicketTable tbody tr {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 0;
        margin-bottom: 1rem;
        background: var(--bg-darker);
        border: 1px solid var(--surface-border);
        border-radius: var(--border-radius-md);
        padding: 0.75rem 0.5rem;
        box-shadow: var(--shadow-soft);
    }
    
    #dashboardTicketTable tbody tr.load-more-row {
        display: block;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
    }
    
    #dashboardTicketTable tbody td {
        display: block;
        width: 100% !important;
        text-align: left !important;
        padding: 0.15rem 0.5rem;
        border-bottom: none;
    }

    /* 1. ROW: ID, Projekt, Zuständig, Status */
    #dashboardTicketTable tbody td[data-label="ID"] {
        order: 1;
        width: auto !important;
        flex: 1;
        font-weight: bold;
        color: var(--primary);
        font-size: 0.95rem;
    }
    
    #dashboardTicketTable tbody td[data-label="Projekt"] {
        order: 2;
        width: auto !important;
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }
    
    #dashboardTicketTable tbody td[data-label="Zuständig"] {
        order: 3;
        width: auto !important;
        padding-left: 0.25rem !important;
        padding-right: 0.25rem !important;
    }
    
    #dashboardTicketTable tbody td[data-label="Status"] {
        order: 4;
        width: auto !important;
        padding-left: 0.25rem !important;
    }

    /* Visual Separator */
    #dashboardTicketTable tbody tr:not(.load-more-row)::after {
        content: "";
        order: 5;
        width: 100%;
        height: 1px;
        background: var(--surface-border);
        margin: 0.5rem 0;
    }

    /* 2. ROW: Zeit (Startbutton) left of Title */
    #dashboardTicketTable tbody td.col-zeit {
        order: 6;
        width: auto !important;
        flex: 0 0 auto;
        margin-bottom: 0.25rem;
        padding-right: 0.5rem !important;
        display: flex;
        align-items: center;
    }

    /* 3. ROW: Titel */
    #dashboardTicketTable tbody td.col-titel {
        order: 7;
        width: 0 !important;
        flex: 1 1 0%;
        min-width: calc(100% - 60px); /* Force it to consume the rest of the row, pushing 31% blocks down */
        font-size: 1.05rem;
        font-weight: 600;
        margin-bottom: 0.25rem;
        padding-left: 0 !important;
        justify-content: flex-start !important;
    }

    /* 4. ROW: Time Stats */
    #dashboardTicketTable tbody td.time-header {
        order: 8;
        width: 31% !important;
        text-align: center !important;
        background: rgba(0,0,0,0.2);
        border-radius: 4px;
        margin-top: 0.25rem;
        margin-right: 2%;
        padding: 0.4rem 0 !important;
    }
    
    #dashboardTicketTable tbody td.time-header:nth-child(9) {
        margin-right: 0;
        width: 33% !important;
    }
    
    #dashboardTicketTable tbody td.time-header::before {
        display: block;
        content: attr(data-label);
        font-size: 0.65rem;
        color: var(--text-muted);
        text-transform: uppercase;
        margin-bottom: 0.15rem;
    }
    
    /* Quill Editor Mobile Overrides */
    .ql-toolbar.ql-snow {
        padding: 0.25rem !important;
        white-space: normal !important; /* let buttons wrap */
    }
    
    .ql-toolbar button {
        margin: 2px !important;
        width: 24px !important;
        height: 24px !important;
    }
    
    .ql-editor {
        min-height: 100px !important;
        padding: 0.5rem !important;
    }
}

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

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2.5rem;
    opacity: 0.8;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.1;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Kanban Board */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    height: calc(100% - 150px);
    min-height: 500px;
}

.kanban-column {
    background: rgba(36, 34, 31, 0.4);
    border-radius: var(--border-radius-lg);
    border: 1px dashed var(--surface-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.kanban-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--surface-border);
    background: rgba(36, 34, 31, 0.6);
}

.kanban-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.kanban-tickets {
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Badges */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    border: 1px solid transparent; /* Platzhalter falls border ergänzt wird */
}

.badge-gray { background: rgba(148, 163, 184, 0.2); color: #cbd5e1; }
.badge-yellow { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.badge-green { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.badge-purple { background: rgba(var(--purple-rgb), 0.2); color: var(--purple-text); }
.badge-billed { background: rgba(var(--billed-rgb), 0.2); color: var(--billed-text); }
.badge-blue { background: rgba(var(--primary-rgb), 0.2); color: #93c5fd; }
.badge-cyan { background: rgba(6, 182, 212, 0.2); color: #67e8f9; }

/* Ticket Cards */
.ticket-card {
    background: var(--bg-darker);
    border: 1px solid var(--surface-border);
    border-radius: var(--border-radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.ticket-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
}

.ticket-card[data-priority="high"]::before { background-color: #ef4444; }
.ticket-card[data-priority="normal"]::before { background-color: #3b82f6; }

.ticket-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-soft);
    border-color: rgba(var(--primary-rgb), 0.5);
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.ticket-id {
    font-family: monospace;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.ticket-title {
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

.ticket-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.assignee-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.7rem;
}

/* List View Table */
.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    width: 300px;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    padding-left: 2.5rem;
}

.table-container {
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    min-width: 900px; /* Forces horizontal scrolling on narrow screens */
    border-collapse: collapse;
    text-align: left;
    table-layout: fixed;
}

.modern-table th, .modern-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--surface-border);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.modern-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.modern-table th:first-child, .modern-table td:first-child {
    min-width: 115px;
}

.modern-table tbody tr {
    transition: background-color var(--transition-fast);
    cursor: pointer;
}

.modern-table tbody tr:hover {
    background-color: var(--surface-hover);
}

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

.btn-icon.small {
    font-size: 0.9rem;
    padding: 0.1rem;
}

.btn-icon:hover {
    color: var(--primary);
}

/* Billing View */
.billing-container {
    max-width: 1400px;
    margin: 0 auto;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.billing-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.project-billing {
    background: rgba(36, 34, 31, 0.4);
    border-radius: var(--border-radius-md);
    padding: 1.5rem;
    border: 1px solid var(--surface-border);
}

.project-billing h3 {
    margin-bottom: 1rem;
    color: var(--primary);
    font-size: 1.25rem;
}

.billing-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px dashed var(--surface-border);
}

.billing-stat {
    display: flex;
    flex-direction: column;
}

.billing-stat strong {
    font-size: 1.5rem;
}

.user-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-dark);
}

.animate-pop-in {
    transform: scale(0.95) translateY(10px);
    transition: transform var(--transition-bounce), opacity 0.3s ease;
    opacity: 0;
}

.modal-overlay:not(.hidden) .animate-pop-in {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--surface-border);
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.btn-close:hover {
    color: white;
}

.form-group {
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 0.75rem;
}

.form-group.half {
    flex: 1;
}

.form-group.third {
    flex: 1;
}

textarea.modern-input {
    resize: vertical;
    min-height: 100px;
    transition: all var(--transition-fast);
}

textarea.modern-input.drag-over {
    border-color: var(--color-done);
    background-color: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.modal-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--surface-border);
}

/* History Logs */
.history-container {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.history-container label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: block;
}

.history-list, .comments-list {
    display: flex;
    flex-direction: column;
    /* Limit the height so the modal body doesn't push the top details off-screen! */
    max-height: 200px;
    min-height: 150px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.5rem;
}

.history-list {
    gap: 0.25rem;
}

/* Custom Scrollbar for inner lists */
.history-list::-webkit-scrollbar, .comments-list::-webkit-scrollbar {
    width: 6px;
}
.history-list::-webkit-scrollbar-track, .comments-list::-webkit-scrollbar-track {
    background: transparent;
}
.history-list::-webkit-scrollbar-thumb, .comments-list::-webkit-scrollbar-thumb {
    background: var(--surface-border);
    border-radius: 10px;
}

.history-item {
    background: var(--surface-hover);
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    border-left: 3px solid var(--primary);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-meta {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Floating Timer */
.floating-timer {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    border: 1px solid var(--primary);
    box-shadow: 0 10px 25px -5px rgba(var(--primary-rgb), 0.4);
    animation: slideUp 0.3s ease-out;
    background: #1e1d1a;
    color: #fdfbf7;
    border: 1px solid rgba(255,255,255,0.1);
    min-width: 350px;
    max-width: 500px;
    border-radius: var(--border-radius-md);
}

.floating-timer.hidden {
    display: none !important;
}

.timer-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

#timerTicketTitle {
    font-size: 0.9rem;
    color: #a3a3a3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.timer-display {
    font-family: monospace;
    font-size: 1.75rem;
    color: #3b82f6;
    font-weight: bold;
    line-height: 1;
}

.timer-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.timer-controls .btn-icon {
    font-size: 1.5rem;
    padding: 0.25rem;
    color: var(--text-muted);
}

.timer-controls .btn-icon.text-yellow { color: var(--color-inprogress); }
.timer-controls .btn-icon.text-red { color: #ef4444; }

.timer-controls .btn-icon:hover {
    transform: scale(1.1);
}

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

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Scrollbar customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(36, 34, 31, 0.5);
}
::-webkit-scrollbar-thumb {
    background: var(--surface-border);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.hidden {
    display: none !important;
}

/* Phase 15: Compact Modal Overrides */
.modal-content .modal-header {
    padding: 0.75rem 1.5rem;
}
.modal-content .modal-body {
    padding: 0.5rem 1.5rem;
}
.modal-content .modal-actions {
    padding: 0.75rem 1.5rem;
}
.modal-content .form-group {
    margin-bottom: 0.75rem;
}
.modal-content .form-row {
    margin-bottom: 0.75rem;
}
.modal-content .modern-input, .modal-content textarea.modern-input {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
}

/* Threaded Comments */
.comment-bubble {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.9rem;
    position: relative;
    border: 1px solid var(--surface-border);
}

.comment-bubble.is-self {
    align-self: flex-end;
    background: var(--surface-light);
    border-bottom-right-radius: 2px;
}

.comment-bubble.is-other {
    align-self: flex-start;
    background: rgba(30,30,30,0.05); /* Sehr helles Grau */
    border-bottom-left-radius: 2px;
}
[data-theme="dark"] .comment-bubble.is-other {
    background: rgba(255,255,255,0.06); /* Helles Grau im Dark Mode */
}

/* Interne Kommentare (nur für Developer/Admin) visuell absetzen */
.comment-bubble.is-internal {
    border-color: #b45309;
    background: rgba(180, 83, 9, 0.15);
}

body.light-mode .comment-bubble.is-internal {
    border: 1px solid #fcd34d;
    background: #fffbeb;
}

/* Inline Comment Images */
.comment-text img {
    max-width: 150px !important;
    max-height: 150px !important;
    object-fit: cover;
    border-radius: 4px;
    cursor: zoom-in;
    transition: opacity 0.2s;
}
.comment-text img:hover {
    opacity: 0.8;
}
/* Custom Instant Tooltip */
.hint-tooltip {
    position: relative;
    cursor: pointer;
}
.hint-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    right: 50%;
    transform: translateX(50%);
    margin-bottom: 5px;
    background: var(--surface-card);
    color: var(--text-primary);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    border: 1px solid var(--surface-border);
    z-index: 1000;
    pointer-events: none;
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.15rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-author {
    font-weight: 600;
    color: var(--text-light);
}

.comment-role-badge {
    background: rgba(255,255,255,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.65rem;
    margin-left: 0.5rem;
    text-transform: uppercase;
}

.comment-role-badge.admin { color: #818cf8; background: rgba(129, 140, 248, 0.15); }
.comment-role-badge.developer { color: #34d399; background: rgba(52, 211, 153, 0.15); }
.comment-role-badge.poweruser { color: #facc15; background: rgba(250, 204, 21, 0.15); }

.comment-text {
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Login Screen */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(18, 18, 18, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-container.hidden {
    display: none !important;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-logo {
    height: 60px;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Dynamische Spalten-Verteilung für den "Abgerechnet" Tab (MA ausblenden) */
.table-view-billed .col-ma {
    display: none !important;
}
.table-view-billed .col-titel {
    width: 28% !important; /* 25% original + 3% = 28% */
}
.table-view-billed #thZeit, .table-view-billed .col-zeit {
    width: 20% !important; /* 13% original + 7% = 20% */
}

/* Erledigt Tab: Zeit-Spalte komplett ausblenden */
.table-view-done .col-zeit {
    display: none !important;
}
.table-view-done .col-titel {
    width: 38% !important; /* 25% original + 13% Zeit = 38% */
}

/* Force Dropdown Arrow on Datalist Inputs */
input[list]::-webkit-calendar-picker-indicator {
    opacity: 1 !important;
    display: block !important;
    cursor: pointer;
    background-color: transparent;
    color: var(--text-muted);
}

/* --- Quill.js MaterialOverrides --- */
.ql-toolbar.ql-snow {
    border: 1px solid var(--surface-border);
    background-color: var(--surface-bg);
    border-top-left-radius: var(--border-radius-sm);
    border-top-right-radius: var(--border-radius-sm);
    font-family: 'IBM Plex Sans', sans-serif;
}
.theme-dark .ql-toolbar.ql-snow .ql-stroke {
    stroke: var(--text-main);
}
.theme-dark .ql-toolbar.ql-snow .ql-fill {
    fill: var(--text-main);
}
.theme-dark .ql-toolbar.ql-snow .ql-picker {
    color: var(--text-main);
}
.ql-container.ql-snow {
    border: 1px solid var(--surface-border);
    border-bottom-left-radius: var(--border-radius-sm);
    border-bottom-right-radius: var(--border-radius-sm);
    background-color: var(--bg-darker);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
}
.ql-editor {
    min-height: inherit;
}
.ql-editor p {
    margin-bottom: 0.5rem;
}
.ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: italic;
}

/* Custom Quill Editor Overrides for Quotes */
.ql-editor blockquote,
.comment-text blockquote {
    border: none !important;
    border-left: 2px solid var(--primary) !important;
    background-color: var(--surface-hover) !important;
    padding: 0.15rem 0.75rem !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    border-radius: 0 !important;
    color: var(--text-muted) !important;
    font-style: italic !important;
}

/* Dynamische Rundungen und Abstände für verschmolzene Blockquotes */
.ql-editor > blockquote:first-child,
.comment-text > blockquote:first-child,
.ql-editor *:not(blockquote) + blockquote,
.comment-text *:not(blockquote) + blockquote {
    border-top-right-radius: 6px !important;
    padding-top: 0.6rem !important;
    margin-top: 0.75rem !important;
}

.ql-editor blockquote:last-child,
.comment-text blockquote:last-child,
.ql-editor blockquote:not(:has(+ blockquote)),
.comment-text blockquote:not(:has(+ blockquote)) {
    border-bottom-right-radius: 6px !important;
    padding-bottom: 0.6rem !important;
    margin-bottom: 0.75rem !important;
}
