/* ================================================ */
/* 🚌 IVECO ORECCHIA MODE - CSS                     */
/* Modalità speciale per gestione mezzi Iveco       */
/* ================================================ */

/* ---- App Iveco visibile ---- */
body.iveco-mode #iveco-app {
    display: flex !important;
}

body.iveco-mode > header,
body.iveco-mode > main,
body.iveco-mode > .bottom-nav,
body.iveco-mode > #pws-particles-container,
body.iveco-mode > nav,
body.iveco-mode nav.bottom-nav,
body.dark-theme.iveco-mode nav.bottom-nav,
body.dark-theme.iveco-mode > header,
body.dark-theme.iveco-mode > main,
body.dark-theme.iveco-mode > .bottom-nav {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transform: none !important;
    position: fixed !important;
    bottom: -9999px !important;
    z-index: -1 !important;
}

/* ---- Struttura principale Iveco ---- */
#iveco-app {
    display: none;
    flex-direction: column;
    min-height: 100vh;
    background: var(--neo-bg, #E4E9F2);
    color: var(--text-primary, #333);
    font-family: var(--body-font-family, 'Poppins', sans-serif);
}

/* Header Iveco */
#iveco-header {
    display: flex;
    flex-direction: column;
    padding: 0.6rem 1.2rem 0 !important;
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-out, 4px 4px 10px rgba(0,0,0,0.1), -4px -4px 10px rgba(255,255,255,0.8));
    position: sticky;
    top: 0;
    z-index: 5000;
    overflow: visible;
    gap: 0;
    /* Sovrascrive il height:70px fisso del CSS globale (index.html) */
    height: auto !important;
    min-height: unset !important;
    box-sizing: border-box;
}

/* Override anche per dark-theme che forza height+padding su tutti gli header */
body.dark-theme #iveco-header {
    height: auto !important;
    padding: 0.6rem 1.2rem 0 !important;
}

/* Riga superiore: logo + pulsante tema */
#iveco-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 48px;
}

/* ================================================================ */
/* 🚌 BUS ANIMATO — Header Iveco                                    */
/* ================================================================ */

/* Track: riga completa sotto logo+azioni */
#iveco-bus-track {
    width: 100%;
    position: relative;
    min-height: 52px;
    height: 52px;
    overflow: visible;
    z-index: 5100;
    isolation: isolate;
    border-bottom: 2px dashed rgba(0,0,0,0.08);
    margin: 2px 0 0;
}

/* Wrapper del bus — posizionato da JS */
#iveco-bus-wrap {
    position: absolute;
    bottom: 0;
    z-index: 5200;
    left: 0;
    width: 80px;
    height: 50px;
    will-change: left;
    pointer-events: none;
}

/* SVG */
#iveco-bus-svg {
    width: 100%;
    height: 100%;
    display: block;
    position: relative;
    z-index: 1;
}

/* Dark mode */
body.dark-theme #iveco-bus-track {
    border-bottom-color: rgba(255,255,255,0.06);
}

/* Override safe-area @supports che forza height+padding su tutti i header */
@supports (padding: max(0px)) {
    #iveco-header {
        height: auto !important;
        padding-top: 0.6rem !important;
        padding-left: 1.2rem !important;
        padding-right: 1.2rem !important;
    }
}

/* ================================================================ */

#iveco-header .iveco-header-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}

#iveco-header .iveco-header-logo img {
    width: 144px;
    height: auto;
    border-radius: 0;
    object-fit: contain;
    pointer-events: none;
}

#iveco-header .iveco-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--neo-primary, #4A90D9);
    line-height: 1.1;
}

#iveco-header .iveco-header-title small {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-secondary, #666);
    letter-spacing: 1px;
    text-transform: uppercase;
}

#iveco-header .iveco-header-actions {
    display: flex;
    gap: 0.5rem;
}

#iveco-header .iveco-header-actions button {
    background: var(--neo-bg, #E4E9F2);
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--neo-out-sm, 3px 3px 6px rgba(0,0,0,0.1), -3px -3px 6px rgba(255,255,255,0.8));
    color: var(--text-primary, #333);
    transition: box-shadow 0.2s;
}

#iveco-header .iveco-header-actions button:active {
    box-shadow: var(--neo-in-sm, inset 2px 2px 5px rgba(0,0,0,0.1), inset -2px -2px 5px rgba(255,255,255,0.8));
}

/* ---- Hint swipe → sul logo (freccia animata) ---- */
#pws-logo,
#iveco-logo-wrap {
    position: relative;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

#pws-logo::after,
#iveco-logo-wrap::after {
    content: '›';
    position: absolute;
    right: -18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.4rem;
    font-weight: 900;
    color: var(--accent, #003366);
    opacity: 0;
    pointer-events: none;
    animation: swipe-hint 2.8s ease-in-out infinite;
    animation-delay: 1.5s;
}

@keyframes swipe-hint {
    0%   { opacity: 0;   transform: translateY(-50%) translateX(0);    }
    20%  { opacity: 0.7; transform: translateY(-50%) translateX(4px);  }
    45%  { opacity: 0.9; transform: translateY(-50%) translateX(10px); }
    70%  { opacity: 0.4; transform: translateY(-50%) translateX(16px); }
    100% { opacity: 0;   transform: translateY(-50%) translateX(20px); }
}

/* Nascondi i vecchi ring SVG / div */
.iveco-press-svg,
.pws-press-svg,
#iveco-header .iveco-header-logo .press-ring,
#pws-logo .long-press-ring {
    display: none !important;
}

/* ---- Contenuto sezioni ---- */
#iveco-content {
    flex: 1;
    padding: 1rem;
    padding-bottom: 90px;
    overflow-y: auto;
}

/* ---- Navigazione inferiore Iveco ---- */
#iveco-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-out, 4px 4px 10px rgba(0,0,0,0.1), -4px -4px 10px rgba(255,255,255,0.8));
    padding: 0.5rem 0;
    z-index: 5000;
    overflow: visible;
    min-height: 60px;
}

#iveco-nav .iveco-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius, 12px);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-secondary, #666);
    font-size: 0.7rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 60px;
    user-select: none;
    -webkit-user-select: none;
}

