/* ========================================
   DISTANZA NORDFISH - Stile Nordfish
   ======================================== */

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

/* ========================================
   CSS CUSTOM PROPERTIES - Mobile Layout
   ======================================== */
:root {
    /* Layout dimensions */
    --header-height: 60px;
    --tabbar-height: 60px;

    /* Safe areas with fallbacks */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);

    /* Combined heights */
    --tabbar-total: calc(var(--tabbar-height) + var(--safe-area-bottom));
    --content-padding-bottom: var(--tabbar-total);

    /* Touch targets */
    --touch-target-min: 44px;
    --touch-target-comfortable: 48px;
}

@media (max-width: 768px) {
    :root {
        --header-height: 0px; /* Header nascosto su mobile */
    }
}

html {
    background-color: #006caa;
    overflow-x: hidden;
    overflow-y: visible;
    color-scheme: dark;
}

html, body {
    overscroll-behavior: none;  /* Previene bounce scroll su iOS/Android */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #006caa 0%, #004d7a 100%);
    min-height: 100vh;
    color: #333;
    position: relative;
    overflow-x: hidden;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(0, 108, 170, 0.3), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(232, 80, 29, 0.2), transparent 50%);
    pointer-events: none;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #006caa 0%, #004d7a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.4s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-truck {
    width: 120px;
    height: auto;
    animation: truckDrive 2.5s ease-in-out infinite;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

@keyframes truckDrive {
    0% {
        transform: translateX(-50vw) translateY(0) scaleX(-1);
        opacity: 0;
    }
    5% {
        opacity: 1;
    }
    50% {
        transform: translateX(0) translateY(-3px) scaleX(-1);
    }
    95% {
        opacity: 1;
    }
    100% {
        transform: translateX(50vw) translateY(0) scaleX(-1);
        opacity: 0;
    }
}

/* App Bar */
.app-bar {
    background: transparent;
    padding: 1.25rem 1rem;
    padding-top: calc(1.25rem + env(safe-area-inset-top));
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    height: auto;
    min-height: 60px;
    box-sizing: border-box;
}

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

.app-bar.header-hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-self: start;
}

.app-logo {
    height: 48px;
    width: auto;
}

.app-title {
    font-size: 1.3rem;
    color: white;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    text-align: center;
    white-space: nowrap;
}

.app-bar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-self: end;
}

.status-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
}

.status-item strong {
    color: #86efac;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    animation: pulse 2s ease-in-out infinite;
}

/* Failover indicator */
.failover-indicator {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.failover-system {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    transition: all 0.3s;
}

.failover-system.active {
    background: rgba(0, 120, 212, 0.5);
    color: #bfdbfe;
}

.failover-system.active.failover-mac {
    background: rgba(239, 68, 68, 0.4);
    color: #fecaca;
}

.failover-system.standby {
    background: rgba(148, 163, 184, 0.15);
    color: rgba(255, 255, 255, 0.4);
}

.failover-icon {
    flex-shrink: 0;
}

.failover-label {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
    font-size: 0.7rem;
}

.failover-separator {
    color: rgba(255, 255, 255, 0.3);
    font-weight: 400;
}

.failover-status-text {
    color: #4caf50;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    text-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}

.failover-status-text.offline {
    color: #f44336;
}

/* Failover overlay */
.failover-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
}

.failover-overlay.hidden {
    display: none;
}

.failover-card {
    background: #1e293b;
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.failover-card h2 {
    color: #f8fafc;
    margin: 1.2rem 0 0.6rem;
    font-size: 1.3rem;
}

.failover-card p {
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 0.5rem;
}

.failover-wait {
    color: #60a5fa !important;
    font-weight: 600;
    margin-top: 1rem !important;
}

.failover-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(96, 165, 250, 0.2);
    border-top-color: #60a5fa;
    border-radius: 50%;
    margin: 0 auto;
    animation: failover-spin 0.8s linear infinite;
}

@keyframes failover-spin {
    to { transform: rotate(360deg); }
}

.status-dot.online {
    background: #10b981;
}

.status-dot.offline {
    background: #ef4444;
}

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

.theme-toggle {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
}

.theme-toggle .icon-moon { display: none; }
.theme-toggle.dark .icon-sun { display: none; }
.theme-toggle.dark .icon-moon { display: block; }

/* Main Layout */
.main-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    padding-top: calc(60px + 1rem + env(safe-area-inset-top));
    max-width: 800px;
    margin: 0 auto;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
}

.column {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.column-left {
    order: 1;
    border-radius: 25px;
    overflow: hidden;
    background: #0a1e37;
}

.column-right {
    order: 3;
    border-radius: 25px;
    overflow: hidden;
    background: #0a1e37;
}

.column-center {
    order: 2;
    border-radius: 25px;
    overflow: hidden;
    background: #0a1e37;
    display: none; /* Hidden on mobile by default */
}

/* Timeline Container */
.timeline-container {
    background: rgba(15, 40, 70, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 25px;
    padding: 1.25rem;
    height: 100%;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.timeline-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 200px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
    padding: 2rem;
}

.timeline-placeholder svg {
    opacity: 0.3;
    margin-bottom: 1rem;
}

.timeline-placeholder p {
    font-size: 0.85rem;
    margin: 0;
}

.timeline-placeholder svg {
    animation: placeholderPulse 2s ease-in-out infinite;
}

@keyframes placeholderPulse {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.05);
    }
}

/* Standalone timeline in center column */
.timeline-container .vehicle-timeline {
    margin-top: 0;
    background: transparent;
    border: none;
    padding: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.timeline-container .timeline-header {
    position: sticky;
    top: 0;
    background: rgba(15, 40, 70, 0.98);
    margin: -1.25rem -1.25rem 1.5rem -1.25rem;
    padding: 1.25rem;
    border-radius: 25px 25px 0 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1;
}

/* View switch (Pianificatore/Timeline) */
.view-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    cursor: pointer;
}

.view-switch input {
    display: none;
}

.view-switch-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    transition: color 0.2s;
}

.view-switch-label.active {
    color: white;
    font-weight: 600;
}

.view-switch-slider {
    position: relative;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 11px;
    transition: background 0.2s;
}

.view-switch-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
    transform: translateX(18px);
}

.view-switch input:not(:checked) + .view-switch-slider::before {
    transform: translateX(0);
}

.view-switch input:not(:checked) + .view-switch-slider {
    background: rgba(255, 255, 255, 0.2);
}

.view-switch input:checked + .view-switch-slider {
    background: #e8501d;
}

/* Timeline Switch */
.timeline-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.4rem 0.75rem;
    background: transparent;
    border-radius: 20px;
    transition: background 0.2s ease;
}

.timeline-switch:hover {
    background: rgba(255, 255, 255, 0.05);
}

.timeline-switch .switch-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timeline-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.timeline-switch .switch-slider {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.timeline-switch .switch-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.timeline-switch input:checked + .switch-slider {
    background: #22c55e;
}

.timeline-switch input:checked + .switch-slider::before {
    transform: translateX(16px);
}

/* Switch disabilitato */
.timeline-switch.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: auto;
}

.timeline-switch.disabled .switch-slider {
    background: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
}

.timeline-switch.disabled input {
    cursor: not-allowed;
}

/* Vehicle Tabs in Header */
.header-vehicle-tabs {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-vehicle-tabs::-webkit-scrollbar {
    display: none;
}

/* Mostra solo quando timeline espansa */
body.timeline-expanded .header-vehicle-tabs {
    display: flex;
}

/* Nascondi pianificatore quando timeline attiva */
body.timeline-expanded .column-left {
    display: none !important;
}

.header-vehicle-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 24px;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.header-vehicle-tab:hover {
    background: rgba(255, 255, 255, 0.18);
    color: white;
    transform: scale(1.02);
}

.header-vehicle-tab.active {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header-vehicle-tab .tab-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.header-vehicle-tab .tab-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 0.15rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Column center - nascosta di default, visibile solo con switch attivo */
.column-center {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.column-center.expanded {
    opacity: 1;
    visibility: visible;
}

.column-center .timeline-container {
    flex: 1;
    border-radius: 25px;
}

/* Layout transitions */
.column-left,
.column-right {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.timeline-container {
    opacity: 1;
    transition: opacity 0.2s ease;
}

.column-center:not(.expanded) .timeline-container {
    opacity: 0;
}

/* Sections */
.section {
    background: rgba(15, 40, 70, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 0;
    overflow: visible;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 100%;
}

.column .section:first-child {
    border-radius: 25px 25px 0 0;
}

.column .section:last-child {
    border-radius: 0 0 25px 25px;
}

.column .section:only-child {
    border-radius: 25px;
}

.column .section:not(:first-child) {
    border-top: none;
}

/* Sezione separata (staccata dalle altre) */
.section.section-separate {
    margin-top: 1.5rem;
    border-radius: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.section.section-separate + .section {
    border-radius: 12px 12px 0 0;
    margin-top: 1.5rem;
}

.section:has(+ .section-separate) {
    border-radius: 0 0 12px 12px;
}

@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
    .section {
        background: rgba(10, 35, 65, 0.9);
    }
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.section-title svg {
    color: #e8501d;
}

.badge {
    background: #e8501d;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: auto;
}

.vrp-badge {
    display: inline-block;
    background: rgba(76, 205, 196, 0.2);
    color: #4ECDC4;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.deposito-row {
    background: rgba(232, 80, 29, 0.15) !important;
    border-left: 3px solid var(--accent);
}

.deposito-row td {
    color: rgba(255, 255, 255, 0.9);
}

.deposito-badge {
    display: inline-block;
    background: rgba(232, 80, 29, 0.3);
    color: #e8501d;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 700;
    margin-left: 0.5rem;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

/* Tabs */
.tabs-header {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 40, 70, 0.5);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.85rem 0.5rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.tab-btn svg {
    color: rgba(255, 255, 255, 0.5);
    flex-shrink: 0;
}

.tab-btn .badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    margin-left: 0;
    background: rgba(255, 255, 255, 0.2);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.85);
}

.tab-btn.active {
    color: white;
    background: rgba(232, 80, 29, 0.15);
}

.tab-btn.active svg {
    color: #e8501d;
}

.tab-btn.active .badge {
    background: #e8501d;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #e8501d;
}

/* Nascondi badge/contatori nei tab */
.tab-btn .badge {
    display: none;
}

.tab-content {
    display: none;
    opacity: 0;
}

.tab-content.active {
    display: block;
    animation: tabSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.tab-content.tab-exiting {
    display: block;
    animation: tabSlideOut 0.2s ease-out forwards;
}

/* Tab transition animations */
@keyframes tabSlideIn {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes tabSlideOut {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-10px) scale(0.98);
    }
}

/* Cards */
.card {
    background: rgba(10, 30, 55, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1rem;
    margin: 0;
    overflow-x: hidden;
    max-width: 100%;
}

.card-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

@supports (backdrop-filter: blur(10px)) or (-webkit-backdrop-filter: blur(10px)) {
    .card {
        background: rgba(0, 20, 45, 0.85);
    }
}

.card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.25rem;
    margin-bottom: 0.25rem;
}

.card-toolbar.clickable {
    cursor: pointer;
}

.toolbar-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Forms */
.input-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.input-row-secondary {
    margin-top: -0.25rem;
}

.input-spacer {
    min-width: 100px;
}

.input-group.note-group {
    flex: 0 0 120px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
    min-width: 0;
}

.input-group:not(.autocomplete-wrapper) {
    overflow: hidden;
}

.input-group.flex-1 { flex: 1; min-width: 80px; }
.input-group.flex-2 { flex: 2; min-width: 100px; }
.input-group.flex-3 { flex: 3; min-width: 150px; }
.input-group.time-group {
    flex: 0 0 auto;
    width: 90px;
}

.input-group.time-group input[type="time"] {
    padding: 0.65rem 0.4rem;
    font-size: 0.8rem;
    text-align: center;
    -webkit-appearance: none;
    background: rgba(0, 20, 45, 0.8) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
}

.input-group.time-group input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

.input-group.scarico-group {
    flex: 0 0 auto;
    width: 70px;
}

.input-group.scarico-group input {
    padding: 0.65rem 0.4rem;
    font-size: 0.8rem;
    text-align: center;
}

.input-group.veicolo-group {
    flex: 0 0 auto;
    width: 100px;
}

.input-group.veicolo-group select.placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.input-group.veicolo-group select {
    padding: 0.65rem 0.4rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.input-group label {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: rgba(0, 20, 45, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    font-size: 0.9rem;
    color: white;
    transition: all 0.2s;
    min-width: 0;
    box-sizing: border-box;
    font-family: inherit;
}

.input-group textarea {
    resize: vertical;
    min-height: 60px;
}

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    background: rgba(0, 30, 60, 0.9);
    border-color: #e8501d;
    box-shadow: 0 0 0 2px rgba(232, 80, 29, 0.2);
}

.input-row input {
    height: 42px;
}

.input-row .btn-filled {
    height: 42px;
    width: 42px;
    padding: 0;
    flex-shrink: 0;
}

/* PIN Input Row */
.pin-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.pin-input-row input {
    flex: 1;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    letter-spacing: 0.3rem;
    text-align: center;
}

.pin-input-row .btn-outlined {
    flex-shrink: 0;
}

/* Upload Zone */
.upload-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.2);
}

.last-csv-info {
    width: 100%;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding-top: 0.25rem;
}

.upload-zone-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 0;
}

.upload-zone-mini:hover {
    border-color: #e8501d;
    color: #e8501d;
    background: rgba(232, 80, 29, 0.1);
}

.export-zone-mini {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 0;
}

.export-zone-mini:hover {
    border-color: #3498db;
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.export-zone-mini.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.filter-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-wrapper:hover {
    border-color: #3498db;
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
}

.filter-wrapper select {
    background: transparent;
    border: none;
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
    cursor: pointer;
    outline: none;
    min-width: 120px;
}

.filter-wrapper select option {
    background: #1a3a5c;
    color: white;
}

/* Esporta CSV - Verde */
#exportZone {
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}

#exportZone:hover {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

/* Stampa PDF - Arancione */
#printRouteBtn {
    border-color: rgba(251, 146, 60, 0.4);
    color: #fb923c;
}

#printRouteBtn:hover {
    border-color: #f97316;
    background: rgba(251, 146, 60, 0.15);
    color: #fb923c;
}


.upload-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #e8501d;
    width: 0%;
    transition: width 0.3s ease;
}

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

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: rgba(20, 45, 75, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-height: 350px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 9999;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.15s;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: rgba(232, 80, 29, 0.3);
}

