:root {
    --sidebar-width: 212px;
    --sidebar-collapsed-width: 68px;
    --sidebar-bg: #1a1d29;
    --sidebar-hover: #252836;
    --sidebar-active: #085584;
    --main-bg: #f5f7fa;
    --card-bg: #ffffff;
    --text-primary: #1a1d29;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --accent-blue: #085584;
    --accent-orange: #F97E18;
    --accent-orange-hover: #e06d15;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--main-bg);
    color: var(--text-primary);
    font-weight: 400;
    overflow-x: hidden;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    transition: width 0.3s ease, transform 0.3s ease;
    transform: translateX(0);
}

.sidebar-header {
    padding: 1.1rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.sidebar-logo {
    height: 26px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 0.85rem;
    font-weight: 700;
    margin: 0;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-divider {
    margin: 0.5rem 1rem 0.65rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
    font-size: 0.78rem;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
    border-left-color: var(--accent-orange);
}

.nav-item.active {
    background: var(--sidebar-active);
    color: #ffffff;
    border-left-color: var(--accent-orange);
}

.nav-group {
    margin-bottom: 0.5rem;
}

.nav-group-toggle {
    width: 100%;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.nav-group-toggle:hover {
    background: var(--sidebar-hover);
    color: #ffffff;
}

.nav-group-label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.nav-group-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.2s ease;
}

.nav-group-toggle.is-open .nav-group-arrow {
    transform: rotate(180deg);
}

.nav-sub {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.nav-sub.open {
    max-height: 500px;
    opacity: 1;
}

.nav-sub .nav-item {
    padding-left: 2.25rem;
    font-size: 0.74rem;
    border-left: none;
}

body.sidebar-collapsed .nav-group-toggle {
    justify-content: center;
    padding: 0.6rem 0.4rem;
}

body.sidebar-collapsed .nav-group-label span:last-child,
body.sidebar-collapsed .nav-group-arrow {
    display: none;
}

body.sidebar-collapsed .nav-sub {
    display: none !important;
}

.nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-orange);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: #ffffff;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    font-size: 0.78rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.6);
    margin-top: 0.1rem;
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
    max-width: 100%;
}

.logout-form {
    width: 100%;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border: none;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.78rem;
    width: 100%;
    justify-content: center;
    cursor: pointer;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left 0.3s ease;
}

/* Top Navbar */
.top-navbar {
    background: var(--sidebar-bg);
    color: #ffffff;
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1.5rem;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.navbar-date {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
}

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

.navbar-profile {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-profile-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.navbar-profile .user-avatar {
    font-size: 0.8rem;
    width: 28px;
    height: 28px;
}

.navbar-profile .user-name {
    color: #ffffff;
    font-size: 0.85rem;
}

.navbar-profile .user-role {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.7rem;
}

.notification-dropdown {
    position: relative;
}

.notification-btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    padding: 0;
}

.notification-btn:hover,
.notification-btn:focus-visible {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.5);
    outline: none;
}

.notification-btn svg {
    width: 18px;
    height: 18px;
}

.notification-popup {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(320px, 80vw);
    background: #ffffff;
    color: var(--text-primary);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 200;
}

.notification-popup.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.notification-popup-header {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.notification-popup-body {
    padding: 0.75rem 0.75rem 0.5rem;
}

.notification-empty {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.notification-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 0 0.25rem;
}

.notification-item {
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(229, 231, 235, 0.85);
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    font-size: 0.8rem;
    margin-bottom: 0.45rem;
}

.notification-item-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.1rem;
}

.notification-item-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.notification-item-body {
    margin-top: 0.15rem;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.notification-footer {
    margin-top: 0.4rem;
    padding: 0.4rem 0.75rem 0.1rem;
    border-top: 1px solid rgba(229, 231, 235, 0.9);
}

.notification-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.78rem;
    color: var(--accent-blue);
    text-decoration: none;
}

.notification-link:hover {
    text-decoration: underline;
}

.sidebar-toggle-btn {
    width: 30px;
    height: 30px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.sidebar-toggle-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.25s ease;
}

.sidebar-toggle-btn:hover,
.sidebar-toggle-btn:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    outline: none;
}

.content-wrapper {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Cards */
.stat-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    height: 100%;
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0;
}

.stat-card.blue .stat-value {
    color: var(--accent-blue);
}

.stat-card.orange .stat-value {
    color: var(--accent-orange);
}

/* Chart Cards */
.chart-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    height: 100%;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.chart-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chart-body {
    position: relative;
    height: 300px;
}

.chart-body.large {
    height: 400px;
}