#iveco-nav .iveco-nav-item .material-symbols-outlined {
    font-size: 1.4rem;
}

#iveco-nav .iveco-nav-item.active {
    color: var(--neo-primary, #4A90D9);
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-in, inset 3px 3px 7px rgba(0,0,0,0.1), inset -3px -3px 7px rgba(255,255,255,0.8));
}

/* ---- Sezioni Iveco ---- */
.iveco-section {
    display: none;
}

.iveco-section.active {
    display: block;
}

/* ---- Card base ---- */
.iveco-card {
    background: var(--neo-bg, #E4E9F2);
    border-radius: var(--border-radius-large, 16px);
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: var(--neo-out, 4px 4px 10px rgba(0,0,0,0.1), -4px -4px 10px rgba(255,255,255,0.8));
}

.iveco-card h2, .iveco-card h3 {
    color: var(--neo-primary, #4A90D9);
    margin-bottom: 0.8rem;
    font-weight: 700;
}

/* ---- SEZIONE 1: ELENCO MEZZI ---- */
.iveco-search-bar {
    position: relative;
    margin-bottom: 1rem;
}

.iveco-search-bar input {
    width: 100%;
    padding: 0.7rem 2.5rem 0.7rem 1rem;
    border: none;
    border-radius: var(--border-radius-full, 50px);
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-in, inset 3px 3px 7px rgba(0,0,0,0.1), inset -3px -3px 7px rgba(255,255,255,0.8));
    color: var(--text-primary, #333);
    font-family: var(--body-font-family, 'Poppins', sans-serif);
    font-size: 0.9rem;
    box-sizing: border-box;
}

.iveco-search-bar input:focus {
    outline: none;
    box-shadow: var(--neo-in, inset 3px 3px 7px rgba(0,0,0,0.12), inset -3px -3px 7px rgba(255,255,255,0.9));
}

.iveco-search-bar .search-icon {
    position: absolute;
    right: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary, #666);
    font-size: 1.2rem;
    pointer-events: none;
}

/* Pulsante X cancella ricerca */
.iveco-search-clear {
    position: absolute;
    right: 2.4rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.1);
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary, #666);
    transition: background 0.15s ease;
    padding: 0;
}

.iveco-search-clear:hover {
    background: rgba(231, 76, 60, 0.18);
    color: #e74c3c;
}

.iveco-search-clear .material-symbols-outlined {
    font-size: 0.9rem;
}

.iveco-stats-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.iveco-stat-chip {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border-radius: var(--border-radius, 12px);
    box-shadow: var(--neo-out-sm, 3px 3px 6px rgba(0,0,0,0.1), -3px -3px 6px rgba(255,255,255,0.8));
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: box-shadow 0.18s ease, transform 0.15s ease, background 0.18s ease;
    user-select: none;
}

.iveco-stat-chip:hover {
    transform: scale(1.04);
}

.iveco-stat-chip:active {
    transform: scale(0.95);
}

.iveco-stat-chip.active {
    box-shadow: inset 3px 3px 7px rgba(0,0,0,0.13), inset -3px -3px 7px rgba(255,255,255,0.75);
}

.iveco-stat-chip.done.active {
    background: rgba(46, 204, 113, 0.12);
}

.iveco-stat-chip.todo.active {
    background: rgba(231, 76, 60, 0.1);
}

.iveco-stat-chip .stat-num {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--neo-primary, #4A90D9);
}

.iveco-stat-chip.done .stat-num {
    color: #2ecc71;
}

.iveco-stat-chip.todo .stat-num {
    color: #e74c3c;
}

/* Lista mezzi */
.iveco-vehicle-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.iveco-vehicle-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.75rem 1rem;
    background: var(--neo-bg, #E4E9F2);
    border-radius: var(--border-radius, 12px);
    box-shadow: var(--neo-out-sm, 3px 3px 6px rgba(0,0,0,0.1), -3px -3px 6px rgba(255,255,255,0.8));
    transition: all 0.2s ease;
    cursor: pointer;
}

.iveco-vehicle-item:hover {
    box-shadow: var(--neo-out, 4px 4px 10px rgba(0,0,0,0.12), -4px -4px 10px rgba(255,255,255,0.9));
}

.iveco-vehicle-item.completed {
    opacity: 0.6;
}

.iveco-vehicle-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-out-sm, 3px 3px 6px rgba(0,0,0,0.1), -3px -3px 6px rgba(255,255,255,0.8));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary, #666);
    flex-shrink: 0;
}

.iveco-vehicle-info {
    flex: 1;
    display: flex;
    gap: 1rem;
}

.iveco-vehicle-field {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.iveco-vehicle-field label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #666);
    margin-bottom: 0.1rem;
}

.iveco-vehicle-field span {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #333);
    letter-spacing: 1px;
}

/* ---- Badge data completamento ---- */
.iveco-done-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.6rem;
    font-weight: 700;
    color: #27ae60;
    background: rgba(46, 204, 113, 0.12);
    border: 1px solid rgba(46, 204, 113, 0.35);
    border-radius: 8px;
    padding: 4px 6px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    line-height: 1.2;
    flex-shrink: 0;
    text-align: center;
    cursor: pointer;
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.iveco-done-date:hover {
    background: rgba(46, 204, 113, 0.22);
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.25);
}

.iveco-done-date:active {
    transform: scale(0.95);
}

.iveco-done-date .material-symbols-outlined {
    font-size: 0.85rem;
    line-height: 1;
}

/* ---- Popup overlay data completamento ---- */
#iveco-date-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

#iveco-date-popup-overlay.visible {
    opacity: 1;
}

#iveco-date-popup {
    background: var(--neo-bg, #E4E9F2);
    border-radius: 20px;
    padding: 1.6rem 1.4rem;
    width: min(92%, 360px);
    box-shadow: 8px 8px 20px rgba(0,0,0,0.18), -4px -4px 14px rgba(255,255,255,0.7);
    transform: scale(0.88) translateY(18px);
    transition: transform 0.28s cubic-bezier(0.34,1.56,0.64,1), opacity 0.25s ease;
    opacity: 0;
}