/* Buttons */
.btn-filled,
.btn-outlined,
.btn-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-filled {
    background: linear-gradient(135deg, #e8501d 0%, #d14518 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(232, 80, 29, 0.3);
}

.btn-filled:hover:not(:disabled) {
    background: linear-gradient(135deg, #f06030 0%, #e8501d 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 80, 29, 0.4);
}

.btn-filled.btn-accent {
    background: linear-gradient(135deg, #006caa 0%, #004d7a 100%);
    box-shadow: 0 2px 8px rgba(0, 108, 170, 0.3);
}

.btn-filled.btn-accent:hover:not(:disabled) {
    background: linear-gradient(135deg, #007cc2 0%, #006caa 100%);
    box-shadow: 0 4px 12px rgba(0, 108, 170, 0.4);
}

.btn-outlined {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-outlined:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.btn-text {
    background: transparent;
    color: white;
}

.btn-text:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
}

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

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.btn-icon.btn-danger {
    color: #ef4444;
}

.btn-icon.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Tables */
.table-container {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.table-scroll {
    max-height: 300px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.table-scroll-sm {
    overflow-x: auto;
    overflow-y: visible;
}

table {
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

th, td {
    padding: 0.75rem 0.5rem;
    text-align: left;
}

th {
    font-size: 0.7rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0, 60, 100, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

td {
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Colonna Nome - non spezzare */
td:nth-child(2) {
    min-width: 100px;
    white-space: nowrap;
}

/* Label sopra gli input nella tabella */
.field-label {
    display: block;
    font-size: 0.6rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0.15rem;
}

/* Colonna Indirizzo - più larga */
td.indirizzo-cell {
    min-width: 150px;
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

td strong {
    color: white;
    font-weight: 600;
}

tbody tr {
    transition: background 0.15s;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.08);
}

.empty-row td {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    padding: 2rem;
    font-style: italic;
}

/* Drag & Drop Table Styles */
.drag-handle-cell {
    width: 30px;
    padding: 0.5rem 0.25rem !important;
    text-align: center;
}

.drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: rgba(255, 255, 255, 0.3);
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.15s;
}

.drag-handle:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
}

.drag-handle:active {
    cursor: grabbing;
}

.draggable-row {
    transition: all 0.15s;
}

.draggable-row.dragging {
    opacity: 0.5;
    background: rgba(232, 80, 29, 0.2) !important;
}

.draggable-row.drag-over {
    border-top: 2px solid #e8501d !important;
    background: rgba(232, 80, 29, 0.1) !important;
}

/* Time Input Cells */
.time-cell {
    width: 85px;
    padding: 0.5rem 0.25rem !important;
}

.time-input {
    width: 100%;
    padding: 0.4rem 0.35rem !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 6px !important;
    font-size: 0.8rem !important;
    color: white !important;
    text-align: center;
    transition: all 0.15s;
}

.time-input:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.time-input:focus {
    outline: none;
    background: rgba(0, 30, 60, 0.9) !important;
    border-color: #e8501d !important;
    box-shadow: 0 0 0 2px rgba(232, 80, 29, 0.2);
}

.time-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
    cursor: pointer;
}

.time-input::-webkit-calendar-picker-indicator:hover {
    opacity: 0.8;
}

/* Actions Cell */
.actions-cell {
    min-width: 90px;
    white-space: nowrap;
    text-align: right;
    padding-right: 0.75rem !important;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5rem;
    overflow: visible;
}

/* Indirizzo Cell */
.indirizzo-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Mobile adjustments for table */
@media (max-width: 768px) {
    .drag-handle-cell {
        width: 24px;
        padding: 0.4rem 0.15rem !important;
    }

    .time-cell {
        width: 60px;
        padding: 0.4rem 0.15rem !important;
    }

    .time-input {
        font-size: 0.7rem !important;
        padding: 0.3rem 0.2rem !important;
    }

    .indirizzo-cell {
        max-width: 100px;
        font-size: 0.75rem;
    }

    .actions-cell {
        width: 50px;
        padding: 0.4rem 0.25rem !important;
    }

    /* Hide address column on mobile */
    .hide-mobile {
        display: none;
    }
}

/* ========================================
   MOBILE CARD LAYOUT - Tabella Punti
   ======================================== */
@media (max-width: 600px) {
    /* Nasconde header tabella punti su mobile */
    .table-scroll-sm table thead {
        display: none;
    }

    /* Contenitore tabella senza scroll */
    .table-scroll-sm {
        max-height: none;
        overflow: visible;
    }

    /* Tabella come container flex */
    .table-scroll-sm table {
        display: block;
    }

    .table-scroll-sm tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Trasforma righe in card */
    .table-scroll-sm tbody tr:not(.empty-row) {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        background: rgba(15, 35, 60, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 12px;
        padding: 1rem;
        padding-top: 0.75rem;
        position: relative;
        row-gap: 0.25rem;
    }

    /* Stile card per deposito */
    .table-scroll-sm tbody tr.deposito-row {
        background: rgba(232, 80, 29, 0.15);
        border-color: rgba(232, 80, 29, 0.4);
    }

    /* Reset stili celle */
    .table-scroll-sm tbody td {
        display: block;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
    }

    /* Drag handle - in alto a destra */
    .table-scroll-sm tbody td.drag-handle-cell {
        position: absolute;
        top: 0.75rem;
        right: 0.75rem;
        width: 44px !important;
    }

    .table-scroll-sm .drag-handle {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.1);
        border-radius: 8px;
    }

    /* Nome punto - prima riga, prominente */
    .table-scroll-sm tbody td:nth-child(2) {
        order: 1;
        width: calc(100% - 60px);
        font-size: 1.05rem;
        font-weight: 700;
        color: white;
        margin-bottom: 0.25rem;
        line-height: 1.3;
    }

    /* Indirizzo - seconda riga, mostrato su mobile */
    .table-scroll-sm tbody td.hide-mobile {
        display: block !important;
        order: 2;
        width: 100%;
        font-size: 0.85rem;
        color: rgba(255, 255, 255, 0.6);
        margin-bottom: 0.5rem;
        padding-bottom: 0.5rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        max-width: none;
    }

    /* Container per orari */
    .table-scroll-sm tbody td.time-cell {
        order: 3;
        display: inline-flex !important;
        align-items: center;
        gap: 0.5rem;
        flex-shrink: 0;
    }

    .table-scroll-sm tbody td.time-cell::before {
        font-size: 0.8rem;
        color: rgba(255, 255, 255, 0.5);
        font-weight: 500;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .table-scroll-sm tbody td.time-cell:nth-of-type(4)::before {
        content: "Dalle";
    }

    .table-scroll-sm tbody td.time-cell:nth-of-type(5)::before {
        content: "Alle";
    }

    /* Time input più grandi e leggibili */
    .table-scroll-sm .time-input {
        width: 70px !important;
        min-width: 70px !important;
        height: 44px !important;
        font-size: 1rem !important;
        padding: 0.4rem 0.5rem !important;
        text-align: center;
        flex-shrink: 0;
    }

    /* Nasconde l'icona del time picker per più spazio */
    .table-scroll-sm .time-input::-webkit-calendar-picker-indicator {
        display: none;
    }

    /* Actions - alla fine della riga orari */
    .table-scroll-sm tbody td.actions-cell {
        order: 3;
        display: flex !important;
        align-items: center;
        gap: 0.5rem;
        margin-left: auto;
        padding: 0 !important;
        border: none !important;
        width: auto !important;
    }

    /* Bottoni azioni */
    .table-scroll-sm tbody .btn-icon {
        width: 44px !important;
        height: 44px !important;
        background: rgba(255, 255, 255, 0.08);
        border-radius: 10px;
        flex-shrink: 0;
    }

    .table-scroll-sm tbody .btn-icon:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .table-scroll-sm tbody .btn-icon.btn-danger {
        background: rgba(239, 68, 68, 0.12);
    }

    .table-scroll-sm tbody .btn-icon.btn-danger:hover {
        background: rgba(239, 68, 68, 0.25);
    }

    /* Empty row - stile normale */
    .table-scroll-sm tbody tr.empty-row {
        display: block;
        background: transparent;
        border: none;
        padding: 2rem;
        text-align: center;
    }

    .table-scroll-sm tbody tr.empty-row td {
        display: inline;
    }
}

/* Schermi molto piccoli - layout verticale per orari */
@media (max-width: 380px) {
    .table-scroll-sm tbody tr:not(.empty-row) {
        row-gap: 0.5rem;
    }

    .table-scroll-sm tbody td.time-cell {
        flex: 1 1 45%;
    }

    .table-scroll-sm tbody td.actions-cell {
        order: 4;
        width: 100% !important;
        justify-content: flex-end;
        margin-top: 0.5rem;
        padding-top: 0.5rem !important;
        border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
    }

    .table-scroll-sm .time-input {
        width: 65px !important;
        min-width: 65px !important;
    }
}

/* Map Container */
.map-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    flex: 1;
}

.map-container #map {
    height: 100%;
    min-height: 400px;
}

/* Bottone back mappa (solo mobile) */
.map-back-btn {
    display: none;
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 600;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 8px;
    width: 44px;
    height: 44px;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.map-back-btn svg {
    color: #333;
}

.map-back-btn:active {
    transform: scale(0.95);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Bottone toggle traffico sulla mappa */
.map-traffic-btn {
    background: #fff;
    border: none;
    border-radius: 4px;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    margin: 10px 10px 0 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s, box-shadow 0.2s;
}

.map-traffic-btn:hover {
    opacity: 1;
}

.map-traffic-btn.active {
    opacity: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), inset 0 0 0 2px #E8501D;
}

.map-legend {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(20, 45, 75, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: white;
    z-index: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.map-legend:empty {
    display: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

/* Action Bar */
.action-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.action-bar .btn-filled:first-child {
    flex: 1;
}

.departure-date-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 8px 12px;
    background: var(--bg-card, #1a2332);
    border: 1px solid var(--border-color, #2a3a4a);
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

.departure-date-row.has-date {
    border-color: var(--accent, #E8501D);
    background: rgba(232, 80, 29, 0.06);
}

.departure-date-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-muted, #8899aa);
    white-space: nowrap;
    flex-shrink: 0;
}

.departure-date-row.has-date .departure-date-label {
    color: var(--accent, #E8501D);
}

.departure-date-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.departure-date-input-wrap input[type="date"] {
    background: transparent !important;
    border: none;
    border-radius: 0;
    color: #fff !important;
    font-size: 0.9rem;
    font-family: inherit;
    padding: 0.65rem 0.85rem;
    min-height: 36px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    -webkit-text-fill-color: #fff;
}

.departure-date-input-wrap input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.6);
    cursor: pointer;
    padding: 4px;
}

.departure-date-row.has-date .departure-date-input-wrap input[type="date"] {
    border-color: var(--accent, #E8501D);
}

.departure-date-hint {
    font-size: 0.8rem;
    color: var(--text-muted, #8899aa);
    white-space: nowrap;
    flex-shrink: 0;
}

.departure-date-row.has-date .departure-date-hint {
    color: var(--accent, #E8501D);
    font-weight: 600;
}

.btn-clear-date {
    background: none;
    border: none;
    color: var(--text-muted, #999);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-clear-date:hover {
    color: var(--danger, #e74c3c);
}

/* Results Box */
.results-box {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.results-info {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.75rem;
}

/* Collapsible */
.collapsible .chevron {
    transition: transform 0.25s ease;
    color: rgba(255, 255, 255, 0.5);
}

.collapsible .card-body.collapsed {
    display: none;
}

.collapsible.open .chevron {
    transform: rotate(180deg);
}

.collapsible.open .card-body.collapsed {
    display: block;
}

/* Quick Config */
.quick-config {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.quick-config .input-group {
    flex: 1;
    min-width: 70px;
}

.quick-config input {
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
}

/* VRP Config Table */
#vrpConfigTable input[type="number"],
#vrpConfigTable input[type="checkbox"] {
    width: 55px;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

#vrpConfigTable input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

/* Veicoli List */
.veicoli-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.veicolo-card {
    background: rgba(5, 25, 50, 0.9);
    border-radius: 10px;
    padding: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s;
}

.veicolo-card:hover {
    border-color: rgba(232, 80, 29, 0.6);
    background: rgba(10, 35, 65, 0.95);
}

.veicolo-card.inactive {
    opacity: 0.5;
}

.veicolo-card.auto-generated {
    border-color: rgba(251, 191, 36, 0.5);
    background: rgba(15, 25, 45, 0.9);
}

.veicolo-card.auto-generated .veicolo-name {
    color: #fbbf24;
}

.auto-generated-note {
    font-size: 0.7rem;
    color: #fbbf24;
    opacity: 0.8;
    margin-bottom: 0.5rem;
    font-style: italic;
}

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

.veicolo-name {
    font-weight: 700;
    color: #e8501d;
    font-size: 0.95rem;
}

.veicolo-info {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.veicolo-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.65rem;
}

.veicolo-actions .btn-outlined {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    flex: 1;
}

.btn-danger {
    color: #ef4444 !important;
    border-color: #ef4444 !important;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2) !important;
}

/* Percorsi Salvati - Nuovo Design Mobile-First */
.percorsi-container {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-height: 200px;
}

.percorsi-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
}

.percorsi-empty svg {
    margin-bottom: 1rem;
    opacity: 0.5;
}

.percorsi-empty p {
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.25rem;
}

.percorsi-empty span {
    font-size: 0.8rem;
}

.percorso-card {
    background: linear-gradient(135deg, rgba(15, 40, 70, 0.95) 0%, rgba(5, 25, 50, 0.98) 100%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    overflow: hidden;
    transition: all 0.25s ease;
}

.percorso-card:active {
    transform: scale(0.98);
}

.percorso-card-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.percorso-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #e8501d 0%, #d14518 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.percorso-icon svg {
    color: white;
}

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

.percorso-nome {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.35rem;
    line-height: 1.2;
}

.percorso-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.percorso-meta-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.percorso-meta-item svg {
    width: 12px;
    height: 12px;
    opacity: 0.7;
}

.percorso-punti-count {
    background: rgba(232, 80, 29, 0.2);
    color: #e8501d;
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}

.percorso-preview {
    padding: 0 1.25rem;
    margin-bottom: 0.75rem;
}

.percorso-preview-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    max-height: 120px;
    overflow-y: auto;
}

.percorso-preview-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.75);
}

.percorso-preview-dot {
    width: 8px;
    height: 8px;
    background: #e8501d;
    border-radius: 50%;
    flex-shrink: 0;
}

.percorso-preview-item:first-child .percorso-preview-dot {
    background: #10b981;
}

.percorso-preview-item:last-child .percorso-preview-dot {
    background: #ef4444;
}

.percorso-actions {
    display: flex;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.percorso-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
}

.percorso-action-btn:first-child {
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.percorso-action-btn:hover,
.percorso-action-btn:active {
    background: rgba(255, 255, 255, 0.08);
}

.percorso-action-btn.primary {
    color: #e8501d;
}

.percorso-action-btn.primary:hover,
.percorso-action-btn.primary:active {
    background: rgba(232, 80, 29, 0.15);
}

.percorso-action-btn.danger {
    color: #ef4444;
}

.percorso-action-btn.danger:hover,
.percorso-action-btn.danger:active {
    background: rgba(239, 68, 68, 0.15);
}

.percorso-action-btn svg {
    width: 16px;
    height: 16px;
}

/* Save Route Inline */
.save-route-inline {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.15);
}

.save-route-inline input {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 20, 45, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    font-size: 0.85rem;
    color: white;
}

.save-route-inline input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.8rem;
}

.save-route-inline input:focus {
    outline: none;
    border-color: #e8501d;
}

/* Toggle */
.toggle {
    position: relative;
    width: 40px;
    height: 22px;
    cursor: pointer;
}

.toggle input {
    display: none;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 11px;
    transition: all 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s;
}

.toggle input:checked + .toggle-slider {
    background: #10b981;
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* VRP Summary */
.vrp-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.summary-item {
    text-align: center;
    padding: 1rem 0.75rem;
    background: rgba(15, 35, 60, 0.8);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.summary-item.warning .summary-value {
    color: #f59e0b;
}

.summary-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #e8501d;
    display: block;
    line-height: 1.2;
}

.summary-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* VRP Filter */
.vrp-filter {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(15, 35, 60, 0.5);
    border-radius: 8px;
}

.vrp-filter label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.vrp-filter select {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: white;
    font-size: 0.85rem;
}

.vrp-filter select option {
    background: #1a3a5c;
    color: white;
}

/* Route Accordion */
.route-accordion {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    margin-bottom: 0.65rem;
    background: rgba(15, 35, 60, 0.6);
}

.route-accordion:hover {
    border-color: rgba(232, 80, 29, 0.4);
}

.route-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 1rem;
    background: rgba(0, 108, 170, 0.2);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.15s;
    border-radius: 8px 8px 0 0;
}

.route-content.hidden + .route-header,
.route-accordion:not(:has(.route-content:not(.hidden))) .route-header {
    border-radius: 8px;
}

.route-header:hover {
    background: rgba(0, 108, 170, 0.3);
}

.route-vehicle {
    font-weight: 700;
    color: white;
}

.route-summary {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

.route-toggle {
    font-weight: bold;
    color: #e8501d;
    width: 20px;
    text-align: center;
}

.route-content {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    background: rgba(0, 0, 0, 0.1);
}

.route-content.hidden {
    display: none;
}

.route-table-wrapper {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.route-steps-table {
    font-size: 0.85rem;
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.route-steps-table thead {
    position: sticky;
    top: 0;
    z-index: 1;
}

.route-steps-table th,
.route-steps-table td {
    white-space: nowrap;
    padding: 0.5rem 0.75rem;
}

.route-steps-table th {
    font-size: 0.65rem;
    background: #1a1a2e;
    border-bottom: 2px solid var(--primary);
}

.route-steps-table td:nth-child(3) {
    white-space: normal;
    max-width: 200px;
}

.route-steps-table .note-cell {
    white-space: normal;
    max-width: 180px;
    font-size: 0.75rem;
    color: #adb5bd;
}

.route-steps-table .real-time-cell {
    background: rgba(255, 255, 255, 0.03);
    min-width: 60px;
    color: #6c757d;
    font-style: italic;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: rgba(30, 58, 95, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 1.5rem;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalEnter 0.3s ease;
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-small {
    max-width: 350px;
    text-align: center;
}

.modal h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

.modal-subtitle {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 1.25rem;
    font-weight: 500;
    color: white;
}

.modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-icon.success {
    background: rgba(16, 185, 129, 0.4);
    color: #d1fae5;
}

.modal-icon.error {
    background: rgba(239, 68, 68, 0.4);
    color: #fecaca;
}

.modal-icon.warning {
    background: rgba(245, 158, 11, 0.4);
    color: #fef3c7;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #e8501d;
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

.modal p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.modal-small .modal-actions {
    justify-content: center;
}

/* Modal header with reorder buttons */
.modal-header-with-reorder {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.modal-header-with-reorder h3 {
    margin: 0;
}

.reorder-buttons {
    display: flex;
    gap: 0.35rem;
}

.btn-reorder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-reorder:hover:not(:disabled) {
    background: rgba(0, 108, 170, 0.2);
    border-color: rgba(0, 108, 170, 0.4);
    color: #5eb8ff;
}

.btn-reorder:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Network files list */
.network-files-list {
    max-height: 300px;
    overflow-y: auto;
    margin: -0.5rem;
}

.network-file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.network-file-item:hover {
    background: rgba(0, 108, 170, 0.15);
}

.network-file-name {
    font-weight: 500;
    color: white;
}

.network-file-date {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

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

.form-grid .full-width {
    grid-column: 1 / -1;
}

/* Input hint */
.input-hint {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
    font-style: italic;
}

/* Time range inline */
.time-range {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.time-range input {
    flex: 1;
}

.time-range span {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

/* Orario badge nella lista punti */
.orario-badge {
    display: inline-block;
    background: rgba(0, 108, 170, 0.25);
    color: #4ECDC4;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Orario highlight nei risultati VRP */
.step-orario {
    font-weight: 700;
    color: #4ECDC4;
}

.step-orario.in-time {
    color: #10b981;
}

.step-orario.late {
    color: #f59e0b;
}

.step-orario.early {
    color: #60a5fa;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: rgba(15, 35, 60, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: toast-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 380px;
    min-width: 280px;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.toast-success::before { background: #22c55e; }
.toast-error::before { background: #ef4444; }
.toast-warning::before { background: #f59e0b; }
.toast-info::before { background: #3b82f6; }

.toast-success { border-color: rgba(34, 197, 94, 0.3); }
.toast-error { border-color: rgba(239, 68, 68, 0.3); }
.toast-warning { border-color: rgba(245, 158, 11, 0.3); }
.toast-info { border-color: rgba(59, 130, 246, 0.3); }

.toast.toast-out {
    animation: toast-out 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.toast-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-icon svg {
    width: 100%;
    height: 100%;
}

.toast-success .toast-icon { color: #22c55e; }
.toast-error .toast-icon { color: #ef4444; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info .toast-icon { color: #3b82f6; }

.toast-message {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.95);
    line-height: 1.4;
    flex: 1;
    font-weight: 500;
}

.toast-close {
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.15s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.toast-close svg {
    width: 16px;
    height: 16px;
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

/* Utilities */
.hidden {
    display: none !important;
}

.empty-text {
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
    padding: 1.5rem;
    font-size: 0.9rem;
}

/* Scrollbar - nascosta di default, visibile solo su hover */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 2px;
}

/* Mostra scrollbar solo su hover del container */
.table-scroll:hover::-webkit-scrollbar-thumb,
.table-scroll-sm:hover::-webkit-scrollbar-thumb,
.veicoli-list:hover::-webkit-scrollbar-thumb,
.autocomplete-dropdown:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.table-scroll:hover,
.table-scroll-sm:hover,
.veicoli-list:hover,
.autocomplete-dropdown:hover {
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}

/* Responsive */
@media (min-width: 1100px) {
    /* Default: 2 colonne (pianificatore | mappa) - timeline nascosta */
    .main-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        max-width: 100%;
        width: 100%;
        padding: 0 0.75rem 0.5rem;
        padding-top: calc(60px + 0.5rem);
        height: 100vh;
        box-sizing: border-box;
        overflow: hidden;
        transition: grid-template-columns 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Timeline nascosta nel grid normale */
    .main-layout .column-center {
        display: none;
    }

    /* Quando timeline attiva: 2 colonne (timeline | mappa) - stesse dimensioni pianificatore */
    .main-layout:has(.column-center.expanded) {
        grid-template-columns: 1fr 1fr;
    }

    .main-layout:has(.column-center.expanded) .column-center {
        display: flex;
        opacity: 1;
        visibility: visible;
    }

    .main-layout:has(.column-center.expanded) .column-left {
        display: none;
    }

    .column-left {
        order: unset;
        min-width: 0;
        height: calc(100vh - 60px - 1rem);
        overflow: hidden;
    }

    /* Section normale con scroll per tutte le tab */
    .column-left .section {
        flex: 1;
        overflow-y: auto;
    }

    /* Solo quando pianificatore è attivo: layout flex per riempire spazio */
    .column-left .section:has(#tab-pianificatore.active) {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #tab-pianificatore.active {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow: hidden;
    }

    #tab-pianificatore.active > .card:last-of-type {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #tab-pianificatore .punti-wrapper {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    #tab-pianificatore .punti-cards-container {
        flex: 1;
        max-height: none;
        overflow-y: auto;
    }

    .column-center.expanded {
        order: unset;
        min-width: 0;
        height: calc(100vh - 60px - 1rem);
    }

    .column-right {
        order: unset;
        min-width: 0;
        height: calc(100vh - 60px - 1rem);
    }

    .map-container {
        height: 100%;
    }

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

    /* Tabella più compatta su desktop */
    table {
        font-size: 0.8rem;
    }

    th, td {
        padding: 0.5rem 0.4rem;
    }

    .field-label {
        font-size: 0.55rem;
    }

    .time-input {
        font-size: 0.75rem !important;
        padding: 0.35rem 0.4rem !important;
        width: 65px !important;
    }
}

/* Timeline header responsive */
@media (min-width: 1100px) and (max-width: 1399px) {
    .timeline-container .timeline-header {
        flex-wrap: wrap;
    }

    .timeline-container .timeline-summary {
        width: 100%;
        margin-left: 0;
        margin-top: 0.5rem;
    }
}

/* ========================================
   OTTIMIZZAZIONE 1366x768 (laptop 16:9/4:3)
   ======================================== */
@media (min-width: 1100px) and (max-width: 1440px) and (max-height: 900px) {
    /* Layout principale più compatto */
    .main-layout {
        padding: 0.75rem;
        padding-top: calc(50px + 0.75rem);
        gap: 0.75rem;
    }

    /* Header più compatto */
    .app-bar {
        min-height: 50px;
        padding: 0.75rem 1rem;
    }

    /* Colonne con altezza ottimizzata */
    .column-left,
    .column-center.expanded,
    .column-right {
        max-height: calc(100vh - 50px - 1.5rem);
    }

    /* Card più compatte */
    .card {
        padding: 0.75rem;
        border-radius: 8px;
    }

    .card-header {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    /* Sezione tabs */
    .section {
        margin-bottom: 0.5rem;
    }

    .tabs-header {
        padding: 0.25rem;
        gap: 0.25rem;
        margin-bottom: 0.5rem;
    }

    .tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .tab-btn svg {
        width: 14px;
        height: 14px;
    }

    /* Tabella punti super compatta */
    .punti-table {
        font-size: 0.72rem;
    }

    .punti-table th {
        padding: 0.35rem 0.3rem;
        font-size: 0.6rem;
    }

    .punti-table td {
        padding: 0.35rem 0.3rem;
    }

    .punti-table .col-name {
        max-width: 100px;
        font-size: 0.72rem;
    }

    .punti-table .col-address {
        max-width: 150px;
        font-size: 0.68rem;
    }

    .punti-table .col-vehicle {
        width: 70px;
    }

    .punti-table .col-window {
        width: 85px;
    }

    .punti-table .col-arrival {
        width: 40px;
        font-size: 0.68rem;
    }

    .punti-table .col-scarico {
        width: 45px;
    }

    .punti-table .col-note {
        max-width: 80px;
        font-size: 0.65rem;
    }

    .punti-table .col-metrics {
        width: 100px;
    }

    .punti-table .col-actions {
        width: 50px;
    }

    /* Badge veicolo più compatto */
    .vehicle-badge-clickable {
        padding: 0.15rem 0.35rem;
        font-size: 0.6rem;
        gap: 0.15rem;
    }

    .vehicle-badge-clickable .lock-icon {
        width: 8px;
        height: 8px;
    }

    /* Chips più compatti */
    .time-chip-editable,
    .scarico-chip-editable {
        padding: 0.15rem 0.35rem;
        font-size: 0.65rem;
    }

    .data-chip {
        padding: 0.1rem 0.3rem;
        font-size: 0.6rem;
    }

    /* Bottoni azioni più piccoli */
    .btn-icon-sm {
        padding: 0.15rem;
    }

    .btn-icon-sm svg {
        width: 12px;
        height: 12px;
    }

    /* Form aggiungi punto compatto */
    .add-punto-form {
        gap: 0.5rem;
        padding: 0.5rem;
    }

    .add-punto-form input {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .add-punto-form .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.75rem;
    }

    /* Vehicle tabs header compatti */
    .header-vehicle-tabs {
        gap: 0.35rem;
    }

    .header-vehicle-tab {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        gap: 0.4rem;
    }

    .header-vehicle-tab .tab-color {
        width: 10px;
        height: 10px;
    }

    .header-vehicle-tab .tab-count {
        padding: 0.1rem 0.4rem;
        font-size: 0.65rem;
    }

    /* Timeline compatta */
    .timeline-container {
        padding: 0.5rem;
    }

    .timeline-header {
        padding: 0.5rem;
        margin-bottom: 0.5rem;
    }

    .timeline-vehicle-name {
        font-size: 0.85rem;
    }

    .timeline-summary-item {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }

    .timeline-item {
        padding: 0.5rem;
        padding-left: 2rem;
        margin-bottom: 0.5rem;
    }

    .timeline-dot {
        width: 10px;
        height: 10px;
        left: 0.35rem;
    }

    .timeline-time {
        font-size: 0.7rem;
    }

    .timeline-name {
        font-size: 0.75rem;
    }

    .timeline-address {
        font-size: 0.65rem;
    }

    .timeline-meta span {
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
    }

    /* Switch timeline compatto */
    .timeline-switch {
        gap: 0.4rem;
    }

    .timeline-switch .switch-label {
        font-size: 0.7rem;
    }

    .timeline-switch .switch-slider {
        width: 32px;
        height: 18px;
    }

    .timeline-switch .switch-slider::before {
        width: 14px;
        height: 14px;
    }

    /* Mappa */
    .map-container {
        border-radius: 8px;
    }

    /* Modal più compatto */
    .modal {
        max-width: 450px;
        max-height: 85vh;
    }

    .modal-header,
    .modal-header-with-reorder {
        padding: 0.75rem 1rem;
    }

    .modal-body {
        padding: 0.75rem 1rem;
    }

    .modal-footer {
        padding: 0.5rem 1rem;
    }

    .form-group {
        margin-bottom: 0.6rem;
    }

    .form-group label {
        font-size: 0.7rem;
        margin-bottom: 0.25rem;
    }

    .form-group input,
    .form-group select {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* ========================================
   OTTIMIZZAZIONE SCHERMI 4:3 (1024x768, 1280x960)
   ======================================== */
@media (min-width: 1000px) and (max-width: 1300px) and (min-aspect-ratio: 1/1) and (max-aspect-ratio: 4/3) {
    /* Layout: colonne più strette per 4:3 */
    .main-layout {
        padding: 0.5rem;
        padding-top: calc(48px + 0.5rem);
        gap: 0.5rem;
    }

    /* Header super compatto */
    .app-bar {
        min-height: 48px;
        padding: 0.5rem 0.75rem;
    }

    .timeline-switch .switch-label {
        display: none;
    }

    /* Colonne */
    .column-left,
    .column-center.expanded,
    .column-right {
        max-height: calc(100vh - 48px - 1rem);
    }

    /* Card compatte */
    .card {
        padding: 0.5rem;
        border-radius: 6px;
    }

    .card-header {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Tabs più stretti */
    .tabs-header {
        padding: 0.2rem;
        gap: 0.2rem;
        margin-bottom: 0.4rem;
    }

    .tab-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
    }

    .tab-btn span:not(.badge) {
        display: none;
    }

    .tab-btn svg {
        margin-right: 0;
    }

    /* Tabella molto compatta */
    .punti-table {
        font-size: 0.68rem;
    }

    .punti-table th {
        padding: 0.3rem 0.25rem;
        font-size: 0.55rem;
    }

    .punti-table td {
        padding: 0.3rem 0.25rem;
    }

    .punti-table .col-name {
        max-width: 80px;
        font-size: 0.68rem;
    }

    .punti-table .col-address {
        max-width: 120px;
        font-size: 0.62rem;
    }

    .punti-table .col-vehicle {
        width: 60px;
    }

    .punti-table .col-window {
        width: 75px;
    }

    .punti-table .col-arrival {
        width: 35px;
        font-size: 0.62rem;
    }

    .punti-table .col-scarico {
        width: 40px;
    }

    .punti-table .col-note {
        max-width: 70px;
        font-size: 0.6rem;
    }

    .punti-table .col-metrics {
        width: 80px;
    }

    .punti-table .col-actions {
        width: 45px;
    }

    /* Badge veicolo molto compatto */
    .vehicle-badge-clickable {
        padding: 0.1rem 0.25rem;
        font-size: 0.55rem;
        gap: 0.1rem;
    }

    .vehicle-badge-clickable .lock-icon {
        width: 7px;
        height: 7px;
    }

    /* Chips molto compatti */
    .time-chip-editable,
    .scarico-chip-editable {
        padding: 0.1rem 0.25rem;
        font-size: 0.58rem;
    }

    .time-chip-editable .edit-icon-mini,
    .scarico-chip-editable .edit-icon-mini {
        width: 9px;
        height: 9px;
    }

    .data-chip {
        padding: 0.08rem 0.2rem;
        font-size: 0.55rem;
    }

    .data-chip .data-label {
        font-size: 0.5rem;
    }

    /* Bottoni azioni mini */
    .btn-icon-sm {
        padding: 0.1rem;
    }

    .btn-icon-sm svg {
        width: 11px;
        height: 11px;
    }

    /* Form compatto */
    .add-punto-form {
        gap: 0.4rem;
        padding: 0.4rem;
    }

    .add-punto-form input {
        padding: 0.35rem 0.4rem;
        font-size: 0.7rem;
    }

    .add-punto-form .btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }

    /* Vehicle tabs header mini */
    .header-vehicle-tabs {
        gap: 0.25rem;
    }

    .header-vehicle-tab {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
        gap: 0.35rem;
    }

    .header-vehicle-tab .tab-color {
        width: 9px;
        height: 9px;
    }

    .header-vehicle-tab .tab-count {
        padding: 0.08rem 0.35rem;
        font-size: 0.6rem;
    }

    /* Timeline compatta */
    .timeline-container {
        padding: 0.4rem;
    }

    .timeline-header {
        padding: 0.4rem;
        margin-bottom: 0.4rem;
    }

    .timeline-vehicle-name {
        font-size: 0.8rem;
    }

    .timeline-summary-item {
        font-size: 0.6rem;
        padding: 0.15rem 0.3rem;
    }

    .timeline-item {
        padding: 0.4rem;
        padding-left: 1.75rem;
        margin-bottom: 0.4rem;
    }

    .timeline-dot {
        width: 9px;
        height: 9px;
        left: 0.3rem;
    }

    .timeline-time {
        font-size: 0.65rem;
    }

    .timeline-name {
        font-size: 0.7rem;
    }

    .timeline-address {
        font-size: 0.6rem;
    }

    .timeline-meta span {
        font-size: 0.55rem;
        padding: 0.08rem 0.25rem;
    }

    /* Modal per 4:3 */
    .modal {
        max-width: 400px;
        max-height: 80vh;
    }

    .modal-header,
    .modal-header-with-reorder {
        padding: 0.6rem 0.75rem;
    }

    .modal-body {
        padding: 0.6rem 0.75rem;
    }

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

    .form-group label {
        font-size: 0.65rem;
    }

    .form-group input,
    .form-group select {
        padding: 0.35rem 0.4rem;
        font-size: 0.75rem;
    }
}

/* Fallback per 1024x768 specifico */
@media (max-width: 1100px) and (min-width: 1000px) {
    .main-layout {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 1100px) {
    .map-container #map {
        min-height: 300px;
    }
}

/* Viewport intermedi: tabs con solo icone */
@media (max-width: 1500px) and (min-width: 769px) {
    .tab-btn {
        flex: 1;
        padding: 0.75rem 0.4rem;
        justify-content: center;
    }

    .tab-btn span:not(.badge) {
        display: none;
    }

    .tab-btn .badge {
        position: absolute;
        top: 4px;
        right: 4px;
        padding: 0.1rem 0.35rem;
        font-size: 0.6rem;
        min-width: 16px;
    }

    .tab-btn svg {
        margin-right: 0;
    }
}

@media (max-width: 768px) {
    /* Nascondi completamente l'header su mobile */
    .app-bar {
        display: none;
    }

    .main-layout {
        padding: 0;
        padding-top: env(safe-area-inset-top);
        gap: 0;
    }

    .card {
        padding: 0.85rem;
    }

    .vrp-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .input-group.flex-2,
    .input-group.flex-3 {
        flex: 1;
        min-width: 45%;
    }
}

/* Toggle button nascosto su desktop */
.input-row-toggle {
    display: none;
}

@media (max-width: 500px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        max-width: 100vw;
        overscroll-behavior: none;  /* Previene bounce/elastic scroll */
    }

    .main-layout {
        padding: 0.5rem;
        padding-top: calc(0.5rem + env(safe-area-inset-top));
        gap: 0.75rem;
        max-width: 100vw;
    }

    .card {
        padding: 0.75rem;
    }

    /* Form mobile semplificato - layout verticale */
    .input-row {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    /* Tutti i campi full width */
    .input-group.flex-2,
    .input-group.flex-3 {
        flex: none;
        width: 100%;
        min-width: unset;
    }

    /* Orari affiancati */
    .input-row .time-group {
        width: calc(50% - 0.375rem);
        display: inline-block;
    }

    .input-row .time-group:first-of-type {
        margin-right: 0.75rem;
    }

    /* Bottone aggiungi prominente */
    .input-row .btn-filled {
        width: 100%;
        height: var(--touch-target-comfortable);
        padding: 0.85rem;
        font-size: 1rem;
        margin-top: 0.5rem;
    }

    /* Toggle button per campi opzionali - più visibile */
    .input-row-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        width: 100%;
        padding: 0.75rem;
        background: rgba(255, 255, 255, 0.05);
        border: 1px dashed rgba(255, 255, 255, 0.25);
        border-radius: 10px;
        color: rgba(255, 255, 255, 0.7);
        font-size: 0.85rem;
        cursor: pointer;
        transition: all 0.2s;
        min-height: var(--touch-target-min);
    }

    .input-row-toggle:active {
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .input-row-toggle svg {
        transition: transform 0.2s;
    }

    .input-row.expanded .input-row-toggle svg {
        transform: rotate(180deg);
    }

    .input-row.expanded .input-row-toggle span {
        display: none;
    }

    .input-row.expanded .input-row-toggle::after {
        content: 'Nascondi dettagli';
    }

    /* Campi opzionali nascosti di default su mobile */
    .input-row:not(.expanded) .time-group,
    .input-row:not(.expanded) .scarico-group,
    .input-row:not(.expanded) .veicolo-group,
    .input-row:not(.expanded) .input-group.flex-2:nth-of-type(n+3) {
        display: none;
    }

    /* Mostra campi quando espanso */
    .input-row.expanded .time-group {
        display: inline-block;
    }

    .input-row.expanded .input-group.flex-2:nth-of-type(n+3) {
        display: block;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Action bar - layout gerarchico */
    .action-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 0.6rem;
        align-items: center;
    }

    .action-bar .btn-filled:first-child {
        flex: 0 0 100%;
        height: 50px;
        font-size: 0.95rem;
        border-radius: 10px;
    }

    /* Riga secondaria: toggle a sinistra, cestino a destra */
    .action-bar .timeline-switch {
        order: 1;
    }

    .action-bar .btn-icon.btn-danger {
        order: 2;
        margin-left: auto;
        width: 44px;
        height: 44px;
        border-radius: 10px;
        background: rgba(239, 68, 68, 0.15);
        border: 1px solid rgba(239, 68, 68, 0.3);
    }

    .action-bar .btn-icon.btn-danger:hover {
        background: rgba(239, 68, 68, 0.25);
    }

    /* Upload inline - pulsanti più grandi e leggibili */
    .upload-inline {
        display: flex;
        justify-content: space-around;
        gap: 0.5rem;
        padding: 0.75rem 0;
    }

    .upload-zone-mini,
    .export-zone-mini {
        flex: 1;
        min-width: 0;
        max-width: 100px;
        min-height: 70px;
        padding: 0.6rem 0.4rem;
        font-size: 0.75rem;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 0.35rem;
        border-radius: 10px;
    }

    .upload-zone-mini svg,
    .export-zone-mini svg {
        width: 20px;
        height: 20px;
    }

    .upload-zone-mini span,
    .export-zone-mini span {
        font-size: 0.65rem;
        font-weight: 600;
        text-align: center;
        line-height: 1.2;
    }

    .modal {
        padding: 1.25rem;
        margin: 0.5rem;
        border-radius: 16px;
    }

    .section-title {
        padding: 0.85rem 1rem;
        font-size: 0.7rem;
    }

    th, td {
        padding: 0.5rem 0.35rem;
        font-size: 0.8rem;
    }

    th {
        font-size: 0.65rem;
    }

    .vrp-summary {
        gap: 0.5rem;
        grid-template-columns: repeat(2, 1fr);
    }

    .summary-item {
        padding: 0.75rem 0.5rem;
    }

    .summary-value {
        font-size: 1.4rem;
    }

    .table-container {
        max-width: 100%;
        overflow-x: auto;
    }
}

/* iOS Safe Area & Touch fixes */
@supports (padding: env(safe-area-inset-bottom)) {
    .main-layout {
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
}

/* iOS input styling fixes */
input, select, textarea {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
}

input[type="time"] {
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

/* Number input spinner arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    opacity: 1;
    filter: invert(1);
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Firefox number input */
@-moz-document url-prefix() {
    input[type="number"] {
        -moz-appearance: spinner-textfield;
    }
}

/* Fix for iOS text rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Disable iOS pull-to-refresh */
body {
    overscroll-behavior-y: none;
}

/* Fix iOS button active state */
button {
    -webkit-tap-highlight-color: transparent;
}

/* ========================================
   SETTINGS TAB STYLES
   ======================================== */

#tab-impostazioni > .card {
    padding-bottom: 1.5rem;
}

.settings-section {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-section:first-child {
    padding-top: 0;
    padding-bottom: 1.5rem;
}

.settings-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.settings-title {
    font-size: 0.7rem;
    font-weight: 700;
    color: #e8501d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1rem;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-item:last-child {
    border-bottom: none;
}

/* Box evidenziato per impostazioni importanti (es. Google Routes) */
.setting-highlight-warning {
    border: 1.5px solid rgba(232, 80, 29, 0.6);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    background: rgba(232, 80, 29, 0.08);
    margin-bottom: 0.5rem;
}

.setting-highlight-warning .setting-label {
    color: #fff;
}

.setting-highlight-warning .setting-desc {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.78rem;
    line-height: 1.4;
}

.setting-item.compact {
    padding: 0;
    border-bottom: none;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    padding: 0.75rem 1rem;
}

.setting-item.compact .setting-label {
    font-size: 0.85rem;
}

.setting-item.compact .setting-desc {
    font-size: 0.75rem;
}

.setting-info {
    flex: 1;
    min-width: 0;
}

.setting-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    margin-bottom: 0.25rem;
}

.setting-desc {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.4;
}

.setting-input {
    width: 100px;
    padding: 0.5rem 0.75rem;
    background: rgba(0, 20, 45, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 0.85rem;
    color: white;
    text-align: center;
}

.setting-input:focus {
    outline: none;
    border-color: #e8501d;
    box-shadow: 0 0 0 2px rgba(232, 80, 29, 0.2);
}

.setting-input option {
    background: #1a3a5c;
    color: white;
}

.settings-info-box {
    background: rgba(0, 108, 170, 0.15);
    border: 1px solid rgba(0, 108, 170, 0.3);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.settings-info-box p {
    margin: 0;
    color: white;
    font-size: 0.85rem;
}

.settings-info-box .text-muted {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

/* Stats Tab */
.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    margin: 0;
}

.stats-title svg {
    color: #4caf50;
}

/* API Usage Stats */
.api-usage-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.api-usage-loading {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
    padding: 1rem;
    text-align: center;
}

.api-usage-item {
    background: transparent;
    border-radius: 8px;
    padding: 0.75rem;
}

.api-usage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.api-usage-name {
    font-size: 0.85rem;
    color: white;
    font-weight: 500;
}

.api-usage-count {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.api-usage-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.api-usage-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.api-usage-bar-fill.safe { background: #4caf50; }
.api-usage-bar-fill.warning { background: #ff9800; }
.api-usage-bar-fill.danger { background: #f44336; }

.api-usage-description {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.25rem;
    font-style: italic;
}

.api-usage-summary {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: rgba(0, 108, 170, 0.2);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.api-usage-summary-item {
    text-align: center;
}

.api-usage-summary-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.api-usage-summary-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.api-usage-summary-item.highlight .api-usage-summary-value {
    color: #4caf50;
    font-size: 1.3rem;
}

/* Google Cloud actual cost banner */
.api-google-cost-banner {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.15), rgba(33, 150, 243, 0.05));
    border: 1px solid rgba(33, 150, 243, 0.4);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 16px;
}

.api-google-cost-banner.danger {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.15), rgba(244, 67, 54, 0.05));
    border-color: rgba(244, 67, 54, 0.4);
}

.api-google-cost-header {
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 12px;
    text-align: center;
}

.api-google-cost-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.api-google-cost-table td {
    padding: 6px 0;
    color: rgba(255, 255, 255, 0.85);
}

.api-google-cost-table td.amount {
    text-align: right;
    font-family: monospace;
    font-size: 0.95rem;
}

.api-google-cost-table tr.muted td {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

.api-google-cost-table tr.divider td {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.api-google-cost-table tr.total td {
    color: #fff;
    padding-top: 8px;
}

.api-google-cost-table tr.paid td {
    color: rgba(255, 255, 255, 0.7);
}

.api-google-cost-table tr.remaining td {
    padding-top: 6px;
}

.api-google-cost-table .success {
    color: #4caf50 !important;
}

.api-google-cost-table .danger {
    color: #f44336 !important;
}

.api-google-cost-note {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Credit banner */
.api-credit-banner {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(76, 175, 80, 0.1));
    border: 1px solid rgba(76, 175, 80, 0.4);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.api-credit-banner.warning {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.2), rgba(255, 152, 0, 0.1));
    border-color: rgba(255, 152, 0, 0.4);
}

.api-credit-banner.danger {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.2), rgba(244, 67, 54, 0.1));
    border-color: rgba(244, 67, 54, 0.4);
}

.api-credit-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.api-credit-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.api-credit-value {
    font-size: 1rem;
    font-weight: 600;
    color: #4caf50;
}

.api-credit-banner.warning .api-credit-value {
    color: #ff9800;
}

.api-credit-banner.danger .api-credit-value {
    color: #f44336;
}

.api-credit-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.api-credit-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.api-credit-banner.warning .api-credit-bar-fill {
    background: linear-gradient(90deg, #ff9800, #ffc107);
}

.api-credit-banner.danger .api-credit-bar-fill {
    background: linear-gradient(90deg, #f44336, #ff5722);
}

/* Free badge */
.api-free-badge {
    display: inline-block;
    background: rgba(76, 175, 80, 0.3);
    color: #4caf50;
    font-size: 0.6rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

/* API cost inline */
.api-cost {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.7rem;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 6px;
}

/* Footer con timestamp */
.api-usage-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.api-last-update {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
}

.api-last-call {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Billing links */
.api-billing-links {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.api-billing-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 108, 170, 0.2);
    border: 1px solid rgba(0, 108, 170, 0.4);
    border-radius: 6px;
    color: #7dd3fc;
    font-size: 0.75rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.api-billing-link:hover {
    background: rgba(0, 108, 170, 0.4);
    color: white;
    transform: translateY(-1px);
}

.api-billing-link svg {
    opacity: 0.8;
}

/* Summary item danger state */
.api-usage-summary-item.danger .api-usage-summary-value {
    color: #f44336;
}

.api-usage-summary-item.danger .api-usage-summary-label {
    color: rgba(244, 67, 54, 0.7);
}

/* Info box inline */
.info-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 108, 170, 0.2);
    border: 1px solid rgba(0, 108, 170, 0.4);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: #7dd3fc;
}

.info-box svg {
    flex-shrink: 0;
    color: #4fc3f7;
}

.info-box strong {
    color: white;
}

/* Responsive settings */
@media (max-width: 500px) {
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .setting-item .toggle,
    .setting-item .setting-input,
    .setting-item .btn-outlined {
        align-self: flex-start;
    }

    .setting-input {
        width: 120px;
    }
}

/* Unassigned section styling */
.unassigned-section {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 8px;
}

.unassigned-section h4 {
    color: #ef4444;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.unassigned-hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.unassigned-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.unassigned-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    gap: 1rem;
    flex-wrap: wrap;
}

.unassigned-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 150px;
}

.unassigned-info strong {
    color: #fff;
    font-size: 0.9rem;
}

.unassigned-reason {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}

.unassigned-details {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    font-size: 0.75rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-row:last-of-type {
    border-bottom: none;
}

.detail-label {
    color: rgba(255, 255, 255, 0.5);
}

.detail-value {
    color: rgba(255, 255, 255, 0.9);
    font-family: monospace;
}

.detail-warning .detail-value {
    color: #fbbf24;
    font-weight: bold;
}

.detail-conflicts {
    margin-top: 0.5rem;
    padding: 0.4rem;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 4px;
    border-left: 3px solid #ef4444;
}

.detail-conflicts ul {
    margin: 0.25rem 0 0 1rem;
    padding: 0;
}

.detail-conflicts li {
    color: rgba(255, 255, 255, 0.8);
    margin: 0.15rem 0;
}

.detail-conflicts li b {
    color: #fff;
}

.conflict-time {
    color: rgba(255, 255, 255, 0.5);
    font-family: monospace;
    font-size: 0.9em;
}

.detail-suggestions {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-suggestions ul {
    margin: 0.25rem 0 0 1rem;
    padding: 0;
}

.detail-suggestions li {
    color: rgba(255, 255, 255, 0.7);
    margin: 0.2rem 0;
}

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

.assign-vehicle-select {
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 0.8rem;
    min-width: 140px;
}

.assign-vehicle-select option {
    background: #1a1a2e;
    color: #fff;
}

.btn-assign {
    padding: 0.4rem 0.8rem;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.btn-assign:hover {
    background: #059669;
}

@media (max-width: 600px) {
    .unassigned-item {
        flex-direction: column;
        align-items: stretch;
    }

    .unassigned-actions {
        margin-top: 0.5rem;
    }

    .assign-vehicle-select {
        flex: 1;
    }
}

/* Modal di conferma/avviso per assegnazione manuale */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(145deg, #1a2a3a, #0d1a2a);
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: modalSlideUp 0.3s ease;
}

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

.modal-content h3 {
    color: #fff;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-body {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    line-height: 1.5;
}

.modal-body p {
    margin-bottom: 0.75rem;
}

.modal-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    margin: 0.75rem 0;
}

.modal-warning strong {
    color: #f59e0b;
    display: block;
    margin-bottom: 0.5rem;
}

.modal-warning ul {
    margin: 0;
    padding-left: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85rem;
}

.modal-warning li {
    margin-bottom: 0.25rem;
}

.modal-unassigned-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 0.75rem;
    margin: 0.5rem 0;
}

.modal-unassigned-item strong {
    display: block;
    color: #fff;
    margin-bottom: 0.25rem;
}

.modal-unassigned-reason {
    display: block;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.modal-unassigned-details {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    padding: 0.5rem;
    font-size: 0.8rem;
}

.modal-detail-row {
    padding: 0.2rem 0;
    color: rgba(255, 255, 255, 0.8);
}

.modal-detail-row b {
    color: #fff;
    font-family: monospace;
}

.modal-detail-warning {
    color: #fbbf24;
    font-weight: bold;
}

.modal-detail-warning b {
    color: #fbbf24;
}

.modal-detail-conflicts {
    margin-top: 0.5rem;
    padding: 0.4rem;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 4px;
    border-left: 2px solid #ef4444;
}

.modal-detail-conflicts span {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
}

.modal-detail-conflicts ul {
    margin: 0.2rem 0 0 1rem;
    padding: 0;
}

.modal-detail-conflicts li {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    margin: 0.15rem 0;
}

.modal-detail-conflicts li b {
    color: #fff;
}

.modal-detail-suggestions {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.modal-detail-suggestions span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
}

.modal-detail-suggestions ul {
    margin: 0.25rem 0 0 1rem;
    padding: 0;
}

.modal-detail-suggestions li {
    margin: 0.2rem 0;
    font-size: 0.75rem;
}

.modal-success {
    color: #10b981;
    font-weight: 500;
}

.modal-error {
    color: #ef4444;
    font-weight: 500;
}

.modal-note {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
    font-style: italic;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
    justify-content: flex-end;
}

.modal-actions .btn-primary {
    background: #e8501d;
    color: #fff;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-actions .btn-primary:hover {
    background: #d14516;
}

.modal-actions .btn-secondary {
    background: transparent;
    color: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.6rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

/* ========================================
   MOBILE TAB BAR
   ======================================== */
.mobile-tabbar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(10, 25, 45, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.75rem 0.5rem;
    padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
    z-index: 1000;
    justify-content: space-around;
    gap: 0.25rem;
}

.tabbar-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
    min-width: 56px;
    flex: 1;
    border-radius: 8px;
}

.tabbar-item:active {
    background: rgba(255, 255, 255, 0.1);
}

.tabbar-item svg {
    width: 24px;
    height: 24px;
}

.tabbar-item span:not(.tabbar-badge) {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tabbar-item.active {
    color: #e8501d;
}

.tabbar-item.active svg {
    stroke: #e8501d;
}

.tabbar-badge {
    position: absolute;
    top: 0;
    right: 0.5rem;
    background: #e8501d;
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

.tabbar-badge:empty,
.tabbar-badge[data-count="0"] {
    display: none;
}

/* ========================================
   MENU DRAWER (Mobile)
   ======================================== */
.menu-drawer {
    position: fixed;
    inset: 0;
    z-index: 10001;
    pointer-events: none;
    visibility: hidden;
    display: none;
}

@media (max-width: 768px) {
    .menu-drawer {
        display: block;
    }
}

.menu-drawer:not(.hidden) {
    pointer-events: auto;
    visibility: visible;
}

.menu-drawer-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.menu-drawer:not(.hidden) .menu-drawer-overlay {
    opacity: 1;
}

.menu-drawer-content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 30, 55, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px 20px 0 0;
    padding-bottom: var(--safe-area-bottom);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.menu-drawer:not(.hidden) .menu-drawer-content {
    transform: translateY(0);
}

.menu-drawer-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.menu-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.menu-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #006caa, #004d7a);
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.menu-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.menu-user-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.menu-user-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.menu-user-email {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.menu-drawer-nav {
    padding: 0.5rem 0;
}

.menu-drawer-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    min-height: 56px;
    transition: background 0.15s;
}

.menu-drawer-item:active {
    background: rgba(255, 255, 255, 0.1);
}

.menu-drawer-item svg {
    width: 24px;
    height: 24px;
    color: rgba(255, 255, 255, 0.7);
    flex-shrink: 0;
}

.menu-badge {
    margin-left: auto;
    background: rgba(232, 80, 29, 0.3);
    color: #e8501d;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
}

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

.menu-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 10px;
    color: #fca5a5;
    font-size: 1rem;
    cursor: pointer;
    min-height: 48px;
    transition: background 0.15s;
}

.menu-logout-btn:active {
    background: rgba(239, 68, 68, 0.2);
}

/* Show mobile tabbar and hide desktop tabs on mobile */
@media (max-width: 768px) {
    .mobile-tabbar {
        display: flex;
    }

    /* Tabbar semplificata - icone grandi, label solo attivo */
    .tabbar-item {
        padding: 0.4rem 0.5rem;
        min-width: 44px;
        gap: 0.15rem;
    }

    .tabbar-item svg {
        width: 26px;
        height: 26px;
    }

    /* Label sempre visibile */
    .tabbar-item span:not(.tabbar-badge) {
        font-size: 0.6rem;
        opacity: 0.7;
    }

    .tabbar-item.active span:not(.tabbar-badge) {
        opacity: 1;
    }

    .tabbar-item.active {
        background: rgba(232, 80, 29, 0.1);
        border-radius: 10px;
    }

    .tabs-header {
        display: none !important;
    }

    /* Add padding at bottom for tabbar */
    .main-layout {
        padding-bottom: var(--tabbar-total);
        padding-left: 0;
        padding-right: 0;
    }

    /* Cards full width senza bordi laterali */
    .section,
    .column .section:first-child,
    .column .section:last-child,
    .column .section:only-child {
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
        border-bottom: none;
    }

    .card {
        border-radius: 0;
        border-top: none;
    }

    /* Nasconde sempre la timeline column su mobile */
    .column-center {
        display: none !important;
    }

    /* Su mobile la column-left è sempre visibile (ignora timeline-expanded) */
    .column-left {
        display: flex !important;
        flex-direction: column;
        min-height: calc(100vh - var(--tabbar-total));
        min-height: calc(100dvh - var(--tabbar-total));
    }

    /* Section riempie la column-left su mobile */
    .column-left .section {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }

    /* Nasconde column-left solo quando mappa è attiva */
    body.show-mobile-map .column-left {
        display: none !important;
    }

    /* Tab content riempe lo spazio - ma NON il pianificatore (che ha contenuto dinamico) */
    .tab-content:not(#tab-pianificatore) {
        min-height: calc(100vh - var(--tabbar-total) - var(--safe-area-top));
        min-height: calc(100dvh - var(--tabbar-total) - var(--safe-area-top));
    }

    .tab-content:not(#tab-pianificatore) > .card {
        min-height: calc(100vh - var(--tabbar-total) - var(--safe-area-top));
        min-height: calc(100dvh - var(--tabbar-total) - var(--safe-area-top));
    }

    /* Pianificatore: altezza naturale, si adatta al contenuto */
    #tab-pianificatore {
        min-height: unset;
    }

    #tab-pianificatore > .card {
        min-height: unset;
    }

    /* Liste dentro le card scrollabili */
    .veicoli-list,
    .autisti-list,
    .percorsi-container {
        max-height: none;
        overflow: visible;
    }

    /* Settings scrollabile */
    .settings-section {
        padding: 0.75rem;
    }

    /* Timeline stesse dimensioni del pianificatore su mobile */
    .timeline-container {
        border-radius: 0;
        border-left: none;
        border-right: none;
        min-height: calc(100vh - 70px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    }

    .timeline-container .timeline-header {
        border-radius: 0;
        margin: -1.25rem -1.25rem 1.5rem -1.25rem;
    }


    /* Hide map column on mobile by default */
    .column-right {
        display: none;
    }

    /* Show map when mappa tab is active */
    body.show-mobile-map .column-right {
        display: block;
    }

    body.show-mobile-map .column-left {
        display: none;
    }

    /* Full height map on mobile (no header) */
    body.show-mobile-map .map-container {
        position: fixed;
        top: var(--safe-area-top);
        left: 0;
        right: 0;
        bottom: var(--tabbar-total);
        border-radius: 0;
        border: none;
    }

    body.show-mobile-map .map-container #map {
        height: 100%;
        min-height: unset;
    }

    body.show-mobile-map .main-layout {
        padding: 0;
    }

    /* Mobile map improvements */
    body.show-mobile-map .map-back-btn {
        display: flex;
    }

    body.show-mobile-map .map-traffic-btn {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
        margin: 10px;
    }

    body.show-mobile-map .map-legend {
        bottom: 24px;
        left: 16px;
        right: 16px;
        max-width: calc(100vw - 32px);
        font-size: 0.75rem;
        padding: 0.6rem 0.8rem;
        gap: 0.5rem;
    }

    body.show-mobile-map .legend-item {
        gap: 0.35rem;
    }

    body.show-mobile-map .legend-color {
        width: 10px;
        height: 10px;
    }

    /* Google Maps controls bigger on mobile */
    body.show-mobile-map .gm-style .gmnoprint button {
        width: 44px !important;
        height: 44px !important;
    }

    body.show-mobile-map .gm-style .gm-fullscreen-control {
        width: 44px !important;
        height: 44px !important;
    }

    /* Larger touch targets - 44px minimo per WCAG */
    .btn-filled,
    .btn-outlined {
        min-height: 48px;
        padding: 0.85rem 1.25rem;
        font-size: 0.95rem;
    }

    .btn-icon {
        width: 48px;
        height: 48px;
    }

    .btn-small {
        min-height: 44px;
        padding: 0.65rem 1rem;
    }

    .input-group input,
    .input-group select {
        min-height: 48px;
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.75rem 1rem;
    }

    /* Toggle più grande per touch */
    .toggle {
        width: 52px;
        height: 28px;
    }

    .toggle-slider::before {
        width: 22px;
        height: 22px;
    }

    .toggle input:checked + .toggle-slider::before {
        transform: translateX(24px);
    }

    /* Toast above tabbar */
    .toast-container {
        bottom: calc(var(--tabbar-total) + 0.5rem);
        right: 0.75rem;
        left: 0.75rem;
    }

    .toast {
        max-width: 100%;
        min-width: auto;
    }

    /* Autocomplete improvements */
    .autocomplete-item {
        padding: 1rem;
        min-height: 44px;
    }

    /* Upload/Export zone bigger */
    .upload-zone-mini,
    .export-zone-mini {
        padding: 1rem;
        min-height: 44px;
    }

    /* Tabella senza limite altezza su mobile */
    .table-scroll-sm {
        max-height: none;
        overflow: visible;
    }

    /* Veicolo card improvements */
    .veicolo-actions .btn-outlined {
        min-height: 40px;
    }

    /* Modal bottom-sheet su mobile */
    .modal-overlay {
        align-items: flex-end;
    }

    .modal {
        margin: 0;
        max-width: 100vw;
        width: 100%;
        max-height: 90vh;
        max-height: 90dvh;
        border-radius: 20px 20px 0 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .modal h3 {
        font-size: 1.15rem;
        position: relative;
        top: 0;
        flex-shrink: 0;
        background: rgba(30, 58, 95, 0.98);
        margin: 0;
        padding: 1.25rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .modal form {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding: 1rem 1.25rem;
    }

    .modal-actions {
        position: relative;
        bottom: 0;
        flex-shrink: 0;
        background: rgba(30, 58, 95, 0.98);
        margin: 0;
        padding: 1rem 1.25rem;
        padding-bottom: calc(1rem + var(--safe-area-bottom));
        border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Form grid 1 colonna su mobile */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }

    /* Time range su mobile */
    .time-range {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .time-range input {
        min-width: 100px;
    }

    /* Map legend mobile friendly */
    .map-legend {
        bottom: 8px;
        left: 8px;
        right: 8px;
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    /* Font più leggibili su mobile */
    .toolbar-label {
        font-size: 0.9rem;
    }

    .section-title {
        font-size: 0.8rem;
        padding: 1rem;
    }

    .setting-label {
        font-size: 0.95rem;
    }

    .setting-desc {
        font-size: 0.8rem;
        line-height: 1.5;
    }

    /* VRP summary più leggibile */
    .summary-value {
        font-size: 1.5rem;
    }

    .summary-label {
        font-size: 0.7rem;
    }

    /* Route accordion mobile */
    .route-header {
        padding: 1rem;
    }

    .route-vehicle {
        font-size: 1rem;
    }

    .route-summary {
        font-size: 0.85rem;
    }

    /* Veicolo card mobile */
    .veicolo-name {
        font-size: 1rem;
    }

    .veicolo-info {
        font-size: 0.85rem;
    }

    /* Percorso card mobile */
    .percorso-nome {
        font-size: 1.1rem;
    }

    .percorso-meta-item {
        font-size: 0.8rem;
    }

    /* Upload/Export zone text più grande */
    .upload-zone-mini,
    .export-zone-mini {
        font-size: 0.9rem;
        gap: 1rem;
    }

    /* Save route inline */
    .save-route-inline {
        flex-direction: column;
        gap: 0.75rem;
    }

    .save-route-inline input {
        min-height: 44px;
        font-size: 16px;
    }

    .save-route-inline .btn-outlined {
        width: 100%;
        justify-content: center;
    }

    /* ========================================
       STOP LIST MOBILE - Redesign tabella punti
       ======================================== */

    /* Nascondi header tabella su mobile */
    .punti-table thead {
        display: none;
    }

    /* Tabella diventa lista verticale */
    .punti-table {
        display: block;
        width: 100%;
        overflow-x: hidden;
    }

    .punti-table tbody {
        display: flex;
        flex-direction: column;
        gap: 0;
    }

    /* Ogni riga diventa una card con grid */
    .punti-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 32px;
        grid-template-rows: auto auto auto;
        gap: 0.15rem 0.4rem;
        padding: 0.6rem 0.5rem 0.6rem 0.75rem;
        background: transparent;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 0;
        border-left: 3px solid rgba(0, 108, 170, 0.5);
    }

    .punti-table tbody tr:last-child {
        border-bottom: none;
    }

    .punti-table tbody tr.row-urgent {
        border-left-color: #e8501d;
        background: rgba(232, 80, 29, 0.08);
    }

    .punti-table tbody tr.row-deadline {
        border-left-color: #f59e0b;
    }

    /* Nome cliente - riga 1, colonna 1 */
    .punti-table .col-name {
        grid-column: 1;
        grid-row: 1;
        font-size: 0.9rem;
        font-weight: 600;
        color: white;
        padding: 0;
        line-height: 1.3;
    }

    /* Indirizzo - riga 2, colonna 1 */
    .punti-table .col-address {
        grid-column: 1;
        grid-row: 2;
        font-size: 0.72rem;
        color: rgba(255, 255, 255, 0.6);
        padding: 0;
        line-height: 1.3;
    }

    /* Orario - riga 3, colonna 1 */
    .punti-table .col-window {
        grid-column: 1;
        grid-row: 3;
        padding: 0;
        margin-top: 0.25rem;
    }

    /* Arrivo nascosto su mobile per risparmiare spazio */
    .punti-table .col-arrival {
        display: none;
    }

    /* Nascondere colonne non essenziali su mobile */
    .punti-table .col-vehicle,
    .punti-table .col-scarico,
    .punti-table .col-note,
    .punti-table .col-metrics {
        display: none;
    }

    /* Azioni - colonna 2, span tutte le righe */
    .punti-table .col-actions {
        grid-column: 2;
        grid-row: 1 / -1;
        padding: 0;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-end;
        gap: 0.5rem;
    }

    /* Bottoni azioni - touch target minimo 44px */
    .punti-table .btn-icon-sm {
        width: var(--touch-target-min);
        height: var(--touch-target-min);
        padding: 0.5rem;
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.08);
    }

    .punti-table .btn-icon-sm svg {
        width: 18px;
        height: 18px;
    }

    .punti-table .btn-icon-sm.btn-danger {
        background: rgba(220, 38, 38, 0.15);
    }

    /* Bottone elimina visibile su mobile */
    .punti-table .btn-icon-sm.btn-danger.delete-btn {
        display: flex;
    }

    /* Chip orario compatto */
    .punti-table .time-chip-editable {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        border-radius: 5px;
        white-space: nowrap;
    }

    .punti-table .time-chip-editable .edit-icon-mini {
        display: none;
    }

    /* Deposito card speciale */
    .punti-table tr.row-deposito {
        display: block !important;
        background: rgba(232, 80, 29, 0.12);
        border-left-color: #e8501d;
        border-bottom: none !important;
        padding: 0.6rem 0.75rem;
    }

    .punti-table tr.row-deposito .col-name {
        display: flex !important;
        align-items: center;
        gap: 0.6rem;
        font-size: 0.95rem;
        font-weight: 700;
        color: #e8501d;
        margin-bottom: 0.2rem;
        max-width: none !important;
        overflow: visible !important;
        text-overflow: unset !important;
        white-space: normal !important;
    }

    .punti-table tr.row-deposito .deposito-logo {
        width: 32px;
        height: 32px;
        border-radius: 6px;
        background: white;
        padding: 3px;
        flex-shrink: 0;
    }

    .punti-table tr.row-deposito .col-address {
        display: block !important;
        margin-left: 38px;
        font-size: 0.72rem;
        color: rgba(255, 255, 255, 0.7);
        max-width: none !important;
        overflow: visible !important;
        text-overflow: unset !important;
        white-space: normal !important;
    }

    .punti-table tr.row-deposito .col-window,
    .punti-table tr.row-deposito .col-arrival,
    .punti-table tr.row-deposito .col-scarico,
    .punti-table tr.row-deposito .col-note,
    .punti-table tr.row-deposito .col-metrics,
    .punti-table tr.row-deposito .col-vehicle,
    .punti-table tr.row-deposito .col-actions {
        display: none !important;
    }
}

/* ========================================
   LOGIN PAGE STYLES
   ======================================== */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1rem;
    padding-top: env(safe-area-inset-top, 1rem);
    padding-bottom: env(safe-area-inset-bottom, 1rem);
}

body.login-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 30% 40%, rgba(0, 108, 170, 0.4), transparent 60%),
        radial-gradient(circle at 70% 70%, rgba(232, 80, 29, 0.25), transparent 50%);
    pointer-events: none;
}

.login-container {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    margin: auto;
}

.login-card {
    background: rgba(15, 40, 70, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

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

.login-logo {
    width: 140px;
    height: auto;
    background: none;
    border-radius: 0;
    padding: 0;
    margin-bottom: 1.5rem;
    box-shadow: none;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

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

.login-form .input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.login-form .input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.login-form .input-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    background: rgba(0, 20, 45, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 10px;
    font-size: 1rem;
    color: white;
    transition: all 0.2s;
}

.login-form .input-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.login-form .input-group input:focus {
    outline: none;
    background: rgba(0, 30, 60, 0.9);
    border-color: #e8501d;
    box-shadow: 0 0 0 3px rgba(232, 80, 29, 0.2);
}

.login-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    text-align: center;
}

.login-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0.5rem;
    position: relative;
}

.login-btn .btn-text,
.login-btn .btn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-btn .spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-footer {
    margin-top: 2rem;
    text-align: center;
}

.login-footer p {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}

/* Login responsive */
@media (max-width: 500px) {
    .login-card {
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }

    .login-logo {
        width: 120px;
    }

    .login-title {
        font-size: 1.3rem;
    }
}

/* ========================================
   USER INFO & LOGOUT STYLES
   ======================================== */
.app-bar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    margin-left: 0.5rem;
}

.user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #006caa 0%, #004d7a 100%);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.user-avatar.admin {
    background: linear-gradient(135deg, #e8501d 0%, #c43d0f 100%);
}

.user-avatar.has-image {
    background: none;
    overflow: hidden;
}

.user-avatar.has-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-wrapper {
    position: relative;
    cursor: pointer;
    display: flex;
}

.avatar-overlay-mini {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    background: rgba(0, 0, 0, 0.5);
    color: white;
}

.user-avatar-wrapper:hover .avatar-overlay-mini {
    opacity: 1;
}

.user-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role-badge {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.15rem 0.4rem;
    border-radius: 6px;
    background: rgba(0, 108, 170, 0.3);
    color: #7dd3fc;
}

.user-role-badge.admin {
    background: rgba(232, 80, 29, 0.3);
    color: #fdba74;
}

.btn-logout {
    width: 26px;
    height: 26px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Mobile user info */
@media (max-width: 768px) {
    .app-bar-user {
        padding: 1px;
        gap: 0.5rem;
    }

    .user-name {
        display: none;
    }

    .user-role-badge {
        font-size: 0.6rem;
    }

    .btn-logout {
        width: 28px;
        height: 28px;
    }
}

/* ========================================
   USER MANAGEMENT STYLES (Admin Settings)
   ======================================== */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.user-card {
    background: rgba(5, 25, 50, 0.9);
    border-radius: 10px;
    padding: 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-card.current-user {
    border-color: rgba(232, 80, 29, 0.5);
    background: rgba(232, 80, 29, 0.1);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #006caa 0%, #004d7a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar.admin {
    background: linear-gradient(135deg, #e8501d 0%, #d14518 100%);
}

.user-avatar.autista {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.user-card-role.autista {
    background: rgba(5, 150, 105, 0.25);
    color: #6ee7b7;
}

.autisti-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.user-avatar svg {
    color: white;
    width: 20px;
    height: 20px;
}

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

.user-card-name {
    font-weight: 700;
    color: white;
    font-size: 0.9rem;
    margin-bottom: 0.15rem;
}

.user-card-email {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.user-card-veicolo {
    font-size: 0.7rem;
    color: rgba(0, 108, 170, 0.9);
    background: rgba(0, 108, 170, 0.15);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-top: 0.2rem;
    display: inline-block;
}

.btn-share {
    background: rgba(0, 108, 170, 0.2);
    color: #4fc3f7;
}

.btn-share:hover {
    background: rgba(0, 108, 170, 0.4);
}

.user-card-role {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    background: rgba(0, 108, 170, 0.25);
    color: #7dd3fc;
}

.user-card-role.admin {
    background: rgba(232, 80, 29, 0.25);
    color: #fdba74;
}

.user-actions {
    display: flex;
    gap: 0.35rem;
}

.add-user-form {
    background: rgba(0, 40, 70, 0.5);
    border-radius: 10px;
    padding: 1rem;
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

.add-user-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.add-user-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.add-user-grid .full-width {
    grid-column: 1 / -1;
}

.add-user-form .input-group {
    margin-bottom: 0;
}

.add-user-form .input-group input,
.add-user-form .input-group select {
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
}

@media (max-width: 500px) {
    .add-user-grid {
        grid-template-columns: 1fr;
    }

    .user-card {
        flex-wrap: wrap;
    }

    .user-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
    }
}

/* ========================================
   PROFILE PAGE (Mobile)
   ======================================== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1.5rem;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #006caa 0%, #004d7a 100%);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    flex-shrink: 0;
}

.profile-avatar.admin {
    background: linear-gradient(135deg, #e8501d 0%, #c43d0f 100%);
}

.profile-avatar-wrapper {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.profile-avatar-wrapper .profile-avatar {
    transition: filter 0.2s;
}

.profile-avatar-wrapper:hover .profile-avatar {
    filter: brightness(0.7);
}

.avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    background: rgba(0, 0, 0, 0.5);
    color: white;
}

.profile-avatar-wrapper:hover .avatar-overlay {
    opacity: 1;
}

.profile-avatar.has-image {
    background: none;
    overflow: hidden;
}

.profile-avatar.has-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.profile-email {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.profile-role-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.25rem 0.6rem;
    border-radius: 10px;
    background: rgba(0, 108, 170, 0.3);
    color: #7dd3fc;
    margin-top: 0.25rem;
    width: fit-content;
}

.profile-role-badge.admin {
    background: rgba(232, 80, 29, 0.3);
    color: #fdba74;
}

.profile-actions {
    padding-top: 1rem;
}

.profile-logout {
    width: 100%;
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%) !important;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3) !important;
}

.profile-logout:hover {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%) !important;
}

/* ========================================
   PUNTI CARDS SYSTEM - Tab + Card orizzontali
   ======================================== */

/* Wrapper che contiene tabs (fissi) e cards (scrollabili) */
.punti-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

/* Tab veicoli - barra fissa sopra le card */
.vehicle-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    padding-bottom: 0.5rem;
    margin: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    background: linear-gradient(135deg, rgba(0, 50, 80, 0.8) 0%, rgba(0, 30, 60, 0.9) 100%);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.vehicle-tabs::-webkit-scrollbar {
    height: 6px;
}

.vehicle-tabs::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.vehicle-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.vehicle-tabs::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.vehicle-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1 1 auto;
    min-width: 70px;
}

.vehicle-tab:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.vehicle-tab.active {
    background: linear-gradient(135deg, #e8501d 0%, #d14518 100%);
    border-color: #e8501d;
    color: white;
    box-shadow: 0 2px 8px rgba(232, 80, 29, 0.4);
}

.vehicle-tab-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.vehicle-tab-name {
    font-weight: 600;
}

.vehicle-tab-color {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.vehicle-tab-stats {
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.8;
}

.vehicle-tab-count {
    background: rgba(0, 0, 0, 0.25);
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
}

.vehicle-tab.active .vehicle-tab-count {
    background: rgba(0, 0, 0, 0.3);
}

/* Container card orizzontali */
.punti-cards-container {
    padding: 0.5rem;
    overflow-x: auto;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
    /* Flex layout per riempire container */
    display: flex;
    flex-direction: column;
}

.punti-cards-container::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.punti-cards-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.punti-cards-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.punti-cards-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Tabella punti */
.punti-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
}

.punti-table thead {
    position: static !important;
}

.punti-table th {
    background: #0a1525;
    padding: 0.5rem 0.4rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
}

.punti-table td {
    padding: 0.5rem 0.4rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.punti-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Animazione righe tabella */
.punti-table tbody tr {
    animation: rowFadeIn 0.2s ease-out backwards;
}

.punti-table tbody tr:nth-child(1) { animation-delay: 0.02s; }
.punti-table tbody tr:nth-child(2) { animation-delay: 0.04s; }
.punti-table tbody tr:nth-child(3) { animation-delay: 0.06s; }
.punti-table tbody tr:nth-child(4) { animation-delay: 0.08s; }
.punti-table tbody tr:nth-child(5) { animation-delay: 0.10s; }
.punti-table tbody tr:nth-child(6) { animation-delay: 0.12s; }
.punti-table tbody tr:nth-child(7) { animation-delay: 0.14s; }
.punti-table tbody tr:nth-child(8) { animation-delay: 0.16s; }
.punti-table tbody tr:nth-child(n+9) { animation-delay: 0.18s; }

@keyframes rowFadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.punti-table .col-name {
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.punti-table .col-address {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.punti-table .col-vehicle {
    width: 80px;
}

.punti-table .col-window {
    width: 110px;
}

.time-chip {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #a5b4fc;
    white-space: nowrap;
}

.time-chip-editable {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #a5b4fc;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.time-chip-editable:hover {
    background: rgba(99, 102, 241, 0.35);
    border-color: rgba(99, 102, 241, 0.6);
}

.time-chip-editable .edit-icon-mini {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.time-chip-editable:hover .edit-icon-mini {
    opacity: 1;
}

/* Chip urgente inattivo (grigio, icona fulmine) */
.urgent-chip-inactive {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: rgba(100, 116, 139, 0.2);
    border: 1px solid rgba(100, 116, 139, 0.3);
    border-radius: 50%;
    font-size: 0.6rem;
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.4;
    margin-right: 0.5rem;
    position: relative;
    top: -3px;
}

.urgent-chip-inactive:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    opacity: 1;
    transform: scale(1.1);
}

/* Chip urgente attivo (rosso pulsante) */
.urgent-chip-active {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.5rem;
    background: rgba(239, 68, 68, 0.25);
    border: 1px solid rgba(239, 68, 68, 0.5);
    border-radius: 12px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #fca5a5;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    animation: urgent-pulse 2s ease-in-out infinite;
    margin-right: 0.75rem;
}

.urgent-chip-active:hover {
    background: rgba(239, 68, 68, 0.4);
    border-color: rgba(239, 68, 68, 0.7);
}

@keyframes urgent-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 8px 2px rgba(239, 68, 68, 0.3); }
}

/* Popup urgenza */
.urgent-popup {
    border-color: rgba(239, 68, 68, 0.3);
}

.urgent-popup-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fca5a5;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(239, 68, 68, 0.2);
}

.urgent-icon {
    font-size: 1rem;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.5);
}

/* Popup per modifica finestra temporale */
.time-popup {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    padding: 0.75rem;
    min-width: 180px;
}

.time-popup-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.time-popup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.time-popup-row label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    min-width: 35px;
}

.time-popup .time-input {
    padding: 0.3rem 0.4rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.8rem;
    width: 100px;
}

.time-popup .time-input:focus {
    outline: none;
    border-color: #6366f1;
}

.time-popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.time-popup .btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    border: none;
}

.time-popup .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.time-popup .btn-primary {
    background: #6366f1;
    color: white;
}

.time-popup .btn-sm:hover {
    opacity: 0.85;
}

.punti-table .col-metrics {
    width: 130px;
    white-space: nowrap;
}

.data-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.15rem 0.4rem;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #fbbf24;
    margin-right: 0.2rem;
}

.data-label {
    font-size: 0.55rem;
    font-weight: 400;
    color: rgba(251, 191, 36, 0.7);
    text-transform: uppercase;
}

.punti-table .col-arrival {
    width: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4ade80;
}

.punti-table .col-scarico {
    width: 55px;
}

.scarico-chip {
    background: rgba(168, 85, 247, 0.2) !important;
    border-color: rgba(168, 85, 247, 0.4) !important;
    color: #c4b5fd !important;
}

.scarico-chip-editable {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.4rem;
    background: rgba(168, 85, 247, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
    color: #c4b5fd;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scarico-chip-editable:hover {
    background: rgba(168, 85, 247, 0.35);
    border-color: rgba(168, 85, 247, 0.6);
}

.scarico-chip-editable .edit-icon-mini {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.scarico-chip-editable:hover .edit-icon-mini {
    opacity: 1;
}

.punti-table .col-note {
    max-width: 120px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.punti-table .col-actions {
    width: 60px;
    text-align: right;
    white-space: nowrap;
}

.vehicle-badge-mini {
    display: inline-block;
    padding: 0.15rem 0.4rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 500;
    color: white;
}

/* Badge veicolo cliccabile */
.vehicle-badge-clickable {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 500;
    color: white;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.vehicle-badge-clickable:hover {
    filter: brightness(1.15);
    transform: scale(1.05);
}

.vehicle-badge-clickable.manual {
    border: 1px dashed rgba(255, 255, 255, 0.5);
}

.vehicle-badge-clickable.manual .lock-icon {
    opacity: 0.8;
}

.vehicle-badge-clickable.empty {
    background: rgba(255, 255, 255, 0.1);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.5);
}

.vehicle-badge-clickable.empty:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
    color: rgba(255, 255, 255, 0.8);
}

/* Popover assegnazione veicolo a punto */
.veicolo-punto-popup {
    background: #1e293b;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    min-width: 180px;
    max-width: 250px;
    overflow: hidden;
    animation: popoverFadeIn 0.15s ease;
}

@keyframes popoverFadeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.veicolo-punto-header {
    padding: 0.6rem 0.8rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.veicolo-punto-list {
    max-height: 200px;
    overflow-y: auto;
}

.veicolo-punto-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.veicolo-punto-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.veicolo-punto-item.selected {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.veicolo-punto-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.veicolo-punto-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.veicolo-punto-item .check-icon {
    color: #22c55e;
    flex-shrink: 0;
}

.veicolo-punto-auto {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.8rem;
    background: transparent;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}

.veicolo-punto-auto:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.btn-icon-sm {
    padding: 0.25rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.6);
    border-radius: 4px;
    transition: all 0.15s;
}

.btn-icon-sm:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-icon-sm.btn-danger:hover {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.punto-row.row-urgent {
    background: rgba(220, 53, 69, 0.1);
}

.punto-row.row-deadline {
    background: rgba(220, 53, 69, 0.15);
    border-left: 3px solid #dc3545;
}

.punto-row.row-deadline td:first-child {
    padding-left: calc(0.4rem + 3px);
}

.punto-row.row-deadline td:first-child::before {
    content: '↑';
    color: #dc3545;
    font-weight: bold;
    margin-right: 0.3rem;
}

.punto-row.row-high {
    background: rgba(255, 193, 7, 0.05);
}

/* Riga deposito */
.punto-row.row-deposito {
    background: linear-gradient(135deg, rgba(255, 140, 0, 0.12) 0%, rgba(255, 140, 0, 0.05) 100%);
    border-left: 3px solid #ff8c00;
}

.punto-row.row-deposito td {
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.punto-row.row-deposito td:first-child {
    padding-left: calc(0.4rem + 3px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-style: normal;
    font-weight: 600;
    color: #ff8c00;
}

.punto-row.row-deposito .deposito-logo {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 3px;
}

.deposito-chip {
    background: rgba(255, 140, 0, 0.15);
    color: #ff8c00;
    border: 1px solid rgba(255, 140, 0, 0.3);
}

.deposito-badge {
    background: rgba(255, 140, 0, 0.2) !important;
    color: #ff8c00 !important;
    font-size: 0.7rem;
}

.badge-urgent {
    display: inline-block;
    background: #dc3545;
    color: white;
    padding: 0 0.3rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: bold;
}

.punti-cards-container::-webkit-scrollbar {
    height: 6px;
}

.punti-cards-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

/* Badge veicolo sulla card */
.punto-vehicle-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    margin-top: 0.3rem;
}

.punto-vehicle-badge .badge-color {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.kanban-punto-btn svg {
    width: 14px;
    height: 14px;
}

/* Deposito speciale */
.kanban-punto-card.deposito-card {
    background: linear-gradient(180deg, rgba(232, 80, 29, 0.15) 0%, rgba(15, 30, 50, 0.95) 50%);
    border-color: rgba(232, 80, 29, 0.25);
}

.kanban-punto-card.deposito-card .kanban-punto-actions {
    display: none;
}

/* Deposito card */
.punti-cards-container .punto-card.deposito-card {
    background: rgba(232, 80, 29, 0.3);
    margin-left: 24px;
    padding-left: 3rem;
}

.punti-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    padding: 3rem 2rem;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.02);
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    margin: 0.5rem;
}

/* Deposito Card */
.punto-card.deposito-card {
    background: rgba(232, 80, 29, 0.15);
    border-color: rgba(232, 80, 29, 0.3);
    padding: 0.85rem 1rem 0.85rem 2.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.punto-card.deposito-card .punto-sequence {
    background: white;
    top: 50%;
    transform: translateY(-50%);
    padding: 4px;
}

.deposito-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
}

.punto-card.deposito-card .punto-card-content {
    flex: 1;
    min-width: 0;
}

.punto-card.deposito-card .punto-card-header {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.punto-card.deposito-card .punto-card-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.punto-card.deposito-card .punto-card-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.punto-card.deposito-card .punto-card-address {
    margin-bottom: 0;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.deposito-badge {
    background: #e8501d;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Individual Punto Card - Accordion Style */
.punto-card {
    background: rgba(15, 35, 60, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    margin-left: 24px;
    position: relative;
    transition: all 0.2s ease;
    animation: puntoCardFadeScale 0.35s cubic-bezier(0.4, 0, 0.2, 1) backwards;
    /* Flex item per riempire container uniformemente */
    flex: 1;
    min-height: 50px;
}

/* Staggered animation delays for punto cards */
.punto-card:nth-child(1) { animation-delay: 0.03s; }
.punto-card:nth-child(2) { animation-delay: 0.06s; }
.punto-card:nth-child(3) { animation-delay: 0.09s; }
.punto-card:nth-child(4) { animation-delay: 0.12s; }
.punto-card:nth-child(5) { animation-delay: 0.15s; }
.punto-card:nth-child(6) { animation-delay: 0.18s; }
.punto-card:nth-child(7) { animation-delay: 0.21s; }
.punto-card:nth-child(8) { animation-delay: 0.24s; }
.punto-card:nth-child(9) { animation-delay: 0.27s; }
.punto-card:nth-child(10) { animation-delay: 0.30s; }
.punto-card:nth-child(n+11) { animation-delay: 0.33s; }

/* Animazione entrata: fade + scale */
@keyframes puntoCardFadeScale {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animazione uscita */
.punto-card.removing {
    animation: puntoCardFadeOut 0.25s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes puntoCardFadeOut {
    to {
        opacity: 0;
        transform: scale(0.92);
    }
}

.punto-card:hover {
    border-color: rgba(232, 80, 29, 0.3);
}

.punto-card.dragging {
    opacity: 0.5;
    background: rgba(232, 80, 29, 0.2);
}

.punto-card.drag-over {
    border-color: #e8501d;
    box-shadow: 0 0 0 2px rgba(232, 80, 29, 0.3);
}

/* Accordion Header - Always Visible */
.punto-accordion-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    padding-left: 2.5rem;
    cursor: pointer;
    transition: background 0.2s;
}

.punto-accordion-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.punto-expand-icon {
    margin-left: auto;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.punto-card.expanded .punto-expand-icon {
    transform: rotate(180deg);
}

/* Accordion Body - Hidden by Default */
.punto-accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 1rem 0 2.5rem;
}

.punto-card.expanded .punto-accordion-body {
    max-height: 500px;
    padding: 0 1rem 1rem 2.5rem;
    overflow: visible;
}

/* Sequence Number */
.punto-sequence {
    position: absolute;
    left: -24px;
    top: 0.75rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #006caa 0%, #004d7a 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Card Header */
.punto-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.punto-card-title {
    flex: 1;
    min-width: 0;
}

.punto-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.punto-card-address {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

/* VRP Badge */
.punto-vrp-badge {
    display: inline-block;
    background: rgba(76, 205, 196, 0.2);
    color: #4ECDC4;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    font-size: 0.65rem;
    font-weight: 600;
}

/* Info Chips Row */
.punto-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.punto-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
}

.punto-chip svg {
    opacity: 0.6;
    flex-shrink: 0;
}

.chip-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    margin-right: 0.25rem;
}

/* Orari stimati */
.punto-chips-stimati {
    margin-top: 0.25rem;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(255, 255, 255, 0.1);
}

.punto-chip.chip-stimato {
    background: rgba(0, 108, 170, 0.15);
    border-color: rgba(0, 108, 170, 0.3);
}

.punto-chip.chip-stimato.arr {
    color: #5eb8ff;
}

.punto-chip.chip-stimato.arr .chip-label {
    color: #5eb8ff;
}

.punto-chip.chip-stimato.part {
    background: rgba(232, 80, 29, 0.15);
    border-color: rgba(232, 80, 29, 0.3);
    color: #ff9a6c;
}

.punto-chip.chip-stimato.part .chip-label {
    color: #ff9a6c;
}

.punto-note {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.4;
}

/* Info Inputs Row (legacy) */
.punto-inputs-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.punto-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.punto-input-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.punto-input {
    width: 85px;
    padding: 0.4rem 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 0.8rem;
    color: white;
    text-align: center;
    transition: all 0.15s;
}

.punto-input:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
}

.punto-input:focus {
    outline: none;
    background: rgba(0, 30, 60, 0.9);
    border-color: #e8501d;
    box-shadow: 0 0 0 2px rgba(232, 80, 29, 0.2);
}

.punto-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.5;
    cursor: pointer;
}

.punto-input-small {
    width: 65px;
}

/* Drag Handle */
.drag-handle-punto {
    position: absolute;
    left: 0.5rem;
    top: 0.85rem;
    color: rgba(255, 255, 255, 0.3);
    cursor: grab;
    padding: 0.25rem;
    transition: color 0.15s;
}

.drag-handle-punto:hover {
    color: rgba(255, 255, 255, 0.6);
}

.drag-handle-punto:active {
    cursor: grabbing;
}

/* Card Actions */
.punto-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: flex-end;
}

.punto-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.punto-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    color: white;
}

.punto-action-btn svg {
    width: 14px;
    height: 14px;
}

.punto-action-btn.btn-danger {
    color: #f87171;
}

.punto-action-btn.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Connection line between punto cards */
.punto-connection {
    display: flex;
    align-items: center;
    margin-left: 6px;
    padding: 0.25rem 0;
    position: relative;
}

.punto-connection::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.15);
}

/* Mobile Responsiveness for Punto Cards */
@media (max-width: 768px) {
    .punti-cards-container {
        padding: 0.5rem;
    }

    .punto-card {
        margin-left: 28px;
    }

    .punto-sequence {
        left: -28px;
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .punto-card-name {
        font-size: 0.95rem;
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        word-break: break-word;
    }
    
    .punto-card-address {
        font-size: 0.78rem;
        white-space: normal;
        word-break: break-word;
    }

    .punto-inputs-row {
        flex-direction: column;
        gap: 0.75rem;
    }

    .punto-input-group {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .punto-input-label {
        min-width: 60px;
    }

    .punto-input {
        flex: 1;
        max-width: 120px;
    }

    .punto-card-actions {
        flex-wrap: wrap;
    }

    .punto-action-btn {
        justify-content: center;
        min-height: 44px;
    }

    .punto-accordion-header {
        padding: 1rem 1rem 1rem 2.5rem;
    }

    .punto-accordion-body {
        padding: 0 1rem 0 2.5rem;
    }

    .punto-card.expanded .punto-accordion-body {
        padding: 0 1rem 1rem 2.5rem;
    }

    /* Disclosure progressiva: mostra solo primi chip */
    .punto-chips-row {
        max-height: 30px;
        overflow: hidden;
        transition: max-height 0.2s ease;
    }

    .punto-card.expanded .punto-chips-row {
        max-height: none;
        overflow: visible;
    }

    /* Chip più compatti su mobile */
    .punto-chip {
        padding: 0.2rem 0.45rem;
        font-size: 0.7rem;
    }

    /* Orari stimati nascosti di default */
    .punto-chips-stimati {
        display: none;
    }

    .punto-card.expanded .punto-chips-stimati {
        display: flex;
    }
}

/* ========================================
   PUNTO CARD V2 - REDESIGN
   Layout: tutto visibile a colpo d'occhio
   ======================================== */

/* Card verticale per scroll orizzontale */
.punto-card-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 180px;
    min-width: 180px;
    padding: 1rem 0.75rem;
    background: linear-gradient(180deg, rgba(15, 35, 60, 0.95) 0%, rgba(10, 25, 45, 0.98) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    transition: all 0.2s ease;
    scroll-snap-align: start;
    flex-shrink: 0;
    text-align: center;
    gap: 0.6rem;
}

.punto-card-v2:hover {
    border-color: rgba(0, 108, 170, 0.5);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transform: translateY(-2px);
}

/* Priority indicators - top border */
.punto-card-v2.priority-high {
    border-top: 3px solid #f59e0b;
}

.punto-card-v2.priority-urgent {
    border-top: 3px solid #ef4444;
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.12) 0%, rgba(15, 35, 60, 0.95) 30%);
}

/* Sequence number - grande e centrato */
.punto-v2-sequence {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 800;
    color: white;
    background: linear-gradient(135deg, #006caa 0%, #004d7a 100%);
    box-shadow: 0 4px 12px rgba(0, 108, 170, 0.4);
    flex-shrink: 0;
}

.punto-v2-sequence.deposito {
    background: white;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(232, 80, 29, 0.3);
}

.punto-v2-sequence.deposito .deposito-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* Main content area - verticale centrato */
.punto-v2-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
}

/* Header - verticale centrato */
.punto-v2-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
}

.punto-v2-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

/* Nome punto - centrato, max 2 righe */
.punto-v2-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    line-height: 1.3;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Badges */
.punto-v2-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-partenza {
    background: linear-gradient(135deg, #e8501d 0%, #c23c0d 100%);
    color: white;
}

.badge-priority {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-urgent {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: pulse-urgent 2s infinite;
}

@keyframes pulse-urgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Time window - centrato */
.punto-v2-time-window {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.6rem;
    background: rgba(0, 108, 170, 0.2);
    border: 1px solid rgba(0, 108, 170, 0.35);
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #5eb8ff;
    white-space: nowrap;
}

/* Address - centrato, max 2 righe */
.punto-v2-address {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.35;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 100%;
}

/* Metrics - centrate */
.punto-v2-metrics {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.3rem;
    width: 100%;
}

.punto-v2-metric {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.3rem 0.5rem;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.punto-v2-metric .metric-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
}

.punto-v2-metric .metric-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
}

.punto-v2-metric.metric-estimated {
    background: rgba(76, 205, 196, 0.12);
    border: 1px solid rgba(76, 205, 196, 0.25);
}

.punto-v2-metric.metric-estimated .metric-value {
    color: #4ECDC4;
}

.punto-v2-metric.metric-estimated .metric-label {
    color: rgba(76, 205, 196, 0.7);
}

/* Extra info (contacts, notes) */
.punto-v2-extra {
    display: none; /* Hidden by default - details visible in edit modal */
}

.punto-v2-contact {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.punto-v2-contact svg {
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.punto-v2-note {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    line-height: 1.4;
}

/* Actions */
/* Actions - centrate in basso */
.punto-v2-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
}

.punto-v2-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.15s;
}

.punto-v2-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: scale(1.05);
}

.punto-v2-btn.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}

.punto-v2-btn svg {
    width: 16px;
    height: 16px;
}

/* Deposito card - stessa struttura verticale */
.punto-card-v2.punto-card-deposito {
    background: linear-gradient(180deg, rgba(232, 80, 29, 0.15) 0%, rgba(15, 35, 60, 0.95) 50%);
    border-color: rgba(232, 80, 29, 0.3);
    width: 160px;
    min-width: 160px;
}

.punto-card-v2.punto-card-deposito .punto-v2-name {
    font-size: 0.85rem;
}

.punto-card-v2.punto-card-deposito .punto-v2-address {
    font-size: 0.7rem;
}

/* Mobile responsiveness - card verticali più strette */
@media (max-width: 768px) {
    .punto-card-v2 {
        width: 160px;
        min-width: 160px;
        padding: 0.85rem 0.6rem;
    }

    .punto-v2-sequence {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }

    .punto-v2-name {
        font-size: 0.85rem;
    }

    .punto-v2-address {
        font-size: 0.7rem;
    }

    .punto-card-v2.punto-card-deposito {
        width: 140px;
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .punto-card-v2 {
        width: 150px;
        min-width: 150px;
    }

    .punto-v2-sequence {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .punto-card-v2.punto-card-deposito {
        width: 130px;
        min-width: 130px;
    }
}

/* ========================================
   DELIVERY CARD SYSTEM
   ======================================== */

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.view-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.view-toggle-btn.active {
    background: rgba(232, 80, 29, 0.2);
    border-color: rgba(232, 80, 29, 0.4);
    color: #e8501d;
}

.view-toggle-btn svg {
    width: 16px;
    height: 16px;
}

/* Route Summary Header */
.route-summary-header {
    background: linear-gradient(135deg, rgba(0, 108, 170, 0.2) 0%, rgba(0, 77, 122, 0.3) 100%);
    border: 1px solid rgba(0, 108, 170, 0.3);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.route-summary-vehicle {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.route-summary-vehicle-badge {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.route-summary-vehicle-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
}

/* Route Autista Info (sopra la tabella punti) */
.route-autista-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 8px;
    font-size: 0.85rem;
}

.route-autista-label {
    color: rgba(255, 255, 255, 0.6);
    font-weight: 500;
}

.route-autista-value {
    color: #10b981;
    font-weight: 600;
}

/* Veicolo Chip (in Autisti tab) */
.veicolo-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.65rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    margin-top: 0.35rem;
}

.veicolo-chip.assigned {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.veicolo-chip.assigned:hover {
    background: rgba(59, 130, 246, 0.3);
}

.veicolo-chip.empty {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.5);
    border: 1px dashed rgba(255, 255, 255, 0.25);
}

.veicolo-chip.empty:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.4);
}

.veicolo-chip svg {
    flex-shrink: 0;
}

.veicolo-chip .chip-arrow {
    opacity: 0.5;
    margin-left: 0.1rem;
}

.veicolo-chip:hover .chip-arrow {
    opacity: 0.8;
}

/* Veicolo Popover */
.veicolo-popover {
    position: fixed;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.veicolo-popover.visible {
    opacity: 1;
    visibility: visible;
}

.veicolo-popover-content {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    min-width: 240px;
    max-width: 300px;
    overflow: hidden;
}

.veicolo-popover-header {
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.veicolo-popover-list {
    max-height: 280px;
    overflow-y: auto;
}

.veicolo-popover-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 1rem;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    transition: background 0.1s ease;
    text-align: left;
}

.veicolo-popover-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.veicolo-popover-item.selected {
    background: rgba(59, 130, 246, 0.15);
}

.veicolo-popover-item.assigned-elsewhere {
    opacity: 0.5;
}

.veicolo-popover-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #60a5fa;
    flex-shrink: 0;
}

.veicolo-popover-name {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.3;
}

.veicolo-popover-name small {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 0.1rem;
}

.veicolo-popover-check {
    color: #60a5fa;
    flex-shrink: 0;
}

.veicolo-popover-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: #ef4444;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.1s ease;
}

.veicolo-popover-remove:hover {
    background: rgba(239, 68, 68, 0.1);
}

.veicolo-popover-remove.hidden {
    display: none;
}

/* Mobile Bottom Sheet */
.veicolo-popover.mobile {
    top: 0 !important;
    left: 0 !important;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.veicolo-popover.mobile .veicolo-popover-content {
    width: 100%;
    max-width: none;
    border-radius: 16px 16px 0 0;
    max-height: 70vh;
}

.veicolo-popover.mobile .veicolo-popover-header {
    padding: 1rem 1.25rem;
    font-size: 0.9rem;
}

.veicolo-popover.mobile .veicolo-popover-item {
    padding: 0.85rem 1.25rem;
}

.veicolo-popover.mobile .veicolo-popover-list {
    max-height: calc(70vh - 120px);
}

/* Progress Bar */
.route-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.route-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #006caa 0%, #4ECDC4 100%);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.route-progress-text {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.75rem;
}

.route-summary-stats {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.route-stat {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

.route-stat svg {
    width: 14px;
    height: 14px;
    stroke: #e8501d;
}

.route-stat strong {
    color: white;
}

/* Delivery Cards Container */
.delivery-cards-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: 12px;
}

/* Connection Line between cards */
.delivery-connection {
    display: flex;
    align-items: center;
    margin-left: 6px;
    padding: 0.35rem 0;
    position: relative;
}

.delivery-connection::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(255, 255, 255, 0.2);
}

.delivery-connection-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 1.5rem;
    padding: 0.35rem 0.75rem;
    background: rgba(232, 80, 29, 0.15);
    border-radius: 20px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.delivery-connection-info svg {
    width: 12px;
    height: 12px;
    stroke: #e8501d;
}

/* Individual Delivery Card */
.delivery-card {
    background: rgba(15, 35, 60, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 1rem;
    margin-left: 12px;
    position: relative;
    transition: all 0.2s ease;
}

.delivery-card:hover {
    background: rgba(20, 45, 75, 0.9);
    border-color: rgba(232, 80, 29, 0.3);
}

.delivery-card.is-start,
.delivery-card.is-end {
    background: rgba(0, 108, 170, 0.15);
    border-color: rgba(0, 108, 170, 0.3);
}

/* Sequence Number Circle */
.delivery-sequence {
    position: absolute;
    left: -24px;
    top: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.delivery-sequence.status-pending {
    background: rgba(100, 116, 139, 0.6);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.delivery-sequence.status-in_progress {
    background: linear-gradient(135deg, #006caa 0%, #0088cc 100%);
    border: 2px solid #006caa;
    animation: pulseBlue 2s infinite;
}

.delivery-sequence.status-completed {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: 2px solid #10b981;
}

.delivery-sequence.status-failed {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 2px solid #ef4444;
}

@keyframes pulseBlue {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0, 108, 170, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(0, 108, 170, 0); }
}

/* Card Header */
.delivery-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.delivery-card-title {
    flex: 1;
    min-width: 0;
}

.delivery-card-name {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.delivery-card-address {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
}

/* Status Badge (clickable) */
.delivery-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    border: none;
    background: none;
    flex-shrink: 0;
}

.delivery-status-badge:hover {
    transform: scale(1.05);
}

.delivery-status-badge svg {
    width: 12px;
    height: 12px;
}

.delivery-status-badge.status-pending {
    background: rgba(100, 116, 139, 0.3);
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.delivery-status-badge.status-in_progress {
    background: rgba(0, 108, 170, 0.2);
    color: #5eb8ff;
    border: 1px solid rgba(0, 108, 170, 0.4);
}

.delivery-status-badge.status-completed {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.delivery-status-badge.status-failed {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

/* Info Chips */
.delivery-info-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.delivery-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.6rem;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.delivery-chip svg {
    width: 12px;
    height: 12px;
    stroke: #e8501d;
    flex-shrink: 0;
}

.delivery-chip.chip-time {
    background: rgba(0, 108, 170, 0.15);
    color: #5eb8ff;
}

.delivery-chip.chip-time svg {
    stroke: #5eb8ff;
}

.delivery-chip.chip-time-out {
    background: rgba(232, 80, 29, 0.15);
    color: #ff9a6c;
}

.delivery-chip.chip-time-out svg {
    stroke: #ff9a6c;
}

/* Expandable Details */
.delivery-details {
    overflow: hidden;
    max-height: 0;
    transition: max-height 0.3s ease, padding 0.3s ease;
    border-top: 1px solid transparent;
}

.delivery-card.expanded .delivery-details {
    max-height: 250px;
    border-top-color: rgba(255, 255, 255, 0.1);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
}

.delivery-detail-row {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.delivery-detail-row:last-child {
    margin-bottom: 0;
}

.delivery-detail-label {
    color: rgba(255, 255, 255, 0.5);
    min-width: 70px;
    flex-shrink: 0;
}

.delivery-detail-value {
    color: white;
    flex: 1;
}

/* Action Buttons */
.delivery-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

.delivery-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.delivery-action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    color: white;
}

.delivery-action-btn svg {
    width: 14px;
    height: 14px;
}

.delivery-action-btn.btn-navigate {
    background: rgba(0, 108, 170, 0.2);
    border-color: rgba(0, 108, 170, 0.4);
    color: #5eb8ff;
}

.delivery-action-btn.btn-navigate:hover {
    background: rgba(0, 108, 170, 0.3);
}

/* Status Dropdown Menu */
.status-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: rgba(20, 45, 75, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 100;
    overflow: hidden;
    min-width: 160px;
}

.status-dropdown.hidden {
    display: none;
}

.status-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    color: white;
    cursor: pointer;
    transition: background 0.15s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.status-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.status-dropdown-item .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-dropdown-item .status-dot.pending { background: rgba(100, 116, 139, 0.8); }
.status-dropdown-item .status-dot.in_progress { background: #006caa; }
.status-dropdown-item .status-dot.completed { background: #10b981; }
.status-dropdown-item .status-dot.failed { background: #ef4444; }

/* Route Cards Wrapper */
.route-cards-wrapper {
    margin-bottom: 1.5rem;
}

.route-cards-wrapper:last-child {
    margin-bottom: 0;
}

/* Mobile Responsiveness for Delivery Cards */
@media (max-width: 768px) {
    .delivery-cards-container {
        padding-left: 16px;
    }

    .delivery-card {
        margin-left: 16px;
        padding: 1rem;
    }

    .delivery-sequence {
        left: -28px;
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
    }

    .delivery-card-name {
        font-size: 1.05rem;
    }

    .delivery-actions {
        flex-direction: column;
    }

    .delivery-action-btn {
        justify-content: center;
        min-height: 44px;
    }

    .route-summary-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .route-summary-vehicle-name {
        font-size: 1.05rem;
    }

    /* Status dropdown as bottom sheet on mobile */
    .status-dropdown {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        margin: 0;
        border-radius: 16px 16px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
        max-width: none;
    }

    .status-dropdown-item {
        min-height: 48px;
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
    }

    .view-toggle {
        flex-direction: row;
    }

    .view-toggle-btn {
        padding: 0.65rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* === AUTISTI SUMMARY CARD === */
.autisti-summary-card {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin: 0;
}

.autisti-summary-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #10b981;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.autisti-summary-header svg {
    flex-shrink: 0;
}

.autisti-summary-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.autista-summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 8px;
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.autista-summary-name {
    color: #f1f5f9;
    font-weight: 500;
}

.autista-summary-item > svg {
    color: #64748b;
    flex-shrink: 0;
}

.autista-summary-item .veicolo-chip {
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    margin-top: 0;
}

.autista-summary-item .veicolo-chip.assigned {
    background: rgba(16, 185, 129, 0.25);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.autista-summary-item .veicolo-chip.assigned:hover {
    background: rgba(16, 185, 129, 0.35);
}

.autista-summary-item .veicolo-chip.empty {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    border: 1px dashed rgba(255, 255, 255, 0.35);
}

@media (max-width: 768px) {
    .autisti-summary-card {
        padding: 0.875rem 1rem;
        margin-bottom: 1rem;
    }

    .autisti-summary-list {
        flex-direction: column;
        gap: 0.5rem;
    }

    .autista-summary-item {
        padding: 0.625rem 0.875rem;
    }
}

/* Google Maps InfoWindow - rimuovi sfondo bianco */
.gm-style-iw-c {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 8px !important;
    overflow: visible !important;
}

.gm-style-iw-d {
    overflow: visible !important;
    max-height: none !important;
}

.gm-style-iw-tc::after {
    background: #1a2332 !important;
}

/* Nascondi pulsante chiusura default */
.gm-style-iw-chr {
    display: none !important;
}

/* Color picker per veicoli */
.color-picker {
    width: 100%;
    height: 44px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.color-picker::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-picker::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

/* ========================================
   MOBILE RESPONSIVE FIX
   ======================================== */
@media (max-width: 768px) {
    /* Vehicle tabs scrollabili */
    .vehicle-tabs {
        margin: 0.25rem;
        padding: 0.5rem;
        gap: 0.4rem;
    }

    .vehicle-tab {
        min-width: 65px;
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .vehicle-tab-stats {
        font-size: 0.6rem;
    }

    /* Tabella punti responsive */
    .punti-table {
        font-size: 0.75rem;
    }

    .punti-table th {
        padding: 0.4rem 0.3rem;
        font-size: 0.65rem;
        background: #0a1929;
    }

    .punti-table td {
        padding: 0.4rem 0.3rem;
    }

    .punti-table .col-name {
        max-width: 100px;
    }

    .punti-table .col-address {
        max-width: 140px;
        font-size: 0.7rem;
    }

    /* Nascondi colonne meno importanti su mobile */
    .punti-table .col-window,
    .punti-table .col-metrics,
    .punti-table .col-arrival,
    .punti-table .col-note,
    .punti-table th:nth-child(n+4):not(:last-child),
    .punti-table td:nth-child(n+4):not(:last-child) {
        display: none;
    }

    /* Colonna veicolo più compatta */
    .punti-table .col-vehicle {
        width: 50px;
    }

    .vehicle-badge-mini {
        padding: 0.1rem 0.3rem;
        font-size: 0.6rem;
    }

    /* Azioni in linea */
    .punti-table .col-actions {
        width: auto;
        display: flex;
        flex-direction: row;
        gap: 0.3rem;
    }

    .punti-table .btn-icon {
        width: 32px;
        height: 32px;
        padding: 0.25rem;
    }

    .punti-table .btn-icon-sm.btn-danger.delete-btn {
        display: flex;
    }
}

/* ==================== Timeline Veicolo ==================== */
.vehicle-timeline {
    margin-top: 1.5rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: timelineFadeIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Animazione entrata timeline */
@keyframes timelineFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.timeline-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.timeline-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: white;
}

.timeline-summary {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-left: auto;
}

.timeline-track {
    position: relative;
    padding-left: 2rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.timeline-track::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: rgba(255, 255, 255, 0.15);
    animation: timelineTrackGrow 0.5s ease-out;
    transform-origin: top;
}

@keyframes timelineTrackGrow {
    from {
        transform: scaleY(0);
        opacity: 0;
    }
    to {
        transform: scaleY(1);
        opacity: 1;
    }
}

.timeline-item {
    position: relative;
    padding-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: timelineItemSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) backwards;
    flex: 1;
}

/* Staggered animation for timeline items */
.timeline-item:nth-child(1) { animation-delay: 0.05s; }
.timeline-item:nth-child(2) { animation-delay: 0.1s; }
.timeline-item:nth-child(3) { animation-delay: 0.15s; }
.timeline-item:nth-child(4) { animation-delay: 0.2s; }
.timeline-item:nth-child(5) { animation-delay: 0.25s; }
.timeline-item:nth-child(6) { animation-delay: 0.3s; }
.timeline-item:nth-child(7) { animation-delay: 0.35s; }
.timeline-item:nth-child(8) { animation-delay: 0.4s; }
.timeline-item:nth-child(9) { animation-delay: 0.45s; }
.timeline-item:nth-child(10) { animation-delay: 0.5s; }
.timeline-item:nth-child(n+11) { animation-delay: 0.55s; }

@keyframes timelineItemSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -2rem;
    top: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1e293b;
    border: 3px solid rgba(255, 255, 255, 0.3);
    z-index: 1;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-item:hover .timeline-dot {
    transform: scale(1.2);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.3);
}

.timeline-dot.start {
    background: #22c55e;
    border-color: #22c55e;
}

.timeline-dot.end {
    background: #64748b;
    border-color: #64748b;
}

.timeline-dot.job {
    background: #1e293b;
    border-width: 3px;
}

.timeline-content {
    flex: 1;
    min-width: 0;
    transition: transform 0.2s ease;
}

.timeline-item:hover .timeline-content {
    transform: translateX(4px);
}

.timeline-time {
    font-size: 0.85rem;
    font-weight: 600;
    color: #a5b4fc;
    margin-bottom: 0.2rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

/* Animazione per evidenziare cambiamenti */
.timeline-time.updated {
    animation: timelineValuePulse 0.6s ease;
}

@keyframes timelineValuePulse {
    0% {
        transform: scale(1);
        color: #a5b4fc;
    }
    50% {
        transform: scale(1.1);
        color: #22c55e;
    }
    100% {
        transform: scale(1);
        color: #a5b4fc;
    }
}

.timeline-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    margin-bottom: 0.15rem;
}

.timeline-address {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-meta {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
}

.timeline-meta span {
    margin-right: 0.25rem;
}

.timeline-urgent {
    font-size: 0.7rem;
    color: #fca5a5;
    font-weight: 500;
    margin-bottom: 0.15rem;
}

.timeline-item.urgent .timeline-dot {
    border-color: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.timeline-item.urgent .timeline-label {
    color: #fca5a5;
}

/* Timeline start/end stili specifici */
.timeline-start .timeline-label,
.timeline-end .timeline-label {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 400;
}

.timeline-start .timeline-time {
    color: #86efac;
}

.timeline-end .timeline-time {
    color: #94a3b8;
}

.timeline-window {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 500;
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 4px;
}

/* Responsive timeline */
@media (max-width: 768px) {
    .vehicle-timeline {
        margin-top: 1rem;
        padding: 0.75rem;
    }

    .timeline-header {
        flex-wrap: wrap;
    }

    .timeline-summary {
        width: 100%;
        margin-left: 0;
        margin-top: 0.25rem;
    }

    .timeline-track {
        padding-left: 1.5rem;
    }

    .timeline-dot {
        left: -1.5rem;
        width: 14px;
        height: 14px;
    }

    .timeline-label {
        font-size: 0.85rem;
    }
}

/* Vehicle separator rows in "Tutti" view */
.vehicle-separator-row {
    background: transparent !important;
}

.vehicle-separator-row td {
    padding: 0 !important;
    border: none !important;
}

.vehicle-separator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0.5rem 0.5rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.vehicle-separator-row:first-child .vehicle-separator {
    margin-top: 0;
    border-top: none;
    padding-top: 0.25rem;
}

.vehicle-separator-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    flex-shrink: 0;
}

.vehicle-separator-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vehicle-separator.unassigned .vehicle-separator-name {
    color: #718096;
}


/* ============================================ */
/* Mobile fixes - departure date + form         */
/* ============================================ */



@media (max-width: 500px) {
    /* Departure date row - compatto ma leggibile */
    .departure-date-row {
        padding: 6px 10px;
        gap: 0.4rem;
        border-radius: 8px;
        margin-bottom: 0.4rem;
    }

    .departure-date-label {
        font-size: 0.78rem;
        gap: 4px;
    }

    .departure-date-label svg {
        width: 14px;
        height: 14px;
    }

    .departure-date-input-wrap input[type="date"] {
        font-size: 0.85rem;
        padding: 5px 6px;
        min-height: 34px;
    }

    .departure-date-hint {
        font-size: 0.75rem;
    }

    /* Form - placeholder più visibili */
    .input-row input::placeholder,
    .input-row select option:first-child {
        color: rgba(255, 255, 255, 0.4);
    }

    /* Campi form opzionali - nascosti di default, visibili quando expanded */
    .input-row:not(.expanded) .time-group,
    .input-row:not(.expanded) .scarico-group,
    .input-row:not(.expanded) .veicolo-group {
        display: none !important;
    }

    .input-row.expanded .time-group,
    .input-row.expanded .scarico-group {
        display: inline-flex !important;
        width: calc(33.33% - 0.5rem);
    }

    .input-row.expanded .veicolo-group {
        display: inline-flex !important;
        width: calc(50% - 0.375rem);
    }

    /* Input campi - più touch-friendly ma compatti */
    .input-row input[type="time"],
    .input-row input[type="number"],
    .input-row select {
        min-height: 40px;
        font-size: 0.85rem;
        padding: 0.5rem;
    }

    /* Riga secondaria contatto/note */
    .input-row-secondary {
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }

    .input-row-secondary .input-group {
        flex: 1;
        min-width: calc(50% - 0.25rem);
    }

    .input-row-secondary .btn-filled {
        width: 100%;
        flex: 0 0 100%;
    }

    /* Accordion body - edit icon più grande */
    .punto-accordion-header .punto-expand-icon {
        min-width: 32px;
        min-height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Card content padding */
    .punto-accordion-header {
        padding: 0.7rem 0.75rem;
        padding-left: 2rem;
        gap: 0.5rem;
    }
}

/* Mobile field labels - hidden on desktop */
.mobile-field-label {
    display: none;
}

@media (max-width: 500px) {
    .mobile-field-label {
        display: block;
        font-size: 0.7rem;
        color: rgba(255, 255, 255, 0.5);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 2px;
        font-weight: 600;
    }
    
    /* Form opzionali - layout migliore */
    .input-row.expanded .time-group,
    .input-row.expanded .scarico-group,
    .input-row.expanded .veicolo-group {
        display: flex !important;
        flex-direction: column;
    }
    
    /* Riga orari + scarico affiancati */
    .input-row.expanded .time-group {
        width: auto;
        flex: 1;
        min-width: 0;
    }
    
    .input-row.expanded .scarico-group {
        width: auto;
        flex: 0 0 70px;
    }
    
    .input-row.expanded .veicolo-group {
        width: 100%;
        flex: 0 0 100%;
    }
    
    .input-row.expanded .veicolo-group select {
        width: 100%;
    }
}

/* ========================================
   FIX: Bottoni azioni in linea su mobile
   ======================================== */
@media (max-width: 768px) {
    .punti-table .col-actions {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
    }

    .punti-table .col-actions .btn-icon-sm {
        display: flex !important;
        width: 36px !important;
        height: 36px !important;
    }

    .punti-table .col-actions .edit-punto-btn {
        order: 1 !important;
    }

    .punti-table .col-actions .delete-btn {
        display: flex !important;
        order: 2 !important;
    }
}
