:root {
    --primary: #f7a70b;
    /* Widmann Official Orange */
    --primary-light: #fff8e1;
    /* Soft Orange Background */
    --secondary: #575756;
    /* Solar Grey */
    --dark: #2c3e50;
    --light: #ecf0f1;
    --white: #ffffff;
    --sidebar-width: 260px;
    --glass: rgba(255, 255, 255, 0.90);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.10);
    --success: #27ae60;
    --danger: #c0392b;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    background: #fdfdfd;
    /* Clean white/grey instead of blue gradient */
    color: var(--dark);
    min-height: 100vh;
    display: flex;
}

/* ... (Existing styles) ... */

/* Unified Settings Panel */
.settings-panel {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.settings-header {
    background: linear-gradient(135deg, var(--primary) 0%, #d35400 100%);
    /* Orange Gradient */
    padding: 30px;
    color: white;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Global Box Sizing */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: white;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    z-index: 1000;
}

/* ... (Brand, nav-item styles remain same) ... */

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 30px;
    /* With flex: 1 and margin-left, we don't need explicit width calc if box-sizing is on */
    width: auto;
    max-width: calc(100% - var(--sidebar-width));
}

.brand {
    padding: 30px;
    font-size: 20px;
    font-weight: 800;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #eee;
}

.brand-dot {
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(243, 156, 18, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(243, 156, 18, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(243, 156, 18, 0);
    }
}

.nav-links {
    padding: 20px;
    flex: 1;
}

.nav-item {
    padding: 12px 15px;
    border-radius: 10px;
    margin-bottom: 5px;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.nav-item:hover,
.nav-item.active {
    background: #f0f3f6;
    color: var(--secondary);
}

.nav-item.active {
    background: rgba(41, 128, 185, 0.1);
    color: var(--secondary);
    font-weight: 600;
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 30px;
    width: calc(100% - var(--sidebar-width));
}

.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
}

/* Filter Bar (Floating) */
.filter-bar {
    background: var(--glass);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    border-radius: 12px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
}

select,
input {
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    min-width: 140px;
    outline: none;
    transition: all 0.2s;
}

select:focus,
input:focus {
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.1);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary), #e67e22);
    color: white;
    box-shadow: 0 4px 15px rgba(243, 167, 11, 0.3);
}

.btn-success {
    background: linear-gradient(45deg, var(--success), #2ecc71);
    color: white;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.3);
}

.btn-outline {
    background: white;
    border: 1px solid #ddd;
    color: var(--dark);
}

.btn-outline:disabled {
    background: #f8f9fa;
    color: #bdc3c7;
    border-color: #ecf0f1;
    cursor: not-allowed;
    box-shadow: none;
    transform: none !important;
}

/* Grid System */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--glass);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(4px);
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-5px);
}

.stat-value {
    font-size: 38px;
    font-weight: 800;
    background: linear-gradient(45deg, var(--dark), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 10px 0;
}

.stat-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #7f8c8d;
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.charts-full {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container,
.table-container {
    background: white;
    padding: 25px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    height: 400px;
    display: flex;
    flex-direction: column;
    /* Fix for Chart.js overflow in Grid/Flex */
    min-width: 0;
    overflow: hidden;
}

.chart-container canvas {
    flex: 1;
    min-height: 0;
    width: 100% !important;
    height: auto !important;
}

.table-container {
    height: auto;
    overflow: hidden;
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 15px;
    color: #95a5a6;
    font-size: 13px;
    border-bottom: 1px solid #eee;
}

td {
    padding: 15px;
    border-bottom: 1px solid #f5f5f5;
    font-size: 14px;
}

tr:hover {
    background: #f9f9f9;
}

/* Status Badges */
.status-badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

/* Extended Status Badges */
.status-open {
    background: #fff9c4;
    /* Yellow-ish specific to Widmann 'Open' */
    color: #fbc02d;
    border: 1px solid #fff176;
}

.status-solved {
    background: #e8f5e9;
    /* Green */
    color: #2ecc71;
    border: 1px solid #c8e6c9;
}

.status-canceled {
    background: #ffebee;
    /* Red */
    color: #e74c3c;
    border: 1px solid #ffcdd2;
}

.status-appointment {
    background: #fff3e0;
    /* Orange */
    color: #f39c12;
    border: 1px solid #ffe0b2;
}

.status-planned {
    background: #e1f5fe;
    /* Blue */
    color: #3498db;
    border: 1px solid #b3e5fc;
}

/* Forms & Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal-content {
    background: white;
    border-radius: 20px;
    padding: 30px;
    width: 600px;
    max-width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #ccc;
}

.close-btn:hover {
    color: var(--danger);
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #eee;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    display: none;
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f9f9f9;
}

.autocomplete-item:hover {
    background: #f8f9fa;
    color: var(--secondary);
}

/* --- Modern Profile Hover Logout --- */
.user-profile-container {
    padding: 20px;
    border-top: 1px solid #eee;
    position: relative;
    /* Context for popup */
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: default;
    /* Not clickable itself */
}

.user-profile .avatar {
    width: 40px;
    height: 40px;
    background: #f0f2f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7f8c8d;
    font-weight: bold;
    font-size: 15px;
    transition: all 0.2s;
}

.user-profile .user-info {
    display: flex;
    flex-direction: column;
}

.user-profile .user-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--dark);
}