.chart-body.small {
    height: 250px;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

/* Sidebar Collapsed State */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .main-content {
    margin-left: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-nav {
    padding: 1rem 0.4rem;
}

body.sidebar-collapsed .nav-item {
    justify-content: center;
    gap: 0;
    padding: 0.75rem 0.4rem;
    border-left: none;
}

body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .user-info,
body.sidebar-collapsed .sidebar-divider,
body.sidebar-collapsed .user-details,
body.sidebar-collapsed .logout-btn span {
    display: none;
}

body.sidebar-collapsed .sidebar-header {
    padding: 1rem 0.4rem;
    justify-content: center;
}

body.sidebar-collapsed .nav-icon,
body.sidebar-collapsed .logout-btn .nav-icon {
    margin: 0;
}

body.sidebar-collapsed .sidebar-footer {
    padding: 0.75rem 0.4rem;
}

body.sidebar-collapsed .logout-btn {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-logo {
    display: none;
}

body.sidebar-collapsed .sidebar-toggle-btn svg,
.sidebar.open .sidebar-toggle-btn svg {
    transform: rotate(180deg);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    body.sidebar-collapsed .main-content {
        margin-left: 0;
    }

    .navbar-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .navbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .navbar-actions {
        margin-left: auto;
    }
}

@media (max-width: 576px) {
    .navbar-profile-info {
        display: none;
    }

    .navbar-profile {
        padding: 0.2rem;
    }
}

/* Buttons */
.btn-brand-orange {
    background: linear-gradient(135deg, var(--accent-orange) 0%, var(--accent-orange-hover) 100%);
    border: none;
    color: white;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(249, 126, 24, 0.3);
}

.btn-brand-orange:hover {
    background: linear-gradient(135deg, var(--accent-orange-hover) 0%, #d15a0f 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(249, 126, 24, 0.4);
}

.btn-brand-orange:active {
    transform: translateY(0);
}

.btn-request-detail {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    border-radius: 999px;
    border: none;
    background: var(--accent-blue);
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.85rem;
    box-shadow: 0 10px 25px rgba(8, 85, 132, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-request-detail svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

.btn-request-detail:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(8, 85, 132, 0.35);
    background: #064a6b;
    color: #fff;
}

.btn-request-detail:hover svg {
    transform: translateX(2px);
}

.table-sort-link {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-weight: 600;
}

.table-sort-link:hover {
    color: var(--accent-blue);
}

.table-sort-link .sort-indicator {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.table-sort-link .sort-indicator.muted {
    color: rgba(26, 29, 41, 0.35);
}

.table-sort-link .sort-indicator.desc {
    transform: rotate(180deg);
}

.is-muted-row {
    opacity: 0.55;
    transition: opacity 0.2s ease;
}

.is-muted-row:hover {
    opacity: 0.8;
}

.request-title-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.2s ease;
}

.request-title-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 100%;
    height: 2px;
    background: rgba(8, 85, 132, 0.4);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.2s ease;
}

.request-title-link:hover {
    color: var(--accent-blue);
}

.request-title-link:hover::after {
    transform: scaleX(1);
}

.graphic-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.graphic-status-pill.status-pending {
    background: rgba(8, 85, 132, 0.12);
    color: var(--accent-blue);
}

.graphic-status-pill.status-in_progress {
    background: rgba(249, 126, 24, 0.15);
    color: var(--accent-orange);
}

.graphic-status-pill.status-waiting_info {
    background: rgba(139, 92, 246, 0.15);
    color: #6d28d9;
}

.graphic-status-pill.status-review {
    background: rgba(14, 165, 233, 0.15);
    color: #0f172a;
}

.graphic-status-pill.status-completed {
    background: rgba(16, 185, 129, 0.18);
    color: #047857;
}

.graphic-status-pill.status-cancelled {
    background: rgba(239, 68, 68, 0.15);
    color: #b91c1c;
}

/* Utilities */
.mb-4 {
    margin-bottom: 1.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

/* Trasferte */
.table-card,
.form-card {
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.table-card .card-body,
.form-card .card-body {
    padding: 1.5rem;
}

.trip-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.trip-status-pill.status-upcoming {
    background: rgba(8, 85, 132, 0.1);
    color: var(--accent-blue);
}

.trip-status-pill.status-ongoing {
    background: rgba(249, 126, 24, 0.1);
    color: var(--accent-orange);
}

.trip-status-pill.status-completed {
    background: rgba(16, 185, 129, 0.15);
    color: #047857;
}

.trip-status-pill.status-cancelled {
    background: rgba(239, 68, 68, 0.12);
    color: #b91c1c;
}

.trip-employee-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    background: #fff;
}

.trip-employee-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-blue);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.autocomplete-wrapper {
    position: relative;
}

.mapbox-suggestions {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow-md);
    z-index: 10;
    max-height: 280px;
    overflow-y: auto;
}

.mapbox-suggestion-item {
    width: 100%;
    border: none;
    background: transparent;
    text-align: left;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.mapbox-suggestion-item:hover,
.mapbox-suggestion-item:focus {
    background: rgba(8, 85, 132, 0.08);
    outline: none;
}

.mapbox-suggestion-item + .mapbox-suggestion-item {
    border-top: 1px solid var(--border-color);
}

.suggestion-primary {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

.suggestion-secondary {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.employee-multiselect {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow-sm);
}

.employee-multiselect-list {
    max-height: 260px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.employee-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s ease;
}

.employee-option:last-child {
    border-bottom: none;
}

.employee-option:hover {
    background: rgba(8, 85, 132, 0.06);
}

.employee-option input[type="checkbox"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.employee-option .employee-name {
    font-weight: 500;
    color: var(--text-primary);
}

.employee-option.is-hidden {
    display: none;
}

.employee-role-text {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: 0.78rem;
    margin-left: 0.35rem;
}