#iveco-date-popup-overlay.visible #iveco-date-popup {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.iveco-date-popup-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.iveco-date-popup-header .material-symbols-outlined {
    font-size: 1.6rem;
    color: var(--neo-primary, #4A90D9);
}

.iveco-date-popup-header h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary, #333);
}

.iveco-date-popup-sub {
    font-size: 0.82rem;
    color: var(--text-secondary, #666);
    margin: 0 0 1.1rem 0;
    padding-bottom: 0.9rem;
    border-bottom: 1px solid rgba(0,0,0,0.07);
}

.iveco-date-popup-input-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.3rem;
}

.iveco-date-popup-input-wrap label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, #666);
    letter-spacing: 0.4px;
}

.iveco-date-popup-input-wrap input[type="date"] {
    width: 100%;
    padding: 0.65rem 1rem;
    border: none;
    border-radius: 12px;
    background: var(--neo-bg, #E4E9F2);
    box-shadow: inset 3px 3px 7px rgba(0,0,0,0.1), inset -3px -3px 7px rgba(255,255,255,0.8);
    color: var(--text-primary, #333);
    font-family: var(--body-font-family, 'Poppins', sans-serif);
    font-size: 1rem;
    cursor: pointer;
    transition: box-shadow 0.2s ease, border 0.2s ease;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
    outline: none;
}

.iveco-date-popup-input-wrap input[type="date"]:focus {
    box-shadow: inset 4px 4px 9px rgba(0,0,0,0.13), inset -4px -4px 9px rgba(255,255,255,0.7), 0 0 0 2px var(--neo-primary, #4A90D9);
}

.iveco-date-popup-actions {
    display: flex;
    gap: 0.75rem;
}

.iveco-date-btn {
    flex: 1;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: 12px;
    font-family: var(--body-font-family, 'Poppins', sans-serif);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.iveco-date-btn.cancel {
    background: var(--neo-bg, #E4E9F2);
    box-shadow: 4px 4px 10px rgba(0,0,0,0.1), -4px -4px 10px rgba(255,255,255,0.8);
    color: var(--text-secondary, #666);
}

.iveco-date-btn.cancel:active {
    box-shadow: inset 3px 3px 7px rgba(0,0,0,0.12), inset -3px -3px 7px rgba(255,255,255,0.7);
}

.iveco-date-btn.confirm {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    box-shadow: 0 4px 14px rgba(46,204,113,0.35);
    color: white;
}

.iveco-date-btn.confirm:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(46,204,113,0.25);
}

.iveco-date-btn .material-symbols-outlined {
    font-size: 1rem;
}

/* Check box neomorfico */
.iveco-check {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-out-sm, 3px 3px 6px rgba(0,0,0,0.1), -3px -3px 6px rgba(255,255,255,0.8));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    color: transparent;
    font-size: 1rem;
    user-select: none;
    -webkit-user-select: none;
}

.iveco-check.checked {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    box-shadow: var(--neo-in-sm, inset 2px 2px 5px rgba(0,0,0,0.2), inset -2px -2px 5px rgba(255,255,255,0.1));
    color: white;
}

.iveco-check .material-symbols-outlined {
    font-size: 1.1rem;
}

/* Empty state */
.iveco-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary, #666);
}

.iveco-empty-state .material-symbols-outlined {
    font-size: 4rem;
    opacity: 0.3;
    display: block;
    margin-bottom: 1rem;
}

/* ---- SEZIONE 2: NOTE ATM ---- */
.iveco-filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.iveco-filter-select {
    flex: 1;
    padding: 0.6rem 1rem;
    border: none;
    border-radius: var(--border-radius-full, 50px);
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-in, inset 3px 3px 7px rgba(0,0,0,0.1), inset -3px -3px 7px rgba(255,255,255,0.8));
    color: var(--text-primary, #333);
    font-family: var(--body-font-family, 'Poppins', sans-serif);
    font-size: 0.9rem;
    cursor: pointer;
}

.iveco-filter-select:focus {
    outline: none;
}

.iveco-atm-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.iveco-atm-vehicle-card {
    background: var(--neo-bg, #E4E9F2);
    border-radius: var(--border-radius, 12px);
    padding: 0.8rem;
    box-shadow: var(--neo-out, 4px 4px 10px rgba(0,0,0,0.1), -4px -4px 10px rgba(255,255,255,0.8));
}

.iveco-atm-vehicle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.iveco-atm-vehicle-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--neo-primary, #4A90D9);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.iveco-atm-vehicle-title small {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-secondary, #666);
}

.iveco-atm-note-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: all 0.3s ease;
}

.iveco-atm-note-item:last-of-type {
    border-bottom: none;
}

.iveco-atm-note-text {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary, #333);
    transition: all 0.3s ease;
}

.iveco-atm-note-item.done .iveco-atm-note-text {
    text-decoration: line-through;
    color: var(--text-secondary, #666);
}

/* Aggiunta nuova nota */
.iveco-add-note-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.7rem;
    align-items: center;
}

.iveco-add-note-input {
    flex: 1;
    padding: 0.5rem 0.8rem;
    border: none;
    border-radius: var(--border-radius-full, 50px);
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-in-sm, inset 2px 2px 5px rgba(0,0,0,0.08), inset -2px -2px 5px rgba(255,255,255,0.8));
    color: var(--text-primary, #333);
    font-family: var(--body-font-family, 'Poppins', sans-serif);
    font-size: 0.85rem;
}

.iveco-add-note-input:focus {
    outline: none;
    box-shadow: var(--neo-in, inset 3px 3px 7px rgba(0,0,0,0.1), inset -3px -3px 7px rgba(255,255,255,0.9));
}

.iveco-add-note-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-out-sm, 3px 3px 6px rgba(0,0,0,0.1), -3px -3px 6px rgba(255,255,255,0.8));
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--neo-primary, #4A90D9);
    font-size: 1.2rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.iveco-add-note-btn:active {
    box-shadow: var(--neo-in-sm, inset 2px 2px 5px rgba(0,0,0,0.1), inset -2px -2px 5px rgba(255,255,255,0.8));
}

/* Pulsante aggiungi mezzo in Note ATM */
.iveco-add-vehicle-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem;
    border: none;
    border-radius: var(--border-radius, 12px);
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-out, 4px 4px 10px rgba(0,0,0,0.1), -4px -4px 10px rgba(255,255,255,0.8));
    color: var(--neo-primary, #4A90D9);
    font-family: var(--body-font-family, 'Poppins', sans-serif);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.iveco-add-vehicle-btn:active {
    box-shadow: var(--neo-in, inset 3px 3px 7px rgba(0,0,0,0.1), inset -3px -3px 7px rgba(255,255,255,0.8));
}

/* Modal selezione mezzo per Note ATM */
.iveco-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.iveco-modal-box {
    background: var(--neo-bg, #E4E9F2);
    border-radius: var(--border-radius-large, 16px);
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--neo-out-lg, 8px 8px 20px rgba(0,0,0,0.15), -8px -8px 20px rgba(255,255,255,0.9));
}

.iveco-modal-box h3 {
    color: var(--neo-primary, #4A90D9);
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.iveco-modal-select {
    width: 100%;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: var(--border-radius, 12px);
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-in, inset 3px 3px 7px rgba(0,0,0,0.1), inset -3px -3px 7px rgba(255,255,255,0.8));
    color: var(--text-primary, #333);
    font-family: var(--body-font-family, 'Poppins', sans-serif);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

.iveco-modal-select:focus {
    outline: none;
}

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

.iveco-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius-full, 50px);
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-out-sm, 3px 3px 6px rgba(0,0,0,0.1), -3px -3px 6px rgba(255,255,255,0.8));
    color: var(--text-primary, #333);
    font-family: var(--body-font-family, 'Poppins', sans-serif);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.iveco-btn.primary {
    color: var(--neo-primary, #4A90D9);
}

.iveco-btn:active {
    box-shadow: var(--neo-in-sm, inset 2px 2px 5px rgba(0,0,0,0.1), inset -2px -2px 5px rgba(255,255,255,0.8));
}

/* ---- SEZIONE 3: AGGIUNGI (Import Excel) ---- */
.iveco-upload-zone {
    border: 2px dashed var(--neo-primary, #4A90D9);
    border-radius: var(--border-radius-large, 16px);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 1rem;
    position: relative;
}

.iveco-upload-zone.drag-over {
    background: rgba(74, 144, 217, 0.05);
    border-color: #2ecc71;
}

.iveco-upload-zone .material-symbols-outlined {
    font-size: 3rem;
    color: var(--neo-primary, #4A90D9);
    margin-bottom: 0.5rem;
    display: block;
}

.iveco-upload-zone p {
    color: var(--text-secondary, #666);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.iveco-upload-zone small {
    color: var(--text-secondary, #666);
    font-size: 0.75rem;
}

#iveco-file-input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

/* Configurazione colonne */
.iveco-col-config {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.iveco-col-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.iveco-col-field label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary, #666);
}

.iveco-col-field select {
    padding: 0.5rem 0.8rem;
    border: none;
    border-radius: var(--border-radius, 12px);
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-in-sm, inset 2px 2px 5px rgba(0,0,0,0.08), inset -2px -2px 5px rgba(255,255,255,0.8));
    color: var(--text-primary, #333);
    font-family: var(--body-font-family, 'Poppins', sans-serif);
    font-size: 0.85rem;
    cursor: pointer;
}

.iveco-col-field select:focus {
    outline: none;
}

/* Preview tabella */
.iveco-preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    overflow: hidden;
    border-radius: var(--border-radius, 12px);
}

.iveco-preview-table th {
    background: var(--neo-primary, #4A90D9);
    color: white;
    padding: 0.5rem 0.8rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iveco-preview-table td {
    padding: 0.5rem 0.8rem;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    color: var(--text-primary, #333);
}

.iveco-preview-table tr:nth-child(even) td {
    background: rgba(0,0,0,0.02);
}

.iveco-preview-table .badge-dup {
    background: #e74c3c;
    color: white;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
}

.iveco-preview-table .badge-new {
    background: #2ecc71;
    color: white;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.65rem;
    font-weight: 700;
}

.iveco-preview-table .badge-ok {
    background: #27ae60;
    color: white;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    font-weight: 700;
}

/* Barra azioni import */
.iveco-import-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.iveco-import-btn {
    flex: 1;
    min-width: 120px;
    padding: 0.8rem;
    border: none;
    border-radius: var(--border-radius, 12px);
    background: var(--neo-bg, #E4E9F2);
    box-shadow: var(--neo-out, 4px 4px 10px rgba(0,0,0,0.1), -4px -4px 10px rgba(255,255,255,0.8));
    color: var(--neo-primary, #4A90D9);
    font-family: var(--body-font-family, 'Poppins', sans-serif);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: all 0.2s;
}

.iveco-import-btn:active {
    box-shadow: var(--neo-in, inset 3px 3px 7px rgba(0,0,0,0.1), inset -3px -3px 7px rgba(255,255,255,0.8));
}

.iveco-import-btn.danger {
    color: #e74c3c;
}

/* Messaggio stato */
.iveco-status-msg {
    padding: 0.7rem 1rem;
    border-radius: var(--border-radius, 12px);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.iveco-status-msg.success {
    background: rgba(46,204,113,0.1);
    color: #27ae60;
    border-left: 4px solid #2ecc71;
}

.iveco-status-msg.warning {
    background: rgba(230,126,34,0.1);
    color: #d35400;
    border-left: 4px solid #e67e22;
}

.iveco-status-msg.info {
    background: rgba(74,144,217,0.1);
    color: var(--neo-primary, #4A90D9);
    border-left: 4px solid var(--neo-primary, #4A90D9);
}

/* ================================================================ */
/* 🌙 DARK MODE COMPLETO — eredita le variabili del sito PWS       */
/* ================================================================ */

/* Le variabili CSS del dark theme sono già definite da .dark-theme
   nel sito principale, quindi usiamo i valori che già esistono.
   Qui sovrascriviamo/aggiungiamo solo ciò che è specifico di Iveco. */

/* --- Sfondo generale app --- */
body.dark-theme #iveco-app {
    background: var(--neo-bg, #1A1A2E);
    color: var(--text-primary, #EDF0F5);
}

/* --- Header e Nav --- */
body.dark-theme #iveco-header,
body.dark-theme #iveco-nav {
    background: var(--neo-bg, #1A1A2E);
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
}

body.dark-theme #iveco-header .iveco-header-title {
    color: var(--neo-primary, #00E5CC);
}

body.dark-theme #iveco-header .iveco-header-title small {
    color: var(--text-secondary, rgba(237,240,245,0.55));
}

body.dark-theme #iveco-header .iveco-header-actions button {
    background: var(--neo-bg, #1A1A2E);
    color: var(--text-primary, #EDF0F5);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

body.dark-theme #iveco-header .iveco-header-actions button:active {
    box-shadow: inset 2px 2px 6px rgba(0,0,0,0.5);
}

/* --- Nav items --- */
body.dark-theme #iveco-nav .iveco-nav-item {
    color: var(--text-secondary, rgba(237,240,245,0.55));
}

body.dark-theme #iveco-nav .iveco-nav-item.active {
    color: var(--neo-primary, #00E5CC);
    background: rgba(0,229,204,0.08);
    box-shadow: inset 2px 2px 6px rgba(0,0,0,0.4), inset -2px -2px 6px rgba(255,255,255,0.03);
}

/* --- Card --- */
body.dark-theme .iveco-card {
    background: var(--neo-bg-light, #232342);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

body.dark-theme .iveco-card h2,
body.dark-theme .iveco-card h3 {
    color: var(--neo-primary, #00E5CC);
}

/* --- Statistiche --- */
body.dark-theme .iveco-stat-chip {
    background: var(--neo-bg, #1A1A2E);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    color: var(--text-secondary, rgba(237,240,245,0.55));
}

body.dark-theme .iveco-stat-chip.active {
    box-shadow: inset 3px 3px 7px rgba(0,0,0,0.45), inset -3px -3px 7px rgba(255,255,255,0.03);
}

body.dark-theme .iveco-stat-chip.done.active {
    background: rgba(46,204,113,0.1);
}

body.dark-theme .iveco-stat-chip.todo.active {
    background: rgba(231,76,60,0.1);
}

body.dark-theme .iveco-search-clear {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.5);
}

body.dark-theme .iveco-search-clear:hover {
    background: rgba(231,76,60,0.25);
    color: #e87d6d;
}

body.dark-theme .iveco-stat-chip .stat-num {
    color: var(--neo-primary, #00E5CC);
}

body.dark-theme .iveco-stat-chip.done .stat-num { color: #2ecc71; }
body.dark-theme .iveco-stat-chip.todo .stat-num { color: #e74c3c; }

/* --- Ricerca --- */
body.dark-theme .iveco-search-bar input {
    background: var(--neo-bg, #1A1A2E);
    color: var(--text-primary, #EDF0F5);
    box-shadow: inset 3px 3px 8px rgba(0,0,0,0.5), inset -3px -3px 8px rgba(255,255,255,0.03);
}

body.dark-theme .iveco-search-bar input::placeholder {
    color: var(--text-secondary, rgba(237,240,245,0.4));
}

body.dark-theme .iveco-search-bar .search-icon {
    color: var(--text-secondary, rgba(237,240,245,0.4));
}

/* --- Lista mezzi --- */
body.dark-theme .iveco-vehicle-item {
    background: var(--neo-bg, #1A1A2E);
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
}

body.dark-theme .iveco-vehicle-item:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

body.dark-theme .iveco-vehicle-number {
    background: var(--neo-bg-light, #232342);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    color: var(--text-secondary, rgba(237,240,245,0.55));
}

body.dark-theme .iveco-vehicle-field label {
    color: var(--text-secondary, rgba(237,240,245,0.55));
}

body.dark-theme .iveco-vehicle-field span {
    color: var(--text-primary, #EDF0F5);
}

/* --- Check --- */
body.dark-theme .iveco-check {
    background: var(--neo-bg-light, #232342);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    color: transparent;
}

body.dark-theme .iveco-check.checked {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    box-shadow: 0 0 10px rgba(46,204,113,0.4);
}

/* Miglioramenti visibilità in tema scuro: bordo leggero, icona più grande e ombra */
body.dark-theme .iveco-check {
    border: 1px solid rgba(255,255,255,0.04);
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

body.dark-theme .iveco-check .material-symbols-outlined {
    font-size: 1.2rem;
    line-height: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}

body.dark-theme .iveco-check.checked .material-symbols-outlined {
    color: white;
    filter: drop-shadow(0 2px 6px rgba(46,204,113,0.35));
}

/* --- Badge data completamento (dark) --- */
body.dark-theme .iveco-done-date {
    color: #2ecc71;
    background: rgba(46, 204, 113, 0.15);
    border-color: rgba(46, 204, 113, 0.3);
}

/* --- Popup data completamento (dark) --- */
body.dark-theme #iveco-date-popup {
    background: var(--neo-bg-light, #1e1e38);
    box-shadow: 8px 8px 24px rgba(0,0,0,0.5), -4px -4px 14px rgba(255,255,255,0.03);
}

body.dark-theme .iveco-date-popup-header h3 {
    color: var(--text-primary, #EDF0F5);
}

body.dark-theme .iveco-date-popup-sub {
    color: var(--text-secondary, rgba(237,240,245,0.55));
    border-bottom-color: rgba(255,255,255,0.07);
}

body.dark-theme .iveco-date-popup-input-wrap label {
    color: var(--text-secondary, rgba(237,240,245,0.55));
}

body.dark-theme .iveco-date-popup-input-wrap input[type="date"] {
    background: var(--neo-bg, #16162a);
    box-shadow: inset 3px 3px 7px rgba(0,0,0,0.35), inset -3px -3px 7px rgba(255,255,255,0.03);
    color: var(--text-primary, #EDF0F5);
    color-scheme: dark;
}

body.dark-theme .iveco-date-btn.cancel {
    background: var(--neo-bg-light, #1e1e38);
    box-shadow: 4px 4px 10px rgba(0,0,0,0.4), -4px -4px 10px rgba(255,255,255,0.03);
    color: var(--text-secondary, rgba(237,240,245,0.7));
}

/* --- Note ATM --- */
body.dark-theme .iveco-atm-vehicle-card {
    background: var(--neo-bg-light, #232342);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

body.dark-theme .iveco-atm-vehicle-title {
    color: var(--neo-primary, #00E5CC);
}

body.dark-theme .iveco-atm-vehicle-title small {
    color: var(--text-secondary, rgba(237,240,245,0.55));
}

body.dark-theme .iveco-atm-note-item {
    border-bottom-color: rgba(255,255,255,0.06);
}

body.dark-theme .iveco-atm-note-text {
    color: var(--text-primary, #EDF0F5);
}

body.dark-theme .iveco-atm-note-item.done .iveco-atm-note-text {
    color: var(--text-secondary, rgba(237,240,245,0.4));
}

/* --- Filtro Note ATM --- */
body.dark-theme .iveco-filter-select {
    background: var(--neo-bg, #1A1A2E);
    color: var(--text-primary, #EDF0F5);
    box-shadow: inset 3px 3px 8px rgba(0,0,0,0.5), inset -3px -3px 8px rgba(255,255,255,0.03);
}

/* --- Input aggiunta nota --- */
body.dark-theme .iveco-add-note-input {
    background: var(--neo-bg, #1A1A2E);
    color: var(--text-primary, #EDF0F5);
    box-shadow: inset 2px 2px 6px rgba(0,0,0,0.5), inset -2px -2px 6px rgba(255,255,255,0.03);
}

body.dark-theme .iveco-add-note-input::placeholder {
    color: var(--text-secondary, rgba(237,240,245,0.4));
}

body.dark-theme .iveco-add-note-input:focus {
    box-shadow: inset 3px 3px 8px rgba(0,0,0,0.5), inset -3px -3px 8px rgba(255,255,255,0.03);
}

body.dark-theme .iveco-add-note-btn {
    background: var(--neo-bg, #1A1A2E);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    color: var(--neo-primary, #00E5CC);
}

body.dark-theme .iveco-add-note-btn:active {
    box-shadow: inset 2px 2px 6px rgba(0,0,0,0.5);
}

/* --- Pulsante aggiungi mezzo Note ATM --- */
body.dark-theme .iveco-add-vehicle-btn {
    background: var(--neo-bg, #1A1A2E);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    color: var(--neo-primary, #00E5CC);
}

body.dark-theme .iveco-add-vehicle-btn:active {
    box-shadow: inset 3px 3px 8px rgba(0,0,0,0.5);
}

/* --- Bottoni generici --- */
body.dark-theme .iveco-btn {
    background: var(--neo-bg, #1A1A2E);
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    color: var(--text-primary, #EDF0F5);
}

body.dark-theme .iveco-btn.primary {
    color: var(--neo-primary, #00E5CC);
}

body.dark-theme .iveco-btn:active {
    box-shadow: inset 2px 2px 6px rgba(0,0,0,0.5);
}

/* --- Upload zone --- */
body.dark-theme .iveco-upload-zone {
    border-color: var(--neo-primary, #00E5CC);
    background: rgba(0,229,204,0.03);
}

body.dark-theme .iveco-upload-zone .material-symbols-outlined {
    color: var(--neo-primary, #00E5CC);
}

body.dark-theme .iveco-upload-zone p {
    color: var(--text-secondary, rgba(237,240,245,0.55));
}

body.dark-theme .iveco-upload-zone small {
    color: var(--text-secondary, rgba(237,240,245,0.4));
}

body.dark-theme .iveco-upload-zone.drag-over {
    background: rgba(0,229,204,0.08);
    border-color: #2ecc71;
}

/* --- Selettori colonne Excel --- */
body.dark-theme .iveco-col-field label {
    color: var(--text-secondary, rgba(237,240,245,0.55));
}

body.dark-theme .iveco-col-field select {
    background: var(--neo-bg, #1A1A2E);
    color: var(--text-primary, #EDF0F5);
    box-shadow: inset 2px 2px 6px rgba(0,0,0,0.5), inset -2px -2px 6px rgba(255,255,255,0.03);
}

/* --- Import buttons --- */
body.dark-theme .iveco-import-btn {
    background: var(--neo-bg, #1A1A2E);
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    color: var(--neo-primary, #00E5CC);
}

body.dark-theme .iveco-import-btn:active {
    box-shadow: inset 3px 3px 8px rgba(0,0,0,0.5);
}

body.dark-theme .iveco-import-btn.danger {
    color: #e74c3c;
}

/* --- Tabella preview --- */
body.dark-theme .iveco-preview-table th {
    background: var(--neo-primary, #00E5CC);
    color: #1A1A2E;
}

body.dark-theme .iveco-preview-table td {
    color: var(--text-primary, #EDF0F5);
    border-bottom-color: rgba(255,255,255,0.06);
}

body.dark-theme .iveco-preview-table tr:nth-child(even) td {
    background: rgba(255,255,255,0.03);
}

/* --- Status messages --- */
body.dark-theme .iveco-status-msg.success {
    background: rgba(46,204,113,0.12);
    color: #2ecc71;
    border-left-color: #2ecc71;
}

body.dark-theme .iveco-status-msg.warning {
    background: rgba(230,126,34,0.12);
    color: #e67e22;
    border-left-color: #e67e22;
}

body.dark-theme .iveco-status-msg.info {
    background: rgba(0,229,204,0.08);
    color: var(--neo-primary, #00E5CC);
    border-left-color: var(--neo-primary, #00E5CC);
}

/* --- Modal selezione mezzo --- */
body.dark-theme .iveco-modal-backdrop {
    background: rgba(0,0,0,0.7);
}

body.dark-theme .iveco-modal-box {
    background: var(--neo-bg-light, #232342);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

body.dark-theme .iveco-modal-box h3 {
    color: var(--neo-primary, #00E5CC);
}

body.dark-theme .iveco-modal-select {
    background: var(--neo-bg, #1A1A2E);
    color: var(--text-primary, #EDF0F5);
    box-shadow: inset 3px 3px 8px rgba(0,0,0,0.5), inset -3px -3px 8px rgba(255,255,255,0.03);
}

/* --- Empty state --- */
body.dark-theme .iveco-empty-state {
    color: var(--text-secondary, rgba(237,240,245,0.4));
}

body.dark-theme .iveco-empty-state .material-symbols-outlined {
    opacity: 0.2;
}

/* --- Testi generali nell'app Iveco in dark mode --- */
body.dark-theme #iveco-app p,
body.dark-theme #iveco-app small,
body.dark-theme #iveco-app span:not(.material-symbols-outlined):not(.stat-num) {
    color: inherit;
}

/* --- Preview info text --- */
body.dark-theme #iveco-preview-info {
    color: var(--text-secondary, rgba(237,240,245,0.55));
}

/* --- Long press ring in dark mode --- */
body.dark-theme #pws-logo.pressing .long-press-ring {
    border-top-color: var(--neo-primary, #00E5CC);
}

body.dark-theme #iveco-header .iveco-header-logo.pressing .press-ring {
    border-top-color: #e74c3c;
}

/* ---- Long press indicator sul logo PWS (modalità normale) ---- */
#pws-logo .long-press-ring {
    display: none; /* sostituito da SVG via JS */
}

body.dark-theme .pws-press-svg circle.track {
    stroke: rgba(0, 229, 204, 0.15);
}

body.dark-theme #iveco-header .iveco-header-logo.pressing .press-ring {
    border-top-color: var(--neo-primary, #00E5CC);
}

/* Animazione nota sparisce (check completato) */
@keyframes fadeSlideOut {
    0%   { opacity: 1; transform: translateX(0); max-height: 80px; }
    100% { opacity: 0; transform: translateX(60px); max-height: 0; padding: 0; margin: 0; overflow: hidden; }
}

.iveco-atm-note-item.removing {
    animation: fadeSlideOut 0.4s ease forwards;
}

/* ================================================================ */
/* 📸 GALLERIA ALLEGATI — Bottone card                              */
/* ================================================================ */
.iveco-gallery-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, rgba(100, 180, 255, 0.15), rgba(140, 120, 255, 0.15));
    color: #5b9bd5;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    outline: none;
}

.iveco-gallery-btn:hover {
    background: linear-gradient(135deg, rgba(100, 180, 255, 0.28), rgba(140, 120, 255, 0.28));
    box-shadow: 0 3px 12px rgba(91, 155, 213, 0.35);
    transform: scale(1.07);
}

.iveco-gallery-btn:active {
    transform: scale(0.93);
}

.iveco-gallery-btn .material-symbols-outlined {
    font-size: 1.35rem;
}

/* Badge contatore allegati */
.iveco-gallery-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    line-height: 1;
    border: 1.5px solid var(--bg-primary, #fff);
}

/* ================================================================ */
/* 📸 GALLERIA ALLEGATI — Popup                                     */
/* ================================================================ */
#iveco-gallery-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99998;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.28s ease;
}

#iveco-gallery-overlay.visible {
    opacity: 1;
}

#iveco-gallery-popup {
    background: var(--bg-card, #f0f4f8);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 520px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(60px);
    transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.22);
}

#iveco-gallery-overlay.visible #iveco-gallery-popup {
    transform: translateY(0);
}

/* Header */
.iveco-gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.2rem 0.8rem;
    border-bottom: 1px solid rgba(0,0,0,0.07);
    flex-shrink: 0;
}

.iveco-gallery-title {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.iveco-gallery-title .material-symbols-outlined {
    font-size: 1.8rem;
    color: #5b9bd5;
    background: rgba(91, 155, 213, 0.12);
    border-radius: 10px;
    padding: 6px;
}

.iveco-gallery-title h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #333);
}

.iveco-gallery-title small {
    font-size: 0.72rem;
    color: var(--text-secondary, #777);
}

.iveco-gallery-close {
    background: rgba(0,0,0,0.07);
    border: none;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary, #666);
    transition: background 0.18s;
}

.iveco-gallery-close:hover { background: rgba(0,0,0,0.13); }

/* Body — griglia */
.iveco-gallery-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.iveco-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.7rem;
}

.iveco-gallery-thumb {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    cursor: pointer;
}

.iveco-gallery-thumb-inner {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    background: rgba(0,0,0,0.06);
}

.iveco-gallery-thumb-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.2s ease;
}

.iveco-gallery-thumb-inner:hover img {
    transform: scale(1.05);
}

.iveco-gallery-thumb-video-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #2d3748, #1a202c);
    gap: 0.4rem;
    padding: 0.5rem;
}

.iveco-gallery-thumb-video-placeholder .material-symbols-outlined {
    font-size: 2.2rem;
    color: rgba(255,255,255,0.85);
}

.iveco-gallery-thumb-label {
    font-size: 0.55rem;
    color: rgba(255,255,255,0.6);
    text-align: center;
    word-break: break-all;
    max-height: 2.5em;
    overflow: hidden;
}

.iveco-gallery-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 6px;
    transition: background 0.18s;
}

.iveco-gallery-thumb-inner:hover .iveco-gallery-thumb-overlay {
    background: rgba(0,0,0,0.25);
}

.iveco-gallery-thumb-delete {
    background: rgba(231, 76, 60, 0.85);
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    opacity: 0;
    transition: opacity 0.18s, background 0.18s;
}

.iveco-gallery-thumb-inner:hover .iveco-gallery-thumb-delete {
    opacity: 1;
}

.iveco-gallery-thumb-delete .material-symbols-outlined {
    font-size: 1rem;
}

.iveco-gallery-thumb-name {
    font-size: 0.6rem;
    color: var(--text-secondary, #777);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Empty state */
.iveco-gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    padding: 3rem 1rem;
    color: var(--text-secondary, #999);
}

.iveco-gallery-empty .material-symbols-outlined {
    font-size: 3rem;
    opacity: 0.4;
}

.iveco-gallery-empty p {
    font-size: 0.9rem;
    margin: 0;
}

/* Footer — upload */
.iveco-gallery-footer {
    padding: 0.8rem 1rem;
    border-top: 1px solid rgba(0,0,0,0.07);
    flex-shrink: 0;
}

.iveco-gallery-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem;
    border-radius: 14px;
    background: linear-gradient(135deg, #5b9bd5, #7c6fc4);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.18s, transform 0.15s;
}

.iveco-gallery-upload-btn:hover { opacity: 0.9; transform: scale(1.01); }
.iveco-gallery-upload-btn:active { transform: scale(0.97); }

.iveco-gallery-upload-btn .material-symbols-outlined {
    font-size: 1.2rem;
}

/* Progress bar galleria */
#iveco-gallery-progress-wrap {
    padding: 0 1rem 0.8rem;
    flex-shrink: 0;
}

.iveco-gallery-progress-bar {
    background: rgba(0,0,0,0.08);
    border-radius: 99px;
    height: 6px;
    overflow: hidden;
    margin-bottom: 4px;
}

.iveco-gallery-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5b9bd5, #2ecc71);
    border-radius: 99px;
    transition: width 0.3s ease;
    width: 0%;
}

#iveco-gallery-progress-wrap small {
    font-size: 0.7rem;
    color: var(--text-secondary, #777);
}

/* ================================================================ */
/* 🖼️ LIGHTBOX                                                      */
/* ================================================================ */
#iveco-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.92);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

#iveco-lightbox.visible { opacity: 1; }

#iveco-lightbox-inner {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#iveco-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    z-index: 10;
    transition: background 0.18s;
}

#iveco-lightbox-close:hover { background: rgba(255,255,255,0.28); }
#iveco-lightbox-close .material-symbols-outlined { font-size: 1.4rem; }

#iveco-lightbox-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: rgba(255,255,255,0.7);
}

.iveco-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #5b9bd5;
    border-radius: 50%;
    animation: iveco-spin 0.8s linear infinite;
}

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

#iveco-lightbox-content {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 96vw;
    max-height: 86vh;
}

#iveco-lightbox-content img {
    max-width: 100%;
    max-height: 82vh;
    border-radius: 8px;
    object-fit: contain;
}

#iveco-lightbox-content video {
    max-width: 96vw;
    max-height: 82vh;
    border-radius: 8px;
}

#iveco-lightbox-name {
    position: absolute;
    bottom: 1.2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.55);
    color: rgba(255,255,255,0.85);
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 99px;
    white-space: nowrap;
    max-width: 80vw;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================================================================ */
/* 📎 SEZIONE UPLOAD NEL POPUP DATA COMPLETAMENTO                   */
/* ================================================================ */
.iveco-date-popup-upload-section {
    margin-top: 0.8rem;
    padding-top: 0.8rem;
}

.iveco-date-popup-upload-divider {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
}

.iveco-date-popup-upload-divider::before,
.iveco-date-popup-upload-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(0,0,0,0.1);
}

.iveco-date-popup-upload-divider span {
    font-size: 0.7rem;
    color: var(--text-secondary, #888);
    white-space: nowrap;
}

.iveco-date-popup-upload-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.6rem;
    border-radius: 12px;
    background: rgba(91, 155, 213, 0.12);
    color: #5b9bd5;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px dashed rgba(91, 155, 213, 0.4);
    transition: background 0.18s, border-color 0.18s;
}

.iveco-date-popup-upload-btn:hover {
    background: rgba(91, 155, 213, 0.2);
    border-color: rgba(91, 155, 213, 0.7);
}

.iveco-date-popup-upload-btn .material-symbols-outlined {
    font-size: 1.1rem;
}

.iveco-date-progress-bar {
    background: rgba(0,0,0,0.08);
    border-radius: 99px;
    height: 5px;
    overflow: hidden;
    margin: 0.5rem 0 0.2rem;
}

.iveco-date-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5b9bd5, #2ecc71);
    border-radius: 99px;
    transition: width 0.3s ease;
    width: 0%;
}

#iveco-date-upload-progress small {
    font-size: 0.68rem;
    color: var(--text-secondary, #777);
}

.iveco-date-upload-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 0.5rem;
}

.iveco-date-upload-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-primary, #444);
    background: rgba(46, 204, 113, 0.08);
    border-radius: 8px;
    padding: 4px 8px;
}

.iveco-date-upload-item.error {
    background: rgba(231, 76, 60, 0.08);
    color: #e74c3c;
}

.iveco-date-upload-item .material-symbols-outlined {
    font-size: 0.9rem;
    flex-shrink: 0;
}

.iveco-date-upload-ok {
    margin-left: auto;
    color: #27ae60;
    font-weight: 700;
}

/* ================================================================ */
/* 🌙 DARK THEME                                                    */
/* ================================================================ */
body.dark-theme .iveco-gallery-btn {
    background: linear-gradient(135deg, rgba(91, 155, 213, 0.18), rgba(124, 111, 196, 0.18));
    color: #7eb8e8;
}

body.dark-theme #iveco-gallery-popup {
    background: var(--bg-card, #1e2433);
}

body.dark-theme .iveco-gallery-header,
body.dark-theme .iveco-gallery-footer {
    border-color: rgba(255,255,255,0.07);
}

body.dark-theme .iveco-gallery-close {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.6);
}

body.dark-theme .iveco-gallery-thumb-inner {
    background: rgba(255,255,255,0.05);
}

body.dark-theme .iveco-gallery-thumb-name {
    color: rgba(255,255,255,0.45);
}

body.dark-theme .iveco-gallery-upload-btn {
    background: linear-gradient(135deg, #4a89c4, #6a5fb0);
}

body.dark-theme .iveco-gallery-progress-bar,
body.dark-theme .iveco-date-progress-bar {
    background: rgba(255,255,255,0.1);
}

body.dark-theme .iveco-date-popup-upload-divider::before,
body.dark-theme .iveco-date-popup-upload-divider::after {
    background: rgba(255,255,255,0.1);
}

body.dark-theme .iveco-date-popup-upload-divider span {
    color: rgba(255,255,255,0.4);
}

body.dark-theme .iveco-date-popup-upload-btn {
    background: rgba(91,155,213,0.1);
    border-color: rgba(91,155,213,0.3);
    color: #7eb8e8;
}

body.dark-theme .iveco-date-upload-item {
    background: rgba(46,204,113,0.07);
    color: rgba(255,255,255,0.75);
}

body.dark-theme .iveco-date-upload-item.error {
    background: rgba(231,76,60,0.08);
    color: #e87d6d;
}

#iveco-bus-custom-img {
    position: relative;
    z-index: 2;
}