.user-profile .user-role {
    font-size: 12px;
    color: #95a5a6;
}

/* Logout Popup */
/* User Menu Popup */
.user-menu-popup {
    position: absolute;
    bottom: 80px;
    left: 20px;
    right: 20px;
    background: white;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    padding: 8px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    border: 1px solid #eee;

    /* Animation State: Hidden */
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 1001;
}

.user-profile-container:hover .user-menu-popup {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-item {
    padding: 10px 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    text-decoration: none;
    transition: all 0.2s;
}

.user-menu-item:hover {
    background: #f8f9fa;
    color: var(--secondary);
}

.user-menu-item.danger {
    color: #e74c3c;
}

.user-menu-item.danger:hover {
    background: #fff5f5;
}

/* --- Modern Header & Filters --- */
.header-split {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 25px;
}

.section-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 5px 0;
    color: var(--dark);
    letter-spacing: -0.5px;
}

.section-subtitle {
    display: block;
    font-size: 14px;
    color: #95a5a6;
    font-weight: 500;
}

.action-group {
    display: flex;
    gap: 10px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid #f0f0f0;
    color: #666;
    background: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.btn-icon:hover {
    background: #f8f9fa;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-pill {
    border-radius: 50px;
    padding: 10px 24px;
    font-size: 14px;
}

/* Modern Filter Bar */
.modern-filter-bar {
    background: white;
    border-radius: 16px;
    padding: 10px 20px;
    /* Reduced vertical padding slightly for compact look */
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    border: 1px solid #f0f0f0;
    flex-wrap: nowrap;
    /* Force 1 line */
    gap: 15px;
    overflow-x: auto;
    /* Allow scroll if screen is too small, better than breaking layout */
}

.filter-group {
    display: flex;
    gap: 10px;
    flex-wrap: nowrap;
    /* Force 1 line */
    align-items: center;
}

.filter-select {
    appearance: none;
    background-color: #f8f9fa;
    border: 1px solid transparent;
    border-radius: 50px;
    /* Pill shape */
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
    padding-right: 32px;
    transition: all 0.2s;
}

.filter-select:hover {
    background-color: #f0f0f0;
    color: #333;
}

.filter-select:focus {
    background-color: white;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.15);
}

.search-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 4px;
    border-radius: 50px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.search-group:focus-within {
    background: white;
    border-color: #eee;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.search-input {
    border: none;
    background: transparent;
    padding: 8px 12px;
    font-size: 13px;
    outline: none;
    width: 180px;
    min-width: 0;
}

.btn-sm {
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 12px;
}

.btn-text {
    border: none;
    background: none;
    color: #999;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 10px;
}

.btn-text:hover {
    color: var(--danger);
}

/* Language Button Active State */
.lang-btn.active {
    border-color: var(--primary) !important;
    background-color: var(--primary-light) !important;
    color: var(--primary);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.lang-btn:hover {
    background-color: #f8f9fa;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    -webkit-transition: .4s;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary);
}

input:checked+.slider:before {
    -webkit-transform: translateX(26px);
    -ms-transform: translateX(26px);
    transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    align-items: stretch;
}

.settings-card {
    background: white;
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Unified Settings Panel */
.settings-panel {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.settings-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    padding: 30px;
    color: white;
    display: flex;
    align-items: center;
    gap: 20px;
}

.settings-avatar-large {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: bold;
    color: white;
    backdrop-filter: blur(10px);
}

.settings-section {
    padding: 30px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    border-bottom: 1px solid #f0f0f0;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-label h4 {
    margin: 0 0 5px 0;
    font-size: 16px;
    color: var(--dark);
}

.settings-label p {
    margin: 0;
    font-size: 13px;
    color: #95a5a6;
}

/* Ticket Detail Modal Styles */
.detail-grid-layout {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 30px;
}

@media (max-width: 768px) {
    .detail-grid-layout {
        grid-template-columns: 1fr;
    }
}

.detail-section {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item label,
.detail-label {
    font-size: 11px;
    text-transform: uppercase;
    color: #95a5a6;
    font-weight: 700;
    margin: 0;
}

.info-item span,
.detail-value {
    font-size: 14px;
    color: var(--dark);
    font-weight: 500;
}

.status-badge {
    display: inline-block;
}

.status-badge.Open {
    background: #f1c40f;
    color: white;
}

.status-badge.Solved {
    background: #2ecc71;
    color: white;
}

.status-badge.Closed {
    background: #95a5a6;
    color: white;
}

.status-badge.Planned {
    background: #3498db;
    color: white;
}