body {
    background-color: var(--tg-theme-bg-color, #090d16);
    color: var(--tg-theme-text-color, #f8fafc);
    -webkit-tap-highlight-color: transparent;
    font-size: 15px;
    overflow-x: hidden;
}

#modalDate::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
}

.custom-tag-chip {
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    touch-action: manipulation;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
}

::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.4);
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 130, 246, 0.7);
}

.slide-next-enter {
    animation: slideNext 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.slide-prev-enter {
    animation: slidePrev 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.day-fade-transition {
    animation: dayFade 0.45s ease-out forwards;
}

@keyframes slideNext {
    from {
        opacity: 0.1;
        transform: translateX(60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slidePrev {
    from {
        opacity: 0.1;
        transform: translateX(-60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes dayFade {
    from {
        opacity: 0.2;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

#pullIndicator {
    transition: transform 0.2s ease, opacity 0.2s ease;
}
/* ---- Mobile: sicurezza e comodità ---- */
/* Font 16px sugli input: evita lo zoom automatico su iOS */
@media (max-width: 640px) {
    input, select, textarea { font-size: 16px !important; }
}
/* Spazio per la barra di sistema (iPhone) su navigazione e pulsante + */
#bottomTabs { padding-bottom: calc(0.625rem + env(safe-area-inset-bottom)); }
#fabContainer { bottom: calc(84px + env(safe-area-inset-bottom)); }
/* Il contenuto non finisce sotto il pulsante + e la barra */
#calendarView, #tasksView, #lavoriView, #companiesView, #adminView { padding-bottom: 7rem; }
/* Wizard: altezza dinamica e spazio sotto */
#modalEvent > div { max-height: 94dvh; padding-bottom: max(1.25rem, env(safe-area-inset-bottom)); }
/* Barra in basso: voce attiva */
#bottomTabs .nav-tab[data-active="1"] { color: #3b82f6; }
.more-sheet-panel { padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
/* Interruttori (switch) */
.sw{appearance:none;-webkit-appearance:none;width:44px;height:24px;border-radius:999px;background:#334155;position:relative;transition:background .2s;flex-shrink:0;cursor:pointer}
.sw::after{content:"";position:absolute;top:2px;left:2px;width:20px;height:20px;border-radius:50%;background:#cbd5e1;transition:transform .2s}
.sw:checked{background:#10b981}.sw:checked::after{transform:translateX(20px);background:#fff}
.sw:disabled{opacity:.4;cursor:not-allowed}
.sw-label{min-height:44px;display:flex;align-items:center;gap:8px;cursor:pointer}